1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Management Module Support for MPT (Message Passing Technology) based 3*4882a593Smuzhiyun * controllers 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * This code is based on drivers/scsi/mpt3sas/mpt3sas_ctl.h 6*4882a593Smuzhiyun * Copyright (C) 2012-2014 LSI Corporation 7*4882a593Smuzhiyun * Copyright (C) 2013-2014 Avago Technologies 8*4882a593Smuzhiyun * (mailto: MPT-FusionLinux.pdl@avagotech.com) 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or 11*4882a593Smuzhiyun * modify it under the terms of the GNU General Public License 12*4882a593Smuzhiyun * as published by the Free Software Foundation; either version 2 13*4882a593Smuzhiyun * of the License, or (at your option) any later version. 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful, 16*4882a593Smuzhiyun * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*4882a593Smuzhiyun * GNU General Public License for more details. 19*4882a593Smuzhiyun * 20*4882a593Smuzhiyun * NO WARRANTY 21*4882a593Smuzhiyun * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 22*4882a593Smuzhiyun * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 23*4882a593Smuzhiyun * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 24*4882a593Smuzhiyun * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 25*4882a593Smuzhiyun * solely responsible for determining the appropriateness of using and 26*4882a593Smuzhiyun * distributing the Program and assumes all risks associated with its 27*4882a593Smuzhiyun * exercise of rights under this Agreement, including but not limited to 28*4882a593Smuzhiyun * the risks and costs of program errors, damage to or loss of data, 29*4882a593Smuzhiyun * programs or equipment, and unavailability or interruption of operations. 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun * DISCLAIMER OF LIABILITY 32*4882a593Smuzhiyun * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 33*4882a593Smuzhiyun * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34*4882a593Smuzhiyun * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 35*4882a593Smuzhiyun * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 36*4882a593Smuzhiyun * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 37*4882a593Smuzhiyun * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 38*4882a593Smuzhiyun * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun * You should have received a copy of the GNU General Public License 41*4882a593Smuzhiyun * along with this program; if not, write to the Free Software 42*4882a593Smuzhiyun * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 43*4882a593Smuzhiyun * USA. 44*4882a593Smuzhiyun */ 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun #ifndef MPT3SAS_CTL_H_INCLUDED 47*4882a593Smuzhiyun #define MPT3SAS_CTL_H_INCLUDED 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun #ifdef __KERNEL__ 50*4882a593Smuzhiyun #include <linux/miscdevice.h> 51*4882a593Smuzhiyun #endif 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun #ifndef MPT2SAS_MINOR 54*4882a593Smuzhiyun #define MPT2SAS_MINOR (MPT_MINOR + 1) 55*4882a593Smuzhiyun #endif 56*4882a593Smuzhiyun #ifndef MPT3SAS_MINOR 57*4882a593Smuzhiyun #define MPT3SAS_MINOR (MPT_MINOR + 2) 58*4882a593Smuzhiyun #endif 59*4882a593Smuzhiyun #define MPT2SAS_DEV_NAME "mpt2ctl" 60*4882a593Smuzhiyun #define MPT3SAS_DEV_NAME "mpt3ctl" 61*4882a593Smuzhiyun #define MPT3_MAGIC_NUMBER 'L' 62*4882a593Smuzhiyun #define MPT3_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */ 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun /** 65*4882a593Smuzhiyun * IOCTL opcodes 66*4882a593Smuzhiyun */ 67*4882a593Smuzhiyun #define MPT3IOCINFO _IOWR(MPT3_MAGIC_NUMBER, 17, \ 68*4882a593Smuzhiyun struct mpt3_ioctl_iocinfo) 69*4882a593Smuzhiyun #define MPT3COMMAND _IOWR(MPT3_MAGIC_NUMBER, 20, \ 70*4882a593Smuzhiyun struct mpt3_ioctl_command) 71*4882a593Smuzhiyun #ifdef CONFIG_COMPAT 72*4882a593Smuzhiyun #define MPT3COMMAND32 _IOWR(MPT3_MAGIC_NUMBER, 20, \ 73*4882a593Smuzhiyun struct mpt3_ioctl_command32) 74*4882a593Smuzhiyun #endif 75*4882a593Smuzhiyun #define MPT3EVENTQUERY _IOWR(MPT3_MAGIC_NUMBER, 21, \ 76*4882a593Smuzhiyun struct mpt3_ioctl_eventquery) 77*4882a593Smuzhiyun #define MPT3EVENTENABLE _IOWR(MPT3_MAGIC_NUMBER, 22, \ 78*4882a593Smuzhiyun struct mpt3_ioctl_eventenable) 79*4882a593Smuzhiyun #define MPT3EVENTREPORT _IOWR(MPT3_MAGIC_NUMBER, 23, \ 80*4882a593Smuzhiyun struct mpt3_ioctl_eventreport) 81*4882a593Smuzhiyun #define MPT3HARDRESET _IOWR(MPT3_MAGIC_NUMBER, 24, \ 82*4882a593Smuzhiyun struct mpt3_ioctl_diag_reset) 83*4882a593Smuzhiyun #define MPT3BTDHMAPPING _IOWR(MPT3_MAGIC_NUMBER, 31, \ 84*4882a593Smuzhiyun struct mpt3_ioctl_btdh_mapping) 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun /* diag buffer support */ 87*4882a593Smuzhiyun #define MPT3DIAGREGISTER _IOWR(MPT3_MAGIC_NUMBER, 26, \ 88*4882a593Smuzhiyun struct mpt3_diag_register) 89*4882a593Smuzhiyun #define MPT3DIAGRELEASE _IOWR(MPT3_MAGIC_NUMBER, 27, \ 90*4882a593Smuzhiyun struct mpt3_diag_release) 91*4882a593Smuzhiyun #define MPT3DIAGUNREGISTER _IOWR(MPT3_MAGIC_NUMBER, 28, \ 92*4882a593Smuzhiyun struct mpt3_diag_unregister) 93*4882a593Smuzhiyun #define MPT3DIAGQUERY _IOWR(MPT3_MAGIC_NUMBER, 29, \ 94*4882a593Smuzhiyun struct mpt3_diag_query) 95*4882a593Smuzhiyun #define MPT3DIAGREADBUFFER _IOWR(MPT3_MAGIC_NUMBER, 30, \ 96*4882a593Smuzhiyun struct mpt3_diag_read_buffer) 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun /* Trace Buffer default UniqueId */ 99*4882a593Smuzhiyun #define MPT2DIAGBUFFUNIQUEID (0x07075900) 100*4882a593Smuzhiyun #define MPT3DIAGBUFFUNIQUEID (0x4252434D) 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun /* UID not found */ 103*4882a593Smuzhiyun #define MPT3_DIAG_UID_NOT_FOUND (0xFF) 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun /** 107*4882a593Smuzhiyun * struct mpt3_ioctl_header - main header structure 108*4882a593Smuzhiyun * @ioc_number - IOC unit number 109*4882a593Smuzhiyun * @port_number - IOC port number 110*4882a593Smuzhiyun * @max_data_size - maximum number bytes to transfer on read 111*4882a593Smuzhiyun */ 112*4882a593Smuzhiyun struct mpt3_ioctl_header { 113*4882a593Smuzhiyun uint32_t ioc_number; 114*4882a593Smuzhiyun uint32_t port_number; 115*4882a593Smuzhiyun uint32_t max_data_size; 116*4882a593Smuzhiyun }; 117*4882a593Smuzhiyun 118*4882a593Smuzhiyun /** 119*4882a593Smuzhiyun * struct mpt3_ioctl_diag_reset - diagnostic reset 120*4882a593Smuzhiyun * @hdr - generic header 121*4882a593Smuzhiyun */ 122*4882a593Smuzhiyun struct mpt3_ioctl_diag_reset { 123*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 124*4882a593Smuzhiyun }; 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun /** 128*4882a593Smuzhiyun * struct mpt3_ioctl_pci_info - pci device info 129*4882a593Smuzhiyun * @device - pci device id 130*4882a593Smuzhiyun * @function - pci function id 131*4882a593Smuzhiyun * @bus - pci bus id 132*4882a593Smuzhiyun * @segment_id - pci segment id 133*4882a593Smuzhiyun */ 134*4882a593Smuzhiyun struct mpt3_ioctl_pci_info { 135*4882a593Smuzhiyun union { 136*4882a593Smuzhiyun struct { 137*4882a593Smuzhiyun uint32_t device:5; 138*4882a593Smuzhiyun uint32_t function:3; 139*4882a593Smuzhiyun uint32_t bus:24; 140*4882a593Smuzhiyun } bits; 141*4882a593Smuzhiyun uint32_t word; 142*4882a593Smuzhiyun } u; 143*4882a593Smuzhiyun uint32_t segment_id; 144*4882a593Smuzhiyun }; 145*4882a593Smuzhiyun 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun #define MPT2_IOCTL_INTERFACE_SCSI (0x00) 148*4882a593Smuzhiyun #define MPT2_IOCTL_INTERFACE_FC (0x01) 149*4882a593Smuzhiyun #define MPT2_IOCTL_INTERFACE_FC_IP (0x02) 150*4882a593Smuzhiyun #define MPT2_IOCTL_INTERFACE_SAS (0x03) 151*4882a593Smuzhiyun #define MPT2_IOCTL_INTERFACE_SAS2 (0x04) 152*4882a593Smuzhiyun #define MPT2_IOCTL_INTERFACE_SAS2_SSS6200 (0x05) 153*4882a593Smuzhiyun #define MPT3_IOCTL_INTERFACE_SAS3 (0x06) 154*4882a593Smuzhiyun #define MPT3_IOCTL_INTERFACE_SAS35 (0x07) 155*4882a593Smuzhiyun #define MPT2_IOCTL_VERSION_LENGTH (32) 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun /** 158*4882a593Smuzhiyun * struct mpt3_ioctl_iocinfo - generic controller info 159*4882a593Smuzhiyun * @hdr - generic header 160*4882a593Smuzhiyun * @adapter_type - type of adapter (spi, fc, sas) 161*4882a593Smuzhiyun * @port_number - port number 162*4882a593Smuzhiyun * @pci_id - PCI Id 163*4882a593Smuzhiyun * @hw_rev - hardware revision 164*4882a593Smuzhiyun * @sub_system_device - PCI subsystem Device ID 165*4882a593Smuzhiyun * @sub_system_vendor - PCI subsystem Vendor ID 166*4882a593Smuzhiyun * @rsvd0 - reserved 167*4882a593Smuzhiyun * @firmware_version - firmware version 168*4882a593Smuzhiyun * @bios_version - BIOS version 169*4882a593Smuzhiyun * @driver_version - driver version - 32 ASCII characters 170*4882a593Smuzhiyun * @rsvd1 - reserved 171*4882a593Smuzhiyun * @scsi_id - scsi id of adapter 0 172*4882a593Smuzhiyun * @rsvd2 - reserved 173*4882a593Smuzhiyun * @pci_information - pci info (2nd revision) 174*4882a593Smuzhiyun */ 175*4882a593Smuzhiyun struct mpt3_ioctl_iocinfo { 176*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 177*4882a593Smuzhiyun uint32_t adapter_type; 178*4882a593Smuzhiyun uint32_t port_number; 179*4882a593Smuzhiyun uint32_t pci_id; 180*4882a593Smuzhiyun uint32_t hw_rev; 181*4882a593Smuzhiyun uint32_t subsystem_device; 182*4882a593Smuzhiyun uint32_t subsystem_vendor; 183*4882a593Smuzhiyun uint32_t rsvd0; 184*4882a593Smuzhiyun uint32_t firmware_version; 185*4882a593Smuzhiyun uint32_t bios_version; 186*4882a593Smuzhiyun uint8_t driver_version[MPT2_IOCTL_VERSION_LENGTH]; 187*4882a593Smuzhiyun uint8_t rsvd1; 188*4882a593Smuzhiyun uint8_t scsi_id; 189*4882a593Smuzhiyun uint16_t rsvd2; 190*4882a593Smuzhiyun struct mpt3_ioctl_pci_info pci_information; 191*4882a593Smuzhiyun }; 192*4882a593Smuzhiyun 193*4882a593Smuzhiyun 194*4882a593Smuzhiyun /* number of event log entries */ 195*4882a593Smuzhiyun #define MPT3SAS_CTL_EVENT_LOG_SIZE (200) 196*4882a593Smuzhiyun 197*4882a593Smuzhiyun /** 198*4882a593Smuzhiyun * struct mpt3_ioctl_eventquery - query event count and type 199*4882a593Smuzhiyun * @hdr - generic header 200*4882a593Smuzhiyun * @event_entries - number of events returned by get_event_report 201*4882a593Smuzhiyun * @rsvd - reserved 202*4882a593Smuzhiyun * @event_types - type of events currently being captured 203*4882a593Smuzhiyun */ 204*4882a593Smuzhiyun struct mpt3_ioctl_eventquery { 205*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 206*4882a593Smuzhiyun uint16_t event_entries; 207*4882a593Smuzhiyun uint16_t rsvd; 208*4882a593Smuzhiyun uint32_t event_types[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; 209*4882a593Smuzhiyun }; 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun /** 212*4882a593Smuzhiyun * struct mpt3_ioctl_eventenable - enable/disable event capturing 213*4882a593Smuzhiyun * @hdr - generic header 214*4882a593Smuzhiyun * @event_types - toggle off/on type of events to be captured 215*4882a593Smuzhiyun */ 216*4882a593Smuzhiyun struct mpt3_ioctl_eventenable { 217*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 218*4882a593Smuzhiyun uint32_t event_types[4]; 219*4882a593Smuzhiyun }; 220*4882a593Smuzhiyun 221*4882a593Smuzhiyun #define MPT3_EVENT_DATA_SIZE (192) 222*4882a593Smuzhiyun /** 223*4882a593Smuzhiyun * struct MPT3_IOCTL_EVENTS - 224*4882a593Smuzhiyun * @event - the event that was reported 225*4882a593Smuzhiyun * @context - unique value for each event assigned by driver 226*4882a593Smuzhiyun * @data - event data returned in fw reply message 227*4882a593Smuzhiyun */ 228*4882a593Smuzhiyun struct MPT3_IOCTL_EVENTS { 229*4882a593Smuzhiyun uint32_t event; 230*4882a593Smuzhiyun uint32_t context; 231*4882a593Smuzhiyun uint8_t data[MPT3_EVENT_DATA_SIZE]; 232*4882a593Smuzhiyun }; 233*4882a593Smuzhiyun 234*4882a593Smuzhiyun /** 235*4882a593Smuzhiyun * struct mpt3_ioctl_eventreport - returing event log 236*4882a593Smuzhiyun * @hdr - generic header 237*4882a593Smuzhiyun * @event_data - (see struct MPT3_IOCTL_EVENTS) 238*4882a593Smuzhiyun */ 239*4882a593Smuzhiyun struct mpt3_ioctl_eventreport { 240*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 241*4882a593Smuzhiyun struct MPT3_IOCTL_EVENTS event_data[1]; 242*4882a593Smuzhiyun }; 243*4882a593Smuzhiyun 244*4882a593Smuzhiyun /** 245*4882a593Smuzhiyun * struct mpt3_ioctl_command - generic mpt firmware passthru ioctl 246*4882a593Smuzhiyun * @hdr - generic header 247*4882a593Smuzhiyun * @timeout - command timeout in seconds. (if zero then use driver default 248*4882a593Smuzhiyun * value). 249*4882a593Smuzhiyun * @reply_frame_buf_ptr - reply location 250*4882a593Smuzhiyun * @data_in_buf_ptr - destination for read 251*4882a593Smuzhiyun * @data_out_buf_ptr - data source for write 252*4882a593Smuzhiyun * @sense_data_ptr - sense data location 253*4882a593Smuzhiyun * @max_reply_bytes - maximum number of reply bytes to be sent to app. 254*4882a593Smuzhiyun * @data_in_size - number bytes for data transfer in (read) 255*4882a593Smuzhiyun * @data_out_size - number bytes for data transfer out (write) 256*4882a593Smuzhiyun * @max_sense_bytes - maximum number of bytes for auto sense buffers 257*4882a593Smuzhiyun * @data_sge_offset - offset in words from the start of the request message to 258*4882a593Smuzhiyun * the first SGL 259*4882a593Smuzhiyun * @mf[1]; 260*4882a593Smuzhiyun */ 261*4882a593Smuzhiyun struct mpt3_ioctl_command { 262*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 263*4882a593Smuzhiyun uint32_t timeout; 264*4882a593Smuzhiyun void __user *reply_frame_buf_ptr; 265*4882a593Smuzhiyun void __user *data_in_buf_ptr; 266*4882a593Smuzhiyun void __user *data_out_buf_ptr; 267*4882a593Smuzhiyun void __user *sense_data_ptr; 268*4882a593Smuzhiyun uint32_t max_reply_bytes; 269*4882a593Smuzhiyun uint32_t data_in_size; 270*4882a593Smuzhiyun uint32_t data_out_size; 271*4882a593Smuzhiyun uint32_t max_sense_bytes; 272*4882a593Smuzhiyun uint32_t data_sge_offset; 273*4882a593Smuzhiyun uint8_t mf[1]; 274*4882a593Smuzhiyun }; 275*4882a593Smuzhiyun 276*4882a593Smuzhiyun #ifdef CONFIG_COMPAT 277*4882a593Smuzhiyun struct mpt3_ioctl_command32 { 278*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 279*4882a593Smuzhiyun uint32_t timeout; 280*4882a593Smuzhiyun uint32_t reply_frame_buf_ptr; 281*4882a593Smuzhiyun uint32_t data_in_buf_ptr; 282*4882a593Smuzhiyun uint32_t data_out_buf_ptr; 283*4882a593Smuzhiyun uint32_t sense_data_ptr; 284*4882a593Smuzhiyun uint32_t max_reply_bytes; 285*4882a593Smuzhiyun uint32_t data_in_size; 286*4882a593Smuzhiyun uint32_t data_out_size; 287*4882a593Smuzhiyun uint32_t max_sense_bytes; 288*4882a593Smuzhiyun uint32_t data_sge_offset; 289*4882a593Smuzhiyun uint8_t mf[1]; 290*4882a593Smuzhiyun }; 291*4882a593Smuzhiyun #endif 292*4882a593Smuzhiyun 293*4882a593Smuzhiyun /** 294*4882a593Smuzhiyun * struct mpt3_ioctl_btdh_mapping - mapping info 295*4882a593Smuzhiyun * @hdr - generic header 296*4882a593Smuzhiyun * @id - target device identification number 297*4882a593Smuzhiyun * @bus - SCSI bus number that the target device exists on 298*4882a593Smuzhiyun * @handle - device handle for the target device 299*4882a593Smuzhiyun * @rsvd - reserved 300*4882a593Smuzhiyun * 301*4882a593Smuzhiyun * To obtain a bus/id the application sets 302*4882a593Smuzhiyun * handle to valid handle, and bus/id to 0xFFFF. 303*4882a593Smuzhiyun * 304*4882a593Smuzhiyun * To obtain the device handle the application sets 305*4882a593Smuzhiyun * bus/id valid value, and the handle to 0xFFFF. 306*4882a593Smuzhiyun */ 307*4882a593Smuzhiyun struct mpt3_ioctl_btdh_mapping { 308*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 309*4882a593Smuzhiyun uint32_t id; 310*4882a593Smuzhiyun uint32_t bus; 311*4882a593Smuzhiyun uint16_t handle; 312*4882a593Smuzhiyun uint16_t rsvd; 313*4882a593Smuzhiyun }; 314*4882a593Smuzhiyun 315*4882a593Smuzhiyun 316*4882a593Smuzhiyun 317*4882a593Smuzhiyun /* application flags for mpt3_diag_register, mpt3_diag_query */ 318*4882a593Smuzhiyun #define MPT3_APP_FLAGS_APP_OWNED (0x0001) 319*4882a593Smuzhiyun #define MPT3_APP_FLAGS_BUFFER_VALID (0x0002) 320*4882a593Smuzhiyun #define MPT3_APP_FLAGS_FW_BUFFER_ACCESS (0x0004) 321*4882a593Smuzhiyun #define MPT3_APP_FLAGS_DYNAMIC_BUFFER_ALLOC (0x0008) 322*4882a593Smuzhiyun 323*4882a593Smuzhiyun /* flags for mpt3_diag_read_buffer */ 324*4882a593Smuzhiyun #define MPT3_FLAGS_REREGISTER (0x0001) 325*4882a593Smuzhiyun 326*4882a593Smuzhiyun #define MPT3_PRODUCT_SPECIFIC_DWORDS 23 327*4882a593Smuzhiyun 328*4882a593Smuzhiyun /** 329*4882a593Smuzhiyun * struct mpt3_diag_register - application register with driver 330*4882a593Smuzhiyun * @hdr - generic header 331*4882a593Smuzhiyun * @reserved - 332*4882a593Smuzhiyun * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 333*4882a593Smuzhiyun * @application_flags - misc flags 334*4882a593Smuzhiyun * @diagnostic_flags - specifies flags affecting command processing 335*4882a593Smuzhiyun * @product_specific - product specific information 336*4882a593Smuzhiyun * @requested_buffer_size - buffers size in bytes 337*4882a593Smuzhiyun * @unique_id - tag specified by application that is used to signal ownership 338*4882a593Smuzhiyun * of the buffer. 339*4882a593Smuzhiyun * 340*4882a593Smuzhiyun * This will allow the driver to setup any required buffers that will be 341*4882a593Smuzhiyun * needed by firmware to communicate with the driver. 342*4882a593Smuzhiyun */ 343*4882a593Smuzhiyun struct mpt3_diag_register { 344*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 345*4882a593Smuzhiyun uint8_t reserved; 346*4882a593Smuzhiyun uint8_t buffer_type; 347*4882a593Smuzhiyun uint16_t application_flags; 348*4882a593Smuzhiyun uint32_t diagnostic_flags; 349*4882a593Smuzhiyun uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 350*4882a593Smuzhiyun uint32_t requested_buffer_size; 351*4882a593Smuzhiyun uint32_t unique_id; 352*4882a593Smuzhiyun }; 353*4882a593Smuzhiyun 354*4882a593Smuzhiyun /** 355*4882a593Smuzhiyun * struct mpt3_diag_unregister - application unregister with driver 356*4882a593Smuzhiyun * @hdr - generic header 357*4882a593Smuzhiyun * @unique_id - tag uniquely identifies the buffer to be unregistered 358*4882a593Smuzhiyun * 359*4882a593Smuzhiyun * This will allow the driver to cleanup any memory allocated for diag 360*4882a593Smuzhiyun * messages and to free up any resources. 361*4882a593Smuzhiyun */ 362*4882a593Smuzhiyun struct mpt3_diag_unregister { 363*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 364*4882a593Smuzhiyun uint32_t unique_id; 365*4882a593Smuzhiyun }; 366*4882a593Smuzhiyun 367*4882a593Smuzhiyun /** 368*4882a593Smuzhiyun * struct mpt3_diag_query - query relevant info associated with diag buffers 369*4882a593Smuzhiyun * @hdr - generic header 370*4882a593Smuzhiyun * @reserved - 371*4882a593Smuzhiyun * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 372*4882a593Smuzhiyun * @application_flags - misc flags 373*4882a593Smuzhiyun * @diagnostic_flags - specifies flags affecting command processing 374*4882a593Smuzhiyun * @product_specific - product specific information 375*4882a593Smuzhiyun * @total_buffer_size - diag buffer size in bytes 376*4882a593Smuzhiyun * @driver_added_buffer_size - size of extra space appended to end of buffer 377*4882a593Smuzhiyun * @unique_id - unique id associated with this buffer. 378*4882a593Smuzhiyun * 379*4882a593Smuzhiyun * The application will send only buffer_type and unique_id. Driver will 380*4882a593Smuzhiyun * inspect unique_id first, if valid, fill in all the info. If unique_id is 381*4882a593Smuzhiyun * 0x00, the driver will return info specified by Buffer Type. 382*4882a593Smuzhiyun */ 383*4882a593Smuzhiyun struct mpt3_diag_query { 384*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 385*4882a593Smuzhiyun uint8_t reserved; 386*4882a593Smuzhiyun uint8_t buffer_type; 387*4882a593Smuzhiyun uint16_t application_flags; 388*4882a593Smuzhiyun uint32_t diagnostic_flags; 389*4882a593Smuzhiyun uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 390*4882a593Smuzhiyun uint32_t total_buffer_size; 391*4882a593Smuzhiyun uint32_t driver_added_buffer_size; 392*4882a593Smuzhiyun uint32_t unique_id; 393*4882a593Smuzhiyun }; 394*4882a593Smuzhiyun 395*4882a593Smuzhiyun /** 396*4882a593Smuzhiyun * struct mpt3_diag_release - request to send Diag Release Message to firmware 397*4882a593Smuzhiyun * @hdr - generic header 398*4882a593Smuzhiyun * @unique_id - tag uniquely identifies the buffer to be released 399*4882a593Smuzhiyun * 400*4882a593Smuzhiyun * This allows ownership of the specified buffer to returned to the driver, 401*4882a593Smuzhiyun * allowing an application to read the buffer without fear that firmware is 402*4882a593Smuzhiyun * overwriting information in the buffer. 403*4882a593Smuzhiyun */ 404*4882a593Smuzhiyun struct mpt3_diag_release { 405*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 406*4882a593Smuzhiyun uint32_t unique_id; 407*4882a593Smuzhiyun }; 408*4882a593Smuzhiyun 409*4882a593Smuzhiyun /** 410*4882a593Smuzhiyun * struct mpt3_diag_read_buffer - request for copy of the diag buffer 411*4882a593Smuzhiyun * @hdr - generic header 412*4882a593Smuzhiyun * @status - 413*4882a593Smuzhiyun * @reserved - 414*4882a593Smuzhiyun * @flags - misc flags 415*4882a593Smuzhiyun * @starting_offset - starting offset within drivers buffer where to start 416*4882a593Smuzhiyun * reading data at into the specified application buffer 417*4882a593Smuzhiyun * @bytes_to_read - number of bytes to copy from the drivers buffer into the 418*4882a593Smuzhiyun * application buffer starting at starting_offset. 419*4882a593Smuzhiyun * @unique_id - unique id associated with this buffer. 420*4882a593Smuzhiyun * @diagnostic_data - data payload 421*4882a593Smuzhiyun */ 422*4882a593Smuzhiyun struct mpt3_diag_read_buffer { 423*4882a593Smuzhiyun struct mpt3_ioctl_header hdr; 424*4882a593Smuzhiyun uint8_t status; 425*4882a593Smuzhiyun uint8_t reserved; 426*4882a593Smuzhiyun uint16_t flags; 427*4882a593Smuzhiyun uint32_t starting_offset; 428*4882a593Smuzhiyun uint32_t bytes_to_read; 429*4882a593Smuzhiyun uint32_t unique_id; 430*4882a593Smuzhiyun uint32_t diagnostic_data[1]; 431*4882a593Smuzhiyun }; 432*4882a593Smuzhiyun 433*4882a593Smuzhiyun #endif /* MPT3SAS_CTL_H_INCLUDED */ 434