Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Apr 2004 19:19:57 +0200
From:      =?ISO-8859-1?Q?S=F8ren_Schmidt?= <sos@DeepCore.dk>
To:        Sean McNeil <sean@mcneil.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Lastest ATA checkings make my driver fail
Message-ID:  <407C213D.8080205@DeepCore.dk>
In-Reply-To: <1081874641.1067.4.camel@server.mcneil.com>
References:  <1081874641.1067.4.camel@server.mcneil.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030504050506020804090701
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Sean McNeil wrote:
> I have two disks that I use in a software raid (because my hardware raid
> controller isn't recognized).  All was working great until the latest
> checkin.  Now,

This is partly because of the pci code changes, you need this patch to 
make it work:


-- 
-Søren


--------------030504050506020804090701
Content-Type: text/plain;
 name="pci-diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="pci-diff"

Index: pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/pci/pci.c,v
retrieving revision 1.240
diff -u -r1.240 pci.c
--- pci.c	11 Apr 2004 07:02:49 -0000	1.240
+++ pci.c	13 Apr 2004 07:26:05 -0000
@@ -1464,17 +1464,21 @@
 	 * Weed out the bogons, and figure out how large the BAR/map is.
 	 */
 	map = pci_read_config(child, *rid, 4);
-	if (pci_maptype(map) & PCI_MAPMEM) {
-		if (type != SYS_RES_MEMORY) {
-			device_printf(child, "rid %#x says memory, driver wants %d failed.\n", *rid, type);
-			return (NULL);
-		}
-	} else {
-		if (type != SYS_RES_IOPORT) {
-			device_printf(child, "rid %#x says ioport, driver wants %d failed.\n", *rid, type);
-			return (NULL);
+	if (map) {
+		if (pci_maptype(map) & PCI_MAPMEM) {
+			if (type != SYS_RES_MEMORY) {
+				device_printf(child, "rid %#x says memory, driver wants %d failed.\n", *rid, type);
+				return (NULL);
+			}
+		} else {
+			if (type != SYS_RES_IOPORT) {
+				device_printf(child, "rid %#x says ioport, driver wants %d failed.\n", *rid, type);
+				return (NULL);
+			}
 		}
 	}
+	else
+		device_printf(child, "NULL BAR ignored, using supplied values\n");
 	pci_write_config(child, *rid, 0xffffffff, 4);
 	testval = pci_read_config(child, *rid, 4);
 
@@ -1483,10 +1487,12 @@
 	 * appropriate bar for that resource (this is the part
 	 * I'm not sure is good for 64-bit bars).
 	 */
-	mapsize = pci_mapsize(testval);
-	count = 1 << mapsize;
-	if (RF_ALIGNMENT(flags) < mapsize)
-	    flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize);
+	if (testval) {
+		mapsize = pci_mapsize(testval);
+		count = 1 << mapsize;
+		if (RF_ALIGNMENT(flags) < mapsize)
+	    		flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize);
+	}
 	res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid,
 	    start, end, count, flags);
 	if (res == NULL) {

--------------030504050506020804090701--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?407C213D.8080205>