1 /*- 2 * Copyright (c) 2014-2016 Solarflare Communications Inc. 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 are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 * The views and conclusions contained in the software and documentation are 27 * those of the authors and should not be interpreted as representing official 28 * policies, either expressed or implied, of the FreeBSD Project. 29 */ 30 31 #ifndef _SYS_SFXGE_IOC_H 32 #define _SYS_SFXGE_IOC_H 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 #include <sys/types.h> 39 40 /* More codes may be added if necessary */ 41 enum sfxge_ioc_codes { 42 SFXGE_MCDI_IOC, 43 SFXGE_NVRAM_IOC, 44 SFXGE_VPD_IOC 45 }; 46 47 enum sfxge_nvram_ops { 48 SFXGE_NVRAM_OP_SIZE, 49 SFXGE_NVRAM_OP_READ, 50 SFXGE_NVRAM_OP_WRITE, 51 SFXGE_NVRAM_OP_ERASE, 52 SFXGE_NVRAM_OP_GET_VER, 53 SFXGE_NVRAM_OP_SET_VER 54 }; 55 56 enum sfxge_nvram_types { 57 SFXGE_NVRAM_TYPE_BOOTROM, 58 SFXGE_NVRAM_TYPE_BOOTROM_CFG, 59 SFXGE_NVRAM_TYPE_MC, 60 SFXGE_NVRAM_TYPE_MC_GOLDEN, 61 SFXGE_NVRAM_TYPE_PHY, 62 SFXGE_NVRAM_TYPE_NULL_PHY, 63 SFXGE_NVRAM_TYPE_FPGA, 64 SFXGE_NVRAM_TYPE_FCFW, 65 SFXGE_NVRAM_TYPE_CPLD, 66 SFXGE_NVRAM_TYPE_FPGA_BACKUP, 67 SFXGE_NVRAM_TYPE_DYNAMIC_CFG 68 }; 69 70 enum sfxge_vpd_ops { 71 SFXGE_VPD_OP_GET_KEYWORD, 72 SFXGE_VPD_OP_SET_KEYWORD 73 }; 74 75 #define SFXGE_MCDI_MAX_PAYLOAD 0x400 76 #define SFXGE_VPD_MAX_PAYLOAD 0x100 77 78 typedef struct sfxge_ioc_s { 79 uint32_t op; 80 union { 81 struct { 82 caddr_t payload; 83 uint32_t cmd; 84 size_t len; /* In and out */ 85 uint32_t rc; 86 } mcdi; 87 struct { 88 uint32_t op; 89 uint32_t type; 90 uint32_t offset; 91 uint32_t size; 92 uint32_t subtype; 93 uint16_t version[4]; /* get/set_ver */ 94 caddr_t data; 95 } nvram; 96 struct { 97 uint8_t op; 98 uint8_t tag; 99 uint16_t keyword; 100 uint16_t len; /* In or out */ 101 caddr_t payload; 102 } vpd; 103 } u; 104 } __packed sfxge_ioc_t; 105 106 #ifdef __cplusplus 107 } 108 #endif 109 110 #endif /* _SYS_SFXGE_IOC_H */ 111