diff options
author | jkh <jkh@FreeBSD.org> | 1995-09-30 00:11:19 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-09-30 00:11:19 +0000 |
commit | 058de844cdff0cda5d175b49612ac08d86b32fe8 (patch) | |
tree | 87850db51be9ef4ddcbde09f254a9ce4d20d0f96 /sys/i386/isa/wd.c | |
parent | 695113e9d5998d28cba0ecf50b6822ea07c2921c (diff) | |
download | FreeBSD-src-058de844cdff0cda5d175b49612ac08d86b32fe8.zip FreeBSD-src-058de844cdff0cda5d175b49612ac08d86b32fe8.tar.gz |
Bring IDE CDROM support up to latest version (1.8a?) from Serge.
Submitted by: vak@cronyx.ru
Diffstat (limited to 'sys/i386/isa/wd.c')
-rw-r--r-- | sys/i386/isa/wd.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 66f16e0..2fe5fda 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.83 1995/09/06 05:06:18 dyson Exp $ + * $Id: wd.c,v 1.84 1995/09/07 08:20:18 swallace Exp $ */ /* TODO: @@ -299,6 +299,7 @@ wdprobe(struct isa_device *dvp) wdc_registerdev(dvp); /* check if we have registers that work */ + outb(du->dk_port + wd_sdh, WDSD_IBM); /* set unit 0 */ outb(du->dk_port + wd_cyl_lo, 0xa5); /* wd_cyl_lo is read/write */ if (inb(du->dk_port + wd_cyl_lo) == 0xff) /* XXX too weak */ goto nodevice; @@ -1900,22 +1901,30 @@ wdflushirq(struct disk *du, int old_ipl) static int wdreset(struct disk *du) { - int wdc; + int wdc, err; wdc = du->dk_port; (void)wdwait(du, 0, TIMEOUT); outb(wdc + wd_ctlr, WDCTL_IDS | WDCTL_RST); DELAY(10 * 1000); outb(wdc + wd_ctlr, WDCTL_IDS); - if (wdwait(du, 0, TIMEOUT) != 0) - return (1); - du->dk_status = inb(wdc + wd_status); + err = 0; + if (wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) != 0) + err = 1; /* no IDE drive found */ du->dk_error = inb(wdc + wd_error); - if ((du->dk_status & ~(WDCS_READY | WDCS_SEEKCMPLT)) != 0 || - du->dk_error != 0x01) - return (1); + if (du->dk_error != 0x01) + err = 1; /* the drive is incompatible */ +#ifdef ATAPI + if (err) { + /* no IDE drive, test for ATAPI signature */ + int lo = inb(wdc + wd_cyl_lo); + int hi = inb(wdc + wd_cyl_hi); + if (lo == 0x14 && hi == 0xeb) + err = 0; /* ATAPI drive detected */ + } +#endif outb(wdc + wd_ctlr, WDCTL_4BIT); - return (0); + return (err); } /* |