Add a new flag to wdc_command: ATA_READREG. This will indicate that all

device registers should be read back into the wdc_command structure after
successfull command completion.  Use this this in wdioctl() for
ATAIOCCOMMAND.
This commit is contained in:
kenh 1998-11-23 23:00:26 +00:00
parent 42d7790133
commit 48f2e0ae6c
2 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: atavar.h,v 1.5 1998/11/20 01:23:52 thorpej Exp $ */
/* $NetBSD: atavar.h,v 1.6 1998/11/23 23:00:26 kenh Exp $ */
/*
* Copyright (c) 1998 Manuel Bouyer.
@ -111,6 +111,7 @@ struct wdc_command {
#define AT_ERROR 0x0040 /* command is done with error */
#define AT_TIMEOU 0x0040 /* command timed out */
#define AT_DF 0x0080 /* Drive fault */
#define AT_READREG 0x0100 /* Read registers on completion */
int timeout; /* timeout (in ms) */
void *data; /* Data buffer address */
int bcount; /* number of bytes to transfer */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wd.c,v 1.187 1998/11/20 01:23:52 thorpej Exp $ */
/* $NetBSD: wd.c,v 1.188 1998/11/23 23:00:27 kenh Exp $ */
/*
* Copyright (c) 1998 Manuel Bouyer. All rights reserved.
@ -1384,6 +1384,9 @@ wdioctlstrategy(bp)
else if (wi->wi_atareq.flags & ATACMD_WRITE)
wdc_c.flags |= AT_WRITE;
if (wi->wi_atareq.flags & ATACMD_READREG)
wdc_c.flags |= AT_READREG;
wdc_c.flags |= AT_WAIT;
wdc_c.timeout = wi->wi_atareq.timeout;
@ -1403,7 +1406,6 @@ wdioctlstrategy(bp)
goto bad;
}
if (wdc_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) {
if (wdc_c.flags & AT_ERROR) {
wi->wi_atareq.retsts = ATACMD_ERROR;
@ -1412,8 +1414,17 @@ wdioctlstrategy(bp)
wi->wi_atareq.retsts = ATACMD_DF;
else
wi->wi_atareq.retsts = ATACMD_TIMEOUT;
} else
} else {
wi->wi_atareq.retsts = ATACMD_OK;
if (wi->wi_atareq.flags & ATACMD_READREG) {
wi->wi_atareq.head = wdc_c.r_head ;
wi->wi_atareq.cylinder = wdc_c.r_cyl;
wi->wi_atareq.sec_num = wdc_c.r_sector;
wi->wi_atareq.sec_count = wdc_c.r_count;
wi->wi_atareq.features = wdc_c.r_precomp;
wi->wi_atareq.error = wdc_c.r_error;
}
}
bp->b_error = 0;
biodone(bp);