summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2004-01-13 21:35:39 +0000
committersos <sos@FreeBSD.org>2004-01-13 21:35:39 +0000
commit04c923e6c53ed6d2d794decfac6c399f21122c85 (patch)
treeedd7e0946032775ce42d3defcfae893545ae8e19
parentb6e75a26df545d8fa52af1d4bfd2e542abbdb260 (diff)
downloadFreeBSD-src-04c923e6c53ed6d2d794decfac6c399f21122c85.zip
FreeBSD-src-04c923e6c53ed6d2d794decfac6c399f21122c85.tar.gz
Fix ata_getparam to accept the fact that some crappy devices can pose as
both master and slave at the same time confusing the probe code.
-rw-r--r--sys/dev/ata/ata-all.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 05f40c2..f8bccf1 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -563,13 +563,13 @@ ata_getparam(struct ata_device *atadev, u_int8_t command)
if (request) {
request->device = atadev;
request->u.ata.command = command;
- request->flags = (ATA_R_READ | ATA_R_AT_HEAD);
+ request->flags = (ATA_R_READ | ATA_R_AT_HEAD | ATA_R_QUIET);
request->data = (caddr_t)atadev->param;
request->timeout = 2;
request->retries = 3;
request->bytecount = sizeof(struct ata_params);
request->transfersize = DEV_BSIZE;
- while (request->retries) {
+ while (request->retries > 0 ) {
ata_queue_request(request);
if (!(error = request->result))
break;
@@ -577,14 +577,8 @@ ata_getparam(struct ata_device *atadev, u_int8_t command)
}
ata_free_request(request);
}
- if (!isprint(atadev->param->model[0]) ||
- !isprint(atadev->param->model[1]))
- error = ENXIO;
- if (error) {
- free(atadev->param, M_ATA);
- atadev->param = NULL;
- }
- else {
+ if (!error && (isprint(atadev->param->model[0]) ||
+ isprint(atadev->param->model[1]))) {
struct ata_params *atacap = atadev->param;
#if BYTE_ORDER == BIG_ENDIAN
int16_t *ptr;
@@ -613,6 +607,14 @@ ata_getparam(struct ata_device *atadev, u_int8_t command)
ata_umode(atacap),
(atacap->hwres & ATA_CABLE_ID) ? "80":"40");
}
+ else {
+ if (!error)
+ error = ENXIO;
+ if (atadev->param) {
+ free(atadev->param, M_ATA);
+ atadev->param = NULL;
+ }
+ }
}
return error;
}
OpenPOWER on IntegriCloud