Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2005 - 2009 ServerEngines |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License version 2 |
| 7 | * as published by the Free Software Foundation. The full GNU General |
| 8 | * Public License is included in this distribution in the file called COPYING. |
| 9 | * |
| 10 | * Written by: Jayamohan Kallickal (jayamohank@serverengines.com) |
| 11 | * |
| 12 | * Contact Information: |
| 13 | * linux-drivers@serverengines.com |
| 14 | * |
| 15 | * ServerEngines |
| 16 | * 209 N. Fair Oaks Ave |
| 17 | * Sunnyvale, CA 94085 |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifndef _BEISCSI_MGMT_ |
| 22 | #define _BEISCSI_MGMT_ |
| 23 | |
| 24 | #include <linux/types.h> |
| 25 | #include <linux/list.h> |
| 26 | #include "be_iscsi.h" |
| 27 | #include "be_main.h" |
| 28 | |
| 29 | /** |
| 30 | * Pseudo amap definition in which each bit of the actual structure is defined |
| 31 | * as a byte: used to calculate offset/shift/mask of each field |
| 32 | */ |
| 33 | struct amap_mcc_sge { |
| 34 | u8 pa_lo[32]; /* dword 0 */ |
| 35 | u8 pa_hi[32]; /* dword 1 */ |
| 36 | u8 length[32]; /* DWORD 2 */ |
| 37 | } __packed; |
| 38 | |
| 39 | /** |
| 40 | * Pseudo amap definition in which each bit of the actual structure is defined |
| 41 | * as a byte: used to calculate offset/shift/mask of each field |
| 42 | */ |
| 43 | struct amap_mcc_wrb_payload { |
| 44 | union { |
| 45 | struct amap_mcc_sge sgl[19]; |
| 46 | u8 embedded[59 * 32]; /* DWORDS 57 to 115 */ |
| 47 | } u; |
| 48 | } __packed; |
| 49 | |
| 50 | /** |
| 51 | * Pseudo amap definition in which each bit of the actual structure is defined |
| 52 | * as a byte: used to calculate offset/shift/mask of each field |
| 53 | */ |
| 54 | struct amap_mcc_wrb { |
| 55 | u8 embedded; /* DWORD 0 */ |
| 56 | u8 rsvd0[2]; /* DWORD 0 */ |
| 57 | u8 sge_count[5]; /* DWORD 0 */ |
| 58 | u8 rsvd1[16]; /* DWORD 0 */ |
| 59 | u8 special[8]; /* DWORD 0 */ |
| 60 | u8 payload_length[32]; |
| 61 | u8 tag[64]; /* DWORD 2 */ |
| 62 | u8 rsvd2[32]; /* DWORD 4 */ |
| 63 | struct amap_mcc_wrb_payload payload; |
| 64 | }; |
| 65 | |
| 66 | struct mcc_sge { |
| 67 | u32 pa_lo; /* dword 0 */ |
| 68 | u32 pa_hi; /* dword 1 */ |
| 69 | u32 length; /* DWORD 2 */ |
| 70 | } __packed; |
| 71 | |
| 72 | struct mcc_wrb_payload { |
| 73 | union { |
| 74 | struct mcc_sge sgl[19]; |
| 75 | u32 embedded[59]; /* DWORDS 57 to 115 */ |
| 76 | } u; |
| 77 | } __packed; |
| 78 | |
| 79 | #define MCC_WRB_EMBEDDED_MASK 0x00000001 |
| 80 | |
| 81 | struct mcc_wrb { |
| 82 | u32 dw[0]; /* DWORD 0 */ |
| 83 | u32 payload_length; |
| 84 | u32 tag[2]; /* DWORD 2 */ |
| 85 | u32 rsvd2[1]; /* DWORD 4 */ |
| 86 | struct mcc_wrb_payload payload; |
| 87 | }; |
| 88 | |
| 89 | unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute); |
| 90 | int mgmt_open_connection(struct beiscsi_hba *phba, struct sockaddr *dst_addr, |
| 91 | struct beiscsi_endpoint *beiscsi_ep); |
| 92 | |
| 93 | unsigned char mgmt_upload_connection(struct beiscsi_hba *phba, |
| 94 | unsigned short cid, |
| 95 | unsigned int upload_flag); |
| 96 | unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba, |
| 97 | unsigned int icd, unsigned int cid); |
| 98 | |
| 99 | struct iscsi_invalidate_connection_params_in { |
| 100 | struct be_cmd_req_hdr hdr; |
| 101 | unsigned int session_handle; |
| 102 | unsigned short cid; |
| 103 | unsigned short unused; |
| 104 | unsigned short cleanup_type; |
| 105 | unsigned short save_cfg; |
| 106 | } __packed; |
| 107 | |
| 108 | struct iscsi_invalidate_connection_params_out { |
| 109 | unsigned int session_handle; |
| 110 | unsigned short cid; |
| 111 | unsigned short unused; |
| 112 | } __packed; |
| 113 | |
| 114 | union iscsi_invalidate_connection_params { |
| 115 | struct iscsi_invalidate_connection_params_in request; |
| 116 | struct iscsi_invalidate_connection_params_out response; |
| 117 | } __packed; |
| 118 | |
| 119 | struct invalidate_command_table { |
| 120 | unsigned short icd; |
| 121 | unsigned short cid; |
| 122 | } __packed; |
| 123 | |
| 124 | struct invalidate_commands_params_in { |
| 125 | struct be_cmd_req_hdr hdr; |
| 126 | unsigned int ref_handle; |
| 127 | unsigned int icd_count; |
| 128 | struct invalidate_command_table table[128]; |
| 129 | unsigned short cleanup_type; |
| 130 | unsigned short unused; |
| 131 | } __packed; |
| 132 | |
| 133 | struct invalidate_commands_params_out { |
| 134 | unsigned int ref_handle; |
| 135 | unsigned int icd_count; |
| 136 | unsigned int icd_status[128]; |
| 137 | } __packed; |
| 138 | |
| 139 | union invalidate_commands_params { |
| 140 | struct invalidate_commands_params_in request; |
| 141 | struct invalidate_commands_params_out response; |
| 142 | } __packed; |
| 143 | |
| 144 | struct mgmt_hba_attributes { |
| 145 | u8 flashrom_version_string[32]; |
| 146 | u8 manufacturer_name[32]; |
| 147 | u32 supported_modes; |
| 148 | u8 seeprom_version_lo; |
| 149 | u8 seeprom_version_hi; |
| 150 | u8 rsvd0[2]; |
| 151 | u32 fw_cmd_data_struct_version; |
| 152 | u32 ep_fw_data_struct_version; |
| 153 | u32 future_reserved[12]; |
| 154 | u32 default_extended_timeout; |
| 155 | u8 controller_model_number[32]; |
| 156 | u8 controller_description[64]; |
| 157 | u8 controller_serial_number[32]; |
| 158 | u8 ip_version_string[32]; |
| 159 | u8 firmware_version_string[32]; |
| 160 | u8 bios_version_string[32]; |
| 161 | u8 redboot_version_string[32]; |
| 162 | u8 driver_version_string[32]; |
| 163 | u8 fw_on_flash_version_string[32]; |
| 164 | u32 functionalities_supported; |
| 165 | u16 max_cdblength; |
| 166 | u8 asic_revision; |
| 167 | u8 generational_guid[16]; |
| 168 | u8 hba_port_count; |
| 169 | u16 default_link_down_timeout; |
| 170 | u8 iscsi_ver_min_max; |
| 171 | u8 multifunction_device; |
| 172 | u8 cache_valid; |
| 173 | u8 hba_status; |
| 174 | u8 max_domains_supported; |
| 175 | u8 phy_port; |
| 176 | u32 firmware_post_status; |
| 177 | u32 hba_mtu[8]; |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 178 | u8 iscsi_features; |
| 179 | u8 future_u8[3]; |
| 180 | u32 future_u32[3]; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 181 | } __packed; |
| 182 | |
| 183 | struct mgmt_controller_attributes { |
| 184 | struct mgmt_hba_attributes hba_attribs; |
| 185 | u16 pci_vendor_id; |
| 186 | u16 pci_device_id; |
| 187 | u16 pci_sub_vendor_id; |
| 188 | u16 pci_sub_system_id; |
| 189 | u8 pci_bus_number; |
| 190 | u8 pci_device_number; |
| 191 | u8 pci_function_number; |
| 192 | u8 interface_type; |
| 193 | u64 unique_identifier; |
| 194 | u8 netfilters; |
| 195 | u8 rsvd0[3]; |
| 196 | u8 future_u32[4]; |
| 197 | } __packed; |
| 198 | |
| 199 | struct be_mgmt_controller_attributes { |
| 200 | struct be_cmd_req_hdr hdr; |
| 201 | struct mgmt_controller_attributes params; |
| 202 | } __packed; |
| 203 | |
| 204 | struct be_mgmt_controller_attributes_resp { |
| 205 | struct be_cmd_resp_hdr hdr; |
| 206 | struct mgmt_controller_attributes params; |
| 207 | } __packed; |
| 208 | |
| 209 | /* configuration management */ |
| 210 | |
| 211 | #define GET_MGMT_CONTROLLER_WS(phba) (phba->pmgmt_ws) |
| 212 | |
| 213 | /* MGMT CMD flags */ |
| 214 | |
| 215 | #define MGMT_CMDH_FREE (1<<0) |
| 216 | |
| 217 | /* --- MGMT_ERROR_CODES --- */ |
| 218 | /* Error Codes returned in the status field of the CMD response header */ |
| 219 | #define MGMT_STATUS_SUCCESS 0 /* The CMD completed without errors */ |
| 220 | #define MGMT_STATUS_FAILED 1 /* Error status in the Status field of */ |
| 221 | /* the CMD_RESPONSE_HEADER */ |
| 222 | |
| 223 | #define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\ |
| 224 | pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\ |
| 225 | bus_address.u.a32.address_lo; \ |
| 226 | pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\ |
| 227 | bus_address.u.a32.address_hi; \ |
| 228 | } |
| 229 | |
| 230 | struct beiscsi_endpoint { |
| 231 | struct beiscsi_hba *phba; |
| 232 | struct beiscsi_sess *sess; |
| 233 | struct beiscsi_conn *conn; |
Jayamohan Kallickal | c246228 | 2010-01-05 05:05:34 +0530 | [diff] [blame^] | 234 | struct iscsi_endpoint *openiscsi_ep; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 235 | unsigned short ip_type; |
| 236 | char dst6_addr[ISCSI_ADDRESS_BUF_LEN]; |
| 237 | unsigned long dst_addr; |
| 238 | unsigned short ep_cid; |
| 239 | unsigned int fw_handle; |
| 240 | u16 dst_tcpport; |
| 241 | u16 cid_vld; |
| 242 | }; |
| 243 | |
| 244 | unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl, |
| 245 | struct beiscsi_hba *phba); |
| 246 | |
| 247 | unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba, |
| 248 | struct beiscsi_endpoint *beiscsi_ep, |
| 249 | unsigned short cid, |
| 250 | unsigned short issue_reset, |
| 251 | unsigned short savecfg_flag); |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 252 | |
| 253 | unsigned char mgmt_fw_cmd(struct be_ctrl_info *ctrl, |
| 254 | struct beiscsi_hba *phba, |
| 255 | char *buf, unsigned int len); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 256 | #endif |