diff options
author | sos <sos@FreeBSD.org> | 2006-03-07 16:05:38 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2006-03-07 16:05:38 +0000 |
commit | 0c7a140bbca8a87747deb587329425902ddca82a (patch) | |
tree | d5e05c1afcab499e2b7e3ccc060857986613bff1 | |
parent | d56d32f380476f2adf17e0474ee0859129612c6e (diff) | |
download | FreeBSD-src-0c7a140bbca8a87747deb587329425902ddca82a.zip FreeBSD-src-0c7a140bbca8a87747deb587329425902ddca82a.tar.gz |
Poll device for readiness before trying to get geometry etc.
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 9dbd824..b4e6c8b 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -181,7 +181,7 @@ afd_open(struct disk *dp) atadev->flags &= ~ATA_D_MEDIA_CHANGED; if (!fdp->mediasize) - return EIO; + return ENXIO; fdp->disk->d_sectorsize = fdp->sectorsize; fdp->disk->d_mediasize = fdp->mediasize; @@ -308,10 +308,12 @@ afd_sense(device_t dev) 0, 0, 0, 0, sizeof(struct afd_capabilities) >> 8, sizeof(struct afd_capabilities) & 0xff, 0, 0, 0, 0, 0, 0, 0 }; + int timeout = 20; int count; - afd_test_ready(dev); - fdp->mediasize = 0; + /* wait for device to get ready */ + while (afd_test_ready(dev) && timeout--) + DELAY(100000); /* The IOMEGA Clik! doesn't support reading the cap page, fake it */ if (!strncmp(atadev->param.model, "IOMEGA Clik!", 12)) { @@ -361,6 +363,7 @@ afd_sense(device_t dev) return 0; } } + fdp->mediasize = 0; return 1; } |