Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204052
b: refs/heads/master
c: 85bdbab
h: refs/heads/master
v: v3
  • Loading branch information
Stephen M. Cameron authored and James Bottomley committed Jul 27, 2010
1 parent cb597b8 commit 238941a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e5c880d1d5923c341ac7ba537fb1e6b73c5977a2
refs/heads/master: 85bdbabbd97ff797f91e6ec839ab053776bc72b4
16 changes: 9 additions & 7 deletions trunk/drivers/scsi/hpsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -3278,9 +3278,16 @@ static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
}

static inline bool hpsa_board_disabled(struct pci_dev *pdev)
{
u16 command;

(void) pci_read_config_word(pdev, PCI_COMMAND, &command);
return ((command & PCI_COMMAND_MEMORY) == 0);
}

static int __devinit hpsa_pci_init(struct ctlr_info *h)
{
ushort command;
u32 scratchpad = 0;
u64 cfg_offset;
u32 cfg_base_addr;
Expand All @@ -3294,15 +3301,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
h->product_name = products[prod_index].product_name;
h->access = *(products[prod_index].access);

/* check to see if controller has been disabled
* BEFORE trying to enable it
*/
(void)pci_read_config_word(h->pdev, PCI_COMMAND, &command);
if (!(command & 0x02)) {
if (hpsa_board_disabled(h->pdev)) {
dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
return -ENODEV;
}

err = pci_enable_device(h->pdev);
if (err) {
dev_warn(&h->pdev->dev, "unable to enable PCI device\n");
Expand Down

0 comments on commit 238941a

Please sign in to comment.