11e66f787SSean Bruno /*- 2*7ea28254SJohn Hall * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries. 31e66f787SSean Bruno * 41e66f787SSean Bruno * Redistribution and use in source and binary forms, with or without 51e66f787SSean Bruno * modification, are permitted provided that the following conditions 61e66f787SSean Bruno * are met: 71e66f787SSean Bruno * 1. Redistributions of source code must retain the above copyright 81e66f787SSean Bruno * notice, this list of conditions and the following disclaimer. 91e66f787SSean Bruno * 2. Redistributions in binary form must reproduce the above copyright 101e66f787SSean Bruno * notice, this list of conditions and the following disclaimer in the 111e66f787SSean Bruno * documentation and/or other materials provided with the distribution. 121e66f787SSean Bruno * 131e66f787SSean Bruno * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 141e66f787SSean Bruno * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 151e66f787SSean Bruno * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 161e66f787SSean Bruno * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 171e66f787SSean Bruno * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 181e66f787SSean Bruno * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 191e66f787SSean Bruno * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 201e66f787SSean Bruno * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 211e66f787SSean Bruno * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 221e66f787SSean Bruno * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 231e66f787SSean Bruno * SUCH DAMAGE. 241e66f787SSean Bruno */ 251e66f787SSean Bruno 261e66f787SSean Bruno 271e66f787SSean Bruno #ifndef _PQI_STRUCTURES_H 281e66f787SSean Bruno #define _PQI_STRUCTURES_H 291e66f787SSean Bruno 30*7ea28254SJohn Hall 31*7ea28254SJohn Hall #include "smartpqi_defines.h" 32*7ea28254SJohn Hall 331e66f787SSean Bruno struct bmic_host_wellness_driver_version { 341e66f787SSean Bruno uint8_t start_tag[4]; 351e66f787SSean Bruno uint8_t driver_version_tag[2]; 361e66f787SSean Bruno uint16_t driver_version_length; 371e66f787SSean Bruno char driver_version[32]; 381e66f787SSean Bruno uint8_t end_tag[2]; 391e66f787SSean Bruno 401e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 411e66f787SSean Bruno 42*7ea28254SJohn Hall 431e66f787SSean Bruno struct bmic_host_wellness_time { 441e66f787SSean Bruno uint8_t start_tag[4]; 451e66f787SSean Bruno uint8_t time_tag[2]; 461e66f787SSean Bruno uint16_t time_length; 471e66f787SSean Bruno uint8_t hour; 481e66f787SSean Bruno uint8_t min; 491e66f787SSean Bruno uint8_t sec; 501e66f787SSean Bruno uint8_t reserved; 511e66f787SSean Bruno uint8_t month; 521e66f787SSean Bruno uint8_t day; 531e66f787SSean Bruno uint8_t century; 541e66f787SSean Bruno uint8_t year; 551e66f787SSean Bruno uint8_t dont_write_tag[2]; 561e66f787SSean Bruno uint8_t end_tag[2]; 571e66f787SSean Bruno 581e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 591e66f787SSean Bruno 60*7ea28254SJohn Hall 611e66f787SSean Bruno /* As per PQI Spec pqi-2r00a , 6.2.2. */ 621e66f787SSean Bruno 631e66f787SSean Bruno /* device capability register , for admin q table 24 */ 641e66f787SSean Bruno struct pqi_dev_adminq_cap { 651e66f787SSean Bruno uint8_t max_admin_ibq_elem; 661e66f787SSean Bruno uint8_t max_admin_obq_elem; 671e66f787SSean Bruno uint8_t admin_ibq_elem_len; 681e66f787SSean Bruno uint8_t admin_obq_elem_len; 691e66f787SSean Bruno uint16_t max_pqi_dev_reset_tmo; 701e66f787SSean Bruno uint8_t res[2]; 711e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 721e66f787SSean Bruno 731e66f787SSean Bruno /* admin q parameter reg , table 36 */ 741e66f787SSean Bruno struct admin_q_param { 751e66f787SSean Bruno uint8_t num_iq_elements; 761e66f787SSean Bruno uint8_t num_oq_elements; 771e66f787SSean Bruno uint8_t intr_msg_num; 781e66f787SSean Bruno uint8_t msix_disable; 791e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 801e66f787SSean Bruno 811e66f787SSean Bruno struct pqi_registers { 821e66f787SSean Bruno uint64_t signature; 831e66f787SSean Bruno uint64_t admin_q_config; 841e66f787SSean Bruno uint64_t pqi_dev_adminq_cap; 851e66f787SSean Bruno uint32_t legacy_intr_status; 861e66f787SSean Bruno uint32_t legacy_intr_mask_set; 871e66f787SSean Bruno uint32_t legacy_intr_mask_clr; 881e66f787SSean Bruno uint8_t res1[28]; 891e66f787SSean Bruno uint32_t pqi_dev_status; 901e66f787SSean Bruno uint8_t res2[4]; 911e66f787SSean Bruno uint64_t admin_ibq_pi_offset; 921e66f787SSean Bruno uint64_t admin_obq_ci_offset; 931e66f787SSean Bruno uint64_t admin_ibq_elem_array_addr; 941e66f787SSean Bruno uint64_t admin_obq_elem_array_addr; 951e66f787SSean Bruno uint64_t admin_ibq_ci_addr; 961e66f787SSean Bruno uint64_t admin_obq_pi_addr; 971e66f787SSean Bruno uint32_t admin_q_param; 981e66f787SSean Bruno uint8_t res3[4]; 991e66f787SSean Bruno uint32_t pqi_dev_err; 1001e66f787SSean Bruno uint8_t res4[4]; 1011e66f787SSean Bruno uint64_t error_details; 1021e66f787SSean Bruno uint32_t dev_reset; 1031e66f787SSean Bruno uint32_t power_action; 1041e66f787SSean Bruno uint8_t res5[104]; 1051e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 1061e66f787SSean Bruno 1071e66f787SSean Bruno /* 1081e66f787SSean Bruno * IOA controller registers 1091e66f787SSean Bruno * Mapped in PCIe BAR 0. 1101e66f787SSean Bruno */ 1111e66f787SSean Bruno 1121e66f787SSean Bruno struct ioa_registers { 1131e66f787SSean Bruno uint8_t res1[0x18]; 1141e66f787SSean Bruno uint32_t host_to_ioa_db_mask_clr; /* 18h */ 1151e66f787SSean Bruno uint8_t res2[4]; 1161e66f787SSean Bruno uint32_t host_to_ioa_db; /* 20h */ 1171e66f787SSean Bruno uint8_t res3[4]; 1181e66f787SSean Bruno uint32_t host_to_ioa_db_clr; /* 28h */ 1191e66f787SSean Bruno uint8_t res4[8]; 1201e66f787SSean Bruno uint32_t ioa_to_host_glob_int_mask; /* 34h */ 1211e66f787SSean Bruno uint8_t res5[0x64]; 1221e66f787SSean Bruno uint32_t ioa_to_host_db; /* 9Ch */ 1231e66f787SSean Bruno uint32_t ioa_to_host_db_clr; /* A0h */ 1241e66f787SSean Bruno uint8_t res6[4]; 1251e66f787SSean Bruno uint32_t ioa_to_host_db_mask; /* A8h */ 1261e66f787SSean Bruno uint32_t ioa_to_host_db_mask_clr; /* ACh */ 1271e66f787SSean Bruno uint32_t scratchpad0; /* B0h */ 1281e66f787SSean Bruno uint32_t scratchpad1; /* B4h */ 1291e66f787SSean Bruno uint32_t scratchpad2; /* B8h */ 1301e66f787SSean Bruno uint32_t scratchpad3_fw_status; /* BCh */ 1311e66f787SSean Bruno uint8_t res7[8]; 1321e66f787SSean Bruno uint32_t scratchpad4; /* C8h */ 1331e66f787SSean Bruno uint8_t res8[0xf34]; /* 0xC8 + 4 + 0xf34 = 1000h */ 1341e66f787SSean Bruno uint32_t mb[8]; /* 1000h */ 1351e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 1361e66f787SSean Bruno 1379fac68fcSPAPANI SRIKANTH 1381e66f787SSean Bruno /* PQI Preferred settings */ 1391e66f787SSean Bruno struct pqi_pref_settings { 1401e66f787SSean Bruno uint16_t max_cmd_size; 1411e66f787SSean Bruno uint16_t max_fib_size; 1421e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 1431e66f787SSean Bruno 1441e66f787SSean Bruno /* pqi capability by sis interface */ 1451e66f787SSean Bruno struct pqi_cap { 1461e66f787SSean Bruno uint32_t max_sg_elem; 1471e66f787SSean Bruno uint32_t max_transfer_size; 1481e66f787SSean Bruno uint32_t max_outstanding_io; 1491e66f787SSean Bruno uint32_t conf_tab_off; 1501e66f787SSean Bruno uint32_t conf_tab_sz; 1511e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 1521e66f787SSean Bruno 1531e66f787SSean Bruno struct pqi_conf_table { 1541e66f787SSean Bruno uint8_t sign[8]; /* "CFGTABLE" */ 1551e66f787SSean Bruno uint32_t first_section_off; 1561e66f787SSean Bruno }; 1571e66f787SSean Bruno 1581e66f787SSean Bruno struct pqi_conf_table_section_header { 1591e66f787SSean Bruno uint16_t section_id; 1601e66f787SSean Bruno uint16_t next_section_off; 1611e66f787SSean Bruno }; 1621e66f787SSean Bruno 1631e66f787SSean Bruno struct pqi_conf_table_general_info { 1641e66f787SSean Bruno struct pqi_conf_table_section_header header; 1651e66f787SSean Bruno uint32_t section_len; 1661e66f787SSean Bruno uint32_t max_outstanding_req; 1671e66f787SSean Bruno uint32_t max_sg_size; 1681e66f787SSean Bruno uint32_t max_sg_per_req; 1691e66f787SSean Bruno }; 1701e66f787SSean Bruno 1711e66f787SSean Bruno struct pqi_conf_table_debug { 1721e66f787SSean Bruno struct pqi_conf_table_section_header header; 1731e66f787SSean Bruno uint32_t scratchpad; 1741e66f787SSean Bruno }; 1751e66f787SSean Bruno 1761e66f787SSean Bruno struct pqi_conf_table_heartbeat { 1771e66f787SSean Bruno struct pqi_conf_table_section_header header; 1781e66f787SSean Bruno uint32_t heartbeat_counter; 1791e66f787SSean Bruno }; 1801e66f787SSean Bruno 1811e66f787SSean Bruno typedef union pqi_reset_reg { 1821e66f787SSean Bruno struct { 1831e66f787SSean Bruno uint32_t reset_type : 3; 1841e66f787SSean Bruno uint32_t reserved : 2; 1851e66f787SSean Bruno uint32_t reset_action : 3; 1861e66f787SSean Bruno uint32_t hold_in_pd1 : 1; 1871e66f787SSean Bruno uint32_t reserved2 : 23; 1881e66f787SSean Bruno } bits; 1891e66f787SSean Bruno uint32_t all_bits; 1901e66f787SSean Bruno }pqi_reset_reg_t; 1911e66f787SSean Bruno 1921e66f787SSean Bruno /* Memory descriptor for DMA memory allocation */ 1931e66f787SSean Bruno typedef struct dma_mem { 1941e66f787SSean Bruno void *virt_addr; 1951e66f787SSean Bruno dma_addr_t dma_addr; 1961e66f787SSean Bruno uint32_t size; 1971e66f787SSean Bruno uint32_t align; 198*7ea28254SJohn Hall char tag[32]; 1991e66f787SSean Bruno bus_dma_tag_t dma_tag; 2001e66f787SSean Bruno bus_dmamap_t dma_map; 2011e66f787SSean Bruno }dma_mem_t; 2021e66f787SSean Bruno 203*7ea28254SJohn Hall /* Lock should be 8 byte aligned 204*7ea28254SJohn Hall TODO : need to apply aligned for lock alone ? 205*7ea28254SJohn Hall */ 2061e66f787SSean Bruno 2071e66f787SSean Bruno #ifndef LOCKFREE_STACK 2081e66f787SSean Bruno 2091e66f787SSean Bruno typedef struct pqi_taglist { 2101e66f787SSean Bruno uint32_t max_elem; 2111e66f787SSean Bruno uint32_t num_elem; 2121e66f787SSean Bruno uint32_t head; 2131e66f787SSean Bruno uint32_t tail; 2141e66f787SSean Bruno uint32_t *elem_array; 2151e66f787SSean Bruno boolean_t lockcreated; 2161e66f787SSean Bruno char lockname[LOCKNAME_SIZE]; 2171e66f787SSean Bruno OS_LOCK_T lock OS_ATTRIBUTE_ALIGNED(8); 2181e66f787SSean Bruno }pqi_taglist_t; 2191e66f787SSean Bruno 2201e66f787SSean Bruno #else /* LOCKFREE_STACK */ 2211e66f787SSean Bruno 2221e66f787SSean Bruno union head_list { 2231e66f787SSean Bruno struct { 2241e66f787SSean Bruno uint32_t seq_no; /* To avoid aba problem */ 2251e66f787SSean Bruno uint32_t index; /* Index at the top of the stack */ 2261e66f787SSean Bruno }top; 2271e66f787SSean Bruno uint64_t data; 2281e66f787SSean Bruno }; 2291e66f787SSean Bruno /* lock-free stack used to push and pop the tag used for IO request */ 2301e66f787SSean Bruno typedef struct lockless_stack { 2311e66f787SSean Bruno uint32_t *next_index_array; 2329fac68fcSPAPANI SRIKANTH uint32_t max_elem;/*No.of total elements*/ 2339fac68fcSPAPANI SRIKANTH uint32_t num_elem;/*No.of present elements*/ 2341e66f787SSean Bruno volatile union head_list head OS_ATTRIBUTE_ALIGNED(8); 2351e66f787SSean Bruno }lockless_stack_t; 2361e66f787SSean Bruno 2371e66f787SSean Bruno #endif /* LOCKFREE_STACK */ 2381e66f787SSean Bruno 2391e66f787SSean Bruno /* 2401e66f787SSean Bruno * PQI SGL descriptor layouts. 2411e66f787SSean Bruno */ 2421e66f787SSean Bruno /* 2431e66f787SSean Bruno * SGL (Scatter Gather List) descriptor Codes 2441e66f787SSean Bruno */ 2451e66f787SSean Bruno 2461e66f787SSean Bruno #define SGL_DESCRIPTOR_CODE_DATA_BLOCK 0x0 2471e66f787SSean Bruno #define SGL_DESCRIPTOR_CODE_BIT_BUCKET 0x1 2481e66f787SSean Bruno #define SGL_DESCRIPTOR_CODE_STANDARD_SEGMENT 0x2 2491e66f787SSean Bruno #define SGL_DESCRIPTOR_CODE_LAST_STANDARD_SEGMENT 0x3 2501e66f787SSean Bruno #define SGL_DESCRIPTOR_CODE_LAST_ALTERNATIVE_SGL_SEGMENT 0x4 2511e66f787SSean Bruno #define SGL_DESCRIPTOR_CODE_VENDOR_SPECIFIC 0xF 2521e66f787SSean Bruno 2531e66f787SSean Bruno typedef struct sgl_descriptor 2541e66f787SSean Bruno { 2551e66f787SSean Bruno uint64_t addr; /* !< Bytes 0-7. The starting 64-bit memory byte address of the data block. */ 2561e66f787SSean Bruno uint32_t length; /* !< Bytes 8-11. The length in bytes of the data block. Set to 0x00000000 specifies that no data be transferred. */ 2571e66f787SSean Bruno uint8_t res[3]; /* !< Bytes 12-14. */ 2581e66f787SSean Bruno uint8_t zero : 4; /* !< Byte 15, Bits 0-3. */ 2591e66f787SSean Bruno uint8_t type : 4; /* !< Byte 15, Bits 4-7. sgl descriptor type */ 2601e66f787SSean Bruno } sg_desc_t; 2611e66f787SSean Bruno 2621e66f787SSean Bruno /* PQI IUs */ 2631e66f787SSean Bruno typedef struct iu_header 2641e66f787SSean Bruno { 2651e66f787SSean Bruno uint8_t iu_type; 2661e66f787SSean Bruno uint8_t comp_feature; 2671e66f787SSean Bruno uint16_t iu_length; 2681e66f787SSean Bruno }OS_ATTRIBUTE_PACKED iu_header_t; 2691e66f787SSean Bruno 2709fac68fcSPAPANI SRIKANTH 2711e66f787SSean Bruno typedef struct general_admin_request /* REPORT_PQI_DEVICE_CAPABILITY, REPORT_MANUFACTURER_INFO, REPORT_OPERATIONAL_IQ, REPORT_OPERATIONAL_OQ all same layout. */ 2721e66f787SSean Bruno { 2731e66f787SSean Bruno iu_header_t header; /* !< Bytes 0-3. */ 2741e66f787SSean Bruno uint16_t res1; 2751e66f787SSean Bruno uint16_t work; 2761e66f787SSean Bruno uint16_t req_id; /* !< Bytes 8-9. request identifier */ 2771e66f787SSean Bruno uint8_t fn_code; /* !< Byte 10. which administrator function */ 2781e66f787SSean Bruno union { 2791e66f787SSean Bruno struct { 2801e66f787SSean Bruno uint8_t res2[33]; /* !< Bytes 11-43. function specific */ 2811e66f787SSean Bruno uint32_t buf_size; /* !< Bytes 44-47. size in bytes of the Data-In/Out Buffer */ 2821e66f787SSean Bruno sg_desc_t sg_desc; /* !< Bytes 48-63. SGL */ 2831e66f787SSean Bruno } OS_ATTRIBUTE_PACKED general_func; 2841e66f787SSean Bruno 2851e66f787SSean Bruno struct { 2861e66f787SSean Bruno uint8_t res1; 2871e66f787SSean Bruno uint16_t qid; 2881e66f787SSean Bruno uint8_t res2[2]; 2891e66f787SSean Bruno uint64_t elem_arr_addr; 2901e66f787SSean Bruno uint64_t iq_ci_addr; 2911e66f787SSean Bruno uint16_t num_elem; 2921e66f787SSean Bruno uint16_t elem_len; 2931e66f787SSean Bruno uint8_t queue_proto; 2941e66f787SSean Bruno uint8_t arb_prio; 2951e66f787SSean Bruno uint8_t res3[22]; 2961e66f787SSean Bruno uint32_t vend_specific; 2971e66f787SSean Bruno } OS_ATTRIBUTE_PACKED create_op_iq; 2981e66f787SSean Bruno 2991e66f787SSean Bruno struct { 3001e66f787SSean Bruno uint8_t res1; 3011e66f787SSean Bruno uint16_t qid; 3021e66f787SSean Bruno uint8_t res2[2]; 3031e66f787SSean Bruno uint64_t elem_arr_addr; 3041e66f787SSean Bruno uint64_t ob_pi_addr; 3051e66f787SSean Bruno uint16_t num_elem; 3061e66f787SSean Bruno uint16_t elem_len; 3071e66f787SSean Bruno uint8_t queue_proto; 3081e66f787SSean Bruno uint8_t res3[3]; 3091e66f787SSean Bruno uint16_t intr_msg_num; 3101e66f787SSean Bruno uint16_t coales_count; 3111e66f787SSean Bruno uint32_t min_coales_time; 3121e66f787SSean Bruno uint32_t max_coales_time; 3131e66f787SSean Bruno uint8_t res4[8]; 3141e66f787SSean Bruno uint32_t vend_specific; 3151e66f787SSean Bruno } OS_ATTRIBUTE_PACKED create_op_oq; 3161e66f787SSean Bruno 3171e66f787SSean Bruno struct { 3181e66f787SSean Bruno uint8_t res1; 3191e66f787SSean Bruno uint16_t qid; 3201e66f787SSean Bruno uint8_t res2[50]; 3211e66f787SSean Bruno } OS_ATTRIBUTE_PACKED delete_op_queue; 3221e66f787SSean Bruno 3231e66f787SSean Bruno struct { 3241e66f787SSean Bruno uint8_t res1; 3251e66f787SSean Bruno uint16_t qid; 3261e66f787SSean Bruno uint8_t res2[46]; 3271e66f787SSean Bruno uint32_t vend_specific; 3281e66f787SSean Bruno } OS_ATTRIBUTE_PACKED change_op_iq_prop; 3291e66f787SSean Bruno 3301e66f787SSean Bruno } OS_ATTRIBUTE_PACKED req_type; 3311e66f787SSean Bruno 3321e66f787SSean Bruno }OS_ATTRIBUTE_PACKED gen_adm_req_iu_t; 3331e66f787SSean Bruno 3349fac68fcSPAPANI SRIKANTH 3351e66f787SSean Bruno typedef struct general_admin_response { 3361e66f787SSean Bruno iu_header_t header; 3371e66f787SSean Bruno uint16_t res1; 3381e66f787SSean Bruno uint16_t work; 3391e66f787SSean Bruno uint16_t req_id; 3401e66f787SSean Bruno uint8_t fn_code; 3411e66f787SSean Bruno uint8_t status; 3421e66f787SSean Bruno union { 3431e66f787SSean Bruno struct { 3441e66f787SSean Bruno uint8_t status_desc[4]; 3451e66f787SSean Bruno uint64_t pi_offset; 3461e66f787SSean Bruno uint8_t res[40]; 3471e66f787SSean Bruno } OS_ATTRIBUTE_PACKED create_op_iq; 3481e66f787SSean Bruno 3491e66f787SSean Bruno struct { 3501e66f787SSean Bruno uint8_t status_desc[4]; 3511e66f787SSean Bruno uint64_t ci_offset; 3521e66f787SSean Bruno uint8_t res[40]; 3531e66f787SSean Bruno } OS_ATTRIBUTE_PACKED create_op_oq; 3541e66f787SSean Bruno } OS_ATTRIBUTE_PACKED resp_type; 3551e66f787SSean Bruno } OS_ATTRIBUTE_PACKED gen_adm_resp_iu_t ; 3561e66f787SSean Bruno 3571e66f787SSean Bruno /*report and set Event config IU*/ 3581e66f787SSean Bruno 3591e66f787SSean Bruno typedef struct pqi_event_config_request { 3601e66f787SSean Bruno iu_header_t header; 3611e66f787SSean Bruno uint16_t response_queue_id; /* specifies the OQ where the response 3621e66f787SSean Bruno IU is to be delivered */ 3631e66f787SSean Bruno uint8_t work_area[2]; /* reserved for driver use */ 3641e66f787SSean Bruno uint16_t request_id; 3651e66f787SSean Bruno union { 3661e66f787SSean Bruno uint16_t reserved; /* Report event config iu */ 3671e66f787SSean Bruno uint16_t global_event_oq_id; /* Set event config iu */ 3681e66f787SSean Bruno }iu_specific; 3691e66f787SSean Bruno uint32_t buffer_length; 3701e66f787SSean Bruno sg_desc_t sg_desc; 3711e66f787SSean Bruno }pqi_event_config_request_t; 3721e66f787SSean Bruno #if 0 3731e66f787SSean Bruno typedef struct pqi_set_event_config_request { 3741e66f787SSean Bruno iu_header_t header; 3751e66f787SSean Bruno uint16_t response_queue_id; /* specifies the OQ where the response 3761e66f787SSean Bruno IU is to be delivered */ 3771e66f787SSean Bruno uint8_t work_area[2]; /* reserved for driver use */ 3781e66f787SSean Bruno uint16_t request_id; 3791e66f787SSean Bruno uint16_t global_event_oq_id; 3801e66f787SSean Bruno uint32_t buffer_length; 3811e66f787SSean Bruno sg_desc_t sg_desc; 3821e66f787SSean Bruno }pqi_set_event_config_request_t; 3831e66f787SSean Bruno #endif 3841e66f787SSean Bruno 3851e66f787SSean Bruno /* Report/Set event config data-in/data-out buffer structure */ 3861e66f787SSean Bruno 3871e66f787SSean Bruno #define PQI_MAX_EVENT_DESCRIPTORS 255 3881e66f787SSean Bruno 3891e66f787SSean Bruno struct pqi_event_descriptor { 3901e66f787SSean Bruno uint8_t event_type; 3911e66f787SSean Bruno uint8_t reserved; 3921e66f787SSean Bruno uint16_t oq_id; 3931e66f787SSean Bruno }; 3941e66f787SSean Bruno 3951e66f787SSean Bruno typedef struct pqi_event_config { 3961e66f787SSean Bruno uint8_t reserved[2]; 3971e66f787SSean Bruno uint8_t num_event_descriptors; 3981e66f787SSean Bruno uint8_t reserved1; 3991e66f787SSean Bruno struct pqi_event_descriptor descriptors[PQI_MAX_EVENT_DESCRIPTORS]; 4001e66f787SSean Bruno }pqi_event_config_t; 4011e66f787SSean Bruno 4021e66f787SSean Bruno /*management response IUs */ 4031e66f787SSean Bruno typedef struct pqi_management_response{ 4041e66f787SSean Bruno iu_header_t header; 4051e66f787SSean Bruno uint16_t reserved1; 4061e66f787SSean Bruno uint8_t work_area[2]; 4071e66f787SSean Bruno uint16_t req_id; 4081e66f787SSean Bruno uint8_t result; 4091e66f787SSean Bruno uint8_t reserved[5]; 4101e66f787SSean Bruno uint64_t result_data; 4111e66f787SSean Bruno }pqi_management_response_t; 4121e66f787SSean Bruno /*Event response IU*/ 4131e66f787SSean Bruno typedef struct pqi_event_response { 4141e66f787SSean Bruno iu_header_t header; 4151e66f787SSean Bruno uint16_t reserved1; 4161e66f787SSean Bruno uint8_t work_area[2]; 4171e66f787SSean Bruno uint8_t event_type; 4181e66f787SSean Bruno uint8_t reserved2 : 7; 4191e66f787SSean Bruno uint8_t request_acknowledge : 1; 4201e66f787SSean Bruno uint16_t event_id; 4211e66f787SSean Bruno uint32_t additional_event_id; 4221e66f787SSean Bruno uint8_t data[16]; 4231e66f787SSean Bruno }pqi_event_response_t; 4241e66f787SSean Bruno 4251e66f787SSean Bruno /*event acknowledge IU*/ 4261e66f787SSean Bruno typedef struct pqi_event_acknowledge_request { 4271e66f787SSean Bruno iu_header_t header; 4281e66f787SSean Bruno uint16_t reserved1; 4291e66f787SSean Bruno uint8_t work_area[2]; 4301e66f787SSean Bruno uint8_t event_type; 4311e66f787SSean Bruno uint8_t reserved2; 4321e66f787SSean Bruno uint16_t event_id; 4331e66f787SSean Bruno uint32_t additional_event_id; 4341e66f787SSean Bruno }pqi_event_acknowledge_request_t; 4351e66f787SSean Bruno 4361e66f787SSean Bruno struct pqi_event { 4371e66f787SSean Bruno boolean_t pending; 4381e66f787SSean Bruno uint8_t event_type; 4391e66f787SSean Bruno uint16_t event_id; 4401e66f787SSean Bruno uint32_t additional_event_id; 4411e66f787SSean Bruno }; 4421e66f787SSean Bruno 4439fac68fcSPAPANI SRIKANTH typedef struct pqi_vendor_general_response { 4449fac68fcSPAPANI SRIKANTH iu_header_t header; 4459fac68fcSPAPANI SRIKANTH uint16_t reserved1; 4469fac68fcSPAPANI SRIKANTH uint8_t work_area[2]; 4479fac68fcSPAPANI SRIKANTH uint16_t request_id; 4489fac68fcSPAPANI SRIKANTH uint16_t function_code; 4499fac68fcSPAPANI SRIKANTH uint16_t status; 4509fac68fcSPAPANI SRIKANTH uint8_t reserved2[2]; 4519fac68fcSPAPANI SRIKANTH } OS_ATTRIBUTE_PACKED pqi_vendor_general_response_t; 4529fac68fcSPAPANI SRIKANTH 4531e66f787SSean Bruno typedef struct op_q_params 4541e66f787SSean Bruno { 4551e66f787SSean Bruno uint8_t fn_code; 4561e66f787SSean Bruno uint16_t qid; 4571e66f787SSean Bruno uint16_t num_elem; 4581e66f787SSean Bruno uint16_t elem_len; 4591e66f787SSean Bruno uint16_t int_msg_num; 4601e66f787SSean Bruno 4611e66f787SSean Bruno } OS_ATTRIBUTE_PACKED op_q_params; 4621e66f787SSean Bruno 463*7ea28254SJohn Hall 4649fac68fcSPAPANI SRIKANTH /* "Fixed Format Sense Data" (0x70 or 0x71) (Table 45 in SPC5) */ 4659fac68fcSPAPANI SRIKANTH typedef struct sense_data_fixed { 466*7ea28254SJohn Hall uint8_t response_code : 7; /* Byte 0, 0x70 or 0x71 */ 467*7ea28254SJohn Hall uint8_t valid : 1; /* Byte 0, bit 7 */ 468*7ea28254SJohn Hall uint8_t byte_1; /* Byte 1 */ 469*7ea28254SJohn Hall uint8_t sense_key : 4; /* Byte 2, bit 0-3 (Key) */ 470*7ea28254SJohn Hall uint8_t byte_2_other : 4; /* Byte 2, bit 4-7 */ 471*7ea28254SJohn Hall uint32_t information; /* Byte 3-6, big-endian like block # in CDB */ 472*7ea28254SJohn Hall uint8_t addtnl_length; /* Byte 7 */ 473*7ea28254SJohn Hall uint8_t cmd_specific[4]; /* Byte 8-11 */ 474*7ea28254SJohn Hall uint8_t sense_code; /* Byte 12 (ASC) */ 475*7ea28254SJohn Hall uint8_t sense_qual; /* Byte 13 (ASCQ) */ 476*7ea28254SJohn Hall uint8_t fru_code; /* Byte 14 */ 477*7ea28254SJohn Hall uint8_t sense_key_specific[3]; /* Byte 15-17 */ 478*7ea28254SJohn Hall uint8_t addtnl_sense[1]; /* Byte 18+ */ 4799fac68fcSPAPANI SRIKANTH } OS_ATTRIBUTE_PACKED sense_data_fixed_t; 4809fac68fcSPAPANI SRIKANTH 4819fac68fcSPAPANI SRIKANTH 4829fac68fcSPAPANI SRIKANTH /* Generic Sense Data Descriptor (Table 29 in SPC5) */ 4839fac68fcSPAPANI SRIKANTH typedef struct descriptor_entry 4849fac68fcSPAPANI SRIKANTH { 485*7ea28254SJohn Hall uint8_t desc_type; /* Byte 9/0 */ 486*7ea28254SJohn Hall uint8_t desc_type_length; /* Byte 10/1 */ 4879fac68fcSPAPANI SRIKANTH union 4889fac68fcSPAPANI SRIKANTH { 4899fac68fcSPAPANI SRIKANTH /* Sense data descriptor specific */ 4909fac68fcSPAPANI SRIKANTH uint8_t bytes[1]; 4919fac68fcSPAPANI SRIKANTH 4929fac68fcSPAPANI SRIKANTH /* Information (Type 0) (Table 31 is SPC5) */ 4939fac68fcSPAPANI SRIKANTH struct { 494*7ea28254SJohn Hall uint8_t byte_2_rsvd : 7; /* Byte 11/2 */ 495*7ea28254SJohn Hall uint8_t valid : 1; /* Byte 11/2, bit 7 */ 496*7ea28254SJohn Hall uint8_t byte_3; /* Byte 12/3 */ 497*7ea28254SJohn Hall uint8_t information[8]; /* Byte 13-20/4-11 */ 4989fac68fcSPAPANI SRIKANTH } OS_ATTRIBUTE_PACKED type_0; 4999fac68fcSPAPANI SRIKANTH 5009fac68fcSPAPANI SRIKANTH }u; 5019fac68fcSPAPANI SRIKANTH } OS_ATTRIBUTE_PACKED descriptor_entry_t; 5029fac68fcSPAPANI SRIKANTH 5039fac68fcSPAPANI SRIKANTH /* "Descriptor Format Sense Data" (0x72 or 0x73) (Table 28 in SPC5) */ 5049fac68fcSPAPANI SRIKANTH typedef struct sense_data_descriptor { 505*7ea28254SJohn Hall uint8_t response_code : 7; /* Byte 0, 0x72 or 0x73 */ 506*7ea28254SJohn Hall uint8_t byte_0_rsvd: 1; /* Byte 0, bit 7 */ 507*7ea28254SJohn Hall uint8_t sense_key : 4; /* Byte 1, bit 0-3 (Key) */ 508*7ea28254SJohn Hall uint8_t byte_1_other : 4; /* Byte 1, bit 4-7 */ 509*7ea28254SJohn Hall uint8_t sense_code; /* Byte 2 (ASC) */ 510*7ea28254SJohn Hall uint8_t sense_qual; /* Byte 3 (ASCQ) */ 511*7ea28254SJohn Hall uint8_t byte4_6[3]; /* Byte 4-6 */ 512*7ea28254SJohn Hall uint8_t more_length; /* Byte 7 */ 513*7ea28254SJohn Hall descriptor_entry_t descriptor_list; /* Bytes 8+ */ 5149fac68fcSPAPANI SRIKANTH 5159fac68fcSPAPANI SRIKANTH } OS_ATTRIBUTE_PACKED sense_data_descriptor_t; 5169fac68fcSPAPANI SRIKANTH 5179fac68fcSPAPANI SRIKANTH typedef union sense_data_u 5189fac68fcSPAPANI SRIKANTH { 5199fac68fcSPAPANI SRIKANTH sense_data_fixed_t fixed_format; 5209fac68fcSPAPANI SRIKANTH sense_data_descriptor_t descriptor_format; 5219fac68fcSPAPANI SRIKANTH uint8_t data[256]; 5229fac68fcSPAPANI SRIKANTH } sense_data_u_t; 5239fac68fcSPAPANI SRIKANTH 5249fac68fcSPAPANI SRIKANTH 5251e66f787SSean Bruno /* Driver will use this structure to interpret the error 5261e66f787SSean Bruno info element returned from a failed requests */ 5271e66f787SSean Bruno typedef struct raid_path_error_info_elem { 5281e66f787SSean Bruno uint8_t data_in_result; /* !< Byte 0. See SOP spec Table 77. */ 5291e66f787SSean Bruno uint8_t data_out_result; /* !< Byte 1. See SOP spec Table 78. */ 5301e66f787SSean Bruno uint8_t reserved[3]; /* !< Bytes 2-4. */ 531*7ea28254SJohn Hall uint8_t status; /* !< Byte 5. See SAM-5 specification "Status" codes Table 40.*/ 5321e66f787SSean Bruno uint16_t status_qual; /* !< Bytes 6-7. See SAM-5 specification Table 43. */ 5331e66f787SSean Bruno uint16_t sense_data_len; /* !< Bytes 8-9. See SOP specification table 79. */ 5341e66f787SSean Bruno uint16_t resp_data_len; /* !< Bytes 10-11. See SOP specification table 79. */ 5351e66f787SSean Bruno uint32_t data_in_transferred; /* !< Bytes 12-15. If "dada_in_result = 0x01 (DATA_IN BUFFER UNDERFLOW)", Indicates the number of contiguous bytes starting with offset zero in Data-In buffer else Ignored. */ 5361e66f787SSean Bruno uint32_t data_out_transferred;/* !< Bytes 16-19. If "data_out_result = 0x01 (DATA_OUT BUFFER UNDERFLOW)", Indicates the number of contiguous bytes starting with offset zero in Data-Out buffer else Ignored. */ 5379fac68fcSPAPANI SRIKANTH union 5389fac68fcSPAPANI SRIKANTH { 5399fac68fcSPAPANI SRIKANTH sense_data_u_t sense_data; 5401e66f787SSean Bruno uint8_t data[256]; /* !< Bytes 20-275. Response Data buffer or Sense Data buffer but not both. */ 5419fac68fcSPAPANI SRIKANTH }; 5421e66f787SSean Bruno }OS_ATTRIBUTE_PACKED raid_path_error_info_elem_t; 5431e66f787SSean Bruno 5441e66f787SSean Bruno #define PQI_ERROR_BUFFER_ELEMENT_LENGTH sizeof(raid_path_error_info_elem_t) 5451e66f787SSean Bruno 5461e66f787SSean Bruno typedef enum error_data_present 5471e66f787SSean Bruno { 5481e66f787SSean Bruno DATA_PRESENT_NO_DATA = 0, /* !< No data present in Data buffer. */ 5491e66f787SSean Bruno DATA_PRESENT_RESPONSE_DATA = 1, /* !< Response data is present in Data buffer. */ 5501e66f787SSean Bruno DATA_PRESENT_SENSE_DATA = 2 /* !< Sense data is present in Data buffer. */ 5511e66f787SSean Bruno } error_data_present_t; 5521e66f787SSean Bruno 5531e66f787SSean Bruno typedef struct aio_path_error_info_elem 5541e66f787SSean Bruno { 555*7ea28254SJohn Hall uint8_t status; /* !< Byte 0. See SAM-5 specification "SCSI Status" codes Table 40.*/ 5561e66f787SSean Bruno uint8_t service_resp; /* !< Byte 1. SCSI Service Response. */ 5571e66f787SSean Bruno uint8_t data_pres; /* !< Byte 2. Bits [7:2] reserved. Bits [1:0] - 0=No data, 1=Response data, 2=Sense data. */ 5581e66f787SSean Bruno uint8_t reserved1; /* !< Byte 3. Reserved. */ 5591e66f787SSean Bruno uint32_t resd_count; /* !< Bytes 4-7. The residual data length in bytes. Need the original transfer size and if Status is OverRun or UnderRun. */ 5601e66f787SSean Bruno uint16_t data_len; /* !< Bytes 8-9. The amount of Sense data or Response data returned in Response/Sense Data buffer. */ 561*7ea28254SJohn Hall uint16_t reserved2; /* !< Bytes 10-11. Reserved. */ 562*7ea28254SJohn Hall union 563*7ea28254SJohn Hall { 564*7ea28254SJohn Hall sense_data_u_t sense_data; /* */ 565*7ea28254SJohn Hall uint8_t data[256]; /* !< Bytes 12-267. Response data buffer or Sense data buffer but not both. */ 566*7ea28254SJohn Hall }; 5671e66f787SSean Bruno uint8_t padding[8]; /* !< Bytes 268-275. Padding to make AIO_PATH_ERROR_INFO_ELEMENT = RAID_PATH_ERROR_INFO_ELEMENT */ 5681e66f787SSean Bruno }OS_ATTRIBUTE_PACKED aio_path_error_info_elem_t; 5691e66f787SSean Bruno 5701e66f787SSean Bruno struct init_base_struct { 5711e66f787SSean Bruno uint32_t revision; /* revision of init structure */ 5721e66f787SSean Bruno uint32_t flags; /* reserved */ 5731e66f787SSean Bruno uint32_t err_buf_paddr_l; /* lower 32 bits of physical address of error buffer */ 5741e66f787SSean Bruno uint32_t err_buf_paddr_h; /* upper 32 bits of physical address of error buffer */ 5751e66f787SSean Bruno uint32_t err_buf_elem_len; /* length of each element in error buffer (in bytes) */ 5761e66f787SSean Bruno uint32_t err_buf_num_elem; /* number of elements in error buffer */ 5771e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 5781e66f787SSean Bruno 5791e66f787SSean Bruno /* Queue details */ 5801e66f787SSean Bruno typedef struct ib_queue { 5811e66f787SSean Bruno uint32_t q_id; 5821e66f787SSean Bruno uint32_t num_elem; 5831e66f787SSean Bruno uint32_t elem_size; 5841e66f787SSean Bruno char *array_virt_addr; 5851e66f787SSean Bruno dma_addr_t array_dma_addr; 5861e66f787SSean Bruno uint32_t pi_local; 5871e66f787SSean Bruno uint32_t pi_register_offset; 5881e66f787SSean Bruno uint32_t *pi_register_abs; 5891e66f787SSean Bruno uint32_t *ci_virt_addr; 5901e66f787SSean Bruno dma_addr_t ci_dma_addr; 5911e66f787SSean Bruno boolean_t created; 5921e66f787SSean Bruno boolean_t lockcreated; 5931e66f787SSean Bruno char lockname[LOCKNAME_SIZE]; 594b17f4335SSean Bruno OS_PQILOCK_T lock OS_ATTRIBUTE_ALIGNED(8); 595*7ea28254SJohn Hall struct dma_mem alloc_dma; 5961e66f787SSean Bruno }ib_queue_t; 5971e66f787SSean Bruno 5981e66f787SSean Bruno typedef struct ob_queue { 5991e66f787SSean Bruno uint32_t q_id; 6001e66f787SSean Bruno uint32_t num_elem; 6011e66f787SSean Bruno uint32_t elem_size; 6021e66f787SSean Bruno uint32_t intr_msg_num; 6031e66f787SSean Bruno char *array_virt_addr; 6041e66f787SSean Bruno dma_addr_t array_dma_addr; 6051e66f787SSean Bruno uint32_t ci_local; 6061e66f787SSean Bruno uint32_t ci_register_offset; 6071e66f787SSean Bruno uint32_t *ci_register_abs; 6081e66f787SSean Bruno uint32_t *pi_virt_addr; 6091e66f787SSean Bruno dma_addr_t pi_dma_addr; 6101e66f787SSean Bruno boolean_t created; 611*7ea28254SJohn Hall struct dma_mem alloc_dma; 6121e66f787SSean Bruno }ob_queue_t; 6131e66f787SSean Bruno 6141e66f787SSean Bruno typedef struct pqisrc_sg_desc{ 6151e66f787SSean Bruno uint64_t addr; 6161e66f787SSean Bruno uint32_t len; 6171e66f787SSean Bruno uint32_t flags; 6181e66f787SSean Bruno }sgt_t; 6191e66f787SSean Bruno 6209fac68fcSPAPANI SRIKANTH 6211e66f787SSean Bruno typedef struct pqi_iu_layer_desc { 6221e66f787SSean Bruno uint8_t ib_spanning_supported : 1; 6231e66f787SSean Bruno uint8_t res1 : 7; 6241e66f787SSean Bruno uint8_t res2[5]; 6251e66f787SSean Bruno uint16_t max_ib_iu_len; 6261e66f787SSean Bruno uint8_t ob_spanning_supported : 1; 6271e66f787SSean Bruno uint8_t res3 : 7; 6281e66f787SSean Bruno uint8_t res4[5]; 6291e66f787SSean Bruno uint16_t max_ob_iu_len; 6301e66f787SSean Bruno }OS_ATTRIBUTE_PACKED pqi_iu_layer_desc_t; 6311e66f787SSean Bruno 6329fac68fcSPAPANI SRIKANTH 6331e66f787SSean Bruno /* Response IU data */ 6341e66f787SSean Bruno typedef struct pqi_device_capabilities { 6351e66f787SSean Bruno uint16_t length; 6361e66f787SSean Bruno uint8_t res1[6]; 6371e66f787SSean Bruno uint8_t ibq_arb_priority_support_bitmask; 6381e66f787SSean Bruno uint8_t max_aw_a; 6391e66f787SSean Bruno uint8_t max_aw_b; 6401e66f787SSean Bruno uint8_t max_aw_c; 6411e66f787SSean Bruno uint8_t max_arb_burst : 3; 6421e66f787SSean Bruno uint8_t res2 : 4; 6431e66f787SSean Bruno uint8_t iqa : 1; 6441e66f787SSean Bruno uint8_t res3[2]; 6451e66f787SSean Bruno uint8_t iq_freeze : 1; 6461e66f787SSean Bruno uint8_t res4 : 7; 6471e66f787SSean Bruno uint16_t max_iqs; 6481e66f787SSean Bruno uint16_t max_iq_elements; 6491e66f787SSean Bruno uint8_t res5[4]; 6501e66f787SSean Bruno uint16_t max_iq_elem_len; 6511e66f787SSean Bruno uint16_t min_iq_elem_len; 6521e66f787SSean Bruno uint8_t res6[2]; 6531e66f787SSean Bruno uint16_t max_oqs; 6541e66f787SSean Bruno uint16_t max_oq_elements; 6551e66f787SSean Bruno uint16_t intr_coales_time_granularity; 6561e66f787SSean Bruno uint16_t max_oq_elem_len; 6571e66f787SSean Bruno uint16_t min_oq_elem_len; 6581e66f787SSean Bruno uint8_t res7[24]; 6591e66f787SSean Bruno pqi_iu_layer_desc_t iu_layer_desc[32]; 6601e66f787SSean Bruno }OS_ATTRIBUTE_PACKED pqi_dev_cap_t; 6611e66f787SSean Bruno 6621e66f787SSean Bruno /* IO path */ 6631e66f787SSean Bruno 664*7ea28254SJohn Hall typedef struct iu_cmd_flags 665*7ea28254SJohn Hall { 666*7ea28254SJohn Hall uint8_t data_dir : 2; 667*7ea28254SJohn Hall uint8_t partial : 1; 668*7ea28254SJohn Hall uint8_t mem_type : 1; 669*7ea28254SJohn Hall uint8_t fence : 1; 670*7ea28254SJohn Hall uint8_t encrypt_enable : 1; 671*7ea28254SJohn Hall uint8_t res2 : 2; 672*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED iu_cmd_flags_t; 673*7ea28254SJohn Hall 674*7ea28254SJohn Hall typedef struct iu_attr_prio 675*7ea28254SJohn Hall { 676*7ea28254SJohn Hall uint8_t task_attr : 3; 677*7ea28254SJohn Hall uint8_t cmd_prio : 4; 678*7ea28254SJohn Hall uint8_t res3 : 1; 679*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED iu_attr_prio_t; 680*7ea28254SJohn Hall 6811e66f787SSean Bruno typedef struct pqi_aio_req { 6821e66f787SSean Bruno iu_header_t header; 6831e66f787SSean Bruno uint16_t response_queue_id; 6841e66f787SSean Bruno uint8_t work_area[2]; 6851e66f787SSean Bruno uint16_t req_id; 6861e66f787SSean Bruno uint8_t res1[2]; 6871e66f787SSean Bruno uint32_t nexus; 6881e66f787SSean Bruno uint32_t buf_len; 689*7ea28254SJohn Hall iu_cmd_flags_t cmd_flags; 690*7ea28254SJohn Hall iu_attr_prio_t attr_prio; 6911e66f787SSean Bruno uint16_t encrypt_key_index; 6921e66f787SSean Bruno uint32_t encrypt_twk_low; 6931e66f787SSean Bruno uint32_t encrypt_twk_high; 6941e66f787SSean Bruno uint8_t cdb[16]; 6951e66f787SSean Bruno uint16_t err_idx; 6961e66f787SSean Bruno uint8_t num_sg; 6971e66f787SSean Bruno uint8_t cdb_len; 6981e66f787SSean Bruno uint8_t lun[8]; 6991e66f787SSean Bruno uint8_t res4[4]; 7001e66f787SSean Bruno sgt_t sg_desc[4]; 7011e66f787SSean Bruno }OS_ATTRIBUTE_PACKED pqi_aio_req_t; 7021e66f787SSean Bruno 703*7ea28254SJohn Hall typedef struct pqi_aio_raid1_write_req { 704*7ea28254SJohn Hall iu_header_t header; 705*7ea28254SJohn Hall uint16_t response_queue_id; 706*7ea28254SJohn Hall uint8_t work_area[2]; 707*7ea28254SJohn Hall uint16_t req_id; 708*7ea28254SJohn Hall uint16_t volume_id; /* ID of raid volume */ 709*7ea28254SJohn Hall uint32_t nexus_1; /* 1st drive in RAID 1 */ 710*7ea28254SJohn Hall uint32_t nexus_2; /* 2nd drive in RAID 1 */ 711*7ea28254SJohn Hall uint32_t nexus_3; /* 3rd drive in RAID 1 */ 712*7ea28254SJohn Hall uint32_t buf_len; 713*7ea28254SJohn Hall iu_cmd_flags_t cmd_flags; 714*7ea28254SJohn Hall iu_attr_prio_t attr_prio; 715*7ea28254SJohn Hall uint16_t encrypt_key_index; 716*7ea28254SJohn Hall uint8_t cdb[16]; 717*7ea28254SJohn Hall uint16_t err_idx; 718*7ea28254SJohn Hall uint8_t num_sg; 719*7ea28254SJohn Hall uint8_t cdb_len; 720*7ea28254SJohn Hall uint8_t num_drives; /* drives in raid1 (2 or 3) */ 721*7ea28254SJohn Hall uint8_t reserved_bytes[3]; 722*7ea28254SJohn Hall uint32_t encrypt_twk_low; 723*7ea28254SJohn Hall uint32_t encrypt_twk_high; 724*7ea28254SJohn Hall sgt_t sg_desc[4]; 725*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqi_aio_raid1_write_req_t; 726*7ea28254SJohn Hall 727*7ea28254SJohn Hall typedef struct pqi_aio_raid5or6_write_req { 728*7ea28254SJohn Hall iu_header_t header; 729*7ea28254SJohn Hall uint16_t response_queue_id; 730*7ea28254SJohn Hall uint8_t work_area[2]; 731*7ea28254SJohn Hall uint16_t req_id; 732*7ea28254SJohn Hall uint16_t volume_id; /* ID of raid volume */ 733*7ea28254SJohn Hall uint32_t data_it_nexus; /* IT nexus of data drive */ 734*7ea28254SJohn Hall uint32_t p_parity_it_nexus;/* It nexus of p parity disk */ 735*7ea28254SJohn Hall uint32_t q_parity_it_nexus;/* It nexus of q parity disk (R6) */ 736*7ea28254SJohn Hall uint32_t buf_len; 737*7ea28254SJohn Hall iu_cmd_flags_t cmd_flags; 738*7ea28254SJohn Hall iu_attr_prio_t attr_prio; 739*7ea28254SJohn Hall uint16_t encrypt_key_index; 740*7ea28254SJohn Hall uint8_t cdb[16]; 741*7ea28254SJohn Hall uint16_t err_idx; 742*7ea28254SJohn Hall uint8_t num_sg; 743*7ea28254SJohn Hall uint8_t cdb_len; 744*7ea28254SJohn Hall uint8_t xor_multiplier; /* for generating RAID 6 Q parity */ 745*7ea28254SJohn Hall uint8_t reserved[3]; 746*7ea28254SJohn Hall uint32_t encrypt_twk_low; 747*7ea28254SJohn Hall uint32_t encrypt_twk_high; 748*7ea28254SJohn Hall uint64_t row; /* logical lba / blocks per row */ 749*7ea28254SJohn Hall uint8_t reserved2[8]; /* changed to reserved, used to stripe_lba */ 750*7ea28254SJohn Hall sgt_t sg_desc[3]; /* only 3 entries for R5/6 */ 751*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqi_aio_raid5or6_write_req_t; 7529fac68fcSPAPANI SRIKANTH 7531e66f787SSean Bruno typedef struct pqisrc_raid_request { 7541e66f787SSean Bruno iu_header_t header; 7551e66f787SSean Bruno uint16_t response_queue_id; /* specifies the OQ where the response 7561e66f787SSean Bruno IU is to be delivered */ 7571e66f787SSean Bruno uint8_t work_area[2]; /* reserved for driver use */ 7581e66f787SSean Bruno uint16_t request_id; 7591e66f787SSean Bruno uint16_t nexus_id; 7601e66f787SSean Bruno uint32_t buffer_length; 7611e66f787SSean Bruno uint8_t lun_number[8]; 7621e66f787SSean Bruno uint16_t protocol_spec; 7631e66f787SSean Bruno uint8_t data_direction : 2; 7641e66f787SSean Bruno uint8_t partial : 1; 7651e66f787SSean Bruno uint8_t reserved1 : 4; 7661e66f787SSean Bruno uint8_t fence : 1; 7671e66f787SSean Bruno uint16_t error_index; 7681e66f787SSean Bruno uint8_t reserved2; 7691e66f787SSean Bruno uint8_t task_attribute : 3; 7701e66f787SSean Bruno uint8_t command_priority : 4; 7711e66f787SSean Bruno uint8_t reserved3 : 1; 7721e66f787SSean Bruno uint8_t reserved4 : 2; 7731e66f787SSean Bruno uint8_t additional_cdb_bytes_usage : 3; 7741e66f787SSean Bruno uint8_t reserved5 : 3; 775*7ea28254SJohn Hall union 776*7ea28254SJohn Hall { 7771e66f787SSean Bruno uint8_t cdb[16]; 778*7ea28254SJohn Hall struct 779*7ea28254SJohn Hall { 780*7ea28254SJohn Hall uint8_t op_code; /* Byte 0. SCSI opcode (0x26 or 0x27) */ 781*7ea28254SJohn Hall uint8_t lun_lower; /* Byte 1 */ 782*7ea28254SJohn Hall uint32_t detail; /* Byte 2-5 */ 783*7ea28254SJohn Hall uint8_t cmd; /* Byte 6. Vendor specific op code. */ 784*7ea28254SJohn Hall uint16_t xfer_len; /* Byte 7-8 */ 785*7ea28254SJohn Hall uint8_t lun_upper; /* Byte 9 */ 786*7ea28254SJohn Hall uint8_t unused[6]; /* Bytes 10-15. */ 787*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED bmic_cdb; 788*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED cmd; 789*7ea28254SJohn Hall uint8_t reserved[11]; 790*7ea28254SJohn Hall uint8_t ml_device_lun_number; 7919fac68fcSPAPANI SRIKANTH uint32_t timeout_in_sec; 7921e66f787SSean Bruno sgt_t sg_descriptors[4]; 7931e66f787SSean Bruno }OS_ATTRIBUTE_PACKED pqisrc_raid_req_t; 7941e66f787SSean Bruno 7959fac68fcSPAPANI SRIKANTH 7969fac68fcSPAPANI SRIKANTH typedef struct pqi_raid_tmf_req { 7971e66f787SSean Bruno iu_header_t header; 7981e66f787SSean Bruno uint16_t resp_qid; 7991e66f787SSean Bruno uint8_t work_area[2]; 8001e66f787SSean Bruno uint16_t req_id; 8011e66f787SSean Bruno uint16_t nexus; 802*7ea28254SJohn Hall uint8_t res1[1]; 803*7ea28254SJohn Hall uint8_t ml_device_lun_number; 8049fac68fcSPAPANI SRIKANTH uint16_t timeout_in_sec; 8051e66f787SSean Bruno uint8_t lun[8]; 8061e66f787SSean Bruno uint16_t protocol_spec; 8071e66f787SSean Bruno uint16_t obq_id_to_manage; 8081e66f787SSean Bruno uint16_t req_id_to_manage; 8091e66f787SSean Bruno uint8_t tmf; 8101e66f787SSean Bruno uint8_t res2 : 7; 8111e66f787SSean Bruno uint8_t fence : 1; 8129fac68fcSPAPANI SRIKANTH } OS_ATTRIBUTE_PACKED pqi_raid_tmf_req_t; 8139fac68fcSPAPANI SRIKANTH 8149fac68fcSPAPANI SRIKANTH typedef struct pqi_aio_tmf_req { 8159fac68fcSPAPANI SRIKANTH iu_header_t header; 8169fac68fcSPAPANI SRIKANTH uint16_t resp_qid; 8179fac68fcSPAPANI SRIKANTH uint8_t work_area[2]; 8189fac68fcSPAPANI SRIKANTH uint16_t req_id; 8199fac68fcSPAPANI SRIKANTH uint16_t res1; 8209fac68fcSPAPANI SRIKANTH uint32_t nexus; 8219fac68fcSPAPANI SRIKANTH uint8_t lun[8]; 8229fac68fcSPAPANI SRIKANTH uint32_t req_id_to_manage; 8239fac68fcSPAPANI SRIKANTH uint8_t tmf; 8249fac68fcSPAPANI SRIKANTH uint8_t res2 : 7; 8259fac68fcSPAPANI SRIKANTH uint8_t fence : 1; 8269fac68fcSPAPANI SRIKANTH uint16_t error_idx; 8279fac68fcSPAPANI SRIKANTH }OS_ATTRIBUTE_PACKED pqi_aio_tmf_req_t; 8281e66f787SSean Bruno 8291e66f787SSean Bruno typedef struct pqi_tmf_resp { 8301e66f787SSean Bruno iu_header_t header; 8311e66f787SSean Bruno uint16_t resp_qid; 8321e66f787SSean Bruno uint8_t work_area[2]; 8331e66f787SSean Bruno uint16_t req_id; 8341e66f787SSean Bruno uint16_t nexus; 8351e66f787SSean Bruno uint8_t add_resp_info[3]; 8361e66f787SSean Bruno uint8_t resp_code; 8371e66f787SSean Bruno }pqi_tmf_resp_t; 8381e66f787SSean Bruno 8399fac68fcSPAPANI SRIKANTH 8401e66f787SSean Bruno struct pqi_io_response { 8411e66f787SSean Bruno iu_header_t header; 8421e66f787SSean Bruno uint16_t queue_id; 8431e66f787SSean Bruno uint8_t work_area[2]; 8441e66f787SSean Bruno uint16_t request_id; 8451e66f787SSean Bruno uint16_t error_index; 8461e66f787SSean Bruno uint8_t reserved[4]; 8471e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 8481e66f787SSean Bruno 8499fac68fcSPAPANI SRIKANTH 8501e66f787SSean Bruno struct pqi_enc_info { 8511e66f787SSean Bruno uint16_t data_enc_key_index; 8521e66f787SSean Bruno uint32_t encrypt_tweak_lower; 8531e66f787SSean Bruno uint32_t encrypt_tweak_upper; 8541e66f787SSean Bruno }; 8551e66f787SSean Bruno 856*7ea28254SJohn Hall typedef uint32_t os_ticks_t; 857*7ea28254SJohn Hall 858*7ea28254SJohn Hall struct pqi_stream_data { 859*7ea28254SJohn Hall uint64_t next_lba; 860*7ea28254SJohn Hall os_ticks_t last_accessed; 861*7ea28254SJohn Hall }; 8629fac68fcSPAPANI SRIKANTH 8631e66f787SSean Bruno typedef struct pqi_scsi_device { 864882d3b24SGordon Bergling device_type_t devtype; /* as reported by INQUIRY command */ 8651e66f787SSean Bruno uint8_t device_type; /* as reported by 8661e66f787SSean Bruno BMIC_IDENTIFY_PHYSICAL_DEVICE - only 8671e66f787SSean Bruno valid for devtype = TYPE_DISK */ 8681e66f787SSean Bruno int bus; 8691e66f787SSean Bruno int target; 8701e66f787SSean Bruno int lun; 8711e66f787SSean Bruno uint8_t flags; 8721e66f787SSean Bruno uint8_t scsi3addr[8]; 8731e66f787SSean Bruno uint64_t wwid; 8741e66f787SSean Bruno uint8_t is_physical_device : 1; 8751e66f787SSean Bruno uint8_t is_external_raid_device : 1; 8761e66f787SSean Bruno uint8_t target_lun_valid : 1; 8771e66f787SSean Bruno uint8_t expose_device : 1; 8781e66f787SSean Bruno uint8_t no_uld_attach : 1; 8791e66f787SSean Bruno uint8_t is_obdr_device : 1; 8801e66f787SSean Bruno uint8_t aio_enabled : 1; 8811e66f787SSean Bruno uint8_t device_gone : 1; 8821e66f787SSean Bruno uint8_t new_device : 1; 8831e66f787SSean Bruno uint8_t volume_offline : 1; 884*7ea28254SJohn Hall uint8_t is_nvme : 1; 8859fac68fcSPAPANI SRIKANTH uint8_t scsi_rescan : 1; 8861e66f787SSean Bruno uint8_t vendor[8]; /* bytes 8-15 of inquiry data */ 8871e66f787SSean Bruno uint8_t model[16]; /* bytes 16-31 of inquiry data */ 8881e66f787SSean Bruno uint64_t sas_address; 8891e66f787SSean Bruno uint8_t raid_level; 8901e66f787SSean Bruno uint16_t queue_depth; /* max. queue_depth for this device */ 8911e66f787SSean Bruno uint32_t ioaccel_handle; 8921e66f787SSean Bruno uint8_t volume_status; 8931e66f787SSean Bruno uint8_t active_path_index; 8941e66f787SSean Bruno uint8_t path_map; 8951e66f787SSean Bruno uint8_t bay; 8961e66f787SSean Bruno uint8_t box[8]; 8971e66f787SSean Bruno uint16_t phys_connector[8]; 8981e66f787SSean Bruno int offload_config; /* I/O accel RAID offload configured */ 8991e66f787SSean Bruno int offload_enabled; /* I/O accel RAID offload enabled */ 9001e66f787SSean Bruno int offload_enabled_pending; 901*7ea28254SJohn Hall int *offload_to_mirror; /* Send next I/O accelerator RAID 9021e66f787SSean Bruno offload request to mirror drive. */ 9031e66f787SSean Bruno struct raid_map *raid_map; /* I/O accelerator RAID map */ 9049fac68fcSPAPANI SRIKANTH 9051e66f787SSean Bruno int reset_in_progress; 9069fac68fcSPAPANI SRIKANTH int logical_unit_number; 9071e66f787SSean Bruno os_dev_info_t *dip; /*os specific scsi device information*/ 9081e66f787SSean Bruno boolean_t invalid; 9099fac68fcSPAPANI SRIKANTH boolean_t path_destroyed; 9109fac68fcSPAPANI SRIKANTH boolean_t firmware_queue_depth_set; 9119fac68fcSPAPANI SRIKANTH OS_ATOMIC64_T active_requests; 9129fac68fcSPAPANI SRIKANTH struct pqisrc_softstate *softs; 913*7ea28254SJohn Hall boolean_t schedule_rescan; 914*7ea28254SJohn Hall boolean_t in_remove; 915*7ea28254SJohn Hall struct pqi_stream_data stream_data[NUM_STREAMS_PER_LUN]; 916*7ea28254SJohn Hall boolean_t is_multi_lun; 917*7ea28254SJohn Hall 918*7ea28254SJohn Hall }pqi_scsi_dev_t; 9199fac68fcSPAPANI SRIKANTH 9201e66f787SSean Bruno struct sense_header_scsi { /* See SPC-3 section 4.5 */ 9211e66f787SSean Bruno uint8_t response_code; /* permit: 0x0, 0x70, 0x71, 0x72, 0x73 */ 9221e66f787SSean Bruno uint8_t sense_key; 9231e66f787SSean Bruno uint8_t asc; 9241e66f787SSean Bruno uint8_t ascq; 9251e66f787SSean Bruno uint8_t byte4; 9261e66f787SSean Bruno uint8_t byte5; 9271e66f787SSean Bruno uint8_t byte6; 9281e66f787SSean Bruno uint8_t additional_length; /* always 0 for fixed sense format */ 9291e66f787SSean Bruno }OS_ATTRIBUTE_PACKED; 9301e66f787SSean Bruno 9311e66f787SSean Bruno typedef struct report_lun_header { 9321e66f787SSean Bruno uint32_t list_length; 9331e66f787SSean Bruno uint8_t extended_response; 9341e66f787SSean Bruno uint8_t reserved[3]; 9351e66f787SSean Bruno }OS_ATTRIBUTE_PACKED reportlun_header_t; 9361e66f787SSean Bruno 9379fac68fcSPAPANI SRIKANTH 9381e66f787SSean Bruno typedef struct report_lun_ext_entry { 9391e66f787SSean Bruno uint8_t lunid[8]; 9401e66f787SSean Bruno uint64_t wwid; 9411e66f787SSean Bruno uint8_t device_type; 9421e66f787SSean Bruno uint8_t device_flags; 9431e66f787SSean Bruno uint8_t lun_count; /* number of LUNs in a multi-LUN device */ 9441e66f787SSean Bruno uint8_t redundant_paths; 9451e66f787SSean Bruno uint32_t ioaccel_handle; 9461e66f787SSean Bruno }OS_ATTRIBUTE_PACKED reportlun_ext_entry_t; 9471e66f787SSean Bruno 9489fac68fcSPAPANI SRIKANTH 9491e66f787SSean Bruno typedef struct report_lun_data_ext { 9501e66f787SSean Bruno reportlun_header_t header; 9511e66f787SSean Bruno reportlun_ext_entry_t lun_entries[1]; 9521e66f787SSean Bruno }OS_ATTRIBUTE_PACKED reportlun_data_ext_t; 9531e66f787SSean Bruno 9549fac68fcSPAPANI SRIKANTH typedef struct reportlun_queue_depth_entry { 9559fac68fcSPAPANI SRIKANTH uint8_t logical_unit_num; 9569fac68fcSPAPANI SRIKANTH uint8_t reserved_1:6; 9579fac68fcSPAPANI SRIKANTH uint8_t address:2; 9589fac68fcSPAPANI SRIKANTH uint8_t box_bus_num; 9599fac68fcSPAPANI SRIKANTH uint8_t reserved_2:6; 9609fac68fcSPAPANI SRIKANTH uint8_t mode:2; 9619fac68fcSPAPANI SRIKANTH uint8_t bus_ident; 9629fac68fcSPAPANI SRIKANTH 9639fac68fcSPAPANI SRIKANTH /* Byte 5 */ 9649fac68fcSPAPANI SRIKANTH uint8_t queue_depth:7; 9659fac68fcSPAPANI SRIKANTH uint8_t multiplier:1; 9669fac68fcSPAPANI SRIKANTH 9679fac68fcSPAPANI SRIKANTH /* Byte 6 */ 9689fac68fcSPAPANI SRIKANTH uint8_t drive_type_mix_flags; 9699fac68fcSPAPANI SRIKANTH uint8_t level_2_bus:6; 9709fac68fcSPAPANI SRIKANTH uint8_t level_2_mode:2; 9719fac68fcSPAPANI SRIKANTH uint8_t unused_bytes[16]; 9729fac68fcSPAPANI SRIKANTH }OS_ATTRIBUTE_PACKED reportlun_queue_depth_entry_t; 9739fac68fcSPAPANI SRIKANTH 9749fac68fcSPAPANI SRIKANTH typedef struct reportlun_queue_depth_data { 9759fac68fcSPAPANI SRIKANTH reportlun_header_t header; 9769fac68fcSPAPANI SRIKANTH reportlun_queue_depth_entry_t lun_entries[1]; /* lun list with Queue Depth values for each lun */ 9779fac68fcSPAPANI SRIKANTH }OS_ATTRIBUTE_PACKED reportlun_queue_depth_data_t; 9789fac68fcSPAPANI SRIKANTH 9791e66f787SSean Bruno typedef struct raidmap_data { 9801e66f787SSean Bruno uint32_t ioaccel_handle; 9811e66f787SSean Bruno uint8_t xor_mult[2]; 9821e66f787SSean Bruno uint8_t reserved[2]; 9831e66f787SSean Bruno }OS_ATTRIBUTE_PACKED raidmap_data_t; 9841e66f787SSean Bruno 9851e66f787SSean Bruno typedef struct raid_map { 9861e66f787SSean Bruno uint32_t structure_size; /* size of entire structure in bytes */ 9871e66f787SSean Bruno uint32_t volume_blk_size; /* bytes / block in the volume */ 9881e66f787SSean Bruno uint64_t volume_blk_cnt; /* logical blocks on the volume */ 9891e66f787SSean Bruno uint8_t phys_blk_shift; /* shift factor to convert between 9901e66f787SSean Bruno units of logical blocks and physical 9911e66f787SSean Bruno disk blocks */ 9921e66f787SSean Bruno uint8_t parity_rotation_shift; /* shift factor to convert between units 9931e66f787SSean Bruno of logical stripes and physical 9941e66f787SSean Bruno stripes */ 9951e66f787SSean Bruno uint16_t strip_size; /* blocks used on each disk / stripe */ 9961e66f787SSean Bruno uint64_t disk_starting_blk; /* first disk block used in volume */ 9971e66f787SSean Bruno uint64_t disk_blk_cnt; /* disk blocks used by volume / disk */ 9981e66f787SSean Bruno uint16_t data_disks_per_row; /* data disk entries / row in the map */ 9991e66f787SSean Bruno uint16_t metadata_disks_per_row; /* mirror/parity disk entries / row 10001e66f787SSean Bruno in the map */ 10011e66f787SSean Bruno uint16_t row_cnt; /* rows in each layout map */ 10021e66f787SSean Bruno uint16_t layout_map_count; /* layout maps (1 map per mirror/parity 10031e66f787SSean Bruno group) */ 10041e66f787SSean Bruno uint16_t flags; 10051e66f787SSean Bruno uint16_t data_encryption_key_index; 10061e66f787SSean Bruno uint8_t reserved[16]; 10071e66f787SSean Bruno raidmap_data_t dev_data[RAID_MAP_MAX_ENTRIES]; 10081e66f787SSean Bruno }OS_ATTRIBUTE_PACKED pqisrc_raid_map_t; 10091e66f787SSean Bruno 1010*7ea28254SJohn Hall typedef struct aio_row { 1011*7ea28254SJohn Hall uint32_t blks_per_row; /* blocks per row */ 1012*7ea28254SJohn Hall uint64_t first; /* first row */ 1013*7ea28254SJohn Hall uint64_t last; /* last row */ 1014*7ea28254SJohn Hall uint32_t offset_first; /* offset in first row */ 1015*7ea28254SJohn Hall uint32_t offset_last; /* offset in last row */ 1016*7ea28254SJohn Hall uint16_t data_disks; /* number of data disks per row */ 1017*7ea28254SJohn Hall uint16_t total_disks; /* data + parity disks per row. */ 1018*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqisrc_aio_row_t; 1019*7ea28254SJohn Hall 1020*7ea28254SJohn Hall typedef struct aio_column { 1021*7ea28254SJohn Hall uint32_t first; /* 1st column of req */ 1022*7ea28254SJohn Hall uint32_t last; /* last column of req */ 1023*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqisrc_aio_column_t; 1024*7ea28254SJohn Hall 1025*7ea28254SJohn Hall typedef struct aio_block { 1026*7ea28254SJohn Hall uint64_t first; /* 1st block number of req */ 1027*7ea28254SJohn Hall uint64_t last; /* last block number of req */ 1028*7ea28254SJohn Hall uint32_t cnt; /* total blocks in req */ 1029*7ea28254SJohn Hall uint64_t disk_block; /* block number of phys disk */ 1030*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqisrc_aio_block_t; 1031*7ea28254SJohn Hall 1032*7ea28254SJohn Hall typedef struct aio_r5or6_loc { 1033*7ea28254SJohn Hall struct aio_row row; /* row information */ 1034*7ea28254SJohn Hall struct aio_column col; /* column information */ 1035*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqisrc_aio_r5or6_loc_t; 1036*7ea28254SJohn Hall 1037*7ea28254SJohn Hall typedef struct aio_map { 1038*7ea28254SJohn Hall uint32_t row; 1039*7ea28254SJohn Hall uint32_t idx; /* index into array of handles */ 1040*7ea28254SJohn Hall uint16_t layout_map_count; 1041*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqisrc_aio_map_t; 1042*7ea28254SJohn Hall 1043*7ea28254SJohn Hall typedef struct aio_disk_group { 1044*7ea28254SJohn Hall uint32_t first; /* first group */ 1045*7ea28254SJohn Hall uint32_t last; /* last group */ 1046*7ea28254SJohn Hall uint32_t cur; /* current group */ 1047*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqisrc_aio_disk_group_t; 1048*7ea28254SJohn Hall 1049*7ea28254SJohn Hall typedef struct aio_req_locator { 1050*7ea28254SJohn Hall uint8_t raid_level; 1051*7ea28254SJohn Hall struct raid_map *raid_map; /* relevant raid map */ 1052*7ea28254SJohn Hall struct aio_block block; /* block range and count */ 1053*7ea28254SJohn Hall struct aio_row row; /* row range and offset info */ 1054*7ea28254SJohn Hall struct aio_column col; /* first/last column info */ 1055*7ea28254SJohn Hall struct aio_r5or6_loc r5or6; /* Raid 5/6-specific bits */ 1056*7ea28254SJohn Hall struct aio_map map; /* map row, count, and index */ 1057*7ea28254SJohn Hall struct aio_disk_group group; /* first, last, and curr group */ 1058*7ea28254SJohn Hall boolean_t is_write; 1059*7ea28254SJohn Hall uint32_t stripesz; 1060*7ea28254SJohn Hall uint16_t strip_sz; 1061*7ea28254SJohn Hall int offload_to_mirror; 1062*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED aio_req_locator_t; 10639fac68fcSPAPANI SRIKANTH 10641e66f787SSean Bruno typedef struct bmic_ident_ctrl { 10651e66f787SSean Bruno uint8_t conf_ld_count; 10661e66f787SSean Bruno uint32_t conf_sign; 10671e66f787SSean Bruno uint8_t fw_version[4]; 10681e66f787SSean Bruno uint8_t rom_fw_rev[4]; 10691e66f787SSean Bruno uint8_t hw_rev; 10701e66f787SSean Bruno uint8_t reserved[140]; 10711e66f787SSean Bruno uint16_t extended_lun_count; 10721e66f787SSean Bruno uint8_t reserved1[34]; 10731e66f787SSean Bruno uint16_t fw_build_number; 10741e66f787SSean Bruno uint8_t reserved2[100]; 10751e66f787SSean Bruno uint8_t ctrl_mode; 10761e66f787SSean Bruno uint8_t reserved3[32]; 10771e66f787SSean Bruno }OS_ATTRIBUTE_PACKED bmic_ident_ctrl_t; 10781e66f787SSean Bruno 10791e66f787SSean Bruno typedef struct bmic_identify_physical_device { 10801e66f787SSean Bruno uint8_t scsi_bus; /* SCSI Bus number on controller */ 10811e66f787SSean Bruno uint8_t scsi_id; /* SCSI ID on this bus */ 10821e66f787SSean Bruno uint16_t block_size; /* sector size in bytes */ 10831e66f787SSean Bruno uint32_t total_blocks; /* number for sectors on drive */ 10841e66f787SSean Bruno uint32_t reserved_blocks; /* controller reserved (RIS) */ 10851e66f787SSean Bruno uint8_t model[40]; /* Physical Drive Model */ 10861e66f787SSean Bruno uint8_t serial_number[40]; /* Drive Serial Number */ 10871e66f787SSean Bruno uint8_t firmware_revision[8]; /* drive firmware revision */ 10881e66f787SSean Bruno uint8_t scsi_inquiry_bits; /* inquiry byte 7 bits */ 10891e66f787SSean Bruno uint8_t compaq_drive_stamp; /* 0 means drive not stamped */ 10901e66f787SSean Bruno uint8_t last_failure_reason; 10911e66f787SSean Bruno uint8_t flags; 10921e66f787SSean Bruno uint8_t more_flags; 10931e66f787SSean Bruno uint8_t scsi_lun; /* SCSI LUN for phys drive */ 10941e66f787SSean Bruno uint8_t yet_more_flags; 10951e66f787SSean Bruno uint8_t even_more_flags; 10961e66f787SSean Bruno uint32_t spi_speed_rules; 10971e66f787SSean Bruno uint8_t phys_connector[2]; /* connector number on controller */ 10981e66f787SSean Bruno uint8_t phys_box_on_bus; /* phys enclosure this drive resides */ 10991e66f787SSean Bruno uint8_t phys_bay_in_box; /* phys drv bay this drive resides */ 11001e66f787SSean Bruno uint32_t rpm; /* drive rotational speed in RPM */ 11011e66f787SSean Bruno uint8_t device_type; /* type of drive */ 11021e66f787SSean Bruno uint8_t sata_version; /* only valid when device_type = 11031e66f787SSean Bruno BMIC_DEVICE_TYPE_SATA */ 11041e66f787SSean Bruno uint64_t big_total_block_count; 11051e66f787SSean Bruno uint64_t ris_starting_lba; 11061e66f787SSean Bruno uint32_t ris_size; 11071e66f787SSean Bruno uint8_t wwid[20]; 11081e66f787SSean Bruno uint8_t controller_phy_map[32]; 11091e66f787SSean Bruno uint16_t phy_count; 11101e66f787SSean Bruno uint8_t phy_connected_dev_type[256]; 11111e66f787SSean Bruno uint8_t phy_to_drive_bay_num[256]; 11121e66f787SSean Bruno uint16_t phy_to_attached_dev_index[256]; 11131e66f787SSean Bruno uint8_t box_index; 11141e66f787SSean Bruno uint8_t reserved; 11151e66f787SSean Bruno uint16_t extra_physical_drive_flags; 11161e66f787SSean Bruno uint8_t negotiated_link_rate[256]; 11171e66f787SSean Bruno uint8_t phy_to_phy_map[256]; 11181e66f787SSean Bruno uint8_t redundant_path_present_map; 11191e66f787SSean Bruno uint8_t redundant_path_failure_map; 11201e66f787SSean Bruno uint8_t active_path_number; 11211e66f787SSean Bruno uint16_t alternate_paths_phys_connector[8]; 11221e66f787SSean Bruno uint8_t alternate_paths_phys_box_on_port[8]; 11231e66f787SSean Bruno uint8_t multi_lun_device_lun_count; 11241e66f787SSean Bruno uint8_t minimum_good_fw_revision[8]; 11251e66f787SSean Bruno uint8_t unique_inquiry_bytes[20]; 11261e66f787SSean Bruno uint8_t current_temperature_degreesC; 11271e66f787SSean Bruno uint8_t temperature_threshold_degreesC; 11281e66f787SSean Bruno uint8_t max_temperature_degreesC; 11291e66f787SSean Bruno uint8_t logical_blocks_per_phys_block_exp; 11301e66f787SSean Bruno uint16_t current_queue_depth_limit; 11311e66f787SSean Bruno uint8_t switch_name[10]; 11321e66f787SSean Bruno uint16_t switch_port; 11331e66f787SSean Bruno uint8_t alternate_paths_switch_name[40]; 11341e66f787SSean Bruno uint8_t alternate_paths_switch_port[8]; 11351e66f787SSean Bruno uint16_t power_on_hours; 11361e66f787SSean Bruno uint16_t percent_endurance_used; 11371e66f787SSean Bruno uint8_t drive_authentication; 11381e66f787SSean Bruno uint8_t smart_carrier_authentication; 11391e66f787SSean Bruno uint8_t smart_carrier_app_fw_version; 11401e66f787SSean Bruno uint8_t smart_carrier_bootloader_fw_version; 11411e66f787SSean Bruno uint8_t encryption_key_name[64]; 11421e66f787SSean Bruno uint32_t misc_drive_flags; 11431e66f787SSean Bruno uint16_t dek_index; 11441e66f787SSean Bruno uint8_t padding[112]; 11451e66f787SSean Bruno }OS_ATTRIBUTE_PACKED bmic_ident_physdev_t; 11461e66f787SSean Bruno 1147*7ea28254SJohn Hall typedef struct bmic_sense_feature { 1148*7ea28254SJohn Hall uint8_t opcode; 1149*7ea28254SJohn Hall uint8_t reserved1[1]; 1150*7ea28254SJohn Hall uint8_t page; 1151*7ea28254SJohn Hall uint8_t sub_page; 1152*7ea28254SJohn Hall uint8_t reserved2[2]; 1153*7ea28254SJohn Hall uint8_t cmd; 1154*7ea28254SJohn Hall uint16_t transfer_length; 1155*7ea28254SJohn Hall uint8_t reserved3[7]; 1156*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED bmic_sense_feature_t; 1157*7ea28254SJohn Hall 1158*7ea28254SJohn Hall typedef struct bmic_sense_feature_buffer_header { 1159*7ea28254SJohn Hall uint8_t page; 1160*7ea28254SJohn Hall uint8_t sub_page; 1161*7ea28254SJohn Hall uint16_t buffer_length; 1162*7ea28254SJohn Hall } OS_ATTRIBUTE_PACKED bmic_sense_feature_buffer_header_t; 1163*7ea28254SJohn Hall 1164*7ea28254SJohn Hall typedef struct bmic_sense_feature_page_header { 1165*7ea28254SJohn Hall uint8_t page; 1166*7ea28254SJohn Hall uint8_t sub_page; 1167*7ea28254SJohn Hall uint16_t total_length; /** Total length of the page. 1168*7ea28254SJohn Hall * The length is the same wheteher the request buffer is too short or not. 1169*7ea28254SJohn Hall * When printing out the page, only print the buffer length. */ 1170*7ea28254SJohn Hall } OS_ATTRIBUTE_PACKED bmic_sense_feature_page_header_t; 1171*7ea28254SJohn Hall 1172*7ea28254SJohn Hall typedef struct bmic_sense_feature_page_io { 1173*7ea28254SJohn Hall struct bmic_sense_feature_page_header header; 1174*7ea28254SJohn Hall uint8_t flags1; 1175*7ea28254SJohn Hall } OS_ATTRIBUTE_PACKED bmic_sense_feature_page_io_t; 1176*7ea28254SJohn Hall 1177*7ea28254SJohn Hall typedef struct bmic_sense_feature_page_io_aio_subpage { 1178*7ea28254SJohn Hall struct bmic_sense_feature_page_header header; 1179*7ea28254SJohn Hall uint8_t fw_aio_read_support; 1180*7ea28254SJohn Hall uint8_t driver_aio_read_support; 1181*7ea28254SJohn Hall uint8_t fw_aio_write_support; 1182*7ea28254SJohn Hall uint8_t driver_aio_write_support; 1183*7ea28254SJohn Hall uint16_t max_aio_rw_xfer_crypto_sas_sata; /* in kb */ 1184*7ea28254SJohn Hall uint16_t max_aio_rw_xfer_crypto_nvme; /* in kb */ 1185*7ea28254SJohn Hall uint16_t max_aio_write_raid5_6; /* in kb */ 1186*7ea28254SJohn Hall uint16_t max_aio_write_raid1_10_2drv; /* in kb */ 1187*7ea28254SJohn Hall uint16_t max_aio_write_raid1_10_3drv; /* in kb */ 1188*7ea28254SJohn Hall } OS_ATTRIBUTE_PACKED bmic_sense_feature_page_io_aio_subpage_t; 1189*7ea28254SJohn Hall 1190*7ea28254SJohn Hall typedef struct bmic_sense_feature_aio_buffer { 1191*7ea28254SJohn Hall struct bmic_sense_feature_buffer_header header; 1192*7ea28254SJohn Hall struct bmic_sense_feature_page_io_aio_subpage aio_subpage; 1193*7ea28254SJohn Hall } OS_ATTRIBUTE_PACKED bmic_sense_feature_aio_buffer_t; 1194*7ea28254SJohn Hall 1195*7ea28254SJohn Hall 11961e66f787SSean Bruno typedef struct pqisrc_bmic_flush_cache { 11971e66f787SSean Bruno uint8_t disable_cache; 11981e66f787SSean Bruno uint8_t power_action; 11991e66f787SSean Bruno uint8_t ndu_flush_cache; 12001e66f787SSean Bruno uint8_t halt_event; 12011e66f787SSean Bruno uint8_t reserved[28]; 12021e66f787SSean Bruno } OS_ATTRIBUTE_PACKED pqisrc_bmic_flush_cache_t; 12031e66f787SSean Bruno 12041e66f787SSean Bruno /* for halt_event member of pqisrc_bmic_flush_cache_t */ 12051e66f787SSean Bruno enum pqisrc_flush_cache_event_type { 12061e66f787SSean Bruno PQISRC_NONE_CACHE_FLUSH_ONLY = 0, 12071e66f787SSean Bruno PQISRC_SHUTDOWN = 1, 12081e66f787SSean Bruno PQISRC_HIBERNATE = 2, 12091e66f787SSean Bruno PQISRC_SUSPEND = 3, 12101e66f787SSean Bruno PQISRC_RESTART = 4 12111e66f787SSean Bruno }; 12121e66f787SSean Bruno 12131e66f787SSean Bruno struct request_container_block; 12141e66f787SSean Bruno typedef void (*success_callback)(struct pqisrc_softstate *, struct request_container_block *); 12151e66f787SSean Bruno typedef void (*error_callback)(struct pqisrc_softstate *, struct request_container_block *, uint16_t); 12161e66f787SSean Bruno 12171e66f787SSean Bruno /* Request container block */ 12181e66f787SSean Bruno typedef struct request_container_block { 12191e66f787SSean Bruno void *req; 12201e66f787SSean Bruno void *error_info; 1221*7ea28254SJohn Hall int status; 12221e66f787SSean Bruno uint32_t tag; 12231e66f787SSean Bruno sgt_t *sg_chain_virt; 12241e66f787SSean Bruno dma_addr_t sg_chain_dma; 12251e66f787SSean Bruno uint32_t data_dir; 12261e66f787SSean Bruno pqi_scsi_dev_t *dvp; 12271e66f787SSean Bruno struct pqisrc_softstate *softs; 12281e66f787SSean Bruno success_callback success_cmp_callback; 12291e66f787SSean Bruno error_callback error_cmp_callback; 1230*7ea28254SJohn Hall uint8_t *cdbp; /* points to either the bypass_cdb below or original host cdb */ 1231*7ea28254SJohn Hall uint8_t bypass_cdb[16]; /* bypass cmds will use this cdb memory */ 12321e66f787SSean Bruno int cmdlen; 12331e66f787SSean Bruno uint32_t bcount; /* buffer size in byte */ 12341e66f787SSean Bruno uint32_t ioaccel_handle; 12351e66f787SSean Bruno boolean_t encrypt_enable; 12361e66f787SSean Bruno struct pqi_enc_info enc_info; 1237*7ea28254SJohn Hall uint32_t row_num; 1238*7ea28254SJohn Hall uint32_t blocks_per_row; 1239*7ea28254SJohn Hall uint32_t raid_map_index; 1240*7ea28254SJohn Hall uint32_t raid_map_row; 12419fac68fcSPAPANI SRIKANTH ib_queue_t *req_q; 1242*7ea28254SJohn Hall IO_PATH_T path; 12439fac68fcSPAPANI SRIKANTH int resp_qid; 12449fac68fcSPAPANI SRIKANTH boolean_t req_pending; 1245*7ea28254SJohn Hall uint32_t it_nexus[PQISRC_MAX_SUPPORTED_MIRRORS]; 12469fac68fcSPAPANI SRIKANTH boolean_t timedout; 12479fac68fcSPAPANI SRIKANTH int tm_req; 12489fac68fcSPAPANI SRIKANTH int aio_retry; 1249*7ea28254SJohn Hall boolean_t is_abort_cmd_from_host; /* true if this is a TMF abort */ 1250*7ea28254SJohn Hall boolean_t host_wants_to_abort_this; /* set to true to ID the request targeted by TMF */ 1251*7ea28254SJohn Hall uint64_t submit_time_user_secs; /* host submit time in user seconds */ 1252*7ea28254SJohn Hall uint64_t host_timeout_ms; /* original host timeout value in msec */ 12531e66f787SSean Bruno int cm_flags; 12541e66f787SSean Bruno void *cm_data; /* pointer to data in kernel space */ 12551e66f787SSean Bruno bus_dmamap_t cm_datamap; 12561e66f787SSean Bruno uint32_t nseg; 12571e66f787SSean Bruno union ccb *cm_ccb; 12581e66f787SSean Bruno sgt_t *sgt; /* sg table */ 12591e66f787SSean Bruno }rcb_t; 12601e66f787SSean Bruno 1261*7ea28254SJohn Hall typedef struct bit_map { 1262*7ea28254SJohn Hall boolean_t bit_vector[MAX_TARGET_BIT]; 1263*7ea28254SJohn Hall }bit_map_t; 1264b17f4335SSean Bruno 1265*7ea28254SJohn Hall typedef enum _io_type 1266*7ea28254SJohn Hall { 1267*7ea28254SJohn Hall UNKNOWN_IO_TYPE, /* IO Type is TBD or cannot be determined */ 1268*7ea28254SJohn Hall NON_RW_IO_TYPE, /* IO Type is non-Read/Write opcode (could separate BMIC, etc. if we wanted) */ 1269*7ea28254SJohn Hall READ_IO_TYPE, /* IO Type is SCSI Read */ 1270*7ea28254SJohn Hall WRITE_IO_TYPE, /* IO Type is SCSI Write */ 1271*7ea28254SJohn Hall } io_type_t; 1272*7ea28254SJohn Hall 1273*7ea28254SJohn Hall typedef enum _counter_types 1274*7ea28254SJohn Hall { 1275*7ea28254SJohn Hall UNKNOWN_COUNTER, 1276*7ea28254SJohn Hall HBA_COUNTER, 1277*7ea28254SJohn Hall RAID0_COUNTER, 1278*7ea28254SJohn Hall RAID1_COUNTER, 1279*7ea28254SJohn Hall RAID5_COUNTER, 1280*7ea28254SJohn Hall RAID6_COUNTER, 1281*7ea28254SJohn Hall MAX_IO_COUNTER, 1282*7ea28254SJohn Hall } counter_types_t; 1283*7ea28254SJohn Hall 1284*7ea28254SJohn Hall typedef struct _io_counters 1285*7ea28254SJohn Hall { 1286*7ea28254SJohn Hall OS_ATOMIC64_T raid_read_cnt; 1287*7ea28254SJohn Hall OS_ATOMIC64_T raid_write_cnt; 1288*7ea28254SJohn Hall OS_ATOMIC64_T aio_read_cnt; 1289*7ea28254SJohn Hall OS_ATOMIC64_T aio_write_cnt; 1290*7ea28254SJohn Hall OS_ATOMIC64_T raid_non_read_write; 1291*7ea28254SJohn Hall OS_ATOMIC64_T aio_non_read_write; 1292*7ea28254SJohn Hall } io_counters_t; 1293*7ea28254SJohn Hall 1294*7ea28254SJohn Hall typedef struct pqisrc_softstate { 12951e66f787SSean Bruno OS_SPECIFIC_T os_specific; 12961e66f787SSean Bruno struct ioa_registers *ioa_reg; 12971e66f787SSean Bruno struct pqi_registers *pqi_reg; 12989fac68fcSPAPANI SRIKANTH uint8_t *pci_mem_base_vaddr; 12991e66f787SSean Bruno PCI_ACC_HANDLE_T pci_mem_handle; 13001e66f787SSean Bruno struct pqi_cap pqi_cap; 13011e66f787SSean Bruno struct pqi_pref_settings pref_settings; 13021e66f787SSean Bruno char fw_version[11]; 13031e66f787SSean Bruno uint16_t fw_build_number; 13041e66f787SSean Bruno uint32_t card; /* index to aac_cards */ 13051e66f787SSean Bruno uint16_t vendid; /* vendor id */ 13061e66f787SSean Bruno uint16_t subvendid; /* sub vendor id */ 13071e66f787SSean Bruno uint16_t devid; /* device id */ 13081e66f787SSean Bruno uint16_t subsysid; /* sub system id */ 13091e66f787SSean Bruno controller_state_t ctlr_state; 13101e66f787SSean Bruno struct dma_mem err_buf_dma_mem; 1311*7ea28254SJohn Hall struct dma_mem sg_dma_desc[PQISRC_MAX_OUTSTANDING_REQ + 1]; 13121e66f787SSean Bruno ib_queue_t admin_ib_queue; 13131e66f787SSean Bruno ob_queue_t admin_ob_queue; 13141e66f787SSean Bruno ob_queue_t event_q; 13151e66f787SSean Bruno ob_queue_t op_ob_q[PQISRC_MAX_SUPPORTED_OP_OB_Q - 1];/* 1 event queue */ 13161e66f787SSean Bruno ib_queue_t op_raid_ib_q[PQISRC_MAX_SUPPORTED_OP_RAID_IB_Q]; 13171e66f787SSean Bruno ib_queue_t op_aio_ib_q[PQISRC_MAX_SUPPORTED_OP_AIO_IB_Q]; 13181e66f787SSean Bruno uint32_t max_outstanding_io; 13191e66f787SSean Bruno uint32_t max_io_for_scsi_ml; 13201e66f787SSean Bruno uint32_t num_op_raid_ibq; 13211e66f787SSean Bruno uint32_t num_op_aio_ibq; 13221e66f787SSean Bruno uint32_t num_op_obq; 13231e66f787SSean Bruno uint32_t num_elem_per_op_ibq; 13241e66f787SSean Bruno uint32_t num_elem_per_op_obq; 1325*7ea28254SJohn Hall uint32_t max_ibq_elem_size; 1326*7ea28254SJohn Hall uint32_t max_obq_elem_size; 13271e66f787SSean Bruno pqi_dev_cap_t pqi_dev_cap; 13281e66f787SSean Bruno uint16_t max_ib_iu_length_per_fw; 1329*7ea28254SJohn Hall uint16_t max_ib_iu_length; /* should be 1152 */ 1330*7ea28254SJohn Hall uint16_t max_spanning_elems; /* should be 9 spanning elements */ 1331*7ea28254SJohn Hall unsigned max_sg_per_single_iu_element; /* should be 8 */ 1332*7ea28254SJohn Hall unsigned max_sg_per_spanning_cmd; /* should be 68, 67 with AIO writes */ 13331e66f787SSean Bruno uint8_t ib_spanning_supported : 1; 13341e66f787SSean Bruno uint8_t ob_spanning_supported : 1; 13351e66f787SSean Bruno pqi_event_config_t event_config; 13361e66f787SSean Bruno struct pqi_event pending_events[PQI_NUM_SUPPORTED_EVENTS]; 13371e66f787SSean Bruno int intr_type; 13381e66f787SSean Bruno int intr_count; 13391e66f787SSean Bruno int num_cpus_online; 1340*7ea28254SJohn Hall int num_devs; 13411e66f787SSean Bruno boolean_t share_opq_and_eventq; 13421e66f787SSean Bruno rcb_t *rcb; 13431e66f787SSean Bruno #ifndef LOCKFREE_STACK 13441e66f787SSean Bruno pqi_taglist_t taglist; 13451e66f787SSean Bruno #else 13461e66f787SSean Bruno lockless_stack_t taglist; 13471e66f787SSean Bruno #endif /* LOCKFREE_STACK */ 13481e66f787SSean Bruno boolean_t devlist_lockcreated; 13491e66f787SSean Bruno OS_LOCK_T devlist_lock OS_ATTRIBUTE_ALIGNED(8); 13501e66f787SSean Bruno char devlist_lock_name[LOCKNAME_SIZE]; 13511e66f787SSean Bruno pqi_scsi_dev_t *device_list[PQI_MAX_DEVICES][PQI_MAX_MULTILUN]; 1352*7ea28254SJohn Hall pqi_scsi_dev_t *dev_list[PQI_MAX_DEVICES]; 13531e66f787SSean Bruno OS_SEMA_LOCK_T scan_lock; 13541e66f787SSean Bruno uint8_t lun_count[PQI_MAX_DEVICES]; 1355b17f4335SSean Bruno uint64_t target_sas_addr[PQI_MAX_EXT_TARGETS]; 1356*7ea28254SJohn Hall uint64_t phys_list_pos; 13571e66f787SSean Bruno uint64_t prev_heartbeat_count; 13581e66f787SSean Bruno uint64_t *heartbeat_counter_abs_addr; 13591e66f787SSean Bruno uint64_t heartbeat_counter_off; 13601e66f787SSean Bruno uint32_t bus_id; 13611e66f787SSean Bruno uint32_t device_id; 13621e66f787SSean Bruno uint32_t func_id; 1363*7ea28254SJohn Hall uint8_t adapter_num; /* globally unique adapter number */ 13641e66f787SSean Bruno char *os_name; 13651e66f787SSean Bruno boolean_t ctrl_online; 13661e66f787SSean Bruno uint8_t pqi_reset_quiesce_allowed : 1; 13671e66f787SSean Bruno boolean_t ctrl_in_pqi_mode; 1368*7ea28254SJohn Hall bit_map_t bit_map; 13699fac68fcSPAPANI SRIKANTH uint32_t adapterQDepth; 13709fac68fcSPAPANI SRIKANTH uint32_t dma_mem_consumed; 1371*7ea28254SJohn Hall boolean_t adv_aio_capable; 1372*7ea28254SJohn Hall boolean_t aio_raid1_write_bypass; 1373*7ea28254SJohn Hall boolean_t aio_raid5_write_bypass; 1374*7ea28254SJohn Hall boolean_t aio_raid6_write_bypass; 1375*7ea28254SJohn Hall boolean_t enable_stream_detection; 1376*7ea28254SJohn Hall uint16_t max_aio_write_raid5_6; /* bytes */ 1377*7ea28254SJohn Hall uint16_t max_aio_write_raid1_10_2drv; /* bytes */ 1378*7ea28254SJohn Hall uint16_t max_aio_write_raid1_10_3drv; /* bytes */ 1379*7ea28254SJohn Hall uint16_t max_aio_rw_xfer_crypto_nvme; /* bytes */ 1380*7ea28254SJohn Hall uint16_t max_aio_rw_xfer_crypto_sas_sata; /* bytes */ 1381*7ea28254SJohn Hall io_counters_t counters[MAX_IO_COUNTER]; 1382*7ea28254SJohn Hall boolean_t log_io_counters; 1383*7ea28254SJohn Hall boolean_t ld_rescan; 1384*7ea28254SJohn Hall 1385*7ea28254SJohn Hall #ifdef PQI_NEED_RESCAN_TIMER_FOR_RBOD_HOTPLUG 1386*7ea28254SJohn Hall reportlun_data_ext_t *log_dev_list; 1387*7ea28254SJohn Hall size_t log_dev_data_length; 1388*7ea28254SJohn Hall uint32_t num_ptraid_targets; 1389*7ea28254SJohn Hall #endif 13909fac68fcSPAPANI SRIKANTH boolean_t timeout_in_passthrough; 13919fac68fcSPAPANI SRIKANTH boolean_t timeout_in_tmf; 1392*7ea28254SJohn Hall boolean_t sata_unique_wwn; 1393*7ea28254SJohn Hall boolean_t page83id_in_rpl; 1394*7ea28254SJohn Hall boolean_t err_resp_verbose; 1395*7ea28254SJohn Hall 1396*7ea28254SJohn Hall #ifdef DEVICE_HINT 1397*7ea28254SJohn Hall device_hint hint; 1398*7ea28254SJohn Hall #endif 1399*7ea28254SJohn Hall 1400*7ea28254SJohn Hall }pqisrc_softstate_t; 1401*7ea28254SJohn Hall 1402*7ea28254SJohn Hall struct pqi_config_table { 1403*7ea28254SJohn Hall uint8_t signature[8]; /* "CFGTABLE" */ 1404*7ea28254SJohn Hall uint32_t first_section_offset; /* offset in bytes from the base */ 1405*7ea28254SJohn Hall /* address of this table to the */ 1406*7ea28254SJohn Hall /* first section */ 1407*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED; 1408*7ea28254SJohn Hall 1409*7ea28254SJohn Hall struct pqi_config_table_section_header { 1410*7ea28254SJohn Hall uint16_t section_id; /* as defined by the */ 1411*7ea28254SJohn Hall /* PQI_CONFIG_TABLE_SECTION_* */ 1412*7ea28254SJohn Hall /* manifest constants above */ 1413*7ea28254SJohn Hall uint16_t next_section_offset; /* offset in bytes from base */ 1414*7ea28254SJohn Hall /* address of the table of the */ 1415*7ea28254SJohn Hall /* next section or 0 if last entry */ 1416*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED; 1417*7ea28254SJohn Hall 1418*7ea28254SJohn Hall struct pqi_config_table_general_info { 1419*7ea28254SJohn Hall struct pqi_config_table_section_header header; 1420*7ea28254SJohn Hall uint32_t section_length; /* size of this section in bytes */ 1421*7ea28254SJohn Hall /* including the section header */ 1422*7ea28254SJohn Hall uint32_t max_outstanding_requests; /* max. outstanding */ 1423*7ea28254SJohn Hall /* commands supported by */ 1424*7ea28254SJohn Hall /* the controller */ 1425*7ea28254SJohn Hall uint32_t max_sg_size; /* max. transfer size of a single */ 1426*7ea28254SJohn Hall /* command */ 1427*7ea28254SJohn Hall uint32_t max_sg_per_request; /* max. number of scatter-gather */ 1428*7ea28254SJohn Hall /* entries supported in a single */ 1429*7ea28254SJohn Hall /* command */ 1430*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED; 1431*7ea28254SJohn Hall 1432*7ea28254SJohn Hall struct pqi_config_table_firmware_features { 1433*7ea28254SJohn Hall struct pqi_config_table_section_header header; 1434*7ea28254SJohn Hall uint16_t num_elements; 1435*7ea28254SJohn Hall uint8_t features_supported[]; 1436*7ea28254SJohn Hall /* u8 features_requested_by_host[]; */ 1437*7ea28254SJohn Hall /* u8 features_enabled[]; */ 1438*7ea28254SJohn Hall /* The 2 fields below are only valid if the MAX_KNOWN_FEATURE bit is set. */ 1439*7ea28254SJohn Hall /* uint16_t firmware_max_known_feature; */ 1440*7ea28254SJohn Hall /* uint16_t host_max_known_feature; */ 1441*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED; 1442*7ea28254SJohn Hall 1443*7ea28254SJohn Hall typedef struct pqi_vendor_general_request { 1444*7ea28254SJohn Hall iu_header_t header; /* bytes 0-3 */ 1445*7ea28254SJohn Hall uint16_t response_id; /* bytes 4-5 */ 1446*7ea28254SJohn Hall uint16_t work; /* bytes 6-7 */ 1447*7ea28254SJohn Hall uint16_t request_id; 1448*7ea28254SJohn Hall uint16_t function_code; 1449*7ea28254SJohn Hall union { 1450*7ea28254SJohn Hall struct { 1451*7ea28254SJohn Hall uint16_t first_section; 1452*7ea28254SJohn Hall uint16_t last_section; 1453*7ea28254SJohn Hall uint8_t reserved[48]; 1454*7ea28254SJohn Hall } OS_ATTRIBUTE_PACKED config_table_update; 1455*7ea28254SJohn Hall 1456*7ea28254SJohn Hall struct { 1457*7ea28254SJohn Hall uint64_t buffer_address; 1458*7ea28254SJohn Hall uint32_t buffer_length; 1459*7ea28254SJohn Hall uint8_t reserved[40]; 1460*7ea28254SJohn Hall } OS_ATTRIBUTE_PACKED ofa_memory_allocation; 1461*7ea28254SJohn Hall } data; 1462*7ea28254SJohn Hall }OS_ATTRIBUTE_PACKED pqi_vendor_general_request_t; 14639fac68fcSPAPANI SRIKANTH 14649fac68fcSPAPANI SRIKANTH typedef struct vpd_logical_volume_status { 14659fac68fcSPAPANI SRIKANTH uint8_t peripheral_info; 14669fac68fcSPAPANI SRIKANTH uint8_t page_code; 14679fac68fcSPAPANI SRIKANTH uint8_t reserved; 14689fac68fcSPAPANI SRIKANTH uint8_t page_length; 14699fac68fcSPAPANI SRIKANTH uint8_t volume_status; 14709fac68fcSPAPANI SRIKANTH uint8_t reserved2[3]; 14719fac68fcSPAPANI SRIKANTH uint32_t flags; 14729fac68fcSPAPANI SRIKANTH }vpd_volume_status; 14731e66f787SSean Bruno 14741e66f787SSean Bruno #endif 1475