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 defreg(x) x = (E1000_##x >> 2) 32 #define defreg_indexed(x, i) x##i = (E1000_##x(i) >> 2) 33 #define defreg_indexeda(x, i) x##i##_A = (E1000_##x##_A(i) >> 2) 34 35 #define defregd(x) defreg_indexed(x, 0), defreg_indexed(x, 1), \ 36 defreg_indexed(x, 2), defreg_indexed(x, 3), \ 37 defreg_indexed(x, 4), defreg_indexed(x, 5), \ 38 defreg_indexed(x, 6), defreg_indexed(x, 7), \ 39 defreg_indexed(x, 8), defreg_indexed(x, 9), \ 40 defreg_indexed(x, 10), defreg_indexed(x, 11), \ 41 defreg_indexed(x, 12), defreg_indexed(x, 13), \ 42 defreg_indexed(x, 14), defreg_indexed(x, 15), \ 43 defreg_indexeda(x, 0), defreg_indexeda(x, 1), \ 44 defreg_indexeda(x, 2), defreg_indexeda(x, 3) 45 46 #define defregv(x) defreg_indexed(x, 0), defreg_indexed(x, 1), \ 47 defreg_indexed(x, 2), defreg_indexed(x, 3), \ 48 defreg_indexed(x, 4), defreg_indexed(x, 5), \ 49 defreg_indexed(x, 6), defreg_indexed(x, 7) 50 51 enum { 52 defreg(CTRL), defreg(EECD), defreg(EERD), defreg(GPRC), 53 defreg(GPTC), defreg(ICR), defreg(ICS), defreg(IMC), 54 defreg(IMS), defreg(LEDCTL), defreg(MANC), defreg(MDIC), 55 defreg(MPC), defreg(RCTL), 56 defreg(STATUS), defreg(SWSM), defreg(TCTL), 57 defreg(TORH), defreg(TORL), defreg(TOTH), 58 defreg(TOTL), defreg(TPR), defreg(TPT), 59 defreg(WUFC), defreg(RA), defreg(MTA), defreg(CRCERRS), 60 defreg(VFTA), defreg(VET), 61 defreg(SCC), defreg(ECOL), 62 defreg(MCC), defreg(LATECOL), defreg(COLC), defreg(DC), 63 defreg(TNCRS), defreg(RLEC), 64 defreg(XONRXC), defreg(XONTXC), defreg(XOFFRXC), defreg(XOFFTXC), 65 defreg(FCRUC), defreg(TDFH), defreg(TDFT), 66 defreg(TDFHS), defreg(TDFTS), defreg(TDFPC), defreg(WUC), 67 defreg(WUS), defreg(RDFH), 68 defreg(RDFT), defreg(RDFHS), defreg(RDFTS), defreg(RDFPC), 69 defreg(IPAV), defreg(IP4AT), defreg(IP6AT), 70 defreg(WUPM), defreg(FFMT), 71 defreg(IAM), 72 defreg(GCR), defreg(TIMINCA), defreg(EIAC), defreg(CTRL_EXT), 73 defreg(IVAR0), defreg(MANC2H), 74 defreg(MFVAL), defreg(MDEF), defreg(FACTPS), defreg(FTFT), 75 defreg(RUC), defreg(ROC), defreg(RFC), defreg(RJC), 76 defreg(PRC64), defreg(PRC127), defreg(PRC255), defreg(PRC511), 77 defreg(PRC1023), defreg(PRC1522), defreg(PTC64), defreg(PTC127), 78 defreg(PTC255), defreg(PTC511), defreg(PTC1023), defreg(PTC1522), 79 defreg(GORCL), defreg(GORCH), defreg(GOTCL), defreg(GOTCH), 80 defreg(RNBC), defreg(BPRC), defreg(MPRC), defreg(RFCTL), 81 defreg(MPTC), defreg(BPTC), 82 defreg(IAC), defreg(MGTPRC), defreg(MGTPDC), defreg(MGTPTC), 83 defreg(TSCTC), defreg(RXCSUM), defreg(FUNCTAG), defreg(GSCL_1), 84 defreg(GSCL_2), defreg(GSCL_3), defreg(GSCL_4), defreg(GSCN_0), 85 defreg(GSCN_1), defreg(GSCN_2), defreg(GSCN_3), 86 defreg_indexed(EITR, 0), 87 defreg(MRQC), defreg(RETA), defreg(RSSRK), 88 defreg(PBACLR), defreg(FCAL), defreg(FCAH), defreg(FCT), 89 defreg(FCRTH), defreg(FCRTL), defreg(FCTTV), defreg(FCRTV), 90 defreg(FLA), defreg(FLOP), 91 defreg(MAVTV0), defreg(MAVTV1), defreg(MAVTV2), defreg(MAVTV3), 92 defreg(TXSTMPL), defreg(TXSTMPH), defreg(SYSTIML), defreg(SYSTIMH), 93 defreg(TIMADJL), defreg(TIMADJH), 94 defreg(RXSTMPH), defreg(RXSTMPL), defreg(RXSATRL), defreg(RXSATRH), 95 defreg(TIPG), 96 defreg(CTRL_DUP), 97 defreg(EEMNGCTL), 98 defreg(EEMNGDATA), 99 defreg(FLMNGCTL), 100 defreg(FLMNGDATA), 101 defreg(FLMNGCNT), 102 defreg(TSYNCRXCTL), 103 defreg(TSYNCTXCTL), 104 defreg(RLPML), 105 defreg(UTA), 106 107 /* Aliases */ 108 defreg(RDFH_A), defreg(RDFT_A), defreg(TDFH_A), defreg(TDFT_A), 109 defreg(RA_A), defreg(VFTA_A), defreg(FCRTL_A), 110 111 /* Additional regs used by IGB */ 112 defreg(FWSM), defreg(SW_FW_SYNC), 113 114 defreg(EICS), defreg(EIMS), defreg(EIMC), defreg(EIAM), 115 defreg(EICR), defreg(IVAR_MISC), defreg(GPIE), 116 117 defreg(RXPBS), defregd(RDBAL), defregd(RDBAH), defregd(RDLEN), 118 defregd(SRRCTL), defregd(RDH), defregd(RDT), 119 defregd(RXDCTL), defregd(RXCTL), defregd(RQDPC), defreg(RA2), 120 121 defreg(TXPBS), defreg(TCTL_EXT), defreg(DTXCTL), defreg(HTCBDPC), 122 defregd(TDBAL), defregd(TDBAH), defregd(TDLEN), defregd(TDH), 123 defregd(TDT), defregd(TXDCTL), defregd(TXCTL), 124 defregd(TDWBAL), defregd(TDWBAH), 125 126 defreg(VT_CTL), 127 128 defregv(P2VMAILBOX), defregv(V2PMAILBOX), defreg(MBVFICR), defreg(MBVFIMR), 129 defreg(VFLRE), defreg(VFRE), defreg(VFTE), defreg(WVBR), 130 defreg(QDE), defreg(DTXSWC), defreg_indexed(VLVF, 0), 131 defregv(VMOLR), defreg(RPLOLR), defregv(VMBMEM), defregv(VMVIR), 132 133 defregv(PVTCTRL), defregv(PVTEICS), defregv(PVTEIMS), defregv(PVTEIMC), 134 defregv(PVTEIAC), defregv(PVTEIAM), defregv(PVTEICR), defregv(PVFGPRC), 135 defregv(PVFGPTC), defregv(PVFGORC), defregv(PVFGOTC), defregv(PVFMPRC), 136 defregv(PVFGPRLBC), defregv(PVFGPTLBC), defregv(PVFGORLBC), defregv(PVFGOTLBC), 137 138 defreg(MTA_A), 139 140 defreg(VTIVAR), defreg(VTIVAR_MISC), 141 }; 142 143 uint64_t igb_mmio_read(void *opaque, hwaddr addr, unsigned size); 144 void igb_mmio_write(void *opaque, hwaddr addr, uint64_t val, unsigned size); 145 146 #endif 147