2 * Copyright (c) 2008 Yahoo!, Inc.
4 * Written by: John Baldwin <jhb@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the author nor the names of any co-contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * LSI MPT-Fusion Host Adapter FreeBSD userland interface
32 * $FreeBSD: src/sys/dev/mps/mps_ioctl.h,v 1.3 2012/01/26 18:17:21 ken Exp $
35 * Copyright (c) 2011 LSI Corp.
36 * All rights reserved.
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
47 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * LSI MPT-Fusion Host Adapter FreeBSD
61 * $FreeBSD: src/sys/dev/mps/mps_ioctl.h,v 1.3 2012/01/26 18:17:21 ken Exp $
67 #include <sys/ioccom.h>
69 #include <dev/raid/mps/mpi/mpi2_type.h>
70 #include <dev/raid/mps/mpi/mpi2.h>
71 #include <dev/raid/mps/mpi/mpi2_cnfg.h>
72 #include <dev/raid/mps/mpi/mpi2_sas.h>
75 * For the read header requests, the header should include the page
76 * type or extended page type, page number, and page version. The
77 * buffer and length are unused. The completed header is returned in
78 * the 'header' member.
80 * For the read page and write page requests, 'buf' should point to a
81 * buffer of 'len' bytes which holds the entire page (including the
84 * All requests specify the page address in 'page_address'.
86 struct mps_cfg_page_req
{
87 MPI2_CONFIG_PAGE_HEADER header
;
88 uint32_t page_address
;
94 struct mps_ext_cfg_page_req
{
95 MPI2_CONFIG_EXTENDED_PAGE_HEADER header
;
96 uint32_t page_address
;
102 struct mps_raid_action
{
106 uint8_t phys_disk_num
;
107 uint32_t action_data_word
;
110 uint32_t volume_status
;
111 uint32_t action_data
[4];
112 uint16_t action_status
;
117 struct mps_usr_command
{
127 typedef struct mps_pci_bits
131 uint32_t DeviceNumber
:5;
132 uint32_t FunctionNumber
:3;
133 uint32_t BusNumber
:24;
137 uint32_t PciSegmentId
;
141 * The following is the MPSIOCTL_GET_ADAPTER_DATA data structure. This data
142 * structure is setup so that we hopefully are properly aligned for both
143 * 32-bit and 64-bit mode applications.
145 * Adapter Type - Value = 4 = SCSI Protocol through SAS-2 adapter
147 * MPI Port Number - The PCI Function number for this device
149 * PCI Device HW Id - The PCI device number for this device
152 #define MPSIOCTL_ADAPTER_TYPE_SAS2 4
153 #define MPSIOCTL_ADAPTER_TYPE_SAS2_SSS6200 5
154 typedef struct mps_adapter_data
156 uint32_t StructureLength
;
157 uint32_t AdapterType
;
158 uint32_t MpiPortNumber
;
159 uint32_t PCIDeviceHwId
;
160 uint32_t PCIDeviceHwRev
;
161 uint32_t SubSystemId
;
162 uint32_t SubsystemVendorId
;
164 uint32_t MpiFirmwareVersion
;
165 uint32_t BiosVersion
;
166 uint8_t DriverVersion
[32];
170 mps_pci_bits_t PciInformation
;
171 } mps_adapter_data_t
;
174 typedef struct mps_update_flash
177 uint32_t ImageChecksum
;
178 uint32_t ImageOffset
;
181 } mps_update_flash_t
;
184 #define MPS_PASS_THRU_DIRECTION_NONE 0
185 #define MPS_PASS_THRU_DIRECTION_READ 1
186 #define MPS_PASS_THRU_DIRECTION_WRITE 2
187 #define MPS_PASS_THRU_DIRECTION_BOTH 3
189 typedef struct mps_pass_thru
194 uint32_t RequestSize
;
197 uint32_t DataDirection
;
199 uint32_t DataOutSize
;
205 * Event queue defines
207 #define MPS_EVENT_QUEUE_SIZE (50) /* Max Events stored in driver */
208 #define MPS_MAX_EVENT_DATA_LENGTH (48) /* Size of each event in Dwords */
210 typedef struct mps_event_query
217 typedef struct mps_event_enable
220 } mps_event_enable_t
;
223 * Event record entry for ioctl.
225 typedef struct mps_event_entry
229 uint32_t Data
[MPS_MAX_EVENT_DATA_LENGTH
];
232 typedef struct mps_event_report
236 } mps_event_report_t
;
239 typedef struct mps_pci_info
242 uint8_t DeviceNumber
;
243 uint8_t FunctionNumber
;
244 uint16_t InterruptVector
;
245 uint8_t PciHeader
[256];
249 typedef struct mps_diag_action
253 uint64_t PtrDiagAction
;
257 #define MPS_FW_DIAGNOSTIC_UID_NOT_FOUND (0xFF)
259 #define MPS_FW_DIAG_NEW (0x806E6577)
261 #define MPS_FW_DIAG_TYPE_REGISTER (0x00000001)
262 #define MPS_FW_DIAG_TYPE_UNREGISTER (0x00000002)
263 #define MPS_FW_DIAG_TYPE_QUERY (0x00000003)
264 #define MPS_FW_DIAG_TYPE_READ_BUFFER (0x00000004)
265 #define MPS_FW_DIAG_TYPE_RELEASE (0x00000005)
267 #define MPS_FW_DIAG_INVALID_UID (0x00000000)
269 #define MPS_DIAG_SUCCESS 0
270 #define MPS_DIAG_FAILURE 1
272 #define MPS_FW_DIAG_ERROR_SUCCESS (0x00000000)
273 #define MPS_FW_DIAG_ERROR_FAILURE (0x00000001)
274 #define MPS_FW_DIAG_ERROR_INVALID_PARAMETER (0x00000002)
275 #define MPS_FW_DIAG_ERROR_POST_FAILED (0x00000010)
276 #define MPS_FW_DIAG_ERROR_INVALID_UID (0x00000011)
277 #define MPS_FW_DIAG_ERROR_RELEASE_FAILED (0x00000012)
278 #define MPS_FW_DIAG_ERROR_NO_BUFFER (0x00000013)
279 #define MPS_FW_DIAG_ERROR_ALREADY_RELEASED (0x00000014)
282 typedef struct mps_fw_diag_register
284 uint8_t ExtendedType
;
286 uint16_t ApplicationFlags
;
287 uint32_t DiagnosticFlags
;
288 uint32_t ProductSpecific
[23];
289 uint32_t RequestedBufferSize
;
291 } mps_fw_diag_register_t
;
293 typedef struct mps_fw_diag_unregister
296 } mps_fw_diag_unregister_t
;
298 #define MPS_FW_DIAG_FLAG_APP_OWNED (0x0001)
299 #define MPS_FW_DIAG_FLAG_BUFFER_VALID (0x0002)
300 #define MPS_FW_DIAG_FLAG_FW_BUFFER_ACCESS (0x0004)
302 typedef struct mps_fw_diag_query
304 uint8_t ExtendedType
;
306 uint16_t ApplicationFlags
;
307 uint32_t DiagnosticFlags
;
308 uint32_t ProductSpecific
[23];
309 uint32_t TotalBufferSize
;
310 uint32_t DriverAddedBufferSize
;
312 } mps_fw_diag_query_t
;
314 typedef struct mps_fw_diag_release
317 } mps_fw_diag_release_t
;
319 #define MPS_FW_DIAG_FLAG_REREGISTER (0x0001)
320 #define MPS_FW_DIAG_FLAG_FORCE_RELEASE (0x0002)
322 typedef struct mps_diag_read_buffer
327 uint32_t StartingOffset
;
328 uint32_t BytesToRead
;
330 uint64_t PtrDataBuffer
;
331 } mps_diag_read_buffer_t
;
336 #define REG_IO_READ 1
337 #define REG_IO_WRITE 2
338 #define REG_MEM_READ 3
339 #define REG_MEM_WRITE 4
341 typedef struct mps_reg_access
348 typedef struct mps_btdh_mapping
354 } mps_btdh_mapping_t
;
356 #define MPSIO_MPS_COMMAND_FLAG_VERBOSE 0x01
357 #define MPSIO_MPS_COMMAND_FLAG_DEBUG 0x02
358 #define MPSIO_READ_CFG_HEADER _IOWR('M', 200, struct mps_cfg_page_req)
359 #define MPSIO_READ_CFG_PAGE _IOWR('M', 201, struct mps_cfg_page_req)
360 #define MPSIO_READ_EXT_CFG_HEADER _IOWR('M', 202, struct mps_ext_cfg_page_req)
361 #define MPSIO_READ_EXT_CFG_PAGE _IOWR('M', 203, struct mps_ext_cfg_page_req)
362 #define MPSIO_WRITE_CFG_PAGE _IOWR('M', 204, struct mps_cfg_page_req)
363 #define MPSIO_RAID_ACTION _IOWR('M', 205, struct mps_raid_action)
364 #define MPSIO_MPS_COMMAND _IOWR('M', 210, struct mps_usr_command)
366 #define MPTIOCTL ('I')
367 #define MPTIOCTL_GET_ADAPTER_DATA _IOWR(MPTIOCTL, 1,\
368 struct mps_adapter_data)
369 #define MPTIOCTL_UPDATE_FLASH _IOWR(MPTIOCTL, 2,\
370 struct mps_update_flash)
371 #define MPTIOCTL_RESET_ADAPTER _IO(MPTIOCTL, 3)
372 #define MPTIOCTL_PASS_THRU _IOWR(MPTIOCTL, 4,\
373 struct mps_pass_thru)
374 #define MPTIOCTL_EVENT_QUERY _IOWR(MPTIOCTL, 5,\
375 struct mps_event_query)
376 #define MPTIOCTL_EVENT_ENABLE _IOWR(MPTIOCTL, 6,\
377 struct mps_event_enable)
378 #define MPTIOCTL_EVENT_REPORT _IOWR(MPTIOCTL, 7,\
379 struct mps_event_report)
380 #define MPTIOCTL_GET_PCI_INFO _IOWR(MPTIOCTL, 8,\
382 #define MPTIOCTL_DIAG_ACTION _IOWR(MPTIOCTL, 9,\
383 struct mps_diag_action)
384 #define MPTIOCTL_REG_ACCESS _IOWR(MPTIOCTL, 10,\
385 struct mps_reg_access)
386 #define MPTIOCTL_BTDH_MAPPING _IOWR(MPTIOCTL, 11,\
387 struct mps_btdh_mapping)
389 #endif /* !_MPS_IOCTL_H_ */