nark.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Adaptec AAC series RAID controller driver
  3. *
  4. * based on the old aacraid driver that is..
  5. * Adaptec aacraid device driver for Linux.
  6. *
  7. * Copyright (c) 2000-2010 Adaptec, Inc.
  8. * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2, or (at your option)
  13. * any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; see the file COPYING. If not, write to
  22. * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23. *
  24. * Module Name:
  25. * nark.c
  26. *
  27. * Abstract: Hardware Device Interface for NEMER/ARK
  28. *
  29. */
  30. #include <linux/pci.h>
  31. #include <linux/blkdev.h>
  32. #include <scsi/scsi_host.h>
  33. #include "aacraid.h"
  34. /**
  35. * aac_nark_ioremap
  36. * @size: mapping resize request
  37. *
  38. */
  39. static int aac_nark_ioremap(struct aac_dev * dev, u32 size)
  40. {
  41. if (!size) {
  42. iounmap(dev->regs.rx);
  43. dev->regs.rx = NULL;
  44. iounmap(dev->base);
  45. dev->base = NULL;
  46. return 0;
  47. }
  48. dev->base_start = pci_resource_start(dev->pdev, 2);
  49. dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) |
  50. ((u64)pci_resource_start(dev->pdev, 1) << 32),
  51. sizeof(struct rx_registers) - sizeof(struct rx_inbound));
  52. dev->base = NULL;
  53. if (dev->regs.rx == NULL)
  54. return -1;
  55. dev->base = ioremap(dev->base_start, size);
  56. if (dev->base == NULL) {
  57. iounmap(dev->regs.rx);
  58. dev->regs.rx = NULL;
  59. return -1;
  60. }
  61. dev->IndexRegs = &((struct rx_registers __iomem *)dev->base)->IndexRegs;
  62. return 0;
  63. }
  64. /**
  65. * aac_nark_init - initialize an NEMER/ARK Split Bar card
  66. * @dev: device to configure
  67. *
  68. */
  69. int aac_nark_init(struct aac_dev * dev)
  70. {
  71. /*
  72. * Fill in the function dispatch table.
  73. */
  74. dev->a_ops.adapter_ioremap = aac_nark_ioremap;
  75. dev->a_ops.adapter_comm = aac_rx_select_comm;
  76. return _aac_rx_init(dev);
  77. }