diff options
author | Sakthivel K <Sakthivel.SaravananKamalRaju@pmcs.com> | 2013-02-27 09:55:25 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-05-10 10:47:46 -0400 |
commit | e590adfd2b35aecb3ea5e7cf3fe4e322b75f348d (patch) | |
tree | 1405a81c1ad2d67c5d458ded80620bc0cc3e0f5c /drivers/scsi | |
parent | e574210170c4a9a1bf1d3afd158d06edd3a840de (diff) |
[SCSI] pm80xx: Multiple inbound/outbound queue configuration
Memory allocation and configuration of multiple inbound and
outbound queues.
Signed-off-by: Sakthivel K <Sakthivel.SaravananKamalRaju@pmcs.com>
Signed-off-by: Anand Kumar S <AnandKumar.Santhanam@pmcs.com>
Acked-by: Jack Wang <jack_wang@usish.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_defs.h | 14 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm8001_hwi.c | 43 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm8001_init.c | 101 |
3 files changed, 98 insertions, 60 deletions
diff --git a/drivers/scsi/pm8001/pm8001_defs.h b/drivers/scsi/pm8001/pm8001_defs.h index b25f87c8f469..26a2ee6f7a6d 100644 --- a/drivers/scsi/pm8001/pm8001_defs.h +++ b/drivers/scsi/pm8001/pm8001_defs.h | |||
@@ -48,8 +48,7 @@ enum chip_flavors { | |||
48 | chip_8018, | 48 | chip_8018, |
49 | chip_8019 | 49 | chip_8019 |
50 | }; | 50 | }; |
51 | #define USI_MAX_MEMCNT 9 | 51 | |
52 | #define PM8001_MAX_DMA_SG SG_ALL | ||
53 | enum phy_speed { | 52 | enum phy_speed { |
54 | PHY_SPEED_15 = 0x01, | 53 | PHY_SPEED_15 = 0x01, |
55 | PHY_SPEED_30 = 0x02, | 54 | PHY_SPEED_30 = 0x02, |
@@ -87,13 +86,16 @@ enum port_type { | |||
87 | #define PM8001_MAX_DEVICES 2048 /* max supported device */ | 86 | #define PM8001_MAX_DEVICES 2048 /* max supported device */ |
88 | #define PM8001_MAX_MSIX_VEC 64 /* max msi-x int for spcv/ve */ | 87 | #define PM8001_MAX_MSIX_VEC 64 /* max msi-x int for spcv/ve */ |
89 | 88 | ||
89 | #define USI_MAX_MEMCNT_BASE 4 | ||
90 | #define IB (USI_MAX_MEMCNT_BASE + 1) | ||
91 | #define CI (IB + PM8001_MAX_SPCV_INB_NUM) | ||
92 | #define OB (CI + PM8001_MAX_SPCV_INB_NUM) | ||
93 | #define PI (OB + PM8001_MAX_SPCV_OUTB_NUM) | ||
94 | #define USI_MAX_MEMCNT (PI + PM8001_MAX_SPCV_OUTB_NUM) | ||
95 | #define PM8001_MAX_DMA_SG SG_ALL | ||
90 | enum memory_region_num { | 96 | enum memory_region_num { |
91 | AAP1 = 0x0, /* application acceleration processor */ | 97 | AAP1 = 0x0, /* application acceleration processor */ |
92 | IOP, /* IO processor */ | 98 | IOP, /* IO processor */ |
93 | CI, /* consumer index */ | ||
94 | PI, /* producer index */ | ||
95 | IB, /* inbound queue */ | ||
96 | OB, /* outbound queue */ | ||
97 | NVMD, /* NVM device */ | 99 | NVMD, /* NVM device */ |
98 | DEV_MEM, /* memory for devices */ | 100 | DEV_MEM, /* memory for devices */ |
99 | CCB_MEM, /* memory for command control block */ | 101 | CCB_MEM, /* memory for command control block */ |
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 9846ee648384..83f9ff46c123 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
@@ -151,10 +151,9 @@ static void read_general_status_table(struct pm8001_hba_info *pm8001_ha) | |||
151 | */ | 151 | */ |
152 | static void read_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha) | 152 | static void read_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha) |
153 | { | 153 | { |
154 | int inbQ_num = 1; | ||
155 | int i; | 154 | int i; |
156 | void __iomem *address = pm8001_ha->inbnd_q_tbl_addr; | 155 | void __iomem *address = pm8001_ha->inbnd_q_tbl_addr; |
157 | for (i = 0; i < inbQ_num; i++) { | 156 | for (i = 0; i < PM8001_MAX_INB_NUM; i++) { |
158 | u32 offset = i * 0x20; | 157 | u32 offset = i * 0x20; |
159 | pm8001_ha->inbnd_q_tbl[i].pi_pci_bar = | 158 | pm8001_ha->inbnd_q_tbl[i].pi_pci_bar = |
160 | get_pci_bar_index(pm8001_mr32(address, (offset + 0x14))); | 159 | get_pci_bar_index(pm8001_mr32(address, (offset + 0x14))); |
@@ -169,10 +168,9 @@ static void read_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha) | |||
169 | */ | 168 | */ |
170 | static void read_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha) | 169 | static void read_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha) |
171 | { | 170 | { |
172 | int outbQ_num = 1; | ||
173 | int i; | 171 | int i; |
174 | void __iomem *address = pm8001_ha->outbnd_q_tbl_addr; | 172 | void __iomem *address = pm8001_ha->outbnd_q_tbl_addr; |
175 | for (i = 0; i < outbQ_num; i++) { | 173 | for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) { |
176 | u32 offset = i * 0x24; | 174 | u32 offset = i * 0x24; |
177 | pm8001_ha->outbnd_q_tbl[i].ci_pci_bar = | 175 | pm8001_ha->outbnd_q_tbl[i].ci_pci_bar = |
178 | get_pci_bar_index(pm8001_mr32(address, (offset + 0x14))); | 176 | get_pci_bar_index(pm8001_mr32(address, (offset + 0x14))); |
@@ -225,19 +223,19 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha) | |||
225 | pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt = | 223 | pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt = |
226 | PM8001_MPI_QUEUE | (64 << 16) | (0x00<<30); | 224 | PM8001_MPI_QUEUE | (64 << 16) | (0x00<<30); |
227 | pm8001_ha->inbnd_q_tbl[i].upper_base_addr = | 225 | pm8001_ha->inbnd_q_tbl[i].upper_base_addr = |
228 | pm8001_ha->memoryMap.region[IB].phys_addr_hi; | 226 | pm8001_ha->memoryMap.region[IB + i].phys_addr_hi; |
229 | pm8001_ha->inbnd_q_tbl[i].lower_base_addr = | 227 | pm8001_ha->inbnd_q_tbl[i].lower_base_addr = |
230 | pm8001_ha->memoryMap.region[IB].phys_addr_lo; | 228 | pm8001_ha->memoryMap.region[IB + i].phys_addr_lo; |
231 | pm8001_ha->inbnd_q_tbl[i].base_virt = | 229 | pm8001_ha->inbnd_q_tbl[i].base_virt = |
232 | (u8 *)pm8001_ha->memoryMap.region[IB].virt_ptr; | 230 | (u8 *)pm8001_ha->memoryMap.region[IB + i].virt_ptr; |
233 | pm8001_ha->inbnd_q_tbl[i].total_length = | 231 | pm8001_ha->inbnd_q_tbl[i].total_length = |
234 | pm8001_ha->memoryMap.region[IB].total_len; | 232 | pm8001_ha->memoryMap.region[IB + i].total_len; |
235 | pm8001_ha->inbnd_q_tbl[i].ci_upper_base_addr = | 233 | pm8001_ha->inbnd_q_tbl[i].ci_upper_base_addr = |
236 | pm8001_ha->memoryMap.region[CI].phys_addr_hi; | 234 | pm8001_ha->memoryMap.region[CI + i].phys_addr_hi; |
237 | pm8001_ha->inbnd_q_tbl[i].ci_lower_base_addr = | 235 | pm8001_ha->inbnd_q_tbl[i].ci_lower_base_addr = |
238 | pm8001_ha->memoryMap.region[CI].phys_addr_lo; | 236 | pm8001_ha->memoryMap.region[CI + i].phys_addr_lo; |
239 | pm8001_ha->inbnd_q_tbl[i].ci_virt = | 237 | pm8001_ha->inbnd_q_tbl[i].ci_virt = |
240 | pm8001_ha->memoryMap.region[CI].virt_ptr; | 238 | pm8001_ha->memoryMap.region[CI + i].virt_ptr; |
241 | offsetib = i * 0x20; | 239 | offsetib = i * 0x20; |
242 | pm8001_ha->inbnd_q_tbl[i].pi_pci_bar = | 240 | pm8001_ha->inbnd_q_tbl[i].pi_pci_bar = |
243 | get_pci_bar_index(pm8001_mr32(addressib, | 241 | get_pci_bar_index(pm8001_mr32(addressib, |
@@ -251,21 +249,21 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha) | |||
251 | pm8001_ha->outbnd_q_tbl[i].element_size_cnt = | 249 | pm8001_ha->outbnd_q_tbl[i].element_size_cnt = |
252 | PM8001_MPI_QUEUE | (64 << 16) | (0x01<<30); | 250 | PM8001_MPI_QUEUE | (64 << 16) | (0x01<<30); |
253 | pm8001_ha->outbnd_q_tbl[i].upper_base_addr = | 251 | pm8001_ha->outbnd_q_tbl[i].upper_base_addr = |
254 | pm8001_ha->memoryMap.region[OB].phys_addr_hi; | 252 | pm8001_ha->memoryMap.region[OB + i].phys_addr_hi; |
255 | pm8001_ha->outbnd_q_tbl[i].lower_base_addr = | 253 | pm8001_ha->outbnd_q_tbl[i].lower_base_addr = |
256 | pm8001_ha->memoryMap.region[OB].phys_addr_lo; | 254 | pm8001_ha->memoryMap.region[OB + i].phys_addr_lo; |
257 | pm8001_ha->outbnd_q_tbl[i].base_virt = | 255 | pm8001_ha->outbnd_q_tbl[i].base_virt = |
258 | (u8 *)pm8001_ha->memoryMap.region[OB].virt_ptr; | 256 | (u8 *)pm8001_ha->memoryMap.region[OB + i].virt_ptr; |
259 | pm8001_ha->outbnd_q_tbl[i].total_length = | 257 | pm8001_ha->outbnd_q_tbl[i].total_length = |
260 | pm8001_ha->memoryMap.region[OB].total_len; | 258 | pm8001_ha->memoryMap.region[OB + i].total_len; |
261 | pm8001_ha->outbnd_q_tbl[i].pi_upper_base_addr = | 259 | pm8001_ha->outbnd_q_tbl[i].pi_upper_base_addr = |
262 | pm8001_ha->memoryMap.region[PI].phys_addr_hi; | 260 | pm8001_ha->memoryMap.region[PI + i].phys_addr_hi; |
263 | pm8001_ha->outbnd_q_tbl[i].pi_lower_base_addr = | 261 | pm8001_ha->outbnd_q_tbl[i].pi_lower_base_addr = |
264 | pm8001_ha->memoryMap.region[PI].phys_addr_lo; | 262 | pm8001_ha->memoryMap.region[PI + i].phys_addr_lo; |
265 | pm8001_ha->outbnd_q_tbl[i].interrup_vec_cnt_delay = | 263 | pm8001_ha->outbnd_q_tbl[i].interrup_vec_cnt_delay = |
266 | 0 | (10 << 16) | (0 << 24); | 264 | 0 | (10 << 16) | (i << 24); |
267 | pm8001_ha->outbnd_q_tbl[i].pi_virt = | 265 | pm8001_ha->outbnd_q_tbl[i].pi_virt = |
268 | pm8001_ha->memoryMap.region[PI].virt_ptr; | 266 | pm8001_ha->memoryMap.region[PI + i].virt_ptr; |
269 | offsetob = i * 0x24; | 267 | offsetob = i * 0x24; |
270 | pm8001_ha->outbnd_q_tbl[i].ci_pci_bar = | 268 | pm8001_ha->outbnd_q_tbl[i].ci_pci_bar = |
271 | get_pci_bar_index(pm8001_mr32(addressob, | 269 | get_pci_bar_index(pm8001_mr32(addressob, |
@@ -641,6 +639,7 @@ static void init_pci_device_addresses(struct pm8001_hba_info *pm8001_ha) | |||
641 | */ | 639 | */ |
642 | static int pm8001_chip_init(struct pm8001_hba_info *pm8001_ha) | 640 | static int pm8001_chip_init(struct pm8001_hba_info *pm8001_ha) |
643 | { | 641 | { |
642 | u8 i = 0; | ||
644 | /* check the firmware status */ | 643 | /* check the firmware status */ |
645 | if (-1 == check_fw_ready(pm8001_ha)) { | 644 | if (-1 == check_fw_ready(pm8001_ha)) { |
646 | PM8001_FAIL_DBG(pm8001_ha, | 645 | PM8001_FAIL_DBG(pm8001_ha, |
@@ -657,8 +656,10 @@ static int pm8001_chip_init(struct pm8001_hba_info *pm8001_ha) | |||
657 | read_outbnd_queue_table(pm8001_ha); | 656 | read_outbnd_queue_table(pm8001_ha); |
658 | /* update main config table ,inbound table and outbound table */ | 657 | /* update main config table ,inbound table and outbound table */ |
659 | update_main_config_table(pm8001_ha); | 658 | update_main_config_table(pm8001_ha); |
660 | update_inbnd_queue_table(pm8001_ha, 0); | 659 | for (i = 0; i < PM8001_MAX_INB_NUM; i++) |
661 | update_outbnd_queue_table(pm8001_ha, 0); | 660 | update_inbnd_queue_table(pm8001_ha, i); |
661 | for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) | ||
662 | update_outbnd_queue_table(pm8001_ha, i); | ||
662 | mpi_set_phys_g3_with_ssc(pm8001_ha, 0); | 663 | mpi_set_phys_g3_with_ssc(pm8001_ha, 0); |
663 | /* 7->130ms, 34->500ms, 119->1.5s */ | 664 | /* 7->130ms, 34->500ms, 119->1.5s */ |
664 | mpi_set_open_retry_interval_reg(pm8001_ha, 119); | 665 | mpi_set_open_retry_interval_reg(pm8001_ha, 119); |
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index f3234b2a0d79..98686b982302 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c | |||
@@ -199,10 +199,14 @@ static irqreturn_t pm8001_interrupt(int irq, void *opaque) | |||
199 | * @pm8001_ha:our hba structure. | 199 | * @pm8001_ha:our hba structure. |
200 | * | 200 | * |
201 | */ | 201 | */ |
202 | static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha) | 202 | static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, |
203 | const struct pci_device_id *ent) | ||
203 | { | 204 | { |
204 | int i; | 205 | int i; |
205 | spin_lock_init(&pm8001_ha->lock); | 206 | spin_lock_init(&pm8001_ha->lock); |
207 | PM8001_INIT_DBG(pm8001_ha, | ||
208 | pm8001_printk("pm8001_alloc: PHY:%x\n", | ||
209 | pm8001_ha->chip->n_phy)); | ||
206 | for (i = 0; i < pm8001_ha->chip->n_phy; i++) { | 210 | for (i = 0; i < pm8001_ha->chip->n_phy; i++) { |
207 | pm8001_phy_init(pm8001_ha, i); | 211 | pm8001_phy_init(pm8001_ha, i); |
208 | pm8001_ha->port[i].wide_port_phymap = 0; | 212 | pm8001_ha->port[i].wide_port_phymap = 0; |
@@ -226,30 +230,57 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha) | |||
226 | pm8001_ha->memoryMap.region[IOP].total_len = PM8001_EVENT_LOG_SIZE; | 230 | pm8001_ha->memoryMap.region[IOP].total_len = PM8001_EVENT_LOG_SIZE; |
227 | pm8001_ha->memoryMap.region[IOP].alignment = 32; | 231 | pm8001_ha->memoryMap.region[IOP].alignment = 32; |
228 | 232 | ||
229 | /* MPI Memory region 3 for consumer Index of inbound queues */ | 233 | for (i = 0; i < PM8001_MAX_SPCV_INB_NUM; i++) { |
230 | pm8001_ha->memoryMap.region[CI].num_elements = 1; | 234 | /* MPI Memory region 3 for consumer Index of inbound queues */ |
231 | pm8001_ha->memoryMap.region[CI].element_size = 4; | 235 | pm8001_ha->memoryMap.region[CI+i].num_elements = 1; |
232 | pm8001_ha->memoryMap.region[CI].total_len = 4; | 236 | pm8001_ha->memoryMap.region[CI+i].element_size = 4; |
233 | pm8001_ha->memoryMap.region[CI].alignment = 4; | 237 | pm8001_ha->memoryMap.region[CI+i].total_len = 4; |
234 | 238 | pm8001_ha->memoryMap.region[CI+i].alignment = 4; | |
235 | /* MPI Memory region 4 for producer Index of outbound queues */ | 239 | |
236 | pm8001_ha->memoryMap.region[PI].num_elements = 1; | 240 | if ((ent->driver_data) != chip_8001) { |
237 | pm8001_ha->memoryMap.region[PI].element_size = 4; | 241 | /* MPI Memory region 5 inbound queues */ |
238 | pm8001_ha->memoryMap.region[PI].total_len = 4; | 242 | pm8001_ha->memoryMap.region[IB+i].num_elements = |
239 | pm8001_ha->memoryMap.region[PI].alignment = 4; | 243 | PM8001_MPI_QUEUE; |
240 | 244 | pm8001_ha->memoryMap.region[IB+i].element_size = 128; | |
241 | /* MPI Memory region 5 inbound queues */ | 245 | pm8001_ha->memoryMap.region[IB+i].total_len = |
242 | pm8001_ha->memoryMap.region[IB].num_elements = PM8001_MPI_QUEUE; | 246 | PM8001_MPI_QUEUE * 128; |
243 | pm8001_ha->memoryMap.region[IB].element_size = 64; | 247 | pm8001_ha->memoryMap.region[IB+i].alignment = 128; |
244 | pm8001_ha->memoryMap.region[IB].total_len = PM8001_MPI_QUEUE * 64; | 248 | } else { |
245 | pm8001_ha->memoryMap.region[IB].alignment = 64; | 249 | pm8001_ha->memoryMap.region[IB+i].num_elements = |
246 | 250 | PM8001_MPI_QUEUE; | |
247 | /* MPI Memory region 6 outbound queues */ | 251 | pm8001_ha->memoryMap.region[IB+i].element_size = 64; |
248 | pm8001_ha->memoryMap.region[OB].num_elements = PM8001_MPI_QUEUE; | 252 | pm8001_ha->memoryMap.region[IB+i].total_len = |
249 | pm8001_ha->memoryMap.region[OB].element_size = 64; | 253 | PM8001_MPI_QUEUE * 64; |
250 | pm8001_ha->memoryMap.region[OB].total_len = PM8001_MPI_QUEUE * 64; | 254 | pm8001_ha->memoryMap.region[IB+i].alignment = 64; |
251 | pm8001_ha->memoryMap.region[OB].alignment = 64; | 255 | } |
256 | } | ||
257 | |||
258 | for (i = 0; i < PM8001_MAX_SPCV_OUTB_NUM; i++) { | ||
259 | /* MPI Memory region 4 for producer Index of outbound queues */ | ||
260 | pm8001_ha->memoryMap.region[PI+i].num_elements = 1; | ||
261 | pm8001_ha->memoryMap.region[PI+i].element_size = 4; | ||
262 | pm8001_ha->memoryMap.region[PI+i].total_len = 4; | ||
263 | pm8001_ha->memoryMap.region[PI+i].alignment = 4; | ||
264 | |||
265 | if (ent->driver_data != chip_8001) { | ||
266 | /* MPI Memory region 6 Outbound queues */ | ||
267 | pm8001_ha->memoryMap.region[OB+i].num_elements = | ||
268 | PM8001_MPI_QUEUE; | ||
269 | pm8001_ha->memoryMap.region[OB+i].element_size = 128; | ||
270 | pm8001_ha->memoryMap.region[OB+i].total_len = | ||
271 | PM8001_MPI_QUEUE * 128; | ||
272 | pm8001_ha->memoryMap.region[OB+i].alignment = 128; | ||
273 | } else { | ||
274 | /* MPI Memory region 6 Outbound queues */ | ||
275 | pm8001_ha->memoryMap.region[OB+i].num_elements = | ||
276 | PM8001_MPI_QUEUE; | ||
277 | pm8001_ha->memoryMap.region[OB+i].element_size = 64; | ||
278 | pm8001_ha->memoryMap.region[OB+i].total_len = | ||
279 | PM8001_MPI_QUEUE * 64; | ||
280 | pm8001_ha->memoryMap.region[OB+i].alignment = 64; | ||
281 | } | ||
252 | 282 | ||
283 | } | ||
253 | /* Memory region write DMA*/ | 284 | /* Memory region write DMA*/ |
254 | pm8001_ha->memoryMap.region[NVMD].num_elements = 1; | 285 | pm8001_ha->memoryMap.region[NVMD].num_elements = 1; |
255 | pm8001_ha->memoryMap.region[NVMD].element_size = 4096; | 286 | pm8001_ha->memoryMap.region[NVMD].element_size = 4096; |
@@ -343,10 +374,12 @@ static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha) | |||
343 | ioremap(pm8001_ha->io_mem[logicalBar].membase, | 374 | ioremap(pm8001_ha->io_mem[logicalBar].membase, |
344 | pm8001_ha->io_mem[logicalBar].memsize); | 375 | pm8001_ha->io_mem[logicalBar].memsize); |
345 | PM8001_INIT_DBG(pm8001_ha, | 376 | PM8001_INIT_DBG(pm8001_ha, |
346 | pm8001_printk("PCI: bar %d, logicalBar %d " | 377 | pm8001_printk("PCI: bar %d, logicalBar %d ", |
347 | "virt_addr=%lx,len=%d\n", bar, logicalBar, | 378 | bar, logicalBar)); |
348 | (unsigned long) | 379 | PM8001_INIT_DBG(pm8001_ha, pm8001_printk( |
349 | pm8001_ha->io_mem[logicalBar].memvirtaddr, | 380 | "base addr %llx virt_addr=%llx len=%d\n", |
381 | (u64)pm8001_ha->io_mem[logicalBar].membase, | ||
382 | (u64)pm8001_ha->io_mem[logicalBar].memvirtaddr, | ||
350 | pm8001_ha->io_mem[logicalBar].memsize)); | 383 | pm8001_ha->io_mem[logicalBar].memsize)); |
351 | } else { | 384 | } else { |
352 | pm8001_ha->io_mem[logicalBar].membase = 0; | 385 | pm8001_ha->io_mem[logicalBar].membase = 0; |
@@ -365,8 +398,9 @@ static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha) | |||
365 | * @shost: scsi host struct which has been initialized before. | 398 | * @shost: scsi host struct which has been initialized before. |
366 | */ | 399 | */ |
367 | static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev, | 400 | static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev, |
368 | u32 chip_id, | 401 | const struct pci_device_id *ent, |
369 | struct Scsi_Host *shost) | 402 | struct Scsi_Host *shost) |
403 | |||
370 | { | 404 | { |
371 | struct pm8001_hba_info *pm8001_ha; | 405 | struct pm8001_hba_info *pm8001_ha; |
372 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | 406 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
@@ -378,7 +412,7 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev, | |||
378 | 412 | ||
379 | pm8001_ha->pdev = pdev; | 413 | pm8001_ha->pdev = pdev; |
380 | pm8001_ha->dev = &pdev->dev; | 414 | pm8001_ha->dev = &pdev->dev; |
381 | pm8001_ha->chip_id = chip_id; | 415 | pm8001_ha->chip_id = ent->driver_data; |
382 | pm8001_ha->chip = &pm8001_chips[pm8001_ha->chip_id]; | 416 | pm8001_ha->chip = &pm8001_chips[pm8001_ha->chip_id]; |
383 | pm8001_ha->irq = pdev->irq; | 417 | pm8001_ha->irq = pdev->irq; |
384 | pm8001_ha->sas = sha; | 418 | pm8001_ha->sas = sha; |
@@ -391,7 +425,7 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev, | |||
391 | (unsigned long)pm8001_ha); | 425 | (unsigned long)pm8001_ha); |
392 | #endif | 426 | #endif |
393 | pm8001_ioremap(pm8001_ha); | 427 | pm8001_ioremap(pm8001_ha); |
394 | if (!pm8001_alloc(pm8001_ha)) | 428 | if (!pm8001_alloc(pm8001_ha, ent)) |
395 | return pm8001_ha; | 429 | return pm8001_ha; |
396 | pm8001_free(pm8001_ha); | 430 | pm8001_free(pm8001_ha); |
397 | return NULL; | 431 | return NULL; |
@@ -669,7 +703,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev, | |||
669 | goto err_out_free; | 703 | goto err_out_free; |
670 | } | 704 | } |
671 | pci_set_drvdata(pdev, SHOST_TO_SAS_HA(shost)); | 705 | pci_set_drvdata(pdev, SHOST_TO_SAS_HA(shost)); |
672 | pm8001_ha = pm8001_pci_alloc(pdev, chip_8001, shost); | 706 | /* ent->driver variable is used to differentiate between controllers */ |
707 | pm8001_ha = pm8001_pci_alloc(pdev, ent, shost); | ||
673 | if (!pm8001_ha) { | 708 | if (!pm8001_ha) { |
674 | rc = -ENOMEM; | 709 | rc = -ENOMEM; |
675 | goto err_out_free; | 710 | goto err_out_free; |