From owner-freebsd-bugs Wed Sep 12 16:50:19 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 862FC37B40C for ; Wed, 12 Sep 2001 16:50:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f8CNo1G17265; Wed, 12 Sep 2001 16:50:01 -0700 (PDT) (envelope-from gnats) Received: from hand.dotat.at (host217-35-41-52.in-addr.btopenworld.com [217.35.41.52]) by hub.freebsd.org (Postfix) with ESMTP id EA0B437B406 for ; Wed, 12 Sep 2001 16:42:03 -0700 (PDT) Received: from fanf by hand.dotat.at with local (Exim 3.33 #16) id 15hKZg-0001WD-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 13 Sep 2001 00:41:48 +0000 Message-Id: Date: Thu, 13 Sep 2001 00:41:48 +0000 From: Tony Finch Reply-To: Tony Finch To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/30539: [PATCH] pull some magic numbers out of the ata code Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 30539 >Category: kern >Synopsis: [PATCH] pull some magic numbers out of the ata code >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Sep 12 16:50:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Tony Finch >Release: FreeBSD 4.4-RC i386 >Organization: dotat labs >Environment: System: FreeBSD hand.dotat.at 4.4-RC FreeBSD 4.4-RC #4: Sat Sep 1 19:06:27 GMT 2001 fanf@hand.dotat.at:/FreeBSD/obj/FreeBSD/releng4/sys/SHARP i386 >Description: There are some magic numbers in the ata code related to timeouts and so forth that would be better coded as #defined constants. >How-To-Repeat: >Fix: Index: sys/dev/ata/ata-all.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v retrieving revision 1.50.2.20 diff -u -r1.50.2.20 ata-all.c --- sys/dev/ata/ata-all.c 2001/08/28 17:56:14 1.50.2.20 +++ sys/dev/ata/ata-all.c 2001/08/28 22:19:33 @@ -77,6 +77,8 @@ #else #define ATA_MASTERDEV(dev) (1) #endif +#define ATA_WAIT_DELAY (5000000) /* microseconds */ +#define ATA_INTR_DELAY (10 * hz) /* ticks */ /* prototypes */ static int ata_probe(device_t); @@ -1431,7 +1433,7 @@ int statio = scp->ioaddr + ATA_STATUS; DELAY(1); - while (timeout < 5000000) { /* timeout 5 secs */ + while (timeout < ATA_WAIT_DELAY) { scp->status = inb(statio); /* if drive fails status, reselect the drive just to be sure */ @@ -1457,7 +1459,7 @@ } if (scp->status & ATA_S_ERROR) scp->error = inb(scp->ioaddr + ATA_ERROR); - if (timeout >= 5000000) + if (timeout >= ATA_WAIT_DELAY) return -1; if (!mask) return (scp->status & ATA_S_ERROR); @@ -1514,14 +1516,14 @@ switch (flags) { case ATA_WAIT_INTR: scp->active = ATA_WAIT_INTR; - asleep((caddr_t)scp, PRIBIO, "atacmd", 10 * hz); + asleep((caddr_t)scp, PRIBIO, "atacmd", ATA_INTR_DELAY); outb(scp->ioaddr + ATA_CMD, command); /* enable interrupt */ if (scp->flags & ATA_QUEUED) outb(scp->altioaddr, ATA_A_4BIT); - if (await(PRIBIO, 10 * hz)) { + if (await(PRIBIO, ATA_INTR_DELAY)) { ata_printf(scp, device, "ata_command: timeout waiting for intr\n"); scp->active = ATA_IDLE; error = -1; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message