Skip to contentSkip to conversation

Sync up drivers/scsi/aic7xxx

PATCH In review Luben Tuikov 1 participant 1 message Sep 28, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 21/28 Sync up drivers/scsi/aic7xxx

Sync up drivers/scsi/aic7xxx/. (2666-2686)

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#17 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic7770_osm.c ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic7770_osm.c renamed from tmp/tmp.27107.0 +14 -6
@@ -36,7 +36,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#17 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#19 $
  */
 
 #include "aic7xxx_osm.h"
@@ -73,7 +73,7 @@
 static int aic7770_linux_config(struct aic7770_identity *entry,
 				aic7770_dev_t dev, u_int eisaBase);
 
-void
+int
 ahc_linux_eisa_init(void)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
@@ -82,7 +82,7 @@
 	int i;
 
 	if (aic7xxx_probe_eisa_vl == 0)
-		return;
+		return (0);
 
 	/*
 	 * Linux requires the EISA IDs to be specified in
@@ -93,7 +93,7 @@
 					 (ahc_num_aic7770_devs + 1),
 					 M_DEVBUF, M_NOWAIT);
 	if (aic7770_driver.id_table == NULL)
-		return;
+		return (-ENOMEM);
 
 	for (eid = (struct eisa_device_id *)aic7770_driver.id_table,
 	     id = aic7770_ident_table, i = 0;
@@ -109,7 +109,7 @@
 	}
 	eid->sig[0] = 0;
 
-	eisa_driver_register(&aic7770_driver);
+	return (eisa_driver_register(&aic7770_driver));
 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
 	struct aic7770_identity *entry;
 	u_int  slot;
@@ -117,7 +117,7 @@
 	u_int  i;
 
 	if (aic7xxx_probe_eisa_vl == 0)
-		return;
+		return (0);
 
 	eisaBase = 0x1000 + AHC_EISA_SLOT_OFFSET;
 	for (slot = 1; slot < NUMSLOTS; eisaBase+=0x1000, slot++) {
@@ -143,6 +143,7 @@
 		if (entry != NULL)
 			aic7770_linux_config(entry, NULL, eisaBase);
 	}
+	return (0);
 #endif
 }
 
@@ -185,6 +186,13 @@
 		return (ENOMEM);
 	}
 	ahc->dev_softc = dev;
+	if (aic_set_dma_mask(ahc, 0xFFFFFFFF) != 0
+       /*|| aic_set_consistent_dma_mask(ahc, 0xFFFFFFFF) != 0 */) {
+		printk(KERN_WARNING "aic7xxx: Unable to set DMA masks.\n");
+		ahc_free(ahc);
+		return (-ENOMEM);
+	}
+	ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;
 	error = aic7770_config(ahc, entry, eisaBase);
 	if (error != 0) {
 		ahc->bsh.ioport = 0;

==== //depot/aic7xxx/aic7xxx/aic79xx.h#105 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx.h ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx.h renamed from tmp/tmp.27107.1 +2 -2
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#105 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#106 $
  *
  * $FreeBSD$
  */
@@ -201,7 +201,7 @@
 #define AHD_BUSRESET_DELAY	25
 
 /******************* Chip Characteristics/Operating Settings  *****************/
-extern int ahd_attach_to_HostRAID_controllers;
+extern uint32_t ahd_attach_to_HostRAID_controllers;
 
 /*
  * Chip Type

==== //depot/aic7xxx/aic7xxx/aic79xx.seq#117 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx.seq ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx.seq renamed from tmp/tmp.27107.2 +13 -2
@@ -40,7 +40,7 @@
  * $FreeBSD$
  */
 
-VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#117 $"
+VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#118 $"
 PATCH_ARG_LIST = "struct ahd_softc *ahd"
 PREFIX = "ahd_"
 
@@ -409,7 +409,18 @@
 	mov	CCSCBCTL, SINDEX ret;
 
 setjmp:
-	bmov	LONGJMP_ADDR, STACK, 2 ret;
+	/*
+	 * At least on the A, a return in the same
+	 * instruction as the bmov results in a return
+	 * to the caller, not to the new address at the
+	 * top of the stack.  Since we want the latter
+	 * (we use setjmp to register a handler from an
+	 * interrupt context but not invoke that handler
+	 * until we return to our idle loop), use a
+	 * separate ret instruction.
+	 */
+	bmov	LONGJMP_ADDR, STACK, 2;
+	ret;
 setjmp_inline:
 	bmov	LONGJMP_ADDR, STACK, 2;
 longjmp:

==== //depot/aic7xxx/aic7xxx/aic79xx.c#236 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_core.c ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_core.c renamed from tmp/tmp.27107.3 +21 -17
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#236 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#238 $
  */
 
 #ifdef __linux__
@@ -54,7 +54,7 @@
 
 /******************************** Globals *************************************/
 struct ahd_softc_tailq ahd_tailq = TAILQ_HEAD_INITIALIZER(ahd_tailq);
-int ahd_attach_to_HostRAID_controllers = 1;
+uint32_t ahd_attach_to_HostRAID_controllers = 1;
 
 /***************************** Lookup Tables **********************************/
 char *ahd_chip_names[] =
@@ -6013,6 +6013,22 @@
 		hscb = (struct hardware_scb *)hscb_map->vaddr;
 		hscb_busaddr = hscb_map->busaddr;
 		scb_data->scbs_left = PAGE_SIZE / sizeof(*hscb);
+		if (ahd->next_queued_hscb == NULL) {
+			/*
+			 * We need one HSCB to serve as the "next HSCB".  Since
+			 * the tag identifier in this HSCB will never be used,
+			 * there is no point in using a valid SCB from the
+			 * free pool for it.  So, we allocate this "sentinel"
+			 * specially.
+	 		 */
+			ahd->next_queued_hscb = hscb;
+			ahd->next_queued_hscb_map = hscb_map;
+			memset(hscb, 0, sizeof(*hscb));
+			hscb->hscb_busaddr = aic_htole32(hscb_busaddr);
+			hscb++;
+			hscb_busaddr += sizeof(*hscb);
+			scb_data->scbs_left--;
+		}
 	}
 
 	if (scb_data->sgs_left != 0) {
@@ -6096,12 +6112,12 @@
 	scb_data->scbs_left -= newcount;
 	scb_data->sgs_left -= newcount;
 	for (i = 0; i < newcount; i++) {
-		u_int col_tag;
-
 		struct scb_platform_data *pdata;
+		u_int col_tag;
 #ifndef __linux__
 		int error;
 #endif
+
 		next_scb = (struct scb *)malloc(sizeof(*next_scb),
 						M_DEVBUF, M_NOWAIT);
 		if (next_scb == NULL)
@@ -6272,8 +6288,7 @@
 	 * for the target mode role, we must additionally provide space for
 	 * the incoming target command fifo.
 	 */
-	driver_data_size = AHD_SCB_MAX * sizeof(*ahd->qoutfifo)
-			 + sizeof(struct hardware_scb);
+	driver_data_size = AHD_SCB_MAX * sizeof(*ahd->qoutfifo);
 	if ((ahd->features & AHD_TARGETMODE) != 0)
 		driver_data_size += AHD_TMODE_CMDS * sizeof(struct target_cmd);
 	if ((ahd->bugs & AHD_PKT_BITBUCKET_BUG) != 0)
@@ -6323,17 +6338,6 @@
 		next_baddr += PKT_OVERRUN_BUFSIZE;
 	}
 
-	/*
-	 * We need one SCB to serve as the "next SCB".  Since the
-	 * tag identifier in this SCB will never be used, there is
-	 * no point in using a valid HSCB tag from an SCB pulled from
-	 * the standard free pool.  So, we allocate this "sentinel"
-	 * specially from the DMA safe memory chunk used for the QOUTFIFO.
-	 */
-	ahd->next_queued_hscb = (struct hardware_scb *)next_vaddr;
-	ahd->next_queued_hscb_map = &ahd->shared_data_map;
-	ahd->next_queued_hscb->hscb_busaddr = aic_htole32(next_baddr);
-
 	ahd->init_level++;
 
 	/* Allocate SCB data now that buffer_dmat is initialized */

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#198 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_osm.c ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_osm.c renamed from tmp/tmp.27107.4 +36 -11

111 lines not on this page · raw message

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#155 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_osm.h ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_osm.h renamed from tmp/tmp.27107.5 +2 -1
@@ -36,7 +36,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#155 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#156 $
  *
  */
 #ifndef _AIC79XX_LINUX_H_
@@ -228,6 +228,7 @@
 }
 
 /**************************** Initialization **********************************/
+extern int	ahd_init_status;
 int		ahd_linux_register_host(struct ahd_softc *,
 					Scsi_Host_Template *);
 

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#30 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_osm_pci.c ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_osm_pci.c renamed from tmp/tmp.27107.6 +27 -4
@@ -36,7 +36,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#30 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#33 $
  */
 
 #include "aic79xx_osm.h"
@@ -48,6 +48,8 @@
  */
 #include "aiclib_pci.c"
 
+static int	ahd_pci_module_registered;
+
 static int	ahd_linux_pci_dev_probe(struct pci_dev *pdev,
 					const struct pci_device_id *ent);
 static int	ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd,
@@ -63,6 +65,10 @@
 		0x9005, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
 		PCI_CLASS_STORAGE_SCSI << 8, 0xFFFF00, 0
 	},
+	{
+		0x9005, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+		PCI_CLASS_STORAGE_RAID << 8, 0xFFFF00, 0
+	},
 	{ 0 }
 };
 
@@ -155,6 +161,12 @@
 	}
 	pci_set_master(pdev);
 
+	if (aic_set_consistent_dma_mask(ahd, 0xFFFFFFFF) != 0) {
+		printk(KERN_WARNING "aic79xx: Unable to set"
+		       "coherent DMA mask.\n");
+		ahd_free(ahd);
+		return (-ENOMEM);
+	}
 	if (sizeof(bus_addr_t) > 4) {
 		uint64_t   memsize;
 		bus_addr_t mask_64bit;
@@ -173,7 +185,12 @@
 			ahd->platform_data->hw_dma_mask = mask_39bit;
 		}
 	} else {
-		aic_set_dma_mask(ahd, 0xFFFFFFFF);
+		if (aic_set_dma_mask(ahd, 0xFFFFFFFF) != 0) {
+			printk(KERN_WARNING "aic79xx: Unable to set data "
+			       "DMA mask.\n");
+			ahd_free(ahd);
+			return (-ENOMEM);
+		}
 		ahd->platform_data->hw_dma_mask = 0xFFFFFFFF;
 	}
 	error = ahd_pci_config(ahd, entry);
@@ -197,13 +214,19 @@
 int
 ahd_linux_pci_init(void)
 {
-	return (pci_module_init(&aic79xx_pci_driver));
+	int error;
+	
+	error = pci_module_init(&aic79xx_pci_driver);
+	if (error == 0)
+		ahd_pci_module_registered = 1;
+	return (error);
 }
 
 void
 ahd_linux_pci_exit(void)
 {
-	pci_unregister_driver(&aic79xx_pci_driver);
+	if (ahd_pci_module_registered != 0)
+		pci_unregister_driver(&aic79xx_pci_driver);
 }
 
 static int

==== //depot/aic7xxx/aic7xxx/aic79xx_pci.c#85 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_pci.c ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_pci.c renamed from tmp/tmp.27107.7 +4 -4
@@ -38,7 +38,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#85 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#86 $
  */
 
 #ifdef __linux__
@@ -65,10 +65,10 @@
 }
 
 #define ID_ALL_MASK			0xFFFFFFFFFFFFFFFFull
-#define ID_ALL_IROC_MASK		0xFFFFFF7FFFFFFFFFull
+#define ID_ALL_IROC_MASK		0xFF7FFFFFFFFFFFFFull
 #define ID_DEV_VENDOR_MASK		0xFFFFFFFF00000000ull
 #define ID_9005_GENERIC_MASK		0xFFF0FFFF00000000ull
-#define ID_9005_GENERIC_IROC_MASK	0xFFF0FF7F00000000ull
+#define ID_9005_GENERIC_IROC_MASK	0xFF70FFFF00000000ull
 
 #define ID_AIC7901			0x800F9005FFFF9005ull
 #define ID_AHA_29320A			0x8000900500609005ull
@@ -199,7 +199,7 @@
 	},
 	/* Generic chip probes for devices we don't know 'exactly' */
 	{
-		ID_AIC7901 & ID_DEV_VENDOR_MASK,
+		ID_AIC7901 & ID_9005_GENERIC_MASK,
 		ID_DEV_VENDOR_MASK,
 		"Adaptec AIC7901 Ultra320 SCSI adapter",
 		ahd_aic7901_setup

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_reg.h#84 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped renamed from tmp/tmp.27107.8 +3 -3
@@ -2,7 +2,7 @@
  * DO NOT EDIT - This file is automatically generated
  *		 from the following source files:
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#117 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#118 $
  * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#75 $
  */
 typedef int (ahd_reg_print_t)(u_int, u_int *, u_int);
@@ -3799,5 +3799,5 @@
 
 
 /* Exported Labels */
-#define	LABEL_seq_isr 	0x282
-#define	LABEL_timer_isr	0x27e
+#define	LABEL_seq_isr 	0x283
+#define	LABEL_timer_isr	0x27f

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_reg_print.c#65 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped renamed from tmp/tmp.27107.9 +1 -1
@@ -2,7 +2,7 @@
  * DO NOT EDIT - This file is automatically generated
  *		 from the following source files:
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#117 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#118 $
  * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#75 $
  */
 

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_seq.h#85 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped renamed from tmp/tmp.27107.10 +410 -409

1,182 lines not on this page · raw message

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#262 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic7xxx_osm.c ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic7xxx_osm.c renamed from tmp/tmp.27107.11 +37 -12

104 lines not on this page · raw message

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#167 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic7xxx_osm.h ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic7xxx_osm.h renamed from tmp/tmp.27107.12 +3 -2
@@ -53,7 +53,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#167 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#168 $
  *
  */
 #ifndef _AIC7XXX_LINUX_H_
@@ -219,6 +219,7 @@
 }
 
 /**************************** Initialization **********************************/
+extern int	ahc_init_status;
 int		ahc_linux_register_host(struct ahc_softc *,
 					Scsi_Host_Template *);
 
@@ -249,7 +250,7 @@
 
 #ifdef CONFIG_EISA
 extern uint32_t aic7xxx_probe_eisa_vl;
-void			 ahc_linux_eisa_init(void);
+int			 ahc_linux_eisa_init(void);
 void			 ahc_linux_eisa_exit(void);
 int			 aic7770_map_registers(struct ahc_softc *ahc,
 					       u_int port);

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#53 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c renamed from tmp/tmp.27107.13 +24 -4
@@ -36,7 +36,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#53 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#56 $
  */
 
 #include "aic7xxx_osm.h"
@@ -47,6 +47,8 @@
  */
 #include "aiclib_pci.c"
 
+static int	ahc_pci_module_registered;
+
 static int	ahc_linux_pci_dev_probe(struct pci_dev *pdev,
 					const struct pci_device_id *ent);
 static int	ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc,
@@ -160,6 +162,13 @@
 	}
 	pci_set_master(pdev);
 
+	if (aic_set_consistent_dma_mask(ahc, 0xFFFFFFFF) != 0) {
+		printk(KERN_WARNING "aic7xxx: Unable to set"
+		       "coherent DMA mask.\n");
+		ahc_free(ahc);
+		return (-ENOMEM);
+	}
+
 	mask_39bit = (bus_addr_t)0x7FFFFFFFFFULL;
 	if (sizeof(bus_addr_t) > 4
 	 && ahc_linux_get_memsize() > 0x80000000
@@ -167,7 +176,12 @@
 		ahc->flags |= AHC_39BIT_ADDRESSING;
 		ahc->platform_data->hw_dma_mask = mask_39bit;
 	} else {
-		aic_set_dma_mask(ahc, 0xFFFFFFFF);
+		if (aic_set_dma_mask(ahc, 0xFFFFFFFF) != 0) {
+			printk(KERN_WARNING "aic7xxx: Unable to set data "
+			       "DMA mask.\n");
+			ahc_free(ahc);
+			return (-ENOMEM);
+		}
 		ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;
 	}
 	error = ahc_pci_config(ahc, entry);
@@ -191,13 +205,19 @@
 int
 ahc_linux_pci_init(void)
 {
-	return (pci_module_init(&aic7xxx_pci_driver));
+	int error;
+	
+	error = pci_module_init(&aic7xxx_pci_driver);
+	if (error == 0)
+		ahc_pci_module_registered = 1;
+	return (error);
 }
 
 void
 ahc_linux_pci_exit(void)
 {
-	pci_unregister_driver(&aic7xxx_pci_driver);
+	if (ahc_pci_module_registered != 0)
+		pci_unregister_driver(&aic7xxx_pci_driver);
 }
 
 static int

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aiclib.c#16 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aiclib.c ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aiclib.c renamed from tmp/tmp.27107.14 +5 -0
@@ -1504,6 +1504,8 @@
 	map = malloc(sizeof(*map), M_DEVBUF, M_NOWAIT);
 	if (map == NULL)
 		return (ENOMEM);
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	/*
 	 * Although we can dma data above 4GB, our
 	 * coherent memory is below 4GB for
@@ -1512,8 +1514,11 @@
 	 * our dma mask when doing allocations.
 	 */
 	aic_set_dma_mask(aic, 0xFFFFFFFF);
+#endif
 	*vaddr = aic_alloc_coherent(aic, dmat->maxsize, &map->bus_addr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	aic_set_dma_mask(aic, aic->platform_data->hw_dma_mask);
+#endif
 	if (*vaddr == NULL)
 		return (ENOMEM);
 	*mapp = map;

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aiclib.h#35 - /home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aiclib.h ====

home/luben/projects/linux/2.6/linux-2.5/drivers/scsi/aic7xxx/aiclib.h renamed from tmp/tmp.27107.15 +9 -0
@@ -332,6 +332,8 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 
 #define aic_set_dma_mask(aic, mask) dma_set_mask(aic->dev_softc, mask)
+#define aic_set_consistent_dma_mask(aic, mask) \
+	pci_set_consistent_dma_mask(aic_dev_to_pci_dev(aic->dev_softc), mask)
 
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3)
 
@@ -341,6 +343,9 @@
 #define aic_set_dma_mask(aic, mask) 			\
 	((aic)->dev_softc == NULL ? 0 : pci_set_dma_mask(aic->dev_softc, mask))
 
+/* Always successfull in 2.4.X kernels */
+#define aic_set_consistent_dma_mask(aic, mask) (0)
+
 #else
 /*
  * Device softc is NULL for EISA devices.
@@ -350,6 +355,10 @@
     (((aic)->dev_softc == NULL)				\
      ? 0						\
      : (((aic)->dev_softc->dma_mask = mask) && 0))
+
+/* Always successfull in 2.4.X kernels */
+#define aic_set_consistent_dma_mask(aic, mask) (0)
+
 #endif
 
 /************************* Host Template Macros *******************************/