aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_ctl.h
diff options
context:
space:
mode:
authorEric Moore <eric.moore@lsi.com>2009-03-09 03:21:12 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-03-13 17:08:49 -0400
commit635374e7eb110e80d9918b8611198edd56a32975 (patch)
tree1c96f9dac921b0b26ee4e93ecd9c79a96fbc7ba6 /drivers/scsi/mpt2sas/mpt2sas_ctl.h
parentdec3f95959bff957f5bcbf16c2a2823f7e33d1e7 (diff)
[SCSI] mpt2sas v00.100.11.15
* This is new scsi lld device driver from LSI supporting the SAS 2.0 standard. I have split patchs by filename. * Here is list of new 6gb host controllers: LSI SAS2004 LSI SAS2008 LSI SAS2108 LSI SAS2116 * Here are the changes in the 4th posting of this patch set: (1) fix compile errors when SCSI_MPT2SAS_LOGGING is not enabled (2) add mpt2sas to the SCSI Mid Layer Makefile (3) append mpt2sas_ to the naming of all non-static functions (4) fix oops for SMP_PASSTHRU (5) doorbell algorithm imported changes from windows driver * Here are the changes in the 3rd posting of this patch set: (1) add readl following writel from the function that disables interrupts (2) replace 0xFFFFFFFFFFFFFFFFULL with ~0ULL (3) when calling pci_enable_msix, only pass one msix entry (instead of 15). (4) remove the "current HW implementation uses..... " comment in the sources (5) merged bug fix for SIGIO/POLLIN notifcation; reported by the storlib team. * Here are the changes in the 2nd posting of this patch set: (1) use little endian types in the mpi headers (2) merged in bug fix's from inhouse drivers. Signed-off-by: Eric Moore <eric.moore@lsi.com> Tested-by: peter Bogdanovic <pbog@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_ctl.h')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.h416
1 files changed, 416 insertions, 0 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.h b/drivers/scsi/mpt2sas/mpt2sas_ctl.h
new file mode 100644
index 000000000000..dbb6c0cf8889
--- /dev/null
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.h
@@ -0,0 +1,416 @@
1/*
2 * Management Module Support for MPT (Message Passing Technology) based
3 * controllers
4 *
5 * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.h
6 * Copyright (C) 2007-2008 LSI Corporation
7 * (mailto:DL-MPTFusionLinux@lsi.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) 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 * NO WARRANTY
20 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
21 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
22 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
23 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
24 * solely responsible for determining the appropriateness of using and
25 * distributing the Program and assumes all risks associated with its
26 * exercise of rights under this Agreement, including but not limited to
27 * the risks and costs of program errors, damage to or loss of data,
28 * programs or equipment, and unavailability or interruption of operations.
29
30 * DISCLAIMER OF LIABILITY
31 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
32 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
34 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
35 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
36 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
37 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
38
39 * You should have received a copy of the GNU General Public License
40 * along with this program; if not, write to the Free Software
41 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
42 * USA.
43 */
44
45#ifndef MPT2SAS_CTL_H_INCLUDED
46#define MPT2SAS_CTL_H_INCLUDED
47
48#ifdef __KERNEL__
49#include <linux/miscdevice.h>
50#endif
51
52#define MPT2SAS_DEV_NAME "mpt2ctl"
53#define MPT2_MAGIC_NUMBER 'm'
54#define MPT2_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */
55
56/**
57 * IOCTL opcodes
58 */
59#define MPT2IOCINFO _IOWR(MPT2_MAGIC_NUMBER, 17, \
60 struct mpt2_ioctl_iocinfo)
61#define MPT2COMMAND _IOWR(MPT2_MAGIC_NUMBER, 20, \
62 struct mpt2_ioctl_command)
63#ifdef CONFIG_COMPAT
64#define MPT2COMMAND32 _IOWR(MPT2_MAGIC_NUMBER, 20, \
65 struct mpt2_ioctl_command32)
66#endif
67#define MPT2EVENTQUERY _IOWR(MPT2_MAGIC_NUMBER, 21, \
68 struct mpt2_ioctl_eventquery)
69#define MPT2EVENTENABLE _IOWR(MPT2_MAGIC_NUMBER, 22, \
70 struct mpt2_ioctl_eventenable)
71#define MPT2EVENTREPORT _IOWR(MPT2_MAGIC_NUMBER, 23, \
72 struct mpt2_ioctl_eventreport)
73#define MPT2HARDRESET _IOWR(MPT2_MAGIC_NUMBER, 24, \
74 struct mpt2_ioctl_diag_reset)
75#define MPT2BTDHMAPPING _IOWR(MPT2_MAGIC_NUMBER, 31, \
76 struct mpt2_ioctl_btdh_mapping)
77
78/* diag buffer support */
79#define MPT2DIAGREGISTER _IOWR(MPT2_MAGIC_NUMBER, 26, \
80 struct mpt2_diag_register)
81#define MPT2DIAGRELEASE _IOWR(MPT2_MAGIC_NUMBER, 27, \
82 struct mpt2_diag_release)
83#define MPT2DIAGUNREGISTER _IOWR(MPT2_MAGIC_NUMBER, 28, \
84 struct mpt2_diag_unregister)
85#define MPT2DIAGQUERY _IOWR(MPT2_MAGIC_NUMBER, 29, \
86 struct mpt2_diag_query)
87#define MPT2DIAGREADBUFFER _IOWR(MPT2_MAGIC_NUMBER, 30, \
88 struct mpt2_diag_read_buffer)
89
90/**
91 * struct mpt2_ioctl_header - main header structure
92 * @ioc_number - IOC unit number
93 * @port_number - IOC port number
94 * @max_data_size - maximum number bytes to transfer on read
95 */
96struct mpt2_ioctl_header {
97 uint32_t ioc_number;
98 uint32_t port_number;
99 uint32_t max_data_size;
100};
101
102/**
103 * struct mpt2_ioctl_diag_reset - diagnostic reset
104 * @hdr - generic header
105 */
106struct mpt2_ioctl_diag_reset {
107 struct mpt2_ioctl_header hdr;
108};
109
110
111/**
112 * struct mpt2_ioctl_pci_info - pci device info
113 * @device - pci device id
114 * @function - pci function id
115 * @bus - pci bus id
116 * @segment_id - pci segment id
117 */
118struct mpt2_ioctl_pci_info {
119 union {
120 struct {
121 uint32_t device:5;
122 uint32_t function:3;
123 uint32_t bus:24;
124 } bits;
125 uint32_t word;
126 } u;
127 uint32_t segment_id;
128};
129
130
131#define MPT2_IOCTL_INTERFACE_SCSI (0x00)
132#define MPT2_IOCTL_INTERFACE_FC (0x01)
133#define MPT2_IOCTL_INTERFACE_FC_IP (0x02)
134#define MPT2_IOCTL_INTERFACE_SAS (0x03)
135#define MPT2_IOCTL_INTERFACE_SAS2 (0x04)
136#define MPT2_IOCTL_VERSION_LENGTH (32)
137
138/**
139 * struct mpt2_ioctl_iocinfo - generic controller info
140 * @hdr - generic header
141 * @adapter_type - type of adapter (spi, fc, sas)
142 * @port_number - port number
143 * @pci_id - PCI Id
144 * @hw_rev - hardware revision
145 * @sub_system_device - PCI subsystem Device ID
146 * @sub_system_vendor - PCI subsystem Vendor ID
147 * @rsvd0 - reserved
148 * @firmware_version - firmware version
149 * @bios_version - BIOS version
150 * @driver_version - driver version - 32 ASCII characters
151 * @rsvd1 - reserved
152 * @scsi_id - scsi id of adapter 0
153 * @rsvd2 - reserved
154 * @pci_information - pci info (2nd revision)
155 */
156struct mpt2_ioctl_iocinfo {
157 struct mpt2_ioctl_header hdr;
158 uint32_t adapter_type;
159 uint32_t port_number;
160 uint32_t pci_id;
161 uint32_t hw_rev;
162 uint32_t subsystem_device;
163 uint32_t subsystem_vendor;
164 uint32_t rsvd0;
165 uint32_t firmware_version;
166 uint32_t bios_version;
167 uint8_t driver_version[MPT2_IOCTL_VERSION_LENGTH];
168 uint8_t rsvd1;
169 uint8_t scsi_id;
170 uint16_t rsvd2;
171 struct mpt2_ioctl_pci_info pci_information;
172};
173
174
175/* number of event log entries */
176#define MPT2SAS_CTL_EVENT_LOG_SIZE (50)
177
178/**
179 * struct mpt2_ioctl_eventquery - query event count and type
180 * @hdr - generic header
181 * @event_entries - number of events returned by get_event_report
182 * @rsvd - reserved
183 * @event_types - type of events currently being captured
184 */
185struct mpt2_ioctl_eventquery {
186 struct mpt2_ioctl_header hdr;
187 uint16_t event_entries;
188 uint16_t rsvd;
189 uint32_t event_types[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
190};
191
192/**
193 * struct mpt2_ioctl_eventenable - enable/disable event capturing
194 * @hdr - generic header
195 * @event_types - toggle off/on type of events to be captured
196 */
197struct mpt2_ioctl_eventenable {
198 struct mpt2_ioctl_header hdr;
199 uint32_t event_types[4];
200};
201
202#define MPT2_EVENT_DATA_SIZE (192)
203/**
204 * struct MPT2_IOCTL_EVENTS -
205 * @event - the event that was reported
206 * @context - unique value for each event assigned by driver
207 * @data - event data returned in fw reply message
208 */
209struct MPT2_IOCTL_EVENTS {
210 uint32_t event;
211 uint32_t context;
212 uint8_t data[MPT2_EVENT_DATA_SIZE];
213};
214
215/**
216 * struct mpt2_ioctl_eventreport - returing event log
217 * @hdr - generic header
218 * @event_data - (see struct MPT2_IOCTL_EVENTS)
219 */
220struct mpt2_ioctl_eventreport {
221 struct mpt2_ioctl_header hdr;
222 struct MPT2_IOCTL_EVENTS event_data[1];
223};
224
225/**
226 * struct mpt2_ioctl_command - generic mpt firmware passthru ioclt
227 * @hdr - generic header
228 * @timeout - command timeout in seconds. (if zero then use driver default
229 * value).
230 * @reply_frame_buf_ptr - reply location
231 * @data_in_buf_ptr - destination for read
232 * @data_out_buf_ptr - data source for write
233 * @sense_data_ptr - sense data location
234 * @max_reply_bytes - maximum number of reply bytes to be sent to app.
235 * @data_in_size - number bytes for data transfer in (read)
236 * @data_out_size - number bytes for data transfer out (write)
237 * @max_sense_bytes - maximum number of bytes for auto sense buffers
238 * @data_sge_offset - offset in words from the start of the request message to
239 * the first SGL
240 * @mf[1];
241 */
242struct mpt2_ioctl_command {
243 struct mpt2_ioctl_header hdr;
244 uint32_t timeout;
245 void __user *reply_frame_buf_ptr;
246 void __user *data_in_buf_ptr;
247 void __user *data_out_buf_ptr;
248 void __user *sense_data_ptr;
249 uint32_t max_reply_bytes;
250 uint32_t data_in_size;
251 uint32_t data_out_size;
252 uint32_t max_sense_bytes;
253 uint32_t data_sge_offset;
254 uint8_t mf[1];
255};
256
257#ifdef CONFIG_COMPAT
258struct mpt2_ioctl_command32 {
259 struct mpt2_ioctl_header hdr;
260 uint32_t timeout;
261 uint32_t reply_frame_buf_ptr;
262 uint32_t data_in_buf_ptr;
263 uint32_t data_out_buf_ptr;
264 uint32_t sense_data_ptr;
265 uint32_t max_reply_bytes;
266 uint32_t data_in_size;
267 uint32_t data_out_size;
268 uint32_t max_sense_bytes;
269 uint32_t data_sge_offset;
270 uint8_t mf[1];
271};
272#endif
273
274/**
275 * struct mpt2_ioctl_btdh_mapping - mapping info
276 * @hdr - generic header
277 * @id - target device identification number
278 * @bus - SCSI bus number that the target device exists on
279 * @handle - device handle for the target device
280 * @rsvd - reserved
281 *
282 * To obtain a bus/id the application sets
283 * handle to valid handle, and bus/id to 0xFFFF.
284 *
285 * To obtain the device handle the application sets
286 * bus/id valid value, and the handle to 0xFFFF.
287 */
288struct mpt2_ioctl_btdh_mapping {
289 struct mpt2_ioctl_header hdr;
290 uint32_t id;
291 uint32_t bus;
292 uint16_t handle;
293 uint16_t rsvd;
294};
295
296
297/* status bits for ioc->diag_buffer_status */
298#define MPT2_DIAG_BUFFER_IS_REGISTERED (0x01)
299#define MPT2_DIAG_BUFFER_IS_RELEASED (0x02)
300
301/* application flags for mpt2_diag_register, mpt2_diag_query */
302#define MPT2_APP_FLAGS_APP_OWNED (0x0001)
303#define MPT2_APP_FLAGS_BUFFER_VALID (0x0002)
304#define MPT2_APP_FLAGS_FW_BUFFER_ACCESS (0x0004)
305
306/* flags for mpt2_diag_read_buffer */
307#define MPT2_FLAGS_REREGISTER (0x0001)
308
309#define MPT2_PRODUCT_SPECIFIC_DWORDS 23
310
311/**
312 * struct mpt2_diag_register - application register with driver
313 * @hdr - generic header
314 * @reserved -
315 * @buffer_type - specifies either TRACE or SNAPSHOT
316 * @application_flags - misc flags
317 * @diagnostic_flags - specifies flags affecting command processing
318 * @product_specific - product specific information
319 * @requested_buffer_size - buffers size in bytes
320 * @unique_id - tag specified by application that is used to signal ownership
321 * of the buffer.
322 *
323 * This will allow the driver to setup any required buffers that will be
324 * needed by firmware to communicate with the driver.
325 */
326struct mpt2_diag_register {
327 struct mpt2_ioctl_header hdr;
328 uint8_t reserved;
329 uint8_t buffer_type;
330 uint16_t application_flags;
331 uint32_t diagnostic_flags;
332 uint32_t product_specific[MPT2_PRODUCT_SPECIFIC_DWORDS];
333 uint32_t requested_buffer_size;
334 uint32_t unique_id;
335};
336
337/**
338 * struct mpt2_diag_unregister - application unregister with driver
339 * @hdr - generic header
340 * @unique_id - tag uniquely identifies the buffer to be unregistered
341 *
342 * This will allow the driver to cleanup any memory allocated for diag
343 * messages and to free up any resources.
344 */
345struct mpt2_diag_unregister {
346 struct mpt2_ioctl_header hdr;
347 uint32_t unique_id;
348};
349
350/**
351 * struct mpt2_diag_query - query relevant info associated with diag buffers
352 * @hdr - generic header
353 * @reserved -
354 * @buffer_type - specifies either TRACE or SNAPSHOT
355 * @application_flags - misc flags
356 * @diagnostic_flags - specifies flags affecting command processing
357 * @product_specific - product specific information
358 * @total_buffer_size - diag buffer size in bytes
359 * @driver_added_buffer_size - size of extra space appended to end of buffer
360 * @unique_id - unique id associated with this buffer.
361 *
362 * The application will send only buffer_type and unique_id. Driver will
363 * inspect unique_id first, if valid, fill in all the info. If unique_id is
364 * 0x00, the driver will return info specified by Buffer Type.
365 */
366struct mpt2_diag_query {
367 struct mpt2_ioctl_header hdr;
368 uint8_t reserved;
369 uint8_t buffer_type;
370 uint16_t application_flags;
371 uint32_t diagnostic_flags;
372 uint32_t product_specific[MPT2_PRODUCT_SPECIFIC_DWORDS];
373 uint32_t total_buffer_size;
374 uint32_t driver_added_buffer_size;
375 uint32_t unique_id;
376};
377
378/**
379 * struct mpt2_diag_release - request to send Diag Release Message to firmware
380 * @hdr - generic header
381 * @unique_id - tag uniquely identifies the buffer to be released
382 *
383 * This allows ownership of the specified buffer to returned to the driver,
384 * allowing an application to read the buffer without fear that firmware is
385 * overwritting information in the buffer.
386 */
387struct mpt2_diag_release {
388 struct mpt2_ioctl_header hdr;
389 uint32_t unique_id;
390};
391
392/**
393 * struct mpt2_diag_read_buffer - request for copy of the diag buffer
394 * @hdr - generic header
395 * @status -
396 * @reserved -
397 * @flags - misc flags
398 * @starting_offset - starting offset within drivers buffer where to start
399 * reading data at into the specified application buffer
400 * @bytes_to_read - number of bytes to copy from the drivers buffer into the
401 * application buffer starting at starting_offset.
402 * @unique_id - unique id associated with this buffer.
403 * @diagnostic_data - data payload
404 */
405struct mpt2_diag_read_buffer {
406 struct mpt2_ioctl_header hdr;
407 uint8_t status;
408 uint8_t reserved;
409 uint16_t flags;
410 uint32_t starting_offset;
411 uint32_t bytes_to_read;
412 uint32_t unique_id;
413 uint32_t diagnostic_data[1];
414};
415
416#endif /* MPT2SAS_CTL_H_INCLUDED */