nark.c 2.1 KB

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