Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208296
b: refs/heads/master
c: d474830
h: refs/heads/master
v: v3
  • Loading branch information
Stephen M. Cameron authored and Jens Axboe committed Aug 7, 2010
1 parent 62d6728 commit 11797a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 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: dac5488a9ed6b6e59749e161209a6678980803f1
refs/heads/master: d474830da6218c0b7f81eab03aff7d8c539bdb57
37 changes: 19 additions & 18 deletions trunk/drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -4009,6 +4009,23 @@ static inline bool cciss_board_disabled(ctlr_info_t *h)
return ((command & PCI_COMMAND_MEMORY) == 0);
}

static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev,
unsigned long *memory_bar)
{
int i;

for (i = 0; i < DEVICE_COUNT_RESOURCE; i++)
if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) {
/* addressing mode bits already removed */
*memory_bar = pci_resource_start(pdev, i);
dev_dbg(&pdev->dev, "memory BAR = %lx\n",
*memory_bar);
return 0;
}
dev_warn(&pdev->dev, "no memory BAR found\n");
return -ENODEV;
}

static int __devinit cciss_pci_init(ctlr_info_t *c)
{
__u32 scratchpad = 0;
Expand Down Expand Up @@ -4052,25 +4069,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *c)
* else we use the IO-APIC interrupt assigned to us by system ROM.
*/
cciss_interrupt_mode(c);

/* find the memory BAR */
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
if (pci_resource_flags(c->pdev, i) & IORESOURCE_MEM)
break;
}
if (i == DEVICE_COUNT_RESOURCE) {
printk(KERN_WARNING "cciss: No memory BAR found\n");
err = -ENODEV;
err = cciss_pci_find_memory_BAR(c->pdev, &c->paddr);
if (err)
goto err_out_free_res;
}

c->paddr = pci_resource_start(c->pdev, i); /* addressing mode bits
* already removed
*/

#ifdef CCISS_DEBUG
printk("address 0 = %lx\n", c->paddr);
#endif /* CCISS_DEBUG */
c->vaddr = remap_pci_mem(c->paddr, 0x250);

/* Wait for the board to become ready. (PCI hotplug needs this.)
Expand Down

0 comments on commit 11797a1

Please sign in to comment.