diff options
author | Yang, Bo <Bo.Yang@lsi.com> | 2008-08-10 15:42:38 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-08-16 11:13:32 -0400 |
commit | 6610a6b354d6c3377a1e79cd1d760ffe4358245c (patch) | |
tree | 6cb8a45dd3f12c85bfe8bafb0954fd999c55e713 /drivers/scsi | |
parent | 530e6fc1e05f14762aea954ca8d6422c5a7077c1 (diff) |
[SCSI] megaraid_sas: add new controllers (0x78 0x79)
Add the new controllers (0x78 0x79) support to the driver. Those
controllers are LSI's next generation (gen2) SAS controllers.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: parenthesise a macro]
Signed-off-by: Bo Yang <bo.yang@lsi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.c | 110 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 4 |
2 files changed, 112 insertions, 2 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index e880cd450e0c..870dc1c6302f 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * FILE : megaraid_sas.c | 12 | * FILE : megaraid_sas.c |
13 | * Version : v00.00.03.20-rc1 | 13 | * Version : v00.00.04.01-rc1 |
14 | * | 14 | * |
15 | * Authors: | 15 | * Authors: |
16 | * (email-id : megaraidlinux@lsi.com) | 16 | * (email-id : megaraidlinux@lsi.com) |
@@ -71,6 +71,10 @@ static struct pci_device_id megasas_pci_table[] = { | |||
71 | /* ppc IOP */ | 71 | /* ppc IOP */ |
72 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078DE)}, | 72 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078DE)}, |
73 | /* ppc IOP */ | 73 | /* ppc IOP */ |
74 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078GEN2)}, | ||
75 | /* gen2*/ | ||
76 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS0079GEN2)}, | ||
77 | /* gen2*/ | ||
74 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VERDE_ZCR)}, | 78 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VERDE_ZCR)}, |
75 | /* xscale IOP, vega */ | 79 | /* xscale IOP, vega */ |
76 | {PCI_DEVICE(PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_PERC5)}, | 80 | {PCI_DEVICE(PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_PERC5)}, |
@@ -324,6 +328,99 @@ static struct megasas_instance_template megasas_instance_template_ppc = { | |||
324 | }; | 328 | }; |
325 | 329 | ||
326 | /** | 330 | /** |
331 | * The following functions are defined for gen2 (deviceid : 0x78 0x79) | ||
332 | * controllers | ||
333 | */ | ||
334 | |||
335 | /** | ||
336 | * megasas_enable_intr_gen2 - Enables interrupts | ||
337 | * @regs: MFI register set | ||
338 | */ | ||
339 | static inline void | ||
340 | megasas_enable_intr_gen2(struct megasas_register_set __iomem *regs) | ||
341 | { | ||
342 | writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear); | ||
343 | |||
344 | /* write ~0x00000005 (4 & 1) to the intr mask*/ | ||
345 | writel(~MFI_GEN2_ENABLE_INTERRUPT_MASK, &(regs)->outbound_intr_mask); | ||
346 | |||
347 | /* Dummy readl to force pci flush */ | ||
348 | readl(®s->outbound_intr_mask); | ||
349 | } | ||
350 | |||
351 | /** | ||
352 | * megasas_disable_intr_gen2 - Disables interrupt | ||
353 | * @regs: MFI register set | ||
354 | */ | ||
355 | static inline void | ||
356 | megasas_disable_intr_gen2(struct megasas_register_set __iomem *regs) | ||
357 | { | ||
358 | u32 mask = 0xFFFFFFFF; | ||
359 | writel(mask, ®s->outbound_intr_mask); | ||
360 | /* Dummy readl to force pci flush */ | ||
361 | readl(®s->outbound_intr_mask); | ||
362 | } | ||
363 | |||
364 | /** | ||
365 | * megasas_read_fw_status_reg_gen2 - returns the current FW status value | ||
366 | * @regs: MFI register set | ||
367 | */ | ||
368 | static u32 | ||
369 | megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem *regs) | ||
370 | { | ||
371 | return readl(&(regs)->outbound_scratch_pad); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | * megasas_clear_interrupt_gen2 - Check & clear interrupt | ||
376 | * @regs: MFI register set | ||
377 | */ | ||
378 | static int | ||
379 | megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs) | ||
380 | { | ||
381 | u32 status; | ||
382 | /* | ||
383 | * Check if it is our interrupt | ||
384 | */ | ||
385 | status = readl(®s->outbound_intr_status); | ||
386 | |||
387 | if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK)) | ||
388 | return 1; | ||
389 | |||
390 | /* | ||
391 | * Clear the interrupt by writing back the same value | ||
392 | */ | ||
393 | writel(status, ®s->outbound_doorbell_clear); | ||
394 | |||
395 | /* Dummy readl to force pci flush */ | ||
396 | readl(®s->outbound_intr_status); | ||
397 | |||
398 | return 0; | ||
399 | } | ||
400 | /** | ||
401 | * megasas_fire_cmd_gen2 - Sends command to the FW | ||
402 | * @frame_phys_addr : Physical address of cmd | ||
403 | * @frame_count : Number of frames for the command | ||
404 | * @regs : MFI register set | ||
405 | */ | ||
406 | static inline void | ||
407 | megasas_fire_cmd_gen2(dma_addr_t frame_phys_addr, u32 frame_count, | ||
408 | struct megasas_register_set __iomem *regs) | ||
409 | { | ||
410 | writel((frame_phys_addr | (frame_count<<1))|1, | ||
411 | &(regs)->inbound_queue_port); | ||
412 | } | ||
413 | |||
414 | static struct megasas_instance_template megasas_instance_template_gen2 = { | ||
415 | |||
416 | .fire_cmd = megasas_fire_cmd_gen2, | ||
417 | .enable_intr = megasas_enable_intr_gen2, | ||
418 | .disable_intr = megasas_disable_intr_gen2, | ||
419 | .clear_intr = megasas_clear_intr_gen2, | ||
420 | .read_fw_status_reg = megasas_read_fw_status_reg_gen2, | ||
421 | }; | ||
422 | |||
423 | /** | ||
327 | * This is the end of set of functions & definitions | 424 | * This is the end of set of functions & definitions |
328 | * specific to ppc (deviceid : 0x60) controllers | 425 | * specific to ppc (deviceid : 0x60) controllers |
329 | */ | 426 | */ |
@@ -1982,7 +2079,12 @@ static int megasas_init_mfi(struct megasas_instance *instance) | |||
1982 | /* | 2079 | /* |
1983 | * Map the message registers | 2080 | * Map the message registers |
1984 | */ | 2081 | */ |
1985 | instance->base_addr = pci_resource_start(instance->pdev, 0); | 2082 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1078GEN2) || |
2083 | (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0079GEN2)) { | ||
2084 | instance->base_addr = pci_resource_start(instance->pdev, 1); | ||
2085 | } else { | ||
2086 | instance->base_addr = pci_resource_start(instance->pdev, 0); | ||
2087 | } | ||
1986 | 2088 | ||
1987 | if (pci_request_regions(instance->pdev, "megasas: LSI")) { | 2089 | if (pci_request_regions(instance->pdev, "megasas: LSI")) { |
1988 | printk(KERN_DEBUG "megasas: IO memory region busy!\n"); | 2090 | printk(KERN_DEBUG "megasas: IO memory region busy!\n"); |
@@ -2004,6 +2106,10 @@ static int megasas_init_mfi(struct megasas_instance *instance) | |||
2004 | case PCI_DEVICE_ID_LSI_SAS1078DE: | 2106 | case PCI_DEVICE_ID_LSI_SAS1078DE: |
2005 | instance->instancet = &megasas_instance_template_ppc; | 2107 | instance->instancet = &megasas_instance_template_ppc; |
2006 | break; | 2108 | break; |
2109 | case PCI_DEVICE_ID_LSI_SAS1078GEN2: | ||
2110 | case PCI_DEVICE_ID_LSI_SAS0079GEN2: | ||
2111 | instance->instancet = &megasas_instance_template_gen2; | ||
2112 | break; | ||
2007 | case PCI_DEVICE_ID_LSI_SAS1064R: | 2113 | case PCI_DEVICE_ID_LSI_SAS1064R: |
2008 | case PCI_DEVICE_ID_DELL_PERC5: | 2114 | case PCI_DEVICE_ID_DELL_PERC5: |
2009 | default: | 2115 | default: |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index b0c41e671702..7072ff2cec06 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 | 28 | #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 |
29 | #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C | 29 | #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C |
30 | #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 | 30 | #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 |
31 | #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078 | ||
32 | #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079 | ||
31 | 33 | ||
32 | /* | 34 | /* |
33 | * ===================================== | 35 | * ===================================== |
@@ -580,6 +582,8 @@ struct megasas_ctrl_info { | |||
580 | #define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) | 582 | #define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) |
581 | 583 | ||
582 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 | 584 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 |
585 | #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 | ||
586 | #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004) | ||
583 | 587 | ||
584 | /* | 588 | /* |
585 | * register set for both 1068 and 1078 controllers | 589 | * register set for both 1068 and 1078 controllers |