Re: Lastest ATA checkings make my driver fail

From: Søren Schmidt <sos_at_DeepCore.dk>
Date: Tue, 13 Apr 2004 19:19:57 +0200
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


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
_at__at_ -1464,17 +1464,21 _at__at_
 	 * 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);
 
_at__at_ -1483,10 +1487,12 _at__at_
 	 * 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) {
Received on Tue Apr 13 2004 - 08:20:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:50 UTC