Date: Thu, 21 Mar 2002 20:24:43 -0800 From: "Sam Leffler" <sam@errno.com> To: "Jon Larssen" <jonlarssen@hotmail.com>, <freebsd-stable@FreeBSD.ORG> Subject: Re: Is ATA partially broken in -STABLE? Message-ID: <3f4201c1d159$7e73fe30$52557f42@errno.com> References: <F67M19VMczi9yzu23Li00008fa7@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
This is a regression introduced in rev 1.50.2.30. The asleep+await calls
that closed two races in the driver were removed. Soren is aware of it.
Attached is a patch that fixes it for me.
Sam
----- Original Message -----
From: "Jon Larssen" <jonlarssen@hotmail.com>
To: <freebsd-stable@FreeBSD.ORG>
Sent: Thursday, March 21, 2002 7:36 PM
Subject: Is ATA partially broken in -STABLE?
> Hi,
>
> I have just cvsup'd my -STABLE system running under VMware 3
> Workstation under Windows 2000. After making world and a
> GENERIC kernel I can't boot into my system. These are the
> messages I get:
>
> ata0-master: timeout waiting for interrupt
> ata0-master: ATA identify failed
> ata1-master: timeout waiting for interrupt
> ata1-master: ATAPI identify failed
> Mounting root from ufs:/dev/ad0s1a
> no such device 'ad'
> setrootbyname failed
>
> and then of course will of course ask me to manually supply
> the boot filesystem. What's is strange is that I kept an old
> kernel that _does_ boot and finds ad.
>
> Is ATA support semi-broken or I am the one broken? :^)
>
> Best regards,
> Jon.
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-stable" in the body of the message
>
>
[-- Attachment #2 --]
Index: ata-all.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.50.2.30
diff -u -r1.50.2.30 ata-all.c
--- ata-all.c 2002/03/18 08:37:33 1.50.2.30
+++ ata-all.c 2002/03/22 04:23:26
@@ -1039,13 +1039,14 @@
case ATA_WAIT_INTR:
atadev->channel->active |= ATA_WAIT_INTR;
+ asleep((caddr_t)atadev->channel, PRIBIO, "atacmd", 10 * hz);
ATA_OUTB(atadev->channel->r_io, ATA_CMD, command);
/* enable interrupt */
if (atadev->channel->flags & ATA_QUEUED)
ATA_OUTB(atadev->channel->r_altio, ATA_ALTSTAT, ATA_A_4BIT);
- if (tsleep((caddr_t)atadev->channel, PRIBIO, "atacmd", 10 * hz)) {
+ if (await(PRIBIO, 10 * hz)) {
ata_prtdev(atadev, "timeout waiting for interrupt\n");
atadev->channel->active &= ~ATA_WAIT_INTR;
error = -1;
Index: atapi-all.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/atapi-all.c,v
retrieving revision 1.46.2.12
diff -u -r1.46.2.12 atapi-all.c
--- atapi-all.c 2002/03/18 08:37:33 1.46.2.12
+++ atapi-all.c 2002/03/22 04:23:27
@@ -202,28 +202,41 @@
ata_prtdev(atadev, "queueing %s ", atapi_cmd2str(request->ccb[0]));
atapi_dump("ccb = ", &request->ccb[0], sizeof(request->ccb));
#endif
- /* append onto controller queue and try to start controller */
- s = splbio();
- if (flags & ATPR_F_AT_HEAD)
- TAILQ_INSERT_HEAD(&atadev->channel->atapi_queue, request, chain);
- else
- TAILQ_INSERT_TAIL(&atadev->channel->atapi_queue, request, chain);
- splx(s);
- ata_start(atadev->channel);
-
- /* if callback used, then just return, gets called from interrupt context */
- if (callback)
+ if (callback) {
+ /*
+ * If callback used, then just return,
+ * gets called from interrupt context.
+ */
+ s = splbio();
+ /* append onto controller queue and try to start controller */
+ if (flags & ATPR_F_AT_HEAD)
+ TAILQ_INSERT_HEAD(&atadev->channel->atapi_queue, request, chain);
+ else
+ TAILQ_INSERT_TAIL(&atadev->channel->atapi_queue, request, chain);
+ ata_start(atadev->channel);
+ splx(s);
return 0;
+ } else {
+ s = splbio();
+ asleep((caddr_t)request, PRIBIO, "atprq", 0);
+ /* append onto controller queue and try to start controller */
+ if (flags & ATPR_F_AT_HEAD)
+ TAILQ_INSERT_HEAD(&atadev->channel->atapi_queue, request, chain);
+ else
+ TAILQ_INSERT_TAIL(&atadev->channel->atapi_queue, request, chain);
+ ata_start(atadev->channel);
+ /* wait for request to complete */
+ await(PRIBIO, 0);
+ splx(s);
- /* wait for request to complete */
- tsleep((caddr_t)request, PRIBIO, "atprq", 0);
- error = request->error;
- if (error)
- bcopy(&request->sense, atadev->result, sizeof(struct atapi_reqsense));
- if (request->dmatab)
- free(request->dmatab, M_DEVBUF);
- free(request, M_ATAPI);
- return error;
+ error = request->error;
+ if (error)
+ bcopy(&request->sense, atadev->result, sizeof(struct atapi_reqsense));
+ if (request->dmatab)
+ free(request->dmatab, M_DEVBUF);
+ free(request, M_ATAPI);
+ return error;
+ }
}
void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3f4201c1d159$7e73fe30$52557f42>
