Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208297
b: refs/heads/master
c: e99ba13
h: refs/heads/master
i:
  208295: 62d6728
v: v3
  • Loading branch information
Stephen M. Cameron authored and Jens Axboe committed Aug 7, 2010
1 parent 11797a1 commit 6a21bef
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 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: d474830da6218c0b7f81eab03aff7d8c539bdb57
refs/heads/master: e99ba1362723df14bbe36da6eeaadf81d95782e6
32 changes: 17 additions & 15 deletions trunk/drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -4026,9 +4026,23 @@ static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev,
return -ENODEV;
}

static int __devinit cciss_wait_for_board_ready(ctlr_info_t *h)
{
int i;
u32 scratchpad;

for (i = 0; i < CCISS_BOARD_READY_ITERATIONS; i++) {
scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
if (scratchpad == CCISS_FIRMWARE_READY)
return 0;
msleep(CCISS_BOARD_READY_POLL_INTERVAL_MSECS);
}
dev_warn(&h->pdev->dev, "board not ready, timed out.\n");
return -ENODEV;
}

static int __devinit cciss_pci_init(ctlr_info_t *c)
{
__u32 scratchpad = 0;
__u64 cfg_offset;
__u32 cfg_base_addr;
__u64 cfg_base_addr_index;
Expand Down Expand Up @@ -4073,21 +4087,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *c)
if (err)
goto err_out_free_res;
c->vaddr = remap_pci_mem(c->paddr, 0x250);

/* Wait for the board to become ready. (PCI hotplug needs this.)
* We poll for up to 120 secs, once per 100ms. */
for (i = 0; i < 1200; i++) {
scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET);
if (scratchpad == CCISS_FIRMWARE_READY)
break;
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(100)); /* wait 100ms */
}
if (scratchpad != CCISS_FIRMWARE_READY) {
printk(KERN_WARNING "cciss: Board not ready. Timed out.\n");
err = -ENODEV;
err = cciss_wait_for_board_ready(c);
if (err)
goto err_out_free_res;
}

/* get the address index number */
cfg_base_addr = readl(c->vaddr + SA5_CTCFG_OFFSET);
Expand Down
15 changes: 15 additions & 0 deletions trunk/drivers/block/cciss.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,21 @@ struct ctlr_info

#define CCISS_INTR_ON 1
#define CCISS_INTR_OFF 0


/* CCISS_BOARD_READY_WAIT_SECS is how long to wait for a board
* to become ready, in seconds, before giving up on it.
* CCISS_BOARD_READY_POLL_INTERVAL_MSECS * is how long to wait
* between polling the board to see if it is ready, in
* milliseconds. CCISS_BOARD_READY_ITERATIONS is derived
* the above.
*/
#define CCISS_BOARD_READY_WAIT_SECS (120)
#define CCISS_BOARD_READY_POLL_INTERVAL_MSECS (100)
#define CCISS_BOARD_READY_ITERATIONS \
((CCISS_BOARD_READY_WAIT_SECS * 1000) / \
CCISS_BOARD_READY_POLL_INTERVAL_MSECS)

/*
Send the command to the hardware
*/
Expand Down

0 comments on commit 6a21bef

Please sign in to comment.