Commit 5480aa18 authored by Raghava Aditya Renukunta's avatar Raghava Aditya Renukunta Committed by Martin K. Petersen

scsi: aacraid: Change phy luns function to use common bmic function

Edit function that retrieves phy lun information to use common
bmic function
Signed-off-by: default avatarRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8fb39182
...@@ -1853,66 +1853,37 @@ void aac_update_hba_map(struct aac_dev *dev, ...@@ -1853,66 +1853,37 @@ void aac_update_hba_map(struct aac_dev *dev,
/** /**
* aac_report_phys_luns() Process topology change * aac_report_phys_luns() Process topology change
* @dev: aac_dev structure * @dev: aac_dev structure
* @fibptr: fib pointer * @rescan: Indicates rescan
* *
* Execute a CISS REPORT PHYS LUNS and process the results into * Execute a CISS REPORT PHYS LUNS and process the results into
* the current hba_map. * the current hba_map.
*/ */
int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr, int rescan) int aac_report_phys_luns(struct aac_dev *dev, int rescan)
{ {
int fibsize, datasize; int rcode = -ENOMEM;
struct aac_ciss_phys_luns_resp *phys_luns; int datasize;
struct aac_srb *srbcmd; struct aac_srb *srbcmd;
struct sgmap64 *sg64; struct aac_srb_unit srbu;
dma_addr_t addr; struct aac_ciss_phys_luns_resp *phys_luns;
u32 vbus, vid;
int rcode = 0;
/* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */
fibsize = sizeof(struct aac_srb) - sizeof(struct sgentry)
+ sizeof(struct sgentry64);
datasize = sizeof(struct aac_ciss_phys_luns_resp)
+ (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun);
phys_luns = dma_alloc_coherent(&dev->pdev->dev, datasize, &addr,
GFP_KERNEL);
if (phys_luns == NULL) {
rcode = -ENOMEM;
goto err_out;
}
vbus = (u32) le16_to_cpu(
dev->supplement_adapter_info.virt_device_bus);
vid = (u32) le16_to_cpu(
dev->supplement_adapter_info.virt_device_target);
aac_fib_init(fibptr);
srbcmd = (struct aac_srb *) fib_data(fibptr); datasize = sizeof(struct aac_ciss_phys_luns_resp) +
srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun);
srbcmd->channel = cpu_to_le32(vbus); phys_luns = kmalloc(datasize, GFP_KERNEL);
srbcmd->id = cpu_to_le32(vid); if (phys_luns == NULL)
srbcmd->lun = 0; goto err_out;
srbcmd->flags = cpu_to_le32(SRB_DataIn);
srbcmd->timeout = cpu_to_le32(10);
srbcmd->retry_limit = 0;
srbcmd->cdb_size = cpu_to_le32(12);
srbcmd->count = cpu_to_le32(datasize);
memset(srbcmd->cdb, 0, sizeof(srbcmd->cdb)); memset(&srbu, 0, sizeof(struct aac_srb_unit));
srbcmd->cdb[0] = CISS_REPORT_PHYSICAL_LUNS;
srbcmd->cdb[1] = 2; /* extended reporting */
srbcmd->cdb[8] = (u8)(datasize >> 8);
srbcmd->cdb[9] = (u8)(datasize);
sg64 = (struct sgmap64 *) &srbcmd->sg; srbcmd = &srbu.srb;
sg64->count = cpu_to_le32(1); srbcmd->flags = cpu_to_le32(SRB_DataIn);
sg64->sg[0].addr[1] = cpu_to_le32(upper_32_bits(addr)); srbcmd->cdb[0] = CISS_REPORT_PHYSICAL_LUNS;
sg64->sg[0].addr[0] = cpu_to_le32(lower_32_bits(addr)); srbcmd->cdb[1] = 2; /* extended reporting */
sg64->sg[0].count = cpu_to_le32(datasize); srbcmd->cdb[8] = (u8)(datasize >> 8);
srbcmd->cdb[9] = (u8)(datasize);
rcode = aac_fib_send(ScsiPortCommand64, fibptr, fibsize, rcode = aac_send_safw_bmic_cmd(dev, &srbu, phys_luns, datasize);
FsaNormal, 1, 1, NULL, NULL); if (unlikely(rcode < 0))
goto err_out;
/* analyse data */ /* analyse data */
if (rcode >= 0 && phys_luns->resp_flag == 2) { if (rcode >= 0 && phys_luns->resp_flag == 2) {
...@@ -1920,7 +1891,7 @@ int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr, int rescan) ...@@ -1920,7 +1891,7 @@ int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr, int rescan)
aac_update_hba_map(dev, phys_luns, rescan); aac_update_hba_map(dev, phys_luns, rescan);
} }
dma_free_coherent(&dev->pdev->dev, datasize, phys_luns, addr); kfree(phys_luns);
err_out: err_out:
return rcode; return rcode;
} }
...@@ -2030,7 +2001,7 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -2030,7 +2001,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
if (!dev->sync_mode && dev->sa_firmware && if (!dev->sync_mode && dev->sa_firmware &&
dev->supplement_adapter_info.virt_device_bus != 0xffff) { dev->supplement_adapter_info.virt_device_bus != 0xffff) {
/* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */ /* Thor SA Firmware -> CISS_REPORT_PHYSICAL_LUNS */
rcode = aac_report_phys_luns(dev, fibptr, AAC_INIT); rcode = aac_report_phys_luns(dev, AAC_INIT);
} }
if (!dev->in_reset) { if (!dev->in_reset) {
......
...@@ -2639,7 +2639,7 @@ static inline int aac_adapter_check_health(struct aac_dev *dev) ...@@ -2639,7 +2639,7 @@ static inline int aac_adapter_check_health(struct aac_dev *dev)
int aac_acquire_irq(struct aac_dev *dev); int aac_acquire_irq(struct aac_dev *dev);
void aac_free_irq(struct aac_dev *dev); void aac_free_irq(struct aac_dev *dev);
int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr, int rescan); int aac_report_phys_luns(struct aac_dev *dev, int rescan);
const char *aac_driverinfo(struct Scsi_Host *); const char *aac_driverinfo(struct Scsi_Host *);
void aac_fib_vector_assign(struct aac_dev *dev); void aac_fib_vector_assign(struct aac_dev *dev);
struct fib *aac_fib_alloc(struct aac_dev *dev); struct fib *aac_fib_alloc(struct aac_dev *dev);
......
...@@ -1919,7 +1919,6 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr) ...@@ -1919,7 +1919,6 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)
{ {
int i, bus, target, container, rcode = 0; int i, bus, target, container, rcode = 0;
u32 events = 0; u32 events = 0;
struct fib *fib;
struct scsi_device *sdev; struct scsi_device *sdev;
if (fibptr->hbacmd_size & SA_AIF_HOTPLUG) if (fibptr->hbacmd_size & SA_AIF_HOTPLUG)
...@@ -1942,19 +1941,11 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr) ...@@ -1942,19 +1941,11 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)
case SA_AIF_LDEV_CHANGE: case SA_AIF_LDEV_CHANGE:
case SA_AIF_BPCFG_CHANGE: case SA_AIF_BPCFG_CHANGE:
fib = aac_fib_alloc(dev);
if (!fib) {
pr_err("aac_handle_sa_aif: out of memory\n");
return;
}
for (bus = 0; bus < AAC_MAX_BUSES; bus++) for (bus = 0; bus < AAC_MAX_BUSES; bus++)
for (target = 0; target < AAC_MAX_TARGETS; target++) for (target = 0; target < AAC_MAX_TARGETS; target++)
dev->hba_map[bus][target].new_devtype = 0; dev->hba_map[bus][target].new_devtype = 0;
rcode = aac_report_phys_luns(dev, fib, AAC_RESCAN); rcode = aac_report_phys_luns(dev, AAC_RESCAN);
if (rcode != -ERESTARTSYS)
aac_fib_free(fib);
aac_resolve_luns(dev); aac_resolve_luns(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment