diff options
| author | jakllsch <jakllsch@NetBSD.org> | 2013-02-03 20:13:27 +0000 |
|---|---|---|
| committer | jakllsch <jakllsch@NetBSD.org> | 2013-02-03 20:13:27 +0000 |
| commit | 31e883c3eb02f10de14d5f73c0daf25fcb534ee8 (patch) | |
| tree | 3ac95d3613cec57c9bb384c2c45ceee4f55ba3eb /sys/dev/ic | |
| parent | 757d80e9b7eb41dccbd618dc06db4252002538cc (diff) | |
Add argument to wdccommandext() to allow the entire contents of the
device/head register to be specified. Needed for upcoming port multipler
support in mvsata(4).
Diffstat (limited to 'sys/dev/ic')
| -rw-r--r-- | sys/dev/ic/mvsata.c | 9 | ||||
| -rw-r--r-- | sys/dev/ic/wdc.c | 20 | ||||
| -rw-r--r-- | sys/dev/ic/wdcvar.h | 4 |
3 files changed, 19 insertions, 14 deletions
diff --git a/sys/dev/ic/mvsata.c b/sys/dev/ic/mvsata.c index 86dc85c1446..49fd3e56d02 100644 --- a/sys/dev/ic/mvsata.c +++ b/sys/dev/ic/mvsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: mvsata.c,v 1.24 2012/07/31 15:50:34 bouyer Exp $ */ +/* $NetBSD: mvsata.c,v 1.25 2013/02/03 20:13:28 jakllsch Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.24 2012/07/31 15:50:34 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.25 2013/02/03 20:13:28 jakllsch Exp $"); #include "opt_mvsata.h" @@ -1174,7 +1174,7 @@ do_pio: } if (ata_bio->flags & ATA_LBA48) wdccommandext(chp, xfer->c_drive, atacmd_to48(cmd), - (uint64_t)ata_bio->blkno, nblks, 0); + ata_bio->blkno, nblks, 0, WDSD_LBA); else wdccommand(chp, xfer->c_drive, cmd, cyl, head, sect, nblks, @@ -1553,7 +1553,8 @@ mvsata_wdc_cmd_start(struct ata_channel *chp, struct ata_xfer *xfer) MVSATA_WDC_WRITE_1(mvport, SRB_CAS, WDCTL_4BIT | WDCTL_IDS); if ((ata_c->flags & AT_LBA48) != 0) { wdccommandext(chp, drive, ata_c->r_command, - ata_c->r_lba, ata_c->r_count, ata_c->r_features); + ata_c->r_lba, ata_c->r_count, ata_c->r_features, + ata_c->r_device & ~0x10); } else { wdccommand(chp, drive, ata_c->r_command, (ata_c->r_lba >> 8) & 0xffff, diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index ad2faa8082d..1927355cf6a 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.276 2012/12/19 14:05:29 kiyohara Exp $ */ +/* $NetBSD: wdc.c,v 1.277 2013/02/03 20:13:28 jakllsch Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.276 2012/12/19 14:05:29 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.277 2013/02/03 20:13:28 jakllsch Exp $"); #include "opt_ata.h" #include "opt_wdc.h" @@ -1472,7 +1472,8 @@ __wdccommand_start(struct ata_channel *chp, struct ata_xfer *xfer) } if ((ata_c->flags & AT_LBA48) != 0) { wdccommandext(chp, drive, ata_c->r_command, - ata_c->r_lba, ata_c->r_count, ata_c->r_features); + ata_c->r_lba, ata_c->r_count, ata_c->r_features, + ata_c->r_device & ~0x10); } else { wdccommand(chp, drive, ata_c->r_command, (ata_c->r_lba >> 8) & 0xffff, @@ -1776,22 +1777,25 @@ wdccommand(struct ata_channel *chp, u_int8_t drive, u_int8_t command, */ void wdccommandext(struct ata_channel *chp, u_int8_t drive, u_int8_t command, - u_int64_t blkno, u_int16_t count, u_int16_t features) + u_int64_t blkno, u_int16_t count, u_int16_t features, u_int8_t device) { struct wdc_softc *wdc = CHAN_TO_WDC(chp); struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; - ATADEBUG_PRINT(("wdccommandext %s:%d:%d: command=0x%x blkno=%d " - "count=%d\n", device_xname(chp->ch_atac->atac_dev), - chp->ch_channel, drive, command, (u_int32_t) blkno, count), + ATADEBUG_PRINT(("wdccommandext %s:%d:%d: command=0x%02x " + "blkno=0x%012"PRIx64" count=0x%04x features=0x%04x " + "device=0x%02x\n", device_xname(chp->ch_atac->atac_dev), + chp->ch_channel, drive, command, blkno, count, features, device), DEBUG_FUNCS); + KASSERT(drive < wdc->wdc_maxdrives); + if (wdc->select) wdc->select(chp,drive); /* Select drive, head, and addressing mode. */ bus_space_write_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0, - (drive << 4) | WDSD_LBA); + (drive << 4) | device); if (wdc->cap & WDC_CAPABILITY_WIDEREGS) { bus_space_write_2(wdr->cmd_iot, wdr->cmd_iohs[wd_features], diff --git a/sys/dev/ic/wdcvar.h b/sys/dev/ic/wdcvar.h index cc9abb63d16..2548221bc2f 100644 --- a/sys/dev/ic/wdcvar.h +++ b/sys/dev/ic/wdcvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wdcvar.h,v 1.96 2012/11/19 22:22:56 rkujawa Exp $ */ +/* $NetBSD: wdcvar.h,v 1.97 2013/02/03 20:13:28 jakllsch Exp $ */ /*- * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc. @@ -166,7 +166,7 @@ int wdc_dmawait(struct ata_channel *, struct ata_xfer *, int); void wdccommand(struct ata_channel *, u_int8_t, u_int8_t, u_int16_t, u_int8_t, u_int8_t, u_int8_t, u_int8_t); void wdccommandext(struct ata_channel *, u_int8_t, u_int8_t, u_int64_t, - u_int16_t, u_int16_t); + u_int16_t, u_int16_t, u_int8_t); void wdccommandshort(struct ata_channel *, int, int); void wdctimeout(void *arg); void wdc_reset_drive(struct ata_drive_datas *, int, uint32_t *); |
