Commit 8307c28eecea917c4754075fbb85eb398a3bc516

Authored by Bryan O'Sullivan
Committed by Linus Torvalds
1 parent 46bbeac922

[PATCH] IB/ipath: support more models of InfiniPath hardware

We do a few more explicit checks for specific models, and now also support the
old PathScale serial number style, or new QLogic style.

This is backwards compatible with previous versions of software and hardware.
That is, older software will see a plausible serial number and correct GUID
when used with a new board, while newer software will correctly handle an
older board.

Signed-off-by: Mike Albaugh <mike.albaugh@qlogic.com>
Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 4 changed files with 38 additions and 10 deletions Side-by-side Diff

drivers/infiniband/hw/ipath/ipath_common.h
... ... @@ -476,7 +476,7 @@
476 476 * Data layout in I2C flash (for GUID, etc.)
477 477 * All fields are little-endian binary unless otherwise stated
478 478 */
479   -#define IPATH_FLASH_VERSION 1
  479 +#define IPATH_FLASH_VERSION 2
480 480 struct ipath_flash {
481 481 /* flash layout version (IPATH_FLASH_VERSION) */
482 482 __u8 if_fversion;
483 483  
... ... @@ -484,14 +484,14 @@
484 484 __u8 if_csum;
485 485 /*
486 486 * valid length (in use, protected by if_csum), including
487   - * if_fversion and if_sum themselves)
  487 + * if_fversion and if_csum themselves)
488 488 */
489 489 __u8 if_length;
490 490 /* the GUID, in network order */
491 491 __u8 if_guid[8];
492 492 /* number of GUIDs to use, starting from if_guid */
493 493 __u8 if_numguid;
494   - /* the board serial number, in ASCII */
  494 + /* the (last 10 characters of) board serial number, in ASCII */
495 495 char if_serial[12];
496 496 /* board mfg date (YYYYMMDD ASCII) */
497 497 char if_mfgdate[8];
... ... @@ -503,8 +503,10 @@
503 503 __u8 if_powerhour[2];
504 504 /* ASCII free-form comment field */
505 505 char if_comment[32];
506   - /* 78 bytes used, min flash size is 128 bytes */
507   - __u8 if_future[50];
  506 + /* Backwards compatible prefix for longer QLogic Serial Numbers */
  507 + char if_sprefix[4];
  508 + /* 82 bytes used, min flash size is 128 bytes */
  509 + __u8 if_future[46];
508 510 };
509 511  
510 512 /*
drivers/infiniband/hw/ipath/ipath_eeprom.c
... ... @@ -601,8 +601,31 @@
601 601 guid = *(__be64 *) ifp->if_guid;
602 602 dd->ipath_guid = guid;
603 603 dd->ipath_nguid = ifp->if_numguid;
604   - memcpy(dd->ipath_serial, ifp->if_serial,
605   - sizeof(ifp->if_serial));
  604 + /*
  605 + * Things are slightly complicated by the desire to transparently
  606 + * support both the Pathscale 10-digit serial number and the QLogic
  607 + * 13-character version.
  608 + */
  609 + if ((ifp->if_fversion > 1) && ifp->if_sprefix[0]
  610 + && ((u8 *)ifp->if_sprefix)[0] != 0xFF) {
  611 + /* This board has a Serial-prefix, which is stored
  612 + * elsewhere for backward-compatibility.
  613 + */
  614 + char *snp = dd->ipath_serial;
  615 + int len;
  616 + memcpy(snp, ifp->if_sprefix, sizeof ifp->if_sprefix);
  617 + snp[sizeof ifp->if_sprefix] = '\0';
  618 + len = strlen(snp);
  619 + snp += len;
  620 + len = (sizeof dd->ipath_serial) - len;
  621 + if (len > sizeof ifp->if_serial) {
  622 + len = sizeof ifp->if_serial;
  623 + }
  624 + memcpy(snp, ifp->if_serial, len);
  625 + } else
  626 + memcpy(dd->ipath_serial, ifp->if_serial,
  627 + sizeof ifp->if_serial);
  628 +
606 629 ipath_cdbg(VERBOSE, "Initted GUID to %llx from eeprom\n",
607 630 (unsigned long long) be64_to_cpu(dd->ipath_guid));
608 631  
drivers/infiniband/hw/ipath/ipath_kernel.h
... ... @@ -491,8 +491,11 @@
491 491 u16 ipath_lid;
492 492 /* list of pkeys programmed; 0 if not set */
493 493 u16 ipath_pkeys[4];
494   - /* ASCII serial number, from flash */
495   - u8 ipath_serial[12];
  494 + /*
  495 + * ASCII serial number, from flash, large enough for original
  496 + * all digit strings, and longer QLogic serial number format
  497 + */
  498 + u8 ipath_serial[16];
496 499 /* human readable board version */
497 500 u8 ipath_boardversion[80];
498 501 /* chip major rev, from ipath_revision */
drivers/infiniband/hw/ipath/ipath_pe800.c
... ... @@ -533,7 +533,7 @@
533 533 if (n)
534 534 snprintf(name, namelen, "%s", n);
535 535  
536   - if (dd->ipath_majrev != 4 || dd->ipath_minrev != 1) {
  536 + if (dd->ipath_majrev != 4 || !dd->ipath_minrev || dd->ipath_minrev>2) {
537 537 ipath_dev_err(dd, "Unsupported PE-800 revision %u.%u!\n",
538 538 dd->ipath_majrev, dd->ipath_minrev);
539 539 ret = 1;