--- kernel-2.4.7.orig/linux/drivers/scsi/aacraid/linit.c	Tue Aug  7 09:51:36 2001
+++ kernel-2.4.7/linux/drivers/scsi/aacraid/linit.c	Tue Aug  7 21:20:38 2001
@@ -47,9 +47,7 @@
 
 #include "AacGenericTypes.h"
 
-#ifdef MODULE
 #include <linux/module.h>
-#endif
 #include "sd.h"
 #include "linit.h"
 #include "aac_unix_defs.h"
@@ -77,8 +75,25 @@
 aac_options_t g_options = { CMN_ERR_LEVEL, 0 };	// default message_level
 
 char g_DriverName[] = { "aacraid" };
-#define module_options aacraid_options
+
+/*
+	The Loadable Kernel Module Installation Facility may pass us
+	a pointer to a driver specific options string to be parsed, 
+	we assign this to options string. 
+*/
+
 static char * aacraid_options = NULL;
+MODULE_PARM      ( aacraid_options, "s" );
+MODULE_PARM_DESC ( aacraid_options, "message_level:(int)  reverse_scan:1 (default 0)");
+
+
+static unsigned short aacraid_pciid[4] = { 0, 0, 0, 0 };
+MODULE_PARM      ( aacraid_pciid, "4h");
+MODULE_PARM_DESC ( aacraid_pciid, "PCI vendor,device,subsystem vendor,subsystem device, for non-auto-recognized controllers.");
+
+MODULE_AUTHOR ("Adaptec OEM RAID Solutions");
+
+
 
 PCI_MINIPORT_COMMON_EXTENSION *g_CommonExtensionPtrArray[ MAXIMUM_NUM_ADAPTERS ];
 unsigned g_HostAdapterCount = 0;
@@ -208,16 +223,22 @@
 
 		CommPrinting = TRUE;
 
-#ifdef MODULE
 		EXPORT_NO_SYMBOLS;
-#endif
 
 		AAC_AnnounceDriver();
 
 		/* setting up the proc directory structure */
 		HostTemplate->proc_name = "aacraid";
 
-		if( module_options != NULL ) AAC_ParseDriverOptions( module_options );
+		if( aacraid_options != NULL ) AAC_ParseDriverOptions( aacraid_options );
+
+		/* If we were passed a PCI device ID, handle that first. */
+		if ( aacraid_pciid[0] != 0 ) {
+			MiniPorts[0].VendorId    = aacraid_pciid[0];
+			MiniPorts[0].DeviceId    = aacraid_pciid[1];
+			MiniPorts[0].SubVendorId = aacraid_pciid[2];
+			MiniPorts[0].SubSystemId = aacraid_pciid[3];
+		}
 
 		// NumMiniPorts & MiniPorts[] defined in aacid.c
 		if (g_options.reverse_scan == 0) {
@@ -240,6 +261,8 @@
 						MiniPorts[index].SubVendorId,
 						MiniPorts[index].SubSystemId);
 
+				/* If vendor and device ID are 0, this is the unused entry, so skip! */
+				if ( vendor_id == 0 && device_id == 0 ) continue;
 
 				// pci_find_device traverses the pci_devices linked list for devices
 				// with matching vendor and device ids.
@@ -814,9 +837,7 @@
 		return( -ENODEV );
 	}
 
-#ifdef MODULE
 	MOD_INC_USE_COUNT;
-#endif
 
 	return( 0 );
 }
@@ -838,9 +859,7 @@
 {
 	cmn_err( CE_DEBUG, "AAC_ChardevRelease" );
 
-#ifdef MODULE
 	MOD_DEC_USE_COUNT;
-#endif
 
 	return( 0 );
 }
@@ -977,31 +996,15 @@
 
 
 /*------------------------------------------------------------------------------
-	Include Module support if requested.
-
 	To use the low level SCSI driver support using the linux kernel loadable 
 	module interface we should initialize the global variable driver_interface  
 	(datatype Scsi_Host_Template) and then include the file scsi_module.c.
-	This should also be wrapped in a #ifdef MODULE/#endif
  *----------------------------------------------------------------------------*/
-#ifdef MODULE
-
-/*
-	The Loadable Kernel Module Installation Facility may pass us
-	a pointer to a driver specific options string to be parsed, 
-	we assign this to options string. 
-*/
-MODULE_PARM( module_options, "s" );
 
 Scsi_Host_Template driver_template = AAC_HOST_TEMPLATE_ENTRY;
 
 #include "scsi_module.c"
 
-#else
-Scsi_Host_Template driver_template = AAC_HOST_TEMPLATE_ENTRY;
-
-#include "scsi_module.c"
-#endif
 
 /*********************************************************************
 	AAC_ProcDirectoryInfo()
--- kernel-2.4.7.orig/linux/drivers/scsi/aacraid/aacid.c	Tue Aug  7 09:51:36 2001
+++ kernel-2.4.7/linux/drivers/scsi/aacraid/aacid.c	Wed Aug  8 09:45:28 2001
@@ -134,14 +134,15 @@
  */
 
 FSA_MINIPORT MiniPorts[] = {
-	{ 0x1028, 0x0001, 0x1028, 0x0001, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* PERC 3/Si */
+	{ 0x0000, 0x0000, 0x0000, 0x0000, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* Dell unknown - uses aacraid_pciid */
+	{ 0x1028, 0x0001, 0x1028, 0x0001, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* PERC 2/Si */
 	{ 0x1028, 0x0002, 0x1028, 0x0002, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* PERC 3/Di */
 	{ 0x1028, 0x0003, 0x1028, 0x0003, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* PERC 3/Si */
 	{ 0x1028, 0x0004, 0x1028, 0x00d0, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* PERC 3/Si */
 	{ 0x1028, 0x0002, 0x1028, 0x00d1, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* PERC 3/Di */
 	{ 0x1028, 0x0002, 0x1028, 0x00d9, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* PERC 3/Di */
 	{ 0x1028, 0x000a, 0x1028, 0x0106, "afa", RxInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* PERC 3/Di */
-	{ 0x1011, 0x0046, 0x9005, 0x1364, "afa", SaInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* Dell PERC2 "Quad Channel */
+	{ 0x1011, 0x0046, 0x9005, 0x1364, "afa", SaInitDevice, "percraid", "DELL    ", "PERCRAID        " }, /* Dell PERC2 "Quad Channel" */
 	{ 0x1011, 0x0046, 0x103c, 0x10c2, "hpn", SaInitDevice, "hpnraid",  "HP      ", "NetRAID-4M      " }  /* HP NetRAID-4M */
 };
 
