Skip to contentSkip to conversation

megaraid in 2.2.18 : correctly identify NetRaid cards

PATCH New Willy Tarreau 1 participant 1 message Dec 28, 2000

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megaraid in 2.2.18 : correctly identify NetRaid cards

Hello Alan,

As previously discussed, I've slighlty arranged the version identification code in the 2.2.18 megaraid driver so that it correcly sees bios and firmware versions on a netraid. Without the patch, I only get smileys and hieroglyphs because the version is interpreted as a string which it is not, on the netraid.

On the netraid I have here, the fourth byte in the version is always 0x20, which I used to identify the version coding because on a megaraid, I have a number here instead. I'd like people who also have a netraid to test if this is enough to catch their bios and firmware releases too.

Here comes the small patch. Please note that I extended the version length to 8 bytes to conform to the syntax the bios uses : letter.2digits.2digits The old undefined code under #ifdef HP has been removed since it was buggy anyway (char >> 8 always gives 0 ...)

Regards,
Willy

drivers/scsi/megaraid.h renamed from drivers/scsi/megaraid.h-orig +2 -2
@@ -639,8 +639,8 @@
     u32 nWriteBlocks[FC_MAX_LOGICAL_DRIVES];
     u32 nInterrupts;
     /* Host adapter parameters */
-    u8 fwVer[7];
-    u8 biosVer[7];
+    u8 fwVer[8];
+    u8 biosVer[8];
 
     struct Scsi_Host *host;
 
drivers/scsi/megaraid.c renamed from drivers/scsi/megaraid.c-orig +18 -20
@@ -1767,27 +1767,25 @@
   if (megaCfg->host->can_queue >= MAX_COMMANDS) {
     megaCfg->host->can_queue = MAX_COMMANDS-1;
   }
+  if ((megaCfg->productInfo.FwVer[3] == 0x20) &&
+      (megaCfg->productInfo.BiosVer[3] == 0x20)) {
+	/* use HP firmware and bios version encoding */
+	  sprintf (megaCfg->fwVer, "%c.%02x.%02x",
+		   megaCfg->productInfo.FwVer[2],
+		   megaCfg->productInfo.FwVer[1],
+		   megaCfg->productInfo.FwVer[0]);
+	  sprintf (megaCfg->biosVer, "%c.%02x.%02x",
+		   megaCfg->productInfo.BiosVer[2],
+		   megaCfg->productInfo.BiosVer[1],
+		   megaCfg->productInfo.BiosVer[0]);
+  }
+  else {
+	  memcpy (megaCfg->fwVer, (char *)megaCfg->productInfo.FwVer, 4);
+	  megaCfg->fwVer[4] = 0;
 
-#ifdef HP			/* use HP firmware and bios version encoding */
-  sprintf (megaCfg->fwVer, "%c%d%d.%d%d",
-	   megaCfg->productInfo.FwVer[2],
-	   megaCfg->productInfo.FwVer[1] >> 8,
-	   megaCfg->productInfo.FwVer[1] & 0x0f,
-	   megaCfg->productInfo.FwVer[2] >> 8,
-	   megaCfg->productInfo.FwVer[2] & 0x0f);
-  sprintf (megaCfg->biosVer, "%c%d%d.%d%d",
-	   megaCfg->productInfo.BiosVer[2],
-	   megaCfg->productInfo.BiosVer[1] >> 8,
-	   megaCfg->productInfo.BiosVer[1] & 0x0f,
-	   megaCfg->productInfo.BiosVer[2] >> 8,
-	   megaCfg->productInfo.BiosVer[2] & 0x0f);
-#else
-  memcpy (megaCfg->fwVer, (char *)megaCfg->productInfo.FwVer, 4);
-  megaCfg->fwVer[4] = 0;
-
-  memcpy (megaCfg->biosVer, (char *)megaCfg->productInfo.BiosVer, 4);
-  megaCfg->biosVer[4] = 0;
-#endif
+	  memcpy (megaCfg->biosVer, (char *)megaCfg->productInfo.BiosVer, 4);
+	  megaCfg->biosVer[4] = 0;
+  }
 
   printk ("megaraid: [%s:%s] detected %d logical drives" CRLFSTR,
           megaCfg->fwVer,

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/