diff options
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_eeprom.c')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_eeprom.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c index a2f1ceafcca9..3313356ab93a 100644 --- a/drivers/infiniband/hw/ipath/ipath_eeprom.c +++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 QLogic, Inc. All rights reserved. | ||
2 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
3 | * | 4 | * |
4 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
@@ -600,8 +601,31 @@ void ipath_get_eeprom_info(struct ipath_devdata *dd) | |||
600 | guid = *(__be64 *) ifp->if_guid; | 601 | guid = *(__be64 *) ifp->if_guid; |
601 | dd->ipath_guid = guid; | 602 | dd->ipath_guid = guid; |
602 | dd->ipath_nguid = ifp->if_numguid; | 603 | dd->ipath_nguid = ifp->if_numguid; |
603 | memcpy(dd->ipath_serial, ifp->if_serial, | 604 | /* |
604 | sizeof(ifp->if_serial)); | 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 | |||
605 | ipath_cdbg(VERBOSE, "Initted GUID to %llx from eeprom\n", | 629 | ipath_cdbg(VERBOSE, "Initted GUID to %llx from eeprom\n", |
606 | (unsigned long long) be64_to_cpu(dd->ipath_guid)); | 630 | (unsigned long long) be64_to_cpu(dd->ipath_guid)); |
607 | 631 | ||