Skip site navigation (1)Skip section navigation (2)
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
This is a multi-part message in MIME format.

------=_NextPart_000_3F3F_01C1D116.6FBDF410
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: 7bit

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
>
>

------=_NextPart_000_3F3F_01C1D116.6FBDF410
Content-Type: application/octet-stream;
	name="ata-patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ata-patch"

Index: ata-all.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v=0A=
retrieving revision 1.50.2.30=0A=
diff -u -r1.50.2.30 ata-all.c=0A=
--- ata-all.c	2002/03/18 08:37:33	1.50.2.30=0A=
+++ ata-all.c	2002/03/22 04:23:26=0A=
@@ -1039,13 +1039,14 @@=0A=
 =0A=
     case ATA_WAIT_INTR:=0A=
 	atadev->channel->active |=3D ATA_WAIT_INTR;=0A=
+	asleep((caddr_t)atadev->channel, PRIBIO, "atacmd", 10 * hz);=0A=
 	ATA_OUTB(atadev->channel->r_io, ATA_CMD, command);=0A=
 =0A=
 	/* enable interrupt */=0A=
 	if (atadev->channel->flags & ATA_QUEUED)=0A=
 	    ATA_OUTB(atadev->channel->r_altio, ATA_ALTSTAT, ATA_A_4BIT);=0A=
 =0A=
-	if (tsleep((caddr_t)atadev->channel, PRIBIO, "atacmd", 10 * hz)) {=0A=
+	if (await(PRIBIO, 10 * hz)) {=0A=
 	    ata_prtdev(atadev, "timeout waiting for interrupt\n");=0A=
 	    atadev->channel->active &=3D ~ATA_WAIT_INTR;=0A=
 	    error =3D -1;=0A=
Index: atapi-all.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /home/ncvs/src/sys/dev/ata/atapi-all.c,v=0A=
retrieving revision 1.46.2.12=0A=
diff -u -r1.46.2.12 atapi-all.c=0A=
--- atapi-all.c	2002/03/18 08:37:33	1.46.2.12=0A=
+++ atapi-all.c	2002/03/22 04:23:27=0A=
@@ -202,28 +202,41 @@=0A=
     ata_prtdev(atadev, "queueing %s ", atapi_cmd2str(request->ccb[0]));=0A=
     atapi_dump("ccb =3D ", &request->ccb[0], sizeof(request->ccb));=0A=
 #endif=0A=
-    /* append onto controller queue and try to start controller */=0A=
-    s =3D splbio();=0A=
-    if (flags & ATPR_F_AT_HEAD)=0A=
-	TAILQ_INSERT_HEAD(&atadev->channel->atapi_queue, request, chain);=0A=
-    else=0A=
-	TAILQ_INSERT_TAIL(&atadev->channel->atapi_queue, request, chain);=0A=
-    splx(s);=0A=
-    ata_start(atadev->channel);=0A=
-=0A=
-    /* if callback used, then just return, gets called from interrupt =
context */=0A=
-    if (callback)=0A=
+    if (callback) {=0A=
+	/*=0A=
+	 * If callback used, then just return,=0A=
+	 * gets called from interrupt context.=0A=
+	 */=0A=
+	s =3D splbio();=0A=
+	/* append onto controller queue and try to start controller */=0A=
+	if (flags & ATPR_F_AT_HEAD)=0A=
+	    TAILQ_INSERT_HEAD(&atadev->channel->atapi_queue, request, chain);=0A=
+	else=0A=
+	    TAILQ_INSERT_TAIL(&atadev->channel->atapi_queue, request, chain);=0A=
+	ata_start(atadev->channel);=0A=
+	splx(s);=0A=
 	return 0;=0A=
+    } else {=0A=
+	s =3D splbio();=0A=
+	asleep((caddr_t)request, PRIBIO, "atprq", 0);=0A=
+	/* append onto controller queue and try to start controller */=0A=
+	if (flags & ATPR_F_AT_HEAD)=0A=
+	    TAILQ_INSERT_HEAD(&atadev->channel->atapi_queue, request, chain);=0A=
+	else=0A=
+	    TAILQ_INSERT_TAIL(&atadev->channel->atapi_queue, request, chain);=0A=
+	ata_start(atadev->channel);=0A=
+	/* wait for request to complete */=0A=
+	await(PRIBIO, 0);=0A=
+	splx(s);=0A=
 =0A=
-    /* wait for request to complete */=0A=
-    tsleep((caddr_t)request, PRIBIO, "atprq", 0);=0A=
-    error =3D request->error;=0A=
-    if (error)=0A=
-	 bcopy(&request->sense, atadev->result, sizeof(struct atapi_reqsense));=0A=
-    if (request->dmatab)=0A=
-	free(request->dmatab, M_DEVBUF);=0A=
-    free(request, M_ATAPI);=0A=
-    return error;=0A=
+	error =3D request->error;=0A=
+	if (error)=0A=
+	     bcopy(&request->sense, atadev->result, sizeof(struct =
atapi_reqsense));=0A=
+	if (request->dmatab)=0A=
+	    free(request->dmatab, M_DEVBUF);=0A=
+	free(request, M_ATAPI);=0A=
+	return error;=0A=
+    }=0A=
 }=0A=
     =0A=
 void=0A=

------=_NextPart_000_3F3F_01C1D116.6FBDF410--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3f4201c1d159$7e73fe30$52557f42>