aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r--drivers/block/cciss.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index d4167c29213d..808d2a5b46bb 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4002,9 +4002,16 @@ static int __devinit cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
4002 return -ENODEV; 4002 return -ENODEV;
4003} 4003}
4004 4004
4005static inline bool cciss_board_disabled(ctlr_info_t *h)
4006{
4007 u16 command;
4008
4009 (void) pci_read_config_word(h->pdev, PCI_COMMAND, &command);
4010 return ((command & PCI_COMMAND_MEMORY) == 0);
4011}
4012
4005static int __devinit cciss_pci_init(ctlr_info_t *c) 4013static int __devinit cciss_pci_init(ctlr_info_t *c)
4006{ 4014{
4007 ushort command;
4008 __u32 scratchpad = 0; 4015 __u32 scratchpad = 0;
4009 __u64 cfg_offset; 4016 __u64 cfg_offset;
4010 __u32 cfg_base_addr; 4017 __u32 cfg_base_addr;
@@ -4018,15 +4025,11 @@ static int __devinit cciss_pci_init(ctlr_info_t *c)
4018 c->product_name = products[prod_index].product_name; 4025 c->product_name = products[prod_index].product_name;
4019 c->access = *(products[prod_index].access); 4026 c->access = *(products[prod_index].access);
4020 4027
4021 /* check to see if controller has been disabled */ 4028 if (cciss_board_disabled(c)) {
4022 /* BEFORE trying to enable it */
4023 (void)pci_read_config_word(c->pdev, PCI_COMMAND, &command);
4024 if (!(command & 0x02)) {
4025 printk(KERN_WARNING 4029 printk(KERN_WARNING
4026 "cciss: controller appears to be disabled\n"); 4030 "cciss: controller appears to be disabled\n");
4027 return -ENODEV; 4031 return -ENODEV;
4028 } 4032 }
4029
4030 err = pci_enable_device(c->pdev); 4033 err = pci_enable_device(c->pdev);
4031 if (err) { 4034 if (err) {
4032 printk(KERN_ERR "cciss: Unable to Enable PCI device\n"); 4035 printk(KERN_ERR "cciss: Unable to Enable PCI device\n");