linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* advansys cleanup
@ 2007-07-16 20:28 Matthew Wilcox
  2007-07-16 22:41 ` [PATCH 1/4] advansys: Create advansys_board_found() Matthew Wilcox
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Matthew Wilcox @ 2007-07-16 20:28 UTC (permalink / raw)
  To: linux-scsi


I have to run, but here's what I've benn working on today if anyone
wants to test:

http://git.kernel.org/pub/scm/linux/kernel/git/willy/advansys-2.6.git

-- 
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] advansys: Create advansys_board_found()
  2007-07-16 20:28 advansys cleanup Matthew Wilcox
@ 2007-07-16 22:41 ` Matthew Wilcox
  2007-07-16 22:41 ` [PATCH 2/4] advansys: Clean up proc_info implementation Matthew Wilcox
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2007-07-16 22:41 UTC (permalink / raw)
  To: linux-scsi; +Cc: Matthew Wilcox

Split advansys_board_found() out of advansys_detect() in preparation
for updating the driver to modern probing methods.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
---
 drivers/scsi/advansys.c |  577 +++++++++++++++++++++++------------------------
 1 files changed, 285 insertions(+), 292 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 2b66897..2b6cf30 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -771,6 +771,7 @@
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/blkdev.h>
+#include <linux/pci.h>
 #include <linux/stat.h>
 #include <linux/spinlock.h>
 #include <linux/dma-mapping.h>
@@ -798,10 +799,6 @@
 #include <scsi/scsi_tcq.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
-#ifdef CONFIG_PCI
-#include <linux/pci.h>
-#endif /* CONFIG_PCI */
-
 
 /*
  * --- Driver Options
@@ -4274,268 +4271,29 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
 }
 #endif /* CONFIG_PROC_FS */
 
-/*
- * advansys_detect()
- *
- * Detect function for AdvanSys adapters.
- *
- * Argument is a pointer to the host driver's scsi_hosts entry.
- *
- * Return number of adapters found.
- *
- * Note: Because this function is called during system initialization
- * it must not call SCSI mid-level functions including scsi_malloc()
- * and scsi_free().
- */
-static int __init
-advansys_detect(struct scsi_host_template *tpnt)
+static int advansys_board_found(struct scsi_host_template *tpnt, int iop,
+				struct pci_dev *pdev, int bus_type)
 {
-    static int          detect_called = ASC_FALSE;
-    int                 iop;
-    int                 bus;
     struct Scsi_Host    *shp = NULL;
     asc_board_t         *boardp = NULL;
     ASC_DVC_VAR         *asc_dvc_varp = NULL;
     ADV_DVC_VAR         *adv_dvc_varp = NULL;
     adv_sgblk_t         *sgp = NULL;
-    int                 ioport = 0;
     int                 share_irq = FALSE;
     int                 iolen = 0;
-    struct device	*dev = NULL;
-#ifdef CONFIG_PCI
-    int                 pci_init_search = 0;
-    struct pci_dev      *pci_devicep[ASC_NUM_BOARD_SUPPORTED];
-    int                 pci_card_cnt_max = 0;
-    int                 pci_card_cnt = 0;
-    struct pci_dev      *pci_devp = NULL;
-    int                 pci_device_id_cnt = 0;
-    unsigned int        pci_device_id[ASC_PCI_DEVICE_ID_CNT] = {
-                                    PCI_DEVICE_ID_ASP_1200A,
-                                    PCI_DEVICE_ID_ASP_ABP940,
-                                    PCI_DEVICE_ID_ASP_ABP940U,
-                                    PCI_DEVICE_ID_ASP_ABP940UW,
-                                    PCI_DEVICE_ID_38C0800_REV1,
-                                    PCI_DEVICE_ID_38C1600_REV1
-                        };
     ADV_PADDR           pci_memory_address;
-#endif /* CONFIG_PCI */
     int                 warn_code, err_code;
     int                 ret;
 
-    if (detect_called == ASC_FALSE) {
-        detect_called = ASC_TRUE;
-    } else {
-        printk("AdvanSys SCSI: advansys_detect() multiple calls ignored\n");
-        return 0;
-    }
-
-    ASC_DBG(1, "advansys_detect: begin\n");
-
-    asc_board_count = 0;
-
-    /*
-     * If I/O port probing has been modified, then verify and
-     * clean-up the 'asc_ioport' list.
-     */
-    if (asc_iopflag == ASC_TRUE) {
-        for (ioport = 0; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
-            ASC_DBG2(1, "advansys_detect: asc_ioport[%d] 0x%x\n",
-                ioport, asc_ioport[ioport]);
-            if (asc_ioport[ioport] != 0) {
-                for (iop = 0; iop < ASC_IOADR_TABLE_MAX_IX; iop++) {
-                    if (_asc_def_iop_base[iop] == asc_ioport[ioport]) {
-                        break;
-                    }
-                }
-                if (iop == ASC_IOADR_TABLE_MAX_IX) {
-                    printk(
-"AdvanSys SCSI: specified I/O Port 0x%X is invalid\n",
-                        asc_ioport[ioport]);
-                    asc_ioport[ioport] = 0;
-                }
-            }
-        }
-        ioport = 0;
-    }
-
-    for (bus = 0; bus < ASC_NUM_BUS; bus++) {
-
-        ASC_DBG2(1, "advansys_detect: bus search type %d (%s)\n",
-            bus, asc_bus_name[bus]);
-        iop = 0;
-
-        while (asc_board_count < ASC_NUM_BOARD_SUPPORTED) {
-
-            ASC_DBG1(2, "advansys_detect: asc_board_count %d\n",
-                asc_board_count);
-
-            switch (asc_bus[bus]) {
-            case ASC_IS_ISA:
-            case ASC_IS_VL:
-#ifdef CONFIG_ISA
-                if (asc_iopflag == ASC_FALSE) {
-                    iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
-                } else {
-                    /*
-                     * ISA and VL I/O port scanning has either been
-                     * eliminated or limited to selected ports on
-                     * the LILO command line, /etc/lilo.conf, or
-                     * by setting variables when the module was loaded.
-                     */
-                    ASC_DBG(1, "advansys_detect: I/O port scanning modified\n");
-                ioport_try_again:
-                    iop = 0;
-                    for (; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
-                        if ((iop = asc_ioport[ioport]) != 0) {
-                            break;
-                        }
-                    }
-                    if (iop) {
-                        ASC_DBG1(1,
-                                "advansys_detect: probing I/O port 0x%x...\n",
-                            iop);
-			if (!request_region(iop, ASC_IOADR_GAP, "advansys")){
-                            printk(
-"AdvanSys SCSI: specified I/O Port 0x%X is busy\n", iop);
-                            /* Don't try this I/O port twice. */
-                            asc_ioport[ioport] = 0;
-                            goto ioport_try_again;
-                        } else if (AscFindSignature(iop) == ASC_FALSE) {
-                            printk(
-"AdvanSys SCSI: specified I/O Port 0x%X has no adapter\n", iop);
-                            /* Don't try this I/O port twice. */
-			    release_region(iop, ASC_IOADR_GAP);
-                            asc_ioport[ioport] = 0;
-                            goto ioport_try_again;
-                        } else {
-                            /*
-                             * If this isn't an ISA board, then it must be
-                             * a VL board. If currently looking an ISA
-                             * board is being looked for then try for
-                             * another ISA board in 'asc_ioport'.
-                             */
-                            if (asc_bus[bus] == ASC_IS_ISA &&
-                                (AscGetChipVersion(iop, ASC_IS_ISA) &
-                                 ASC_CHIP_VER_ISA_BIT) == 0) {
-                                 /*
-                                  * Don't clear 'asc_ioport[ioport]'. Try
-                                  * this board again for VL. Increment
-                                  * 'ioport' past this board.
-                                  */
-                                 ioport++;
-				 release_region(iop, ASC_IOADR_GAP);
-                                 goto ioport_try_again;
-                            }
-                        }
-                        /*
-                         * This board appears good, don't try the I/O port
-                         * again by clearing its value. Increment 'ioport'
-                         * for the next iteration.
-                         */
-                        asc_ioport[ioport++] = 0;
-                    }
-                }
-#endif /* CONFIG_ISA */
-                break;
-
-            case ASC_IS_EISA:
-#ifdef CONFIG_ISA
-                iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
-#endif /* CONFIG_ISA */
-                break;
-
-            case ASC_IS_PCI:
-#ifdef CONFIG_PCI
-                if (pci_init_search == 0) {
-                    int i, j;
-
-                    pci_init_search = 1;
-
-                    /* Find all PCI cards. */
-                    while (pci_device_id_cnt < ASC_PCI_DEVICE_ID_CNT) {
-                        if ((pci_devp = pci_find_device(PCI_VENDOR_ID_ASP,
-                            pci_device_id[pci_device_id_cnt], pci_devp)) ==
-                            NULL) {
-                            pci_device_id_cnt++;
-                        } else {
-                            if (pci_enable_device(pci_devp) == 0) {
-                                pci_devicep[pci_card_cnt_max++] = pci_devp;
-                            }
-                        }
-                    }
-
-                    /*
-                     * Sort PCI cards in ascending order by PCI Bus, Slot,
-                     * and Device Number.
-                     */
-                    for (i = 0; i < pci_card_cnt_max - 1; i++)
-                    {
-                        for (j = i + 1; j < pci_card_cnt_max; j++) {
-                            if ((pci_devicep[j]->bus->number <
-                                 pci_devicep[i]->bus->number) ||
-                                ((pci_devicep[j]->bus->number ==
-                                  pci_devicep[i]->bus->number) &&
-                                  (pci_devicep[j]->devfn <
-                                   pci_devicep[i]->devfn))) {
-                                pci_devp = pci_devicep[i];
-                                pci_devicep[i] = pci_devicep[j];
-                                pci_devicep[j] = pci_devp;
-                            }
-                        }
-                    }
-
-                    pci_card_cnt = 0;
-                } else {
-                    pci_card_cnt++;
-                }
-
-                if (pci_card_cnt == pci_card_cnt_max) {
-                    iop = 0;
-                } else {
-                    pci_devp = pci_devicep[pci_card_cnt];
-
-                    ASC_DBG2(2,
-                        "advansys_detect: devfn %d, bus number %d\n",
-                        pci_devp->devfn, pci_devp->bus->number);
-                    iop = pci_resource_start(pci_devp, 0);
-                    ASC_DBG2(1,
-                        "advansys_detect: vendorID %X, deviceID %X\n",
-                        pci_devp->vendor, pci_devp->device);
-                    ASC_DBG2(2, "advansys_detect: iop %X, irqLine %d\n",
-                        iop, pci_devp->irq);
-                }
-		if(pci_devp)
-		    dev = &pci_devp->dev;
-
-#endif /* CONFIG_PCI */
-                break;
-
-            default:
-                ASC_PRINT1("advansys_detect: unknown bus type: %d\n",
-                    asc_bus[bus]);
-                break;
-            }
-            ASC_DBG1(1, "advansys_detect: iop 0x%x\n", iop);
-
             /*
-             * Adapter not found, try next bus type.
-             */
-            if (iop == 0) {
-                break;
-            }
-
-            /*
-             * Adapter found.
-             *
              * Register the adapter, get its configuration, and
              * initialize it.
              */
-            ASC_DBG(2, "advansys_detect: scsi_register()\n");
-            shp = scsi_register(tpnt, sizeof(asc_board_t));
+            ASC_DBG(2, "advansys_board_found: scsi_register()\n");
 
-            if (shp == NULL) {
-                continue;
-            }
+            shp = scsi_register(tpnt, sizeof(asc_board_t));
+            if (!shp)
+		return -ENOMEM;
 
             /* Save a pointer to the Scsi_Host of each board found. */
             asc_host[asc_board_count++] = shp;
@@ -4544,8 +4302,6 @@ advansys_detect(struct scsi_host_template *tpnt)
             boardp = ASC_BOARDP(shp);
             memset(boardp, 0, sizeof(asc_board_t));
             boardp->id = asc_board_count - 1;
-
-            /* Initialize spinlock. */
             spin_lock_init(&boardp->lock);
 
             /*
@@ -4556,19 +4312,18 @@ advansys_detect(struct scsi_host_template *tpnt)
              * the board type.
              */
 #ifdef CONFIG_PCI
-            if (asc_bus[bus] == ASC_IS_PCI &&
-                (pci_devp->device == PCI_DEVICE_ID_ASP_ABP940UW ||
-                 pci_devp->device == PCI_DEVICE_ID_38C0800_REV1 ||
-                 pci_devp->device == PCI_DEVICE_ID_38C1600_REV1))
-            {
-                boardp->flags |= ASC_IS_WIDE_BOARD;
-            }
+	if (bus_type == ASC_IS_PCI &&
+	    (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW ||
+	     pdev->device == PCI_DEVICE_ID_38C0800_REV1 ||
+	     pdev->device == PCI_DEVICE_ID_38C1600_REV1)) {
+		boardp->flags |= ASC_IS_WIDE_BOARD;
+	}
 #endif /* CONFIG_PCI */
 
             if (ASC_NARROW_BOARD(boardp)) {
                 ASC_DBG(1, "advansys_detect: narrow board\n");
                 asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
-                asc_dvc_varp->bus_type = asc_bus[bus];
+                asc_dvc_varp->bus_type = bus_type;
                 asc_dvc_varp->drv_ptr = boardp;
                 asc_dvc_varp->cfg = &boardp->dvc_cfg.asc_dvc_cfg;
                 asc_dvc_varp->cfg->overrun_buf = &overrun_buf[0];
@@ -4582,19 +4337,16 @@ advansys_detect(struct scsi_host_template *tpnt)
                 adv_dvc_varp->isr_callback = adv_isr_callback;
                 adv_dvc_varp->async_callback = adv_async_callback;
 #ifdef CONFIG_PCI
-                if (pci_devp->device == PCI_DEVICE_ID_ASP_ABP940UW)
-                {
-                    ASC_DBG(1, "advansys_detect: ASC-3550\n");
-                    adv_dvc_varp->chip_type = ADV_CHIP_ASC3550;
-                } else if (pci_devp->device == PCI_DEVICE_ID_38C0800_REV1)
-                {
-                    ASC_DBG(1, "advansys_detect: ASC-38C0800\n");
-                    adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800;
-                } else
-                {
-                    ASC_DBG(1, "advansys_detect: ASC-38C1600\n");
-                    adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600;
-                }
+		if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) {
+			ASC_DBG(1, "advansys_detect: ASC-3550\n");
+			adv_dvc_varp->chip_type = ADV_CHIP_ASC3550;
+                } else if (pdev->device == PCI_DEVICE_ID_38C0800_REV1) {
+			ASC_DBG(1, "advansys_detect: ASC-38C0800\n");
+			adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800;
+		} else {
+			ASC_DBG(1, "advansys_detect: ASC-38C1600\n");
+			adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600;
+		}
 #endif /* CONFIG_PCI */
 
                 /*
@@ -4619,7 +4371,7 @@ advansys_detect(struct scsi_host_template *tpnt)
                     iolen = ADV_38C1600_IOLEN;
                 }
 #ifdef CONFIG_PCI
-                pci_memory_address = pci_resource_start(pci_devp, 1);
+                pci_memory_address = pci_resource_start(pdev, 1);
                 ASC_DBG1(1, "advansys_detect: pci_memory_address: 0x%lx\n",
                     (ulong) pci_memory_address);
                 if ((boardp->ioremap_addr =
@@ -4630,7 +4382,7 @@ advansys_detect(struct scsi_host_template *tpnt)
                        boardp->id, pci_memory_address, iolen);
                    scsi_unregister(shp);
                    asc_board_count--;
-                   continue;
+                   return -ENOMEM;
                 }
                 ASC_DBG1(1, "advansys_detect: ioremap_addr: 0x%lx\n",
                     (ulong) boardp->ioremap_addr);
@@ -4665,12 +4417,12 @@ advansys_detect(struct scsi_host_template *tpnt)
                     boardp->id, ASC_PRTBUF_SIZE, GFP_ATOMIC);
                 scsi_unregister(shp);
                 asc_board_count--;
-                continue;
+                return -ENOMEM;
             }
 #endif /* CONFIG_PROC_FS */
 
             if (ASC_NARROW_BOARD(boardp)) {
-		asc_dvc_varp->cfg->dev = dev;
+		asc_dvc_varp->cfg->dev = NULL;
 		/*
                  * Set the board bus type and PCI IRQ before
                  * calling AscInitGetConfig().
@@ -4692,11 +4444,12 @@ advansys_detect(struct scsi_host_template *tpnt)
 #endif /* CONFIG_ISA */
 #ifdef CONFIG_PCI
                 case ASC_IS_PCI:
-                    shp->irq = asc_dvc_varp->irq_no = pci_devp->irq;
+                    shp->irq = asc_dvc_varp->irq_no = pdev->irq;
+        	    asc_dvc_varp->cfg->dev = &pdev->dev;
                     asc_dvc_varp->cfg->pci_slot_info =
-                        ASC_PCI_MKID(pci_devp->bus->number,
-                            PCI_SLOT(pci_devp->devfn),
-                            PCI_FUNC(pci_devp->devfn));
+                        ASC_PCI_MKID(pdev->bus->number,
+                            PCI_SLOT(pdev->devfn),
+                            PCI_FUNC(pdev->devfn));
                     shp->unchecked_isa_dma = FALSE;
                     share_irq = TRUE;
                     break;
@@ -4710,17 +4463,17 @@ advansys_detect(struct scsi_host_template *tpnt)
                     break;
                 }
             } else {
-                adv_dvc_varp->cfg->dev = dev;
                 /*
                  * For Wide boards set PCI information before calling
                  * AdvInitGetConfig().
                  */
 #ifdef CONFIG_PCI
-                shp->irq = adv_dvc_varp->irq_no = pci_devp->irq;
+                shp->irq = adv_dvc_varp->irq_no = pdev->irq;
+                adv_dvc_varp->cfg->dev = &pdev->dev;
                 adv_dvc_varp->cfg->pci_slot_info =
-                    ASC_PCI_MKID(pci_devp->bus->number,
-                        PCI_SLOT(pci_devp->devfn),
-                        PCI_FUNC(pci_devp->devfn));
+                    ASC_PCI_MKID(pdev->bus->number,
+                        PCI_SLOT(pdev->devfn),
+                        PCI_FUNC(pdev->devfn));
                 shp->unchecked_isa_dma = FALSE;
                 share_irq = TRUE;
 #endif /* CONFIG_PCI */
@@ -4796,7 +4549,7 @@ advansys_detect(struct scsi_host_template *tpnt)
 #endif /* CONFIG_PROC_FS */
                 scsi_unregister(shp);
                 asc_board_count--;
-                continue;
+                return err_code;
             }
 
             /*
@@ -4884,7 +4637,7 @@ advansys_detect(struct scsi_host_template *tpnt)
 #endif /* CONFIG_PROC_FS */
                     scsi_unregister(shp);
                     asc_board_count--;
-                    continue;
+                    return asc_dvc_varp->err_code;
                 }
 
                 /*
@@ -5153,7 +4906,7 @@ advansys_detect(struct scsi_host_template *tpnt)
 #endif /* CONFIG_PROC_FS */
                 scsi_unregister(shp);
                 asc_board_count--;
-                continue;
+                return -EBUSY;
             }
 
             /* Register DMA Channel for Narrow boards. */
@@ -5174,7 +4927,7 @@ advansys_detect(struct scsi_host_template *tpnt)
 #endif /* CONFIG_PROC_FS */
                         scsi_unregister(shp);
                         asc_board_count--;
-                        continue;
+                        return ret;
                     }
                     AscEnableIsaDma(shp->dma_channel);
                 }
@@ -5222,7 +4975,7 @@ advansys_detect(struct scsi_host_template *tpnt)
 #endif /* CONFIG_PROC_FS */
                 scsi_unregister(shp);
                 asc_board_count--;
-                continue;
+                return ret;
             }
 
             /*
@@ -5404,9 +5157,249 @@ advansys_detect(struct scsi_host_template *tpnt)
                 free_irq(shp->irq, boardp);
                 scsi_unregister(shp);
                 asc_board_count--;
-                continue;
+                return err_code;
+	}
+	ASC_DBG_PRT_SCSI_HOST(2, shp);
+
+	return 0;
+}
+
+/*
+ * advansys_detect()
+ *
+ * Detect function for AdvanSys adapters.
+ *
+ * Argument is a pointer to the host driver's scsi_hosts entry.
+ *
+ * Return number of adapters found.
+ *
+ * Note: Because this function is called during system initialization
+ * it must not call SCSI mid-level functions including scsi_malloc()
+ * and scsi_free().
+ */
+static int __init
+advansys_detect(struct scsi_host_template *tpnt)
+{
+    static int          detect_called = ASC_FALSE;
+    int                 iop;
+    int                 bus;
+    int                 ioport = 0;
+#ifdef CONFIG_PCI
+    int                 pci_init_search = 0;
+    struct pci_dev      *pci_devicep[ASC_NUM_BOARD_SUPPORTED];
+    int                 pci_card_cnt_max = 0;
+    int                 pci_card_cnt = 0;
+    struct pci_dev      *pci_devp = NULL;
+    int                 pci_device_id_cnt = 0;
+    unsigned int        pci_device_id[ASC_PCI_DEVICE_ID_CNT] = {
+                                    PCI_DEVICE_ID_ASP_1200A,
+                                    PCI_DEVICE_ID_ASP_ABP940,
+                                    PCI_DEVICE_ID_ASP_ABP940U,
+                                    PCI_DEVICE_ID_ASP_ABP940UW,
+                                    PCI_DEVICE_ID_38C0800_REV1,
+                                    PCI_DEVICE_ID_38C1600_REV1
+                        };
+#else
+#define pci_devp NULL
+#endif /* CONFIG_PCI */
+
+    if (detect_called == ASC_FALSE) {
+        detect_called = ASC_TRUE;
+    } else {
+        printk("AdvanSys SCSI: advansys_detect() multiple calls ignored\n");
+        return 0;
+    }
+
+    ASC_DBG(1, "advansys_detect: begin\n");
+
+    asc_board_count = 0;
+
+    /*
+     * If I/O port probing has been modified, then verify and
+     * clean-up the 'asc_ioport' list.
+     */
+    if (asc_iopflag == ASC_TRUE) {
+        for (ioport = 0; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
+            ASC_DBG2(1, "advansys_detect: asc_ioport[%d] 0x%x\n",
+                ioport, asc_ioport[ioport]);
+            if (asc_ioport[ioport] != 0) {
+                for (iop = 0; iop < ASC_IOADR_TABLE_MAX_IX; iop++) {
+                    if (_asc_def_iop_base[iop] == asc_ioport[ioport]) {
+                        break;
+                    }
+                }
+                if (iop == ASC_IOADR_TABLE_MAX_IX) {
+                    printk(
+"AdvanSys SCSI: specified I/O Port 0x%X is invalid\n",
+                        asc_ioport[ioport]);
+                    asc_ioport[ioport] = 0;
+                }
+            }
+        }
+        ioport = 0;
+    }
+
+    for (bus = 0; bus < ASC_NUM_BUS; bus++) {
+
+        ASC_DBG2(1, "advansys_detect: bus search type %d (%s)\n",
+            bus, asc_bus_name[bus]);
+        iop = 0;
+
+        while (asc_board_count < ASC_NUM_BOARD_SUPPORTED) {
+
+            ASC_DBG1(2, "advansys_detect: asc_board_count %d\n",
+                asc_board_count);
+
+            switch (asc_bus[bus]) {
+            case ASC_IS_ISA:
+            case ASC_IS_VL:
+#ifdef CONFIG_ISA
+                if (asc_iopflag == ASC_FALSE) {
+                    iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
+                } else {
+                    /*
+                     * ISA and VL I/O port scanning has either been
+                     * eliminated or limited to selected ports on
+                     * the LILO command line, /etc/lilo.conf, or
+                     * by setting variables when the module was loaded.
+                     */
+                    ASC_DBG(1, "advansys_detect: I/O port scanning modified\n");
+                ioport_try_again:
+                    iop = 0;
+                    for (; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
+                        if ((iop = asc_ioport[ioport]) != 0) {
+                            break;
+                        }
+                    }
+                    if (iop) {
+                        ASC_DBG1(1,
+                                "advansys_detect: probing I/O port 0x%x...\n",
+                            iop);
+			if (!request_region(iop, ASC_IOADR_GAP, "advansys")){
+                            printk(
+"AdvanSys SCSI: specified I/O Port 0x%X is busy\n", iop);
+                            /* Don't try this I/O port twice. */
+                            asc_ioport[ioport] = 0;
+                            goto ioport_try_again;
+                        } else if (AscFindSignature(iop) == ASC_FALSE) {
+                            printk(
+"AdvanSys SCSI: specified I/O Port 0x%X has no adapter\n", iop);
+                            /* Don't try this I/O port twice. */
+			    release_region(iop, ASC_IOADR_GAP);
+                            asc_ioport[ioport] = 0;
+                            goto ioport_try_again;
+                        } else {
+                            /*
+                             * If this isn't an ISA board, then it must be
+                             * a VL board. If currently looking an ISA
+                             * board is being looked for then try for
+                             * another ISA board in 'asc_ioport'.
+                             */
+                            if (asc_bus[bus] == ASC_IS_ISA &&
+                                (AscGetChipVersion(iop, ASC_IS_ISA) &
+                                 ASC_CHIP_VER_ISA_BIT) == 0) {
+                                 /*
+                                  * Don't clear 'asc_ioport[ioport]'. Try
+                                  * this board again for VL. Increment
+                                  * 'ioport' past this board.
+                                  */
+                                 ioport++;
+				 release_region(iop, ASC_IOADR_GAP);
+                                 goto ioport_try_again;
+                            }
+                        }
+                        /*
+                         * This board appears good, don't try the I/O port
+                         * again by clearing its value. Increment 'ioport'
+                         * for the next iteration.
+                         */
+                        asc_ioport[ioport++] = 0;
+                    }
+                }
+#endif /* CONFIG_ISA */
+                break;
+
+            case ASC_IS_EISA:
+#ifdef CONFIG_ISA
+                iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
+#endif /* CONFIG_ISA */
+                break;
+
+            case ASC_IS_PCI:
+#ifdef CONFIG_PCI
+                if (pci_init_search == 0) {
+                    int i, j;
+
+                    pci_init_search = 1;
+
+                    /* Find all PCI cards. */
+                    while (pci_device_id_cnt < ASC_PCI_DEVICE_ID_CNT) {
+                        if ((pci_devp = pci_find_device(PCI_VENDOR_ID_ASP,
+                            pci_device_id[pci_device_id_cnt], pci_devp)) ==
+                            NULL) {
+                            pci_device_id_cnt++;
+                        } else {
+                            if (pci_enable_device(pci_devp) == 0) {
+                                pci_devicep[pci_card_cnt_max++] = pci_devp;
+                            }
+                        }
+                    }
+
+                    /*
+                     * Sort PCI cards in ascending order by PCI Bus, Slot,
+                     * and Device Number.
+                     */
+                    for (i = 0; i < pci_card_cnt_max - 1; i++)
+                    {
+                        for (j = i + 1; j < pci_card_cnt_max; j++) {
+                            if ((pci_devicep[j]->bus->number <
+                                 pci_devicep[i]->bus->number) ||
+                                ((pci_devicep[j]->bus->number ==
+                                  pci_devicep[i]->bus->number) &&
+                                  (pci_devicep[j]->devfn <
+                                   pci_devicep[i]->devfn))) {
+                                pci_devp = pci_devicep[i];
+                                pci_devicep[i] = pci_devicep[j];
+                                pci_devicep[j] = pci_devp;
+                            }
+                        }
+                    }
+
+                    pci_card_cnt = 0;
+                } else {
+                    pci_card_cnt++;
+                }
+
+                if (pci_card_cnt == pci_card_cnt_max) {
+                    iop = 0;
+                } else {
+                    pci_devp = pci_devicep[pci_card_cnt];
+
+                    ASC_DBG2(2,
+                        "advansys_detect: devfn %d, bus number %d\n",
+                        pci_devp->devfn, pci_devp->bus->number);
+                    iop = pci_resource_start(pci_devp, 0);
+                    ASC_DBG2(1,
+                        "advansys_detect: vendorID %X, deviceID %X\n",
+                        pci_devp->vendor, pci_devp->device);
+                    ASC_DBG2(2, "advansys_detect: iop %X, irqLine %d\n",
+                        iop, pci_devp->irq);
+                }
+
+#endif /* CONFIG_PCI */
+                break;
+
+            default:
+                ASC_PRINT1("advansys_detect: unknown bus type: %d\n",
+                    asc_bus[bus]);
+                break;
             }
-            ASC_DBG_PRT_SCSI_HOST(2, shp);
+            ASC_DBG1(1, "advansys_detect: iop 0x%x\n", iop);
+
+            if (iop == 0)
+		break;
+
+	    advansys_board_found(tpnt, iop, pci_devp, asc_bus[bus]);
         }
     }
 
-- 
1.4.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] advansys: Clean up proc_info implementation
  2007-07-16 20:28 advansys cleanup Matthew Wilcox
  2007-07-16 22:41 ` [PATCH 1/4] advansys: Create advansys_board_found() Matthew Wilcox
@ 2007-07-16 22:41 ` Matthew Wilcox
  2007-07-16 22:41 ` [PATCH 3/4] advansys: Convert to pci_register_driver interface Matthew Wilcox
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2007-07-16 22:41 UTC (permalink / raw)
  To: linux-scsi; +Cc: Matthew Wilcox

Just use the Scsi_Host passed in, rather than looking through the driver's
own array of boards for one that matches it.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
---
 drivers/scsi/advansys.c |   35 +++++++++++------------------------
 1 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 2b6cf30..83fd9c7 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -4072,9 +4072,7 @@ static int
 advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
 		off_t offset, int length, int inout)
 {
-    struct Scsi_Host    *shp;
     asc_board_t         *boardp;
-    int                 i;
     char                *cp;
     int			cplen;
     int                 cnt;
@@ -4099,18 +4097,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      * User read of /proc/scsi/advansys/[0...] file.
      */
 
-    /* Find the specified board. */
-    for (i = 0; i < asc_board_count; i++) {
-        if (asc_host[i]->host_no == shost->host_no) {
-            break;
-        }
-    }
-    if (i == asc_board_count) {
-        return(-ENOENT);
-    }
-
-    shp = asc_host[i];
-    boardp = ASC_BOARDP(shp);
+    boardp = ASC_BOARDP(shost);
 
     /* Copy read data starting at the beginning of the buffer. */
     *start = buffer;
@@ -4124,7 +4111,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      *
      * advansys_info() returns the board string from its own static buffer.
      */
-    cp = (char *) advansys_info(shp);
+    cp = (char *) advansys_info(shost);
     strcat(cp, "\n");
     cplen = strlen(cp);
     /* Copy board information. */
@@ -4143,7 +4130,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      */
     if (ASC_WIDE_BOARD(boardp)) {
         cp = boardp->prtbuf;
-        cplen = asc_prt_adv_bios(shp, cp, ASC_PRTBUF_SIZE);
+        cplen = asc_prt_adv_bios(shost, cp, ASC_PRTBUF_SIZE);
         ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
         cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
         totcnt += cnt;
@@ -4160,7 +4147,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      * Display driver information for each device attached to the board.
      */
     cp = boardp->prtbuf;
-    cplen = asc_prt_board_devices(shp, cp, ASC_PRTBUF_SIZE);
+    cplen = asc_prt_board_devices(shost, cp, ASC_PRTBUF_SIZE);
     ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
     cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
     totcnt += cnt;
@@ -4177,9 +4164,9 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      */
     cp = boardp->prtbuf;
     if (ASC_NARROW_BOARD(boardp)) {
-        cplen = asc_prt_asc_board_eeprom(shp, cp, ASC_PRTBUF_SIZE);
+        cplen = asc_prt_asc_board_eeprom(shost, cp, ASC_PRTBUF_SIZE);
     } else {
-        cplen = asc_prt_adv_board_eeprom(shp, cp, ASC_PRTBUF_SIZE);
+        cplen = asc_prt_adv_board_eeprom(shost, cp, ASC_PRTBUF_SIZE);
     }
     ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
     cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
@@ -4196,7 +4183,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      * Display driver configuration and information for the board.
      */
     cp = boardp->prtbuf;
-    cplen = asc_prt_driver_conf(shp, cp, ASC_PRTBUF_SIZE);
+    cplen = asc_prt_driver_conf(shost, cp, ASC_PRTBUF_SIZE);
     ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
     cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
     totcnt += cnt;
@@ -4213,7 +4200,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      * Display driver statistics for the board.
      */
     cp = boardp->prtbuf;
-    cplen = asc_prt_board_stats(shp, cp, ASC_PRTBUF_SIZE);
+    cplen = asc_prt_board_stats(shost, cp, ASC_PRTBUF_SIZE);
     ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE);
     cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
     totcnt += cnt;
@@ -4230,7 +4217,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      */
     for (tgt_id = 0; tgt_id <= ADV_MAX_TID; tgt_id++) {
       cp = boardp->prtbuf;
-      cplen = asc_prt_target_stats(shp, tgt_id, cp, ASC_PRTBUF_SIZE);
+      cplen = asc_prt_target_stats(shost, tgt_id, cp, ASC_PRTBUF_SIZE);
       ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE);
       cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
       totcnt += cnt;
@@ -4250,9 +4237,9 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
      */
     cp = boardp->prtbuf;
     if (ASC_NARROW_BOARD(boardp)) {
-        cplen = asc_prt_asc_board_info(shp, cp, ASC_PRTBUF_SIZE);
+        cplen = asc_prt_asc_board_info(shost, cp, ASC_PRTBUF_SIZE);
     } else {
-        cplen = asc_prt_adv_board_info(shp, cp, ASC_PRTBUF_SIZE);
+        cplen = asc_prt_adv_board_info(shost, cp, ASC_PRTBUF_SIZE);
     }
     ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
     cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-- 
1.4.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] advansys: Convert to pci_register_driver interface
  2007-07-16 20:28 advansys cleanup Matthew Wilcox
  2007-07-16 22:41 ` [PATCH 1/4] advansys: Create advansys_board_found() Matthew Wilcox
  2007-07-16 22:41 ` [PATCH 2/4] advansys: Clean up proc_info implementation Matthew Wilcox
@ 2007-07-16 22:41 ` Matthew Wilcox
  2007-07-16 22:41 ` [PATCH 4/4] advansys: Move to scsi hotplug initialisation model Matthew Wilcox
  2007-07-17 14:24 ` advansys cleanup Matthew Wilcox
  4 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2007-07-16 22:41 UTC (permalink / raw)
  To: linux-scsi; +Cc: Matthew Wilcox

Add a pci_driver interface for the PCI advansys devices.  For
ISA/EISA/VLB devices, we still call advansys_detect and advansys_release.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
---
 drivers/scsi/advansys.c |  170 +++++++++++++++++++++--------------------------
 1 files changed, 75 insertions(+), 95 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 83fd9c7..35c4a1d 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -4261,12 +4261,12 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
 static int advansys_board_found(struct scsi_host_template *tpnt, int iop,
 				struct pci_dev *pdev, int bus_type)
 {
-    struct Scsi_Host    *shp = NULL;
-    asc_board_t         *boardp = NULL;
+    struct Scsi_Host    *shp;
+    asc_board_t         *boardp;
     ASC_DVC_VAR         *asc_dvc_varp = NULL;
     ADV_DVC_VAR         *adv_dvc_varp = NULL;
-    adv_sgblk_t         *sgp = NULL;
-    int                 share_irq = FALSE;
+    adv_sgblk_t         *sgp;
+    int                 share_irq;
     int                 iolen = 0;
     ADV_PADDR           pci_memory_address;
     int                 warn_code, err_code;
@@ -4284,6 +4284,8 @@ static int advansys_board_found(struct scsi_host_template *tpnt, int iop,
 
             /* Save a pointer to the Scsi_Host of each board found. */
             asc_host[asc_board_count++] = shp;
+	    if (pdev)
+		pci_set_drvdata(pdev, shp);
 
             /* Initialize private per board data */
             boardp = ASC_BOARDP(shp);
@@ -5033,9 +5035,8 @@ static int advansys_board_found(struct scsi_host_template *tpnt, int iop,
                     sgp = (adv_sgblk_t *)
                         kmalloc(sizeof(adv_sgblk_t), GFP_ATOMIC);
 
-                    if (sgp == NULL) {
+                    if (sgp == NULL)
                         break;
-                    }
 
                     sgp->next_sgblkp = boardp->adv_sgblkp;
                     boardp->adv_sgblkp = sgp;
@@ -5171,24 +5172,6 @@ advansys_detect(struct scsi_host_template *tpnt)
     int                 iop;
     int                 bus;
     int                 ioport = 0;
-#ifdef CONFIG_PCI
-    int                 pci_init_search = 0;
-    struct pci_dev      *pci_devicep[ASC_NUM_BOARD_SUPPORTED];
-    int                 pci_card_cnt_max = 0;
-    int                 pci_card_cnt = 0;
-    struct pci_dev      *pci_devp = NULL;
-    int                 pci_device_id_cnt = 0;
-    unsigned int        pci_device_id[ASC_PCI_DEVICE_ID_CNT] = {
-                                    PCI_DEVICE_ID_ASP_1200A,
-                                    PCI_DEVICE_ID_ASP_ABP940,
-                                    PCI_DEVICE_ID_ASP_ABP940U,
-                                    PCI_DEVICE_ID_ASP_ABP940UW,
-                                    PCI_DEVICE_ID_38C0800_REV1,
-                                    PCI_DEVICE_ID_38C1600_REV1
-                        };
-#else
-#define pci_devp NULL
-#endif /* CONFIG_PCI */
 
     if (detect_called == ASC_FALSE) {
         detect_called = ASC_TRUE;
@@ -5312,70 +5295,6 @@ advansys_detect(struct scsi_host_template *tpnt)
 #endif /* CONFIG_ISA */
                 break;
 
-            case ASC_IS_PCI:
-#ifdef CONFIG_PCI
-                if (pci_init_search == 0) {
-                    int i, j;
-
-                    pci_init_search = 1;
-
-                    /* Find all PCI cards. */
-                    while (pci_device_id_cnt < ASC_PCI_DEVICE_ID_CNT) {
-                        if ((pci_devp = pci_find_device(PCI_VENDOR_ID_ASP,
-                            pci_device_id[pci_device_id_cnt], pci_devp)) ==
-                            NULL) {
-                            pci_device_id_cnt++;
-                        } else {
-                            if (pci_enable_device(pci_devp) == 0) {
-                                pci_devicep[pci_card_cnt_max++] = pci_devp;
-                            }
-                        }
-                    }
-
-                    /*
-                     * Sort PCI cards in ascending order by PCI Bus, Slot,
-                     * and Device Number.
-                     */
-                    for (i = 0; i < pci_card_cnt_max - 1; i++)
-                    {
-                        for (j = i + 1; j < pci_card_cnt_max; j++) {
-                            if ((pci_devicep[j]->bus->number <
-                                 pci_devicep[i]->bus->number) ||
-                                ((pci_devicep[j]->bus->number ==
-                                  pci_devicep[i]->bus->number) &&
-                                  (pci_devicep[j]->devfn <
-                                   pci_devicep[i]->devfn))) {
-                                pci_devp = pci_devicep[i];
-                                pci_devicep[i] = pci_devicep[j];
-                                pci_devicep[j] = pci_devp;
-                            }
-                        }
-                    }
-
-                    pci_card_cnt = 0;
-                } else {
-                    pci_card_cnt++;
-                }
-
-                if (pci_card_cnt == pci_card_cnt_max) {
-                    iop = 0;
-                } else {
-                    pci_devp = pci_devicep[pci_card_cnt];
-
-                    ASC_DBG2(2,
-                        "advansys_detect: devfn %d, bus number %d\n",
-                        pci_devp->devfn, pci_devp->bus->number);
-                    iop = pci_resource_start(pci_devp, 0);
-                    ASC_DBG2(1,
-                        "advansys_detect: vendorID %X, deviceID %X\n",
-                        pci_devp->vendor, pci_devp->device);
-                    ASC_DBG2(2, "advansys_detect: iop %X, irqLine %d\n",
-                        iop, pci_devp->irq);
-                }
-
-#endif /* CONFIG_PCI */
-                break;
-
             default:
                 ASC_PRINT1("advansys_detect: unknown bus type: %d\n",
                     asc_bus[bus]);
@@ -5386,7 +5305,7 @@ advansys_detect(struct scsi_host_template *tpnt)
             if (iop == 0)
 		break;
 
-	    advansys_board_found(tpnt, iop, pci_devp, asc_bus[bus]);
+	    advansys_board_found(tpnt, iop, NULL, asc_bus[bus]);
         }
     }
 
@@ -5855,8 +5774,6 @@ static struct scsi_host_template driver_template = {
     .proc_info                  = advansys_proc_info,
 #endif
     .name                       = "advansys",
-    .detect                     = advansys_detect, 
-    .release                    = advansys_release,
     .info                       = advansys_info,
     .queuecommand               = advansys_queuecommand,
     .eh_bus_reset_handler	= advansys_reset,
@@ -5877,8 +5794,6 @@ static struct scsi_host_template driver_template = {
      */
     .use_clustering             = ENABLE_CLUSTERING,
 };
-#include "scsi_module.c"
-
 
 /*
  * --- Miscellaneous Driver Functions
@@ -5911,6 +5826,8 @@ advansys_interrupt(int irq, void *dev_id)
      */
     for (i = 0; i < asc_board_count; i++) {
 	shp = asc_host[i];
+	if (!shp)
+	    continue;
         boardp = ASC_BOARDP(shp);
         ASC_DBG2(2, "advansys_interrupt: i %d, boardp 0x%lx\n",
             i, (ulong) boardp);
@@ -18113,7 +18030,6 @@ AdvInquiryHandling(
 }
 MODULE_LICENSE("Dual BSD/GPL");
 
-#ifdef CONFIG_PCI
 /* PCI Devices supported by this driver */
 static struct pci_device_id advansys_pci_tbl[] __devinitdata = {
 	{ PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A,
@@ -18131,4 +18047,68 @@ static struct pci_device_id advansys_pci_tbl[] __devinitdata = {
 	{ }
 };
 MODULE_DEVICE_TABLE(pci, advansys_pci_tbl);
-#endif /* CONFIG_PCI */
+
+static int __devinit advansys_pci_probe(struct pci_dev *pdev,
+					const struct pci_device_id *ent)
+{
+	int err, ioport;
+
+	ioport = pci_resource_start(pdev, 0);
+	err = advansys_board_found(&driver_template, ioport, pdev, ASC_IS_PCI);
+
+	return err;
+}
+
+static void advansys_pci_remove(struct pci_dev *pdev)
+{
+	int i;
+	struct Scsi_Host *host = pci_get_drvdata(pdev);
+	scsi_remove_host(host);
+	advansys_release(host);
+
+	for (i = 0; i < asc_board_count; i++) {
+		if (asc_host[i] == host) {
+			asc_host[i] = NULL;
+			break;
+		}
+	}
+}
+
+static void advansys_remove(void)
+{
+	int i;
+
+	for (i = 0; i < asc_board_count; i++) {
+		struct Scsi_Host *host = asc_host[i];
+		if (!host)
+			continue;
+		scsi_remove_host(host);
+		advansys_release(host);
+		asc_host[i] = NULL;
+	}
+}
+
+static struct pci_driver advansys_pci_driver = {
+	.name = "advansys",
+	.id_table = advansys_pci_tbl,
+	.probe = advansys_pci_probe,
+	.remove = __devexit_p(advansys_pci_remove),
+};
+
+static int __init advansys_init(void)
+{
+	int error;
+	error = pci_register_driver(&advansys_pci_driver);
+	if (!error)
+		advansys_detect(&driver_template);
+	return error;
+}
+
+static void __exit advansys_exit(void)
+{
+	pci_unregister_driver(&advansys_pci_driver);
+	advansys_remove();
+}
+
+module_init(advansys_init);
+module_exit(advansys_exit);
-- 
1.4.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] advansys: Move to scsi hotplug initialisation model
  2007-07-16 20:28 advansys cleanup Matthew Wilcox
                   ` (2 preceding siblings ...)
  2007-07-16 22:41 ` [PATCH 3/4] advansys: Convert to pci_register_driver interface Matthew Wilcox
@ 2007-07-16 22:41 ` Matthew Wilcox
  2007-07-17 14:24 ` advansys cleanup Matthew Wilcox
  4 siblings, 0 replies; 9+ messages in thread
From: Matthew Wilcox @ 2007-07-16 22:41 UTC (permalink / raw)
  To: linux-scsi; +Cc: Matthew Wilcox

Switch from scsi_register/scsi_unregister to scsi_host_alloc,
scsi_add_host, scsi_scan_host and scsi_host_put.

Also restructure error handling in advansys_board_found, and split
advansys_init_wide_chip out of advansys_board_found.

Don't need to pass the driver_template around any more; and rename it
to advansys_template now we're not using scsi_module.c.

Reordered some functions so we don't need forward declarations.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
---
 drivers/scsi/advansys.c | 2129 +++++++++++++++++++++++------------------------
 1 files changed, 1026 insertions(+), 1103 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 35c4a1d..2c5b6ac 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -800,6 +800,8 @@
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
 
+MODULE_LICENSE("Dual BSD/GPL");
+
 /*
  * --- Driver Options
  */
@@ -3827,7 +3829,7 @@ typedef struct adv_req {
 /*
  * Structure allocated for each board.
  *
- * This structure is allocated by scsi_register() at the end
+ * This structure is allocated by scsi_host_alloc() at the end
  * of the 'Scsi_Host' structure starting at the 'hostdata'
  * field. It is guaranteed to be allocated from DMA-able memory.
  */
@@ -4258,1104 +4260,6 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
 }
 #endif /* CONFIG_PROC_FS */
 
-static int advansys_board_found(struct scsi_host_template *tpnt, int iop,
-				struct pci_dev *pdev, int bus_type)
-{
-    struct Scsi_Host    *shp;
-    asc_board_t         *boardp;
-    ASC_DVC_VAR         *asc_dvc_varp = NULL;
-    ADV_DVC_VAR         *adv_dvc_varp = NULL;
-    adv_sgblk_t         *sgp;
-    int                 share_irq;
-    int                 iolen = 0;
-    ADV_PADDR           pci_memory_address;
-    int                 warn_code, err_code;
-    int                 ret;
-
-            /*
-             * Register the adapter, get its configuration, and
-             * initialize it.
-             */
-            ASC_DBG(2, "advansys_board_found: scsi_register()\n");
-
-            shp = scsi_register(tpnt, sizeof(asc_board_t));
-            if (!shp)
-		return -ENOMEM;
-
-            /* Save a pointer to the Scsi_Host of each board found. */
-            asc_host[asc_board_count++] = shp;
-	    if (pdev)
-		pci_set_drvdata(pdev, shp);
-
-            /* Initialize private per board data */
-            boardp = ASC_BOARDP(shp);
-            memset(boardp, 0, sizeof(asc_board_t));
-            boardp->id = asc_board_count - 1;
-            spin_lock_init(&boardp->lock);
-
-            /*
-             * Handle both narrow and wide boards.
-             *
-             * If a Wide board was detected, set the board structure
-             * wide board flag. Set-up the board structure based on
-             * the board type.
-             */
-#ifdef CONFIG_PCI
-	if (bus_type == ASC_IS_PCI &&
-	    (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW ||
-	     pdev->device == PCI_DEVICE_ID_38C0800_REV1 ||
-	     pdev->device == PCI_DEVICE_ID_38C1600_REV1)) {
-		boardp->flags |= ASC_IS_WIDE_BOARD;
-	}
-#endif /* CONFIG_PCI */
-
-            if (ASC_NARROW_BOARD(boardp)) {
-                ASC_DBG(1, "advansys_detect: narrow board\n");
-                asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
-                asc_dvc_varp->bus_type = bus_type;
-                asc_dvc_varp->drv_ptr = boardp;
-                asc_dvc_varp->cfg = &boardp->dvc_cfg.asc_dvc_cfg;
-                asc_dvc_varp->cfg->overrun_buf = &overrun_buf[0];
-                asc_dvc_varp->iop_base = iop;
-                asc_dvc_varp->isr_callback = asc_isr_callback;
-            } else {
-                ASC_DBG(1, "advansys_detect: wide board\n");
-                adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
-                adv_dvc_varp->drv_ptr = boardp;
-                adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg;
-                adv_dvc_varp->isr_callback = adv_isr_callback;
-                adv_dvc_varp->async_callback = adv_async_callback;
-#ifdef CONFIG_PCI
-		if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) {
-			ASC_DBG(1, "advansys_detect: ASC-3550\n");
-			adv_dvc_varp->chip_type = ADV_CHIP_ASC3550;
-                } else if (pdev->device == PCI_DEVICE_ID_38C0800_REV1) {
-			ASC_DBG(1, "advansys_detect: ASC-38C0800\n");
-			adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800;
-		} else {
-			ASC_DBG(1, "advansys_detect: ASC-38C1600\n");
-			adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600;
-		}
-#endif /* CONFIG_PCI */
-
-                /*
-                 * Map the board's registers into virtual memory for
-                 * PCI slave access. Only memory accesses are used to
-                 * access the board's registers.
-                 *
-                 * Note: The PCI register base address is not always
-                 * page aligned, but the address passed to ioremap()
-                 * must be page aligned. It is guaranteed that the
-                 * PCI register base address will not cross a page
-                 * boundary.
-                 */
-                if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-                {
-                    iolen = ADV_3550_IOLEN;
-                } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-                {
-                    iolen = ADV_38C0800_IOLEN;
-                } else
-                {
-                    iolen = ADV_38C1600_IOLEN;
-                }
-#ifdef CONFIG_PCI
-                pci_memory_address = pci_resource_start(pdev, 1);
-                ASC_DBG1(1, "advansys_detect: pci_memory_address: 0x%lx\n",
-                    (ulong) pci_memory_address);
-                if ((boardp->ioremap_addr =
-                    ioremap(pci_memory_address & PAGE_MASK,
-                         PAGE_SIZE)) == 0) {
-                   ASC_PRINT3(
-"advansys_detect: board %d: ioremap(%x, %d) returned NULL\n",
-                       boardp->id, pci_memory_address, iolen);
-                   scsi_unregister(shp);
-                   asc_board_count--;
-                   return -ENOMEM;
-                }
-                ASC_DBG1(1, "advansys_detect: ioremap_addr: 0x%lx\n",
-                    (ulong) boardp->ioremap_addr);
-                adv_dvc_varp->iop_base = (AdvPortAddr)
-                    (boardp->ioremap_addr +
-                     (pci_memory_address - (pci_memory_address & PAGE_MASK)));
-                ASC_DBG1(1, "advansys_detect: iop_base: 0x%lx\n",
-                    adv_dvc_varp->iop_base);
-#endif /* CONFIG_PCI */
-
-                /*
-                 * Even though it isn't used to access wide boards, other
-                 * than for the debug line below, save I/O Port address so
-                 * that it can be reported.
-                 */
-                boardp->ioport = iop;
-
-                ASC_DBG2(1,
-"advansys_detect: iopb_chip_id_1 0x%x, iopw_chip_id_0 0x%x\n",
-                    (ushort) inp(iop + 1), (ushort) inpw(iop));
-            }
-
-#ifdef CONFIG_PROC_FS
-            /*
-             * Allocate buffer for printing information from
-             * /proc/scsi/advansys/[0...].
-             */
-            if ((boardp->prtbuf =
-                kmalloc(ASC_PRTBUF_SIZE, GFP_ATOMIC)) == NULL) {
-                ASC_PRINT3(
-"advansys_detect: board %d: kmalloc(%d, %d) returned NULL\n",
-                    boardp->id, ASC_PRTBUF_SIZE, GFP_ATOMIC);
-                scsi_unregister(shp);
-                asc_board_count--;
-                return -ENOMEM;
-            }
-#endif /* CONFIG_PROC_FS */
-
-            if (ASC_NARROW_BOARD(boardp)) {
-		asc_dvc_varp->cfg->dev = NULL;
-		/*
-                 * Set the board bus type and PCI IRQ before
-                 * calling AscInitGetConfig().
-                 */
-                switch (asc_dvc_varp->bus_type) {
-#ifdef CONFIG_ISA
-                case ASC_IS_ISA:
-                    shp->unchecked_isa_dma = TRUE;
-                    share_irq = FALSE;
-                    break;
-                case ASC_IS_VL:
-                    shp->unchecked_isa_dma = FALSE;
-                    share_irq = FALSE;
-                    break;
-                case ASC_IS_EISA:
-                    shp->unchecked_isa_dma = FALSE;
-                    share_irq = TRUE;
-                    break;
-#endif /* CONFIG_ISA */
-#ifdef CONFIG_PCI
-                case ASC_IS_PCI:
-                    shp->irq = asc_dvc_varp->irq_no = pdev->irq;
-        	    asc_dvc_varp->cfg->dev = &pdev->dev;
-                    asc_dvc_varp->cfg->pci_slot_info =
-                        ASC_PCI_MKID(pdev->bus->number,
-                            PCI_SLOT(pdev->devfn),
-                            PCI_FUNC(pdev->devfn));
-                    shp->unchecked_isa_dma = FALSE;
-                    share_irq = TRUE;
-                    break;
-#endif /* CONFIG_PCI */
-                default:
-                    ASC_PRINT2(
-"advansys_detect: board %d: unknown adapter type: %d\n",
-                        boardp->id, asc_dvc_varp->bus_type);
-                    shp->unchecked_isa_dma = TRUE;
-                    share_irq = FALSE;
-                    break;
-                }
-            } else {
-                /*
-                 * For Wide boards set PCI information before calling
-                 * AdvInitGetConfig().
-                 */
-#ifdef CONFIG_PCI
-                shp->irq = adv_dvc_varp->irq_no = pdev->irq;
-                adv_dvc_varp->cfg->dev = &pdev->dev;
-                adv_dvc_varp->cfg->pci_slot_info =
-                    ASC_PCI_MKID(pdev->bus->number,
-                        PCI_SLOT(pdev->devfn),
-                        PCI_FUNC(pdev->devfn));
-                shp->unchecked_isa_dma = FALSE;
-                share_irq = TRUE;
-#endif /* CONFIG_PCI */
-            }
-
-            /*
-             * Read the board configuration.
-             */
-            if (ASC_NARROW_BOARD(boardp)) {
-                 /*
-                  * NOTE: AscInitGetConfig() may change the board's
-                  * bus_type value. The asc_bus[bus] value should no
-                  * longer be used. If the bus_type field must be
-                  * referenced only use the bit-wise AND operator "&".
-                  */
-                ASC_DBG(2, "advansys_detect: AscInitGetConfig()\n");
-                switch(ret = AscInitGetConfig(asc_dvc_varp)) {
-                case 0:    /* No error */
-                    break;
-                case ASC_WARN_IO_PORT_ROTATE:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: I/O port address modified\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_AUTO_CONFIG:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: I/O port increment switch enabled\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_EEPROM_CHKSUM:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: EEPROM checksum error\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_IRQ_MODIFIED:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: IRQ modified\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_CMD_QNG_CONFLICT:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: tag queuing enabled w/o disconnects\n",
-                        boardp->id);
-                    break;
-                default:
-                    ASC_PRINT2(
-"AscInitGetConfig: board %d: unknown warning: 0x%x\n",
-                        boardp->id, ret);
-                    break;
-                }
-                if ((err_code = asc_dvc_varp->err_code) != 0) {
-                    ASC_PRINT3(
-"AscInitGetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
-                        boardp->id, asc_dvc_varp->init_state,
-                        asc_dvc_varp->err_code);
-                }
-            } else {
-                ASC_DBG(2, "advansys_detect: AdvInitGetConfig()\n");
-                if ((ret = AdvInitGetConfig(adv_dvc_varp)) != 0) {
-                    ASC_PRINT2("AdvInitGetConfig: board %d: warning: 0x%x\n",
-                        boardp->id, ret);
-                }
-                if ((err_code = adv_dvc_varp->err_code) != 0) {
-                    ASC_PRINT2(
-"AdvInitGetConfig: board %d error: err_code 0x%x\n",
-                        boardp->id, adv_dvc_varp->err_code);
-                }
-            }
-
-            if (err_code != 0) {
-#ifdef CONFIG_PROC_FS
-                kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                scsi_unregister(shp);
-                asc_board_count--;
-                return err_code;
-            }
-
-            /*
-             * Save the EEPROM configuration so that it can be displayed
-             * from /proc/scsi/advansys/[0...].
-             */
-            if (ASC_NARROW_BOARD(boardp)) {
-
-                ASCEEP_CONFIG *ep;
-
-                /*
-                 * Set the adapter's target id bit in the 'init_tidmask' field.
-                 */
-                boardp->init_tidmask |=
-                    ADV_TID_TO_TIDMASK(asc_dvc_varp->cfg->chip_scsi_id);
-
-                /*
-                 * Save EEPROM settings for the board.
-                 */
-                ep = &boardp->eep_config.asc_eep;
-
-                ep->init_sdtr = asc_dvc_varp->cfg->sdtr_enable;
-                ep->disc_enable = asc_dvc_varp->cfg->disc_enable;
-                ep->use_cmd_qng = asc_dvc_varp->cfg->cmd_qng_enabled;
-                ASC_EEP_SET_DMA_SPD(ep, asc_dvc_varp->cfg->isa_dma_speed);
-                ep->start_motor = asc_dvc_varp->start_motor;
-                ep->cntl = asc_dvc_varp->dvc_cntl;
-                ep->no_scam = asc_dvc_varp->no_scam;
-                ep->max_total_qng = asc_dvc_varp->max_total_qng;
-                ASC_EEP_SET_CHIP_ID(ep, asc_dvc_varp->cfg->chip_scsi_id);
-                /* 'max_tag_qng' is set to the same value for every device. */
-                ep->max_tag_qng = asc_dvc_varp->cfg->max_tag_qng[0];
-                ep->adapter_info[0] = asc_dvc_varp->cfg->adapter_info[0];
-                ep->adapter_info[1] = asc_dvc_varp->cfg->adapter_info[1];
-                ep->adapter_info[2] = asc_dvc_varp->cfg->adapter_info[2];
-                ep->adapter_info[3] = asc_dvc_varp->cfg->adapter_info[3];
-                ep->adapter_info[4] = asc_dvc_varp->cfg->adapter_info[4];
-                ep->adapter_info[5] = asc_dvc_varp->cfg->adapter_info[5];
-
-               /*
-                * Modify board configuration.
-                */
-                ASC_DBG(2, "advansys_detect: AscInitSetConfig()\n");
-                switch (ret = AscInitSetConfig(asc_dvc_varp)) {
-                case 0:    /* No error. */
-                    break;
-                case ASC_WARN_IO_PORT_ROTATE:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: I/O port address modified\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_AUTO_CONFIG:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: I/O port increment switch enabled\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_EEPROM_CHKSUM:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: EEPROM checksum error\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_IRQ_MODIFIED:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: IRQ modified\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_CMD_QNG_CONFLICT:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: tag queuing w/o disconnects\n",
-                        boardp->id);
-                    break;
-                default:
-                    ASC_PRINT2(
-"AscInitSetConfig: board %d: unknown warning: 0x%x\n",
-                        boardp->id, ret);
-                    break;
-                }
-                if (asc_dvc_varp->err_code != 0) {
-                    ASC_PRINT3(
-"AscInitSetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
-                        boardp->id, asc_dvc_varp->init_state,
-                        asc_dvc_varp->err_code);
-#ifdef CONFIG_PROC_FS
-                    kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                    scsi_unregister(shp);
-                    asc_board_count--;
-                    return asc_dvc_varp->err_code;
-                }
-
-                /*
-                 * Finish initializing the 'Scsi_Host' structure.
-                 */
-                /* AscInitSetConfig() will set the IRQ for non-PCI boards. */
-                if ((asc_dvc_varp->bus_type & ASC_IS_PCI) == 0) {
-                    shp->irq = asc_dvc_varp->irq_no;
-                }
-            } else {
-                ADVEEP_3550_CONFIG      *ep_3550;
-                ADVEEP_38C0800_CONFIG   *ep_38C0800;
-                ADVEEP_38C1600_CONFIG   *ep_38C1600;
-
-                /*
-                 * Save Wide EEP Configuration Information.
-                 */
-                if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-                {
-                    ep_3550 = &boardp->eep_config.adv_3550_eep;
-
-                    ep_3550->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
-                    ep_3550->max_host_qng = adv_dvc_varp->max_host_qng;
-                    ep_3550->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
-                    ep_3550->termination = adv_dvc_varp->cfg->termination;
-                    ep_3550->disc_enable = adv_dvc_varp->cfg->disc_enable;
-                    ep_3550->bios_ctrl = adv_dvc_varp->bios_ctrl;
-                    ep_3550->wdtr_able = adv_dvc_varp->wdtr_able;
-                    ep_3550->sdtr_able = adv_dvc_varp->sdtr_able;
-                    ep_3550->ultra_able = adv_dvc_varp->ultra_able;
-                    ep_3550->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_3550->start_motor = adv_dvc_varp->start_motor;
-                    ep_3550->scsi_reset_delay = adv_dvc_varp->scsi_reset_wait;
-                    ep_3550->serial_number_word1 =
-                        adv_dvc_varp->cfg->serial1;
-                    ep_3550->serial_number_word2 =
-                        adv_dvc_varp->cfg->serial2;
-                    ep_3550->serial_number_word3 =
-                        adv_dvc_varp->cfg->serial3;
-                } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-                {
-                    ep_38C0800 = &boardp->eep_config.adv_38C0800_eep;
-
-                    ep_38C0800->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
-                    ep_38C0800->max_host_qng = adv_dvc_varp->max_host_qng;
-                    ep_38C0800->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
-                    ep_38C0800->termination_lvd =
-                        adv_dvc_varp->cfg->termination;
-                    ep_38C0800->disc_enable = adv_dvc_varp->cfg->disc_enable;
-                    ep_38C0800->bios_ctrl = adv_dvc_varp->bios_ctrl;
-                    ep_38C0800->wdtr_able = adv_dvc_varp->wdtr_able;
-                    ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_38C0800->sdtr_speed1 = adv_dvc_varp->sdtr_speed1;
-                    ep_38C0800->sdtr_speed2 = adv_dvc_varp->sdtr_speed2;
-                    ep_38C0800->sdtr_speed3 = adv_dvc_varp->sdtr_speed3;
-                    ep_38C0800->sdtr_speed4 = adv_dvc_varp->sdtr_speed4;
-                    ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_38C0800->start_motor = adv_dvc_varp->start_motor;
-                    ep_38C0800->scsi_reset_delay =
-                        adv_dvc_varp->scsi_reset_wait;
-                    ep_38C0800->serial_number_word1 =
-                        adv_dvc_varp->cfg->serial1;
-                    ep_38C0800->serial_number_word2 =
-                        adv_dvc_varp->cfg->serial2;
-                    ep_38C0800->serial_number_word3 =
-                        adv_dvc_varp->cfg->serial3;
-                } else
-                {
-                    ep_38C1600 = &boardp->eep_config.adv_38C1600_eep;
-
-                    ep_38C1600->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
-                    ep_38C1600->max_host_qng = adv_dvc_varp->max_host_qng;
-                    ep_38C1600->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
-                    ep_38C1600->termination_lvd =
-                        adv_dvc_varp->cfg->termination;
-                    ep_38C1600->disc_enable = adv_dvc_varp->cfg->disc_enable;
-                    ep_38C1600->bios_ctrl = adv_dvc_varp->bios_ctrl;
-                    ep_38C1600->wdtr_able = adv_dvc_varp->wdtr_able;
-                    ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_38C1600->sdtr_speed1 = adv_dvc_varp->sdtr_speed1;
-                    ep_38C1600->sdtr_speed2 = adv_dvc_varp->sdtr_speed2;
-                    ep_38C1600->sdtr_speed3 = adv_dvc_varp->sdtr_speed3;
-                    ep_38C1600->sdtr_speed4 = adv_dvc_varp->sdtr_speed4;
-                    ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_38C1600->start_motor = adv_dvc_varp->start_motor;
-                    ep_38C1600->scsi_reset_delay =
-                        adv_dvc_varp->scsi_reset_wait;
-                    ep_38C1600->serial_number_word1 =
-                        adv_dvc_varp->cfg->serial1;
-                    ep_38C1600->serial_number_word2 =
-                        adv_dvc_varp->cfg->serial2;
-                    ep_38C1600->serial_number_word3 =
-                        adv_dvc_varp->cfg->serial3;
-                }
-
-                /*
-                 * Set the adapter's target id bit in the 'init_tidmask' field.
-                 */
-                boardp->init_tidmask |=
-                    ADV_TID_TO_TIDMASK(adv_dvc_varp->chip_scsi_id);
-
-                /*
-                 * Finish initializing the 'Scsi_Host' structure.
-                 */
-                shp->irq = adv_dvc_varp->irq_no;
-            }
-
-            /*
-             * Channels are numbered beginning with 0. For AdvanSys one host
-             * structure supports one channel. Multi-channel boards have a
-             * separate host structure for each channel.
-             */
-            shp->max_channel = 0;
-            if (ASC_NARROW_BOARD(boardp)) {
-                shp->max_id = ASC_MAX_TID + 1;
-                shp->max_lun = ASC_MAX_LUN + 1;
-
-                shp->io_port = asc_dvc_varp->iop_base;
-                boardp->asc_n_io_port = ASC_IOADR_GAP;
-                shp->this_id = asc_dvc_varp->cfg->chip_scsi_id;
-
-                /* Set maximum number of queues the adapter can handle. */
-                shp->can_queue = asc_dvc_varp->max_total_qng;
-            } else {
-                shp->max_id = ADV_MAX_TID + 1;
-                shp->max_lun = ADV_MAX_LUN + 1;
-
-                /*
-                 * Save the I/O Port address and length even though
-                 * I/O ports are not used to access Wide boards.
-                 * Instead the Wide boards are accessed with
-                 * PCI Memory Mapped I/O.
-                 */
-                shp->io_port = iop;
-                boardp->asc_n_io_port = iolen;
-
-                shp->this_id = adv_dvc_varp->chip_scsi_id;
-
-                /* Set maximum number of queues the adapter can handle. */
-                shp->can_queue = adv_dvc_varp->max_host_qng;
-            }
-
-            /*
-             * 'n_io_port' currently is one byte.
-             *
-             * Set a value to 'n_io_port', but never referenced it because
-             * it may be truncated.
-             */
-            shp->n_io_port = boardp->asc_n_io_port <= 255 ?
-                boardp->asc_n_io_port : 255;
-
-            /*
-             * Following v1.3.89, 'cmd_per_lun' is no longer needed
-             * and should be set to zero.
-             *
-             * But because of a bug introduced in v1.3.89 if the driver is
-             * compiled as a module and 'cmd_per_lun' is zero, the Mid-Level
-             * SCSI function 'allocate_device' will panic. To allow the driver
-             * to work as a module in these kernels set 'cmd_per_lun' to 1.
-	     *
-	     * Note: This is wrong.  cmd_per_lun should be set to the depth
-	     * you want on untagged devices always.
-#ifdef MODULE
-             */
-            shp->cmd_per_lun = 1;
-/* #else
-            shp->cmd_per_lun = 0;
-#endif */
-
-            /*
-             * Set the maximum number of scatter-gather elements the
-             * adapter can handle.
-             */
-            if (ASC_NARROW_BOARD(boardp)) {
-                /*
-                 * Allow two commands with 'sg_tablesize' scatter-gather
-                 * elements to be executed simultaneously. This value is
-                 * the theoretical hardware limit. It may be decreased
-                 * below.
-                 */
-                shp->sg_tablesize =
-                    (((asc_dvc_varp->max_total_qng - 2) / 2) *
-                    ASC_SG_LIST_PER_Q) + 1;
-            } else {
-                shp->sg_tablesize = ADV_MAX_SG_LIST;
-            }
-
-            /*
-             * The value of 'sg_tablesize' can not exceed the SCSI
-             * mid-level driver definition of SG_ALL. SG_ALL also
-             * must not be exceeded, because it is used to define the
-             * size of the scatter-gather table in 'struct asc_sg_head'.
-             */
-            if (shp->sg_tablesize > SG_ALL) {
-                shp->sg_tablesize = SG_ALL;
-            }
-
-            ASC_DBG1(1, "advansys_detect: sg_tablesize: %d\n",
-                shp->sg_tablesize);
-
-            /* BIOS start address. */
-            if (ASC_NARROW_BOARD(boardp)) {
-                shp->base =
-                        ((ulong) AscGetChipBiosAddress(
-                            asc_dvc_varp->iop_base,
-                            asc_dvc_varp->bus_type));
-            } else {
-                /*
-                 * Fill-in BIOS board variables. The Wide BIOS saves
-                 * information in LRAM that is used by the driver.
-                 */
-                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_SIGNATURE,
-                    boardp->bios_signature);
-                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_VERSION,
-                    boardp->bios_version);
-                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_CODESEG,
-                    boardp->bios_codeseg);
-                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_CODELEN,
-                    boardp->bios_codelen);
-
-                ASC_DBG2(1,
-                    "advansys_detect: bios_signature 0x%x, bios_version 0x%x\n",
-                    boardp->bios_signature, boardp->bios_version);
-
-                ASC_DBG2(1,
-                    "advansys_detect: bios_codeseg 0x%x, bios_codelen 0x%x\n",
-                    boardp->bios_codeseg, boardp->bios_codelen);
-
-                /*
-                 * If the BIOS saved a valid signature, then fill in
-                 * the BIOS code segment base address.
-                 */
-                if (boardp->bios_signature == 0x55AA) {
-                    /*
-                     * Convert x86 realmode code segment to a linear
-                     * address by shifting left 4.
-                     */
-                    shp->base = ((ulong) boardp->bios_codeseg << 4);
-                } else {
-                    shp->base = 0;
-                }
-            }
-
-            /*
-             * Register Board Resources - I/O Port, DMA, IRQ
-             */
-
-            /*
-             * Register I/O port range.
-             *
-             * For Wide boards the I/O ports are not used to access
-             * the board, but request the region anyway.
-             *
-             * 'shp->n_io_port' is not referenced, because it may be truncated.
-             */
-            ASC_DBG2(2,
-                "advansys_detect: request_region port 0x%lx, len 0x%x\n",
-                (ulong) shp->io_port, boardp->asc_n_io_port);
-            if (request_region(shp->io_port, boardp->asc_n_io_port,
-                               "advansys") == NULL) {
-                ASC_PRINT3(
-"advansys_detect: board %d: request_region() failed, port 0x%lx, len 0x%x\n",
-                    boardp->id, (ulong) shp->io_port, boardp->asc_n_io_port);
-#ifdef CONFIG_PROC_FS
-                kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                scsi_unregister(shp);
-                asc_board_count--;
-                return -EBUSY;
-            }
-
-            /* Register DMA Channel for Narrow boards. */
-            shp->dma_channel = NO_ISA_DMA; /* Default to no ISA DMA. */
-#ifdef CONFIG_ISA
-            if (ASC_NARROW_BOARD(boardp)) {
-                /* Register DMA channel for ISA bus. */
-                if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
-                    shp->dma_channel = asc_dvc_varp->cfg->isa_dma_channel;
-                    if ((ret =
-                         request_dma(shp->dma_channel, "advansys")) != 0) {
-                        ASC_PRINT3(
-"advansys_detect: board %d: request_dma() %d failed %d\n",
-                            boardp->id, shp->dma_channel, ret);
-                        release_region(shp->io_port, boardp->asc_n_io_port);
-#ifdef CONFIG_PROC_FS
-                        kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                        scsi_unregister(shp);
-                        asc_board_count--;
-                        return ret;
-                    }
-                    AscEnableIsaDma(shp->dma_channel);
-                }
-            }
-#endif /* CONFIG_ISA */
-
-            /* Register IRQ Number. */
-            ASC_DBG1(2, "advansys_detect: request_irq() %d\n", shp->irq);
-           /*
-            * If request_irq() fails with the IRQF_DISABLED flag set,
-            * then try again without the IRQF_DISABLED flag set. This
-            * allows IRQ sharing to work even with other drivers that
-            * do not set the IRQF_DISABLED flag.
-            *
-            * If IRQF_DISABLED is not set, then interrupts are enabled
-            * before the driver interrupt function is called.
-            */
-            if (((ret = request_irq(shp->irq, advansys_interrupt,
-                            IRQF_DISABLED | (share_irq == TRUE ? IRQF_SHARED : 0),
-                            "advansys", boardp)) != 0) &&
-                ((ret = request_irq(shp->irq, advansys_interrupt,
-                            (share_irq == TRUE ? IRQF_SHARED : 0),
-                            "advansys", boardp)) != 0))
-            {
-                if (ret == -EBUSY) {
-                    ASC_PRINT2(
-"advansys_detect: board %d: request_irq(): IRQ 0x%x already in use.\n",
-                        boardp->id, shp->irq);
-                } else if (ret == -EINVAL) {
-                    ASC_PRINT2(
-"advansys_detect: board %d: request_irq(): IRQ 0x%x not valid.\n",
-                        boardp->id, shp->irq);
-                } else {
-                    ASC_PRINT3(
-"advansys_detect: board %d: request_irq(): IRQ 0x%x failed with %d\n",
-                        boardp->id, shp->irq, ret);
-                }
-                release_region(shp->io_port, boardp->asc_n_io_port);
-                iounmap(boardp->ioremap_addr);
-                if (shp->dma_channel != NO_ISA_DMA) {
-                    free_dma(shp->dma_channel);
-                }
-#ifdef CONFIG_PROC_FS
-                kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                scsi_unregister(shp);
-                asc_board_count--;
-                return ret;
-            }
-
-            /*
-             * Initialize board RISC chip and enable interrupts.
-             */
-            if (ASC_NARROW_BOARD(boardp)) {
-                ASC_DBG(2, "advansys_detect: AscInitAsc1000Driver()\n");
-                warn_code = AscInitAsc1000Driver(asc_dvc_varp);
-                err_code = asc_dvc_varp->err_code;
-
-                if (warn_code || err_code) {
-                    ASC_PRINT4(
-"advansys_detect: board %d error: init_state 0x%x, warn 0x%x, error 0x%x\n",
-                        boardp->id, asc_dvc_varp->init_state,
-                        warn_code, err_code);
-                }
-            } else {
-                ADV_CARR_T      *carrp;
-                int             req_cnt = 0;
-                adv_req_t       *reqp = NULL;
-                int             sg_cnt = 0;
-
-                /*
-                 * Allocate buffer carrier structures. The total size
-                 * is about 4 KB, so allocate all at once.
-                 */
-                carrp =
-                    (ADV_CARR_T *) kmalloc(ADV_CARRIER_BUFSIZE, GFP_ATOMIC);
-                ASC_DBG1(1, "advansys_detect: carrp 0x%lx\n", (ulong) carrp);
-
-                if (carrp == NULL) {
-                    goto kmalloc_error;
-                }
-
-                /*
-                 * Allocate up to 'max_host_qng' request structures for
-                 * the Wide board. The total size is about 16 KB, so
-                 * allocate all at once. If the allocation fails decrement
-                 * and try again.
-                 */
-                for (req_cnt = adv_dvc_varp->max_host_qng;
-                    req_cnt > 0; req_cnt--) {
-
-                    reqp = (adv_req_t *)
-                        kmalloc(sizeof(adv_req_t) * req_cnt, GFP_ATOMIC);
-
-                    ASC_DBG3(1,
-                        "advansys_detect: reqp 0x%lx, req_cnt %d, bytes %lu\n",
-                        (ulong) reqp, req_cnt,
-                        (ulong) sizeof(adv_req_t) * req_cnt);
-
-                    if (reqp != NULL) {
-                        break;
-                    }
-                }
-                if (reqp == NULL)
-                {
-                    goto kmalloc_error;
-                }
-
-                /*
-                 * Allocate up to ADV_TOT_SG_BLOCK request structures for
-                 * the Wide board. Each structure is about 136 bytes.
-                 */
-                boardp->adv_sgblkp = NULL;
-                for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) {
-
-                    sgp = (adv_sgblk_t *)
-                        kmalloc(sizeof(adv_sgblk_t), GFP_ATOMIC);
-
-                    if (sgp == NULL)
-                        break;
-
-                    sgp->next_sgblkp = boardp->adv_sgblkp;
-                    boardp->adv_sgblkp = sgp;
-
-                }
-                ASC_DBG3(1,
-                    "advansys_detect: sg_cnt %d * %u = %u bytes\n",
-                    sg_cnt, sizeof(adv_sgblk_t),
-                    (unsigned) (sizeof(adv_sgblk_t) * sg_cnt));
-
-                /*
-                 * If no request structures or scatter-gather structures could
-                 * be allocated, then return an error. Otherwise continue with
-                 * initialization.
-                 */
-    kmalloc_error:
-                if (carrp == NULL)
-                {
-                    ASC_PRINT1(
-"advansys_detect: board %d error: failed to kmalloc() carrier buffer.\n",
-                        boardp->id);
-                    err_code = ADV_ERROR;
-                } else if (reqp == NULL) {
-                    kfree(carrp);
-                    ASC_PRINT1(
-"advansys_detect: board %d error: failed to kmalloc() adv_req_t buffer.\n",
-                        boardp->id);
-                    err_code = ADV_ERROR;
-                } else if (boardp->adv_sgblkp == NULL) {
-                    kfree(carrp);
-                    kfree(reqp);
-                    ASC_PRINT1(
-"advansys_detect: board %d error: failed to kmalloc() adv_sgblk_t buffers.\n",
-                        boardp->id);
-                    err_code = ADV_ERROR;
-                } else {
-
-                    /* Save carrier buffer pointer. */
-                    boardp->orig_carrp = carrp;
-
-                    /*
-                     * Save original pointer for kfree() in case the
-                     * driver is built as a module and can be unloaded.
-                     */
-                    boardp->orig_reqp = reqp;
-
-                    adv_dvc_varp->carrier_buf = carrp;
-
-                    /*
-                     * Point 'adv_reqp' to the request structures and
-                     * link them together.
-                     */
-                    req_cnt--;
-                    reqp[req_cnt].next_reqp = NULL;
-                    for (; req_cnt > 0; req_cnt--) {
-                        reqp[req_cnt - 1].next_reqp = &reqp[req_cnt];
-                    }
-                    boardp->adv_reqp = &reqp[0];
-
-                    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-                    {
-                        ASC_DBG(2,
-                            "advansys_detect: AdvInitAsc3550Driver()\n");
-                        warn_code = AdvInitAsc3550Driver(adv_dvc_varp);
-                    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
-                        ASC_DBG(2,
-                            "advansys_detect: AdvInitAsc38C0800Driver()\n");
-                        warn_code = AdvInitAsc38C0800Driver(adv_dvc_varp);
-                    } else {
-                        ASC_DBG(2,
-                            "advansys_detect: AdvInitAsc38C1600Driver()\n");
-                        warn_code = AdvInitAsc38C1600Driver(adv_dvc_varp);
-                    }
-                    err_code = adv_dvc_varp->err_code;
-
-                    if (warn_code || err_code) {
-                        ASC_PRINT3(
-"advansys_detect: board %d error: warn 0x%x, error 0x%x\n",
-                            boardp->id, warn_code, err_code);
-                    }
-                }
-            }
-
-            if (err_code != 0) {
-                release_region(shp->io_port, boardp->asc_n_io_port);
-                if (ASC_WIDE_BOARD(boardp)) {
-                    iounmap(boardp->ioremap_addr);
-                    kfree(boardp->orig_carrp);
-                    boardp->orig_carrp = NULL;
-                    if (boardp->orig_reqp) {
-                        kfree(boardp->orig_reqp);
-                        boardp->orig_reqp = boardp->adv_reqp = NULL;
-                    }
-                    while ((sgp = boardp->adv_sgblkp) != NULL)
-                    {
-                        boardp->adv_sgblkp = sgp->next_sgblkp;
-                        kfree(sgp);
-                    }
-                }
-                if (shp->dma_channel != NO_ISA_DMA) {
-                    free_dma(shp->dma_channel);
-                }
-#ifdef CONFIG_PROC_FS
-                kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                free_irq(shp->irq, boardp);
-                scsi_unregister(shp);
-                asc_board_count--;
-                return err_code;
-	}
-	ASC_DBG_PRT_SCSI_HOST(2, shp);
-
-	return 0;
-}
-
-/*
- * advansys_detect()
- *
- * Detect function for AdvanSys adapters.
- *
- * Argument is a pointer to the host driver's scsi_hosts entry.
- *
- * Return number of adapters found.
- *
- * Note: Because this function is called during system initialization
- * it must not call SCSI mid-level functions including scsi_malloc()
- * and scsi_free().
- */
-static int __init
-advansys_detect(struct scsi_host_template *tpnt)
-{
-    static int          detect_called = ASC_FALSE;
-    int                 iop;
-    int                 bus;
-    int                 ioport = 0;
-
-    if (detect_called == ASC_FALSE) {
-        detect_called = ASC_TRUE;
-    } else {
-        printk("AdvanSys SCSI: advansys_detect() multiple calls ignored\n");
-        return 0;
-    }
-
-    ASC_DBG(1, "advansys_detect: begin\n");
-
-    asc_board_count = 0;
-
-    /*
-     * If I/O port probing has been modified, then verify and
-     * clean-up the 'asc_ioport' list.
-     */
-    if (asc_iopflag == ASC_TRUE) {
-        for (ioport = 0; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
-            ASC_DBG2(1, "advansys_detect: asc_ioport[%d] 0x%x\n",
-                ioport, asc_ioport[ioport]);
-            if (asc_ioport[ioport] != 0) {
-                for (iop = 0; iop < ASC_IOADR_TABLE_MAX_IX; iop++) {
-                    if (_asc_def_iop_base[iop] == asc_ioport[ioport]) {
-                        break;
-                    }
-                }
-                if (iop == ASC_IOADR_TABLE_MAX_IX) {
-                    printk(
-"AdvanSys SCSI: specified I/O Port 0x%X is invalid\n",
-                        asc_ioport[ioport]);
-                    asc_ioport[ioport] = 0;
-                }
-            }
-        }
-        ioport = 0;
-    }
-
-    for (bus = 0; bus < ASC_NUM_BUS; bus++) {
-
-        ASC_DBG2(1, "advansys_detect: bus search type %d (%s)\n",
-            bus, asc_bus_name[bus]);
-        iop = 0;
-
-        while (asc_board_count < ASC_NUM_BOARD_SUPPORTED) {
-
-            ASC_DBG1(2, "advansys_detect: asc_board_count %d\n",
-                asc_board_count);
-
-            switch (asc_bus[bus]) {
-            case ASC_IS_ISA:
-            case ASC_IS_VL:
-#ifdef CONFIG_ISA
-                if (asc_iopflag == ASC_FALSE) {
-                    iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
-                } else {
-                    /*
-                     * ISA and VL I/O port scanning has either been
-                     * eliminated or limited to selected ports on
-                     * the LILO command line, /etc/lilo.conf, or
-                     * by setting variables when the module was loaded.
-                     */
-                    ASC_DBG(1, "advansys_detect: I/O port scanning modified\n");
-                ioport_try_again:
-                    iop = 0;
-                    for (; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
-                        if ((iop = asc_ioport[ioport]) != 0) {
-                            break;
-                        }
-                    }
-                    if (iop) {
-                        ASC_DBG1(1,
-                                "advansys_detect: probing I/O port 0x%x...\n",
-                            iop);
-			if (!request_region(iop, ASC_IOADR_GAP, "advansys")){
-                            printk(
-"AdvanSys SCSI: specified I/O Port 0x%X is busy\n", iop);
-                            /* Don't try this I/O port twice. */
-                            asc_ioport[ioport] = 0;
-                            goto ioport_try_again;
-                        } else if (AscFindSignature(iop) == ASC_FALSE) {
-                            printk(
-"AdvanSys SCSI: specified I/O Port 0x%X has no adapter\n", iop);
-                            /* Don't try this I/O port twice. */
-			    release_region(iop, ASC_IOADR_GAP);
-                            asc_ioport[ioport] = 0;
-                            goto ioport_try_again;
-                        } else {
-                            /*
-                             * If this isn't an ISA board, then it must be
-                             * a VL board. If currently looking an ISA
-                             * board is being looked for then try for
-                             * another ISA board in 'asc_ioport'.
-                             */
-                            if (asc_bus[bus] == ASC_IS_ISA &&
-                                (AscGetChipVersion(iop, ASC_IS_ISA) &
-                                 ASC_CHIP_VER_ISA_BIT) == 0) {
-                                 /*
-                                  * Don't clear 'asc_ioport[ioport]'. Try
-                                  * this board again for VL. Increment
-                                  * 'ioport' past this board.
-                                  */
-                                 ioport++;
-				 release_region(iop, ASC_IOADR_GAP);
-                                 goto ioport_try_again;
-                            }
-                        }
-                        /*
-                         * This board appears good, don't try the I/O port
-                         * again by clearing its value. Increment 'ioport'
-                         * for the next iteration.
-                         */
-                        asc_ioport[ioport++] = 0;
-                    }
-                }
-#endif /* CONFIG_ISA */
-                break;
-
-            case ASC_IS_EISA:
-#ifdef CONFIG_ISA
-                iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
-#endif /* CONFIG_ISA */
-                break;
-
-            default:
-                ASC_PRINT1("advansys_detect: unknown bus type: %d\n",
-                    asc_bus[bus]);
-                break;
-            }
-            ASC_DBG1(1, "advansys_detect: iop 0x%x\n", iop);
-
-            if (iop == 0)
-		break;
-
-	    advansys_board_found(tpnt, iop, NULL, asc_bus[bus]);
-        }
-    }
-
-    ASC_DBG1(1, "advansys_detect: done: asc_board_count %d\n", asc_board_count);
-    return asc_board_count;
-}
-
-/*
- * advansys_release()
- *
- * Release resources allocated for a single AdvanSys adapter.
- */
-static int
-advansys_release(struct Scsi_Host *shp)
-{
-    asc_board_t    *boardp;
-
-    ASC_DBG(1, "advansys_release: begin\n");
-    boardp = ASC_BOARDP(shp);
-    free_irq(shp->irq, boardp);
-    if (shp->dma_channel != NO_ISA_DMA) {
-        ASC_DBG(1, "advansys_release: free_dma()\n");
-        free_dma(shp->dma_channel);
-    }
-    release_region(shp->io_port, boardp->asc_n_io_port);
-    if (ASC_WIDE_BOARD(boardp)) {
-        adv_sgblk_t    *sgp = NULL;
-
-        iounmap(boardp->ioremap_addr);
-        kfree(boardp->orig_carrp);
-        boardp->orig_carrp = NULL;
-        if (boardp->orig_reqp) {
-            kfree(boardp->orig_reqp);
-            boardp->orig_reqp = boardp->adv_reqp = NULL;
-        }
-        while ((sgp = boardp->adv_sgblkp) != NULL)
-        {
-            boardp->adv_sgblkp = sgp->next_sgblkp;
-            kfree(sgp);
-        }
-    }
-#ifdef CONFIG_PROC_FS
-    ASC_ASSERT(boardp->prtbuf != NULL);
-    kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-    scsi_unregister(shp);
-    ASC_DBG(1, "advansys_release: end\n");
-    return 0;
-}
-
 /*
  * advansys_info()
  *
@@ -5768,7 +4672,7 @@ advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev,
  * --- Loadable Driver Support
  */
 
-static struct scsi_host_template driver_template = {
+static struct scsi_host_template advansys_template = {
     .proc_name                  = "advansys",
 #ifdef CONFIG_PROC_FS
     .proc_info                  = advansys_proc_info,
@@ -18028,7 +16932,1025 @@ AdvInquiryHandling(
         }
     }
 }
-MODULE_LICENSE("Dual BSD/GPL");
+
+static int __init advansys_init_wide_chip(asc_board_t *boardp,
+					  ADV_DVC_VAR *adv_dvc_varp)
+{
+	ADV_CARR_T *carrp;
+	int req_cnt = 0;
+	adv_req_t *reqp = NULL;
+	int sg_cnt = 0;
+	adv_sgblk_t *sgp;
+	int warn_code, err_code;
+
+	/*
+	 * Allocate buffer carrier structures. The total size
+	 * is about 4 KB, so allocate all at once.
+	 */
+	carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL);
+	ASC_DBG1(1, "advansys_detect: carrp 0x%lx\n", (ulong) carrp);
+
+	if (!carrp)
+		goto kmalloc_failed;
+
+	/*
+	 * Allocate up to 'max_host_qng' request structures for
+	 * the Wide board. The total size is about 16 KB, so
+	 * allocate all at once. If the allocation fails decrement
+	 * and try again.
+	 */
+	for (req_cnt = adv_dvc_varp->max_host_qng; req_cnt > 0; req_cnt--) {
+		reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL);
+
+		ASC_DBG3(1,
+			 "advansys_detect: reqp 0x%lx, req_cnt %d, bytes %lu\n",
+			 (ulong) reqp, req_cnt,
+			 (ulong) sizeof(adv_req_t) * req_cnt);
+
+		if (reqp)
+			break;
+	}
+
+	if (!reqp)
+		goto kmalloc_failed;
+
+	/*
+	 * Allocate up to ADV_TOT_SG_BLOCK request structures for
+	 * the Wide board. Each structure is about 136 bytes.
+	 */
+	boardp->adv_sgblkp = NULL;
+	for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) {
+		sgp = kmalloc(sizeof(adv_sgblk_t), GFP_KERNEL);
+
+		if (!sgp)
+			break;
+
+		sgp->next_sgblkp = boardp->adv_sgblkp;
+		boardp->adv_sgblkp = sgp;
+	}
+
+	if (!boardp->adv_sgblkp)
+		goto kmalloc_failed;
+
+	ASC_DBG3(1, "advansys_detect: sg_cnt %d * %u = %u bytes\n",
+		 sg_cnt, sizeof(adv_sgblk_t),
+		 (unsigned) (sizeof(adv_sgblk_t) * sg_cnt));
+
+	/* Save carrier buffer pointer. */
+	boardp->orig_carrp = carrp;
+
+	/*
+	 * Save original pointer for kfree() in case the
+	 * driver is built as a module and can be unloaded.
+	 */
+	boardp->orig_reqp = reqp;
+
+	adv_dvc_varp->carrier_buf = carrp;
+
+	/*
+	 * Point 'adv_reqp' to the request structures and
+	 * link them together.
+	 */
+	req_cnt--;
+	reqp[req_cnt].next_reqp = NULL;
+	for (; req_cnt > 0; req_cnt--) {
+		reqp[req_cnt - 1].next_reqp = &reqp[req_cnt];
+	}
+	boardp->adv_reqp = &reqp[0];
+
+	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+		ASC_DBG(2, "advansys_detect: AdvInitAsc3550Driver()\n");
+		warn_code = AdvInitAsc3550Driver(adv_dvc_varp);
+	} else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+		ASC_DBG(2, "advansys_detect: AdvInitAsc38C0800Driver()\n");
+		warn_code = AdvInitAsc38C0800Driver(adv_dvc_varp);
+	} else {
+		ASC_DBG(2, "advansys_detect: AdvInitAsc38C1600Driver()\n");
+		warn_code = AdvInitAsc38C1600Driver(adv_dvc_varp);
+	}
+	err_code = adv_dvc_varp->err_code;
+
+	if (warn_code || err_code) {
+		ASC_PRINT3("advansys_detect: board %d error: warn 0x%x, "
+			   "error 0x%x\n", boardp->id, warn_code, err_code);
+	}
+
+	if (err_code == 0)
+		return 0;
+
+	while ((sgp = boardp->adv_sgblkp) != NULL) {
+		boardp->adv_sgblkp = sgp->next_sgblkp;
+		kfree(sgp);
+	}
+
+ failed:
+	kfree(reqp);
+	kfree(carrp);
+	return err_code;
+
+ kmalloc_failed:
+	ASC_PRINT1("advansys_detect: board %d error: kmalloc() failed\n",
+		   boardp->id);
+	err_code = ADV_ERROR;
+	goto failed;
+}
+
+static int advansys_board_found(int iop, struct pci_dev *pdev, int bus_type)
+{
+	struct Scsi_Host *shost;
+	asc_board_t *boardp;
+	ASC_DVC_VAR *asc_dvc_varp = NULL;
+	ADV_DVC_VAR *adv_dvc_varp = NULL;
+	int share_irq;
+	int iolen = 0;
+	int warn_code, err_code;
+	int ret;
+
+	/*
+	 * Register the adapter, get its configuration, and
+	 * initialize it.
+	 */
+	ASC_DBG(2, "advansys_board_found: scsi_host_alloc()\n");
+
+	shost = scsi_host_alloc(&advansys_template, sizeof(asc_board_t));
+	if (!shost)
+		return -ENOMEM;
+
+	/* Save a pointer to the Scsi_Host of each board found. */
+	asc_host[asc_board_count++] = shost;
+	if (pdev)
+		pci_set_drvdata(pdev, shost);
+
+	/* Initialize private per board data */
+	boardp = ASC_BOARDP(shost);
+	memset(boardp, 0, sizeof(asc_board_t));
+	boardp->id = asc_board_count - 1;
+	spin_lock_init(&boardp->lock);
+
+	/*
+	 * Handle both narrow and wide boards.
+	 *
+	 * If a Wide board was detected, set the board structure
+	 * wide board flag. Set-up the board structure based on
+	 * the board type.
+	 */
+#ifdef CONFIG_PCI
+	if (bus_type == ASC_IS_PCI &&
+	    (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW ||
+	     pdev->device == PCI_DEVICE_ID_38C0800_REV1 ||
+	     pdev->device == PCI_DEVICE_ID_38C1600_REV1)) {
+		boardp->flags |= ASC_IS_WIDE_BOARD;
+	}
+#endif /* CONFIG_PCI */
+
+	if (ASC_NARROW_BOARD(boardp)) {
+		ASC_DBG(1, "advansys_detect: narrow board\n");
+		asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
+		asc_dvc_varp->bus_type = bus_type;
+		asc_dvc_varp->drv_ptr = boardp;
+		asc_dvc_varp->cfg = &boardp->dvc_cfg.asc_dvc_cfg;
+		asc_dvc_varp->cfg->overrun_buf = &overrun_buf[0];
+		asc_dvc_varp->iop_base = iop;
+		asc_dvc_varp->isr_callback = asc_isr_callback;
+	} else {
+		ASC_DBG(1, "advansys_detect: wide board\n");
+		adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
+		adv_dvc_varp->drv_ptr = boardp;
+		adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg;
+		adv_dvc_varp->isr_callback = adv_isr_callback;
+		adv_dvc_varp->async_callback = adv_async_callback;
+#ifdef CONFIG_PCI
+		if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) {
+			ASC_DBG(1, "advansys_detect: ASC-3550\n");
+			adv_dvc_varp->chip_type = ADV_CHIP_ASC3550;
+			iolen = ADV_3550_IOLEN;
+		} else if (pdev->device == PCI_DEVICE_ID_38C0800_REV1) {
+			ASC_DBG(1, "advansys_detect: ASC-38C0800\n");
+			adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800;
+			iolen = ADV_38C0800_IOLEN;
+		} else {
+			ASC_DBG(1, "advansys_detect: ASC-38C1600\n");
+			adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600;
+			iolen = ADV_38C1600_IOLEN;
+		}
+
+		/*
+		 * Map the board's registers into virtual memory for
+		 * PCI slave access. Only memory accesses are used to
+		 * access the board's registers.
+		 */
+
+		ASC_DBG1(1, "advansys_detect: pci_memory_address: 0x%lx\n",
+			 pci_resource_start(pdev, 1));
+		boardp->ioremap_addr = ioremap(pci_resource_start(pdev, 1),
+					       iolen);
+		if (boardp->ioremap_addr == 0) {
+			ASC_PRINT3("advansys_detect: board %d: ioremap(%x, %d) "
+				   "returned NULL\n", boardp->id,
+				   pci_resource_start(pdev, 1), iolen);
+			err_code = -ENOMEM;
+			goto err_shost;
+		}
+		ASC_DBG1(1, "advansys_detect: ioremap_addr: 0x%lx\n",
+			 (ulong) boardp->ioremap_addr);
+		adv_dvc_varp->iop_base = (AdvPortAddr) boardp->ioremap_addr;
+#endif /* CONFIG_PCI */
+
+		/*
+		 * Even though it isn't used to access wide boards, other
+		 * than for the debug line below, save I/O Port address so
+		 * that it can be reported.
+		 */
+		boardp->ioport = iop;
+
+		ASC_DBG2(1, "advansys_detect: iopb_chip_id_1 0x%x, "
+			 "iopw_chip_id_0 0x%x\n", (ushort) inp(iop + 1),
+			 (ushort) inpw(iop));
+	}
+
+#ifdef CONFIG_PROC_FS
+	/*
+	 * Allocate buffer for printing information from
+	 * /proc/scsi/advansys/[0...].
+	 */
+	boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_KERNEL);
+	if (!boardp->prtbuf) {
+		ASC_PRINT3("advansys_detect: board %d: kmalloc(%d, %d) "
+			   "returned NULL\n", boardp->id, ASC_PRTBUF_SIZE,
+			   GFP_ATOMIC);
+		err_code = -ENOMEM;
+		goto err_unmap;
+	}
+#endif /* CONFIG_PROC_FS */
+
+	if (ASC_NARROW_BOARD(boardp)) {
+		asc_dvc_varp->cfg->dev = NULL;
+		/*
+		 * Set the board bus type and PCI IRQ before
+		 * calling AscInitGetConfig().
+		 */
+		switch (asc_dvc_varp->bus_type) {
+#ifdef CONFIG_ISA
+		case ASC_IS_ISA:
+			shost->unchecked_isa_dma = TRUE;
+			share_irq = FALSE;
+			break;
+		case ASC_IS_VL:
+			shost->unchecked_isa_dma = FALSE;
+			share_irq = FALSE;
+			break;
+		case ASC_IS_EISA:
+			shost->unchecked_isa_dma = FALSE;
+			share_irq = TRUE;
+			break;
+#endif /* CONFIG_ISA */
+#ifdef CONFIG_PCI
+		case ASC_IS_PCI:
+			shost->irq = asc_dvc_varp->irq_no = pdev->irq;
+			asc_dvc_varp->cfg->dev = &pdev->dev;
+			asc_dvc_varp->cfg->pci_slot_info =
+				ASC_PCI_MKID(pdev->bus->number,
+					PCI_SLOT(pdev->devfn),
+					PCI_FUNC(pdev->devfn));
+			shost->unchecked_isa_dma = FALSE;
+			share_irq = TRUE;
+			break;
+#endif /* CONFIG_PCI */
+		default:
+			ASC_PRINT2("advansys_detect: board %d: unknown adapter"
+				   " type: %d\n", boardp->id,
+				   asc_dvc_varp->bus_type);
+			shost->unchecked_isa_dma = TRUE;
+			share_irq = FALSE;
+			break;
+		}
+	} else {
+		/*
+		 * For Wide boards set PCI information before calling
+		 * AdvInitGetConfig().
+		 */
+#ifdef CONFIG_PCI
+		shost->irq = adv_dvc_varp->irq_no = pdev->irq;
+		adv_dvc_varp->cfg->dev = &pdev->dev;
+		adv_dvc_varp->cfg->pci_slot_info =
+			ASC_PCI_MKID(pdev->bus->number,
+				PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+		shost->unchecked_isa_dma = FALSE;
+		share_irq = TRUE;
+#endif /* CONFIG_PCI */
+	}
+
+	/* Read the board configuration. */
+	if (ASC_NARROW_BOARD(boardp)) {
+		/*
+		 * NOTE: AscInitGetConfig() may change the board's
+		 * bus_type value. The asc_bus[bus] value should no
+		 * longer be used. If the bus_type field must be
+		 * referenced only use the bit-wise AND operator "&".
+		 */
+                ASC_DBG(2, "advansys_detect: AscInitGetConfig()\n");
+                switch(ret = AscInitGetConfig(asc_dvc_varp)) {
+                case 0:    /* No error */
+                    break;
+                case ASC_WARN_IO_PORT_ROTATE:
+                    ASC_PRINT1(
+"AscInitGetConfig: board %d: I/O port address modified\n",
+                        boardp->id);
+                    break;
+                case ASC_WARN_AUTO_CONFIG:
+                    ASC_PRINT1(
+"AscInitGetConfig: board %d: I/O port increment switch enabled\n",
+                        boardp->id);
+                    break;
+                case ASC_WARN_EEPROM_CHKSUM:
+                    ASC_PRINT1(
+"AscInitGetConfig: board %d: EEPROM checksum error\n",
+                        boardp->id);
+                    break;
+                case ASC_WARN_IRQ_MODIFIED:
+                    ASC_PRINT1(
+"AscInitGetConfig: board %d: IRQ modified\n",
+                        boardp->id);
+                    break;
+                case ASC_WARN_CMD_QNG_CONFLICT:
+                    ASC_PRINT1(
+"AscInitGetConfig: board %d: tag queuing enabled w/o disconnects\n",
+                        boardp->id);
+                    break;
+                default:
+                    ASC_PRINT2(
+"AscInitGetConfig: board %d: unknown warning: 0x%x\n",
+                        boardp->id, ret);
+                    break;
+                }
+                if ((err_code = asc_dvc_varp->err_code) != 0) {
+                    ASC_PRINT3(
+"AscInitGetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
+                        boardp->id, asc_dvc_varp->init_state,
+                        asc_dvc_varp->err_code);
+                }
+            } else {
+                ASC_DBG(2, "advansys_detect: AdvInitGetConfig()\n");
+                if ((ret = AdvInitGetConfig(adv_dvc_varp)) != 0) {
+                    ASC_PRINT2("AdvInitGetConfig: board %d: warning: 0x%x\n",
+                        boardp->id, ret);
+                }
+                if ((err_code = adv_dvc_varp->err_code) != 0) {
+                    ASC_PRINT2(
+"AdvInitGetConfig: board %d error: err_code 0x%x\n",
+                        boardp->id, adv_dvc_varp->err_code);
+                }
+            }
+
+            if (err_code != 0)
+		goto err_free_proc;
+
+            /*
+             * Save the EEPROM configuration so that it can be displayed
+             * from /proc/scsi/advansys/[0...].
+             */
+            if (ASC_NARROW_BOARD(boardp)) {
+
+                ASCEEP_CONFIG *ep;
+
+                /*
+                 * Set the adapter's target id bit in the 'init_tidmask' field.
+                 */
+                boardp->init_tidmask |=
+                    ADV_TID_TO_TIDMASK(asc_dvc_varp->cfg->chip_scsi_id);
+
+                /*
+                 * Save EEPROM settings for the board.
+                 */
+                ep = &boardp->eep_config.asc_eep;
+
+                ep->init_sdtr = asc_dvc_varp->cfg->sdtr_enable;
+                ep->disc_enable = asc_dvc_varp->cfg->disc_enable;
+                ep->use_cmd_qng = asc_dvc_varp->cfg->cmd_qng_enabled;
+                ASC_EEP_SET_DMA_SPD(ep, asc_dvc_varp->cfg->isa_dma_speed);
+                ep->start_motor = asc_dvc_varp->start_motor;
+                ep->cntl = asc_dvc_varp->dvc_cntl;
+                ep->no_scam = asc_dvc_varp->no_scam;
+                ep->max_total_qng = asc_dvc_varp->max_total_qng;
+                ASC_EEP_SET_CHIP_ID(ep, asc_dvc_varp->cfg->chip_scsi_id);
+                /* 'max_tag_qng' is set to the same value for every device. */
+                ep->max_tag_qng = asc_dvc_varp->cfg->max_tag_qng[0];
+                ep->adapter_info[0] = asc_dvc_varp->cfg->adapter_info[0];
+                ep->adapter_info[1] = asc_dvc_varp->cfg->adapter_info[1];
+                ep->adapter_info[2] = asc_dvc_varp->cfg->adapter_info[2];
+                ep->adapter_info[3] = asc_dvc_varp->cfg->adapter_info[3];
+                ep->adapter_info[4] = asc_dvc_varp->cfg->adapter_info[4];
+                ep->adapter_info[5] = asc_dvc_varp->cfg->adapter_info[5];
+
+               /*
+                * Modify board configuration.
+                */
+                ASC_DBG(2, "advansys_detect: AscInitSetConfig()\n");
+                switch (ret = AscInitSetConfig(asc_dvc_varp)) {
+                case 0:    /* No error. */
+                    break;
+                case ASC_WARN_IO_PORT_ROTATE:
+                    ASC_PRINT1(
+"AscInitSetConfig: board %d: I/O port address modified\n",
+                        boardp->id);
+                    break;
+                case ASC_WARN_AUTO_CONFIG:
+                    ASC_PRINT1(
+"AscInitSetConfig: board %d: I/O port increment switch enabled\n",
+                        boardp->id);
+                    break;
+                case ASC_WARN_EEPROM_CHKSUM:
+                    ASC_PRINT1(
+"AscInitSetConfig: board %d: EEPROM checksum error\n",
+                        boardp->id);
+                    break;
+                case ASC_WARN_IRQ_MODIFIED:
+                    ASC_PRINT1(
+"AscInitSetConfig: board %d: IRQ modified\n",
+                        boardp->id);
+                    break;
+                case ASC_WARN_CMD_QNG_CONFLICT:
+                    ASC_PRINT1(
+"AscInitSetConfig: board %d: tag queuing w/o disconnects\n",
+                        boardp->id);
+                    break;
+                default:
+                    ASC_PRINT2(
+"AscInitSetConfig: board %d: unknown warning: 0x%x\n",
+                        boardp->id, ret);
+                    break;
+                }
+                if (asc_dvc_varp->err_code != 0) {
+		    err_code = asc_dvc_varp->err_code;
+                    ASC_PRINT3(
+"AscInitSetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
+                        boardp->id, asc_dvc_varp->init_state,
+                        err_code);
+                    goto err_free_proc;
+                }
+
+                /*
+                 * Finish initializing the 'Scsi_Host' structure.
+                 */
+                /* AscInitSetConfig() will set the IRQ for non-PCI boards. */
+                if ((asc_dvc_varp->bus_type & ASC_IS_PCI) == 0) {
+                    shost->irq = asc_dvc_varp->irq_no;
+                }
+            } else {
+                ADVEEP_3550_CONFIG      *ep_3550;
+                ADVEEP_38C0800_CONFIG   *ep_38C0800;
+                ADVEEP_38C1600_CONFIG   *ep_38C1600;
+
+                /*
+                 * Save Wide EEP Configuration Information.
+                 */
+                if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
+                {
+                    ep_3550 = &boardp->eep_config.adv_3550_eep;
+
+                    ep_3550->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
+                    ep_3550->max_host_qng = adv_dvc_varp->max_host_qng;
+                    ep_3550->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
+                    ep_3550->termination = adv_dvc_varp->cfg->termination;
+                    ep_3550->disc_enable = adv_dvc_varp->cfg->disc_enable;
+                    ep_3550->bios_ctrl = adv_dvc_varp->bios_ctrl;
+                    ep_3550->wdtr_able = adv_dvc_varp->wdtr_able;
+                    ep_3550->sdtr_able = adv_dvc_varp->sdtr_able;
+                    ep_3550->ultra_able = adv_dvc_varp->ultra_able;
+                    ep_3550->tagqng_able = adv_dvc_varp->tagqng_able;
+                    ep_3550->start_motor = adv_dvc_varp->start_motor;
+                    ep_3550->scsi_reset_delay = adv_dvc_varp->scsi_reset_wait;
+                    ep_3550->serial_number_word1 =
+                        adv_dvc_varp->cfg->serial1;
+                    ep_3550->serial_number_word2 =
+                        adv_dvc_varp->cfg->serial2;
+                    ep_3550->serial_number_word3 =
+                        adv_dvc_varp->cfg->serial3;
+                } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
+                {
+                    ep_38C0800 = &boardp->eep_config.adv_38C0800_eep;
+
+                    ep_38C0800->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
+                    ep_38C0800->max_host_qng = adv_dvc_varp->max_host_qng;
+                    ep_38C0800->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
+                    ep_38C0800->termination_lvd =
+                        adv_dvc_varp->cfg->termination;
+                    ep_38C0800->disc_enable = adv_dvc_varp->cfg->disc_enable;
+                    ep_38C0800->bios_ctrl = adv_dvc_varp->bios_ctrl;
+                    ep_38C0800->wdtr_able = adv_dvc_varp->wdtr_able;
+                    ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able;
+                    ep_38C0800->sdtr_speed1 = adv_dvc_varp->sdtr_speed1;
+                    ep_38C0800->sdtr_speed2 = adv_dvc_varp->sdtr_speed2;
+                    ep_38C0800->sdtr_speed3 = adv_dvc_varp->sdtr_speed3;
+                    ep_38C0800->sdtr_speed4 = adv_dvc_varp->sdtr_speed4;
+                    ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able;
+                    ep_38C0800->start_motor = adv_dvc_varp->start_motor;
+                    ep_38C0800->scsi_reset_delay =
+                        adv_dvc_varp->scsi_reset_wait;
+                    ep_38C0800->serial_number_word1 =
+                        adv_dvc_varp->cfg->serial1;
+                    ep_38C0800->serial_number_word2 =
+                        adv_dvc_varp->cfg->serial2;
+                    ep_38C0800->serial_number_word3 =
+                        adv_dvc_varp->cfg->serial3;
+                } else
+                {
+                    ep_38C1600 = &boardp->eep_config.adv_38C1600_eep;
+
+                    ep_38C1600->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
+                    ep_38C1600->max_host_qng = adv_dvc_varp->max_host_qng;
+                    ep_38C1600->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
+                    ep_38C1600->termination_lvd =
+                        adv_dvc_varp->cfg->termination;
+                    ep_38C1600->disc_enable = adv_dvc_varp->cfg->disc_enable;
+                    ep_38C1600->bios_ctrl = adv_dvc_varp->bios_ctrl;
+                    ep_38C1600->wdtr_able = adv_dvc_varp->wdtr_able;
+                    ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able;
+                    ep_38C1600->sdtr_speed1 = adv_dvc_varp->sdtr_speed1;
+                    ep_38C1600->sdtr_speed2 = adv_dvc_varp->sdtr_speed2;
+                    ep_38C1600->sdtr_speed3 = adv_dvc_varp->sdtr_speed3;
+                    ep_38C1600->sdtr_speed4 = adv_dvc_varp->sdtr_speed4;
+                    ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able;
+                    ep_38C1600->start_motor = adv_dvc_varp->start_motor;
+                    ep_38C1600->scsi_reset_delay =
+                        adv_dvc_varp->scsi_reset_wait;
+                    ep_38C1600->serial_number_word1 =
+                        adv_dvc_varp->cfg->serial1;
+                    ep_38C1600->serial_number_word2 =
+                        adv_dvc_varp->cfg->serial2;
+                    ep_38C1600->serial_number_word3 =
+                        adv_dvc_varp->cfg->serial3;
+                }
+
+                /*
+                 * Set the adapter's target id bit in the 'init_tidmask' field.
+                 */
+                boardp->init_tidmask |=
+                    ADV_TID_TO_TIDMASK(adv_dvc_varp->chip_scsi_id);
+
+                /*
+                 * Finish initializing the 'Scsi_Host' structure.
+                 */
+                shost->irq = adv_dvc_varp->irq_no;
+            }
+
+            /*
+             * Channels are numbered beginning with 0. For AdvanSys one host
+             * structure supports one channel. Multi-channel boards have a
+             * separate host structure for each channel.
+             */
+            shost->max_channel = 0;
+            if (ASC_NARROW_BOARD(boardp)) {
+                shost->max_id = ASC_MAX_TID + 1;
+                shost->max_lun = ASC_MAX_LUN + 1;
+
+                shost->io_port = asc_dvc_varp->iop_base;
+                boardp->asc_n_io_port = ASC_IOADR_GAP;
+                shost->this_id = asc_dvc_varp->cfg->chip_scsi_id;
+
+                /* Set maximum number of queues the adapter can handle. */
+                shost->can_queue = asc_dvc_varp->max_total_qng;
+            } else {
+                shost->max_id = ADV_MAX_TID + 1;
+                shost->max_lun = ADV_MAX_LUN + 1;
+
+                /*
+                 * Save the I/O Port address and length even though
+                 * I/O ports are not used to access Wide boards.
+                 * Instead the Wide boards are accessed with
+                 * PCI Memory Mapped I/O.
+                 */
+                shost->io_port = iop;
+                boardp->asc_n_io_port = iolen;
+
+                shost->this_id = adv_dvc_varp->chip_scsi_id;
+
+                /* Set maximum number of queues the adapter can handle. */
+                shost->can_queue = adv_dvc_varp->max_host_qng;
+            }
+
+            /*
+             * 'n_io_port' currently is one byte.
+             *
+             * Set a value to 'n_io_port', but never referenced it because
+             * it may be truncated.
+             */
+            shost->n_io_port = boardp->asc_n_io_port <= 255 ?
+                boardp->asc_n_io_port : 255;
+
+            /*
+             * Following v1.3.89, 'cmd_per_lun' is no longer needed
+             * and should be set to zero.
+             *
+             * But because of a bug introduced in v1.3.89 if the driver is
+             * compiled as a module and 'cmd_per_lun' is zero, the Mid-Level
+             * SCSI function 'allocate_device' will panic. To allow the driver
+             * to work as a module in these kernels set 'cmd_per_lun' to 1.
+	     *
+	     * Note: This is wrong.  cmd_per_lun should be set to the depth
+	     * you want on untagged devices always.
+#ifdef MODULE
+             */
+            shost->cmd_per_lun = 1;
+/* #else
+            shost->cmd_per_lun = 0;
+#endif */
+
+            /*
+             * Set the maximum number of scatter-gather elements the
+             * adapter can handle.
+             */
+            if (ASC_NARROW_BOARD(boardp)) {
+                /*
+                 * Allow two commands with 'sg_tablesize' scatter-gather
+                 * elements to be executed simultaneously. This value is
+                 * the theoretical hardware limit. It may be decreased
+                 * below.
+                 */
+                shost->sg_tablesize =
+                    (((asc_dvc_varp->max_total_qng - 2) / 2) *
+                    ASC_SG_LIST_PER_Q) + 1;
+            } else {
+                shost->sg_tablesize = ADV_MAX_SG_LIST;
+            }
+
+            /*
+             * The value of 'sg_tablesize' can not exceed the SCSI
+             * mid-level driver definition of SG_ALL. SG_ALL also
+             * must not be exceeded, because it is used to define the
+             * size of the scatter-gather table in 'struct asc_sg_head'.
+             */
+            if (shost->sg_tablesize > SG_ALL) {
+                shost->sg_tablesize = SG_ALL;
+            }
+
+            ASC_DBG1(1, "advansys_detect: sg_tablesize: %d\n",
+                shost->sg_tablesize);
+
+            /* BIOS start address. */
+            if (ASC_NARROW_BOARD(boardp)) {
+                shost->base =
+                        ((ulong) AscGetChipBiosAddress(
+                            asc_dvc_varp->iop_base,
+                            asc_dvc_varp->bus_type));
+            } else {
+                /*
+                 * Fill-in BIOS board variables. The Wide BIOS saves
+                 * information in LRAM that is used by the driver.
+                 */
+                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_SIGNATURE,
+                    boardp->bios_signature);
+                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_VERSION,
+                    boardp->bios_version);
+                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_CODESEG,
+                    boardp->bios_codeseg);
+                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_CODELEN,
+                    boardp->bios_codelen);
+
+                ASC_DBG2(1,
+                    "advansys_detect: bios_signature 0x%x, bios_version 0x%x\n",
+                    boardp->bios_signature, boardp->bios_version);
+
+                ASC_DBG2(1,
+                    "advansys_detect: bios_codeseg 0x%x, bios_codelen 0x%x\n",
+                    boardp->bios_codeseg, boardp->bios_codelen);
+
+                /*
+                 * If the BIOS saved a valid signature, then fill in
+                 * the BIOS code segment base address.
+                 */
+                if (boardp->bios_signature == 0x55AA) {
+                    /*
+                     * Convert x86 realmode code segment to a linear
+                     * address by shifting left 4.
+                     */
+                    shost->base = ((ulong) boardp->bios_codeseg << 4);
+                } else {
+                    shost->base = 0;
+                }
+            }
+
+            /*
+             * Register Board Resources - I/O Port, DMA, IRQ
+             */
+
+            /*
+             * Register I/O port range.
+             *
+             * For Wide boards the I/O ports are not used to access
+             * the board, but request the region anyway.
+             *
+             * 'shost->n_io_port' is not referenced, because it may be truncated.
+             */
+            ASC_DBG2(2,
+                "advansys_detect: request_region port 0x%lx, len 0x%x\n",
+                (ulong) shost->io_port, boardp->asc_n_io_port);
+            if (request_region(shost->io_port, boardp->asc_n_io_port,
+                               "advansys") == NULL) {
+                ASC_PRINT3(
+"advansys_detect: board %d: request_region() failed, port 0x%lx, len 0x%x\n",
+                    boardp->id, (ulong) shost->io_port, boardp->asc_n_io_port);
+		err_code = -EBUSY;
+		goto err_free_proc;
+            }
+
+            /* Register DMA Channel for Narrow boards. */
+            shost->dma_channel = NO_ISA_DMA; /* Default to no ISA DMA. */
+#ifdef CONFIG_ISA
+            if (ASC_NARROW_BOARD(boardp)) {
+                /* Register DMA channel for ISA bus. */
+                if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
+                    shost->dma_channel = asc_dvc_varp->cfg->isa_dma_channel;
+                    if ((err_code =
+                         request_dma(shost->dma_channel, "advansys")) != 0) {
+                        ASC_PRINT3(
+"advansys_detect: board %d: request_dma() %d failed %d\n",
+                            boardp->id, shost->dma_channel, ret);
+                         goto err_free_region;
+                    }
+                    AscEnableIsaDma(shost->dma_channel);
+                }
+            }
+#endif /* CONFIG_ISA */
+
+            /* Register IRQ Number. */
+            ASC_DBG1(2, "advansys_detect: request_irq() %d\n", shost->irq);
+           /*
+            * If request_irq() fails with the IRQF_DISABLED flag set,
+            * then try again without the IRQF_DISABLED flag set. This
+            * allows IRQ sharing to work even with other drivers that
+            * do not set the IRQF_DISABLED flag.
+            *
+            * If IRQF_DISABLED is not set, then interrupts are enabled
+            * before the driver interrupt function is called.
+            */
+            if (((err_code = request_irq(shost->irq, advansys_interrupt,
+                            IRQF_DISABLED | (share_irq == TRUE ? IRQF_SHARED : 0),
+                            "advansys", boardp)) != 0) &&
+                ((err_code = request_irq(shost->irq, advansys_interrupt,
+                            (share_irq == TRUE ? IRQF_SHARED : 0),
+                            "advansys", boardp)) != 0))
+            {
+                if (err_code == -EBUSY) {
+                    ASC_PRINT2(
+"advansys_detect: board %d: request_irq(): IRQ 0x%x already in use.\n",
+                        boardp->id, shost->irq);
+                } else if (err_code == -EINVAL) {
+                    ASC_PRINT2(
+"advansys_detect: board %d: request_irq(): IRQ 0x%x not valid.\n",
+                        boardp->id, shost->irq);
+                } else {
+                    ASC_PRINT3(
+"advansys_detect: board %d: request_irq(): IRQ 0x%x failed with %d\n",
+                        boardp->id, shost->irq, ret);
+                }
+                goto err_free_dma;
+            }
+
+            /*
+             * Initialize board RISC chip and enable interrupts.
+             */
+            if (ASC_NARROW_BOARD(boardp)) {
+                ASC_DBG(2, "advansys_detect: AscInitAsc1000Driver()\n");
+                warn_code = AscInitAsc1000Driver(asc_dvc_varp);
+                err_code = asc_dvc_varp->err_code;
+
+                if (warn_code || err_code) {
+                    ASC_PRINT4(
+"advansys_detect: board %d error: init_state 0x%x, warn 0x%x, error 0x%x\n",
+                        boardp->id, asc_dvc_varp->init_state,
+                        warn_code, err_code);
+                }
+            } else {
+	        err_code = advansys_init_wide_chip(boardp, adv_dvc_varp);
+            }
+
+	if (err_code != 0)
+		goto err_free_irq;
+	ASC_DBG_PRT_SCSI_HOST(2, shost);
+
+	err_code = scsi_add_host(shost, pdev ? &pdev->dev : NULL);
+	if (err_code)
+		goto err_free_irq;
+
+	scsi_scan_host(shost);
+
+	return 0;
+
+ err_free_irq:
+	free_irq(shost->irq, boardp);
+
+ err_free_dma:
+	if (shost->dma_channel != NO_ISA_DMA)
+		free_dma(shost->dma_channel);
+
+ err_free_region:
+	release_region(shost->io_port, boardp->asc_n_io_port);
+
+ err_free_proc:
+	kfree(boardp->prtbuf);
+
+ err_unmap:
+	iounmap(boardp->ioremap_addr);
+
+ err_shost:
+	scsi_host_put(shost);
+	asc_board_count--;
+	return err_code;
+}
+
+/*
+ * advansys_detect()
+ *
+ * Detect function for AdvanSys adapters.
+ *
+ * Argument is a pointer to the host driver's scsi_hosts entry.
+ *
+ * Return number of adapters found.
+ *
+ * Note: Because this function is called during system initialization
+ * it must not call SCSI mid-level functions including scsi_malloc()
+ * and scsi_free().
+ */
+static int __init advansys_detect(void)
+{
+    int                 iop;
+    int                 bus;
+    int                 ioport = 0;
+
+    ASC_DBG(1, "advansys_detect: begin\n");
+
+    /*
+     * If I/O port probing has been modified, then verify and
+     * clean-up the 'asc_ioport' list.
+     */
+    if (asc_iopflag == ASC_TRUE) {
+        for (ioport = 0; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
+            ASC_DBG2(1, "advansys_detect: asc_ioport[%d] 0x%x\n",
+                ioport, asc_ioport[ioport]);
+            if (asc_ioport[ioport] != 0) {
+                for (iop = 0; iop < ASC_IOADR_TABLE_MAX_IX; iop++) {
+                    if (_asc_def_iop_base[iop] == asc_ioport[ioport]) {
+                        break;
+                    }
+                }
+                if (iop == ASC_IOADR_TABLE_MAX_IX) {
+                    printk(
+"AdvanSys SCSI: specified I/O Port 0x%X is invalid\n",
+                        asc_ioport[ioport]);
+                    asc_ioport[ioport] = 0;
+                }
+            }
+        }
+        ioport = 0;
+    }
+
+    for (bus = 0; bus < ASC_NUM_BUS; bus++) {
+
+        ASC_DBG2(1, "advansys_detect: bus search type %d (%s)\n",
+            bus, asc_bus_name[bus]);
+        iop = 0;
+
+        while (asc_board_count < ASC_NUM_BOARD_SUPPORTED) {
+
+            ASC_DBG1(2, "advansys_detect: asc_board_count %d\n",
+                asc_board_count);
+
+            switch (asc_bus[bus]) {
+            case ASC_IS_ISA:
+            case ASC_IS_VL:
+#ifdef CONFIG_ISA
+                if (asc_iopflag == ASC_FALSE) {
+                    iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
+                } else {
+                    /*
+                     * ISA and VL I/O port scanning has either been
+                     * eliminated or limited to selected ports on
+                     * the LILO command line, /etc/lilo.conf, or
+                     * by setting variables when the module was loaded.
+                     */
+                    ASC_DBG(1, "advansys_detect: I/O port scanning modified\n");
+                ioport_try_again:
+                    iop = 0;
+                    for (; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
+                        if ((iop = asc_ioport[ioport]) != 0) {
+                            break;
+                        }
+                    }
+                    if (iop) {
+                        ASC_DBG1(1,
+                                "advansys_detect: probing I/O port 0x%x...\n",
+                            iop);
+			if (!request_region(iop, ASC_IOADR_GAP, "advansys")){
+                            printk(
+"AdvanSys SCSI: specified I/O Port 0x%X is busy\n", iop);
+                            /* Don't try this I/O port twice. */
+                            asc_ioport[ioport] = 0;
+                            goto ioport_try_again;
+                        } else if (AscFindSignature(iop) == ASC_FALSE) {
+                            printk(
+"AdvanSys SCSI: specified I/O Port 0x%X has no adapter\n", iop);
+                            /* Don't try this I/O port twice. */
+			    release_region(iop, ASC_IOADR_GAP);
+                            asc_ioport[ioport] = 0;
+                            goto ioport_try_again;
+                        } else {
+                            /*
+                             * If this isn't an ISA board, then it must be
+                             * a VL board. If currently looking an ISA
+                             * board is being looked for then try for
+                             * another ISA board in 'asc_ioport'.
+                             */
+                            if (asc_bus[bus] == ASC_IS_ISA &&
+                                (AscGetChipVersion(iop, ASC_IS_ISA) &
+                                 ASC_CHIP_VER_ISA_BIT) == 0) {
+                                 /*
+                                  * Don't clear 'asc_ioport[ioport]'. Try
+                                  * this board again for VL. Increment
+                                  * 'ioport' past this board.
+                                  */
+                                 ioport++;
+				 release_region(iop, ASC_IOADR_GAP);
+                                 goto ioport_try_again;
+                            }
+                        }
+                        /*
+                         * This board appears good, don't try the I/O port
+                         * again by clearing its value. Increment 'ioport'
+                         * for the next iteration.
+                         */
+                        asc_ioport[ioport++] = 0;
+                    }
+                }
+#endif /* CONFIG_ISA */
+                break;
+
+            case ASC_IS_EISA:
+#ifdef CONFIG_ISA
+                iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
+#endif /* CONFIG_ISA */
+                break;
+
+            default:
+                ASC_PRINT1("advansys_detect: unknown bus type: %d\n",
+                    asc_bus[bus]);
+                break;
+            }
+            ASC_DBG1(1, "advansys_detect: iop 0x%x\n", iop);
+
+            if (iop == 0)
+		break;
+
+	    advansys_board_found(iop, NULL, asc_bus[bus]);
+        }
+    }
+
+    ASC_DBG1(1, "advansys_detect: done: asc_board_count %d\n", asc_board_count);
+    return asc_board_count;
+}
+
+/*
+ * advansys_release()
+ *
+ * Release resources allocated for a single AdvanSys adapter.
+ */
+static int
+advansys_release(struct Scsi_Host *shp)
+{
+    asc_board_t    *boardp;
+
+    ASC_DBG(1, "advansys_release: begin\n");
+    boardp = ASC_BOARDP(shp);
+    free_irq(shp->irq, boardp);
+    if (shp->dma_channel != NO_ISA_DMA) {
+        ASC_DBG(1, "advansys_release: free_dma()\n");
+        free_dma(shp->dma_channel);
+    }
+    release_region(shp->io_port, boardp->asc_n_io_port);
+    if (ASC_WIDE_BOARD(boardp)) {
+        adv_sgblk_t    *sgp = NULL;
+
+        iounmap(boardp->ioremap_addr);
+        kfree(boardp->orig_carrp);
+        boardp->orig_carrp = NULL;
+        if (boardp->orig_reqp) {
+            kfree(boardp->orig_reqp);
+            boardp->orig_reqp = boardp->adv_reqp = NULL;
+        }
+        while ((sgp = boardp->adv_sgblkp) != NULL)
+        {
+            boardp->adv_sgblkp = sgp->next_sgblkp;
+            kfree(sgp);
+        }
+    }
+#ifdef CONFIG_PROC_FS
+    ASC_ASSERT(boardp->prtbuf != NULL);
+    kfree(boardp->prtbuf);
+#endif /* CONFIG_PROC_FS */
+    scsi_host_put(shp);
+    ASC_DBG(1, "advansys_release: end\n");
+    return 0;
+}
 
 /* PCI Devices supported by this driver */
 static struct pci_device_id advansys_pci_tbl[] __devinitdata = {
@@ -18054,7 +17976,7 @@ static int __devinit advansys_pci_probe(struct pci_dev *pdev,
 	int err, ioport;
 
 	ioport = pci_resource_start(pdev, 0);
-	err = advansys_board_found(&driver_template, ioport, pdev, ASC_IS_PCI);
+	err = advansys_board_found(ioport, pdev, ASC_IS_PCI);
 
 	return err;
 }
@@ -18098,9 +18020,10 @@ static struct pci_driver advansys_pci_driver = {
 static int __init advansys_init(void)
 {
 	int error;
+
 	error = pci_register_driver(&advansys_pci_driver);
 	if (!error)
-		advansys_detect(&driver_template);
+		advansys_detect();
 	return error;
 }
 
-- 
1.4.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: advansys cleanup
  2007-07-16 20:28 advansys cleanup Matthew Wilcox
                   ` (3 preceding siblings ...)
  2007-07-16 22:41 ` [PATCH 4/4] advansys: Move to scsi hotplug initialisation model Matthew Wilcox
@ 2007-07-17 14:24 ` Matthew Wilcox
  2007-07-17 15:36   ` Ken Witherow
  4 siblings, 1 reply; 9+ messages in thread
From: Matthew Wilcox @ 2007-07-17 14:24 UTC (permalink / raw)
  To: linux-scsi; +Cc: jeffreyfreeman, ken, Christoph Hellwig

On Mon, Jul 16, 2007 at 02:28:15PM -0600, Matthew Wilcox wrote:
> I have to run, but here's what I've benn working on today if anyone
> wants to test:
> 
> http://git.kernel.org/pub/scm/linux/kernel/git/willy/advansys-2.6.git

I was in so much of a hurry that I got the URL wrong.  It is:

http://git.kernel.org/?p=linux/kernel/git/willy/advansys.git;a=summary

I've posted the four patches that this git contains.

I don't have an advansys card of my own, so I'm looking for testers.
It compiles cleanly, but that's about the best I can say about it.
I'm looking to do some more work on it today, including fixing the
dreadful job somebody did of removing the check_region calls.  It'd be
helpful to know that this much works (and if it doesn't, at which point
in the patch series it stops working).

-- 
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: advansys cleanup
  2007-07-17 14:24 ` advansys cleanup Matthew Wilcox
@ 2007-07-17 15:36   ` Ken Witherow
  2007-07-17 16:37     ` Matthew Wilcox
  0 siblings, 1 reply; 9+ messages in thread
From: Ken Witherow @ 2007-07-17 15:36 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-scsi, jeffreyfreeman, Christoph Hellwig

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3808 bytes --]

On Tue, 17 Jul 2007, Matthew Wilcox wrote:

> On Mon, Jul 16, 2007 at 02:28:15PM -0600, Matthew Wilcox wrote:
>> I have to run, but here's what I've benn working on today if anyone
>> wants to test:
>>
>> http://git.kernel.org/pub/scm/linux/kernel/git/willy/advansys-2.6.git
>
> I was in so much of a hurry that I got the URL wrong.  It is:
>
> http://git.kernel.org/?p=linux/kernel/git/willy/advansys.git;a=summary
>
> I've posted the four patches that this git contains.
>
> I don't have an advansys card of my own, so I'm looking for testers.
> It compiles cleanly, but that's about the best I can say about it.
> I'm looking to do some more work on it today, including fixing the
> dreadful job somebody did of removing the check_region calls.  It'd be
> helpful to know that this much works (and if it doesn't, at which point
> in the patch series it stops working).

I don't use git, but I extracted the 4 patches out from the website. 3 of 
the 4 had failed hunks against my gentoo kernel so I tried stock 2.6.22 
and still had the same hunks fail.

Instead, I pulled the raw advansys.c from the tree provided and dropped 
that in place.


here's the build:

   CHK     include/linux/version.h
   CHK     include/linux/utsrelease.h
   CALL    scripts/checksyscalls.sh
   CHK     include/linux/compile.h
   CC      drivers/scsi/advansys.o
drivers/scsi/advansys.c:795:2: warning: #warning this driver is still not 
properly converted to the DMA API
   LD      drivers/scsi/built-in.o
   LD      drivers/built-in.o
   GEN     .version
   CHK     include/linux/compile.h
   UPD     include/linux/compile.h
   CC      init/version.o
   LD      init/built-in.o
   LD      .tmp_vmlinux1
   KSYM    .tmp_kallsyms1.S
   AS      .tmp_kallsyms1.o
   LD      .tmp_vmlinux2
   KSYM    .tmp_kallsyms2.S
   AS      .tmp_kallsyms2.o
   LD      vmlinux
   SYSMAP  System.map
   SYSMAP  .tmp_System.map
   MODPOST vmlinux
WARNING: drivers/built-in.o(.text+0x99045): Section mismatch: reference to 
.init.text: (between 'advansys_board_found' and 'advansys_pci_probe')
WARNING: drivers/built-in.o(.text+0x9910b): Section mismatch: reference to 
.init.text: (between 'advansys_board_found' and 'advansys_pci_probe')
WARNING: drivers/built-in.o(.text+0x994bd): Section mismatch: reference to 
.init.text: (between 'advansys_board_found' and 'advansys_pci_probe')
WARNING: drivers/built-in.o(.text+0x99ced): Section mismatch: reference to 
.init.text: (between 'advansys_board_found' and 'advansys_pci_probe')
WARNING: drivers/built-in.o(.text+0x99d69): Section mismatch: reference to 
.init.text: (between 'advansys_board_found' and 'advansys_pci_probe')
WARNING: drivers/built-in.o(.text+0x99ded): Section mismatch: reference to 
.init.text: (between 'advansys_board_found' and 'advansys_pci_probe')
WARNING: drivers/built-in.o(.text+0x99e11): Section mismatch: reference to 
.init.text: (between 'advansys_board_found' and 'advansys_pci_probe')
WARNING: drivers/built-in.o(.text+0x99e21): Section mismatch: reference to 
.init.text: (between 'advansys_board_found' and 'advansys_pci_probe')
   AS      arch/i386/boot/setup.o
   LD      arch/i386/boot/setup
   OBJCOPY arch/i386/boot/compressed/vmlinux.bin
   GZIP    arch/i386/boot/compressed/vmlinux.bin.gz
   LD      arch/i386/boot/compressed/piggy.o
   LD      arch/i386/boot/compressed/vmlinux
   OBJCOPY arch/i386/boot/vmlinux.bin
   BUILD   arch/i386/boot/bzImage
Root device is (22, 8)
Boot sector 512 bytes.
Setup is 6784 bytes.
System is 2412 kB
Kernel: arch/i386/boot/bzImage is ready  (#2)
   Building modules, stage 2.
   MODPOST 96 modules


I've attached my regular dmesg as well as my dmesg with the failure of the 
updated advansys driver.

I'd be glad to attempt the patches again. It would be easier for me if you 
sent me the raw patches, if possible.

[-- Attachment #2: Type: TEXT/PLAIN, Size: 23255 bytes --]

[    0.000000] Linux version 2.6.22-gentoo-r1 (root@death) (gcc version 4.1.2 (Gentoo 4.1.2)) #1 SMP PREEMPT Fri Jul 13 17:10:52 EDT 2007
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f400 (usable)
[    0.000000]  BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000e4800 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000001fff0000 (usable)
[    0.000000]  BIOS-e820: 000000001fff0000 - 000000001ffffc00 (ACPI data)
[    0.000000]  BIOS-e820: 000000001ffffc00 - 0000000020000000 (ACPI NVS)
[    0.000000]  BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
[    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)
[    0.000000] 511MB LOWMEM available.
[    0.000000] found SMP MP-table at 000f7510
[    0.000000] Entering add_active_range(0, 0, 131056) 0 entries of 256 used
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA             0 ->     4096
[    0.000000]   Normal       4096 ->   131056
[    0.000000] early_node_map[1] active PFN ranges
[    0.000000]     0:        0 ->   131056
[    0.000000] On node 0 totalpages: 131056
[    0.000000]   DMA zone: 32 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 4064 pages, LIFO batch:0
[    0.000000]   Normal zone: 991 pages used for memmap
[    0.000000]   Normal zone: 125969 pages, LIFO batch:31
[    0.000000] DMI 2.3 present.
[    0.000000] ACPI: RSDP 000F74B0, 0014 (r0 PTLTD )
[    0.000000] ACPI: RSDT 1FFFD51D, 002C (r1 PTLTD    RSDT    6040000  LTP        0)
[    0.000000] ACPI: FACP 1FFFFB2E, 0074 (r1 TYAN   GUINNESS  6040000 PTEC    F4240)
[    0.000000] ACPI: DSDT 1FFFD549, 25E5 (r1    AMD  AMDACPI  6040000 MSFT  100000B)
[    0.000000] ACPI: FACS 1FFFFFC0, 0040
[    0.000000] ACPI: APIC 1FFFFBA2, 005E (r1 PTLTD    APIC    6040000  LTP        0)
[    0.000000] ACPI: PM-Timer IO Port: 0x8008
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x01] enabled)
[    0.000000] Processor #1 6:6 APIC version 16
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
[    0.000000] Processor #0 6:6 APIC version 16
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 2, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 high edge)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ2 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] Allocating PCI resources starting at 30000000 (gap: 20000000:dec00000)
[    0.000000] Built 1 zonelists.  Total pages: 130033
[    0.000000] Kernel command line: BOOT_IMAGE=gentoo ro root=1608
[    0.000000] mapped APIC to ffffd000 (fee00000)
[    0.000000] mapped IOAPIC to ffffc000 (fec00000)
[    0.000000] Enabling fast FPU save and restore... done.
[    0.000000] Enabling unmasked SIMD FPU exception support... done.
[    0.000000] Initializing CPU#0
[    0.000000] PID hash table entries: 2048 (order: 11, 8192 bytes)
[    0.000000] Detected 1533.426 MHz processor.
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 514060k/524224k available (3381k kernel code, 9696k reserved, 1148k data, 272k init, 0k highmem)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfffb7000 - 0xfffff000   ( 288 kB)
[    0.000000]     vmalloc : 0xe0800000 - 0xfffb5000   ( 503 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdfff0000   ( 511 MB)
[    0.000000]       .init : 0xc0574000 - 0xc05b8000   ( 272 kB)
[    0.000000]       .data : 0xc044d671 - 0xc056c7dc   (1148 kB)
[    0.000000]       .text : 0xc0100000 - 0xc044d671   (3381 kB)
[    0.000000] Checking if this processor honours the WP bit even in supervisor mode... Ok.
[    0.084000] Calibrating delay using timer specific routine.. 3069.21 BogoMIPS (lpj=6138423)
[    0.084000] Mount-cache hash table entries: 512
[    0.084000] CPU: After generic identify, caps: 0383fbff c1cbfbff 00000000 00000000 00000000 00000000 00000000
[    0.084000] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.084000] CPU: L2 Cache: 256K (64 bytes/line)
[    0.084000] CPU: After all inits, caps: 0383fbff c1cbfbff 00000000 00000420 00000000 00000000 00000000
[    0.084000] Intel machine check architecture supported.
[    0.084000] Intel machine check reporting enabled on CPU#0.
[    0.084000] Compat vDSO mapped to ffffe000.
[    0.084000] Checking 'hlt' instruction... OK.
[    0.100000] Freeing SMP alternatives: 13k freed
[    0.100000] ACPI: Core revision 20070126
[    0.100000] CPU0: AMD Athlon(tm) MP 1800+ stepping 02
[    0.100000] Booting processor 1/0 eip 2000
[    0.112000] Initializing CPU#1
[    0.192000] Calibrating delay using timer specific routine.. 3067.08 BogoMIPS (lpj=6134179)
[    0.192000] CPU: After generic identify, caps: 0383fbff c1cbfbff 00000000 00000000 00000000 00000000 00000000
[    0.192000] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.192000] CPU: L2 Cache: 256K (64 bytes/line)
[    0.192000] CPU: After all inits, caps: 0383fbff c1cbfbff 00000000 00000420 00000000 00000000 00000000
[    0.192000] Intel machine check architecture supported.
[    0.192000] Intel machine check reporting enabled on CPU#1.
[    0.192000] CPU1: AMD Athlon(tm) Processor stepping 02
[    0.192000] Total of 2 processors activated (6136.30 BogoMIPS).
[    0.192000] ENABLING IO-APIC IRQs
[    0.192000] ..TIMER: vector=0x31 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.232000] Brought up 2 CPUs
[    0.284000] migration_cost=4000
[    0.284000] NET: Registered protocol family 16
[    0.284000] ACPI: bus type pci registered
[    0.288000] PCI: PCI BIOS revision 2.10 entry at 0xfd7e0, last bus=1
[    0.288000] PCI: Using configuration type 1
[    0.288000] Setting up standard PCI resources
[    0.292000] mtrr: your CPUs had inconsistent fixed MTRR settings
[    0.292000] mtrr: probably your BIOS does not setup all CPUs.
[    0.292000] mtrr: corrected configuration.
[    0.296000] ACPI: Interpreter enabled
[    0.296000] ACPI: Using IOAPIC for interrupt routing
[    0.300000] ACPI: PCI Root Bridge [PCI0] (0000:00)
[    0.300000] PCI: Probing PCI hardware (bus 00)
[    0.300000] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
[    0.300000] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.AGP_._PRT]
[    0.304000] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 5 10 11) *0, disabled.
[    0.304000] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 *5 10 11)
[    0.304000] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 5 *10 11)
[    0.304000] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 5 10 *11)
[    0.304000] Linux Plug and Play Support v0.97 (c) Adam Belay
[    0.304000] pnp: PnP ACPI init
[    0.304000] ACPI: bus type pnp registered
[    0.308000] pnp: PnP ACPI: found 13 devices
[    0.308000] ACPI: ACPI bus type pnp unregistered
[    0.308000] SCSI subsystem initialized
[    0.308000] libata version 2.21 loaded.
[    0.308000] usbcore: registered new interface driver usbfs
[    0.308000] usbcore: registered new interface driver hub
[    0.308000] usbcore: registered new device driver usb
[    0.308000] PCI: Using ACPI for IRQ routing
[    0.308000] PCI: If a device doesn't work, try "pci=routeirq".  If it helps, post a report
[    0.312000] pnp: 00:00: iomem range 0xfff80000-0xffffffff could not be reserved
[    0.312000] pnp: 00:00: iomem range 0xffc00000-0xfff7ffff has been reserved
[    0.312000] pnp: 00:00: iomem range 0x0-0x9ffff could not be reserved
[    0.312000] pnp: 00:00: iomem range 0x100000-0x1fffffff could not be reserved
[    0.312000] pnp: 00:06: ioport range 0x4d0-0x4d1 has been reserved
[    0.340000] PCI: Bridge: 0000:00:01.0
[    0.340000]   IO window: disabled.
[    0.340000]   MEM window: f1000000-f1ffffff
[    0.340000]   PREFETCH window: f8000000-fc0fffff
[    0.340000] NET: Registered protocol family 2
[    0.344000] Time: acpi_pm clocksource has been installed.
[    0.376000] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.376000] TCP established hash table entries: 16384 (order: 6, 458752 bytes)
[    0.376000] TCP bind hash table entries: 16384 (order: 6, 393216 bytes)
[    0.376000] TCP: Hash tables configured (established 16384 bind 16384)
[    0.376000] TCP reno registered
[    0.388000] Machine check exception polling timer started.
[    0.388000] VFS: Disk quotas dquot_6.5.1
[    0.388000] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.388000] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.388000] io scheduler noop registered
[    0.388000] io scheduler anticipatory registered (default)
[    0.388000] io scheduler deadline registered
[    0.388000] io scheduler cfq registered
[    0.388000] BIOS failed to enable PCI standards compliance, fixing this error.
[    0.388000] I/O APIC: AMD Erratum #22 may be present. In the event of instability try
[    0.388000]         : booting with the "noapic" option.
[    0.408000] Boot video device is 0000:01:05.0
[    0.472000] lp: driver loaded but no devices found
[    0.472000] Real Time Clock Driver v1.12ac
[    0.472000] Linux agpgart interface v0.102 (c) Dave Jones
[    0.472000] input: Power Button (FF) as /class/input/input0
[    0.472000] ACPI: Power Button (FF) [PWRF]
[    0.472000] input: Sleep Button (FF) as /class/input/input1
[    0.472000] ACPI: Sleep Button (FF) [SLPF]
[    0.472000] input: Power Button (CM) as /class/input/input2
[    0.472000] ACPI: Power Button (CM) [PWRB]
[    0.472000] Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
[    0.472000] 00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.476000] 00:08: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    0.476000] parport_pc 00:09: reported by Plug and Play ACPI
[    0.476000] parport0: PC-style at 0x378 (0x778), irq 7 [PCSPP,TRISTATE,EPP]
[    0.572000] lp0: using parport0 (interrupt-driven).
[    0.572000] lp0: console ready
[    0.572000] Floppy drive(s): fd0 is 1.44M
[    0.588000] FDC 0 is a post-1991 82077
[    0.592000] loop: module loaded
[    0.592000] 8139too Fast Ethernet driver 0.9.28
[    0.592000] ACPI: PCI Interrupt 0000:00:0d.0[A] -> GSI 17 (level, low) -> IRQ 16
[    0.592000] eth0: RealTek RTL8139 at 0x1400, 00:50:ba:ae:3d:8a, IRQ 16
[    0.592000] eth0:  Identified 8139 chip type 'RTL-8139C'
[    0.592000] netconsole: not configured, aborting
[    0.592000] Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
[    0.592000] ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
[    0.592000] AMD7411: IDE controller at PCI slot 0000:00:07.1
[    0.592000] AMD7411: chipset revision 1
[    0.592000] AMD7411: not 100% native mode: will probe irqs later
[    0.592000] AMD7411: 0000:00:07.1 (rev 01) UDMA100 controller
[    0.592000]     ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda:DMA, hdb:pio
[    0.592000]     ide1: BM-DMA at 0xf008-0xf00f, BIOS settings: hdc:DMA, hdd:DMA
[    0.592000] Probing IDE interface ide0...
[    1.332000] hda: LITE-ON DVDRW SHW-160P6S, ATAPI CD/DVD-ROM drive
[    2.004000] ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
[    2.004000] Probing IDE interface ide1...
[    2.292000] hdc: ST3160023A, ATA DISK drive
[    2.572000] hdd: ST3200822A, ATA DISK drive
[    2.628000] ide1 at 0x170-0x177,0x376 on irq 15
[    2.628000] hdc: max request size: 512KiB
[    2.628000] hdc: 312581808 sectors (160041 MB) w/8192KiB Cache, CHS=19457/255/63, UDMA(100)
[    2.628000] hdc: cache flushes supported
[    2.628000]  hdc: hdc1 hdc2 hdc3 < hdc5 hdc6 hdc7 hdc8 hdc9 >
[    2.708000] hdd: max request size: 512KiB
[    2.708000] hdd: 390721968 sectors (200049 MB) w/8192KiB Cache, CHS=24321/255/63, UDMA(100)
[    2.708000] hdd: cache flushes supported
[    2.708000]  hdd: hdd1 hdd2 hdd4 < hdd5 hdd6 hdd7 hdd8 >
[    2.768000] hda: ATAPI 48X DVD-ROM DVD-R CD-R/RW drive, 2048kB Cache, UDMA(33)
[    2.768000] Uniform CD-ROM driver Revision: 3.20
[    2.772000] ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 16
[    6.036000] scsi0 : AdvanSys SCSI 3.3K: PCI Ultra: IO 0x1800-0x180F, IRQ 0x10
[    6.040000] ACPI: PCI Interrupt 0000:00:0a.0[A] -> GSI 18 (level, low) -> IRQ 17
[    7.092000] scsi 0:0:5:0: Direct-Access     SEAGATE  SX410800N        7117 PQ: 0 ANSI: 2
[   11.252000] scsi1 : Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev 7.0
[   11.252000]         <Adaptec 2940 Ultra2 SCSI adapter>
[   11.252000]         aic7890/91: Ultra2 Wide Channel A, SCSI Id=7, 32/253 SCBs
[   11.252000] 
[   11.252000] st: Version 20070203, fixed bufsize 32768, s/g segs 256
[   11.256000] sd 0:0:5:0: [sda] 17096357 512-byte hardware sectors (8753 MB)
[   11.260000] sd 0:0:5:0: [sda] Write Protect is off
[   11.260000] scsi 1:0:0:0: Direct-Access     IBM      DNES-309170      SAH0 PQ: 0 ANSI: 3
[   11.260000] scsi1:A:0:0: Tagged Queuing enabled.  Depth 32
[   11.260000]  target1:0:0: Beginning Domain Validation
[   11.260000] sd 0:0:5:0: [sda] Mode Sense: b9 00 10 08
[   11.264000] sd 0:0:5:0: [sda] Write cache: disabled, read cache: enabled, supports DPO and FUA
[   11.268000] sd 0:0:5:0: [sda] 17096357 512-byte hardware sectors (8753 MB)
[   11.272000] sd 0:0:5:0: [sda] Write Protect is off
[   11.272000] sd 0:0:5:0: [sda] Mode Sense: b9 00 10 08
[   11.276000] sd 0:0:5:0: [sda] Write cache: disabled, read cache: enabled, supports DPO and FUA
[   11.276000]  sda:(scsi1:A:0:0): refuses WIDE negotiation.  Using 8bit transfers
[   11.296000]  sda1 sda4 <<6> target1:0:0: FAST-20 SCSI 20.0 MB/s ST (50 ns, offset 31)
[   11.316000]  sda5 >
[   11.316000] sd 0:0:5:0: [sda] Attached SCSI disk
[   11.316000] sd 0:0:5:0: Attached scsi generic sg0 type 0
[   11.316000] usbmon: debugfs is not available
[   11.316000] ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
[   11.316000] ACPI: PCI Interrupt 0000:00:07.4[D] -> GSI 19 (level, low) -> IRQ 18
[   11.316000] ohci_hcd 0000:00:07.4: OHCI Host Controller
[   11.316000] ohci_hcd 0000:00:07.4: new USB bus registered, assigned bus number 1
[   11.316000] ohci_hcd 0000:00:07.4: irq 18, io mem 0x000dc000
[   11.320000]  target1:0:0: Domain Validation skipping write tests
[   11.320000]  target1:0:0: Ending Domain Validation
[   11.372000] usb usb1: configuration #1 chosen from 1 choice
[   11.372000] hub 1-0:1.0: USB hub found
[   11.372000] hub 1-0:1.0: 4 ports detected
[   11.612000] scsi 1:0:2:0: CD-ROM            TEAC     CD-W512SB        1.0C PQ: 0 ANSI: 2
[   11.612000]  target1:0:2: Beginning Domain Validation
[   11.620000]  target1:0:2: FAST-20 SCSI 20.0 MB/s ST (50 ns, offset 8)
[   11.624000]  target1:0:2: Domain Validation skipping write tests
[   11.624000]  target1:0:2: Ending Domain Validation
[   11.732000] usb 1-1: new full speed USB device using ohci_hcd and address 2
[   11.888000] usb 1-1: configuration #1 chosen from 1 choice
[   11.888000] hub 1-1:1.0: USB hub found
[   11.892000] hub 1-1:1.0: 4 ports detected
[   12.272000] usb 1-2: new full speed USB device using ohci_hcd and address 3
[   12.432000] usb 1-2: configuration #1 chosen from 1 choice
[   12.440000] hub 1-2:1.0: USB hub found
[   12.440000] hub 1-2:1.0: 4 ports detected
[   12.776000] usb 1-1.1: new full speed USB device using ohci_hcd and address 4
[   12.892000] usb 1-1.1: configuration #1 chosen from 1 choice
[   13.108000] usb 1-1.3: new full speed USB device using ohci_hcd and address 5
[   13.220000] usb 1-1.3: configuration #1 chosen from 1 choice
[   13.432000] usb 1-1.4: new low speed USB device using ohci_hcd and address 6
[   13.544000] usb 1-1.4: configuration #1 chosen from 1 choice
[   13.764000] usb 1-2.3: new full speed USB device using ohci_hcd and address 7
[   13.876000] usb 1-2.3: configuration #1 chosen from 1 choice
[   13.888000] drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 7 if 0 alt 0 proto 2 vid 0x04E8 pid 0x326C
[   13.888000] usbcore: registered new interface driver usblp
[   13.888000] drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver
[   13.888000] Initializing USB Mass Storage driver...
[   13.888000] scsi2 : SCSI emulation for USB Mass Storage devices
[   13.888000] usb-storage: device found at 4
[   13.888000] usb-storage: waiting for device to settle before scanning
[   13.888000] scsi3 : SCSI emulation for USB Mass Storage devices
[   13.888000] usb-storage: device found at 5
[   13.888000] usb-storage: waiting for device to settle before scanning
[   13.888000] usbcore: registered new interface driver usb-storage
[   13.888000] USB Mass Storage support registered.
[   13.888000] PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M] at 0x60,0x64 irq 1,12
[   13.892000] serio: i8042 KBD port at 0x60,0x64 irq 1
[   13.892000] serio: i8042 AUX port at 0x60,0x64 irq 12
[   13.892000] mice: PS/2 mouse device common for all mice
[   13.916000] input: AT Translated Set 2 keyboard as /class/input/input3
[   13.920000] input: PC Speaker as /class/input/input4
[   14.664000] input: ImExPS/2 Generic Explorer Mouse as /class/input/input5
[   14.668000] EDAC MC: Ver: 2.0.1 Jul 13 2007
[   14.668000] EDAC MC0: Giving out device to amd76x_edac AMD762: DEV 0000:00:00.0
[   14.668000] usbcore: registered new interface driver hiddev
[   14.680000] input: Logitech WingMan Action Pad as /class/input/input6
[   14.680000] input: USB HID v1.10 Joystick [Logitech WingMan Action Pad] on usb-0000:00:07.4-1.4
[   14.680000] usbcore: registered new interface driver usbhid
[   14.680000] drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
[   14.680000] Advanced Linux Sound Architecture Driver Version 1.0.14 (Thu May 31 09:03:25 2007 UTC).
[   14.680000] no UART detected at 0x1
[   14.684000] ACPI: PCI Interrupt 0000:00:0b.0[A] -> GSI 19 (level, low) -> IRQ 18
[   14.704000] sd 1:0:0:0: [sdb] 17916240 512-byte hardware sectors (9173 MB)
[   14.712000] ALSA device list:
[   14.712000]   #0: SB Live 5.1 (rev.10, serial:0x80641102) at 0x1840, irq 18
[   14.712000] Netfilter messages via NETLINK v0.30.
[   14.712000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   14.712000] TCP cubic registered
[   14.712000] NET: Registered protocol family 1
[   14.712000] NET: Registered protocol family 17
[   14.712000] Starting balanced_irq
[   14.712000] Using IPI Shortcut mode
[   14.712000] scsi: waiting for bus probes to complete ...
[   14.752000] sd 1:0:0:0: [sdb] Write Protect is off
[   14.752000] sd 1:0:0:0: [sdb] Mode Sense: c3 00 00 08
[   14.784000] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   14.812000] sd 1:0:0:0: [sdb] 17916240 512-byte hardware sectors (9173 MB)
[   14.860000] sd 1:0:0:0: [sdb] Write Protect is off
[   14.860000] sd 1:0:0:0: [sdb] Mode Sense: c3 00 00 08
[   14.892000] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   14.892000]  sdb: sdb1 sdb2 sdb3 < sdb5 sdb6 sdb7 >
[   14.928000] sd 1:0:0:0: [sdb] Attached SCSI disk
[   14.928000] sd 1:0:0:0: Attached scsi generic sg1 type 0
[   14.968000] sr0: scsi3-mmc drive: 32x/32x writer cd/rw xa/form2 cdda tray
[   14.968000] sr 1:0:2:0: Attached scsi CD-ROM sr0
[   14.968000] sr 1:0:2:0: Attached scsi generic sg2 type 5
[   14.984000] kjournald starting.  Commit interval 5 seconds
[   14.984000] EXT3-fs: mounted filesystem with ordered data mode.
[   14.984000] VFS: Mounted root (ext3 filesystem) readonly.
[   14.984000] Freeing unused kernel memory: 272k freed
[   17.720000] gameport: EMU10K1 is pci0000:00:0b.1/gameport0, io 0x1878, speed 59659kHz
[   18.152000] nvidia: module license 'NVIDIA' taints kernel.
[   18.156000] ACPI: PCI Interrupt 0000:01:05.0[A] -> GSI 18 (level, low) -> IRQ 17
[   18.156000] NVRM: loading NVIDIA Linux x86 Kernel Module  1.0-8776  Mon Oct 16 21:56:04 PDT 2006
[   18.408000] NVRM: PAT index 1 already configured for Write-Combining!
[   18.408000] NVRM: Aborting, due to PAT already being configured
[   18.892000] usb-storage: device scan complete
[   18.892000] usb-storage: device scan complete
[   18.900000] scsi 3:0:0:0: Direct-Access     Generic  USB SD Reader    2.00 PQ: 0 ANSI: 0
[   18.900000] scsi 2:0:0:0: Direct-Access     SanDisk  ImageMate II     1.30 PQ: 0 ANSI: 2
[   18.912000] sd 2:0:0:0: [sdc] Attached SCSI removable disk
[   18.912000] sd 2:0:0:0: Attached scsi generic sg3 type 0
[   18.940000] sd 3:0:0:0: [sdd] Attached SCSI removable disk
[   18.940000] sd 3:0:0:0: Attached scsi generic sg4 type 0
[   19.420000] EXT3 FS on hdc8, internal journal
[  141.828000] kjournald starting.  Commit interval 5 seconds
[  141.828000] EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
[  141.832000] EXT3 FS on sdb1, internal journal
[  141.832000] EXT3-fs: mounted filesystem with ordered data mode.
[  141.844000] kjournald starting.  Commit interval 5 seconds
[  141.844000] EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
[  141.844000] EXT3 FS on hdc6, internal journal
[  141.844000] EXT3-fs: mounted filesystem with ordered data mode.
[  141.856000] kjournald starting.  Commit interval 5 seconds
[  141.884000] EXT3 FS on sda1, internal journal
[  141.884000] EXT3-fs: mounted filesystem with ordered data mode.
[  141.904000] kjournald starting.  Commit interval 5 seconds
[  141.904000] EXT3 FS on hdc1, internal journal
[  141.904000] EXT3-fs: mounted filesystem with ordered data mode.
[  141.920000] kjournald starting.  Commit interval 5 seconds
[  141.920000] EXT3 FS on hdc5, internal journal
[  141.920000] EXT3-fs: mounted filesystem with ordered data mode.
[  141.948000] kjournald starting.  Commit interval 5 seconds
[  141.948000] EXT3 FS on hdd6, internal journal
[  141.948000] EXT3-fs: mounted filesystem with ordered data mode.
[  141.964000] kjournald starting.  Commit interval 5 seconds
[  141.964000] EXT3 FS on hdd5, internal journal
[  141.964000] EXT3-fs: mounted filesystem with ordered data mode.
[  141.992000] kjournald starting.  Commit interval 5 seconds
[  141.992000] EXT3 FS on hdd8, internal journal
[  141.992000] EXT3-fs: mounted filesystem with ordered data mode.
[  142.136000] EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
[  142.276000] Adding 2008084k swap on /dev/hdc9.  Priority:-1 extents:1 across:2008084k

[-- Attachment #3: Type: TEXT/PLAIN, Size: 24572 bytes --]

[    0.000000] Linux version 2.6.22-gentoo-r1 (root@death) (gcc version 4.1.2 (Gentoo 4.1.2)) #2 SMP PREEMPT Tue Jul 17 11:03:47 EDT 2007
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f400 (usable)
[    0.000000]  BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000e4800 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000001fff0000 (usable)
[    0.000000]  BIOS-e820: 000000001fff0000 - 000000001ffffc00 (ACPI data)
[    0.000000]  BIOS-e820: 000000001ffffc00 - 0000000020000000 (ACPI NVS)
[    0.000000]  BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
[    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)
[    0.000000] 511MB LOWMEM available.
[    0.000000] found SMP MP-table at 000f7510
[    0.000000] Entering add_active_range(0, 0, 131056) 0 entries of 256 used
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA             0 ->     4096
[    0.000000]   Normal       4096 ->   131056
[    0.000000] early_node_map[1] active PFN ranges
[    0.000000]     0:        0 ->   131056
[    0.000000] On node 0 totalpages: 131056
[    0.000000]   DMA zone: 32 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 4064 pages, LIFO batch:0
[    0.000000]   Normal zone: 991 pages used for memmap
[    0.000000]   Normal zone: 125969 pages, LIFO batch:31
[    0.000000] DMI 2.3 present.
[    0.000000] ACPI: RSDP 000F74B0, 0014 (r0 PTLTD )
[    0.000000] ACPI: RSDT 1FFFD51D, 002C (r1 PTLTD    RSDT    6040000  LTP        0)
[    0.000000] ACPI: FACP 1FFFFB2E, 0074 (r1 TYAN   GUINNESS  6040000 PTEC    F4240)
[    0.000000] ACPI: DSDT 1FFFD549, 25E5 (r1    AMD  AMDACPI  6040000 MSFT  100000B)
[    0.000000] ACPI: FACS 1FFFFFC0, 0040
[    0.000000] ACPI: APIC 1FFFFBA2, 005E (r1 PTLTD    APIC    6040000  LTP        0)
[    0.000000] ACPI: PM-Timer IO Port: 0x8008
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x01] enabled)
[    0.000000] Processor #1 6:6 APIC version 16
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
[    0.000000] Processor #0 6:6 APIC version 16
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 2, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 high edge)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ2 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] Allocating PCI resources starting at 30000000 (gap: 20000000:dec00000)
[    0.000000] Built 1 zonelists.  Total pages: 130033
[    0.000000] Kernel command line: auto BOOT_IMAGE=linux ro root=1608
[    0.000000] mapped APIC to ffffd000 (fee00000)
[    0.000000] mapped IOAPIC to ffffc000 (fec00000)
[    0.000000] Enabling fast FPU save and restore... done.
[    0.000000] Enabling unmasked SIMD FPU exception support... done.
[    0.000000] Initializing CPU#0
[    0.000000] PID hash table entries: 2048 (order: 11, 8192 bytes)
[    0.000000] Detected 1533.426 MHz processor.
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 514068k/524224k available (3386k kernel code, 9688k reserved, 1147k data, 264k init, 0k highmem)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfffb7000 - 0xfffff000   ( 288 kB)
[    0.000000]     vmalloc : 0xe0800000 - 0xfffb5000   ( 503 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdfff0000   ( 511 MB)
[    0.000000]       .init : 0xc0574000 - 0xc05b6000   ( 264 kB)
[    0.000000]       .data : 0xc044ea41 - 0xc056d7dc   (1147 kB)
[    0.000000]       .text : 0xc0100000 - 0xc044ea41   (3386 kB)
[    0.000000] Checking if this processor honours the WP bit even in supervisor mode... Ok.
[    0.084000] Calibrating delay using timer specific routine.. 3069.20 BogoMIPS (lpj=6138404)
[    0.084000] Mount-cache hash table entries: 512
[    0.084000] CPU: After generic identify, caps: 0383fbff c1cbfbff 00000000 00000000 00000000 00000000 00000000
[    0.084000] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.084000] CPU: L2 Cache: 256K (64 bytes/line)
[    0.084000] CPU: After all inits, caps: 0383fbff c1cbfbff 00000000 00000420 00000000 00000000 00000000
[    0.084000] Intel machine check architecture supported.
[    0.084000] Intel machine check reporting enabled on CPU#0.
[    0.084000] Compat vDSO mapped to ffffe000.
[    0.084000] Checking 'hlt' instruction... OK.
[    0.100000] Freeing SMP alternatives: 13k freed
[    0.100000] ACPI: Core revision 20070126
[    0.100000] CPU0: AMD Athlon(tm) MP 1800+ stepping 02
[    0.100000] Booting processor 1/0 eip 2000
[    0.112000] Initializing CPU#1
[    0.192000] Calibrating delay using timer specific routine.. 3067.08 BogoMIPS (lpj=6134178)
[    0.192000] CPU: After generic identify, caps: 0383fbff c1cbfbff 00000000 00000000 00000000 00000000 00000000
[    0.192000] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.192000] CPU: L2 Cache: 256K (64 bytes/line)
[    0.192000] CPU: After all inits, caps: 0383fbff c1cbfbff 00000000 00000420 00000000 00000000 00000000
[    0.192000] Intel machine check architecture supported.
[    0.192000] Intel machine check reporting enabled on CPU#1.
[    0.192000] CPU1: AMD Athlon(tm) Processor stepping 02
[    0.192000] Total of 2 processors activated (6136.29 BogoMIPS).
[    0.192000] ENABLING IO-APIC IRQs
[    0.192000] ..TIMER: vector=0x31 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.232000] Brought up 2 CPUs
[    0.276000] migration_cost=4000
[    0.276000] NET: Registered protocol family 16
[    0.276000] ACPI: bus type pci registered
[    0.276000] PCI: PCI BIOS revision 2.10 entry at 0xfd7e0, last bus=1
[    0.276000] PCI: Using configuration type 1
[    0.276000] Setting up standard PCI resources
[    0.280000] mtrr: your CPUs had inconsistent fixed MTRR settings
[    0.284000] mtrr: probably your BIOS does not setup all CPUs.
[    0.284000] mtrr: corrected configuration.
[    0.288000] ACPI: Interpreter enabled
[    0.288000] ACPI: Using IOAPIC for interrupt routing
[    0.292000] ACPI: PCI Root Bridge [PCI0] (0000:00)
[    0.292000] PCI: Probing PCI hardware (bus 00)
[    0.292000] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
[    0.292000] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.AGP_._PRT]
[    0.292000] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 5 10 11) *0, disabled.
[    0.292000] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 *5 10 11)
[    0.292000] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 5 *10 11)
[    0.296000] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 5 10 *11)
[    0.296000] Linux Plug and Play Support v0.97 (c) Adam Belay
[    0.296000] pnp: PnP ACPI init
[    0.296000] ACPI: bus type pnp registered
[    0.300000] pnp: PnP ACPI: found 13 devices
[    0.300000] ACPI: ACPI bus type pnp unregistered
[    0.300000] SCSI subsystem initialized
[    0.300000] libata version 2.21 loaded.
[    0.300000] usbcore: registered new interface driver usbfs
[    0.300000] usbcore: registered new interface driver hub
[    0.300000] usbcore: registered new device driver usb
[    0.300000] PCI: Using ACPI for IRQ routing
[    0.300000] PCI: If a device doesn't work, try "pci=routeirq".  If it helps, post a report
[    0.300000] pnp: 00:00: iomem range 0xfff80000-0xffffffff could not be reserved
[    0.300000] pnp: 00:00: iomem range 0xffc00000-0xfff7ffff has been reserved
[    0.300000] pnp: 00:00: iomem range 0x0-0x9ffff could not be reserved
[    0.300000] pnp: 00:00: iomem range 0x100000-0x1fffffff could not be reserved
[    0.300000] pnp: 00:06: ioport range 0x4d0-0x4d1 has been reserved
[    0.332000] PCI: Bridge: 0000:00:01.0
[    0.332000]   IO window: disabled.
[    0.332000]   MEM window: f1000000-f1ffffff
[    0.332000]   PREFETCH window: f8000000-fc0fffff
[    0.332000] NET: Registered protocol family 2
[    0.336000] Time: acpi_pm clocksource has been installed.
[    0.368000] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.368000] TCP established hash table entries: 16384 (order: 6, 458752 bytes)
[    0.368000] TCP bind hash table entries: 16384 (order: 6, 393216 bytes)
[    0.368000] TCP: Hash tables configured (established 16384 bind 16384)
[    0.368000] TCP reno registered
[    0.380000] Machine check exception polling timer started.
[    0.380000] VFS: Disk quotas dquot_6.5.1
[    0.380000] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.380000] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.380000] io scheduler noop registered
[    0.380000] io scheduler anticipatory registered (default)
[    0.380000] io scheduler deadline registered
[    0.380000] io scheduler cfq registered
[    0.380000] BIOS failed to enable PCI standards compliance, fixing this error.
[    0.380000] I/O APIC: AMD Erratum #22 may be present. In the event of instability try
[    0.380000]         : booting with the "noapic" option.
[    0.400000] Boot video device is 0000:01:05.0
[    0.464000] lp: driver loaded but no devices found
[    0.464000] Real Time Clock Driver v1.12ac
[    0.464000] Linux agpgart interface v0.102 (c) Dave Jones
[    0.464000] input: Power Button (FF) as /class/input/input0
[    0.464000] ACPI: Power Button (FF) [PWRF]
[    0.464000] input: Sleep Button (FF) as /class/input/input1
[    0.464000] ACPI: Sleep Button (FF) [SLPF]
[    0.464000] input: Power Button (CM) as /class/input/input2
[    0.464000] ACPI: Power Button (CM) [PWRB]
[    0.464000] Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
[    0.468000] 00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.468000] 00:08: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    0.468000] parport_pc 00:09: reported by Plug and Play ACPI
[    0.468000] parport0: PC-style at 0x378 (0x778), irq 7 [PCSPP,TRISTATE,EPP]
[    0.564000] lp0: using parport0 (interrupt-driven).
[    0.564000] lp0: console ready
[    0.564000] Floppy drive(s): fd0 is 1.44M
[    0.580000] FDC 0 is a post-1991 82077
[    0.584000] loop: module loaded
[    0.584000] 8139too Fast Ethernet driver 0.9.28
[    0.584000] ACPI: PCI Interrupt 0000:00:0d.0[A] -> GSI 17 (level, low) -> IRQ 16
[    0.584000] eth0: RealTek RTL8139 at 0x1400, 00:50:ba:ae:3d:8a, IRQ 16
[    0.584000] eth0:  Identified 8139 chip type 'RTL-8139C'
[    0.584000] netconsole: not configured, aborting
[    0.584000] Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
[    0.584000] ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
[    0.584000] AMD7411: IDE controller at PCI slot 0000:00:07.1
[    0.584000] AMD7411: chipset revision 1
[    0.584000] AMD7411: not 100% native mode: will probe irqs later
[    0.584000] AMD7411: 0000:00:07.1 (rev 01) UDMA100 controller
[    0.584000]     ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda:DMA, hdb:pio
[    0.584000]     ide1: BM-DMA at 0xf008-0xf00f, BIOS settings: hdc:pio, hdd:DMA
[    0.584000] Probing IDE interface ide0...
[    1.320000] hda: LITE-ON DVDRW SHW-160P6S, ATAPI CD/DVD-ROM drive
[    1.992000] ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
[    1.992000] Probing IDE interface ide1...
[    2.280000] hdc: ST3160023A, ATA DISK drive
[    2.560000] hdd: ST3200822A, ATA DISK drive
[    2.616000] ide1 at 0x170-0x177,0x376 on irq 15
[    2.616000] hdc: max request size: 512KiB
[    2.616000] hdc: 312581808 sectors (160041 MB) w/8192KiB Cache, CHS=19457/255/63, UDMA(100)
[    2.616000] hdc: cache flushes supported
[    2.616000]  hdc: hdc1 hdc2 hdc3 < hdc5 hdc6 hdc7 hdc8 hdc9 >
[    2.708000] hdd: max request size: 512KiB
[    2.708000] hdd: 390721968 sectors (200049 MB) w/8192KiB Cache, CHS=24321/255/63, UDMA(100)
[    2.708000] hdd: cache flushes supported
[    2.708000]  hdd: hdd1 hdd2 hdd4 < hdd5 hdd6 hdd7 hdd8 >
[    2.764000] hda: ATAPI 48X DVD-ROM DVD-R CD-R/RW drive, 2048kB Cache, UDMA(33)
[    2.764000] Uniform CD-ROM driver Revision: 3.20
[    6.032000] scsi0 : AdvanSys SCSI 3.3K: PCI Ultra: IO 0x1800-0x180F, IRQ 0x5
[    6.032000] advansys: advansys_detect: unknown bus type: 4
[    6.032000] ACPI: PCI Interrupt 0000:00:0a.0[A] -> GSI 18 (level, low) -> IRQ 17
[   11.248000] scsi1 : Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev 7.0
[   11.248000]         <Adaptec 2940 Ultra2 SCSI adapter>
[   11.248000]         aic7890/91: Ultra2 Wide Channel A, SCSI Id=7, 32/253 SCBs
[   11.248000] 
[   11.248000] st: Version 20070203, fixed bufsize 32768, s/g segs 256
[   11.248000] usbmon: debugfs is not available
[   11.248000] ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
[   11.248000] ACPI: PCI Interrupt 0000:00:07.4[D] -> GSI 19 (level, low) -> IRQ 18
[   11.248000] ohci_hcd 0000:00:07.4: OHCI Host Controller
[   11.248000] ohci_hcd 0000:00:07.4: new USB bus registered, assigned bus number 1
[   11.248000] ohci_hcd 0000:00:07.4: irq 18, io mem 0x000dc000
[   11.256000] scsi 1:0:0:0: Direct-Access     IBM      DNES-309170      SAH0 PQ: 0 ANSI: 3
[   11.256000] scsi1:A:0:0: Tagged Queuing enabled.  Depth 32
[   11.256000]  target1:0:0: Beginning Domain Validation
[   11.292000] (scsi1:A:0:0): refuses WIDE negotiation.  Using 8bit transfers
[   11.292000]  target1:0:0: FAST-20 SCSI 20.0 MB/s ST (50 ns, offset 31)
[   11.304000] usb usb1: configuration #1 chosen from 1 choice
[   11.304000] hub 1-0:1.0: USB hub found
[   11.304000] hub 1-0:1.0: 4 ports detected
[   11.316000]  target1:0:0: Domain Validation skipping write tests
[   11.316000]  target1:0:0: Ending Domain Validation
[   11.532000] advansys: advansys_reset: board 0: SCSI bus reset started...
[   11.608000] scsi 1:0:2:0: CD-ROM            TEAC     CD-W512SB        1.0C PQ: 0 ANSI: 2
[   11.608000]  target1:0:2: Beginning Domain Validation
[   11.616000]  target1:0:2: FAST-20 SCSI 20.0 MB/s ST (50 ns, offset 8)
[   11.620000]  target1:0:2: Domain Validation skipping write tests
[   11.620000]  target1:0:2: Ending Domain Validation
[   11.668000] usb 1-1: new full speed USB device using ohci_hcd and address 2
[   11.824000] usb 1-1: configuration #1 chosen from 1 choice
[   11.824000] hub 1-1:1.0: USB hub found
[   11.828000] hub 1-1:1.0: 4 ports detected
[   12.208000] usb 1-2: new full speed USB device using ohci_hcd and address 3
[   12.368000] usb 1-2: configuration #1 chosen from 1 choice
[   12.376000] hub 1-2:1.0: USB hub found
[   12.376000] hub 1-2:1.0: 4 ports detected
[   12.712000] usb 1-1.1: new full speed USB device using ohci_hcd and address 4
[   12.828000] usb 1-1.1: configuration #1 chosen from 1 choice
[   13.044000] usb 1-1.3: new full speed USB device using ohci_hcd and address 5
[   13.156000] usb 1-1.3: configuration #1 chosen from 1 choice
[   13.368000] usb 1-1.4: new low speed USB device using ohci_hcd and address 6
[   13.480000] usb 1-1.4: configuration #1 chosen from 1 choice
[   13.700000] usb 1-2.3: new full speed USB device using ohci_hcd and address 7
[   13.812000] usb 1-2.3: configuration #1 chosen from 1 choice
[   13.824000] drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 7 if 0 alt 0 proto 2 vid 0x04E8 pid 0x326C
[   13.824000] usbcore: registered new interface driver usblp
[   13.824000] drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver
[   13.824000] Initializing USB Mass Storage driver...
[   13.824000] scsi2 : SCSI emulation for USB Mass Storage devices
[   13.824000] usb-storage: device found at 4
[   13.824000] usb-storage: waiting for device to settle before scanning
[   13.824000] scsi3 : SCSI emulation for USB Mass Storage devices
[   13.824000] usb-storage: device found at 5
[   13.824000] usb-storage: waiting for device to settle before scanning
[   13.824000] usbcore: registered new interface driver usb-storage
[   13.824000] USB Mass Storage support registered.
[   13.824000] PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M] at 0x60,0x64 irq 1,12
[   13.828000] serio: i8042 KBD port at 0x60,0x64 irq 1
[   13.828000] serio: i8042 AUX port at 0x60,0x64 irq 12
[   13.828000] mice: PS/2 mouse device common for all mice
[   13.828000] input: PC Speaker as /class/input/input3
[   13.828000] EDAC MC: Ver: 2.0.1 Jul 13 2007
[   13.828000] EDAC MC0: Giving out device to amd76x_edac AMD762: DEV 0000:00:00.0
[   13.828000] usbcore: registered new interface driver hiddev
[   13.840000] input: Logitech WingMan Action Pad as /class/input/input4
[   13.840000] input: USB HID v1.10 Joystick [Logitech WingMan Action Pad] on usb-0000:00:07.4-1.4
[   13.840000] usbcore: registered new interface driver usbhid
[   13.840000] drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
[   13.840000] Advanced Linux Sound Architecture Driver Version 1.0.14 (Thu May 31 09:03:25 2007 UTC).
[   13.840000] no UART detected at 0x1
[   13.844000] ACPI: PCI Interrupt 0000:00:0b.0[A] -> GSI 19 (level, low) -> IRQ 18
[   13.852000] input: AT Translated Set 2 keyboard as /class/input/input5
[   13.872000] ALSA device list:
[   13.872000]   #0: SB Live 5.1 (rev.10, serial:0x80641102) at 0x1840, irq 18
[   13.872000] Netfilter messages via NETLINK v0.30.
[   13.872000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   13.872000] TCP cubic registered
[   13.872000] NET: Registered protocol family 1
[   13.872000] NET: Registered protocol family 17
[   13.872000] Starting balanced_irq
[   13.872000] Using IPI Shortcut mode
[   13.872000] scsi: waiting for bus probes to complete ...
[   14.604000] input: ImExPS/2 Generic Explorer Mouse as /class/input/input6
[   14.708000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[   18.828000] usb-storage: device scan complete
[   18.828000] usb-storage: device scan complete
[   18.836000] scsi 3:0:0:0: Direct-Access     Generic  USB SD Reader    2.00 PQ: 0 ANSI: 0
[   18.836000] scsi 2:0:0:0: Direct-Access     SanDisk  ImageMate II     1.30 PQ: 0 ANSI: 2
[   34.712000] advansys: advansys_reset: board 0: SCSI bus reset started...
[   37.888000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[   47.892000] scsi 0:0:0:0: scsi: Device offlined - not ready after error recovery
[   53.392000] advansys: advansys_reset: board 0: SCSI bus reset started...
[   56.568000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[   76.572000] advansys: advansys_reset: board 0: SCSI bus reset started...
[   79.748000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[   89.752000] scsi 0:0:1:0: scsi: Device offlined - not ready after error recovery
[   95.252000] advansys: advansys_reset: board 0: SCSI bus reset started...
[   98.428000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  118.432000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  121.608000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  131.612000] scsi 0:0:2:0: scsi: Device offlined - not ready after error recovery
[  137.112000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  140.288000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  160.292000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  163.468000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  173.472000] scsi 0:0:3:0: scsi: Device offlined - not ready after error recovery
[  178.972000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  182.148000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  202.152000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  205.328000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  215.332000] scsi 0:0:4:0: scsi: Device offlined - not ready after error recovery
[  220.832000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  224.008000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  244.012000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  247.188000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  257.192000] scsi 0:0:5:0: scsi: Device offlined - not ready after error recovery
[  262.692000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  265.868000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  285.872000] advansys: advansys_reset: board 0: SCSI bus reset started...
[  289.048000] advansys: advansys_reset: board 0: SCSI bus reset successful.
[  299.052000] scsi 0:0:6:0: scsi: Device offlined - not ready after error recovery
[  299.052000] sd 1:0:0:0: [sda] 17916240 512-byte hardware sectors (9173 MB)
[  299.092000] sd 1:0:0:0: [sda] Write Protect is off
[  299.092000] sd 1:0:0:0: [sda] Mode Sense: c3 00 00 08
[  299.128000] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  299.152000] sd 1:0:0:0: [sda] 17916240 512-byte hardware sectors (9173 MB)
[  299.200000] sd 1:0:0:0: [sda] Write Protect is off
[  299.200000] sd 1:0:0:0: [sda] Mode Sense: c3 00 00 08
[  299.232000] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  299.232000]  sda: sda1 sda2 sda3 < sda5 sda6 sda7 >
[  299.268000] sd 1:0:0:0: [sda] Attached SCSI disk
[  299.268000] sd 1:0:0:0: Attached scsi generic sg0 type 0
[  299.308000] sr0: scsi3-mmc drive: 32x/32x writer cd/rw xa/form2 cdda tray
[  299.308000] sr 1:0:2:0: Attached scsi CD-ROM sr0
[  299.308000] sr 1:0:2:0: Attached scsi generic sg1 type 5
[  299.320000] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[  299.320000] sd 2:0:0:0: Attached scsi generic sg2 type 0
[  299.332000] kjournald starting.  Commit interval 5 seconds
[  299.332000] EXT3-fs: mounted filesystem with ordered data mode.
[  299.332000] VFS: Mounted root (ext3 filesystem) readonly.
[  299.332000] Freeing unused kernel memory: 264k freed
[  299.428000] sd 3:0:0:0: [sdc] Attached SCSI removable disk
[  299.428000] sd 3:0:0:0: Attached scsi generic sg3 type 0
[  302.080000] gameport: EMU10K1 is pci0000:00:0b.1/gameport0, io 0x1878, speed 59659kHz
[  302.332000] nvidia: module license 'NVIDIA' taints kernel.
[  302.352000] ACPI: PCI Interrupt 0000:01:05.0[A] -> GSI 18 (level, low) -> IRQ 17
[  302.352000] NVRM: loading NVIDIA Linux x86 Kernel Module  1.0-8776  Mon Oct 16 21:56:04 PDT 2006
[  303.564000] EXT3 FS on hdc8, internal journal
[  390.740000] kjournald starting.  Commit interval 5 seconds
[  390.740000] EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
[  390.740000] EXT3 FS on hdc6, internal journal
[  390.740000] EXT3-fs: mounted filesystem with ordered data mode.
[  390.772000] kjournald starting.  Commit interval 5 seconds
[  390.772000] EXT3 FS on hdc1, internal journal
[  390.772000] EXT3-fs: mounted filesystem with ordered data mode.
[  390.792000] kjournald starting.  Commit interval 5 seconds
[  390.792000] EXT3 FS on hdc5, internal journal
[  390.792000] EXT3-fs: mounted filesystem with ordered data mode.
[  390.816000] kjournald starting.  Commit interval 5 seconds
[  390.816000] EXT3 FS on hdd6, internal journal
[  390.816000] EXT3-fs: mounted filesystem with ordered data mode.
[  390.832000] kjournald starting.  Commit interval 5 seconds
[  390.832000] EXT3 FS on hdd5, internal journal
[  390.832000] EXT3-fs: mounted filesystem with ordered data mode.
[  390.860000] kjournald starting.  Commit interval 5 seconds
[  390.860000] EXT3 FS on hdd8, internal journal
[  390.860000] EXT3-fs: mounted filesystem with ordered data mode.
[  390.940000] EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
[  391.024000] Adding 2008084k swap on /dev/hdc9.  Priority:-1 extents:1 across:2008084k

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: advansys cleanup
  2007-07-17 15:36   ` Ken Witherow
@ 2007-07-17 16:37     ` Matthew Wilcox
  2007-07-17 20:05       ` Ken Witherow
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew Wilcox @ 2007-07-17 16:37 UTC (permalink / raw)
  To: Ken Witherow; +Cc: linux-scsi, jeffreyfreeman, Christoph Hellwig

On Tue, Jul 17, 2007 at 11:36:11AM -0400, Ken Witherow wrote:
> Instead, I pulled the raw advansys.c from the tree provided and dropped 
> that in place.

Hm, sorry about that.  I suspect that advansys.c has changed since
2.6.22.

>   CC      drivers/scsi/advansys.o
> drivers/scsi/advansys.c:795:2: warning: #warning this driver is still not 
> properly converted to the DMA API

Yeah, I'm not planning on getting rid of that warning.  Yet, anyway.

>   MODPOST vmlinux
> WARNING: drivers/built-in.o(.text+0x99045): Section mismatch: reference to 
> .init.text: (between 'advansys_board_found' and 'advansys_pci_probe')

Oops.  Probably simple to fix, I'll look into that.

> 
> I've attached my regular dmesg as well as my dmesg with the failure of the 
> updated advansys driver.

The important bit is this one:

-ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 16
-scsi0 : AdvanSys SCSI 3.3K: PCI Ultra: IO 0x1800-0x180F, IRQ 0x10
+scsi0 : AdvanSys SCSI 3.3K: PCI Ultra: IO 0x1800-0x180F, IRQ 0x5
+advansys: advansys_detect: unknown bus type: 4

Somehow I've messed up the IRQ.

The unknown bus type is just a minor oversight -- i ripped out the
handling of PCI bus types from advansys_detect, but let it try to probe
for them anyway, which it no longer knows how to handle.

> I'd be glad to attempt the patches again. It would be easier for me if you 
> sent me the raw patches, if possible.

How about I send you a patch on top of the advansys.c you got from that
git tree?

-- 
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: advansys cleanup
  2007-07-17 16:37     ` Matthew Wilcox
@ 2007-07-17 20:05       ` Ken Witherow
  0 siblings, 0 replies; 9+ messages in thread
From: Ken Witherow @ 2007-07-17 20:05 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-scsi, jeffreyfreeman, Christoph Hellwig

On Tue, 17 Jul 2007, Matthew Wilcox wrote:

>> I'd be glad to attempt the patches again. It would be easier for me if you
>> sent me the raw patches, if possible.
>
> How about I send you a patch on top of the advansys.c you got from that
> git tree?

Certainly... whatever works for you. I'm glad just to see the driver 
getting a little love again.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-07-17 20:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-16 20:28 advansys cleanup Matthew Wilcox
2007-07-16 22:41 ` [PATCH 1/4] advansys: Create advansys_board_found() Matthew Wilcox
2007-07-16 22:41 ` [PATCH 2/4] advansys: Clean up proc_info implementation Matthew Wilcox
2007-07-16 22:41 ` [PATCH 3/4] advansys: Convert to pci_register_driver interface Matthew Wilcox
2007-07-16 22:41 ` [PATCH 4/4] advansys: Move to scsi hotplug initialisation model Matthew Wilcox
2007-07-17 14:24 ` advansys cleanup Matthew Wilcox
2007-07-17 15:36   ` Ken Witherow
2007-07-17 16:37     ` Matthew Wilcox
2007-07-17 20:05       ` Ken Witherow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).