![]() |
|
|||
0001 /* 0002 * Management Module Support for MPT (Message Passing Technology) based 0003 * controllers 0004 * 0005 * This code is based on drivers/scsi/mpt3sas/mpt3sas_ctl.h 0006 * Copyright (C) 2012-2014 LSI Corporation 0007 * Copyright (C) 2013-2014 Avago Technologies 0008 * (mailto: MPT-FusionLinux.pdl@avagotech.com) 0009 * 0010 * This program is free software; you can redistribute it and/or 0011 * modify it under the terms of the GNU General Public License 0012 * as published by the Free Software Foundation; either version 2 0013 * of the License, or (at your option) any later version. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU General Public License for more details. 0019 * 0020 * NO WARRANTY 0021 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 0022 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 0023 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 0024 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 0025 * solely responsible for determining the appropriateness of using and 0026 * distributing the Program and assumes all risks associated with its 0027 * exercise of rights under this Agreement, including but not limited to 0028 * the risks and costs of program errors, damage to or loss of data, 0029 * programs or equipment, and unavailability or interruption of operations. 0030 0031 * DISCLAIMER OF LIABILITY 0032 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 0033 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 0034 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 0035 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 0036 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 0037 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 0038 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 0039 0040 * You should have received a copy of the GNU General Public License 0041 * along with this program; if not, write to the Free Software 0042 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 0043 * USA. 0044 */ 0045 0046 #ifndef MPT3SAS_CTL_H_INCLUDED 0047 #define MPT3SAS_CTL_H_INCLUDED 0048 0049 #ifdef __KERNEL__ 0050 #include <linux/miscdevice.h> 0051 #endif 0052 0053 #include "mpt3sas_base.h" 0054 0055 #ifndef MPT2SAS_MINOR 0056 #define MPT2SAS_MINOR (MPT_MINOR + 1) 0057 #endif 0058 #ifndef MPT3SAS_MINOR 0059 #define MPT3SAS_MINOR (MPT_MINOR + 2) 0060 #endif 0061 #define MPT2SAS_DEV_NAME "mpt2ctl" 0062 #define MPT3SAS_DEV_NAME "mpt3ctl" 0063 #define MPT3_MAGIC_NUMBER 'L' 0064 #define MPT3_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */ 0065 0066 /** 0067 * IOCTL opcodes 0068 */ 0069 #define MPT3IOCINFO _IOWR(MPT3_MAGIC_NUMBER, 17, \ 0070 struct mpt3_ioctl_iocinfo) 0071 #define MPT3COMMAND _IOWR(MPT3_MAGIC_NUMBER, 20, \ 0072 struct mpt3_ioctl_command) 0073 #ifdef CONFIG_COMPAT 0074 #define MPT3COMMAND32 _IOWR(MPT3_MAGIC_NUMBER, 20, \ 0075 struct mpt3_ioctl_command32) 0076 #endif 0077 #define MPT3EVENTQUERY _IOWR(MPT3_MAGIC_NUMBER, 21, \ 0078 struct mpt3_ioctl_eventquery) 0079 #define MPT3EVENTENABLE _IOWR(MPT3_MAGIC_NUMBER, 22, \ 0080 struct mpt3_ioctl_eventenable) 0081 #define MPT3EVENTREPORT _IOWR(MPT3_MAGIC_NUMBER, 23, \ 0082 struct mpt3_ioctl_eventreport) 0083 #define MPT3HARDRESET _IOWR(MPT3_MAGIC_NUMBER, 24, \ 0084 struct mpt3_ioctl_diag_reset) 0085 #define MPT3BTDHMAPPING _IOWR(MPT3_MAGIC_NUMBER, 31, \ 0086 struct mpt3_ioctl_btdh_mapping) 0087 0088 /* diag buffer support */ 0089 #define MPT3DIAGREGISTER _IOWR(MPT3_MAGIC_NUMBER, 26, \ 0090 struct mpt3_diag_register) 0091 #define MPT3DIAGRELEASE _IOWR(MPT3_MAGIC_NUMBER, 27, \ 0092 struct mpt3_diag_release) 0093 #define MPT3DIAGUNREGISTER _IOWR(MPT3_MAGIC_NUMBER, 28, \ 0094 struct mpt3_diag_unregister) 0095 #define MPT3DIAGQUERY _IOWR(MPT3_MAGIC_NUMBER, 29, \ 0096 struct mpt3_diag_query) 0097 #define MPT3DIAGREADBUFFER _IOWR(MPT3_MAGIC_NUMBER, 30, \ 0098 struct mpt3_diag_read_buffer) 0099 #define MPT3ADDNLDIAGQUERY _IOWR(MPT3_MAGIC_NUMBER, 32, \ 0100 struct mpt3_addnl_diag_query) 0101 0102 /* Trace Buffer default UniqueId */ 0103 #define MPT2DIAGBUFFUNIQUEID (0x07075900) 0104 #define MPT3DIAGBUFFUNIQUEID (0x4252434D) 0105 0106 /* UID not found */ 0107 #define MPT3_DIAG_UID_NOT_FOUND (0xFF) 0108 0109 0110 /** 0111 * struct mpt3_ioctl_header - main header structure 0112 * @ioc_number - IOC unit number 0113 * @port_number - IOC port number 0114 * @max_data_size - maximum number bytes to transfer on read 0115 */ 0116 struct mpt3_ioctl_header { 0117 uint32_t ioc_number; 0118 uint32_t port_number; 0119 uint32_t max_data_size; 0120 }; 0121 0122 /** 0123 * struct mpt3_ioctl_diag_reset - diagnostic reset 0124 * @hdr - generic header 0125 */ 0126 struct mpt3_ioctl_diag_reset { 0127 struct mpt3_ioctl_header hdr; 0128 }; 0129 0130 0131 /** 0132 * struct mpt3_ioctl_pci_info - pci device info 0133 * @device - pci device id 0134 * @function - pci function id 0135 * @bus - pci bus id 0136 * @segment_id - pci segment id 0137 */ 0138 struct mpt3_ioctl_pci_info { 0139 union { 0140 struct { 0141 uint32_t device:5; 0142 uint32_t function:3; 0143 uint32_t bus:24; 0144 } bits; 0145 uint32_t word; 0146 } u; 0147 uint32_t segment_id; 0148 }; 0149 0150 0151 #define MPT2_IOCTL_INTERFACE_SCSI (0x00) 0152 #define MPT2_IOCTL_INTERFACE_FC (0x01) 0153 #define MPT2_IOCTL_INTERFACE_FC_IP (0x02) 0154 #define MPT2_IOCTL_INTERFACE_SAS (0x03) 0155 #define MPT2_IOCTL_INTERFACE_SAS2 (0x04) 0156 #define MPT2_IOCTL_INTERFACE_SAS2_SSS6200 (0x05) 0157 #define MPT3_IOCTL_INTERFACE_SAS3 (0x06) 0158 #define MPT3_IOCTL_INTERFACE_SAS35 (0x07) 0159 #define MPT2_IOCTL_VERSION_LENGTH (32) 0160 0161 /** 0162 * struct mpt3_ioctl_iocinfo - generic controller info 0163 * @hdr - generic header 0164 * @adapter_type - type of adapter (spi, fc, sas) 0165 * @port_number - port number 0166 * @pci_id - PCI Id 0167 * @hw_rev - hardware revision 0168 * @sub_system_device - PCI subsystem Device ID 0169 * @sub_system_vendor - PCI subsystem Vendor ID 0170 * @rsvd0 - reserved 0171 * @firmware_version - firmware version 0172 * @bios_version - BIOS version 0173 * @driver_version - driver version - 32 ASCII characters 0174 * @rsvd1 - reserved 0175 * @scsi_id - scsi id of adapter 0 0176 * @rsvd2 - reserved 0177 * @pci_information - pci info (2nd revision) 0178 */ 0179 struct mpt3_ioctl_iocinfo { 0180 struct mpt3_ioctl_header hdr; 0181 uint32_t adapter_type; 0182 uint32_t port_number; 0183 uint32_t pci_id; 0184 uint32_t hw_rev; 0185 uint32_t subsystem_device; 0186 uint32_t subsystem_vendor; 0187 uint32_t rsvd0; 0188 uint32_t firmware_version; 0189 uint32_t bios_version; 0190 uint8_t driver_version[MPT2_IOCTL_VERSION_LENGTH]; 0191 uint8_t rsvd1; 0192 uint8_t scsi_id; 0193 uint16_t rsvd2; 0194 struct mpt3_ioctl_pci_info pci_information; 0195 }; 0196 0197 0198 /* number of event log entries */ 0199 #define MPT3SAS_CTL_EVENT_LOG_SIZE (200) 0200 0201 /** 0202 * struct mpt3_ioctl_eventquery - query event count and type 0203 * @hdr - generic header 0204 * @event_entries - number of events returned by get_event_report 0205 * @rsvd - reserved 0206 * @event_types - type of events currently being captured 0207 */ 0208 struct mpt3_ioctl_eventquery { 0209 struct mpt3_ioctl_header hdr; 0210 uint16_t event_entries; 0211 uint16_t rsvd; 0212 uint32_t event_types[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; 0213 }; 0214 0215 /** 0216 * struct mpt3_ioctl_eventenable - enable/disable event capturing 0217 * @hdr - generic header 0218 * @event_types - toggle off/on type of events to be captured 0219 */ 0220 struct mpt3_ioctl_eventenable { 0221 struct mpt3_ioctl_header hdr; 0222 uint32_t event_types[4]; 0223 }; 0224 0225 #define MPT3_EVENT_DATA_SIZE (192) 0226 /** 0227 * struct MPT3_IOCTL_EVENTS - 0228 * @event - the event that was reported 0229 * @context - unique value for each event assigned by driver 0230 * @data - event data returned in fw reply message 0231 */ 0232 struct MPT3_IOCTL_EVENTS { 0233 uint32_t event; 0234 uint32_t context; 0235 uint8_t data[MPT3_EVENT_DATA_SIZE]; 0236 }; 0237 0238 /** 0239 * struct mpt3_ioctl_eventreport - returing event log 0240 * @hdr - generic header 0241 * @event_data - (see struct MPT3_IOCTL_EVENTS) 0242 */ 0243 struct mpt3_ioctl_eventreport { 0244 struct mpt3_ioctl_header hdr; 0245 struct MPT3_IOCTL_EVENTS event_data[1]; 0246 }; 0247 0248 /** 0249 * struct mpt3_ioctl_command - generic mpt firmware passthru ioctl 0250 * @hdr - generic header 0251 * @timeout - command timeout in seconds. (if zero then use driver default 0252 * value). 0253 * @reply_frame_buf_ptr - reply location 0254 * @data_in_buf_ptr - destination for read 0255 * @data_out_buf_ptr - data source for write 0256 * @sense_data_ptr - sense data location 0257 * @max_reply_bytes - maximum number of reply bytes to be sent to app. 0258 * @data_in_size - number bytes for data transfer in (read) 0259 * @data_out_size - number bytes for data transfer out (write) 0260 * @max_sense_bytes - maximum number of bytes for auto sense buffers 0261 * @data_sge_offset - offset in words from the start of the request message to 0262 * the first SGL 0263 * @mf[1]; 0264 */ 0265 struct mpt3_ioctl_command { 0266 struct mpt3_ioctl_header hdr; 0267 uint32_t timeout; 0268 void __user *reply_frame_buf_ptr; 0269 void __user *data_in_buf_ptr; 0270 void __user *data_out_buf_ptr; 0271 void __user *sense_data_ptr; 0272 uint32_t max_reply_bytes; 0273 uint32_t data_in_size; 0274 uint32_t data_out_size; 0275 uint32_t max_sense_bytes; 0276 uint32_t data_sge_offset; 0277 uint8_t mf[1]; 0278 }; 0279 0280 #ifdef CONFIG_COMPAT 0281 struct mpt3_ioctl_command32 { 0282 struct mpt3_ioctl_header hdr; 0283 uint32_t timeout; 0284 uint32_t reply_frame_buf_ptr; 0285 uint32_t data_in_buf_ptr; 0286 uint32_t data_out_buf_ptr; 0287 uint32_t sense_data_ptr; 0288 uint32_t max_reply_bytes; 0289 uint32_t data_in_size; 0290 uint32_t data_out_size; 0291 uint32_t max_sense_bytes; 0292 uint32_t data_sge_offset; 0293 uint8_t mf[1]; 0294 }; 0295 #endif 0296 0297 /** 0298 * struct mpt3_ioctl_btdh_mapping - mapping info 0299 * @hdr - generic header 0300 * @id - target device identification number 0301 * @bus - SCSI bus number that the target device exists on 0302 * @handle - device handle for the target device 0303 * @rsvd - reserved 0304 * 0305 * To obtain a bus/id the application sets 0306 * handle to valid handle, and bus/id to 0xFFFF. 0307 * 0308 * To obtain the device handle the application sets 0309 * bus/id valid value, and the handle to 0xFFFF. 0310 */ 0311 struct mpt3_ioctl_btdh_mapping { 0312 struct mpt3_ioctl_header hdr; 0313 uint32_t id; 0314 uint32_t bus; 0315 uint16_t handle; 0316 uint16_t rsvd; 0317 }; 0318 0319 0320 0321 /* application flags for mpt3_diag_register, mpt3_diag_query */ 0322 #define MPT3_APP_FLAGS_APP_OWNED (0x0001) 0323 #define MPT3_APP_FLAGS_BUFFER_VALID (0x0002) 0324 #define MPT3_APP_FLAGS_FW_BUFFER_ACCESS (0x0004) 0325 #define MPT3_APP_FLAGS_DYNAMIC_BUFFER_ALLOC (0x0008) 0326 0327 /* flags for mpt3_diag_read_buffer */ 0328 #define MPT3_FLAGS_REREGISTER (0x0001) 0329 0330 #define MPT3_PRODUCT_SPECIFIC_DWORDS 23 0331 0332 /** 0333 * struct mpt3_diag_register - application register with driver 0334 * @hdr - generic header 0335 * @reserved - 0336 * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 0337 * @application_flags - misc flags 0338 * @diagnostic_flags - specifies flags affecting command processing 0339 * @product_specific - product specific information 0340 * @requested_buffer_size - buffers size in bytes 0341 * @unique_id - tag specified by application that is used to signal ownership 0342 * of the buffer. 0343 * 0344 * This will allow the driver to setup any required buffers that will be 0345 * needed by firmware to communicate with the driver. 0346 */ 0347 struct mpt3_diag_register { 0348 struct mpt3_ioctl_header hdr; 0349 uint8_t reserved; 0350 uint8_t buffer_type; 0351 uint16_t application_flags; 0352 uint32_t diagnostic_flags; 0353 uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 0354 uint32_t requested_buffer_size; 0355 uint32_t unique_id; 0356 }; 0357 0358 /** 0359 * struct mpt3_diag_unregister - application unregister with driver 0360 * @hdr - generic header 0361 * @unique_id - tag uniquely identifies the buffer to be unregistered 0362 * 0363 * This will allow the driver to cleanup any memory allocated for diag 0364 * messages and to free up any resources. 0365 */ 0366 struct mpt3_diag_unregister { 0367 struct mpt3_ioctl_header hdr; 0368 uint32_t unique_id; 0369 }; 0370 0371 /** 0372 * struct mpt3_diag_query - query relevant info associated with diag buffers 0373 * @hdr - generic header 0374 * @reserved - 0375 * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 0376 * @application_flags - misc flags 0377 * @diagnostic_flags - specifies flags affecting command processing 0378 * @product_specific - product specific information 0379 * @total_buffer_size - diag buffer size in bytes 0380 * @driver_added_buffer_size - size of extra space appended to end of buffer 0381 * @unique_id - unique id associated with this buffer. 0382 * 0383 * The application will send only buffer_type and unique_id. Driver will 0384 * inspect unique_id first, if valid, fill in all the info. If unique_id is 0385 * 0x00, the driver will return info specified by Buffer Type. 0386 */ 0387 struct mpt3_diag_query { 0388 struct mpt3_ioctl_header hdr; 0389 uint8_t reserved; 0390 uint8_t buffer_type; 0391 uint16_t application_flags; 0392 uint32_t diagnostic_flags; 0393 uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 0394 uint32_t total_buffer_size; 0395 uint32_t driver_added_buffer_size; 0396 uint32_t unique_id; 0397 }; 0398 0399 /** 0400 * struct mpt3_diag_release - request to send Diag Release Message to firmware 0401 * @hdr - generic header 0402 * @unique_id - tag uniquely identifies the buffer to be released 0403 * 0404 * This allows ownership of the specified buffer to returned to the driver, 0405 * allowing an application to read the buffer without fear that firmware is 0406 * overwriting information in the buffer. 0407 */ 0408 struct mpt3_diag_release { 0409 struct mpt3_ioctl_header hdr; 0410 uint32_t unique_id; 0411 }; 0412 0413 /** 0414 * struct mpt3_diag_read_buffer - request for copy of the diag buffer 0415 * @hdr - generic header 0416 * @status - 0417 * @reserved - 0418 * @flags - misc flags 0419 * @starting_offset - starting offset within drivers buffer where to start 0420 * reading data at into the specified application buffer 0421 * @bytes_to_read - number of bytes to copy from the drivers buffer into the 0422 * application buffer starting at starting_offset. 0423 * @unique_id - unique id associated with this buffer. 0424 * @diagnostic_data - data payload 0425 */ 0426 struct mpt3_diag_read_buffer { 0427 struct mpt3_ioctl_header hdr; 0428 uint8_t status; 0429 uint8_t reserved; 0430 uint16_t flags; 0431 uint32_t starting_offset; 0432 uint32_t bytes_to_read; 0433 uint32_t unique_id; 0434 uint32_t diagnostic_data[1]; 0435 }; 0436 0437 /** 0438 * struct mpt3_addnl_diag_query - diagnostic buffer release reason 0439 * @hdr - generic header 0440 * @unique_id - unique id associated with this buffer. 0441 * @rel_query - release query. 0442 * @reserved2 0443 */ 0444 struct mpt3_addnl_diag_query { 0445 struct mpt3_ioctl_header hdr; 0446 uint32_t unique_id; 0447 struct htb_rel_query rel_query; 0448 uint32_t reserved2[2]; 0449 }; 0450 0451 #endif /* MPT3SAS_CTL_H_INCLUDED */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |