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) 97*688c1a0aSSuganath Prabu S #define MPT3ADDNLDIAGQUERY _IOWR(MPT3_MAGIC_NUMBER, 32, \ 98*688c1a0aSSuganath Prabu S struct mpt3_addnl_diag_query) 99f92363d1SSreekanth Reddy 10008e7378eSSreekanth Reddy /* Trace Buffer default UniqueId */ 10108e7378eSSreekanth Reddy #define MPT2DIAGBUFFUNIQUEID (0x07075900) 10208e7378eSSreekanth Reddy #define MPT3DIAGBUFFUNIQUEID (0x4252434D) 10308e7378eSSreekanth Reddy 10408e7378eSSreekanth Reddy /* UID not found */ 10508e7378eSSreekanth Reddy #define MPT3_DIAG_UID_NOT_FOUND (0xFF) 10608e7378eSSreekanth Reddy 10708e7378eSSreekanth Reddy 108f92363d1SSreekanth Reddy /** 109f92363d1SSreekanth Reddy * struct mpt3_ioctl_header - main header structure 110f92363d1SSreekanth Reddy * @ioc_number - IOC unit number 111f92363d1SSreekanth Reddy * @port_number - IOC port number 112f92363d1SSreekanth Reddy * @max_data_size - maximum number bytes to transfer on read 113f92363d1SSreekanth Reddy */ 114f92363d1SSreekanth Reddy struct mpt3_ioctl_header { 115f92363d1SSreekanth Reddy uint32_t ioc_number; 116f92363d1SSreekanth Reddy uint32_t port_number; 117f92363d1SSreekanth Reddy uint32_t max_data_size; 118f92363d1SSreekanth Reddy }; 119f92363d1SSreekanth Reddy 120f92363d1SSreekanth Reddy /** 121f92363d1SSreekanth Reddy * struct mpt3_ioctl_diag_reset - diagnostic reset 122f92363d1SSreekanth Reddy * @hdr - generic header 123f92363d1SSreekanth Reddy */ 124f92363d1SSreekanth Reddy struct mpt3_ioctl_diag_reset { 125f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 126f92363d1SSreekanth Reddy }; 127f92363d1SSreekanth Reddy 128f92363d1SSreekanth Reddy 129f92363d1SSreekanth Reddy /** 130f92363d1SSreekanth Reddy * struct mpt3_ioctl_pci_info - pci device info 131f92363d1SSreekanth Reddy * @device - pci device id 132f92363d1SSreekanth Reddy * @function - pci function id 133f92363d1SSreekanth Reddy * @bus - pci bus id 134f92363d1SSreekanth Reddy * @segment_id - pci segment id 135f92363d1SSreekanth Reddy */ 136f92363d1SSreekanth Reddy struct mpt3_ioctl_pci_info { 137f92363d1SSreekanth Reddy union { 138f92363d1SSreekanth Reddy struct { 139f92363d1SSreekanth Reddy uint32_t device:5; 140f92363d1SSreekanth Reddy uint32_t function:3; 141f92363d1SSreekanth Reddy uint32_t bus:24; 142f92363d1SSreekanth Reddy } bits; 143f92363d1SSreekanth Reddy uint32_t word; 144f92363d1SSreekanth Reddy } u; 145f92363d1SSreekanth Reddy uint32_t segment_id; 146f92363d1SSreekanth Reddy }; 147f92363d1SSreekanth Reddy 148f92363d1SSreekanth Reddy 149f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SCSI (0x00) 150f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_FC (0x01) 151f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_FC_IP (0x02) 152f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SAS (0x03) 153f92363d1SSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SAS2 (0x04) 1547786ab6aSSreekanth Reddy #define MPT2_IOCTL_INTERFACE_SAS2_SSS6200 (0x05) 155f92363d1SSreekanth Reddy #define MPT3_IOCTL_INTERFACE_SAS3 (0x06) 156998f26aeSSuganath Prabu Subramani #define MPT3_IOCTL_INTERFACE_SAS35 (0x07) 157f92363d1SSreekanth Reddy #define MPT2_IOCTL_VERSION_LENGTH (32) 158f92363d1SSreekanth Reddy 159f92363d1SSreekanth Reddy /** 160f92363d1SSreekanth Reddy * struct mpt3_ioctl_iocinfo - generic controller info 161f92363d1SSreekanth Reddy * @hdr - generic header 162f92363d1SSreekanth Reddy * @adapter_type - type of adapter (spi, fc, sas) 163f92363d1SSreekanth Reddy * @port_number - port number 164f92363d1SSreekanth Reddy * @pci_id - PCI Id 165f92363d1SSreekanth Reddy * @hw_rev - hardware revision 166f92363d1SSreekanth Reddy * @sub_system_device - PCI subsystem Device ID 167f92363d1SSreekanth Reddy * @sub_system_vendor - PCI subsystem Vendor ID 168f92363d1SSreekanth Reddy * @rsvd0 - reserved 169f92363d1SSreekanth Reddy * @firmware_version - firmware version 170f92363d1SSreekanth Reddy * @bios_version - BIOS version 171f92363d1SSreekanth Reddy * @driver_version - driver version - 32 ASCII characters 172f92363d1SSreekanth Reddy * @rsvd1 - reserved 173f92363d1SSreekanth Reddy * @scsi_id - scsi id of adapter 0 174f92363d1SSreekanth Reddy * @rsvd2 - reserved 175f92363d1SSreekanth Reddy * @pci_information - pci info (2nd revision) 176f92363d1SSreekanth Reddy */ 177f92363d1SSreekanth Reddy struct mpt3_ioctl_iocinfo { 178f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 179f92363d1SSreekanth Reddy uint32_t adapter_type; 180f92363d1SSreekanth Reddy uint32_t port_number; 181f92363d1SSreekanth Reddy uint32_t pci_id; 182f92363d1SSreekanth Reddy uint32_t hw_rev; 183f92363d1SSreekanth Reddy uint32_t subsystem_device; 184f92363d1SSreekanth Reddy uint32_t subsystem_vendor; 185f92363d1SSreekanth Reddy uint32_t rsvd0; 186f92363d1SSreekanth Reddy uint32_t firmware_version; 187f92363d1SSreekanth Reddy uint32_t bios_version; 188f92363d1SSreekanth Reddy uint8_t driver_version[MPT2_IOCTL_VERSION_LENGTH]; 189f92363d1SSreekanth Reddy uint8_t rsvd1; 190f92363d1SSreekanth Reddy uint8_t scsi_id; 191f92363d1SSreekanth Reddy uint16_t rsvd2; 192f92363d1SSreekanth Reddy struct mpt3_ioctl_pci_info pci_information; 193f92363d1SSreekanth Reddy }; 194f92363d1SSreekanth Reddy 195f92363d1SSreekanth Reddy 196f92363d1SSreekanth Reddy /* number of event log entries */ 1971537d1bfSChaitra P B #define MPT3SAS_CTL_EVENT_LOG_SIZE (200) 198f92363d1SSreekanth Reddy 199f92363d1SSreekanth Reddy /** 200f92363d1SSreekanth Reddy * struct mpt3_ioctl_eventquery - query event count and type 201f92363d1SSreekanth Reddy * @hdr - generic header 202f92363d1SSreekanth Reddy * @event_entries - number of events returned by get_event_report 203f92363d1SSreekanth Reddy * @rsvd - reserved 204f92363d1SSreekanth Reddy * @event_types - type of events currently being captured 205f92363d1SSreekanth Reddy */ 206f92363d1SSreekanth Reddy struct mpt3_ioctl_eventquery { 207f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 208f92363d1SSreekanth Reddy uint16_t event_entries; 209f92363d1SSreekanth Reddy uint16_t rsvd; 210f92363d1SSreekanth Reddy uint32_t event_types[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; 211f92363d1SSreekanth Reddy }; 212f92363d1SSreekanth Reddy 213f92363d1SSreekanth Reddy /** 214f92363d1SSreekanth Reddy * struct mpt3_ioctl_eventenable - enable/disable event capturing 215f92363d1SSreekanth Reddy * @hdr - generic header 216f92363d1SSreekanth Reddy * @event_types - toggle off/on type of events to be captured 217f92363d1SSreekanth Reddy */ 218f92363d1SSreekanth Reddy struct mpt3_ioctl_eventenable { 219f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 220f92363d1SSreekanth Reddy uint32_t event_types[4]; 221f92363d1SSreekanth Reddy }; 222f92363d1SSreekanth Reddy 223f92363d1SSreekanth Reddy #define MPT3_EVENT_DATA_SIZE (192) 224f92363d1SSreekanth Reddy /** 225f92363d1SSreekanth Reddy * struct MPT3_IOCTL_EVENTS - 226f92363d1SSreekanth Reddy * @event - the event that was reported 227f92363d1SSreekanth Reddy * @context - unique value for each event assigned by driver 228f92363d1SSreekanth Reddy * @data - event data returned in fw reply message 229f92363d1SSreekanth Reddy */ 230f92363d1SSreekanth Reddy struct MPT3_IOCTL_EVENTS { 231f92363d1SSreekanth Reddy uint32_t event; 232f92363d1SSreekanth Reddy uint32_t context; 233f92363d1SSreekanth Reddy uint8_t data[MPT3_EVENT_DATA_SIZE]; 234f92363d1SSreekanth Reddy }; 235f92363d1SSreekanth Reddy 236f92363d1SSreekanth Reddy /** 237f92363d1SSreekanth Reddy * struct mpt3_ioctl_eventreport - returing event log 238f92363d1SSreekanth Reddy * @hdr - generic header 239f92363d1SSreekanth Reddy * @event_data - (see struct MPT3_IOCTL_EVENTS) 240f92363d1SSreekanth Reddy */ 241f92363d1SSreekanth Reddy struct mpt3_ioctl_eventreport { 242f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 243f92363d1SSreekanth Reddy struct MPT3_IOCTL_EVENTS event_data[1]; 244f92363d1SSreekanth Reddy }; 245f92363d1SSreekanth Reddy 246f92363d1SSreekanth Reddy /** 247f92363d1SSreekanth Reddy * struct mpt3_ioctl_command - generic mpt firmware passthru ioctl 248f92363d1SSreekanth Reddy * @hdr - generic header 249f92363d1SSreekanth Reddy * @timeout - command timeout in seconds. (if zero then use driver default 250f92363d1SSreekanth Reddy * value). 251f92363d1SSreekanth Reddy * @reply_frame_buf_ptr - reply location 252f92363d1SSreekanth Reddy * @data_in_buf_ptr - destination for read 253f92363d1SSreekanth Reddy * @data_out_buf_ptr - data source for write 254f92363d1SSreekanth Reddy * @sense_data_ptr - sense data location 255f92363d1SSreekanth Reddy * @max_reply_bytes - maximum number of reply bytes to be sent to app. 256f92363d1SSreekanth Reddy * @data_in_size - number bytes for data transfer in (read) 257f92363d1SSreekanth Reddy * @data_out_size - number bytes for data transfer out (write) 258f92363d1SSreekanth Reddy * @max_sense_bytes - maximum number of bytes for auto sense buffers 259f92363d1SSreekanth Reddy * @data_sge_offset - offset in words from the start of the request message to 260f92363d1SSreekanth Reddy * the first SGL 261f92363d1SSreekanth Reddy * @mf[1]; 262f92363d1SSreekanth Reddy */ 263f92363d1SSreekanth Reddy struct mpt3_ioctl_command { 264f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 265f92363d1SSreekanth Reddy uint32_t timeout; 266f92363d1SSreekanth Reddy void __user *reply_frame_buf_ptr; 267f92363d1SSreekanth Reddy void __user *data_in_buf_ptr; 268f92363d1SSreekanth Reddy void __user *data_out_buf_ptr; 269f92363d1SSreekanth Reddy void __user *sense_data_ptr; 270f92363d1SSreekanth Reddy uint32_t max_reply_bytes; 271f92363d1SSreekanth Reddy uint32_t data_in_size; 272f92363d1SSreekanth Reddy uint32_t data_out_size; 273f92363d1SSreekanth Reddy uint32_t max_sense_bytes; 274f92363d1SSreekanth Reddy uint32_t data_sge_offset; 275f92363d1SSreekanth Reddy uint8_t mf[1]; 276f92363d1SSreekanth Reddy }; 277f92363d1SSreekanth Reddy 278f92363d1SSreekanth Reddy #ifdef CONFIG_COMPAT 279f92363d1SSreekanth Reddy struct mpt3_ioctl_command32 { 280f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 281f92363d1SSreekanth Reddy uint32_t timeout; 282f92363d1SSreekanth Reddy uint32_t reply_frame_buf_ptr; 283f92363d1SSreekanth Reddy uint32_t data_in_buf_ptr; 284f92363d1SSreekanth Reddy uint32_t data_out_buf_ptr; 285f92363d1SSreekanth Reddy uint32_t sense_data_ptr; 286f92363d1SSreekanth Reddy uint32_t max_reply_bytes; 287f92363d1SSreekanth Reddy uint32_t data_in_size; 288f92363d1SSreekanth Reddy uint32_t data_out_size; 289f92363d1SSreekanth Reddy uint32_t max_sense_bytes; 290f92363d1SSreekanth Reddy uint32_t data_sge_offset; 291f92363d1SSreekanth Reddy uint8_t mf[1]; 292f92363d1SSreekanth Reddy }; 293f92363d1SSreekanth Reddy #endif 294f92363d1SSreekanth Reddy 295f92363d1SSreekanth Reddy /** 296f92363d1SSreekanth Reddy * struct mpt3_ioctl_btdh_mapping - mapping info 297f92363d1SSreekanth Reddy * @hdr - generic header 298f92363d1SSreekanth Reddy * @id - target device identification number 299f92363d1SSreekanth Reddy * @bus - SCSI bus number that the target device exists on 300f92363d1SSreekanth Reddy * @handle - device handle for the target device 301f92363d1SSreekanth Reddy * @rsvd - reserved 302f92363d1SSreekanth Reddy * 303f92363d1SSreekanth Reddy * To obtain a bus/id the application sets 304f92363d1SSreekanth Reddy * handle to valid handle, and bus/id to 0xFFFF. 305f92363d1SSreekanth Reddy * 306f92363d1SSreekanth Reddy * To obtain the device handle the application sets 307f92363d1SSreekanth Reddy * bus/id valid value, and the handle to 0xFFFF. 308f92363d1SSreekanth Reddy */ 309f92363d1SSreekanth Reddy struct mpt3_ioctl_btdh_mapping { 310f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 311f92363d1SSreekanth Reddy uint32_t id; 312f92363d1SSreekanth Reddy uint32_t bus; 313f92363d1SSreekanth Reddy uint16_t handle; 314f92363d1SSreekanth Reddy uint16_t rsvd; 315f92363d1SSreekanth Reddy }; 316f92363d1SSreekanth Reddy 317f92363d1SSreekanth Reddy 318f92363d1SSreekanth Reddy 319f92363d1SSreekanth Reddy /* application flags for mpt3_diag_register, mpt3_diag_query */ 320f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_APP_OWNED (0x0001) 321f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_BUFFER_VALID (0x0002) 322f92363d1SSreekanth Reddy #define MPT3_APP_FLAGS_FW_BUFFER_ACCESS (0x0004) 323a066f4c3SSreekanth Reddy #define MPT3_APP_FLAGS_DYNAMIC_BUFFER_ALLOC (0x0008) 324f92363d1SSreekanth Reddy 325f92363d1SSreekanth Reddy /* flags for mpt3_diag_read_buffer */ 326f92363d1SSreekanth Reddy #define MPT3_FLAGS_REREGISTER (0x0001) 327f92363d1SSreekanth Reddy 328f92363d1SSreekanth Reddy #define MPT3_PRODUCT_SPECIFIC_DWORDS 23 329f92363d1SSreekanth Reddy 330f92363d1SSreekanth Reddy /** 331f92363d1SSreekanth Reddy * struct mpt3_diag_register - application register with driver 332f92363d1SSreekanth Reddy * @hdr - generic header 333f92363d1SSreekanth Reddy * @reserved - 334f92363d1SSreekanth Reddy * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 335f92363d1SSreekanth Reddy * @application_flags - misc flags 336f92363d1SSreekanth Reddy * @diagnostic_flags - specifies flags affecting command processing 337f92363d1SSreekanth Reddy * @product_specific - product specific information 338f92363d1SSreekanth Reddy * @requested_buffer_size - buffers size in bytes 339f92363d1SSreekanth Reddy * @unique_id - tag specified by application that is used to signal ownership 340f92363d1SSreekanth Reddy * of the buffer. 341f92363d1SSreekanth Reddy * 342f92363d1SSreekanth Reddy * This will allow the driver to setup any required buffers that will be 343f92363d1SSreekanth Reddy * needed by firmware to communicate with the driver. 344f92363d1SSreekanth Reddy */ 345f92363d1SSreekanth Reddy struct mpt3_diag_register { 346f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 347f92363d1SSreekanth Reddy uint8_t reserved; 348f92363d1SSreekanth Reddy uint8_t buffer_type; 349f92363d1SSreekanth Reddy uint16_t application_flags; 350f92363d1SSreekanth Reddy uint32_t diagnostic_flags; 351f92363d1SSreekanth Reddy uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 352f92363d1SSreekanth Reddy uint32_t requested_buffer_size; 353f92363d1SSreekanth Reddy uint32_t unique_id; 354f92363d1SSreekanth Reddy }; 355f92363d1SSreekanth Reddy 356f92363d1SSreekanth Reddy /** 357f92363d1SSreekanth Reddy * struct mpt3_diag_unregister - application unregister with driver 358f92363d1SSreekanth Reddy * @hdr - generic header 359f92363d1SSreekanth Reddy * @unique_id - tag uniquely identifies the buffer to be unregistered 360f92363d1SSreekanth Reddy * 361f92363d1SSreekanth Reddy * This will allow the driver to cleanup any memory allocated for diag 362f92363d1SSreekanth Reddy * messages and to free up any resources. 363f92363d1SSreekanth Reddy */ 364f92363d1SSreekanth Reddy struct mpt3_diag_unregister { 365f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 366f92363d1SSreekanth Reddy uint32_t unique_id; 367f92363d1SSreekanth Reddy }; 368f92363d1SSreekanth Reddy 369f92363d1SSreekanth Reddy /** 370f92363d1SSreekanth Reddy * struct mpt3_diag_query - query relevant info associated with diag buffers 371f92363d1SSreekanth Reddy * @hdr - generic header 372f92363d1SSreekanth Reddy * @reserved - 373f92363d1SSreekanth Reddy * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 374f92363d1SSreekanth Reddy * @application_flags - misc flags 375f92363d1SSreekanth Reddy * @diagnostic_flags - specifies flags affecting command processing 376f92363d1SSreekanth Reddy * @product_specific - product specific information 377f92363d1SSreekanth Reddy * @total_buffer_size - diag buffer size in bytes 378f92363d1SSreekanth Reddy * @driver_added_buffer_size - size of extra space appended to end of buffer 379f92363d1SSreekanth Reddy * @unique_id - unique id associated with this buffer. 380f92363d1SSreekanth Reddy * 381f92363d1SSreekanth Reddy * The application will send only buffer_type and unique_id. Driver will 382f92363d1SSreekanth Reddy * inspect unique_id first, if valid, fill in all the info. If unique_id is 383f92363d1SSreekanth Reddy * 0x00, the driver will return info specified by Buffer Type. 384f92363d1SSreekanth Reddy */ 385f92363d1SSreekanth Reddy struct mpt3_diag_query { 386f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 387f92363d1SSreekanth Reddy uint8_t reserved; 388f92363d1SSreekanth Reddy uint8_t buffer_type; 389f92363d1SSreekanth Reddy uint16_t application_flags; 390f92363d1SSreekanth Reddy uint32_t diagnostic_flags; 391f92363d1SSreekanth Reddy uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 392f92363d1SSreekanth Reddy uint32_t total_buffer_size; 393f92363d1SSreekanth Reddy uint32_t driver_added_buffer_size; 394f92363d1SSreekanth Reddy uint32_t unique_id; 395f92363d1SSreekanth Reddy }; 396f92363d1SSreekanth Reddy 397f92363d1SSreekanth Reddy /** 398f92363d1SSreekanth Reddy * struct mpt3_diag_release - request to send Diag Release Message to firmware 399f92363d1SSreekanth Reddy * @hdr - generic header 400f92363d1SSreekanth Reddy * @unique_id - tag uniquely identifies the buffer to be released 401f92363d1SSreekanth Reddy * 402f92363d1SSreekanth Reddy * This allows ownership of the specified buffer to returned to the driver, 403f92363d1SSreekanth Reddy * allowing an application to read the buffer without fear that firmware is 4049a284e5cSMasahiro Yamada * overwriting information in the buffer. 405f92363d1SSreekanth Reddy */ 406f92363d1SSreekanth Reddy struct mpt3_diag_release { 407f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 408f92363d1SSreekanth Reddy uint32_t unique_id; 409f92363d1SSreekanth Reddy }; 410f92363d1SSreekanth Reddy 411f92363d1SSreekanth Reddy /** 412f92363d1SSreekanth Reddy * struct mpt3_diag_read_buffer - request for copy of the diag buffer 413f92363d1SSreekanth Reddy * @hdr - generic header 414f92363d1SSreekanth Reddy * @status - 415f92363d1SSreekanth Reddy * @reserved - 416f92363d1SSreekanth Reddy * @flags - misc flags 417f92363d1SSreekanth Reddy * @starting_offset - starting offset within drivers buffer where to start 418f92363d1SSreekanth Reddy * reading data at into the specified application buffer 419f92363d1SSreekanth Reddy * @bytes_to_read - number of bytes to copy from the drivers buffer into the 420f92363d1SSreekanth Reddy * application buffer starting at starting_offset. 421f92363d1SSreekanth Reddy * @unique_id - unique id associated with this buffer. 422f92363d1SSreekanth Reddy * @diagnostic_data - data payload 423f92363d1SSreekanth Reddy */ 424f92363d1SSreekanth Reddy struct mpt3_diag_read_buffer { 425f92363d1SSreekanth Reddy struct mpt3_ioctl_header hdr; 426f92363d1SSreekanth Reddy uint8_t status; 427f92363d1SSreekanth Reddy uint8_t reserved; 428f92363d1SSreekanth Reddy uint16_t flags; 429f92363d1SSreekanth Reddy uint32_t starting_offset; 430f92363d1SSreekanth Reddy uint32_t bytes_to_read; 431f92363d1SSreekanth Reddy uint32_t unique_id; 432f92363d1SSreekanth Reddy uint32_t diagnostic_data[1]; 433f92363d1SSreekanth Reddy }; 434f92363d1SSreekanth Reddy 435*688c1a0aSSuganath Prabu S /** 436*688c1a0aSSuganath Prabu S * struct mpt3_addnl_diag_query - diagnostic buffer release reason 437*688c1a0aSSuganath Prabu S * @hdr - generic header 438*688c1a0aSSuganath Prabu S * @unique_id - unique id associated with this buffer. 439*688c1a0aSSuganath Prabu S * @buffer_rel_condition - Release condition ioctl/sysfs/reset 440*688c1a0aSSuganath Prabu S * @reserved1 441*688c1a0aSSuganath Prabu S * @trigger_type - Master/Event/scsi/MPI 442*688c1a0aSSuganath Prabu S * @trigger_info_dwords - Data Correspondig to trigger type 443*688c1a0aSSuganath Prabu S * @reserved2 444*688c1a0aSSuganath Prabu S */ 445*688c1a0aSSuganath Prabu S struct mpt3_addnl_diag_query { 446*688c1a0aSSuganath Prabu S struct mpt3_ioctl_header hdr; 447*688c1a0aSSuganath Prabu S uint32_t unique_id; 448*688c1a0aSSuganath Prabu S uint16_t buffer_rel_condition; 449*688c1a0aSSuganath Prabu S uint16_t reserved1; 450*688c1a0aSSuganath Prabu S uint32_t trigger_type; 451*688c1a0aSSuganath Prabu S uint32_t trigger_info_dwords[2]; 452*688c1a0aSSuganath Prabu S uint32_t reserved2[2]; 453*688c1a0aSSuganath Prabu S }; 454*688c1a0aSSuganath Prabu S 455f92363d1SSreekanth Reddy #endif /* MPT3SAS_CTL_H_INCLUDED */ 456