rkt.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Adaptec AAC series RAID controller driver
  4. * (c) Copyright 2001 Red Hat Inc.
  5. *
  6. * based on the old aacraid driver that is..
  7. * Adaptec aacraid device driver for Linux.
  8. *
  9. * Copyright (c) 2000-2010 Adaptec, Inc.
  10. * 2010-2015 PMC-Sierra, Inc. ([email protected])
  11. * 2016-2017 Microsemi Corp. ([email protected])
  12. *
  13. * Module Name:
  14. * rkt.c
  15. *
  16. * Abstract: Hardware miniport for Drawbridge specific hardware functions.
  17. */
  18. #include <linux/blkdev.h>
  19. #include <scsi/scsi_host.h>
  20. #include "aacraid.h"
  21. #define AAC_NUM_IO_FIB_RKT (246 - AAC_NUM_MGT_FIB)
  22. /**
  23. * aac_rkt_select_comm - Select communications method
  24. * @dev: Adapter
  25. * @comm: communications method
  26. */
  27. static int aac_rkt_select_comm(struct aac_dev *dev, int comm)
  28. {
  29. int retval;
  30. retval = aac_rx_select_comm(dev, comm);
  31. if (comm == AAC_COMM_MESSAGE) {
  32. /*
  33. * FIB Setup has already been done, but we can minimize the
  34. * damage by at least ensuring the OS never issues more
  35. * commands than we can handle. The Rocket adapters currently
  36. * can only handle 246 commands and 8 AIFs at the same time,
  37. * and in fact do notify us accordingly if we negotiate the
  38. * FIB size. The problem that causes us to add this check is
  39. * to ensure that we do not overdo it with the adapter when a
  40. * hard coded FIB override is being utilized. This special
  41. * case warrants this half baked, but convenient, check here.
  42. */
  43. if (dev->scsi_host_ptr->can_queue > AAC_NUM_IO_FIB_RKT) {
  44. dev->init->r7.max_io_commands =
  45. cpu_to_le32(AAC_NUM_IO_FIB_RKT + AAC_NUM_MGT_FIB);
  46. dev->scsi_host_ptr->can_queue = AAC_NUM_IO_FIB_RKT;
  47. }
  48. }
  49. return retval;
  50. }
  51. /**
  52. * aac_rkt_ioremap
  53. * @dev: device to ioremap
  54. * @size: mapping resize request
  55. *
  56. */
  57. static int aac_rkt_ioremap(struct aac_dev * dev, u32 size)
  58. {
  59. if (!size) {
  60. iounmap(dev->regs.rkt);
  61. return 0;
  62. }
  63. dev->base = dev->regs.rkt = ioremap(dev->base_start, size);
  64. if (dev->base == NULL)
  65. return -1;
  66. dev->IndexRegs = &dev->regs.rkt->IndexRegs;
  67. return 0;
  68. }
  69. /**
  70. * aac_rkt_init - initialize an i960 based AAC card
  71. * @dev: device to configure
  72. *
  73. * Allocate and set up resources for the i960 based AAC variants. The
  74. * device_interface in the commregion will be allocated and linked
  75. * to the comm region.
  76. */
  77. int aac_rkt_init(struct aac_dev *dev)
  78. {
  79. /*
  80. * Fill in the function dispatch table.
  81. */
  82. dev->a_ops.adapter_ioremap = aac_rkt_ioremap;
  83. dev->a_ops.adapter_comm = aac_rkt_select_comm;
  84. return _aac_rx_init(dev);
  85. }