Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286291
b: refs/heads/master
c: 22605f9
h: refs/heads/master
i:
  286289: 27f7b99
  286287: c1fabb3
v: v3
  • Loading branch information
Matthew Wilcox committed Nov 4, 2011
1 parent 26ee17f commit b3a130d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aba2080f3f1639f9202f1a52993669844abcfb80
refs/heads/master: 22605f96810d073eb74051d0295b6577d6a6a563
10 changes: 10 additions & 0 deletions trunk/drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,8 @@ static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev)
{
int result;
u32 aqa;
u64 cap;
unsigned long timeout;
struct nvme_queue *nvmeq;

dev->dbs = ((void __iomem *)dev->bar) + 4096;
Expand All @@ -915,10 +917,18 @@ static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev)
writeq(nvmeq->cq_dma_addr, &dev->bar->acq);
writel(dev->ctrl_config, &dev->bar->cc);

cap = readq(&dev->bar->cap);
timeout = ((NVME_CAP_TIMEOUT(cap) + 1) * HZ / 2) + jiffies;

while (!(readl(&dev->bar->csts) & NVME_CSTS_RDY)) {
msleep(100);
if (fatal_signal_pending(current))
return -EINTR;
if (time_after(jiffies, timeout)) {
dev_err(&dev->pci_dev->dev,
"Device not ready; aborting initialisation\n");
return -ENODEV;
}
}

result = queue_request_irq(dev, nvmeq, "nvme admin");
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ struct nvme_bar {
__u64 acq; /* Admin CQ Base Address */
};

#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)

enum {
NVME_CC_ENABLE = 1 << 0,
NVME_CC_CSS_NVM = 0 << 4,
Expand Down

0 comments on commit b3a130d

Please sign in to comment.