diff options
Diffstat (limited to 'drivers/scsi/isci/isci.h')
-rw-r--r-- | drivers/scsi/isci/isci.h | 90 |
1 files changed, 11 insertions, 79 deletions
diff --git a/drivers/scsi/isci/isci.h b/drivers/scsi/isci/isci.h index 80cfb45f8da1..714ed926171b 100644 --- a/drivers/scsi/isci/isci.h +++ b/drivers/scsi/isci/isci.h | |||
@@ -78,39 +78,16 @@ enum sci_controller_mode { | |||
78 | SCI_MODE_SIZE /* deprecated */ | 78 | SCI_MODE_SIZE /* deprecated */ |
79 | }; | 79 | }; |
80 | 80 | ||
81 | #define SCI_MAX_PHYS (4) | 81 | #define SCI_MAX_PHYS (4UL) |
82 | #define SCI_MAX_PORTS SCI_MAX_PHYS | 82 | #define SCI_MAX_PORTS SCI_MAX_PHYS |
83 | #define SCI_MIN_SMP_PHYS (38) | ||
84 | #define SCI_MAX_SMP_PHYS (384) /* not silicon constrained */ | 83 | #define SCI_MAX_SMP_PHYS (384) /* not silicon constrained */ |
85 | #define SCI_MAX_REMOTE_DEVICES (256) | 84 | #define SCI_MAX_REMOTE_DEVICES (256UL) |
86 | #define SCI_MIN_REMOTE_DEVICES (16) | 85 | #define SCI_MAX_IO_REQUESTS (256UL) |
87 | #define SCI_MAX_IO_REQUESTS (256) | ||
88 | #define SCI_MIN_IO_REQUESTS (1) | ||
89 | #define SCI_MAX_MSIX_MESSAGES (2) | 86 | #define SCI_MAX_MSIX_MESSAGES (2) |
90 | #define SCI_MAX_SCATTER_GATHER_ELEMENTS 130 /* not silicon constrained */ | 87 | #define SCI_MAX_SCATTER_GATHER_ELEMENTS 130 /* not silicon constrained */ |
91 | #define SCI_MIN_SCATTER_GATHER_ELEMENTS 1 | ||
92 | #define SCI_MAX_CONTROLLERS 2 | 88 | #define SCI_MAX_CONTROLLERS 2 |
93 | #define SCI_MAX_DOMAINS SCI_MAX_PORTS | 89 | #define SCI_MAX_DOMAINS SCI_MAX_PORTS |
94 | 90 | ||
95 | /* 2 indicates the maximum number of UFs that can occur for a given IO request. | ||
96 | * The hardware handles reception of additional unsolicited frames while all | ||
97 | * UFs are in use, by holding off the transmitting device. This number could | ||
98 | * be theoretically reduced to 1, but 2 provides for more reliable operation. | ||
99 | * During SATA PIO operation, it is possible under some conditions for there to | ||
100 | * be 3 separate FISes received, back to back to back (PIO Setup, Data, D2H | ||
101 | * Register). It is unlikely to have all 3 pending all at once without some of | ||
102 | * them already being processed. | ||
103 | */ | ||
104 | #define SCU_MIN_UNSOLICITED_FRAMES (1) | ||
105 | #define SCU_MIN_CRITICAL_NOTIFICATIONS (24) | ||
106 | #define SCU_MIN_EVENTS (4) | ||
107 | #define SCU_MIN_COMPLETION_QUEUE_SCRATCH (2) | ||
108 | #define SCU_MIN_COMPLETION_QUEUE_ENTRIES (SCU_MIN_CRITICAL_NOTIFICATIONS \ | ||
109 | + SCU_MIN_EVENTS \ | ||
110 | + SCU_MIN_UNSOLICITED_FRAMES \ | ||
111 | + SCI_MIN_IO_REQUESTS \ | ||
112 | + SCU_MIN_COMPLETION_QUEUE_SCRATCH) | ||
113 | |||
114 | #define SCU_MAX_CRITICAL_NOTIFICATIONS (384) | 91 | #define SCU_MAX_CRITICAL_NOTIFICATIONS (384) |
115 | #define SCU_MAX_EVENTS (128) | 92 | #define SCU_MAX_EVENTS (128) |
116 | #define SCU_MAX_UNSOLICITED_FRAMES (128) | 93 | #define SCU_MAX_UNSOLICITED_FRAMES (128) |
@@ -121,51 +98,6 @@ enum sci_controller_mode { | |||
121 | + SCI_MAX_IO_REQUESTS \ | 98 | + SCI_MAX_IO_REQUESTS \ |
122 | + SCU_MAX_COMPLETION_QUEUE_SCRATCH) | 99 | + SCU_MAX_COMPLETION_QUEUE_SCRATCH) |
123 | 100 | ||
124 | #if !defined(ENABLE_MINIMUM_MEMORY_MODE) | ||
125 | #define SCU_UNSOLICITED_FRAME_COUNT SCU_MAX_UNSOLICITED_FRAMES | ||
126 | #define SCU_CRITICAL_NOTIFICATION_COUNT SCU_MAX_CRITICAL_NOTIFICATIONS | ||
127 | #define SCU_EVENT_COUNT SCU_MAX_EVENTS | ||
128 | #define SCU_COMPLETION_QUEUE_SCRATCH SCU_MAX_COMPLETION_QUEUE_SCRATCH | ||
129 | #define SCU_IO_REQUEST_COUNT SCI_MAX_IO_REQUESTS | ||
130 | #define SCU_IO_REQUEST_SGE_COUNT SCI_MAX_SCATTER_GATHER_ELEMENTS | ||
131 | #define SCU_COMPLETION_QUEUE_COUNT SCU_MAX_COMPLETION_QUEUE_ENTRIES | ||
132 | #else | ||
133 | #define SCU_UNSOLICITED_FRAME_COUNT SCU_MIN_UNSOLICITED_FRAMES | ||
134 | #define SCU_CRITICAL_NOTIFICATION_COUNT SCU_MIN_CRITICAL_NOTIFICATIONS | ||
135 | #define SCU_EVENT_COUNT SCU_MIN_EVENTS | ||
136 | #define SCU_COMPLETION_QUEUE_SCRATCH SCU_MIN_COMPLETION_QUEUE_SCRATCH | ||
137 | #define SCU_IO_REQUEST_COUNT SCI_MIN_IO_REQUESTS | ||
138 | #define SCU_IO_REQUEST_SGE_COUNT SCI_MIN_SCATTER_GATHER_ELEMENTS | ||
139 | #define SCU_COMPLETION_QUEUE_COUNT SCU_MIN_COMPLETION_QUEUE_ENTRIES | ||
140 | #endif /* !defined(ENABLE_MINIMUM_MEMORY_OPERATION) */ | ||
141 | |||
142 | /** | ||
143 | * | ||
144 | * | ||
145 | * The SCU_COMPLETION_QUEUE_COUNT constant indicates the size of the completion | ||
146 | * queue into which the hardware DMAs 32-bit quantas (completion entries). | ||
147 | */ | ||
148 | |||
149 | /** | ||
150 | * | ||
151 | * | ||
152 | * This queue must be programmed to a power of 2 size (e.g. 32, 64, 1024, etc.). | ||
153 | */ | ||
154 | #if (SCU_COMPLETION_QUEUE_COUNT != 16) && \ | ||
155 | (SCU_COMPLETION_QUEUE_COUNT != 32) && \ | ||
156 | (SCU_COMPLETION_QUEUE_COUNT != 64) && \ | ||
157 | (SCU_COMPLETION_QUEUE_COUNT != 128) && \ | ||
158 | (SCU_COMPLETION_QUEUE_COUNT != 256) && \ | ||
159 | (SCU_COMPLETION_QUEUE_COUNT != 512) && \ | ||
160 | (SCU_COMPLETION_QUEUE_COUNT != 1024) | ||
161 | #error "SCU_COMPLETION_QUEUE_COUNT must be set to a power of 2." | ||
162 | #endif | ||
163 | |||
164 | #if SCU_MIN_UNSOLICITED_FRAMES > SCU_MAX_UNSOLICITED_FRAMES | ||
165 | #error "Invalid configuration of unsolicited frame constants" | ||
166 | #endif /* SCU_MIN_UNSOLICITED_FRAMES > SCU_MAX_UNSOLICITED_FRAMES */ | ||
167 | |||
168 | #define SCU_MIN_UF_TABLE_ENTRIES (8) | ||
169 | #define SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES (4096) | 101 | #define SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES (4096) |
170 | #define SCU_UNSOLICITED_FRAME_BUFFER_SIZE (1024) | 102 | #define SCU_UNSOLICITED_FRAME_BUFFER_SIZE (1024) |
171 | #define SCU_INVALID_FRAME_INDEX (0xFFFF) | 103 | #define SCU_INVALID_FRAME_INDEX (0xFFFF) |
@@ -173,14 +105,14 @@ enum sci_controller_mode { | |||
173 | #define SCU_IO_REQUEST_MAX_SGE_SIZE (0x00FFFFFF) | 105 | #define SCU_IO_REQUEST_MAX_SGE_SIZE (0x00FFFFFF) |
174 | #define SCU_IO_REQUEST_MAX_TRANSFER_LENGTH (0x00FFFFFF) | 106 | #define SCU_IO_REQUEST_MAX_TRANSFER_LENGTH (0x00FFFFFF) |
175 | 107 | ||
176 | /* | 108 | static inline void check_sizes(void) |
177 | * Determine the size of the unsolicited frame array including | 109 | { |
178 | * unused buffers. */ | 110 | BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_EVENTS); |
179 | #if SCU_UNSOLICITED_FRAME_COUNT <= SCU_MIN_UF_TABLE_ENTRIES | 111 | BUILD_BUG_ON(SCU_MAX_UNSOLICITED_FRAMES <= 8); |
180 | #define SCU_UNSOLICITED_FRAME_CONTROL_ARRAY_SIZE SCU_MIN_UF_TABLE_ENTRIES | 112 | BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_UNSOLICITED_FRAMES); |
181 | #else | 113 | BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_COMPLETION_QUEUE_ENTRIES); |
182 | #define SCU_UNSOLICITED_FRAME_CONTROL_ARRAY_SIZE SCU_MAX_UNSOLICITED_FRAMES | 114 | BUILD_BUG_ON(SCU_MAX_UNSOLICITED_FRAMES > SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES); |
183 | #endif /* SCU_UNSOLICITED_FRAME_COUNT <= SCU_MIN_UF_TABLE_ENTRIES */ | 115 | } |
184 | 116 | ||
185 | /** | 117 | /** |
186 | * enum sci_status - This is the general return status enumeration for non-IO, | 118 | * enum sci_status - This is the general return status enumeration for non-IO, |