scu_constants.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * This file is provided under a dual BSD/GPLv2 license. When using or
  3. * redistributing this file, you may do so under either license.
  4. *
  5. * GPL LICENSE SUMMARY
  6. *
  7. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called LICENSE.GPL.
  23. *
  24. * BSD LICENSE
  25. *
  26. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source and binary forms, with or without
  30. * modification, are permitted provided that the following conditions
  31. * are met:
  32. *
  33. * * Redistributions of source code must retain the above copyright
  34. * notice, this list of conditions and the following disclaimer.
  35. * * Redistributions in binary form must reproduce the above copyright
  36. * notice, this list of conditions and the following disclaimer in
  37. * the documentation and/or other materials provided with the
  38. * distribution.
  39. * * Neither the name of Intel Corporation nor the names of its
  40. * contributors may be used to endorse or promote products derived
  41. * from this software without specific prior written permission.
  42. *
  43. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  44. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  45. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  46. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  47. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  48. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  49. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  50. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  51. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  52. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  53. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  54. */
  55. #ifndef _SCU_CONSTANTS_H_
  56. #define _SCU_CONSTANTS_H_
  57. /**
  58. * This file contains the SCU hardware constants.
  59. *
  60. *
  61. */
  62. #include "sci_controller_constants.h"
  63. /**
  64. *
  65. *
  66. * 2 indicates the maximum number of UFs that can occur for a given IO request.
  67. * The hardware handles reception of additional unsolicited frames while all
  68. * UFs are in use, by holding off the transmitting device. This number could
  69. * be theoretically reduced to 1, but 2 provides for more reliable operation.
  70. * During SATA PIO operation, it is possible under some conditions for there to
  71. * be 3 separate FISes received, back to back to back (PIO Setup, Data, D2H
  72. * Register). It is unlikely to have all 3 pending all at once without some of
  73. * them already being processed.
  74. */
  75. #define SCU_MIN_UNSOLICITED_FRAMES (1)
  76. #define SCU_MIN_CRITICAL_NOTIFICATIONS (24)
  77. #define SCU_MIN_EVENTS (4)
  78. #define SCU_MIN_COMPLETION_QUEUE_SCRATCH (2)
  79. #define SCU_MIN_COMPLETION_QUEUE_ENTRIES (SCU_MIN_CRITICAL_NOTIFICATIONS \
  80. + SCU_MIN_EVENTS \
  81. + SCU_MIN_UNSOLICITED_FRAMES \
  82. + SCI_MIN_IO_REQUESTS \
  83. + SCU_MIN_COMPLETION_QUEUE_SCRATCH)
  84. #define SCU_MAX_CRITICAL_NOTIFICATIONS (384)
  85. #define SCU_MAX_EVENTS (128)
  86. #define SCU_MAX_UNSOLICITED_FRAMES (128)
  87. #define SCU_MAX_COMPLETION_QUEUE_SCRATCH (128)
  88. #define SCU_MAX_COMPLETION_QUEUE_ENTRIES (SCU_MAX_CRITICAL_NOTIFICATIONS \
  89. + SCU_MAX_EVENTS \
  90. + SCU_MAX_UNSOLICITED_FRAMES \
  91. + SCI_MAX_IO_REQUESTS \
  92. + SCU_MAX_COMPLETION_QUEUE_SCRATCH)
  93. #if !defined(ENABLE_MINIMUM_MEMORY_MODE)
  94. #define SCU_UNSOLICITED_FRAME_COUNT SCU_MAX_UNSOLICITED_FRAMES
  95. #define SCU_CRITICAL_NOTIFICATION_COUNT SCU_MAX_CRITICAL_NOTIFICATIONS
  96. #define SCU_EVENT_COUNT SCU_MAX_EVENTS
  97. #define SCU_COMPLETION_QUEUE_SCRATCH SCU_MAX_COMPLETION_QUEUE_SCRATCH
  98. #define SCU_IO_REQUEST_COUNT SCI_MAX_IO_REQUESTS
  99. #define SCU_IO_REQUEST_SGE_COUNT SCI_MAX_SCATTER_GATHER_ELEMENTS
  100. #define SCU_COMPLETION_QUEUE_COUNT SCU_MAX_COMPLETION_QUEUE_ENTRIES
  101. #else
  102. #define SCU_UNSOLICITED_FRAME_COUNT SCU_MIN_UNSOLICITED_FRAMES
  103. #define SCU_CRITICAL_NOTIFICATION_COUNT SCU_MIN_CRITICAL_NOTIFICATIONS
  104. #define SCU_EVENT_COUNT SCU_MIN_EVENTS
  105. #define SCU_COMPLETION_QUEUE_SCRATCH SCU_MIN_COMPLETION_QUEUE_SCRATCH
  106. #define SCU_IO_REQUEST_COUNT SCI_MIN_IO_REQUESTS
  107. #define SCU_IO_REQUEST_SGE_COUNT SCI_MIN_SCATTER_GATHER_ELEMENTS
  108. #define SCU_COMPLETION_QUEUE_COUNT SCU_MIN_COMPLETION_QUEUE_ENTRIES
  109. #endif /* !defined(ENABLE_MINIMUM_MEMORY_OPERATION) */
  110. /**
  111. *
  112. *
  113. * The SCU_COMPLETION_QUEUE_COUNT constant indicates the size of the completion
  114. * queue into which the hardware DMAs 32-bit quantas (completion entries).
  115. */
  116. /**
  117. *
  118. *
  119. * This queue must be programmed to a power of 2 size (e.g. 32, 64, 1024, etc.).
  120. */
  121. #if (SCU_COMPLETION_QUEUE_COUNT != 16) && \
  122. (SCU_COMPLETION_QUEUE_COUNT != 32) && \
  123. (SCU_COMPLETION_QUEUE_COUNT != 64) && \
  124. (SCU_COMPLETION_QUEUE_COUNT != 128) && \
  125. (SCU_COMPLETION_QUEUE_COUNT != 256) && \
  126. (SCU_COMPLETION_QUEUE_COUNT != 512) && \
  127. (SCU_COMPLETION_QUEUE_COUNT != 1024)
  128. #error "SCU_COMPLETION_QUEUE_COUNT must be set to a power of 2."
  129. #endif
  130. #if SCU_MIN_UNSOLICITED_FRAMES > SCU_MAX_UNSOLICITED_FRAMES
  131. #error "Invalid configuration of unsolicited frame constants"
  132. #endif /* SCU_MIN_UNSOLICITED_FRAMES > SCU_MAX_UNSOLICITED_FRAMES */
  133. #define SCU_MIN_UF_TABLE_ENTRIES (8)
  134. #define SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES (4096)
  135. #define SCU_UNSOLICITED_FRAME_BUFFER_SIZE (1024)
  136. #define SCU_INVALID_FRAME_INDEX (0xFFFF)
  137. #define SCU_IO_REQUEST_MAX_SGE_SIZE (0x00FFFFFF)
  138. #define SCU_IO_REQUEST_MAX_TRANSFER_LENGTH (0x00FFFFFF)
  139. #endif /* _SCU_CONSTANTS_H_ */