Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89652
b: refs/heads/master
c: 45e6cdf
h: refs/heads/master
v: v3
  • Loading branch information
Darrick J. Wong authored and James Bottomley committed Apr 7, 2008
1 parent 3702fbd commit e547e1d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7e23ea488488400127a2da19c0d89f1723117504
refs/heads/master: 45e6cdf41437c72ed79cee64dc69e7f740511e50
41 changes: 41 additions & 0 deletions trunk/drivers/scsi/libsas/sas_scsi_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/

#include <linux/kthread.h>
#include <linux/firmware.h>
#include <linux/ctype.h>

#include "sas_internal.h"

Expand Down Expand Up @@ -1064,6 +1066,45 @@ void sas_target_destroy(struct scsi_target *starget)
return;
}

static void sas_parse_addr(u8 *sas_addr, const char *p)
{
int i;
for (i = 0; i < SAS_ADDR_SIZE; i++) {
u8 h, l;
if (!*p)
break;
h = isdigit(*p) ? *p-'0' : toupper(*p)-'A'+10;
p++;
l = isdigit(*p) ? *p-'0' : toupper(*p)-'A'+10;
p++;
sas_addr[i] = (h<<4) | l;
}
}

#define SAS_STRING_ADDR_SIZE 16

int sas_request_addr(struct Scsi_Host *shost, u8 *addr)
{
int res;
const struct firmware *fw;

res = request_firmware(&fw, "sas_addr", &shost->shost_gendev);
if (res)
return res;

if (fw->size < SAS_STRING_ADDR_SIZE) {
res = -ENODEV;
goto out;
}

sas_parse_addr(addr, fw->data);

out:
release_firmware(fw);
return res;
}
EXPORT_SYMBOL_GPL(sas_request_addr);

EXPORT_SYMBOL_GPL(sas_queuecommand);
EXPORT_SYMBOL_GPL(sas_target_alloc);
EXPORT_SYMBOL_GPL(sas_slave_configure);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/scsi/libsas.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,4 +677,6 @@ extern void sas_ssp_task_response(struct device *dev, struct sas_task *task,
struct ssp_response_iu *iu);
struct sas_phy *sas_find_local_phy(struct domain_device *dev);

int sas_request_addr(struct Scsi_Host *shost, u8 *addr);

#endif /* _SASLIB_H_ */

0 comments on commit e547e1d

Please sign in to comment.