Commit 2290678f authored by Raghava Aditya Renukunta's avatar Raghava Aditya Renukunta Committed by Martin K. Petersen

scsi: aacraid: Added macros to help loop through known buses and targets

Added macros to loop through the MAX SUPPORTED Buses and Targets. This
will make the code a bit easier to read.
Signed-off-by: default avatarRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f2d2caba
...@@ -117,9 +117,13 @@ enum { ...@@ -117,9 +117,13 @@ enum {
/* Thor: 5 phys. buses: #0: empty, 1-4: 256 targets each */ /* Thor: 5 phys. buses: #0: empty, 1-4: 256 targets each */
#define AAC_MAX_BUSES 5 #define AAC_MAX_BUSES 5
#define AAC_MAX_TARGETS 256 #define AAC_MAX_TARGETS 256
#define AAC_BUS_TARGET_LOOP (AAC_MAX_BUSES * AAC_MAX_TARGETS)
#define AAC_MAX_NATIVE_SIZE 2048 #define AAC_MAX_NATIVE_SIZE 2048
#define FW_ERROR_BUFFER_SIZE 512 #define FW_ERROR_BUFFER_SIZE 512
#define get_bus_number(x) (x/AAC_MAX_TARGETS)
#define get_target_number(x) (x%AAC_MAX_TARGETS)
/* Thor AIF events */ /* Thor AIF events */
#define SA_AIF_HOTPLUG (1<<1) #define SA_AIF_HOTPLUG (1<<1)
#define SA_AIF_HARDWARE (1<<2) #define SA_AIF_HARDWARE (1<<2)
......
...@@ -1890,11 +1890,14 @@ static int aac_is_safw_target_valid(struct aac_dev *dev, int bus, int target) ...@@ -1890,11 +1890,14 @@ static int aac_is_safw_target_valid(struct aac_dev *dev, int bus, int target)
static void aac_resolve_luns(struct aac_dev *dev) static void aac_resolve_luns(struct aac_dev *dev)
{ {
int i;
int bus, target, channel; int bus, target, channel;
struct scsi_device *sdev; struct scsi_device *sdev;
for (bus = 0; bus < AAC_MAX_BUSES; bus++) { for (i = 0; i < AAC_BUS_TARGET_LOOP; i++) {
for (target = 0; target < AAC_MAX_TARGETS; target++) {
bus = get_bus_number(i);
target = get_target_number(i);
if (bus == CONTAINER_CHANNEL) if (bus == CONTAINER_CHANNEL)
channel = CONTAINER_CHANNEL; channel = CONTAINER_CHANNEL;
...@@ -1907,14 +1910,11 @@ static void aac_resolve_luns(struct aac_dev *dev) ...@@ -1907,14 +1910,11 @@ static void aac_resolve_luns(struct aac_dev *dev)
if (!sdev && aac_is_safw_target_valid(dev, bus, target)) if (!sdev && aac_is_safw_target_valid(dev, bus, target))
scsi_add_device(dev->scsi_host_ptr, channel, scsi_add_device(dev->scsi_host_ptr, channel,
target, 0); target, 0);
else if (sdev && aac_is_safw_target_valid(dev, else if (sdev && aac_is_safw_target_valid(dev, bus, target))
bus, target))
scsi_remove_device(sdev); scsi_remove_device(sdev);
if (sdev) if (sdev)
scsi_device_put(sdev); scsi_device_put(sdev);
}
} }
} }
......
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