aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic94xx
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2008-02-19 13:50:49 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:15:39 -0400
commit68066c3ed14b529331bc2ff12470e9ca1cae5c3f (patch)
treee7c57b85c65c5945106e9a26f67fb732e2e294f4 /drivers/scsi/aic94xx
parent45e6cdf41437c72ed79cee64dc69e7f740511e50 (diff)
[SCSI] aic94xx: Use sas_request_addr() to provide SAS WWN if the adapter lacks one
If the aic94xx chip doesn't have a SAS address in the chip's flash memory, make libsas get one for us. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/aic94xx')
-rw-r--r--drivers/scsi/aic94xx/aic94xx.h16
-rw-r--r--drivers/scsi/aic94xx/aic94xx_hwi.c20
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c2
3 files changed, 9 insertions, 29 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx.h b/drivers/scsi/aic94xx/aic94xx.h
index eb8efdcefe4..2ef459e9cda 100644
--- a/drivers/scsi/aic94xx/aic94xx.h
+++ b/drivers/scsi/aic94xx/aic94xx.h
@@ -58,7 +58,6 @@
58 58
59extern struct kmem_cache *asd_dma_token_cache; 59extern struct kmem_cache *asd_dma_token_cache;
60extern struct kmem_cache *asd_ascb_cache; 60extern struct kmem_cache *asd_ascb_cache;
61extern char sas_addr_str[2*SAS_ADDR_SIZE + 1];
62 61
63static inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr) 62static inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr)
64{ 63{
@@ -68,21 +67,6 @@ static inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr)
68 *p = '\0'; 67 *p = '\0';
69} 68}
70 69
71static inline void asd_destringify_sas_addr(u8 *sas_addr, const char *p)
72{
73 int i;
74 for (i = 0; i < SAS_ADDR_SIZE; i++) {
75 u8 h, l;
76 if (!*p)
77 break;
78 h = isdigit(*p) ? *p-'0' : *p-'A'+10;
79 p++;
80 l = isdigit(*p) ? *p-'0' : *p-'A'+10;
81 p++;
82 sas_addr[i] = (h<<4) | l;
83 }
84}
85
86struct asd_ha_struct; 70struct asd_ha_struct;
87struct asd_ascb; 71struct asd_ascb;
88 72
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 098b5f39cd3..940a207a42f 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -27,6 +27,7 @@
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/firmware.h>
30 31
31#include "aic94xx.h" 32#include "aic94xx.h"
32#include "aic94xx_reg.h" 33#include "aic94xx_reg.h"
@@ -38,16 +39,14 @@ u32 MBAR0_SWB_SIZE;
38 39
39/* ---------- Initialization ---------- */ 40/* ---------- Initialization ---------- */
40 41
41static void asd_get_user_sas_addr(struct asd_ha_struct *asd_ha) 42static int asd_get_user_sas_addr(struct asd_ha_struct *asd_ha)
42{ 43{
43 extern char sas_addr_str[]; 44 /* adapter came with a sas address */
44 /* If the user has specified a WWN it overrides other settings 45 if (asd_ha->hw_prof.sas_addr[0])
45 */ 46 return 0;
46 if (sas_addr_str[0] != '\0') 47
47 asd_destringify_sas_addr(asd_ha->hw_prof.sas_addr, 48 return sas_request_addr(asd_ha->sas_ha.core.shost,
48 sas_addr_str); 49 asd_ha->hw_prof.sas_addr);
49 else if (asd_ha->hw_prof.sas_addr[0] != 0)
50 asd_stringify_sas_addr(sas_addr_str, asd_ha->hw_prof.sas_addr);
51} 50}
52 51
53static void asd_propagate_sas_addr(struct asd_ha_struct *asd_ha) 52static void asd_propagate_sas_addr(struct asd_ha_struct *asd_ha)
@@ -657,8 +656,7 @@ int asd_init_hw(struct asd_ha_struct *asd_ha)
657 656
658 asd_init_ctxmem(asd_ha); 657 asd_init_ctxmem(asd_ha);
659 658
660 asd_get_user_sas_addr(asd_ha); 659 if (asd_get_user_sas_addr(asd_ha)) {
661 if (!asd_ha->hw_prof.sas_addr[0]) {
662 asd_printk("No SAS Address provided for %s\n", 660 asd_printk("No SAS Address provided for %s\n",
663 pci_name(asd_ha->pcidev)); 661 pci_name(asd_ha->pcidev));
664 err = -ENODEV; 662 err = -ENODEV;
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 88d1e731b65..806fa4d9a64 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -56,8 +56,6 @@ MODULE_PARM_DESC(collector, "\n"
56 "\tThe aic94xx SAS LLDD supports both modes.\n" 56 "\tThe aic94xx SAS LLDD supports both modes.\n"
57 "\tDefault: 0 (Direct Mode).\n"); 57 "\tDefault: 0 (Direct Mode).\n");
58 58
59char sas_addr_str[2*SAS_ADDR_SIZE + 1] = "";
60
61static struct scsi_transport_template *aic94xx_transport_template; 59static struct scsi_transport_template *aic94xx_transport_template;
62static int asd_scan_finished(struct Scsi_Host *, unsigned long); 60static int asd_scan_finished(struct Scsi_Host *, unsigned long);
63static void asd_scan_start(struct Scsi_Host *); 61static void asd_scan_start(struct Scsi_Host *);