diff options
author | Mike Miller <mike.miller@hp.com> | 2009-04-02 12:50:56 -0700 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-07 08:12:38 +0200 |
commit | e143858104e318263689c551543dfc3f186cea12 (patch) | |
tree | 96d2bf9cc01931c9f8e4f93d5f200ad1b05cb890 /drivers/block/cciss.c | |
parent | 0a9279cc7cbe726e995c44a1acae81d446775816 (diff) | |
download | lwn-e143858104e318263689c551543dfc3f186cea12.tar.gz lwn-e143858104e318263689c551543dfc3f186cea12.zip |
cciss: change to discover first memory BAR
Add a method for discovering the first memory BAR. All Smart Array
controllers to date have always had the the memory BAR as the first BAR.
A new controller to be released later this year breaks that model.
Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 4e5441baa49d..219c530c8da0 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -3265,12 +3265,21 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) */ cciss_interrupt_mode(c, pdev, board_id); - /* - * Memory base addr is first addr , the second points to the config - * table - */ + /* find the memory BAR */ + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { + if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) + break; + } + if (i == DEVICE_COUNT_RESOURCE) { + printk(KERN_WARNING "cciss: No memory BAR found\n"); + err = -ENODEV; + goto err_out_free_res; + } + + c->paddr = pci_resource_start(pdev, i); /* addressing mode bits + * already removed + */ - c->paddr = pci_resource_start(pdev, 0); /* addressing mode bits already removed */ #ifdef CCISS_DEBUG printk("address 0 = %lx\n", c->paddr); #endif /* CCISS_DEBUG */ |