]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Work around aacraid FW problem
authorMark Haverkamp <markh@osdl.org>
Thu, 23 Oct 2003 04:27:44 +0000 (23:27 -0500)
committerJames Bottomley <jejb@raven.il.steeleye.com>
Thu, 23 Oct 2003 04:27:44 +0000 (23:27 -0500)
If you have a 4gig or greater system, some versions of aacraid firmware
have problems if you set HostPhysMemPages >= 0x100000.  This can
potentially cause data corruption.  If you have 4gig or greater memory,
this patch sets the HostPhysMemPages to something that the firmware can
deal with.

drivers/scsi/aacraid/aacraid.h
drivers/scsi/aacraid/comminit.c

index 24cb71bf0512212da1d64c1e14b541dd5cbf8577..b6da218464a0ab7ef7a26532afcbb14660e4e4a7 100644 (file)
@@ -14,6 +14,8 @@
 #define AAC_MAX_TARGET (MAXIMUM_NUM_CONTAINERS+1)
 #define AAC_MAX_LUN    (8)
 
+#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
+
 /*
  * These macros convert from physical channels to virtual channels
  */
index 3509d8768313e12654555942c5900f178b1ed44e..87671a1055ef93d339b52c095b908d092ef55532 100644 (file)
@@ -92,7 +92,21 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co
        init->AdapterFibsPhysicalAddress = cpu_to_le32((u32)phys);
        init->AdapterFibsSize = cpu_to_le32(fibsize);
        init->AdapterFibAlign = cpu_to_le32(sizeof(struct hw_fib));
-       init->HostPhysMemPages = cpu_to_le32(num_physpages);            // number of 4k pages of host physical memory
+       /* 
+        * number of 4k pages of host physical memory. The aacraid fw needs
+        * this number to be less than 4gb worth of pages. num_physpages is in
+        * system page units. New firmware doesn't have any issues with the
+        * mapping system, but older Firmware did, and had *troubles* dealing
+        * with the math overloading past 32 bits, thus we must limit this
+        * field.
+        */
+       if ((num_physpages << (PAGE_SHIFT - 12)) <= AAC_MAX_HOSTPHYSMEMPAGES) {
+               init->HostPhysMemPages = 
+                       cpu_to_le32(num_physpages << (PAGE_SHIFT-12));
+       } else {
+               init->HostPhysMemPages = cpu_to_le32(AAC_MAX_HOSTPHYSMEMPAGES);
+       }
+
 
        /*
         * Increment the base address by the amount already used