rkt.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Adaptec AAC series RAID controller driver
  3. * (c) Copyright 2001 Red Hat Inc.
  4. *
  5. * based on the old aacraid driver that is..
  6. * Adaptec aacraid device driver for Linux.
  7. *
  8. * Copyright (c) 2000-2010 Adaptec, Inc.
  9. * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2, or (at your option)
  14. * any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; see the file COPYING. If not, write to
  23. * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  24. *
  25. * Module Name:
  26. * rkt.c
  27. *
  28. * Abstract: Hardware miniport for Drawbridge specific hardware functions.
  29. *
  30. */
  31. #include <linux/blkdev.h>
  32. #include <scsi/scsi_host.h>
  33. #include "aacraid.h"
  34. #define AAC_NUM_IO_FIB_RKT (246 - AAC_NUM_MGT_FIB)
  35. /**
  36. * aac_rkt_select_comm - Select communications method
  37. * @dev: Adapter
  38. * @comm: communications method
  39. */
  40. static int aac_rkt_select_comm(struct aac_dev *dev, int comm)
  41. {
  42. int retval;
  43. retval = aac_rx_select_comm(dev, comm);
  44. if (comm == AAC_COMM_MESSAGE) {
  45. /*
  46. * FIB Setup has already been done, but we can minimize the
  47. * damage by at least ensuring the OS never issues more
  48. * commands than we can handle. The Rocket adapters currently
  49. * can only handle 246 commands and 8 AIFs at the same time,
  50. * and in fact do notify us accordingly if we negotiate the
  51. * FIB size. The problem that causes us to add this check is
  52. * to ensure that we do not overdo it with the adapter when a
  53. * hard coded FIB override is being utilized. This special
  54. * case warrants this half baked, but convenient, check here.
  55. */
  56. if (dev->scsi_host_ptr->can_queue > AAC_NUM_IO_FIB_RKT) {
  57. dev->init->MaxIoCommands =
  58. cpu_to_le32(AAC_NUM_IO_FIB_RKT + AAC_NUM_MGT_FIB);
  59. dev->scsi_host_ptr->can_queue = AAC_NUM_IO_FIB_RKT;
  60. }
  61. }
  62. return retval;
  63. }
  64. /**
  65. * aac_rkt_ioremap
  66. * @size: mapping resize request
  67. *
  68. */
  69. static int aac_rkt_ioremap(struct aac_dev * dev, u32 size)
  70. {
  71. if (!size) {
  72. iounmap(dev->regs.rkt);
  73. return 0;
  74. }
  75. dev->base = dev->regs.rkt = ioremap(dev->base_start, size);
  76. if (dev->base == NULL)
  77. return -1;
  78. dev->IndexRegs = &dev->regs.rkt->IndexRegs;
  79. return 0;
  80. }
  81. /**
  82. * aac_rkt_init - initialize an i960 based AAC card
  83. * @dev: device to configure
  84. *
  85. * Allocate and set up resources for the i960 based AAC variants. The
  86. * device_interface in the commregion will be allocated and linked
  87. * to the comm region.
  88. */
  89. int aac_rkt_init(struct aac_dev *dev)
  90. {
  91. /*
  92. * Fill in the function dispatch table.
  93. */
  94. dev->a_ops.adapter_ioremap = aac_rkt_ioremap;
  95. dev->a_ops.adapter_comm = aac_rkt_select_comm;
  96. return _aac_rx_init(dev);
  97. }