aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c92
1 files changed, 44 insertions, 48 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 4217e49aea46..4f338061b5c3 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -189,16 +189,16 @@ static void check_ioctl_unit_attention(struct ctlr_info *h,
189/* performant mode helper functions */ 189/* performant mode helper functions */
190static void calc_bucket_map(int *bucket, int num_buckets, 190static void calc_bucket_map(int *bucket, int num_buckets,
191 int nsgs, int *bucket_map); 191 int nsgs, int *bucket_map);
192static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h); 192static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h);
193static inline u32 next_command(struct ctlr_info *h, u8 q); 193static inline u32 next_command(struct ctlr_info *h, u8 q);
194static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev, 194static int hpsa_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
195 void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index, 195 u32 *cfg_base_addr, u64 *cfg_base_addr_index,
196 u64 *cfg_offset); 196 u64 *cfg_offset);
197static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev, 197static int hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
198 unsigned long *memory_bar); 198 unsigned long *memory_bar);
199static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id); 199static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id);
200static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev, 200static int hpsa_wait_for_board_state(struct pci_dev *pdev, void __iomem *vaddr,
201 void __iomem *vaddr, int wait_for_ready); 201 int wait_for_ready);
202static inline void finish_cmd(struct CommandList *c); 202static inline void finish_cmd(struct CommandList *c);
203#define BOARD_NOT_READY 0 203#define BOARD_NOT_READY 0
204#define BOARD_READY 1 204#define BOARD_READY 1
@@ -3182,8 +3182,8 @@ static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg)
3182 } 3182 }
3183} 3183}
3184 3184
3185static int __devinit hpsa_send_host_reset(struct ctlr_info *h, 3185static int hpsa_send_host_reset(struct ctlr_info *h, unsigned char *scsi3addr,
3186 unsigned char *scsi3addr, u8 reset_type) 3186 u8 reset_type)
3187{ 3187{
3188 struct CommandList *c; 3188 struct CommandList *c;
3189 3189
@@ -3606,8 +3606,8 @@ static irqreturn_t do_hpsa_intr_msi(int irq, void *queue)
3606 * in simple mode, not performant mode due to the tag lookup. 3606 * in simple mode, not performant mode due to the tag lookup.
3607 * We only ever use this immediately after a controller reset. 3607 * We only ever use this immediately after a controller reset.
3608 */ 3608 */
3609static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode, 3609static int hpsa_message(struct pci_dev *pdev, unsigned char opcode,
3610 unsigned char type) 3610 unsigned char type)
3611{ 3611{
3612 struct Command { 3612 struct Command {
3613 struct CommandListHeader CommandHeader; 3613 struct CommandListHeader CommandHeader;
@@ -3756,14 +3756,13 @@ static int hpsa_controller_hard_reset(struct pci_dev *pdev,
3756 return 0; 3756 return 0;
3757} 3757}
3758 3758
3759static __devinit void init_driver_version(char *driver_version, int len) 3759static void init_driver_version(char *driver_version, int len)
3760{ 3760{
3761 memset(driver_version, 0, len); 3761 memset(driver_version, 0, len);
3762 strncpy(driver_version, HPSA " " HPSA_DRIVER_VERSION, len - 1); 3762 strncpy(driver_version, HPSA " " HPSA_DRIVER_VERSION, len - 1);
3763} 3763}
3764 3764
3765static __devinit int write_driver_ver_to_cfgtable( 3765static int write_driver_ver_to_cfgtable(struct CfgTable __iomem *cfgtable)
3766 struct CfgTable __iomem *cfgtable)
3767{ 3766{
3768 char *driver_version; 3767 char *driver_version;
3769 int i, size = sizeof(cfgtable->driver_version); 3768 int i, size = sizeof(cfgtable->driver_version);
@@ -3779,8 +3778,8 @@ static __devinit int write_driver_ver_to_cfgtable(
3779 return 0; 3778 return 0;
3780} 3779}
3781 3780
3782static __devinit void read_driver_ver_from_cfgtable( 3781static void read_driver_ver_from_cfgtable(struct CfgTable __iomem *cfgtable,
3783 struct CfgTable __iomem *cfgtable, unsigned char *driver_ver) 3782 unsigned char *driver_ver)
3784{ 3783{
3785 int i; 3784 int i;
3786 3785
@@ -3788,8 +3787,7 @@ static __devinit void read_driver_ver_from_cfgtable(
3788 driver_ver[i] = readb(&cfgtable->driver_version[i]); 3787 driver_ver[i] = readb(&cfgtable->driver_version[i]);
3789} 3788}
3790 3789
3791static __devinit int controller_reset_failed( 3790static int controller_reset_failed(struct CfgTable __iomem *cfgtable)
3792 struct CfgTable __iomem *cfgtable)
3793{ 3791{
3794 3792
3795 char *driver_ver, *old_driver_ver; 3793 char *driver_ver, *old_driver_ver;
@@ -3812,7 +3810,7 @@ static __devinit int controller_reset_failed(
3812/* This does a hard reset of the controller using PCI power management 3810/* This does a hard reset of the controller using PCI power management
3813 * states or the using the doorbell register. 3811 * states or the using the doorbell register.
3814 */ 3812 */
3815static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) 3813static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
3816{ 3814{
3817 u64 cfg_offset; 3815 u64 cfg_offset;
3818 u32 cfg_base_addr; 3816 u32 cfg_base_addr;
@@ -4029,7 +4027,7 @@ static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
4029 * controllers that are capable. If not, we use IO-APIC mode. 4027 * controllers that are capable. If not, we use IO-APIC mode.
4030 */ 4028 */
4031 4029
4032static void __devinit hpsa_interrupt_mode(struct ctlr_info *h) 4030static void hpsa_interrupt_mode(struct ctlr_info *h)
4033{ 4031{
4034#ifdef CONFIG_PCI_MSI 4032#ifdef CONFIG_PCI_MSI
4035 int err, i; 4033 int err, i;
@@ -4077,7 +4075,7 @@ default_int_mode:
4077 h->intr[h->intr_mode] = h->pdev->irq; 4075 h->intr[h->intr_mode] = h->pdev->irq;
4078} 4076}
4079 4077
4080static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id) 4078static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
4081{ 4079{
4082 int i; 4080 int i;
4083 u32 subsystem_vendor_id, subsystem_device_id; 4081 u32 subsystem_vendor_id, subsystem_device_id;
@@ -4101,8 +4099,8 @@ static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
4101 return ARRAY_SIZE(products) - 1; /* generic unknown smart array */ 4099 return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
4102} 4100}
4103 4101
4104static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev, 4102static int hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
4105 unsigned long *memory_bar) 4103 unsigned long *memory_bar)
4106{ 4104{
4107 int i; 4105 int i;
4108 4106
@@ -4118,8 +4116,8 @@ static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
4118 return -ENODEV; 4116 return -ENODEV;
4119} 4117}
4120 4118
4121static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev, 4119static int hpsa_wait_for_board_state(struct pci_dev *pdev, void __iomem *vaddr,
4122 void __iomem *vaddr, int wait_for_ready) 4120 int wait_for_ready)
4123{ 4121{
4124 int i, iterations; 4122 int i, iterations;
4125 u32 scratchpad; 4123 u32 scratchpad;
@@ -4143,9 +4141,9 @@ static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev,
4143 return -ENODEV; 4141 return -ENODEV;
4144} 4142}
4145 4143
4146static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev, 4144static int hpsa_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
4147 void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index, 4145 u32 *cfg_base_addr, u64 *cfg_base_addr_index,
4148 u64 *cfg_offset) 4146 u64 *cfg_offset)
4149{ 4147{
4150 *cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET); 4148 *cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET);
4151 *cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET); 4149 *cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET);
@@ -4158,7 +4156,7 @@ static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev,
4158 return 0; 4156 return 0;
4159} 4157}
4160 4158
4161static int __devinit hpsa_find_cfgtables(struct ctlr_info *h) 4159static int hpsa_find_cfgtables(struct ctlr_info *h)
4162{ 4160{
4163 u64 cfg_offset; 4161 u64 cfg_offset;
4164 u32 cfg_base_addr; 4162 u32 cfg_base_addr;
@@ -4187,7 +4185,7 @@ static int __devinit hpsa_find_cfgtables(struct ctlr_info *h)
4187 return 0; 4185 return 0;
4188} 4186}
4189 4187
4190static void __devinit hpsa_get_max_perf_mode_cmds(struct ctlr_info *h) 4188static void hpsa_get_max_perf_mode_cmds(struct ctlr_info *h)
4191{ 4189{
4192 h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); 4190 h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
4193 4191
@@ -4208,7 +4206,7 @@ static void __devinit hpsa_get_max_perf_mode_cmds(struct ctlr_info *h)
4208 * max commands, max SG elements without chaining, and with chaining, 4206 * max commands, max SG elements without chaining, and with chaining,
4209 * SG chain block size, etc. 4207 * SG chain block size, etc.
4210 */ 4208 */
4211static void __devinit hpsa_find_board_params(struct ctlr_info *h) 4209static void hpsa_find_board_params(struct ctlr_info *h)
4212{ 4210{
4213 hpsa_get_max_perf_mode_cmds(h); 4211 hpsa_get_max_perf_mode_cmds(h);
4214 h->nr_cmds = h->max_commands - 4; /* Allow room for some ioctls */ 4212 h->nr_cmds = h->max_commands - 4; /* Allow room for some ioctls */
@@ -4266,7 +4264,7 @@ static inline void hpsa_p600_dma_prefetch_quirk(struct ctlr_info *h)
4266 writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG); 4264 writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG);
4267} 4265}
4268 4266
4269static void __devinit hpsa_wait_for_mode_change_ack(struct ctlr_info *h) 4267static void hpsa_wait_for_mode_change_ack(struct ctlr_info *h)
4270{ 4268{
4271 int i; 4269 int i;
4272 u32 doorbell_value; 4270 u32 doorbell_value;
@@ -4287,7 +4285,7 @@ static void __devinit hpsa_wait_for_mode_change_ack(struct ctlr_info *h)
4287 } 4285 }
4288} 4286}
4289 4287
4290static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h) 4288static int hpsa_enter_simple_mode(struct ctlr_info *h)
4291{ 4289{
4292 u32 trans_support; 4290 u32 trans_support;
4293 4291
@@ -4310,7 +4308,7 @@ static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h)
4310 return 0; 4308 return 0;
4311} 4309}
4312 4310
4313static int __devinit hpsa_pci_init(struct ctlr_info *h) 4311static int hpsa_pci_init(struct ctlr_info *h)
4314{ 4312{
4315 int prod_index, err; 4313 int prod_index, err;
4316 4314
@@ -4378,7 +4376,7 @@ err_out_free_res:
4378 return err; 4376 return err;
4379} 4377}
4380 4378
4381static void __devinit hpsa_hba_inquiry(struct ctlr_info *h) 4379static void hpsa_hba_inquiry(struct ctlr_info *h)
4382{ 4380{
4383 int rc; 4381 int rc;
4384 4382
@@ -4394,7 +4392,7 @@ static void __devinit hpsa_hba_inquiry(struct ctlr_info *h)
4394 } 4392 }
4395} 4393}
4396 4394
4397static __devinit int hpsa_init_reset_devices(struct pci_dev *pdev) 4395static int hpsa_init_reset_devices(struct pci_dev *pdev)
4398{ 4396{
4399 int rc, i; 4397 int rc, i;
4400 4398
@@ -4426,7 +4424,7 @@ static __devinit int hpsa_init_reset_devices(struct pci_dev *pdev)
4426 return 0; 4424 return 0;
4427} 4425}
4428 4426
4429static __devinit int hpsa_allocate_cmd_pool(struct ctlr_info *h) 4427static int hpsa_allocate_cmd_pool(struct ctlr_info *h)
4430{ 4428{
4431 h->cmd_pool_bits = kzalloc( 4429 h->cmd_pool_bits = kzalloc(
4432 DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) * 4430 DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) *
@@ -4499,7 +4497,7 @@ static int hpsa_request_irq(struct ctlr_info *h,
4499 return 0; 4497 return 0;
4500} 4498}
4501 4499
4502static int __devinit hpsa_kdump_soft_reset(struct ctlr_info *h) 4500static int hpsa_kdump_soft_reset(struct ctlr_info *h)
4503{ 4501{
4504 if (hpsa_send_host_reset(h, RAID_CTLR_LUNID, 4502 if (hpsa_send_host_reset(h, RAID_CTLR_LUNID,
4505 HPSA_RESET_TYPE_CONTROLLER)) { 4503 HPSA_RESET_TYPE_CONTROLLER)) {
@@ -4713,8 +4711,7 @@ static void stop_controller_lockup_detector(struct ctlr_info *h)
4713 spin_unlock_irqrestore(&lockup_detector_lock, flags); 4711 spin_unlock_irqrestore(&lockup_detector_lock, flags);
4714} 4712}
4715 4713
4716static int __devinit hpsa_init_one(struct pci_dev *pdev, 4714static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
4717 const struct pci_device_id *ent)
4718{ 4715{
4719 int dac, rc; 4716 int dac, rc;
4720 struct ctlr_info *h; 4717 struct ctlr_info *h;
@@ -4910,7 +4907,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
4910 hpsa_free_irqs_and_disable_msix(h); 4907 hpsa_free_irqs_and_disable_msix(h);
4911} 4908}
4912 4909
4913static void __devexit hpsa_free_device_info(struct ctlr_info *h) 4910static void hpsa_free_device_info(struct ctlr_info *h)
4914{ 4911{
4915 int i; 4912 int i;
4916 4913
@@ -4918,7 +4915,7 @@ static void __devexit hpsa_free_device_info(struct ctlr_info *h)
4918 kfree(h->dev[i]); 4915 kfree(h->dev[i]);
4919} 4916}
4920 4917
4921static void __devexit hpsa_remove_one(struct pci_dev *pdev) 4918static void hpsa_remove_one(struct pci_dev *pdev)
4922{ 4919{
4923 struct ctlr_info *h; 4920 struct ctlr_info *h;
4924 4921
@@ -4966,7 +4963,7 @@ static int hpsa_resume(__attribute__((unused)) struct pci_dev *pdev)
4966static struct pci_driver hpsa_pci_driver = { 4963static struct pci_driver hpsa_pci_driver = {
4967 .name = HPSA, 4964 .name = HPSA,
4968 .probe = hpsa_init_one, 4965 .probe = hpsa_init_one,
4969 .remove = __devexit_p(hpsa_remove_one), 4966 .remove = hpsa_remove_one,
4970 .id_table = hpsa_pci_device_id, /* id_table */ 4967 .id_table = hpsa_pci_device_id, /* id_table */
4971 .shutdown = hpsa_shutdown, 4968 .shutdown = hpsa_shutdown,
4972 .suspend = hpsa_suspend, 4969 .suspend = hpsa_suspend,
@@ -5010,8 +5007,7 @@ static void calc_bucket_map(int bucket[], int num_buckets,
5010 } 5007 }
5011} 5008}
5012 5009
5013static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h, 5010static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 use_short_tags)
5014 u32 use_short_tags)
5015{ 5011{
5016 int i; 5012 int i;
5017 unsigned long register_value; 5013 unsigned long register_value;
@@ -5079,7 +5075,7 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
5079 h->transMethod = CFGTBL_Trans_Performant; 5075 h->transMethod = CFGTBL_Trans_Performant;
5080} 5076}
5081 5077
5082static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) 5078static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
5083{ 5079{
5084 u32 trans_support; 5080 u32 trans_support;
5085 int i; 5081 int i;