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