1 /* 2 * QEMU igb emulation - shared definitions 3 * 4 * Copyright (c) 2020-2023 Red Hat, Inc. 5 * Copyright (c) 2008 Qumranet 6 * 7 * Based on work done by: 8 * Nir Peleg, Tutis Systems Ltd. for Qumranet Inc. 9 * Copyright (c) 2007 Dan Aloni 10 * Copyright (c) 2004 Antony T Curtis 11 * 12 * This library is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU Lesser General Public 14 * License as published by the Free Software Foundation; either 15 * version 2.1 of the License, or (at your option) any later version. 16 * 17 * This library is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * Lesser General Public License for more details. 21 * 22 * You should have received a copy of the GNU Lesser General Public 23 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 24 */ 25 26 #ifndef HW_NET_IGB_COMMON_H 27 #define HW_NET_IGB_COMMON_H 28 29 #include "igb_regs.h" 30 31 #define TYPE_IGBVF "igbvf" 32 33 #define IGBVF_MMIO_BAR_IDX (0) 34 #define IGBVF_MSIX_BAR_IDX (3) 35 36 #define IGBVF_MMIO_SIZE (16 * 1024) 37 #define IGBVF_MSIX_SIZE (16 * 1024) 38 39 #define defreg(x) x = (E1000_##x >> 2) 40 #define defreg_indexed(x, i) x##i = (E1000_##x(i) >> 2) 41 #define defreg_indexeda(x, i) x##i##_A = (E1000_##x##_A(i) >> 2) 42 43 #define defregd(x) defreg_indexed(x, 0), defreg_indexed(x, 1), \ 44 defreg_indexed(x, 2), defreg_indexed(x, 3), \ 45 defreg_indexed(x, 4), defreg_indexed(x, 5), \ 46 defreg_indexed(x, 6), defreg_indexed(x, 7), \ 47 defreg_indexed(x, 8), defreg_indexed(x, 9), \ 48 defreg_indexed(x, 10), defreg_indexed(x, 11), \ 49 defreg_indexed(x, 12), defreg_indexed(x, 13), \ 50 defreg_indexed(x, 14), defreg_indexed(x, 15), \ 51 defreg_indexeda(x, 0), defreg_indexeda(x, 1), \ 52 defreg_indexeda(x, 2), defreg_indexeda(x, 3) 53 54 #define defreg8(x) defreg_indexed(x, 0), defreg_indexed(x, 1), \ 55 defreg_indexed(x, 2), defreg_indexed(x, 3), \ 56 defreg_indexed(x, 4), defreg_indexed(x, 5), \ 57 defreg_indexed(x, 6), defreg_indexed(x, 7) 58 59 enum { 60 defreg(CTRL), defreg(EECD), defreg(EERD), defreg(GPRC), 61 defreg(GPTC), defreg(ICR), defreg(ICS), defreg(IMC), 62 defreg(IMS), defreg(LEDCTL), defreg(MANC), defreg(MDIC), 63 defreg(MPC), defreg(RCTL), 64 defreg(STATUS), defreg(SWSM), defreg(TCTL), 65 defreg(TORH), defreg(TORL), defreg(TOTH), 66 defreg(TOTL), defreg(TPR), defreg(TPT), 67 defreg(WUFC), defreg(RA), defreg(MTA), defreg(CRCERRS), 68 defreg(VFTA), defreg(VET), 69 defreg(SCC), defreg(ECOL), 70 defreg(MCC), defreg(LATECOL), defreg(COLC), defreg(DC), 71 defreg(TNCRS), defreg(RLEC), 72 defreg(XONRXC), defreg(XONTXC), defreg(XOFFRXC), defreg(XOFFTXC), 73 defreg(FCRUC), defreg(TDFH), defreg(TDFT), 74 defreg(TDFHS), defreg(TDFTS), defreg(TDFPC), defreg(WUC), 75 defreg(WUS), defreg(RDFH), 76 defreg(RDFT), defreg(RDFHS), defreg(RDFTS), defreg(RDFPC), 77 defreg(IPAV), defreg(IP4AT), defreg(IP6AT), 78 defreg(WUPM), defreg(FFMT), 79 defreg(IAM), 80 defreg(GCR), defreg(TIMINCA), defreg(EIAC), defreg(CTRL_EXT), 81 defreg(IVAR0), defreg(MANC2H), 82 defreg(MFVAL), defreg(MDEF), defreg(FACTPS), defreg(FTFT), 83 defreg(RUC), defreg(ROC), defreg(RFC), defreg(RJC), 84 defreg(PRC64), defreg(PRC127), defreg(PRC255), defreg(PRC511), 85 defreg(PRC1023), defreg(PRC1522), defreg(PTC64), defreg(PTC127), 86 defreg(PTC255), defreg(PTC511), defreg(PTC1023), defreg(PTC1522), 87 defreg(GORCL), defreg(GORCH), defreg(GOTCL), defreg(GOTCH), 88 defreg(RNBC), defreg(BPRC), defreg(MPRC), defreg(RFCTL), 89 defreg(MPTC), defreg(BPTC), 90 defreg(IAC), defreg(MGTPRC), defreg(MGTPDC), defreg(MGTPTC), 91 defreg(TSCTC), defreg(RXCSUM), defreg(FUNCTAG), defreg(GSCL_1), 92 defreg(GSCL_2), defreg(GSCL_3), defreg(GSCL_4), defreg(GSCN_0), 93 defreg(GSCN_1), defreg(GSCN_2), defreg(GSCN_3), 94 defreg_indexed(EITR, 0), 95 defreg(MRQC), defreg(RETA), defreg(RSSRK), 96 defreg(PBACLR), defreg(FCAL), defreg(FCAH), defreg(FCT), 97 defreg(FCRTH), defreg(FCRTL), defreg(FCTTV), defreg(FCRTV), 98 defreg(FLA), defreg(FLOP), 99 defreg(MAVTV0), defreg(MAVTV1), defreg(MAVTV2), defreg(MAVTV3), 100 defreg(TXSTMPL), defreg(TXSTMPH), defreg(SYSTIML), defreg(SYSTIMH), 101 defreg(TIMADJL), defreg(TIMADJH), 102 defreg(RXSTMPH), defreg(RXSTMPL), defreg(RXSATRL), defreg(RXSATRH), 103 defreg(TIPG), 104 defreg(CTRL_DUP), 105 defreg(EEMNGCTL), 106 defreg(EEMNGDATA), 107 defreg(FLMNGCTL), 108 defreg(FLMNGDATA), 109 defreg(FLMNGCNT), 110 defreg(TSYNCRXCTL), 111 defreg(TSYNCTXCTL), 112 defreg(RLPML), 113 defreg(UTA), 114 115 /* Aliases */ 116 defreg(RDFH_A), defreg(RDFT_A), defreg(TDFH_A), defreg(TDFT_A), 117 defreg(RA_A), defreg(VFTA_A), defreg(FCRTL_A), 118 119 /* Additional regs used by IGB */ 120 defreg(FWSM), defreg(SW_FW_SYNC), 121 122 defreg(EICS), defreg(EIMS), defreg(EIMC), defreg(EIAM), 123 defreg(EICR), defreg(IVAR_MISC), defreg(GPIE), 124 125 defreg(TSYNCRXCFG), defreg8(ETQF), 126 127 defreg(RXPBS), defregd(RDBAL), defregd(RDBAH), defregd(RDLEN), 128 defregd(SRRCTL), defregd(RDH), defregd(RDT), 129 defregd(RXDCTL), defregd(RXCTL), defregd(RQDPC), defreg(RA2), 130 131 defreg(TXPBS), defreg(TCTL_EXT), defreg(DTXCTL), defreg(HTCBDPC), 132 defregd(TDBAL), defregd(TDBAH), defregd(TDLEN), defregd(TDH), 133 defregd(TDT), defregd(TXDCTL), defregd(TXCTL), 134 defregd(TDWBAL), defregd(TDWBAH), 135 136 defreg(VT_CTL), 137 138 defreg8(P2VMAILBOX), defreg8(V2PMAILBOX), defreg(MBVFICR), defreg(MBVFIMR), 139 defreg(VFLRE), defreg(VFRE), defreg(VFTE), defreg(WVBR), 140 defreg(QDE), defreg(DTXSWC), defreg_indexed(VLVF, 0), 141 defreg8(VMOLR), defreg(RPLOLR), defreg8(VMBMEM), defreg8(VMVIR), 142 143 defreg8(PVTCTRL), defreg8(PVTEICS), defreg8(PVTEIMS), defreg8(PVTEIMC), 144 defreg8(PVTEIAC), defreg8(PVTEIAM), defreg8(PVTEICR), defreg8(PVFGPRC), 145 defreg8(PVFGPTC), defreg8(PVFGORC), defreg8(PVFGOTC), defreg8(PVFMPRC), 146 defreg8(PVFGPRLBC), defreg8(PVFGPTLBC), defreg8(PVFGORLBC), defreg8(PVFGOTLBC), 147 148 defreg(MTA_A), 149 150 defreg(VTIVAR), defreg(VTIVAR_MISC), 151 }; 152 153 uint64_t igb_mmio_read(void *opaque, hwaddr addr, unsigned size); 154 void igb_mmio_write(void *opaque, hwaddr addr, uint64_t val, unsigned size); 155 156 #endif 157