mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <wtarreau@free.fr>
To: alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org
Subject: [patch] megaraid in 2.2.18 : correctly identify NetRaid cards
Date: Thu, 28 Dec 2000 08:58:52 +0100 (MET)	[thread overview]
Message-ID: <977990332.3a4af2bc18914@imp.free.fr> (raw)

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

--- linux/drivers/scsi/megaraid.h-orig	Wed Dec 27 16:08:26 2000
+++ linux/drivers/scsi/megaraid.h	Wed Dec 27 16:08:00 2000
@@ -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;
 
--- linux/drivers/scsi/megaraid.c-orig	Wed Dec 27 13:22:27 2000
+++ linux/drivers/scsi/megaraid.c	Wed Dec 27 16:02:27 2000
@@ -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 majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

                 reply	other threads:[~2000-12-28  8:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=977990332.3a4af2bc18914@imp.free.fr \
    --to=wtarreau@free.fr \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®