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 7*a03bd153SSreekanth Reddy * Copyright (C) 2013-2014 Avago Technologies 8*a03bd153SSreekanth 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 53f92363d1SSreekanth Reddy 54f92363d1SSreekanth Reddy #ifndef MPT3SAS_MINOR 55f92363d1SSreekanth Reddy #define MPT3SAS_MINOR (MPT_MINOR + 2) 56f92363d1SSreekanth Reddy #endif 57f92363d1SSreekanth Reddy #define MPT3SAS_DEV_NAME "mpt3ctl" 58f92363d1SSreekanth Reddy #define MPT3_MAGIC_NUMBER 'L' 59f92363d1SSreekanth Reddy #define MPT3_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */ 60f92363d1SSreekanth Reddy 61f92363d1SSreekanth Reddy /** 62f92363d1SSreekanth Reddy * IOCTL opcodes 63f92363d1SSreekanth Reddy */ 64f92363d1SSreekanth Reddy #define MPT3IOCINFO _IOWR(MPT3_MAGIC_NUMBER, 17, \ 65f92363d1SSreekanth Reddy struct mpt3_ioctl_iocinfo) 66f92363d1SSreekanth Reddy #define MPT3COMMAND _IOWR(MPT3_MAGIC_NUMBER, 20, \ 67f92363d1SSreekanth Reddy struct mpt3_ioctl_command) 68f92363d1SSreekanth Reddy #ifdef CONFIG_COMPAT 69f92363d1SSreekanth Reddy #define MPT3COMMAND32 _IOWR(MPT3_MAGIC_NUMBER, 20, \ 70f92363d1SSreekanth Reddy struct mpt3_ioctl_command32) 71f92363d1SSreekanth Reddy #endif 72f92363d1SSreekanth Reddy #define MPT3EVENTQUERY _IOWR(MPT3_MAGIC_NUMBER, 21, \ 73f92363d1SSreekanth Reddy struct mpt3_ioctl_eventquery) 74f92363d1SSreekanth Reddy #define MPT3EVENTENABLE _IOWR(MPT3_MAGIC_NUMBER, 22, \ 75f92363d1SSreekanth Reddy struct mpt3_ioctl_eventenable) 76f92363d1SSreekanth Reddy #define MPT3EVENTREPORT _IOWR(MPT3_MAGIC_NUMBER, 23, \ 77f92363d1SSreekanth Reddy struct mpt3_ioctl_eventreport) 78f92363d1SSreekanth Reddy #define MPT3HARDRESET _IOWR(MPT3_MAGIC_NUMBER, 24, \ 79f92363d1SSreekanth Reddy struct mpt3_ioctl_diag_reset) 80f92363d1SSreekanth Reddy #define MPT3BTDHMAPPING _IOWR(MPT3_MAGIC_NUMBER, 31, \ 81f92363d1SSreekanth Reddy struct mpt3_ioctl_btdh_mapping) 82f92363d1SSreekanth Reddy 83f92363d1SSreekanth Reddy /* diag buffer support */ 84f92363d1SSreekanth Reddy #define MPT3DIAGREGISTER _IOWR(MPT3_MAGIC_NUMBER, 26, \ 85f92363d1SSreekanth Reddy struct mpt3_diag_register) 86f92363d1SSreekanth Reddy #define MPT3DIAGRELEASE _IOWR(MPT3_MAGIC_NUMBER, 27, \ 87f92363d1SSreekanth Reddy struct mpt3_diag_release) 88f92363d1SSreekanth Reddy #define MPT3DIAGUNREGISTER _IOWR(MPT3_MAGIC_NUMBER, 28, \ 89f92363d1SSreekanth Reddy struct mpt3_diag_unregister) 90f92363d1SSreekanth Reddy #define MPT3DIAGQUERY _IOWR(MPT3_MAGIC_NUMBER, 29, \ 91f92363d1SSreekanth Reddy struct mpt3_diag_query) 92f92363d1SSreekanth Reddy #define MPT3DIAGREADBUFFER _IOWR(MPT3_MAGIC_NUMBER, 30, \ 93f92363d1SSreekanth Reddy struct mpt3_diag_read_buffer) 94f92363d1SSreekanth Reddy 95f92363d1SSreekanth Reddy /** 96f92363d1SSreekanth Reddy * struct mpt3_ioctl_header - main header structure 97f92363d1SSreekanth Reddy * @ioc_number - IOC unit number 98f92363d1SSreekanth Reddy * @port_number - IOC port number 99f92363d1SSreekanth Reddy * @max_data_size - maximum number bytes to transfer on read 100f92363d1SSreekanth Reddy */ 101f92363d1SSreekanth Reddy struct mpt3_ioctl_header { 102f92363d1SSreekanth Reddy uint32_t ioc_number; 103f92363d1SSreekanth Reddy uint32_t port_number; 104f92363d1SSreekanth Reddy uint32_t max_data_size; 105f92363d1SSreekanth Reddy }; 106f92363d1SSreekanth Reddy 107f92363d1SSreekanth Reddy /** 108f92363d1SSreekanth Reddy * struct mpt3_ioctl_diag_reset - diagnostic reset 109f92363d1SSreekanth Reddy * @hdr - generic header 110f92363d1SSreekanth Reddy */ 111f92363d1SSreekanth Reddy struct mpt3_ioctl_diag_reset { 112f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 113f92363d1SSreekanth Reddy }; 114f92363d1SSreekanth Reddy 115f92363d1SSreekanth Reddy 116f92363d1SSreekanth Reddy /** 117f92363d1SSreekanth Reddy * struct mpt3_ioctl_pci_info - pci device info 118f92363d1SSreekanth Reddy * @device - pci device id 119f92363d1SSreekanth Reddy * @function - pci function id 120f92363d1SSreekanth Reddy * @bus - pci bus id 121f92363d1SSreekanth Reddy * @segment_id - pci segment id 122f92363d1SSreekanth Reddy */ 123f92363d1SSreekanth Reddy struct mpt3_ioctl_pci_info { 124f92363d1SSreekanth Reddy union { 125f92363d1SSreekanth Reddy struct { 126f92363d1SSreekanth Reddy uint32_t device:5; 127f92363d1SSreekanth Reddy uint32_t function:3; 128f92363d1SSreekanth Reddy uint32_t bus:24; 129f92363d1SSreekanth Reddy } bits; 130f92363d1SSreekanth Reddy uint32_t word; 131f92363d1SSreekanth Reddy } u; 132f92363d1SSreekanth Reddy uint32_t segment_id; 133f92363d1SSreekanth Reddy }; 134f92363d1SSreekanth Reddy 135f92363d1SSreekanth Reddy 136f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SCSI (0x00) 137f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_FC (0x01) 138f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_FC_IP (0x02) 139f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SAS (0x03) 140f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SAS2 (0x04) 141f92363d1SSreekanth Reddy #define MPT3_IOCTL_INTERFACE_SAS3 (0x06) 142f92363d1SSreekanth Reddy #define MPT2_IOCTL_VERSION_LENGTH (32) 143f92363d1SSreekanth Reddy 144f92363d1SSreekanth Reddy /** 145f92363d1SSreekanth Reddy * struct mpt3_ioctl_iocinfo - generic controller info 146f92363d1SSreekanth Reddy * @hdr - generic header 147f92363d1SSreekanth Reddy * @adapter_type - type of adapter (spi, fc, sas) 148f92363d1SSreekanth Reddy * @port_number - port number 149f92363d1SSreekanth Reddy * @pci_id - PCI Id 150f92363d1SSreekanth Reddy * @hw_rev - hardware revision 151f92363d1SSreekanth Reddy * @sub_system_device - PCI subsystem Device ID 152f92363d1SSreekanth Reddy * @sub_system_vendor - PCI subsystem Vendor ID 153f92363d1SSreekanth Reddy * @rsvd0 - reserved 154f92363d1SSreekanth Reddy * @firmware_version - firmware version 155f92363d1SSreekanth Reddy * @bios_version - BIOS version 156f92363d1SSreekanth Reddy * @driver_version - driver version - 32 ASCII characters 157f92363d1SSreekanth Reddy * @rsvd1 - reserved 158f92363d1SSreekanth Reddy * @scsi_id - scsi id of adapter 0 159f92363d1SSreekanth Reddy * @rsvd2 - reserved 160f92363d1SSreekanth Reddy * @pci_information - pci info (2nd revision) 161f92363d1SSreekanth Reddy */ 162f92363d1SSreekanth Reddy struct mpt3_ioctl_iocinfo { 163f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 164f92363d1SSreekanth Reddy uint32_t adapter_type; 165f92363d1SSreekanth Reddy uint32_t port_number; 166f92363d1SSreekanth Reddy uint32_t pci_id; 167f92363d1SSreekanth Reddy uint32_t hw_rev; 168f92363d1SSreekanth Reddy uint32_t subsystem_device; 169f92363d1SSreekanth Reddy uint32_t subsystem_vendor; 170f92363d1SSreekanth Reddy uint32_t rsvd0; 171f92363d1SSreekanth Reddy uint32_t firmware_version; 172f92363d1SSreekanth Reddy uint32_t bios_version; 173f92363d1SSreekanth Reddy uint8_t driver_version[MPT2_IOCTL_VERSION_LENGTH]; 174f92363d1SSreekanth Reddy uint8_t rsvd1; 175f92363d1SSreekanth Reddy uint8_t scsi_id; 176f92363d1SSreekanth Reddy uint16_t rsvd2; 177f92363d1SSreekanth Reddy struct mpt3_ioctl_pci_info pci_information; 178f92363d1SSreekanth Reddy }; 179f92363d1SSreekanth Reddy 180f92363d1SSreekanth Reddy 181f92363d1SSreekanth Reddy /* number of event log entries */ 182f92363d1SSreekanth Reddy #define MPT3SAS_CTL_EVENT_LOG_SIZE (50) 183f92363d1SSreekanth Reddy 184f92363d1SSreekanth Reddy /** 185f92363d1SSreekanth Reddy * struct mpt3_ioctl_eventquery - query event count and type 186f92363d1SSreekanth Reddy * @hdr - generic header 187f92363d1SSreekanth Reddy * @event_entries - number of events returned by get_event_report 188f92363d1SSreekanth Reddy * @rsvd - reserved 189f92363d1SSreekanth Reddy * @event_types - type of events currently being captured 190f92363d1SSreekanth Reddy */ 191f92363d1SSreekanth Reddy struct mpt3_ioctl_eventquery { 192f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 193f92363d1SSreekanth Reddy uint16_t event_entries; 194f92363d1SSreekanth Reddy uint16_t rsvd; 195f92363d1SSreekanth Reddy uint32_t event_types[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; 196f92363d1SSreekanth Reddy }; 197f92363d1SSreekanth Reddy 198f92363d1SSreekanth Reddy /** 199f92363d1SSreekanth Reddy * struct mpt3_ioctl_eventenable - enable/disable event capturing 200f92363d1SSreekanth Reddy * @hdr - generic header 201f92363d1SSreekanth Reddy * @event_types - toggle off/on type of events to be captured 202f92363d1SSreekanth Reddy */ 203f92363d1SSreekanth Reddy struct mpt3_ioctl_eventenable { 204f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 205f92363d1SSreekanth Reddy uint32_t event_types[4]; 206f92363d1SSreekanth Reddy }; 207f92363d1SSreekanth Reddy 208f92363d1SSreekanth Reddy #define MPT3_EVENT_DATA_SIZE (192) 209f92363d1SSreekanth Reddy /** 210f92363d1SSreekanth Reddy * struct MPT3_IOCTL_EVENTS - 211f92363d1SSreekanth Reddy * @event - the event that was reported 212f92363d1SSreekanth Reddy * @context - unique value for each event assigned by driver 213f92363d1SSreekanth Reddy * @data - event data returned in fw reply message 214f92363d1SSreekanth Reddy */ 215f92363d1SSreekanth Reddy struct MPT3_IOCTL_EVENTS { 216f92363d1SSreekanth Reddy uint32_t event; 217f92363d1SSreekanth Reddy uint32_t context; 218f92363d1SSreekanth Reddy uint8_t data[MPT3_EVENT_DATA_SIZE]; 219f92363d1SSreekanth Reddy }; 220f92363d1SSreekanth Reddy 221f92363d1SSreekanth Reddy /** 222f92363d1SSreekanth Reddy * struct mpt3_ioctl_eventreport - returing event log 223f92363d1SSreekanth Reddy * @hdr - generic header 224f92363d1SSreekanth Reddy * @event_data - (see struct MPT3_IOCTL_EVENTS) 225f92363d1SSreekanth Reddy */ 226f92363d1SSreekanth Reddy struct mpt3_ioctl_eventreport { 227f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 228f92363d1SSreekanth Reddy struct MPT3_IOCTL_EVENTS event_data[1]; 229f92363d1SSreekanth Reddy }; 230f92363d1SSreekanth Reddy 231f92363d1SSreekanth Reddy /** 232f92363d1SSreekanth Reddy * struct mpt3_ioctl_command - generic mpt firmware passthru ioctl 233f92363d1SSreekanth Reddy * @hdr - generic header 234f92363d1SSreekanth Reddy * @timeout - command timeout in seconds. (if zero then use driver default 235f92363d1SSreekanth Reddy * value). 236f92363d1SSreekanth Reddy * @reply_frame_buf_ptr - reply location 237f92363d1SSreekanth Reddy * @data_in_buf_ptr - destination for read 238f92363d1SSreekanth Reddy * @data_out_buf_ptr - data source for write 239f92363d1SSreekanth Reddy * @sense_data_ptr - sense data location 240f92363d1SSreekanth Reddy * @max_reply_bytes - maximum number of reply bytes to be sent to app. 241f92363d1SSreekanth Reddy * @data_in_size - number bytes for data transfer in (read) 242f92363d1SSreekanth Reddy * @data_out_size - number bytes for data transfer out (write) 243f92363d1SSreekanth Reddy * @max_sense_bytes - maximum number of bytes for auto sense buffers 244f92363d1SSreekanth Reddy * @data_sge_offset - offset in words from the start of the request message to 245f92363d1SSreekanth Reddy * the first SGL 246f92363d1SSreekanth Reddy * @mf[1]; 247f92363d1SSreekanth Reddy */ 248f92363d1SSreekanth Reddy struct mpt3_ioctl_command { 249f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 250f92363d1SSreekanth Reddy uint32_t timeout; 251f92363d1SSreekanth Reddy void __user *reply_frame_buf_ptr; 252f92363d1SSreekanth Reddy void __user *data_in_buf_ptr; 253f92363d1SSreekanth Reddy void __user *data_out_buf_ptr; 254f92363d1SSreekanth Reddy void __user *sense_data_ptr; 255f92363d1SSreekanth Reddy uint32_t max_reply_bytes; 256f92363d1SSreekanth Reddy uint32_t data_in_size; 257f92363d1SSreekanth Reddy uint32_t data_out_size; 258f92363d1SSreekanth Reddy uint32_t max_sense_bytes; 259f92363d1SSreekanth Reddy uint32_t data_sge_offset; 260f92363d1SSreekanth Reddy uint8_t mf[1]; 261f92363d1SSreekanth Reddy }; 262f92363d1SSreekanth Reddy 263f92363d1SSreekanth Reddy #ifdef CONFIG_COMPAT 264f92363d1SSreekanth Reddy struct mpt3_ioctl_command32 { 265f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 266f92363d1SSreekanth Reddy uint32_t timeout; 267f92363d1SSreekanth Reddy uint32_t reply_frame_buf_ptr; 268f92363d1SSreekanth Reddy uint32_t data_in_buf_ptr; 269f92363d1SSreekanth Reddy uint32_t data_out_buf_ptr; 270f92363d1SSreekanth Reddy uint32_t sense_data_ptr; 271f92363d1SSreekanth Reddy uint32_t max_reply_bytes; 272f92363d1SSreekanth Reddy uint32_t data_in_size; 273f92363d1SSreekanth Reddy uint32_t data_out_size; 274f92363d1SSreekanth Reddy uint32_t max_sense_bytes; 275f92363d1SSreekanth Reddy uint32_t data_sge_offset; 276f92363d1SSreekanth Reddy uint8_t mf[1]; 277f92363d1SSreekanth Reddy }; 278f92363d1SSreekanth Reddy #endif 279f92363d1SSreekanth Reddy 280f92363d1SSreekanth Reddy /** 281f92363d1SSreekanth Reddy * struct mpt3_ioctl_btdh_mapping - mapping info 282f92363d1SSreekanth Reddy * @hdr - generic header 283f92363d1SSreekanth Reddy * @id - target device identification number 284f92363d1SSreekanth Reddy * @bus - SCSI bus number that the target device exists on 285f92363d1SSreekanth Reddy * @handle - device handle for the target device 286f92363d1SSreekanth Reddy * @rsvd - reserved 287f92363d1SSreekanth Reddy * 288f92363d1SSreekanth Reddy * To obtain a bus/id the application sets 289f92363d1SSreekanth Reddy * handle to valid handle, and bus/id to 0xFFFF. 290f92363d1SSreekanth Reddy * 291f92363d1SSreekanth Reddy * To obtain the device handle the application sets 292f92363d1SSreekanth Reddy * bus/id valid value, and the handle to 0xFFFF. 293f92363d1SSreekanth Reddy */ 294f92363d1SSreekanth Reddy struct mpt3_ioctl_btdh_mapping { 295f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 296f92363d1SSreekanth Reddy uint32_t id; 297f92363d1SSreekanth Reddy uint32_t bus; 298f92363d1SSreekanth Reddy uint16_t handle; 299f92363d1SSreekanth Reddy uint16_t rsvd; 300f92363d1SSreekanth Reddy }; 301f92363d1SSreekanth Reddy 302f92363d1SSreekanth Reddy 303f92363d1SSreekanth Reddy 304f92363d1SSreekanth Reddy /* application flags for mpt3_diag_register, mpt3_diag_query */ 305f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_APP_OWNED (0x0001) 306f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_BUFFER_VALID (0x0002) 307f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_FW_BUFFER_ACCESS (0x0004) 308f92363d1SSreekanth Reddy 309f92363d1SSreekanth Reddy /* flags for mpt3_diag_read_buffer */ 310f92363d1SSreekanth Reddy #define MPT3_FLAGS_REREGISTER (0x0001) 311f92363d1SSreekanth Reddy 312f92363d1SSreekanth Reddy #define MPT3_PRODUCT_SPECIFIC_DWORDS 23 313f92363d1SSreekanth Reddy 314f92363d1SSreekanth Reddy /** 315f92363d1SSreekanth Reddy * struct mpt3_diag_register - application register with driver 316f92363d1SSreekanth Reddy * @hdr - generic header 317f92363d1SSreekanth Reddy * @reserved - 318f92363d1SSreekanth Reddy * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 319f92363d1SSreekanth Reddy * @application_flags - misc flags 320f92363d1SSreekanth Reddy * @diagnostic_flags - specifies flags affecting command processing 321f92363d1SSreekanth Reddy * @product_specific - product specific information 322f92363d1SSreekanth Reddy * @requested_buffer_size - buffers size in bytes 323f92363d1SSreekanth Reddy * @unique_id - tag specified by application that is used to signal ownership 324f92363d1SSreekanth Reddy * of the buffer. 325f92363d1SSreekanth Reddy * 326f92363d1SSreekanth Reddy * This will allow the driver to setup any required buffers that will be 327f92363d1SSreekanth Reddy * needed by firmware to communicate with the driver. 328f92363d1SSreekanth Reddy */ 329f92363d1SSreekanth Reddy struct mpt3_diag_register { 330f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 331f92363d1SSreekanth Reddy uint8_t reserved; 332f92363d1SSreekanth Reddy uint8_t buffer_type; 333f92363d1SSreekanth Reddy uint16_t application_flags; 334f92363d1SSreekanth Reddy uint32_t diagnostic_flags; 335f92363d1SSreekanth Reddy uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 336f92363d1SSreekanth Reddy uint32_t requested_buffer_size; 337f92363d1SSreekanth Reddy uint32_t unique_id; 338f92363d1SSreekanth Reddy }; 339f92363d1SSreekanth Reddy 340f92363d1SSreekanth Reddy /** 341f92363d1SSreekanth Reddy * struct mpt3_diag_unregister - application unregister with driver 342f92363d1SSreekanth Reddy * @hdr - generic header 343f92363d1SSreekanth Reddy * @unique_id - tag uniquely identifies the buffer to be unregistered 344f92363d1SSreekanth Reddy * 345f92363d1SSreekanth Reddy * This will allow the driver to cleanup any memory allocated for diag 346f92363d1SSreekanth Reddy * messages and to free up any resources. 347f92363d1SSreekanth Reddy */ 348f92363d1SSreekanth Reddy struct mpt3_diag_unregister { 349f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 350f92363d1SSreekanth Reddy uint32_t unique_id; 351f92363d1SSreekanth Reddy }; 352f92363d1SSreekanth Reddy 353f92363d1SSreekanth Reddy /** 354f92363d1SSreekanth Reddy * struct mpt3_diag_query - query relevant info associated with diag buffers 355f92363d1SSreekanth Reddy * @hdr - generic header 356f92363d1SSreekanth Reddy * @reserved - 357f92363d1SSreekanth Reddy * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 358f92363d1SSreekanth Reddy * @application_flags - misc flags 359f92363d1SSreekanth Reddy * @diagnostic_flags - specifies flags affecting command processing 360f92363d1SSreekanth Reddy * @product_specific - product specific information 361f92363d1SSreekanth Reddy * @total_buffer_size - diag buffer size in bytes 362f92363d1SSreekanth Reddy * @driver_added_buffer_size - size of extra space appended to end of buffer 363f92363d1SSreekanth Reddy * @unique_id - unique id associated with this buffer. 364f92363d1SSreekanth Reddy * 365f92363d1SSreekanth Reddy * The application will send only buffer_type and unique_id. Driver will 366f92363d1SSreekanth Reddy * inspect unique_id first, if valid, fill in all the info. If unique_id is 367f92363d1SSreekanth Reddy * 0x00, the driver will return info specified by Buffer Type. 368f92363d1SSreekanth Reddy */ 369f92363d1SSreekanth Reddy struct mpt3_diag_query { 370f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 371f92363d1SSreekanth Reddy uint8_t reserved; 372f92363d1SSreekanth Reddy uint8_t buffer_type; 373f92363d1SSreekanth Reddy uint16_t application_flags; 374f92363d1SSreekanth Reddy uint32_t diagnostic_flags; 375f92363d1SSreekanth Reddy uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 376f92363d1SSreekanth Reddy uint32_t total_buffer_size; 377f92363d1SSreekanth Reddy uint32_t driver_added_buffer_size; 378f92363d1SSreekanth Reddy uint32_t unique_id; 379f92363d1SSreekanth Reddy }; 380f92363d1SSreekanth Reddy 381f92363d1SSreekanth Reddy /** 382f92363d1SSreekanth Reddy * struct mpt3_diag_release - request to send Diag Release Message to firmware 383f92363d1SSreekanth Reddy * @hdr - generic header 384f92363d1SSreekanth Reddy * @unique_id - tag uniquely identifies the buffer to be released 385f92363d1SSreekanth Reddy * 386f92363d1SSreekanth Reddy * This allows ownership of the specified buffer to returned to the driver, 387f92363d1SSreekanth Reddy * allowing an application to read the buffer without fear that firmware is 388f92363d1SSreekanth Reddy * overwritting information in the buffer. 389f92363d1SSreekanth Reddy */ 390f92363d1SSreekanth Reddy struct mpt3_diag_release { 391f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 392f92363d1SSreekanth Reddy uint32_t unique_id; 393f92363d1SSreekanth Reddy }; 394f92363d1SSreekanth Reddy 395f92363d1SSreekanth Reddy /** 396f92363d1SSreekanth Reddy * struct mpt3_diag_read_buffer - request for copy of the diag buffer 397f92363d1SSreekanth Reddy * @hdr - generic header 398f92363d1SSreekanth Reddy * @status - 399f92363d1SSreekanth Reddy * @reserved - 400f92363d1SSreekanth Reddy * @flags - misc flags 401f92363d1SSreekanth Reddy * @starting_offset - starting offset within drivers buffer where to start 402f92363d1SSreekanth Reddy * reading data at into the specified application buffer 403f92363d1SSreekanth Reddy * @bytes_to_read - number of bytes to copy from the drivers buffer into the 404f92363d1SSreekanth Reddy * application buffer starting at starting_offset. 405f92363d1SSreekanth Reddy * @unique_id - unique id associated with this buffer. 406f92363d1SSreekanth Reddy * @diagnostic_data - data payload 407f92363d1SSreekanth Reddy */ 408f92363d1SSreekanth Reddy struct mpt3_diag_read_buffer { 409f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 410f92363d1SSreekanth Reddy uint8_t status; 411f92363d1SSreekanth Reddy uint8_t reserved; 412f92363d1SSreekanth Reddy uint16_t flags; 413f92363d1SSreekanth Reddy uint32_t starting_offset; 414f92363d1SSreekanth Reddy uint32_t bytes_to_read; 415f92363d1SSreekanth Reddy uint32_t unique_id; 416f92363d1SSreekanth Reddy uint32_t diagnostic_data[1]; 417f92363d1SSreekanth Reddy }; 418f92363d1SSreekanth Reddy 419f92363d1SSreekanth Reddy #endif /* MPT3SAS_CTL_H_INCLUDED */ 420