149ef7e06SGarrett D'Amore /* 249ef7e06SGarrett D'Amore * Copyright (c) 2008-2016 Solarflare Communications Inc. 349ef7e06SGarrett D'Amore * All rights reserved. 449ef7e06SGarrett D'Amore * 549ef7e06SGarrett D'Amore * Redistribution and use in source and binary forms, with or without 649ef7e06SGarrett D'Amore * modification, are permitted provided that the following conditions are met: 749ef7e06SGarrett D'Amore * 849ef7e06SGarrett D'Amore * 1. Redistributions of source code must retain the above copyright notice, 949ef7e06SGarrett D'Amore * this list of conditions and the following disclaimer. 1049ef7e06SGarrett D'Amore * 2. Redistributions in binary form must reproduce the above copyright notice, 1149ef7e06SGarrett D'Amore * this list of conditions and the following disclaimer in the documentation 1249ef7e06SGarrett D'Amore * and/or other materials provided with the distribution. 1349ef7e06SGarrett D'Amore * 1449ef7e06SGarrett D'Amore * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 1549ef7e06SGarrett D'Amore * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1649ef7e06SGarrett D'Amore * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1749ef7e06SGarrett D'Amore * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 1849ef7e06SGarrett D'Amore * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1949ef7e06SGarrett D'Amore * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2049ef7e06SGarrett D'Amore * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2149ef7e06SGarrett D'Amore * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2249ef7e06SGarrett D'Amore * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 2349ef7e06SGarrett D'Amore * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 2449ef7e06SGarrett D'Amore * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2549ef7e06SGarrett D'Amore * 2649ef7e06SGarrett D'Amore * The views and conclusions contained in the software and documentation are 2749ef7e06SGarrett D'Amore * those of the authors and should not be interpreted as representing official 2849ef7e06SGarrett D'Amore * policies, either expressed or implied, of the FreeBSD Project. 2949ef7e06SGarrett D'Amore */ 3049ef7e06SGarrett D'Amore 3149ef7e06SGarrett D'Amore #ifndef _SYS_SFXGE_IOC_H 3249ef7e06SGarrett D'Amore #define _SYS_SFXGE_IOC_H 3349ef7e06SGarrett D'Amore 3449ef7e06SGarrett D'Amore #ifdef __cplusplus 3549ef7e06SGarrett D'Amore extern "C" { 3649ef7e06SGarrett D'Amore #endif 3749ef7e06SGarrett D'Amore 3849ef7e06SGarrett D'Amore #include <sys/types.h> 3949ef7e06SGarrett D'Amore 4049ef7e06SGarrett D'Amore /* Ensure no ambiguity over structure layouts */ 4149ef7e06SGarrett D'Amore #pragma pack(1) 4249ef7e06SGarrett D'Amore 4349ef7e06SGarrett D'Amore #define SFXGE_IOC ('S' << 24 | 'F' << 16 | 'C' << 8) 4449ef7e06SGarrett D'Amore 4549ef7e06SGarrett D'Amore #define SFXGE_STOP_IOC (SFXGE_IOC | 0x01) 4649ef7e06SGarrett D'Amore #define SFXGE_START_IOC (SFXGE_IOC | 0x02) 4749ef7e06SGarrett D'Amore 4849ef7e06SGarrett D'Amore /* MDIO was SFXGE_IOC 0x03 */ 4949ef7e06SGarrett D'Amore 5049ef7e06SGarrett D'Amore /* I2C was SFXGE_IOC 0x04 */ 5149ef7e06SGarrett D'Amore 5249ef7e06SGarrett D'Amore /* SPI was SFXGE_IOC 0x05 */ 5349ef7e06SGarrett D'Amore 5449ef7e06SGarrett D'Amore /* BAR was SFXGE_IOC 0x06 */ 5549ef7e06SGarrett D'Amore 5649ef7e06SGarrett D'Amore /* PCI was SFXGE_IOC 0x07 */ 5749ef7e06SGarrett D'Amore 5849ef7e06SGarrett D'Amore /* MAC was SFXGE_IOC 0x08 */ 5949ef7e06SGarrett D'Amore 6049ef7e06SGarrett D'Amore /* PHY was SFXGE_IOC 0x09 */ 6149ef7e06SGarrett D'Amore 6249ef7e06SGarrett D'Amore /* SRAM was SFXGE_IOC 0x0a */ 6349ef7e06SGarrett D'Amore 6449ef7e06SGarrett D'Amore /* TX was SFXGE_IOC 0x0b */ 6549ef7e06SGarrett D'Amore 6649ef7e06SGarrett D'Amore /* RX was SFXGE_IOC 0x0c */ 6749ef7e06SGarrett D'Amore 6849ef7e06SGarrett D'Amore /* NVRAM */ 6949ef7e06SGarrett D'Amore 7049ef7e06SGarrett D'Amore #define SFXGE_NVRAM_IOC (SFXGE_IOC | 0x0d) 7149ef7e06SGarrett D'Amore 7249ef7e06SGarrett D'Amore typedef struct sfxge_nvram_ioc_s { 7349ef7e06SGarrett D'Amore uint32_t sni_op; 7449ef7e06SGarrett D'Amore uint32_t sni_type; 7549ef7e06SGarrett D'Amore uint32_t sni_offset; 7649ef7e06SGarrett D'Amore uint32_t sni_size; 7749ef7e06SGarrett D'Amore uint32_t sni_subtype; 7849ef7e06SGarrett D'Amore uint16_t sni_version[4]; /* get/set_ver */ 7949ef7e06SGarrett D'Amore /* 8049ef7e06SGarrett D'Amore * Streams STRMSGSZ limit (default 64kb) 81*bbf21555SRichard Lowe * See write(2) and I_STR in streamio(4I) 8249ef7e06SGarrett D'Amore */ 8349ef7e06SGarrett D'Amore uint8_t sni_data[32*1024]; /* read/write */ 8449ef7e06SGarrett D'Amore } sfxge_nvram_ioc_t; 8549ef7e06SGarrett D'Amore 8649ef7e06SGarrett D'Amore #define SFXGE_NVRAM_OP_SIZE 0x00000001 8749ef7e06SGarrett D'Amore #define SFXGE_NVRAM_OP_READ 0x00000002 8849ef7e06SGarrett D'Amore #define SFXGE_NVRAM_OP_WRITE 0x00000003 8949ef7e06SGarrett D'Amore #define SFXGE_NVRAM_OP_ERASE 0x00000004 9049ef7e06SGarrett D'Amore #define SFXGE_NVRAM_OP_GET_VER 0x00000005 9149ef7e06SGarrett D'Amore #define SFXGE_NVRAM_OP_SET_VER 0x00000006 9249ef7e06SGarrett D'Amore 9349ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_BOOTROM 0x00000001 9449ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_BOOTROM_CFG 0x00000002 9549ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_MC 0x00000003 9649ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_MC_GOLDEN 0x00000004 9749ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_PHY 0x00000005 9849ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_NULL_PHY 0x00000006 9949ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_FPGA 0x00000007 10049ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_FCFW 0x00000008 10149ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_CPLD 0x00000009 10249ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_FPGA_BACKUP 0x0000000a 10349ef7e06SGarrett D'Amore #define SFXGE_NVRAM_TYPE_DYNAMIC_CFG 0x0000000b 10449ef7e06SGarrett D'Amore 10549ef7e06SGarrett D'Amore 10649ef7e06SGarrett D'Amore /* PHY BIST was IOC 0x0e */ 10749ef7e06SGarrett D'Amore 10849ef7e06SGarrett D'Amore /* Legacy IOC for MCDIv1 protocol - do not use in new code */ 10949ef7e06SGarrett D'Amore #define SFXGE_MCDI_IOC (SFXGE_IOC | 0x0f) 11049ef7e06SGarrett D'Amore 11149ef7e06SGarrett D'Amore typedef struct sfxge_mcdi_ioc_s { 11249ef7e06SGarrett D'Amore uint8_t smi_payload[256]; 11349ef7e06SGarrett D'Amore uint8_t smi_cmd; 11449ef7e06SGarrett D'Amore uint8_t smi_len; /* In and out */ 11549ef7e06SGarrett D'Amore uint8_t smi_rc; 11649ef7e06SGarrett D'Amore } sfxge_mcdi_ioc_t; 11749ef7e06SGarrett D'Amore 11849ef7e06SGarrett D'Amore /* Reset the NIC */ 11949ef7e06SGarrett D'Amore 12049ef7e06SGarrett D'Amore #define SFXGE_NIC_RESET_IOC (SFXGE_IOC | 0x10) 12149ef7e06SGarrett D'Amore 12249ef7e06SGarrett D'Amore /* VPD */ 12349ef7e06SGarrett D'Amore 12449ef7e06SGarrett D'Amore #define SFXGE_VPD_IOC (SFXGE_IOC | 0x11) 12549ef7e06SGarrett D'Amore 12649ef7e06SGarrett D'Amore #define SFXGE_VPD_MAX_PAYLOAD 0x100 12749ef7e06SGarrett D'Amore 12849ef7e06SGarrett D'Amore typedef struct sfxge_vpd_ioc_s { 12949ef7e06SGarrett D'Amore uint8_t svi_op; 13049ef7e06SGarrett D'Amore uint8_t svi_tag; 13149ef7e06SGarrett D'Amore uint16_t svi_keyword; 13249ef7e06SGarrett D'Amore uint8_t svi_len; /* In or out */ 13349ef7e06SGarrett D'Amore uint8_t svi_payload[SFXGE_VPD_MAX_PAYLOAD]; /* In or out */ 13449ef7e06SGarrett D'Amore } sfxge_vpd_ioc_t; 13549ef7e06SGarrett D'Amore 13649ef7e06SGarrett D'Amore #define SFXGE_VPD_OP_GET_KEYWORD 0x00000001 13749ef7e06SGarrett D'Amore #define SFXGE_VPD_OP_SET_KEYWORD 0x00000002 13849ef7e06SGarrett D'Amore 13949ef7e06SGarrett D'Amore /* MCDIv2 */ 14049ef7e06SGarrett D'Amore 14149ef7e06SGarrett D'Amore #define SFXGE_MCDI2_IOC (SFXGE_IOC | 0x12) 14249ef7e06SGarrett D'Amore 14349ef7e06SGarrett D'Amore typedef struct sfxge_mcdi2_ioc_s { 14449ef7e06SGarrett D'Amore uint8_t smi_payload[1024]; 14549ef7e06SGarrett D'Amore uint32_t smi_cmd; 14649ef7e06SGarrett D'Amore uint32_t smi_len; /* In and out */ 14749ef7e06SGarrett D'Amore uint32_t smi_rc; 14849ef7e06SGarrett D'Amore } sfxge_mcdi2_ioc_t; 14949ef7e06SGarrett D'Amore 15049ef7e06SGarrett D'Amore 15149ef7e06SGarrett D'Amore #pragma pack() 15249ef7e06SGarrett D'Amore 15349ef7e06SGarrett D'Amore #ifdef __cplusplus 15449ef7e06SGarrett D'Amore } 15549ef7e06SGarrett D'Amore #endif 15649ef7e06SGarrett D'Amore 15749ef7e06SGarrett D'Amore #endif /* _SYS_SFXGE_IOC_H */ 158