The correct serial number presentation should be the same
as the one on the sticker of the HBA card.

The PCIe Device Serial Number Capability Structure contains

      +-------------------------------------+
      | PCIe Enhanced Capability Header     | 0x00
      +-------------------------------------+
31:0  | Serial Number Register (Lower Dword)| 0x04
      +-------------------------------------+
63:32 | Serial Number Register (Upper Dword)| 0x08
      +-------------------------------------+

The Serial Number register shown above is a 64-bit field
that contains the IEEE defined 64-bit Extended Unique
Identifier (EUI-64):

+-----+-------------------------+
|Byte |                         |
|Order|       Description       |
+-----+-------------------------+ low
|  0  | Company ID              |
|  1  |                         |
|  2  |                         |
+-----+-------------------------+
|  3  | MAC Label (0xFFFF)      |
|  4  |                         |
+-----+-------------------------+
|  5  | Extension Identifier    |
|  6  |                         |
|  7  |                         |
+-----+-------------------------+ high

The 48-bit serial number shown on the HBA card is constructed from

         47                  24 23                   0
        +----------------------+----------------------+
   high | Extension Identifier |     Company ID       | low
        +----------------------+----------------------+

Signed-off-by: Steve Ma <[email protected]>
---

 pci.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/pci.c b/pci.c
index e559ae8..4f01995 100644
--- a/pci.c
+++ b/pci.c
@@ -138,11 +138,13 @@ get_device_serial_number(struct pci_device *dev, struct 
hba_info *hba_info)
                                                     &dword_high, offset + 8);
                        snprintf(hba_info->SerialNumber,
                                 sizeof(hba_info->SerialNumber),
-                               "%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x\n",
-                               dword_low & 0xff, (dword_low >> 8) & 0xff,
-                               (dword_low >> 16) & 0xff, dword_low >> 24,
-                               dword_high & 0xff, (dword_high >> 8) & 0xff,
-                               (dword_high >> 16) & 0xff, dword_high >> 24);
+                               "%02X%02X%02X%02X%02X%02X\n",
+                               dword_high >> 24,
+                               (dword_high >> 16) & 0xff,
+                               (dword_high >> 8) & 0xff,
+                               (dword_low >> 16) & 0xff,
+                               (dword_low >> 8) & 0xff,
+                               dword_low & 0xff);
                        break;
                } while (offset);
                break;

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to