patch-2.3.11 linux/drivers/scsi/eata_dma.c

Next file: linux/drivers/scsi/eata_pio.c
Previous file: linux/drivers/scsi/aic7xxx.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.10/linux/drivers/scsi/eata_dma.c linux/drivers/scsi/eata_dma.c
@@ -70,7 +70,6 @@
 #include <linux/ioport.h>
 #include <linux/malloc.h>
 #include <linux/in.h>
-#include <linux/bios32.h>
 #include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/delay.h>
@@ -1404,116 +1403,64 @@
 
 void find_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt)
 {
-
 #ifndef CONFIG_PCI
     printk("eata_dma: kernel PCI support not enabled. Skipping scan for PCI HBAs.\n");
 #else
-    
-    u8 pci_bus, pci_device_fn;
-    static s16 pci_index = 0;	/* Device index to PCI BIOS calls */
-    u32 base = 0;
-    u16 com_adr;
-    u16 rev_device;
-    u32 error, i, x;
+    struct pci_dev *dev; 
+    u32 base, x;
     u8 pal1, pal2, pal3;
 
-    if (pci_present()) {
-	for (i = 0; i <= MAXPCI; ++i, ++pci_index) {
-	    if (pcibios_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT, 
-				    pci_index, &pci_bus, &pci_device_fn))
-		break;
+    for(dev=NULL; dev = pci_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT, dev);) {
 	    DBG(DBG_PROBE && DBG_PCI, 
-		printk("eata_dma: find_PCI, HBA at bus %d, device %d,"
-		       " function %d, index %d\n", (s32)pci_bus, 
-		       (s32)((pci_device_fn & 0xf8) >> 3),
-		       (s32)(pci_device_fn & 7), pci_index));
-	    
-	    if (!(error = pcibios_read_config_word(pci_bus, pci_device_fn, 
-				       PCI_CLASS_DEVICE, &rev_device))) {
-		if (rev_device == PCI_CLASS_STORAGE_SCSI) {
-		    if (!(error = pcibios_read_config_word(pci_bus, 
-					       pci_device_fn, PCI_COMMAND, 
-					       (u16 *) & com_adr))) {
-			if (!((com_adr & PCI_COMMAND_IO) && 
-			      (com_adr & PCI_COMMAND_MASTER))) {
-			    printk("eata_dma: find_PCI, HBA has IO or"
-				   " BUSMASTER mode disabled\n");
-			    continue;
-			}
-		    } else
-			printk("eata_dma: find_PCI, error %x while reading "
-			       "PCI_COMMAND\n", error);
-		} else
-		    printk("eata_dma: find_PCI, DEVICECLASSID %x didn't match\n", 
-			   rev_device);
-	    } else {
-		printk("eata_dma: find_PCI, error %x while reading "
-		       "PCI_CLASS_BASE\n", 
-		       error);
+		printk("eata_dma: find_PCI, HBA at %s\n", dev->name));
+	    pci_set_master(dev);
+	    base = dev->base_address[0];
+	    if (!(base & PCI_BASE_ADDRESS_SPACE_IO)) {
+		printk("eata_dma: invalid base address of device %s\n", dev->name);
 		continue;
 	    }
-	    
-	    if (!(error = pcibios_read_config_dword(pci_bus, pci_device_fn,
-				       PCI_BASE_ADDRESS_0, (int *) &base))){
-		
-		/* Check if the address is valid */
-		if (base & 0x01) {
-		    base &= 0xfffffffe;
-                    /* EISA tag there ? */
-		    pal1 = inb(base);
-		    pal2 = inb(base + 1);
-		    pal3 = inb(base + 2);
-		    if (((pal1 == DPT_ID1) && (pal2 == DPT_ID2)) ||
-			((pal1 == NEC_ID1) && (pal2 == NEC_ID2) && 
-			 (pal3 == NEC_ID3)) ||
-			((pal1 == ATT_ID1) && (pal2 == ATT_ID2) && 
-			 (pal3 == ATT_ID3)))
-			base += 0x08;
-		    else
-			base += 0x10;   /* Now, THIS is the real address */
-
-		    if (base != 0x1f8) {
-			/* We didn't find it in the primary search */
-			if (get_conf_PIO(base, buf) == TRUE) {
-
-			    /* OK. We made it till here, so we can go now  
-			     * and register it. We  only have to check and 
-			     * eventually remove it from the EISA and ISA list 
-			     */
-			    DBG(DBG_PCI, printk("Registering PCI HBA\n"));
-			    register_HBA(base, buf, tpnt, IS_PCI);
-			    
-			    if (base < 0x1000) {
-				for (x = 0; x < MAXISA; ++x) {
-				    if (ISAbases[x] == base) {
-					ISAbases[x] = 0;
-					break;
-				    }
-				}
-			    } else if ((base & 0x0fff) == 0x0c88) 
-				EISAbases[(base >> 12) & 0x0f] = 0;
-			    continue;  /* break; */
-			} 
-#if CHECK_BLINK
-			else if (check_blink_state(base) == TRUE) {
-			    printk("eata_dma: HBA is in BLINK state.\n"
-				   "Consult your HBAs manual to correct this.\n");
+	    base &= PCI_BASE_ADDRESS_IO_MASK;
+            /* EISA tag there ? */
+	    pal1 = inb(base);
+	    pal2 = inb(base + 1);
+	    pal3 = inb(base + 2);
+	    if (((pal1 == DPT_ID1) && (pal2 == DPT_ID2)) ||
+		((pal1 == NEC_ID1) && (pal2 == NEC_ID2) && 
+		(pal3 == NEC_ID3)) ||
+		((pal1 == ATT_ID1) && (pal2 == ATT_ID2) && 
+		(pal3 == ATT_ID3)))
+		base += 0x08;
+	    else
+		base += 0x10;   /* Now, THIS is the real address */
+	    if (base != 0x1f8) {
+		/* We didn't find it in the primary search */
+		if (get_conf_PIO(base, buf) == TRUE) {
+		    /* OK. We made it till here, so we can go now  
+		     * and register it. We only have to check and 
+		     * eventually remove it from the EISA and ISA list 
+		     */
+		    DBG(DBG_PCI, printk("Registering PCI HBA\n"));
+		    register_HBA(base, buf, tpnt, IS_PCI);
+		    
+		    if (base < 0x1000) {
+			for (x = 0; x < MAXISA; ++x) {
+			    if (ISAbases[x] == base) {
+				ISAbases[x] = 0;
+				break;
+			    }
 			}
-#endif
-		    }
+		    } else if ((base & 0x0fff) == 0x0c88) 
+			EISAbases[(base >> 12) & 0x0f] = 0;
+		} 
+#if CHECK_BLINK
+		else if (check_blink_state(base) == TRUE) {
+		    printk("eata_dma: HBA is in BLINK state.\n"
+			   "Consult your HBAs manual to correct this.\n");
 		}
-	    } else {
-		printk("eata_dma: error %x while reading "
-		       "PCI_BASE_ADDRESS_0\n", error);
+#endif
 	    }
 	}
-    } else {
-	printk("eata_dma: No BIOS32 extensions present. This driver release "
-	       "still depends on it.\n"
-	       "	  Skipping scan for PCI HBAs. \n");
-    }
 #endif /* #ifndef CONFIG_PCI */
-    return;
 }
 
 int eata_detect(Scsi_Host_Template * tpnt)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)