diff options
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 90 |
1 files changed, 43 insertions, 47 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 6526157edafc..ade58bc8f3c4 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -181,8 +181,8 @@ static void cciss_geometry_inquiry(ctlr_info_t *h, int logvol, | |||
181 | sector_t total_size, | 181 | sector_t total_size, |
182 | unsigned int block_size, InquiryData_struct *inq_buff, | 182 | unsigned int block_size, InquiryData_struct *inq_buff, |
183 | drive_info_struct *drv); | 183 | drive_info_struct *drv); |
184 | static void __devinit cciss_interrupt_mode(ctlr_info_t *); | 184 | static void cciss_interrupt_mode(ctlr_info_t *); |
185 | static int __devinit cciss_enter_simple_mode(struct ctlr_info *h); | 185 | static int cciss_enter_simple_mode(struct ctlr_info *h); |
186 | static void start_io(ctlr_info_t *h); | 186 | static void start_io(ctlr_info_t *h); |
187 | static int sendcmd_withirq(ctlr_info_t *h, __u8 cmd, void *buff, size_t size, | 187 | static int sendcmd_withirq(ctlr_info_t *h, __u8 cmd, void *buff, size_t size, |
188 | __u8 page_code, unsigned char scsi3addr[], | 188 | __u8 page_code, unsigned char scsi3addr[], |
@@ -199,14 +199,13 @@ static void cciss_device_release(struct device *dev); | |||
199 | static void cciss_free_gendisk(ctlr_info_t *h, int drv_index); | 199 | static void cciss_free_gendisk(ctlr_info_t *h, int drv_index); |
200 | static void cciss_free_drive_info(ctlr_info_t *h, int drv_index); | 200 | static void cciss_free_drive_info(ctlr_info_t *h, int drv_index); |
201 | static inline u32 next_command(ctlr_info_t *h); | 201 | static inline u32 next_command(ctlr_info_t *h); |
202 | static int __devinit cciss_find_cfg_addrs(struct pci_dev *pdev, | 202 | static int cciss_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr, |
203 | void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index, | 203 | u32 *cfg_base_addr, u64 *cfg_base_addr_index, |
204 | u64 *cfg_offset); | 204 | u64 *cfg_offset); |
205 | static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev, | 205 | static int cciss_pci_find_memory_BAR(struct pci_dev *pdev, |
206 | unsigned long *memory_bar); | 206 | unsigned long *memory_bar); |
207 | static inline u32 cciss_tag_discard_error_bits(ctlr_info_t *h, u32 tag); | 207 | static inline u32 cciss_tag_discard_error_bits(ctlr_info_t *h, u32 tag); |
208 | static __devinit int write_driver_ver_to_cfgtable( | 208 | static int write_driver_ver_to_cfgtable(CfgTable_struct __iomem *cfgtable); |
209 | CfgTable_struct __iomem *cfgtable); | ||
210 | 209 | ||
211 | /* performant mode helper functions */ | 210 | /* performant mode helper functions */ |
212 | static void calc_bucket_map(int *bucket, int num_buckets, int nsgs, | 211 | static void calc_bucket_map(int *bucket, int num_buckets, int nsgs, |
@@ -550,7 +549,7 @@ static const struct file_operations cciss_proc_fops = { | |||
550 | .write = cciss_proc_write, | 549 | .write = cciss_proc_write, |
551 | }; | 550 | }; |
552 | 551 | ||
553 | static void __devinit cciss_procinit(ctlr_info_t *h) | 552 | static void cciss_procinit(ctlr_info_t *h) |
554 | { | 553 | { |
555 | struct proc_dir_entry *pde; | 554 | struct proc_dir_entry *pde; |
556 | 555 | ||
@@ -2663,8 +2662,8 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff, | |||
2663 | return status; | 2662 | return status; |
2664 | } | 2663 | } |
2665 | 2664 | ||
2666 | static int __devinit cciss_send_reset(ctlr_info_t *h, unsigned char *scsi3addr, | 2665 | static int cciss_send_reset(ctlr_info_t *h, unsigned char *scsi3addr, |
2667 | u8 reset_type) | 2666 | u8 reset_type) |
2668 | { | 2667 | { |
2669 | CommandList_struct *c; | 2668 | CommandList_struct *c; |
2670 | int return_status; | 2669 | int return_status; |
@@ -3919,7 +3918,7 @@ static void calc_bucket_map(int bucket[], int num_buckets, | |||
3919 | } | 3918 | } |
3920 | } | 3919 | } |
3921 | 3920 | ||
3922 | static void __devinit cciss_wait_for_mode_change_ack(ctlr_info_t *h) | 3921 | static void cciss_wait_for_mode_change_ack(ctlr_info_t *h) |
3923 | { | 3922 | { |
3924 | int i; | 3923 | int i; |
3925 | 3924 | ||
@@ -3933,8 +3932,7 @@ static void __devinit cciss_wait_for_mode_change_ack(ctlr_info_t *h) | |||
3933 | } | 3932 | } |
3934 | } | 3933 | } |
3935 | 3934 | ||
3936 | static __devinit void cciss_enter_performant_mode(ctlr_info_t *h, | 3935 | static void cciss_enter_performant_mode(ctlr_info_t *h, u32 use_short_tags) |
3937 | u32 use_short_tags) | ||
3938 | { | 3936 | { |
3939 | /* This is a bit complicated. There are 8 registers on | 3937 | /* This is a bit complicated. There are 8 registers on |
3940 | * the controller which we write to to tell it 8 different | 3938 | * the controller which we write to to tell it 8 different |
@@ -4000,7 +3998,7 @@ static __devinit void cciss_enter_performant_mode(ctlr_info_t *h, | |||
4000 | " performant mode\n"); | 3998 | " performant mode\n"); |
4001 | } | 3999 | } |
4002 | 4000 | ||
4003 | static void __devinit cciss_put_controller_into_performant_mode(ctlr_info_t *h) | 4001 | static void cciss_put_controller_into_performant_mode(ctlr_info_t *h) |
4004 | { | 4002 | { |
4005 | __u32 trans_support; | 4003 | __u32 trans_support; |
4006 | 4004 | ||
@@ -4062,7 +4060,7 @@ clean_up: | |||
4062 | * controllers that are capable. If not, we use IO-APIC mode. | 4060 | * controllers that are capable. If not, we use IO-APIC mode. |
4063 | */ | 4061 | */ |
4064 | 4062 | ||
4065 | static void __devinit cciss_interrupt_mode(ctlr_info_t *h) | 4063 | static void cciss_interrupt_mode(ctlr_info_t *h) |
4066 | { | 4064 | { |
4067 | #ifdef CONFIG_PCI_MSI | 4065 | #ifdef CONFIG_PCI_MSI |
4068 | int err; | 4066 | int err; |
@@ -4108,7 +4106,7 @@ default_int_mode: | |||
4108 | return; | 4106 | return; |
4109 | } | 4107 | } |
4110 | 4108 | ||
4111 | static int __devinit cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id) | 4109 | static int cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id) |
4112 | { | 4110 | { |
4113 | int i; | 4111 | int i; |
4114 | u32 subsystem_vendor_id, subsystem_device_id; | 4112 | u32 subsystem_vendor_id, subsystem_device_id; |
@@ -4134,8 +4132,8 @@ static inline bool cciss_board_disabled(ctlr_info_t *h) | |||
4134 | return ((command & PCI_COMMAND_MEMORY) == 0); | 4132 | return ((command & PCI_COMMAND_MEMORY) == 0); |
4135 | } | 4133 | } |
4136 | 4134 | ||
4137 | static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev, | 4135 | static int cciss_pci_find_memory_BAR(struct pci_dev *pdev, |
4138 | unsigned long *memory_bar) | 4136 | unsigned long *memory_bar) |
4139 | { | 4137 | { |
4140 | int i; | 4138 | int i; |
4141 | 4139 | ||
@@ -4151,8 +4149,8 @@ static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev, | |||
4151 | return -ENODEV; | 4149 | return -ENODEV; |
4152 | } | 4150 | } |
4153 | 4151 | ||
4154 | static int __devinit cciss_wait_for_board_state(struct pci_dev *pdev, | 4152 | static int cciss_wait_for_board_state(struct pci_dev *pdev, |
4155 | void __iomem *vaddr, int wait_for_ready) | 4153 | void __iomem *vaddr, int wait_for_ready) |
4156 | #define BOARD_READY 1 | 4154 | #define BOARD_READY 1 |
4157 | #define BOARD_NOT_READY 0 | 4155 | #define BOARD_NOT_READY 0 |
4158 | { | 4156 | { |
@@ -4179,9 +4177,9 @@ static int __devinit cciss_wait_for_board_state(struct pci_dev *pdev, | |||
4179 | return -ENODEV; | 4177 | return -ENODEV; |
4180 | } | 4178 | } |
4181 | 4179 | ||
4182 | static int __devinit cciss_find_cfg_addrs(struct pci_dev *pdev, | 4180 | static int cciss_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr, |
4183 | void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index, | 4181 | u32 *cfg_base_addr, u64 *cfg_base_addr_index, |
4184 | u64 *cfg_offset) | 4182 | u64 *cfg_offset) |
4185 | { | 4183 | { |
4186 | *cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET); | 4184 | *cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET); |
4187 | *cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET); | 4185 | *cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET); |
@@ -4195,7 +4193,7 @@ static int __devinit cciss_find_cfg_addrs(struct pci_dev *pdev, | |||
4195 | return 0; | 4193 | return 0; |
4196 | } | 4194 | } |
4197 | 4195 | ||
4198 | static int __devinit cciss_find_cfgtables(ctlr_info_t *h) | 4196 | static int cciss_find_cfgtables(ctlr_info_t *h) |
4199 | { | 4197 | { |
4200 | u64 cfg_offset; | 4198 | u64 cfg_offset; |
4201 | u32 cfg_base_addr; | 4199 | u32 cfg_base_addr; |
@@ -4224,7 +4222,7 @@ static int __devinit cciss_find_cfgtables(ctlr_info_t *h) | |||
4224 | return 0; | 4222 | return 0; |
4225 | } | 4223 | } |
4226 | 4224 | ||
4227 | static void __devinit cciss_get_max_perf_mode_cmds(struct ctlr_info *h) | 4225 | static void cciss_get_max_perf_mode_cmds(struct ctlr_info *h) |
4228 | { | 4226 | { |
4229 | h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); | 4227 | h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); |
4230 | 4228 | ||
@@ -4245,7 +4243,7 @@ static void __devinit cciss_get_max_perf_mode_cmds(struct ctlr_info *h) | |||
4245 | * max commands, max SG elements without chaining, and with chaining, | 4243 | * max commands, max SG elements without chaining, and with chaining, |
4246 | * SG chain block size, etc. | 4244 | * SG chain block size, etc. |
4247 | */ | 4245 | */ |
4248 | static void __devinit cciss_find_board_params(ctlr_info_t *h) | 4246 | static void cciss_find_board_params(ctlr_info_t *h) |
4249 | { | 4247 | { |
4250 | cciss_get_max_perf_mode_cmds(h); | 4248 | cciss_get_max_perf_mode_cmds(h); |
4251 | h->nr_cmds = h->max_commands - 4 - cciss_tape_cmds; | 4249 | h->nr_cmds = h->max_commands - 4 - cciss_tape_cmds; |
@@ -4304,7 +4302,7 @@ static inline void cciss_p600_dma_prefetch_quirk(ctlr_info_t *h) | |||
4304 | pci_write_config_dword(h->pdev, PCI_COMMAND_PARITY, dma_refetch); | 4302 | pci_write_config_dword(h->pdev, PCI_COMMAND_PARITY, dma_refetch); |
4305 | } | 4303 | } |
4306 | 4304 | ||
4307 | static int __devinit cciss_pci_init(ctlr_info_t *h) | 4305 | static int cciss_pci_init(ctlr_info_t *h) |
4308 | { | 4306 | { |
4309 | int prod_index, err; | 4307 | int prod_index, err; |
4310 | 4308 | ||
@@ -4424,7 +4422,8 @@ static void free_hba(ctlr_info_t *h) | |||
4424 | } | 4422 | } |
4425 | 4423 | ||
4426 | /* Send a message CDB to the firmware. */ | 4424 | /* Send a message CDB to the firmware. */ |
4427 | static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, unsigned char type) | 4425 | static int cciss_message(struct pci_dev *pdev, unsigned char opcode, |
4426 | unsigned char type) | ||
4428 | { | 4427 | { |
4429 | typedef struct { | 4428 | typedef struct { |
4430 | CommandListHeader_struct CommandHeader; | 4429 | CommandListHeader_struct CommandHeader; |
@@ -4571,14 +4570,13 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev, | |||
4571 | return 0; | 4570 | return 0; |
4572 | } | 4571 | } |
4573 | 4572 | ||
4574 | static __devinit void init_driver_version(char *driver_version, int len) | 4573 | static void init_driver_version(char *driver_version, int len) |
4575 | { | 4574 | { |
4576 | memset(driver_version, 0, len); | 4575 | memset(driver_version, 0, len); |
4577 | strncpy(driver_version, "cciss " DRIVER_NAME, len - 1); | 4576 | strncpy(driver_version, "cciss " DRIVER_NAME, len - 1); |
4578 | } | 4577 | } |
4579 | 4578 | ||
4580 | static __devinit int write_driver_ver_to_cfgtable( | 4579 | static int write_driver_ver_to_cfgtable(CfgTable_struct __iomem *cfgtable) |
4581 | CfgTable_struct __iomem *cfgtable) | ||
4582 | { | 4580 | { |
4583 | char *driver_version; | 4581 | char *driver_version; |
4584 | int i, size = sizeof(cfgtable->driver_version); | 4582 | int i, size = sizeof(cfgtable->driver_version); |
@@ -4594,8 +4592,8 @@ static __devinit int write_driver_ver_to_cfgtable( | |||
4594 | return 0; | 4592 | return 0; |
4595 | } | 4593 | } |
4596 | 4594 | ||
4597 | static __devinit void read_driver_ver_from_cfgtable( | 4595 | static void read_driver_ver_from_cfgtable(CfgTable_struct __iomem *cfgtable, |
4598 | CfgTable_struct __iomem *cfgtable, unsigned char *driver_ver) | 4596 | unsigned char *driver_ver) |
4599 | { | 4597 | { |
4600 | int i; | 4598 | int i; |
4601 | 4599 | ||
@@ -4603,8 +4601,7 @@ static __devinit void read_driver_ver_from_cfgtable( | |||
4603 | driver_ver[i] = readb(&cfgtable->driver_version[i]); | 4601 | driver_ver[i] = readb(&cfgtable->driver_version[i]); |
4604 | } | 4602 | } |
4605 | 4603 | ||
4606 | static __devinit int controller_reset_failed( | 4604 | static int controller_reset_failed(CfgTable_struct __iomem *cfgtable) |
4607 | CfgTable_struct __iomem *cfgtable) | ||
4608 | { | 4605 | { |
4609 | 4606 | ||
4610 | char *driver_ver, *old_driver_ver; | 4607 | char *driver_ver, *old_driver_ver; |
@@ -4627,7 +4624,7 @@ static __devinit int controller_reset_failed( | |||
4627 | 4624 | ||
4628 | /* This does a hard reset of the controller using PCI power management | 4625 | /* This does a hard reset of the controller using PCI power management |
4629 | * states or using the doorbell register. */ | 4626 | * states or using the doorbell register. */ |
4630 | static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) | 4627 | static int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) |
4631 | { | 4628 | { |
4632 | u64 cfg_offset; | 4629 | u64 cfg_offset; |
4633 | u32 cfg_base_addr; | 4630 | u32 cfg_base_addr; |
@@ -4772,7 +4769,7 @@ unmap_vaddr: | |||
4772 | return rc; | 4769 | return rc; |
4773 | } | 4770 | } |
4774 | 4771 | ||
4775 | static __devinit int cciss_init_reset_devices(struct pci_dev *pdev) | 4772 | static int cciss_init_reset_devices(struct pci_dev *pdev) |
4776 | { | 4773 | { |
4777 | int rc, i; | 4774 | int rc, i; |
4778 | 4775 | ||
@@ -4806,7 +4803,7 @@ static __devinit int cciss_init_reset_devices(struct pci_dev *pdev) | |||
4806 | return 0; | 4803 | return 0; |
4807 | } | 4804 | } |
4808 | 4805 | ||
4809 | static __devinit int cciss_allocate_cmd_pool(ctlr_info_t *h) | 4806 | static int cciss_allocate_cmd_pool(ctlr_info_t *h) |
4810 | { | 4807 | { |
4811 | h->cmd_pool_bits = kmalloc(BITS_TO_LONGS(h->nr_cmds) * | 4808 | h->cmd_pool_bits = kmalloc(BITS_TO_LONGS(h->nr_cmds) * |
4812 | sizeof(unsigned long), GFP_KERNEL); | 4809 | sizeof(unsigned long), GFP_KERNEL); |
@@ -4825,7 +4822,7 @@ static __devinit int cciss_allocate_cmd_pool(ctlr_info_t *h) | |||
4825 | return 0; | 4822 | return 0; |
4826 | } | 4823 | } |
4827 | 4824 | ||
4828 | static __devinit int cciss_allocate_scatterlists(ctlr_info_t *h) | 4825 | static int cciss_allocate_scatterlists(ctlr_info_t *h) |
4829 | { | 4826 | { |
4830 | int i; | 4827 | int i; |
4831 | 4828 | ||
@@ -4893,7 +4890,7 @@ static int cciss_request_irq(ctlr_info_t *h, | |||
4893 | return -1; | 4890 | return -1; |
4894 | } | 4891 | } |
4895 | 4892 | ||
4896 | static int __devinit cciss_kdump_soft_reset(ctlr_info_t *h) | 4893 | static int cciss_kdump_soft_reset(ctlr_info_t *h) |
4897 | { | 4894 | { |
4898 | if (cciss_send_reset(h, CTLR_LUNID, CCISS_RESET_TYPE_CONTROLLER)) { | 4895 | if (cciss_send_reset(h, CTLR_LUNID, CCISS_RESET_TYPE_CONTROLLER)) { |
4899 | dev_warn(&h->pdev->dev, "Resetting array controller failed.\n"); | 4896 | dev_warn(&h->pdev->dev, "Resetting array controller failed.\n"); |
@@ -4952,8 +4949,7 @@ static void cciss_undo_allocations_after_kdump_soft_reset(ctlr_info_t *h) | |||
4952 | * stealing all these major device numbers. | 4949 | * stealing all these major device numbers. |
4953 | * returns the number of block devices registered. | 4950 | * returns the number of block devices registered. |
4954 | */ | 4951 | */ |
4955 | static int __devinit cciss_init_one(struct pci_dev *pdev, | 4952 | static int cciss_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
4956 | const struct pci_device_id *ent) | ||
4957 | { | 4953 | { |
4958 | int i; | 4954 | int i; |
4959 | int j = 0; | 4955 | int j = 0; |
@@ -5207,7 +5203,7 @@ static void cciss_shutdown(struct pci_dev *pdev) | |||
5207 | free_irq(h->intr[h->intr_mode], h); | 5203 | free_irq(h->intr[h->intr_mode], h); |
5208 | } | 5204 | } |
5209 | 5205 | ||
5210 | static int __devinit cciss_enter_simple_mode(struct ctlr_info *h) | 5206 | static int cciss_enter_simple_mode(struct ctlr_info *h) |
5211 | { | 5207 | { |
5212 | u32 trans_support; | 5208 | u32 trans_support; |
5213 | 5209 | ||
@@ -5229,7 +5225,7 @@ static int __devinit cciss_enter_simple_mode(struct ctlr_info *h) | |||
5229 | } | 5225 | } |
5230 | 5226 | ||
5231 | 5227 | ||
5232 | static void __devexit cciss_remove_one(struct pci_dev *pdev) | 5228 | static void cciss_remove_one(struct pci_dev *pdev) |
5233 | { | 5229 | { |
5234 | ctlr_info_t *h; | 5230 | ctlr_info_t *h; |
5235 | int i, j; | 5231 | int i, j; |
@@ -5308,7 +5304,7 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
5308 | static struct pci_driver cciss_pci_driver = { | 5304 | static struct pci_driver cciss_pci_driver = { |
5309 | .name = "cciss", | 5305 | .name = "cciss", |
5310 | .probe = cciss_init_one, | 5306 | .probe = cciss_init_one, |
5311 | .remove = __devexit_p(cciss_remove_one), | 5307 | .remove = cciss_remove_one, |
5312 | .id_table = cciss_pci_device_id, /* id_table */ | 5308 | .id_table = cciss_pci_device_id, /* id_table */ |
5313 | .shutdown = cciss_shutdown, | 5309 | .shutdown = cciss_shutdown, |
5314 | }; | 5310 | }; |