aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_cmd.c
diff options
context:
space:
mode:
authorRoland Dreier <roland@topspin.com>2005-06-27 17:36:45 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 18:11:46 -0400
commit80fd8238734c852a8ed1ea39f8444a2df33bd161 (patch)
treed29f8f1a13c879ba991bf39096df8c009b406268 /drivers/infiniband/hw/mthca/mthca_cmd.c
parent761f9eb8c31f72692aad118e51e2a59a80467088 (diff)
[PATCH] IB/mthca: Encapsulate command interface init
Encapsulate mthca command interface initialization/cleanup. Signed-off-by: Roland Dreier <roland@topspin.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_cmd.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cmd.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
index cd9ed958d92f..78d4891720e9 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -431,6 +431,27 @@ static int mthca_cmd_imm(struct mthca_dev *dev,
431 timeout, status); 431 timeout, status);
432} 432}
433 433
434int mthca_cmd_init(struct mthca_dev *dev)
435{
436 sema_init(&dev->cmd.hcr_sem, 1);
437 sema_init(&dev->cmd.poll_sem, 1);
438 dev->cmd.use_events = 0;
439
440 dev->hcr = ioremap(pci_resource_start(dev->pdev, 0) + MTHCA_HCR_BASE,
441 MTHCA_HCR_SIZE);
442 if (!dev->hcr) {
443 mthca_err(dev, "Couldn't map command register.");
444 return -ENOMEM;
445 }
446
447 return 0;
448}
449
450void mthca_cmd_cleanup(struct mthca_dev *dev)
451{
452 iounmap(dev->hcr);
453}
454
434/* 455/*
435 * Switch to using events to issue FW commands (should be called after 456 * Switch to using events to issue FW commands (should be called after
436 * event queue to command events has been initialized). 457 * event queue to command events has been initialized).