summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/atapi.c
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>1995-09-09 11:41:04 +0000
committersos <sos@FreeBSD.org>1995-09-09 11:41:04 +0000
commit963f4486b05c8ad4bf733678713126e013fbf757 (patch)
treeca13751bd7346bb88c2b3755228c1e856ebc6556 /sys/i386/isa/atapi.c
parentb621bdb82560ba416ec34ef1b3eba16ee6a733ec (diff)
downloadFreeBSD-src-963f4486b05c8ad4bf733678713126e013fbf757.zip
FreeBSD-src-963f4486b05c8ad4bf733678713126e013fbf757.tar.gz
Patch to the atapi driver, by Serge V.Vakulenko, minor changes
by me... Original message: This patch upgrades the ATAPI CD-ROM driver to version 1.3. It has three bugs fixed: 1) The `controller not ready' message at startup and later. It was caused by staled media change bit. 2) Incorrect shuffling of model string for some drives (NEC, Mitsumi). 3) Handling of drives which report itself as been of direct-access type, instead of CD-ROM type. There is one known bug which is not fixed yet -- probing in absense of IDE disks. A work-around exists though (thanks Steve!). If you have no IDE disks attached, then remove them from the kernel config file to make the CD-ROM attach correctly. Unfortunately, there is no way to disable them from the kernel interactive config mode. Reviewed by: sos (Soren Schmidt) Submitted by: vak@gw.cronyx.msk.su (Serge V.Vakulenko)
Diffstat (limited to 'sys/i386/isa/atapi.c')
-rw-r--r--sys/i386/isa/atapi.c56
1 files changed, 32 insertions, 24 deletions
diff --git a/sys/i386/isa/atapi.c b/sys/i386/isa/atapi.c
index c620b55..75e18a4 100644
--- a/sys/i386/isa/atapi.c
+++ b/sys/i386/isa/atapi.c
@@ -11,7 +11,7 @@
* or modify this software as long as this message is kept with the software,
* all derivative works or modified versions.
*
- * Version 1.1, Mon Jul 10 21:55:11 MSD 1995
+ * Version 1.3, Mon Aug 28 21:44:01 MSD 1995
*/
/*
@@ -101,7 +101,6 @@
#include "wdc.h"
#include "wcd.h"
-/* #include "whd.h" -- add your driver here */
/* #include "wmt.h" -- add your driver here */
/* #include "wmd.h" -- add your driver here */
@@ -243,14 +242,22 @@ void atapi_attach (int ctlr, int unit, int port, struct kern_devconf *parent)
return;
}
switch (ap->devtype) {
- default:
- /* unknown ATAPI device */
- printf ("wdc%d: unit %d: unknown ATAPI type=%d\n",
+ default: /* unknown ATAPI device */
+ printf ("wdc%d: unit %d: unknown ATAPI device type=%d\n",
ctlr, unit, ap->devtype);
break;
+
+ case AT_TYPE_DIRECT: /* direct-access (magnetic disk) */
+#if NWHD > 0
+ /* Add your driver here */
+#else
+ printf ("wdc%d: ATAPI hard disks not supported\n", ctlr);
+ printf ("wdc%d: Could be old ATAPI CDROM, trying...\n", ctlr);
+ break;
+#endif
+
case AT_TYPE_CDROM: /* CD-ROM device */
#if NWCD > 0
- /* ATAPI CD-ROM */
{
int wcdattach (struct atapi*, int, struct atapi_params*,
int, struct kern_devconf*);
@@ -263,25 +270,20 @@ void atapi_attach (int ctlr, int unit, int port, struct kern_devconf *parent)
printf ("wdc%d: ATAPI CD-ROMs not configured\n", ctlr);
break;
#endif
- case AT_TYPE_DIRECT: /* direct-access (magnetic disk) */
-#if NWHD > 0
- /* Add your driver here */
-#else
- printf ("wdc%d: ATAPI hard disks not supported\n", ctlr);
- break;
-#endif
+
case AT_TYPE_TAPE: /* streaming tape (QIC-121 model) */
#if NWMT > 0
/* Add your driver here */
#else
- printf ("wdc%d: ATAPI streaming tapes not supported yet\n", ctlr);
+ printf ("wdc%d: ATAPI streaming tapes not supported\n", ctlr);
break;
#endif
+
case AT_TYPE_OPTICAL: /* optical disk */
#if NWMD > 0
/* Add your driver here */
#else
- printf ("wdc%d: ATAPI optical disks not supported yet\n", ctlr);
+ printf ("wdc%d: ATAPI optical disks not supported\n", ctlr);
break;
#endif
}
@@ -336,10 +338,15 @@ static struct atapi_params *atapi_probe (int port, int unit)
return (0);
bcopy (tb, ap, sizeof *ap);
- /* Shuffle string byte order. */
- for (i=0; i<sizeof(ap->model); i+=2) {
- u_short *p = (u_short*) (ap->model + i);
- *p = ntohs (*p);
+ /*
+ * Shuffle string byte order.
+ * Mitsumi and NEC drives don't need this.
+ */
+ if (! ((ap->model[0] == 'N' && ap->model[1] == 'E') ||
+ (ap->model[0] == 'F' && ap->model[1] == 'X'))) {
+ u_short *p = (u_short*) (ap->model + sizeof(ap->model));
+ while (--p >= (u_short*) ap->model)
+ *p = ntohs (*p);
}
/* Clean up the model by converting nulls to spaces, and
@@ -580,12 +587,13 @@ int atapi_io (struct atapi *ata, struct atapicmd *ac)
u_char ireason;
u_short len;
- if (atapi_wait (ata->port, ac->count ? ARS_DRQ : 0) < 0) {
- printf ("atapi%d.%d: controller not ready\n",
- ata->ctrlr, ac->unit);
+ if (atapi_wait (ata->port, 0) < 0) {
+ ac->result.status = inb (ata->port + AR_STATUS);
+ ac->result.error = inb (ata->port + AR_ERROR);
ac->result.code = RES_NOTRDY;
- ac->result.status = 0;
- ac->result.error = 0;
+ printf ("atapi%d.%d: controller not ready, status=%b, error=%b\n",
+ ata->ctrlr, ac->unit, ac->result.status, ARS_BITS,
+ ac->result.error, AER_BITS);
return (0);
}
OpenPOWER on IntegriCloud