1 /*- 2 * Copyright (c) 2014-2015 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 * $FreeBSD$ 31 */ 32 33 #ifndef _SYS_SFXGE_IOC_H 34 #define _SYS_SFXGE_IOC_H 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 #include <sys/types.h> 41 42 /* More codes may be added if necessary */ 43 enum sfxge_ioc_codes { 44 SFXGE_MCDI_IOC, 45 SFXGE_NVRAM_IOC, 46 SFXGE_VPD_IOC 47 }; 48 49 enum sfxge_nvram_ops { 50 SFXGE_NVRAM_OP_SIZE, 51 SFXGE_NVRAM_OP_READ, 52 SFXGE_NVRAM_OP_WRITE, 53 SFXGE_NVRAM_OP_ERASE, 54 SFXGE_NVRAM_OP_GET_VER, 55 SFXGE_NVRAM_OP_SET_VER 56 }; 57 58 enum sfxge_nvram_types { 59 SFXGE_NVRAM_TYPE_BOOTROM, 60 SFXGE_NVRAM_TYPE_BOOTROM_CFG, 61 SFXGE_NVRAM_TYPE_MC, 62 SFXGE_NVRAM_TYPE_MC_GOLDEN, 63 SFXGE_NVRAM_TYPE_PHY, 64 SFXGE_NVRAM_TYPE_NULL_PHY, 65 SFXGE_NVRAM_TYPE_FPGA, 66 SFXGE_NVRAM_TYPE_FCFW, 67 SFXGE_NVRAM_TYPE_CPLD, 68 SFXGE_NVRAM_TYPE_FPGA_BACKUP, 69 SFXGE_NVRAM_TYPE_DYNAMIC_CFG 70 }; 71 72 enum sfxge_vpd_ops { 73 SFXGE_VPD_OP_GET_KEYWORD, 74 SFXGE_VPD_OP_SET_KEYWORD 75 }; 76 77 #define SFXGE_MCDI_MAX_PAYLOAD 0x400 78 #define SFXGE_VPD_MAX_PAYLOAD 0x100 79 80 typedef struct sfxge_ioc_s { 81 uint32_t op; 82 union { 83 struct { 84 caddr_t payload; 85 uint32_t cmd; 86 size_t len; /* In and out */ 87 uint32_t rc; 88 } mcdi; 89 struct { 90 uint32_t op; 91 uint32_t type; 92 uint32_t offset; 93 uint32_t size; 94 uint32_t subtype; 95 uint16_t version[4]; /* get/set_ver */ 96 caddr_t data; 97 } nvram; 98 struct { 99 uint8_t op; 100 uint8_t tag; 101 uint16_t keyword; 102 uint16_t len; /* In or out */ 103 caddr_t payload; 104 } vpd; 105 } u; 106 } __packed sfxge_ioc_t; 107 108 #ifdef __cplusplus 109 } 110 #endif 111 112 #endif /* _SYS_SFXGE_IOC_H */ 113