18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Management Module Support for MPT (Message Passing Technology) based 38c2ecf20Sopenharmony_ci * controllers 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * This code is based on drivers/scsi/mpt3sas/mpt3sas_ctl.h 68c2ecf20Sopenharmony_ci * Copyright (C) 2012-2014 LSI Corporation 78c2ecf20Sopenharmony_ci * Copyright (C) 2013-2014 Avago Technologies 88c2ecf20Sopenharmony_ci * (mailto: MPT-FusionLinux.pdl@avagotech.com) 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or 118c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License 128c2ecf20Sopenharmony_ci * as published by the Free Software Foundation; either version 2 138c2ecf20Sopenharmony_ci * of the License, or (at your option) any later version. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 168c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 178c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 188c2ecf20Sopenharmony_ci * GNU General Public License for more details. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * NO WARRANTY 218c2ecf20Sopenharmony_ci * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 228c2ecf20Sopenharmony_ci * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 238c2ecf20Sopenharmony_ci * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 248c2ecf20Sopenharmony_ci * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 258c2ecf20Sopenharmony_ci * solely responsible for determining the appropriateness of using and 268c2ecf20Sopenharmony_ci * distributing the Program and assumes all risks associated with its 278c2ecf20Sopenharmony_ci * exercise of rights under this Agreement, including but not limited to 288c2ecf20Sopenharmony_ci * the risks and costs of program errors, damage to or loss of data, 298c2ecf20Sopenharmony_ci * programs or equipment, and unavailability or interruption of operations. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci * DISCLAIMER OF LIABILITY 328c2ecf20Sopenharmony_ci * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 338c2ecf20Sopenharmony_ci * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 348c2ecf20Sopenharmony_ci * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 358c2ecf20Sopenharmony_ci * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 368c2ecf20Sopenharmony_ci * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 378c2ecf20Sopenharmony_ci * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 388c2ecf20Sopenharmony_ci * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 418c2ecf20Sopenharmony_ci * along with this program; if not, write to the Free Software 428c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 438c2ecf20Sopenharmony_ci * USA. 448c2ecf20Sopenharmony_ci */ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#ifndef MPT3SAS_CTL_H_INCLUDED 478c2ecf20Sopenharmony_ci#define MPT3SAS_CTL_H_INCLUDED 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#ifdef __KERNEL__ 508c2ecf20Sopenharmony_ci#include <linux/miscdevice.h> 518c2ecf20Sopenharmony_ci#endif 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#ifndef MPT2SAS_MINOR 548c2ecf20Sopenharmony_ci#define MPT2SAS_MINOR (MPT_MINOR + 1) 558c2ecf20Sopenharmony_ci#endif 568c2ecf20Sopenharmony_ci#ifndef MPT3SAS_MINOR 578c2ecf20Sopenharmony_ci#define MPT3SAS_MINOR (MPT_MINOR + 2) 588c2ecf20Sopenharmony_ci#endif 598c2ecf20Sopenharmony_ci#define MPT2SAS_DEV_NAME "mpt2ctl" 608c2ecf20Sopenharmony_ci#define MPT3SAS_DEV_NAME "mpt3ctl" 618c2ecf20Sopenharmony_ci#define MPT3_MAGIC_NUMBER 'L' 628c2ecf20Sopenharmony_ci#define MPT3_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/** 658c2ecf20Sopenharmony_ci * IOCTL opcodes 668c2ecf20Sopenharmony_ci */ 678c2ecf20Sopenharmony_ci#define MPT3IOCINFO _IOWR(MPT3_MAGIC_NUMBER, 17, \ 688c2ecf20Sopenharmony_ci struct mpt3_ioctl_iocinfo) 698c2ecf20Sopenharmony_ci#define MPT3COMMAND _IOWR(MPT3_MAGIC_NUMBER, 20, \ 708c2ecf20Sopenharmony_ci struct mpt3_ioctl_command) 718c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT 728c2ecf20Sopenharmony_ci#define MPT3COMMAND32 _IOWR(MPT3_MAGIC_NUMBER, 20, \ 738c2ecf20Sopenharmony_ci struct mpt3_ioctl_command32) 748c2ecf20Sopenharmony_ci#endif 758c2ecf20Sopenharmony_ci#define MPT3EVENTQUERY _IOWR(MPT3_MAGIC_NUMBER, 21, \ 768c2ecf20Sopenharmony_ci struct mpt3_ioctl_eventquery) 778c2ecf20Sopenharmony_ci#define MPT3EVENTENABLE _IOWR(MPT3_MAGIC_NUMBER, 22, \ 788c2ecf20Sopenharmony_ci struct mpt3_ioctl_eventenable) 798c2ecf20Sopenharmony_ci#define MPT3EVENTREPORT _IOWR(MPT3_MAGIC_NUMBER, 23, \ 808c2ecf20Sopenharmony_ci struct mpt3_ioctl_eventreport) 818c2ecf20Sopenharmony_ci#define MPT3HARDRESET _IOWR(MPT3_MAGIC_NUMBER, 24, \ 828c2ecf20Sopenharmony_ci struct mpt3_ioctl_diag_reset) 838c2ecf20Sopenharmony_ci#define MPT3BTDHMAPPING _IOWR(MPT3_MAGIC_NUMBER, 31, \ 848c2ecf20Sopenharmony_ci struct mpt3_ioctl_btdh_mapping) 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci/* diag buffer support */ 878c2ecf20Sopenharmony_ci#define MPT3DIAGREGISTER _IOWR(MPT3_MAGIC_NUMBER, 26, \ 888c2ecf20Sopenharmony_ci struct mpt3_diag_register) 898c2ecf20Sopenharmony_ci#define MPT3DIAGRELEASE _IOWR(MPT3_MAGIC_NUMBER, 27, \ 908c2ecf20Sopenharmony_ci struct mpt3_diag_release) 918c2ecf20Sopenharmony_ci#define MPT3DIAGUNREGISTER _IOWR(MPT3_MAGIC_NUMBER, 28, \ 928c2ecf20Sopenharmony_ci struct mpt3_diag_unregister) 938c2ecf20Sopenharmony_ci#define MPT3DIAGQUERY _IOWR(MPT3_MAGIC_NUMBER, 29, \ 948c2ecf20Sopenharmony_ci struct mpt3_diag_query) 958c2ecf20Sopenharmony_ci#define MPT3DIAGREADBUFFER _IOWR(MPT3_MAGIC_NUMBER, 30, \ 968c2ecf20Sopenharmony_ci struct mpt3_diag_read_buffer) 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* Trace Buffer default UniqueId */ 998c2ecf20Sopenharmony_ci#define MPT2DIAGBUFFUNIQUEID (0x07075900) 1008c2ecf20Sopenharmony_ci#define MPT3DIAGBUFFUNIQUEID (0x4252434D) 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci/* UID not found */ 1038c2ecf20Sopenharmony_ci#define MPT3_DIAG_UID_NOT_FOUND (0xFF) 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/** 1078c2ecf20Sopenharmony_ci * struct mpt3_ioctl_header - main header structure 1088c2ecf20Sopenharmony_ci * @ioc_number - IOC unit number 1098c2ecf20Sopenharmony_ci * @port_number - IOC port number 1108c2ecf20Sopenharmony_ci * @max_data_size - maximum number bytes to transfer on read 1118c2ecf20Sopenharmony_ci */ 1128c2ecf20Sopenharmony_cistruct mpt3_ioctl_header { 1138c2ecf20Sopenharmony_ci uint32_t ioc_number; 1148c2ecf20Sopenharmony_ci uint32_t port_number; 1158c2ecf20Sopenharmony_ci uint32_t max_data_size; 1168c2ecf20Sopenharmony_ci}; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/** 1198c2ecf20Sopenharmony_ci * struct mpt3_ioctl_diag_reset - diagnostic reset 1208c2ecf20Sopenharmony_ci * @hdr - generic header 1218c2ecf20Sopenharmony_ci */ 1228c2ecf20Sopenharmony_cistruct mpt3_ioctl_diag_reset { 1238c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 1248c2ecf20Sopenharmony_ci}; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/** 1288c2ecf20Sopenharmony_ci * struct mpt3_ioctl_pci_info - pci device info 1298c2ecf20Sopenharmony_ci * @device - pci device id 1308c2ecf20Sopenharmony_ci * @function - pci function id 1318c2ecf20Sopenharmony_ci * @bus - pci bus id 1328c2ecf20Sopenharmony_ci * @segment_id - pci segment id 1338c2ecf20Sopenharmony_ci */ 1348c2ecf20Sopenharmony_cistruct mpt3_ioctl_pci_info { 1358c2ecf20Sopenharmony_ci union { 1368c2ecf20Sopenharmony_ci struct { 1378c2ecf20Sopenharmony_ci uint32_t device:5; 1388c2ecf20Sopenharmony_ci uint32_t function:3; 1398c2ecf20Sopenharmony_ci uint32_t bus:24; 1408c2ecf20Sopenharmony_ci } bits; 1418c2ecf20Sopenharmony_ci uint32_t word; 1428c2ecf20Sopenharmony_ci } u; 1438c2ecf20Sopenharmony_ci uint32_t segment_id; 1448c2ecf20Sopenharmony_ci}; 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci#define MPT2_IOCTL_INTERFACE_SCSI (0x00) 1488c2ecf20Sopenharmony_ci#define MPT2_IOCTL_INTERFACE_FC (0x01) 1498c2ecf20Sopenharmony_ci#define MPT2_IOCTL_INTERFACE_FC_IP (0x02) 1508c2ecf20Sopenharmony_ci#define MPT2_IOCTL_INTERFACE_SAS (0x03) 1518c2ecf20Sopenharmony_ci#define MPT2_IOCTL_INTERFACE_SAS2 (0x04) 1528c2ecf20Sopenharmony_ci#define MPT2_IOCTL_INTERFACE_SAS2_SSS6200 (0x05) 1538c2ecf20Sopenharmony_ci#define MPT3_IOCTL_INTERFACE_SAS3 (0x06) 1548c2ecf20Sopenharmony_ci#define MPT3_IOCTL_INTERFACE_SAS35 (0x07) 1558c2ecf20Sopenharmony_ci#define MPT2_IOCTL_VERSION_LENGTH (32) 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci/** 1588c2ecf20Sopenharmony_ci * struct mpt3_ioctl_iocinfo - generic controller info 1598c2ecf20Sopenharmony_ci * @hdr - generic header 1608c2ecf20Sopenharmony_ci * @adapter_type - type of adapter (spi, fc, sas) 1618c2ecf20Sopenharmony_ci * @port_number - port number 1628c2ecf20Sopenharmony_ci * @pci_id - PCI Id 1638c2ecf20Sopenharmony_ci * @hw_rev - hardware revision 1648c2ecf20Sopenharmony_ci * @sub_system_device - PCI subsystem Device ID 1658c2ecf20Sopenharmony_ci * @sub_system_vendor - PCI subsystem Vendor ID 1668c2ecf20Sopenharmony_ci * @rsvd0 - reserved 1678c2ecf20Sopenharmony_ci * @firmware_version - firmware version 1688c2ecf20Sopenharmony_ci * @bios_version - BIOS version 1698c2ecf20Sopenharmony_ci * @driver_version - driver version - 32 ASCII characters 1708c2ecf20Sopenharmony_ci * @rsvd1 - reserved 1718c2ecf20Sopenharmony_ci * @scsi_id - scsi id of adapter 0 1728c2ecf20Sopenharmony_ci * @rsvd2 - reserved 1738c2ecf20Sopenharmony_ci * @pci_information - pci info (2nd revision) 1748c2ecf20Sopenharmony_ci */ 1758c2ecf20Sopenharmony_cistruct mpt3_ioctl_iocinfo { 1768c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 1778c2ecf20Sopenharmony_ci uint32_t adapter_type; 1788c2ecf20Sopenharmony_ci uint32_t port_number; 1798c2ecf20Sopenharmony_ci uint32_t pci_id; 1808c2ecf20Sopenharmony_ci uint32_t hw_rev; 1818c2ecf20Sopenharmony_ci uint32_t subsystem_device; 1828c2ecf20Sopenharmony_ci uint32_t subsystem_vendor; 1838c2ecf20Sopenharmony_ci uint32_t rsvd0; 1848c2ecf20Sopenharmony_ci uint32_t firmware_version; 1858c2ecf20Sopenharmony_ci uint32_t bios_version; 1868c2ecf20Sopenharmony_ci uint8_t driver_version[MPT2_IOCTL_VERSION_LENGTH]; 1878c2ecf20Sopenharmony_ci uint8_t rsvd1; 1888c2ecf20Sopenharmony_ci uint8_t scsi_id; 1898c2ecf20Sopenharmony_ci uint16_t rsvd2; 1908c2ecf20Sopenharmony_ci struct mpt3_ioctl_pci_info pci_information; 1918c2ecf20Sopenharmony_ci}; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci/* number of event log entries */ 1958c2ecf20Sopenharmony_ci#define MPT3SAS_CTL_EVENT_LOG_SIZE (200) 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci/** 1988c2ecf20Sopenharmony_ci * struct mpt3_ioctl_eventquery - query event count and type 1998c2ecf20Sopenharmony_ci * @hdr - generic header 2008c2ecf20Sopenharmony_ci * @event_entries - number of events returned by get_event_report 2018c2ecf20Sopenharmony_ci * @rsvd - reserved 2028c2ecf20Sopenharmony_ci * @event_types - type of events currently being captured 2038c2ecf20Sopenharmony_ci */ 2048c2ecf20Sopenharmony_cistruct mpt3_ioctl_eventquery { 2058c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 2068c2ecf20Sopenharmony_ci uint16_t event_entries; 2078c2ecf20Sopenharmony_ci uint16_t rsvd; 2088c2ecf20Sopenharmony_ci uint32_t event_types[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; 2098c2ecf20Sopenharmony_ci}; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci/** 2128c2ecf20Sopenharmony_ci * struct mpt3_ioctl_eventenable - enable/disable event capturing 2138c2ecf20Sopenharmony_ci * @hdr - generic header 2148c2ecf20Sopenharmony_ci * @event_types - toggle off/on type of events to be captured 2158c2ecf20Sopenharmony_ci */ 2168c2ecf20Sopenharmony_cistruct mpt3_ioctl_eventenable { 2178c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 2188c2ecf20Sopenharmony_ci uint32_t event_types[4]; 2198c2ecf20Sopenharmony_ci}; 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci#define MPT3_EVENT_DATA_SIZE (192) 2228c2ecf20Sopenharmony_ci/** 2238c2ecf20Sopenharmony_ci * struct MPT3_IOCTL_EVENTS - 2248c2ecf20Sopenharmony_ci * @event - the event that was reported 2258c2ecf20Sopenharmony_ci * @context - unique value for each event assigned by driver 2268c2ecf20Sopenharmony_ci * @data - event data returned in fw reply message 2278c2ecf20Sopenharmony_ci */ 2288c2ecf20Sopenharmony_cistruct MPT3_IOCTL_EVENTS { 2298c2ecf20Sopenharmony_ci uint32_t event; 2308c2ecf20Sopenharmony_ci uint32_t context; 2318c2ecf20Sopenharmony_ci uint8_t data[MPT3_EVENT_DATA_SIZE]; 2328c2ecf20Sopenharmony_ci}; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci/** 2358c2ecf20Sopenharmony_ci * struct mpt3_ioctl_eventreport - returing event log 2368c2ecf20Sopenharmony_ci * @hdr - generic header 2378c2ecf20Sopenharmony_ci * @event_data - (see struct MPT3_IOCTL_EVENTS) 2388c2ecf20Sopenharmony_ci */ 2398c2ecf20Sopenharmony_cistruct mpt3_ioctl_eventreport { 2408c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 2418c2ecf20Sopenharmony_ci struct MPT3_IOCTL_EVENTS event_data[1]; 2428c2ecf20Sopenharmony_ci}; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci/** 2458c2ecf20Sopenharmony_ci * struct mpt3_ioctl_command - generic mpt firmware passthru ioctl 2468c2ecf20Sopenharmony_ci * @hdr - generic header 2478c2ecf20Sopenharmony_ci * @timeout - command timeout in seconds. (if zero then use driver default 2488c2ecf20Sopenharmony_ci * value). 2498c2ecf20Sopenharmony_ci * @reply_frame_buf_ptr - reply location 2508c2ecf20Sopenharmony_ci * @data_in_buf_ptr - destination for read 2518c2ecf20Sopenharmony_ci * @data_out_buf_ptr - data source for write 2528c2ecf20Sopenharmony_ci * @sense_data_ptr - sense data location 2538c2ecf20Sopenharmony_ci * @max_reply_bytes - maximum number of reply bytes to be sent to app. 2548c2ecf20Sopenharmony_ci * @data_in_size - number bytes for data transfer in (read) 2558c2ecf20Sopenharmony_ci * @data_out_size - number bytes for data transfer out (write) 2568c2ecf20Sopenharmony_ci * @max_sense_bytes - maximum number of bytes for auto sense buffers 2578c2ecf20Sopenharmony_ci * @data_sge_offset - offset in words from the start of the request message to 2588c2ecf20Sopenharmony_ci * the first SGL 2598c2ecf20Sopenharmony_ci * @mf[1]; 2608c2ecf20Sopenharmony_ci */ 2618c2ecf20Sopenharmony_cistruct mpt3_ioctl_command { 2628c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 2638c2ecf20Sopenharmony_ci uint32_t timeout; 2648c2ecf20Sopenharmony_ci void __user *reply_frame_buf_ptr; 2658c2ecf20Sopenharmony_ci void __user *data_in_buf_ptr; 2668c2ecf20Sopenharmony_ci void __user *data_out_buf_ptr; 2678c2ecf20Sopenharmony_ci void __user *sense_data_ptr; 2688c2ecf20Sopenharmony_ci uint32_t max_reply_bytes; 2698c2ecf20Sopenharmony_ci uint32_t data_in_size; 2708c2ecf20Sopenharmony_ci uint32_t data_out_size; 2718c2ecf20Sopenharmony_ci uint32_t max_sense_bytes; 2728c2ecf20Sopenharmony_ci uint32_t data_sge_offset; 2738c2ecf20Sopenharmony_ci uint8_t mf[1]; 2748c2ecf20Sopenharmony_ci}; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT 2778c2ecf20Sopenharmony_cistruct mpt3_ioctl_command32 { 2788c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 2798c2ecf20Sopenharmony_ci uint32_t timeout; 2808c2ecf20Sopenharmony_ci uint32_t reply_frame_buf_ptr; 2818c2ecf20Sopenharmony_ci uint32_t data_in_buf_ptr; 2828c2ecf20Sopenharmony_ci uint32_t data_out_buf_ptr; 2838c2ecf20Sopenharmony_ci uint32_t sense_data_ptr; 2848c2ecf20Sopenharmony_ci uint32_t max_reply_bytes; 2858c2ecf20Sopenharmony_ci uint32_t data_in_size; 2868c2ecf20Sopenharmony_ci uint32_t data_out_size; 2878c2ecf20Sopenharmony_ci uint32_t max_sense_bytes; 2888c2ecf20Sopenharmony_ci uint32_t data_sge_offset; 2898c2ecf20Sopenharmony_ci uint8_t mf[1]; 2908c2ecf20Sopenharmony_ci}; 2918c2ecf20Sopenharmony_ci#endif 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci/** 2948c2ecf20Sopenharmony_ci * struct mpt3_ioctl_btdh_mapping - mapping info 2958c2ecf20Sopenharmony_ci * @hdr - generic header 2968c2ecf20Sopenharmony_ci * @id - target device identification number 2978c2ecf20Sopenharmony_ci * @bus - SCSI bus number that the target device exists on 2988c2ecf20Sopenharmony_ci * @handle - device handle for the target device 2998c2ecf20Sopenharmony_ci * @rsvd - reserved 3008c2ecf20Sopenharmony_ci * 3018c2ecf20Sopenharmony_ci * To obtain a bus/id the application sets 3028c2ecf20Sopenharmony_ci * handle to valid handle, and bus/id to 0xFFFF. 3038c2ecf20Sopenharmony_ci * 3048c2ecf20Sopenharmony_ci * To obtain the device handle the application sets 3058c2ecf20Sopenharmony_ci * bus/id valid value, and the handle to 0xFFFF. 3068c2ecf20Sopenharmony_ci */ 3078c2ecf20Sopenharmony_cistruct mpt3_ioctl_btdh_mapping { 3088c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 3098c2ecf20Sopenharmony_ci uint32_t id; 3108c2ecf20Sopenharmony_ci uint32_t bus; 3118c2ecf20Sopenharmony_ci uint16_t handle; 3128c2ecf20Sopenharmony_ci uint16_t rsvd; 3138c2ecf20Sopenharmony_ci}; 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci/* application flags for mpt3_diag_register, mpt3_diag_query */ 3188c2ecf20Sopenharmony_ci#define MPT3_APP_FLAGS_APP_OWNED (0x0001) 3198c2ecf20Sopenharmony_ci#define MPT3_APP_FLAGS_BUFFER_VALID (0x0002) 3208c2ecf20Sopenharmony_ci#define MPT3_APP_FLAGS_FW_BUFFER_ACCESS (0x0004) 3218c2ecf20Sopenharmony_ci#define MPT3_APP_FLAGS_DYNAMIC_BUFFER_ALLOC (0x0008) 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci/* flags for mpt3_diag_read_buffer */ 3248c2ecf20Sopenharmony_ci#define MPT3_FLAGS_REREGISTER (0x0001) 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci#define MPT3_PRODUCT_SPECIFIC_DWORDS 23 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci/** 3298c2ecf20Sopenharmony_ci * struct mpt3_diag_register - application register with driver 3308c2ecf20Sopenharmony_ci * @hdr - generic header 3318c2ecf20Sopenharmony_ci * @reserved - 3328c2ecf20Sopenharmony_ci * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 3338c2ecf20Sopenharmony_ci * @application_flags - misc flags 3348c2ecf20Sopenharmony_ci * @diagnostic_flags - specifies flags affecting command processing 3358c2ecf20Sopenharmony_ci * @product_specific - product specific information 3368c2ecf20Sopenharmony_ci * @requested_buffer_size - buffers size in bytes 3378c2ecf20Sopenharmony_ci * @unique_id - tag specified by application that is used to signal ownership 3388c2ecf20Sopenharmony_ci * of the buffer. 3398c2ecf20Sopenharmony_ci * 3408c2ecf20Sopenharmony_ci * This will allow the driver to setup any required buffers that will be 3418c2ecf20Sopenharmony_ci * needed by firmware to communicate with the driver. 3428c2ecf20Sopenharmony_ci */ 3438c2ecf20Sopenharmony_cistruct mpt3_diag_register { 3448c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 3458c2ecf20Sopenharmony_ci uint8_t reserved; 3468c2ecf20Sopenharmony_ci uint8_t buffer_type; 3478c2ecf20Sopenharmony_ci uint16_t application_flags; 3488c2ecf20Sopenharmony_ci uint32_t diagnostic_flags; 3498c2ecf20Sopenharmony_ci uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 3508c2ecf20Sopenharmony_ci uint32_t requested_buffer_size; 3518c2ecf20Sopenharmony_ci uint32_t unique_id; 3528c2ecf20Sopenharmony_ci}; 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci/** 3558c2ecf20Sopenharmony_ci * struct mpt3_diag_unregister - application unregister with driver 3568c2ecf20Sopenharmony_ci * @hdr - generic header 3578c2ecf20Sopenharmony_ci * @unique_id - tag uniquely identifies the buffer to be unregistered 3588c2ecf20Sopenharmony_ci * 3598c2ecf20Sopenharmony_ci * This will allow the driver to cleanup any memory allocated for diag 3608c2ecf20Sopenharmony_ci * messages and to free up any resources. 3618c2ecf20Sopenharmony_ci */ 3628c2ecf20Sopenharmony_cistruct mpt3_diag_unregister { 3638c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 3648c2ecf20Sopenharmony_ci uint32_t unique_id; 3658c2ecf20Sopenharmony_ci}; 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci/** 3688c2ecf20Sopenharmony_ci * struct mpt3_diag_query - query relevant info associated with diag buffers 3698c2ecf20Sopenharmony_ci * @hdr - generic header 3708c2ecf20Sopenharmony_ci * @reserved - 3718c2ecf20Sopenharmony_ci * @buffer_type - specifies either TRACE, SNAPSHOT, or EXTENDED 3728c2ecf20Sopenharmony_ci * @application_flags - misc flags 3738c2ecf20Sopenharmony_ci * @diagnostic_flags - specifies flags affecting command processing 3748c2ecf20Sopenharmony_ci * @product_specific - product specific information 3758c2ecf20Sopenharmony_ci * @total_buffer_size - diag buffer size in bytes 3768c2ecf20Sopenharmony_ci * @driver_added_buffer_size - size of extra space appended to end of buffer 3778c2ecf20Sopenharmony_ci * @unique_id - unique id associated with this buffer. 3788c2ecf20Sopenharmony_ci * 3798c2ecf20Sopenharmony_ci * The application will send only buffer_type and unique_id. Driver will 3808c2ecf20Sopenharmony_ci * inspect unique_id first, if valid, fill in all the info. If unique_id is 3818c2ecf20Sopenharmony_ci * 0x00, the driver will return info specified by Buffer Type. 3828c2ecf20Sopenharmony_ci */ 3838c2ecf20Sopenharmony_cistruct mpt3_diag_query { 3848c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 3858c2ecf20Sopenharmony_ci uint8_t reserved; 3868c2ecf20Sopenharmony_ci uint8_t buffer_type; 3878c2ecf20Sopenharmony_ci uint16_t application_flags; 3888c2ecf20Sopenharmony_ci uint32_t diagnostic_flags; 3898c2ecf20Sopenharmony_ci uint32_t product_specific[MPT3_PRODUCT_SPECIFIC_DWORDS]; 3908c2ecf20Sopenharmony_ci uint32_t total_buffer_size; 3918c2ecf20Sopenharmony_ci uint32_t driver_added_buffer_size; 3928c2ecf20Sopenharmony_ci uint32_t unique_id; 3938c2ecf20Sopenharmony_ci}; 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci/** 3968c2ecf20Sopenharmony_ci * struct mpt3_diag_release - request to send Diag Release Message to firmware 3978c2ecf20Sopenharmony_ci * @hdr - generic header 3988c2ecf20Sopenharmony_ci * @unique_id - tag uniquely identifies the buffer to be released 3998c2ecf20Sopenharmony_ci * 4008c2ecf20Sopenharmony_ci * This allows ownership of the specified buffer to returned to the driver, 4018c2ecf20Sopenharmony_ci * allowing an application to read the buffer without fear that firmware is 4028c2ecf20Sopenharmony_ci * overwriting information in the buffer. 4038c2ecf20Sopenharmony_ci */ 4048c2ecf20Sopenharmony_cistruct mpt3_diag_release { 4058c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 4068c2ecf20Sopenharmony_ci uint32_t unique_id; 4078c2ecf20Sopenharmony_ci}; 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci/** 4108c2ecf20Sopenharmony_ci * struct mpt3_diag_read_buffer - request for copy of the diag buffer 4118c2ecf20Sopenharmony_ci * @hdr - generic header 4128c2ecf20Sopenharmony_ci * @status - 4138c2ecf20Sopenharmony_ci * @reserved - 4148c2ecf20Sopenharmony_ci * @flags - misc flags 4158c2ecf20Sopenharmony_ci * @starting_offset - starting offset within drivers buffer where to start 4168c2ecf20Sopenharmony_ci * reading data at into the specified application buffer 4178c2ecf20Sopenharmony_ci * @bytes_to_read - number of bytes to copy from the drivers buffer into the 4188c2ecf20Sopenharmony_ci * application buffer starting at starting_offset. 4198c2ecf20Sopenharmony_ci * @unique_id - unique id associated with this buffer. 4208c2ecf20Sopenharmony_ci * @diagnostic_data - data payload 4218c2ecf20Sopenharmony_ci */ 4228c2ecf20Sopenharmony_cistruct mpt3_diag_read_buffer { 4238c2ecf20Sopenharmony_ci struct mpt3_ioctl_header hdr; 4248c2ecf20Sopenharmony_ci uint8_t status; 4258c2ecf20Sopenharmony_ci uint8_t reserved; 4268c2ecf20Sopenharmony_ci uint16_t flags; 4278c2ecf20Sopenharmony_ci uint32_t starting_offset; 4288c2ecf20Sopenharmony_ci uint32_t bytes_to_read; 4298c2ecf20Sopenharmony_ci uint32_t unique_id; 4308c2ecf20Sopenharmony_ci uint32_t diagnostic_data[1]; 4318c2ecf20Sopenharmony_ci}; 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ci#endif /* MPT3SAS_CTL_H_INCLUDED */ 434