13a977deeSAkihiko Odaki /* 23a977deeSAkihiko Odaki * QEMU igb emulation - shared definitions 33a977deeSAkihiko Odaki * 43a977deeSAkihiko Odaki * Copyright (c) 2020-2023 Red Hat, Inc. 53a977deeSAkihiko Odaki * Copyright (c) 2008 Qumranet 63a977deeSAkihiko Odaki * 73a977deeSAkihiko Odaki * Based on work done by: 83a977deeSAkihiko Odaki * Nir Peleg, Tutis Systems Ltd. for Qumranet Inc. 93a977deeSAkihiko Odaki * Copyright (c) 2007 Dan Aloni 103a977deeSAkihiko Odaki * Copyright (c) 2004 Antony T Curtis 113a977deeSAkihiko Odaki * 123a977deeSAkihiko Odaki * This library is free software; you can redistribute it and/or 133a977deeSAkihiko Odaki * modify it under the terms of the GNU Lesser General Public 143a977deeSAkihiko Odaki * License as published by the Free Software Foundation; either 153a977deeSAkihiko Odaki * version 2.1 of the License, or (at your option) any later version. 163a977deeSAkihiko Odaki * 173a977deeSAkihiko Odaki * This library is distributed in the hope that it will be useful, 183a977deeSAkihiko Odaki * but WITHOUT ANY WARRANTY; without even the implied warranty of 193a977deeSAkihiko Odaki * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 203a977deeSAkihiko Odaki * Lesser General Public License for more details. 213a977deeSAkihiko Odaki * 223a977deeSAkihiko Odaki * You should have received a copy of the GNU Lesser General Public 233a977deeSAkihiko Odaki * License along with this library; if not, see <http://www.gnu.org/licenses/>. 243a977deeSAkihiko Odaki */ 253a977deeSAkihiko Odaki 263a977deeSAkihiko Odaki #ifndef HW_NET_IGB_COMMON_H 273a977deeSAkihiko Odaki #define HW_NET_IGB_COMMON_H 283a977deeSAkihiko Odaki 293a977deeSAkihiko Odaki #include "igb_regs.h" 303a977deeSAkihiko Odaki 31ff2b24c8SAkihiko Odaki #define TYPE_IGBVF "igbvf" 32ff2b24c8SAkihiko Odaki 33ff2b24c8SAkihiko Odaki #define IGBVF_MMIO_BAR_IDX (0) 34ff2b24c8SAkihiko Odaki #define IGBVF_MSIX_BAR_IDX (3) 35ff2b24c8SAkihiko Odaki 36ff2b24c8SAkihiko Odaki #define IGBVF_MMIO_SIZE (16 * 1024) 37ff2b24c8SAkihiko Odaki #define IGBVF_MSIX_SIZE (16 * 1024) 38ff2b24c8SAkihiko Odaki 393a977deeSAkihiko Odaki #define defreg(x) x = (E1000_##x >> 2) 403a977deeSAkihiko Odaki #define defreg_indexed(x, i) x##i = (E1000_##x(i) >> 2) 413a977deeSAkihiko Odaki #define defreg_indexeda(x, i) x##i##_A = (E1000_##x##_A(i) >> 2) 423a977deeSAkihiko Odaki 433a977deeSAkihiko Odaki #define defregd(x) defreg_indexed(x, 0), defreg_indexed(x, 1), \ 443a977deeSAkihiko Odaki defreg_indexed(x, 2), defreg_indexed(x, 3), \ 453a977deeSAkihiko Odaki defreg_indexed(x, 4), defreg_indexed(x, 5), \ 463a977deeSAkihiko Odaki defreg_indexed(x, 6), defreg_indexed(x, 7), \ 473a977deeSAkihiko Odaki defreg_indexed(x, 8), defreg_indexed(x, 9), \ 483a977deeSAkihiko Odaki defreg_indexed(x, 10), defreg_indexed(x, 11), \ 493a977deeSAkihiko Odaki defreg_indexed(x, 12), defreg_indexed(x, 13), \ 503a977deeSAkihiko Odaki defreg_indexed(x, 14), defreg_indexed(x, 15), \ 513a977deeSAkihiko Odaki defreg_indexeda(x, 0), defreg_indexeda(x, 1), \ 523a977deeSAkihiko Odaki defreg_indexeda(x, 2), defreg_indexeda(x, 3) 533a977deeSAkihiko Odaki 543a9926d9SAkihiko Odaki #define defreg8(x) defreg_indexed(x, 0), defreg_indexed(x, 1), \ 553a977deeSAkihiko Odaki defreg_indexed(x, 2), defreg_indexed(x, 3), \ 563a977deeSAkihiko Odaki defreg_indexed(x, 4), defreg_indexed(x, 5), \ 573a977deeSAkihiko Odaki defreg_indexed(x, 6), defreg_indexed(x, 7) 583a977deeSAkihiko Odaki 593a977deeSAkihiko Odaki enum { 603a977deeSAkihiko Odaki defreg(CTRL), defreg(EECD), defreg(EERD), defreg(GPRC), 613a977deeSAkihiko Odaki defreg(GPTC), defreg(ICR), defreg(ICS), defreg(IMC), 623a977deeSAkihiko Odaki defreg(IMS), defreg(LEDCTL), defreg(MANC), defreg(MDIC), 633a977deeSAkihiko Odaki defreg(MPC), defreg(RCTL), 643a977deeSAkihiko Odaki defreg(STATUS), defreg(SWSM), defreg(TCTL), 653a977deeSAkihiko Odaki defreg(TORH), defreg(TORL), defreg(TOTH), 663a977deeSAkihiko Odaki defreg(TOTL), defreg(TPR), defreg(TPT), 673a977deeSAkihiko Odaki defreg(WUFC), defreg(RA), defreg(MTA), defreg(CRCERRS), 683a977deeSAkihiko Odaki defreg(VFTA), defreg(VET), 693a977deeSAkihiko Odaki defreg(SCC), defreg(ECOL), 703a977deeSAkihiko Odaki defreg(MCC), defreg(LATECOL), defreg(COLC), defreg(DC), 713a977deeSAkihiko Odaki defreg(TNCRS), defreg(RLEC), 723a977deeSAkihiko Odaki defreg(XONRXC), defreg(XONTXC), defreg(XOFFRXC), defreg(XOFFTXC), 733a977deeSAkihiko Odaki defreg(FCRUC), defreg(TDFH), defreg(TDFT), 743a977deeSAkihiko Odaki defreg(TDFHS), defreg(TDFTS), defreg(TDFPC), defreg(WUC), 753a977deeSAkihiko Odaki defreg(WUS), defreg(RDFH), 763a977deeSAkihiko Odaki defreg(RDFT), defreg(RDFHS), defreg(RDFTS), defreg(RDFPC), 773a977deeSAkihiko Odaki defreg(IPAV), defreg(IP4AT), defreg(IP6AT), 783a977deeSAkihiko Odaki defreg(WUPM), defreg(FFMT), 793a977deeSAkihiko Odaki defreg(IAM), 803a977deeSAkihiko Odaki defreg(GCR), defreg(TIMINCA), defreg(EIAC), defreg(CTRL_EXT), 813a977deeSAkihiko Odaki defreg(IVAR0), defreg(MANC2H), 823a977deeSAkihiko Odaki defreg(MFVAL), defreg(MDEF), defreg(FACTPS), defreg(FTFT), 833a977deeSAkihiko Odaki defreg(RUC), defreg(ROC), defreg(RFC), defreg(RJC), 843a977deeSAkihiko Odaki defreg(PRC64), defreg(PRC127), defreg(PRC255), defreg(PRC511), 853a977deeSAkihiko Odaki defreg(PRC1023), defreg(PRC1522), defreg(PTC64), defreg(PTC127), 863a977deeSAkihiko Odaki defreg(PTC255), defreg(PTC511), defreg(PTC1023), defreg(PTC1522), 873a977deeSAkihiko Odaki defreg(GORCL), defreg(GORCH), defreg(GOTCL), defreg(GOTCH), 883a977deeSAkihiko Odaki defreg(RNBC), defreg(BPRC), defreg(MPRC), defreg(RFCTL), 893a977deeSAkihiko Odaki defreg(MPTC), defreg(BPTC), 903a977deeSAkihiko Odaki defreg(IAC), defreg(MGTPRC), defreg(MGTPDC), defreg(MGTPTC), 913a977deeSAkihiko Odaki defreg(TSCTC), defreg(RXCSUM), defreg(FUNCTAG), defreg(GSCL_1), 923a977deeSAkihiko Odaki defreg(GSCL_2), defreg(GSCL_3), defreg(GSCL_4), defreg(GSCN_0), 933a977deeSAkihiko Odaki defreg(GSCN_1), defreg(GSCN_2), defreg(GSCN_3), 943a977deeSAkihiko Odaki defreg_indexed(EITR, 0), 953a977deeSAkihiko Odaki defreg(MRQC), defreg(RETA), defreg(RSSRK), 963a977deeSAkihiko Odaki defreg(PBACLR), defreg(FCAL), defreg(FCAH), defreg(FCT), 973a977deeSAkihiko Odaki defreg(FCRTH), defreg(FCRTL), defreg(FCTTV), defreg(FCRTV), 983a977deeSAkihiko Odaki defreg(FLA), defreg(FLOP), 993a977deeSAkihiko Odaki defreg(MAVTV0), defreg(MAVTV1), defreg(MAVTV2), defreg(MAVTV3), 1003a977deeSAkihiko Odaki defreg(TXSTMPL), defreg(TXSTMPH), defreg(SYSTIML), defreg(SYSTIMH), 1013a977deeSAkihiko Odaki defreg(TIMADJL), defreg(TIMADJH), 1023a977deeSAkihiko Odaki defreg(RXSTMPH), defreg(RXSTMPL), defreg(RXSATRL), defreg(RXSATRH), 1033a977deeSAkihiko Odaki defreg(TIPG), 1043a977deeSAkihiko Odaki defreg(CTRL_DUP), 1053a977deeSAkihiko Odaki defreg(EEMNGCTL), 1063a977deeSAkihiko Odaki defreg(EEMNGDATA), 1073a977deeSAkihiko Odaki defreg(FLMNGCTL), 1083a977deeSAkihiko Odaki defreg(FLMNGDATA), 1093a977deeSAkihiko Odaki defreg(FLMNGCNT), 1103a977deeSAkihiko Odaki defreg(TSYNCRXCTL), 1113a977deeSAkihiko Odaki defreg(TSYNCTXCTL), 1123a977deeSAkihiko Odaki defreg(RLPML), 1133a977deeSAkihiko Odaki defreg(UTA), 1143a977deeSAkihiko Odaki 1153a977deeSAkihiko Odaki /* Aliases */ 1163a977deeSAkihiko Odaki defreg(RDFH_A), defreg(RDFT_A), defreg(TDFH_A), defreg(TDFT_A), 1173a977deeSAkihiko Odaki defreg(RA_A), defreg(VFTA_A), defreg(FCRTL_A), 1183a977deeSAkihiko Odaki 1193a977deeSAkihiko Odaki /* Additional regs used by IGB */ 1203a977deeSAkihiko Odaki defreg(FWSM), defreg(SW_FW_SYNC), 1213a977deeSAkihiko Odaki 1223a977deeSAkihiko Odaki defreg(EICS), defreg(EIMS), defreg(EIMC), defreg(EIAM), 1233a977deeSAkihiko Odaki defreg(EICR), defreg(IVAR_MISC), defreg(GPIE), 1243a977deeSAkihiko Odaki 1253a9926d9SAkihiko Odaki defreg(TSYNCRXCFG), defreg8(ETQF), 1263a9926d9SAkihiko Odaki 1273a977deeSAkihiko Odaki defreg(RXPBS), defregd(RDBAL), defregd(RDBAH), defregd(RDLEN), 1283a977deeSAkihiko Odaki defregd(SRRCTL), defregd(RDH), defregd(RDT), 1293a977deeSAkihiko Odaki defregd(RXDCTL), defregd(RXCTL), defregd(RQDPC), defreg(RA2), 1303a977deeSAkihiko Odaki 1313a977deeSAkihiko Odaki defreg(TXPBS), defreg(TCTL_EXT), defreg(DTXCTL), defreg(HTCBDPC), 1323a977deeSAkihiko Odaki defregd(TDBAL), defregd(TDBAH), defregd(TDLEN), defregd(TDH), 1333a977deeSAkihiko Odaki defregd(TDT), defregd(TXDCTL), defregd(TXCTL), 1343a977deeSAkihiko Odaki defregd(TDWBAL), defregd(TDWBAH), 1353a977deeSAkihiko Odaki 1363a977deeSAkihiko Odaki defreg(VT_CTL), 1373a977deeSAkihiko Odaki 1383a9926d9SAkihiko Odaki defreg8(P2VMAILBOX), defreg8(V2PMAILBOX), defreg(MBVFICR), defreg(MBVFIMR), 1393a977deeSAkihiko Odaki defreg(VFLRE), defreg(VFRE), defreg(VFTE), defreg(WVBR), 1403a977deeSAkihiko Odaki defreg(QDE), defreg(DTXSWC), defreg_indexed(VLVF, 0), 1413a9926d9SAkihiko Odaki defreg8(VMOLR), defreg(RPLOLR), defreg8(VMBMEM), defreg8(VMVIR), 1423a977deeSAkihiko Odaki 1433a9926d9SAkihiko Odaki defreg8(PVTCTRL), defreg8(PVTEICS), defreg8(PVTEIMS), defreg8(PVTEIMC), 1443a9926d9SAkihiko Odaki defreg8(PVTEIAC), defreg8(PVTEIAM), defreg8(PVTEICR), defreg8(PVFGPRC), 1453a9926d9SAkihiko Odaki defreg8(PVFGPTC), defreg8(PVFGORC), defreg8(PVFGOTC), defreg8(PVFMPRC), 1463a9926d9SAkihiko Odaki defreg8(PVFGPRLBC), defreg8(PVFGPTLBC), defreg8(PVFGORLBC), defreg8(PVFGOTLBC), 1473a977deeSAkihiko Odaki 1483a977deeSAkihiko Odaki defreg(MTA_A), 1493a977deeSAkihiko Odaki 1503a977deeSAkihiko Odaki defreg(VTIVAR), defreg(VTIVAR_MISC), 1513a977deeSAkihiko Odaki }; 1523a977deeSAkihiko Odaki 1533a977deeSAkihiko Odaki uint64_t igb_mmio_read(void *opaque, hwaddr addr, unsigned size); 1543a977deeSAkihiko Odaki void igb_mmio_write(void *opaque, hwaddr addr, uint64_t val, unsigned size); 155*fe73674aSCédric Le Goater void igb_vf_reset(void *opaque, uint16_t vfn); 1563a977deeSAkihiko Odaki 1573a977deeSAkihiko Odaki #endif 158