1 /* 2 * Copyright (c) 2015-2016 Qlogic Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #ifndef _BXE_IOCTL_H_ 29 #define _BXE_IOCTL_H_ 30 31 #include <sys/cdefs.h> 32 #include <sys/ioccom.h> 33 34 35 struct bxe_grcdump { 36 uint16_t pci_func; 37 uint32_t grcdump_size; 38 void *grcdump; 39 uint32_t grcdump_dwords; 40 }; 41 typedef struct bxe_grcdump bxe_grcdump_t; 42 43 #define BXE_DRV_NAME_LENGTH 32 44 #define BXE_DRV_VERSION_LENGTH 32 45 #define BXE_MFW_VERSION_LENGTH 32 46 #define BXE_STORMFW_VERSION_LENGTH 32 47 #define BXE_BUS_INFO_LENGTH 32 48 49 struct bxe_drvinfo { 50 char drv_name[BXE_DRV_NAME_LENGTH]; 51 char drv_version[BXE_DRV_VERSION_LENGTH]; 52 char mfw_version[BXE_MFW_VERSION_LENGTH]; 53 char stormfw_version[BXE_STORMFW_VERSION_LENGTH]; 54 uint32_t eeprom_dump_len; /* in bytes */ 55 uint32_t reg_dump_len; /* in bytes */ 56 char bus_info[BXE_BUS_INFO_LENGTH]; 57 }; 58 typedef struct bxe_drvinfo bxe_drvinfo_t; 59 60 struct bxe_dev_setting { 61 62 uint32_t supported; /* Features this interface supports */ 63 uint32_t advertising;/* Features this interface advertises */ 64 uint32_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */ 65 uint32_t duplex; /* Duplex, half or full */ 66 uint32_t port; /* Which connector port */ 67 uint32_t phy_address;/* port number*/ 68 uint32_t autoneg; /* Enable or disable autonegotiation */ 69 }; 70 typedef struct bxe_dev_setting bxe_dev_setting_t; 71 72 struct bxe_get_regs { 73 void *reg_buf; 74 uint32_t reg_buf_len; 75 }; 76 typedef struct bxe_get_regs bxe_get_regs_t; 77 78 #define BXE_EEPROM_MAX_DATA_LEN 524288 79 80 struct bxe_eeprom { 81 uint32_t eeprom_cmd; 82 #define BXE_EEPROM_CMD_SET_EEPROM 0x01 83 #define BXE_EEPROM_CMD_GET_EEPROM 0x02 84 85 void *eeprom_data; 86 uint32_t eeprom_offset; 87 uint32_t eeprom_data_len; 88 uint32_t eeprom_magic; 89 }; 90 typedef struct bxe_eeprom bxe_eeprom_t; 91 92 struct bxe_reg_rdw { 93 uint32_t reg_cmd; 94 #define BXE_READ_REG_CMD 0x01 95 #define BXE_WRITE_REG_CMD 0x02 96 97 uint32_t reg_id; 98 uint32_t reg_val; 99 uint32_t reg_access_type; 100 #define BXE_REG_ACCESS_DIRECT 0x01 101 #define BXE_REG_ACCESS_INDIRECT 0x02 102 }; 103 104 typedef struct bxe_reg_rdw bxe_reg_rdw_t; 105 106 struct bxe_pcicfg_rdw { 107 uint32_t cfg_cmd; 108 #define BXE_READ_PCICFG 0x01 109 #define BXE_WRITE_PCICFG 0x01 110 uint32_t cfg_id; 111 uint32_t cfg_val; 112 uint32_t cfg_width; 113 }; 114 115 typedef struct bxe_pcicfg_rdw bxe_pcicfg_rdw_t; 116 117 struct bxe_perm_mac_addr { 118 char mac_addr_str[32]; 119 }; 120 121 typedef struct bxe_perm_mac_addr bxe_perm_mac_addr_t; 122 123 124 /* 125 * Read grcdump size 126 */ 127 #define BXE_GRC_DUMP_SIZE _IOWR('e', 1, bxe_grcdump_t) 128 129 /* 130 * Read grcdump 131 */ 132 #define BXE_GRC_DUMP _IOWR('e', 2, bxe_grcdump_t) 133 134 /* 135 * Read driver info 136 */ 137 #define BXE_DRV_INFO _IOR('e', 3, bxe_drvinfo_t) 138 139 /* 140 * Read Device Setting 141 */ 142 #define BXE_DEV_SETTING _IOR('e', 4, bxe_dev_setting_t) 143 144 /* 145 * Get Registers 146 */ 147 #define BXE_GET_REGS _IOR('e', 5, bxe_get_regs_t) 148 149 /* 150 * Get/Set EEPROM 151 */ 152 #define BXE_EEPROM _IOWR('e', 6, bxe_eeprom_t) 153 154 /* 155 * read/write a register 156 */ 157 #define BXE_RDW_REG _IOWR('e', 7, bxe_reg_rdw_t) 158 159 /* 160 * read/write PCIcfg 161 */ 162 #define BXE_RDW_PCICFG _IOWR('e', 8, bxe_reg_rdw_t) 163 164 /* 165 * get permanent mac address 166 */ 167 168 #define BXE_MAC_ADDR _IOWR('e', 9, bxe_perm_mac_addr_t) 169 170 171 #endif /* #ifndef _QLNX_IOCTL_H_ */ 172