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