i8254xGBe_defs.hh revision 10905
111731Sjason@lowepower.com/* 211731Sjason@lowepower.com * Copyright (c) 2006 The Regents of The University of Michigan 311731Sjason@lowepower.com * All rights reserved. 411731Sjason@lowepower.com * 511731Sjason@lowepower.com * Redistribution and use in source and binary forms, with or without 611731Sjason@lowepower.com * modification, are permitted provided that the following conditions are 711731Sjason@lowepower.com * met: redistributions of source code must retain the above copyright 811731Sjason@lowepower.com * notice, this list of conditions and the following disclaimer; 911731Sjason@lowepower.com * redistributions in binary form must reproduce the above copyright 1011731Sjason@lowepower.com * notice, this list of conditions and the following disclaimer in the 1111731Sjason@lowepower.com * documentation and/or other materials provided with the distribution; 1211731Sjason@lowepower.com * neither the name of the copyright holders nor the names of its 1311731Sjason@lowepower.com * contributors may be used to endorse or promote products derived from 1411731Sjason@lowepower.com * this software without specific prior written permission. 1511731Sjason@lowepower.com * 1611731Sjason@lowepower.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1711731Sjason@lowepower.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1811731Sjason@lowepower.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1911731Sjason@lowepower.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2011731Sjason@lowepower.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2111731Sjason@lowepower.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2211731Sjason@lowepower.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2311731Sjason@lowepower.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2411731Sjason@lowepower.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2511731Sjason@lowepower.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2611731Sjason@lowepower.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2711731Sjason@lowepower.com * 2811731Sjason@lowepower.com * Authors: Ali Saidi 2911731Sjason@lowepower.com */ 3011731Sjason@lowepower.com 3111731Sjason@lowepower.com/* @file 3211731Sjason@lowepower.com * Register and structure descriptions for Intel's 8254x line of gigabit ethernet controllers. 3311731Sjason@lowepower.com */ 3411731Sjason@lowepower.com#include "base/bitfield.hh" 3511731Sjason@lowepower.com 3611731Sjason@lowepower.comnamespace iGbReg { 3711731Sjason@lowepower.com 3811731Sjason@lowepower.com 3911731Sjason@lowepower.com// Registers used by the Intel GbE NIC 4011731Sjason@lowepower.comconst uint32_t REG_CTRL = 0x00000; 4111731Sjason@lowepower.comconst uint32_t REG_STATUS = 0x00008; 4211731Sjason@lowepower.comconst uint32_t REG_EECD = 0x00010; 4311731Sjason@lowepower.comconst uint32_t REG_EERD = 0x00014; 4411731Sjason@lowepower.comconst uint32_t REG_CTRL_EXT = 0x00018; 4511731Sjason@lowepower.comconst uint32_t REG_MDIC = 0x00020; 4611731Sjason@lowepower.comconst uint32_t REG_FCAL = 0x00028; 4711731Sjason@lowepower.comconst uint32_t REG_FCAH = 0x0002C; 4811731Sjason@lowepower.comconst uint32_t REG_FCT = 0x00030; 4911731Sjason@lowepower.comconst uint32_t REG_VET = 0x00038; 5011731Sjason@lowepower.comconst uint32_t REG_PBA = 0x01000; 5111731Sjason@lowepower.comconst uint32_t REG_ICR = 0x000C0; 5211731Sjason@lowepower.comconst uint32_t REG_ITR = 0x000C4; 5311731Sjason@lowepower.comconst uint32_t REG_ICS = 0x000C8; 5411731Sjason@lowepower.comconst uint32_t REG_IMS = 0x000D0; 5511731Sjason@lowepower.comconst uint32_t REG_IMC = 0x000D8; 5611731Sjason@lowepower.comconst uint32_t REG_IAM = 0x000E0; 5711731Sjason@lowepower.comconst uint32_t REG_RCTL = 0x00100; 5811731Sjason@lowepower.comconst uint32_t REG_FCTTV = 0x00170; 5911731Sjason@lowepower.comconst uint32_t REG_TIPG = 0x00410; 6011731Sjason@lowepower.comconst uint32_t REG_AIFS = 0x00458; 6111731Sjason@lowepower.comconst uint32_t REG_LEDCTL = 0x00e00; 6211731Sjason@lowepower.comconst uint32_t REG_EICR = 0x01580; 6311731Sjason@lowepower.comconst uint32_t REG_IVAR0 = 0x01700; 6411731Sjason@lowepower.comconst uint32_t REG_FCRTL = 0x02160; 6511731Sjason@lowepower.comconst uint32_t REG_FCRTH = 0x02168; 6611731Sjason@lowepower.comconst uint32_t REG_RDBAL = 0x02800; 6711731Sjason@lowepower.comconst uint32_t REG_RDBAH = 0x02804; 6811731Sjason@lowepower.comconst uint32_t REG_RDLEN = 0x02808; 6911731Sjason@lowepower.comconst uint32_t REG_SRRCTL = 0x0280C; 7011731Sjason@lowepower.comconst uint32_t REG_RDH = 0x02810; 7111731Sjason@lowepower.comconst uint32_t REG_RDT = 0x02818; 7211731Sjason@lowepower.comconst uint32_t REG_RDTR = 0x02820; 7311731Sjason@lowepower.comconst uint32_t REG_RXDCTL = 0x02828; 7411731Sjason@lowepower.comconst uint32_t REG_RADV = 0x0282C; 7511731Sjason@lowepower.comconst uint32_t REG_TCTL = 0x00400; 7611731Sjason@lowepower.comconst uint32_t REG_TDBAL = 0x03800; 7711731Sjason@lowepower.comconst uint32_t REG_TDBAH = 0x03804; 7811731Sjason@lowepower.comconst uint32_t REG_TDLEN = 0x03808; 7911731Sjason@lowepower.comconst uint32_t REG_TDH = 0x03810; 8011731Sjason@lowepower.comconst uint32_t REG_TXDCA_CTL = 0x03814; 8111731Sjason@lowepower.comconst uint32_t REG_TDT = 0x03818; 8211731Sjason@lowepower.comconst uint32_t REG_TIDV = 0x03820; 8311731Sjason@lowepower.comconst uint32_t REG_TXDCTL = 0x03828; 8411731Sjason@lowepower.comconst uint32_t REG_TADV = 0x0382C; 8511731Sjason@lowepower.comconst uint32_t REG_TDWBAL = 0x03838; 8611731Sjason@lowepower.comconst uint32_t REG_TDWBAH = 0x0383C; 8711731Sjason@lowepower.comconst uint32_t REG_CRCERRS = 0x04000; 8812137Sar4jc@virginia.educonst uint32_t REG_RXCSUM = 0x05000; 8911731Sjason@lowepower.comconst uint32_t REG_RLPML = 0x05004; 9011731Sjason@lowepower.comconst uint32_t REG_RFCTL = 0x05008; 9112137Sar4jc@virginia.educonst uint32_t REG_MTA = 0x05200; 9211731Sjason@lowepower.comconst uint32_t REG_RAL = 0x05400; 9311731Sjason@lowepower.comconst uint32_t REG_RAH = 0x05404; 9411731Sjason@lowepower.comconst uint32_t REG_VFTA = 0x05600; 9511731Sjason@lowepower.com 9611731Sjason@lowepower.comconst uint32_t REG_WUC = 0x05800; 9711731Sjason@lowepower.comconst uint32_t REG_MANC = 0x05820; 9811731Sjason@lowepower.comconst uint32_t REG_SWSM = 0x05B50; 9911731Sjason@lowepower.comconst uint32_t REG_FWSM = 0x05B54; 10011731Sjason@lowepower.comconst uint32_t REG_SWFWSYNC = 0x05B5C; 10111731Sjason@lowepower.com 10211731Sjason@lowepower.comconst uint8_t EEPROM_READ_OPCODE_SPI = 0x03; 10311731Sjason@lowepower.comconst uint8_t EEPROM_RDSR_OPCODE_SPI = 0x05; 10411731Sjason@lowepower.comconst uint8_t EEPROM_SIZE = 64; 10511731Sjason@lowepower.comconst uint16_t EEPROM_CSUM = 0xBABA; 10611731Sjason@lowepower.com 10711731Sjason@lowepower.comconst uint8_t VLAN_FILTER_TABLE_SIZE = 128; 10811731Sjason@lowepower.comconst uint8_t RCV_ADDRESS_TABLE_SIZE = 24; 10911731Sjason@lowepower.comconst uint8_t MULTICAST_TABLE_SIZE = 128; 11011731Sjason@lowepower.comconst uint32_t STATS_REGS_SIZE = 0x228; 11111731Sjason@lowepower.com 11211731Sjason@lowepower.com 11311731Sjason@lowepower.com// Registers in that are accessed in the PHY 11411731Sjason@lowepower.comconst uint8_t PHY_PSTATUS = 0x1; 11511731Sjason@lowepower.comconst uint8_t PHY_PID = 0x2; 11611731Sjason@lowepower.comconst uint8_t PHY_EPID = 0x3; 11711731Sjason@lowepower.comconst uint8_t PHY_GSTATUS = 10; 11811731Sjason@lowepower.comconst uint8_t PHY_EPSTATUS = 15; 11911731Sjason@lowepower.comconst uint8_t PHY_AGC = 18; 12011731Sjason@lowepower.com 12111731Sjason@lowepower.com// Receive Descriptor Status Flags 12211731Sjason@lowepower.comconst uint16_t RXDS_DYNINT = 0x800; 12311731Sjason@lowepower.comconst uint16_t RXDS_UDPV = 0x400; 12411731Sjason@lowepower.comconst uint16_t RXDS_CRCV = 0x100; 12511731Sjason@lowepower.comconst uint16_t RXDS_PIF = 0x080; 12611731Sjason@lowepower.comconst uint16_t RXDS_IPCS = 0x040; 12711731Sjason@lowepower.comconst uint16_t RXDS_TCPCS = 0x020; 12811731Sjason@lowepower.comconst uint16_t RXDS_UDPCS = 0x010; 12911731Sjason@lowepower.comconst uint16_t RXDS_VP = 0x008; 13011731Sjason@lowepower.comconst uint16_t RXDS_IXSM = 0x004; 13111731Sjason@lowepower.comconst uint16_t RXDS_EOP = 0x002; 13211731Sjason@lowepower.comconst uint16_t RXDS_DD = 0x001; 13311731Sjason@lowepower.com 13411731Sjason@lowepower.com// Receive Descriptor Error Flags 13511731Sjason@lowepower.comconst uint8_t RXDE_RXE = 0x80; 13611731Sjason@lowepower.comconst uint8_t RXDE_IPE = 0x40; 13711731Sjason@lowepower.comconst uint8_t RXDE_TCPE = 0x20; 13811731Sjason@lowepower.comconst uint8_t RXDE_SEQ = 0x04; 13911731Sjason@lowepower.comconst uint8_t RXDE_SE = 0x02; 14011731Sjason@lowepower.comconst uint8_t RXDE_CE = 0x01; 14111731Sjason@lowepower.com 14211731Sjason@lowepower.com// Receive Descriptor Extended Error Flags 14311731Sjason@lowepower.comconst uint16_t RXDEE_HBO = 0x008; 14411731Sjason@lowepower.comconst uint16_t RXDEE_CE = 0x010; 14511731Sjason@lowepower.comconst uint16_t RXDEE_LE = 0x020; 14611731Sjason@lowepower.comconst uint16_t RXDEE_PE = 0x080; 14711731Sjason@lowepower.comconst uint16_t RXDEE_OSE = 0x100; 14811731Sjason@lowepower.comconst uint16_t RXDEE_USE = 0x200; 14911731Sjason@lowepower.comconst uint16_t RXDEE_TCPE = 0x400; 15011731Sjason@lowepower.comconst uint16_t RXDEE_IPE = 0x800; 15111731Sjason@lowepower.com 15211731Sjason@lowepower.com 15311731Sjason@lowepower.com// Receive Descriptor Types 15411731Sjason@lowepower.comconst uint8_t RXDT_LEGACY = 0x00; 15511731Sjason@lowepower.comconst uint8_t RXDT_ADV_ONEBUF = 0x01; 15611731Sjason@lowepower.comconst uint8_t RXDT_ADV_SPLIT_A = 0x05; 15711731Sjason@lowepower.com 15811731Sjason@lowepower.com// Receive Descriptor Packet Types 15911731Sjason@lowepower.comconst uint16_t RXDP_IPV4 = 0x001; 16011731Sjason@lowepower.comconst uint16_t RXDP_IPV4E = 0x002; 16111731Sjason@lowepower.comconst uint16_t RXDP_IPV6 = 0x004; 16211731Sjason@lowepower.comconst uint16_t RXDP_IPV6E = 0x008; 16311731Sjason@lowepower.comconst uint16_t RXDP_TCP = 0x010; 16411731Sjason@lowepower.comconst uint16_t RXDP_UDP = 0x020; 16511731Sjason@lowepower.comconst uint16_t RXDP_SCTP = 0x040; 16611731Sjason@lowepower.comconst uint16_t RXDP_NFS = 0x080; 16711731Sjason@lowepower.com 16811731Sjason@lowepower.com// Interrupt types 16911731Sjason@lowepower.comenum IntTypes 17011731Sjason@lowepower.com{ 17111731Sjason@lowepower.com IT_NONE = 0x00000, //dummy value 17211731Sjason@lowepower.com IT_TXDW = 0x00001, 17311731Sjason@lowepower.com IT_TXQE = 0x00002, 17411731Sjason@lowepower.com IT_LSC = 0x00004, 17511731Sjason@lowepower.com IT_RXSEQ = 0x00008, 17611731Sjason@lowepower.com IT_RXDMT = 0x00010, 17711731Sjason@lowepower.com IT_RXO = 0x00040, 17811731Sjason@lowepower.com IT_RXT = 0x00080, 17911731Sjason@lowepower.com IT_MADC = 0x00200, 18011731Sjason@lowepower.com IT_RXCFG = 0x00400, 18111731Sjason@lowepower.com IT_GPI0 = 0x02000, 18211731Sjason@lowepower.com IT_GPI1 = 0x04000, 18311731Sjason@lowepower.com IT_TXDLOW = 0x08000, 18411731Sjason@lowepower.com IT_SRPD = 0x10000, 18511731Sjason@lowepower.com IT_ACK = 0x20000 18611731Sjason@lowepower.com}; 18711731Sjason@lowepower.com 18811731Sjason@lowepower.com// Receive Descriptor struct 18911731Sjason@lowepower.comstruct RxDesc { 19011731Sjason@lowepower.com union { 19111731Sjason@lowepower.com struct { 19211731Sjason@lowepower.com Addr buf; 19311731Sjason@lowepower.com uint16_t len; 19411731Sjason@lowepower.com uint16_t csum; 19511731Sjason@lowepower.com uint8_t status; 19611731Sjason@lowepower.com uint8_t errors; 19711731Sjason@lowepower.com uint16_t vlan; 19811731Sjason@lowepower.com } legacy; 19911731Sjason@lowepower.com struct { 20011731Sjason@lowepower.com Addr pkt; 20111731Sjason@lowepower.com Addr hdr; 20211731Sjason@lowepower.com } adv_read; 20311731Sjason@lowepower.com struct { 20411731Sjason@lowepower.com uint16_t rss_type:4; 20511731Sjason@lowepower.com uint16_t pkt_type:12; 20611731Sjason@lowepower.com uint16_t __reserved1:5; 20711731Sjason@lowepower.com uint16_t header_len:10; 20811731Sjason@lowepower.com uint16_t sph:1; 20911731Sjason@lowepower.com union { 21011731Sjason@lowepower.com struct { 21111731Sjason@lowepower.com uint16_t id; 21211731Sjason@lowepower.com uint16_t csum; 21311731Sjason@lowepower.com }; 21411731Sjason@lowepower.com uint32_t rss_hash; 21511731Sjason@lowepower.com }; 21611731Sjason@lowepower.com uint32_t status:20; 21711731Sjason@lowepower.com uint32_t errors:12; 21811731Sjason@lowepower.com uint16_t pkt_len; 21911731Sjason@lowepower.com uint16_t vlan_tag; 22011731Sjason@lowepower.com } adv_wb ; 22111731Sjason@lowepower.com }; 22211731Sjason@lowepower.com}; 22311731Sjason@lowepower.com 22411731Sjason@lowepower.comstruct TxDesc { 22511731Sjason@lowepower.com uint64_t d1; 22611731Sjason@lowepower.com uint64_t d2; 22711731Sjason@lowepower.com}; 22811731Sjason@lowepower.com 22911731Sjason@lowepower.comnamespace TxdOp { 23011731Sjason@lowepower.comconst uint8_t TXD_CNXT = 0x0; 23111731Sjason@lowepower.comconst uint8_t TXD_DATA = 0x1; 23211731Sjason@lowepower.comconst uint8_t TXD_ADVCNXT = 0x2; 23311731Sjason@lowepower.comconst uint8_t TXD_ADVDATA = 0x3; 23411731Sjason@lowepower.com 23511731Sjason@lowepower.cominline bool isLegacy(TxDesc *d) { return !bits(d->d2,29,29); } 23611731Sjason@lowepower.cominline uint8_t getType(TxDesc *d) { return bits(d->d2, 23,20); } 23711731Sjason@lowepower.cominline bool isType(TxDesc *d, uint8_t type) { return getType(d) == type; } 23811731Sjason@lowepower.cominline bool isTypes(TxDesc *d, uint8_t t1, uint8_t t2) { return isType(d, t1) || isType(d, t2); } 23911731Sjason@lowepower.cominline bool isAdvDesc(TxDesc *d) { return !isLegacy(d) && isTypes(d, TXD_ADVDATA,TXD_ADVCNXT); } 24011731Sjason@lowepower.cominline bool isContext(TxDesc *d) { return !isLegacy(d) && isTypes(d,TXD_CNXT, TXD_ADVCNXT); } 24111731Sjason@lowepower.cominline bool isData(TxDesc *d) { return !isLegacy(d) && isTypes(d, TXD_DATA, TXD_ADVDATA); } 24211731Sjason@lowepower.com 24311731Sjason@lowepower.cominline Addr getBuf(TxDesc *d) { assert(isLegacy(d) || isData(d)); return d->d1; } 24411731Sjason@lowepower.cominline Addr getLen(TxDesc *d) { if (isLegacy(d)) return bits(d->d2,15,0); else return bits(d->d2, 19,0); } 24511731Sjason@lowepower.cominline void setDd(TxDesc *d) { replaceBits(d->d2, 35, 32, ULL(1)); } 24611731Sjason@lowepower.com 24711731Sjason@lowepower.cominline bool ide(TxDesc *d) { return bits(d->d2, 31,31) && (getType(d) == TXD_DATA || isLegacy(d)); } 24811731Sjason@lowepower.cominline bool vle(TxDesc *d) { assert(isLegacy(d) || isData(d)); return bits(d->d2, 30,30); } 24911731Sjason@lowepower.cominline bool rs(TxDesc *d) { return bits(d->d2, 27,27); } 25011731Sjason@lowepower.cominline bool ic(TxDesc *d) { assert(isLegacy(d) || isData(d)); return isLegacy(d) && bits(d->d2, 26,26); } 25111731Sjason@lowepower.cominline bool tse(TxDesc *d) { 25211731Sjason@lowepower.com if (isTypes(d, TXD_CNXT, TXD_DATA)) 25311731Sjason@lowepower.com return bits(d->d2, 26,26); 25411731Sjason@lowepower.com if (isType(d, TXD_ADVDATA)) 25511731Sjason@lowepower.com return bits(d->d2, 31, 31); 25611731Sjason@lowepower.com return false; 25711731Sjason@lowepower.com} 25811731Sjason@lowepower.com 25911731Sjason@lowepower.cominline bool ifcs(TxDesc *d) { assert(isLegacy(d) || isData(d)); return bits(d->d2, 25,25); } 26011731Sjason@lowepower.cominline bool eop(TxDesc *d) { assert(isLegacy(d) || isData(d)); return bits(d->d2, 24,24); } 26111731Sjason@lowepower.cominline bool ip(TxDesc *d) { assert(isContext(d)); return bits(d->d2, 25,25); } 26211731Sjason@lowepower.cominline bool tcp(TxDesc *d) { assert(isContext(d)); return bits(d->d2, 24,24); } 26311731Sjason@lowepower.com 26411731Sjason@lowepower.cominline uint8_t getCso(TxDesc *d) { assert(isLegacy(d)); return bits(d->d2, 23,16); } 26511731Sjason@lowepower.cominline uint8_t getCss(TxDesc *d) { assert(isLegacy(d)); return bits(d->d2, 47,40); } 26611731Sjason@lowepower.com 26711731Sjason@lowepower.cominline bool ixsm(TxDesc *d) { return isData(d) && bits(d->d2, 40,40); } 26811731Sjason@lowepower.cominline bool txsm(TxDesc *d) { return isData(d) && bits(d->d2, 41,41); } 26911731Sjason@lowepower.com 27011731Sjason@lowepower.cominline int tucse(TxDesc *d) { assert(isContext(d)); return bits(d->d1,63,48); } 27111731Sjason@lowepower.cominline int tucso(TxDesc *d) { assert(isContext(d)); return bits(d->d1,47,40); } 27211731Sjason@lowepower.cominline int tucss(TxDesc *d) { assert(isContext(d)); return bits(d->d1,39,32); } 27311731Sjason@lowepower.cominline int ipcse(TxDesc *d) { assert(isContext(d)); return bits(d->d1,31,16); } 27411731Sjason@lowepower.cominline int ipcso(TxDesc *d) { assert(isContext(d)); return bits(d->d1,15,8); } 27511731Sjason@lowepower.cominline int ipcss(TxDesc *d) { assert(isContext(d)); return bits(d->d1,7,0); } 27611731Sjason@lowepower.cominline int mss(TxDesc *d) { assert(isContext(d)); return bits(d->d2,63,48); } 27711731Sjason@lowepower.cominline int hdrlen(TxDesc *d) { 27811731Sjason@lowepower.com assert(isContext(d)); 27911731Sjason@lowepower.com if (!isAdvDesc(d)) 28011731Sjason@lowepower.com return bits(d->d2,47,40); 28111731Sjason@lowepower.com return bits(d->d2, 47,40) + bits(d->d1, 8,0) + bits(d->d1, 15, 9); 28211731Sjason@lowepower.com} 28311731Sjason@lowepower.com 28411731Sjason@lowepower.cominline int getTsoLen(TxDesc *d) { assert(isType(d, TXD_ADVDATA)); return bits(d->d2, 63,46); } 28511731Sjason@lowepower.cominline int utcmd(TxDesc *d) { assert(isContext(d)); return bits(d->d2,24,31); } 28611731Sjason@lowepower.com} // namespace TxdOp 28711731Sjason@lowepower.com 28811731Sjason@lowepower.com 28911731Sjason@lowepower.com#define ADD_FIELD32(NAME, OFFSET, BITS) \ 29011731Sjason@lowepower.com inline uint32_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \ 29111731Sjason@lowepower.com inline void NAME(uint32_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); } 29212137Sar4jc@virginia.edu 29311731Sjason@lowepower.com#define ADD_FIELD64(NAME, OFFSET, BITS) \ 29411731Sjason@lowepower.com inline uint64_t NAME() { return bits(_data, OFFSET+BITS-1, OFFSET); } \ 29511731Sjason@lowepower.com inline void NAME(uint64_t d) { replaceBits(_data, OFFSET+BITS-1, OFFSET,d); } 29611731Sjason@lowepower.com 29711731Sjason@lowepower.comstruct Regs : public Serializable { 29811731Sjason@lowepower.com template<class T> 29911731Sjason@lowepower.com struct Reg { 30011731Sjason@lowepower.com T _data; 30112137Sar4jc@virginia.edu T operator()() { return _data; } 30211731Sjason@lowepower.com const Reg<T> &operator=(T d) { _data = d; return *this;} 30311731Sjason@lowepower.com bool operator==(T d) { return d == _data; } 30411731Sjason@lowepower.com void operator()(T d) { _data = d; } 30512137Sar4jc@virginia.edu Reg() { _data = 0; } 30611731Sjason@lowepower.com void serialize(CheckpointOut &cp) const 30712137Sar4jc@virginia.edu { 30811731Sjason@lowepower.com SERIALIZE_SCALAR(_data); 30912137Sar4jc@virginia.edu } 31011731Sjason@lowepower.com void unserialize(CheckpointIn &cp) 31111731Sjason@lowepower.com { 31211731Sjason@lowepower.com UNSERIALIZE_SCALAR(_data); 31311731Sjason@lowepower.com } 31411731Sjason@lowepower.com }; 31511731Sjason@lowepower.com 31611731Sjason@lowepower.com struct CTRL : public Reg<uint32_t> { // 0x0000 CTRL Register 31711731Sjason@lowepower.com using Reg<uint32_t>::operator=; 31811731Sjason@lowepower.com ADD_FIELD32(fd,0,1); // full duplex 31911731Sjason@lowepower.com ADD_FIELD32(bem,1,1); // big endian mode 32011731Sjason@lowepower.com ADD_FIELD32(pcipr,2,1); // PCI priority 32111731Sjason@lowepower.com ADD_FIELD32(lrst,3,1); // link reset 32211731Sjason@lowepower.com ADD_FIELD32(tme,4,1); // test mode enable 32311731Sjason@lowepower.com ADD_FIELD32(asde,5,1); // Auto-speed detection 32411731Sjason@lowepower.com ADD_FIELD32(slu,6,1); // Set link up 32511731Sjason@lowepower.com ADD_FIELD32(ilos,7,1); // invert los-of-signal 32611731Sjason@lowepower.com ADD_FIELD32(speed,8,2); // speed selection bits 32711731Sjason@lowepower.com ADD_FIELD32(be32,10,1); // big endian mode 32 32811731Sjason@lowepower.com ADD_FIELD32(frcspd,11,1); // force speed 32911731Sjason@lowepower.com ADD_FIELD32(frcdpx,12,1); // force duplex 33011731Sjason@lowepower.com ADD_FIELD32(duden,13,1); // dock/undock enable 33111731Sjason@lowepower.com ADD_FIELD32(dudpol,14,1); // dock/undock polarity 33211731Sjason@lowepower.com ADD_FIELD32(fphyrst,15,1); // force phy reset 33311731Sjason@lowepower.com ADD_FIELD32(extlen,16,1); // external link status enable 33411731Sjason@lowepower.com ADD_FIELD32(rsvd,17,1); // reserved 33511731Sjason@lowepower.com ADD_FIELD32(sdp0d,18,1); // software controlled pin data 33611731Sjason@lowepower.com ADD_FIELD32(sdp1d,19,1); // software controlled pin data 33711731Sjason@lowepower.com ADD_FIELD32(sdp2d,20,1); // software controlled pin data 33811731Sjason@lowepower.com ADD_FIELD32(sdp3d,21,1); // software controlled pin data 33911731Sjason@lowepower.com ADD_FIELD32(sdp0i,22,1); // software controlled pin dir 34011731Sjason@lowepower.com ADD_FIELD32(sdp1i,23,1); // software controlled pin dir 34111731Sjason@lowepower.com ADD_FIELD32(sdp2i,24,1); // software controlled pin dir 34211731Sjason@lowepower.com ADD_FIELD32(sdp3i,25,1); // software controlled pin dir 34311731Sjason@lowepower.com ADD_FIELD32(rst,26,1); // reset 34411731Sjason@lowepower.com ADD_FIELD32(rfce,27,1); // receive flow control enable 34511731Sjason@lowepower.com ADD_FIELD32(tfce,28,1); // transmit flow control enable 34611731Sjason@lowepower.com ADD_FIELD32(rte,29,1); // routing tag enable 34711731Sjason@lowepower.com ADD_FIELD32(vme,30,1); // vlan enable 34811731Sjason@lowepower.com ADD_FIELD32(phyrst,31,1); // phy reset 34911731Sjason@lowepower.com }; 35011731Sjason@lowepower.com CTRL ctrl; 35111731Sjason@lowepower.com 35211731Sjason@lowepower.com struct STATUS : public Reg<uint32_t> { // 0x0008 STATUS Register 35311731Sjason@lowepower.com using Reg<uint32_t>::operator=; 35411731Sjason@lowepower.com ADD_FIELD32(fd,0,1); // full duplex 35511731Sjason@lowepower.com ADD_FIELD32(lu,1,1); // link up 35611731Sjason@lowepower.com ADD_FIELD32(func,2,2); // function id 35711731Sjason@lowepower.com ADD_FIELD32(txoff,4,1); // transmission paused 35811731Sjason@lowepower.com ADD_FIELD32(tbimode,5,1); // tbi mode 35911731Sjason@lowepower.com ADD_FIELD32(speed,6,2); // link speed 36011731Sjason@lowepower.com ADD_FIELD32(asdv,8,2); // auto speed detection value 36111731Sjason@lowepower.com ADD_FIELD32(mtxckok,10,1); // mtx clock running ok 36211731Sjason@lowepower.com ADD_FIELD32(pci66,11,1); // In 66Mhz pci slot 36311731Sjason@lowepower.com ADD_FIELD32(bus64,12,1); // in 64 bit slot 36411731Sjason@lowepower.com ADD_FIELD32(pcix,13,1); // Pci mode 36511731Sjason@lowepower.com ADD_FIELD32(pcixspd,14,2); // pci x speed 36611731Sjason@lowepower.com }; 36711731Sjason@lowepower.com STATUS sts; 36811731Sjason@lowepower.com 36911731Sjason@lowepower.com struct EECD : public Reg<uint32_t> { // 0x0010 EECD Register 37011731Sjason@lowepower.com using Reg<uint32_t>::operator=; 37111731Sjason@lowepower.com ADD_FIELD32(sk,0,1); // clack input to the eeprom 37211731Sjason@lowepower.com ADD_FIELD32(cs,1,1); // chip select to eeprom 37311731Sjason@lowepower.com ADD_FIELD32(din,2,1); // data input to eeprom 37411731Sjason@lowepower.com ADD_FIELD32(dout,3,1); // data output bit 37511731Sjason@lowepower.com ADD_FIELD32(fwe,4,2); // flash write enable 37611731Sjason@lowepower.com ADD_FIELD32(ee_req,6,1); // request eeprom access 37711731Sjason@lowepower.com ADD_FIELD32(ee_gnt,7,1); // grant eeprom access 37811731Sjason@lowepower.com ADD_FIELD32(ee_pres,8,1); // eeprom present 37911731Sjason@lowepower.com ADD_FIELD32(ee_size,9,1); // eeprom size 38011731Sjason@lowepower.com ADD_FIELD32(ee_sz1,10,1); // eeprom size 38111731Sjason@lowepower.com ADD_FIELD32(rsvd,11,2); // reserved 38211731Sjason@lowepower.com ADD_FIELD32(ee_type,13,1); // type of eeprom 38311731Sjason@lowepower.com } ; 384 EECD eecd; 385 386 struct EERD : public Reg<uint32_t> { // 0x0014 EERD Register 387 using Reg<uint32_t>::operator=; 388 ADD_FIELD32(start,0,1); // start read 389 ADD_FIELD32(done,1,1); // done read 390 ADD_FIELD32(addr,2,14); // address 391 ADD_FIELD32(data,16,16); // data 392 }; 393 EERD eerd; 394 395 struct CTRL_EXT : public Reg<uint32_t> { // 0x0018 CTRL_EXT Register 396 using Reg<uint32_t>::operator=; 397 ADD_FIELD32(gpi_en,0,4); // enable interrupts from gpio 398 ADD_FIELD32(phyint,5,1); // reads the phy internal int status 399 ADD_FIELD32(sdp2_data,6,1); // data from gpio sdp 400 ADD_FIELD32(spd3_data,7,1); // data frmo gpio sdp 401 ADD_FIELD32(spd2_iodir,10,1); // direction of sdp2 402 ADD_FIELD32(spd3_iodir,11,1); // direction of sdp2 403 ADD_FIELD32(asdchk,12,1); // initiate auto-speed-detection 404 ADD_FIELD32(eerst,13,1); // reset the eeprom 405 ADD_FIELD32(spd_byps,15,1); // bypass speed select 406 ADD_FIELD32(ro_dis,17,1); // disable relaxed memory ordering 407 ADD_FIELD32(vreg,21,1); // power down the voltage regulator 408 ADD_FIELD32(link_mode,22,2); // interface to talk to the link 409 ADD_FIELD32(iame, 27,1); // interrupt acknowledge auto-mask ?? 410 ADD_FIELD32(drv_loaded, 28,1);// driver is loaded and incharge of device 411 ADD_FIELD32(timer_clr, 29,1); // clear interrupt timers after IMS clear ?? 412 }; 413 CTRL_EXT ctrl_ext; 414 415 struct MDIC : public Reg<uint32_t> { // 0x0020 MDIC Register 416 using Reg<uint32_t>::operator=; 417 ADD_FIELD32(data,0,16); // data 418 ADD_FIELD32(regadd,16,5); // register address 419 ADD_FIELD32(phyadd,21,5); // phy addresses 420 ADD_FIELD32(op,26,2); // opcode 421 ADD_FIELD32(r,28,1); // ready 422 ADD_FIELD32(i,29,1); // interrupt 423 ADD_FIELD32(e,30,1); // error 424 }; 425 MDIC mdic; 426 427 struct ICR : public Reg<uint32_t> { // 0x00C0 ICR Register 428 using Reg<uint32_t>::operator=; 429 ADD_FIELD32(txdw,0,1) // tx descr witten back 430 ADD_FIELD32(txqe,1,1) // tx queue empty 431 ADD_FIELD32(lsc,2,1) // link status change 432 ADD_FIELD32(rxseq,3,1) // rcv sequence error 433 ADD_FIELD32(rxdmt0,4,1) // rcv descriptor min thresh 434 ADD_FIELD32(rsvd1,5,1) // reserved 435 ADD_FIELD32(rxo,6,1) // receive overrunn 436 ADD_FIELD32(rxt0,7,1) // receiver timer interrupt 437 ADD_FIELD32(mdac,9,1) // mdi/o access complete 438 ADD_FIELD32(rxcfg,10,1) // recv /c/ ordered sets 439 ADD_FIELD32(phyint,12,1) // phy interrupt 440 ADD_FIELD32(gpi1,13,1) // gpi int 1 441 ADD_FIELD32(gpi2,14,1) // gpi int 2 442 ADD_FIELD32(txdlow,15,1) // transmit desc low thresh 443 ADD_FIELD32(srpd,16,1) // small receive packet detected 444 ADD_FIELD32(ack,17,1); // receive ack frame 445 ADD_FIELD32(int_assert, 31,1); // interrupt caused a system interrupt 446 }; 447 ICR icr; 448 449 uint32_t imr; // register that contains the current interrupt mask 450 451 struct ITR : public Reg<uint32_t> { // 0x00C4 ITR Register 452 using Reg<uint32_t>::operator=; 453 ADD_FIELD32(interval, 0,16); // minimum inter-interrutp inteval 454 // specified in 256ns interrupts 455 }; 456 ITR itr; 457 458 // When CTRL_EXT.IAME and the ICR.INT_ASSERT is 1 an ICR read or write 459 // causes the IAM register contents to be written into the IMC 460 // automatically clearing all interrupts that have a bit in the IAM set 461 uint32_t iam; 462 463 struct RCTL : public Reg<uint32_t> { // 0x0100 RCTL Register 464 using Reg<uint32_t>::operator=; 465 ADD_FIELD32(rst,0,1); // Reset 466 ADD_FIELD32(en,1,1); // Enable 467 ADD_FIELD32(sbp,2,1); // Store bad packets 468 ADD_FIELD32(upe,3,1); // Unicast Promiscuous enabled 469 ADD_FIELD32(mpe,4,1); // Multicast promiscuous enabled 470 ADD_FIELD32(lpe,5,1); // long packet reception enabled 471 ADD_FIELD32(lbm,6,2); // 472 ADD_FIELD32(rdmts,8,2); // 473 ADD_FIELD32(mo,12,2); // 474 ADD_FIELD32(mdr,14,1); // 475 ADD_FIELD32(bam,15,1); // 476 ADD_FIELD32(bsize,16,2); // 477 ADD_FIELD32(vfe,18,1); // 478 ADD_FIELD32(cfien,19,1); // 479 ADD_FIELD32(cfi,20,1); // 480 ADD_FIELD32(dpf,22,1); // discard pause frames 481 ADD_FIELD32(pmcf,23,1); // pass mac control frames 482 ADD_FIELD32(bsex,25,1); // buffer size extension 483 ADD_FIELD32(secrc,26,1); // strip ethernet crc from incoming packet 484 unsigned descSize() 485 { 486 switch(bsize()) { 487 case 0: return bsex() == 0 ? 2048 : 0; 488 case 1: return bsex() == 0 ? 1024 : 16384; 489 case 2: return bsex() == 0 ? 512 : 8192; 490 case 3: return bsex() == 0 ? 256 : 4096; 491 default: 492 return 0; 493 } 494 } 495 }; 496 RCTL rctl; 497 498 struct FCTTV : public Reg<uint32_t> { // 0x0170 FCTTV 499 using Reg<uint32_t>::operator=; 500 ADD_FIELD32(ttv,0,16); // Transmit Timer Value 501 }; 502 FCTTV fcttv; 503 504 struct TCTL : public Reg<uint32_t> { // 0x0400 TCTL Register 505 using Reg<uint32_t>::operator=; 506 ADD_FIELD32(rst,0,1); // Reset 507 ADD_FIELD32(en,1,1); // Enable 508 ADD_FIELD32(bce,2,1); // busy check enable 509 ADD_FIELD32(psp,3,1); // pad short packets 510 ADD_FIELD32(ct,4,8); // collision threshold 511 ADD_FIELD32(cold,12,10); // collision distance 512 ADD_FIELD32(swxoff,22,1); // software xoff transmission 513 ADD_FIELD32(pbe,23,1); // packet burst enable 514 ADD_FIELD32(rtlc,24,1); // retransmit late collisions 515 ADD_FIELD32(nrtu,25,1); // on underrun no TX 516 ADD_FIELD32(mulr,26,1); // multiple request 517 }; 518 TCTL tctl; 519 520 struct PBA : public Reg<uint32_t> { // 0x1000 PBA Register 521 using Reg<uint32_t>::operator=; 522 ADD_FIELD32(rxa,0,16); 523 ADD_FIELD32(txa,16,16); 524 }; 525 PBA pba; 526 527 struct FCRTL : public Reg<uint32_t> { // 0x2160 FCRTL Register 528 using Reg<uint32_t>::operator=; 529 ADD_FIELD32(rtl,3,28); // make this bigger than the spec so we can have 530 // a larger buffer 531 ADD_FIELD32(xone, 31,1); 532 }; 533 FCRTL fcrtl; 534 535 struct FCRTH : public Reg<uint32_t> { // 0x2168 FCRTL Register 536 using Reg<uint32_t>::operator=; 537 ADD_FIELD32(rth,3,13); // make this bigger than the spec so we can have 538 //a larger buffer 539 ADD_FIELD32(xfce, 31,1); 540 }; 541 FCRTH fcrth; 542 543 struct RDBA : public Reg<uint64_t> { // 0x2800 RDBA Register 544 using Reg<uint64_t>::operator=; 545 ADD_FIELD64(rdbal,0,32); // base address of rx descriptor ring 546 ADD_FIELD64(rdbah,32,32); // base address of rx descriptor ring 547 }; 548 RDBA rdba; 549 550 struct RDLEN : public Reg<uint32_t> { // 0x2808 RDLEN Register 551 using Reg<uint32_t>::operator=; 552 ADD_FIELD32(len,7,13); // number of bytes in the descriptor buffer 553 }; 554 RDLEN rdlen; 555 556 struct SRRCTL : public Reg<uint32_t> { // 0x280C SRRCTL Register 557 using Reg<uint32_t>::operator=; 558 ADD_FIELD32(pktlen, 0, 8); 559 ADD_FIELD32(hdrlen, 8, 8); // guess based on header, not documented 560 ADD_FIELD32(desctype, 25,3); // type of descriptor 000 legacy, 001 adv, 561 //101 hdr split 562 unsigned bufLen() { return pktlen() << 10; } 563 unsigned hdrLen() { return hdrlen() << 6; } 564 }; 565 SRRCTL srrctl; 566 567 struct RDH : public Reg<uint32_t> { // 0x2810 RDH Register 568 using Reg<uint32_t>::operator=; 569 ADD_FIELD32(rdh,0,16); // head of the descriptor ring 570 }; 571 RDH rdh; 572 573 struct RDT : public Reg<uint32_t> { // 0x2818 RDT Register 574 using Reg<uint32_t>::operator=; 575 ADD_FIELD32(rdt,0,16); // tail of the descriptor ring 576 }; 577 RDT rdt; 578 579 struct RDTR : public Reg<uint32_t> { // 0x2820 RDTR Register 580 using Reg<uint32_t>::operator=; 581 ADD_FIELD32(delay,0,16); // receive delay timer 582 ADD_FIELD32(fpd, 31,1); // flush partial descriptor block ?? 583 }; 584 RDTR rdtr; 585 586 struct RXDCTL : public Reg<uint32_t> { // 0x2828 RXDCTL Register 587 using Reg<uint32_t>::operator=; 588 ADD_FIELD32(pthresh,0,6); // prefetch threshold, less that this 589 // consider prefetch 590 ADD_FIELD32(hthresh,8,6); // number of descriptors in host mem to 591 // consider prefetch 592 ADD_FIELD32(wthresh,16,6); // writeback threshold 593 ADD_FIELD32(gran,24,1); // granularity 0 = desc, 1 = cacheline 594 }; 595 RXDCTL rxdctl; 596 597 struct RADV : public Reg<uint32_t> { // 0x282C RADV Register 598 using Reg<uint32_t>::operator=; 599 ADD_FIELD32(idv,0,16); // absolute interrupt delay 600 }; 601 RADV radv; 602 603 struct RSRPD : public Reg<uint32_t> { // 0x2C00 RSRPD Register 604 using Reg<uint32_t>::operator=; 605 ADD_FIELD32(idv,0,12); // size to interrutp on small packets 606 }; 607 RSRPD rsrpd; 608 609 struct TDBA : public Reg<uint64_t> { // 0x3800 TDBAL Register 610 using Reg<uint64_t>::operator=; 611 ADD_FIELD64(tdbal,0,32); // base address of transmit descriptor ring 612 ADD_FIELD64(tdbah,32,32); // base address of transmit descriptor ring 613 }; 614 TDBA tdba; 615 616 struct TDLEN : public Reg<uint32_t> { // 0x3808 TDLEN Register 617 using Reg<uint32_t>::operator=; 618 ADD_FIELD32(len,7,13); // number of bytes in the descriptor buffer 619 }; 620 TDLEN tdlen; 621 622 struct TDH : public Reg<uint32_t> { // 0x3810 TDH Register 623 using Reg<uint32_t>::operator=; 624 ADD_FIELD32(tdh,0,16); // head of the descriptor ring 625 }; 626 TDH tdh; 627 628 struct TXDCA_CTL : public Reg<uint32_t> { // 0x3814 TXDCA_CTL Register 629 using Reg<uint32_t>::operator=; 630 ADD_FIELD32(cpu_mask, 0, 5); 631 ADD_FIELD32(enabled, 5,1); 632 ADD_FIELD32(relax_ordering, 6, 1); 633 }; 634 TXDCA_CTL txdca_ctl; 635 636 struct TDT : public Reg<uint32_t> { // 0x3818 TDT Register 637 using Reg<uint32_t>::operator=; 638 ADD_FIELD32(tdt,0,16); // tail of the descriptor ring 639 }; 640 TDT tdt; 641 642 struct TIDV : public Reg<uint32_t> { // 0x3820 TIDV Register 643 using Reg<uint32_t>::operator=; 644 ADD_FIELD32(idv,0,16); // interrupt delay 645 }; 646 TIDV tidv; 647 648 struct TXDCTL : public Reg<uint32_t> { // 0x3828 TXDCTL Register 649 using Reg<uint32_t>::operator=; 650 ADD_FIELD32(pthresh, 0,6); // if number of descriptors control has is 651 // below this number, a prefetch is considered 652 ADD_FIELD32(hthresh,8,8); // number of valid descriptors is host memory 653 // before a prefetch is considered 654 ADD_FIELD32(wthresh,16,6); // number of descriptors to keep until 655 // writeback is considered 656 ADD_FIELD32(gran, 24,1); // granulatiry of above values (0 = cacheline, 657 // 1 == desscriptor) 658 ADD_FIELD32(lwthresh,25,7); // xmit descriptor low thresh, interrupt 659 // below this level 660 }; 661 TXDCTL txdctl; 662 663 struct TADV : public Reg<uint32_t> { // 0x382C TADV Register 664 using Reg<uint32_t>::operator=; 665 ADD_FIELD32(idv,0,16); // absolute interrupt delay 666 }; 667 TADV tadv; 668/* 669 struct TDWBA : public Reg<uint64_t> { // 0x3838 TDWBA Register 670 using Reg<uint64_t>::operator=; 671 ADD_FIELD64(en,0,1); // enable transmit description ring address writeback 672 ADD_FIELD64(tdwbal,2,32); // base address of transmit descriptor ring address writeback 673 ADD_FIELD64(tdwbah,32,32); // base address of transmit descriptor ring 674 }; 675 TDWBA tdwba;*/ 676 uint64_t tdwba; 677 678 struct RXCSUM : public Reg<uint32_t> { // 0x5000 RXCSUM Register 679 using Reg<uint32_t>::operator=; 680 ADD_FIELD32(pcss,0,8); 681 ADD_FIELD32(ipofld,8,1); 682 ADD_FIELD32(tuofld,9,1); 683 ADD_FIELD32(pcsd, 13,1); 684 }; 685 RXCSUM rxcsum; 686 687 uint32_t rlpml; // 0x5004 RLPML probably maximum accepted packet size 688 689 struct RFCTL : public Reg<uint32_t> { // 0x5008 RFCTL Register 690 using Reg<uint32_t>::operator=; 691 ADD_FIELD32(iscsi_dis,0,1); 692 ADD_FIELD32(iscsi_dwc,1,5); 693 ADD_FIELD32(nfsw_dis,6,1); 694 ADD_FIELD32(nfsr_dis,7,1); 695 ADD_FIELD32(nfs_ver,8,2); 696 ADD_FIELD32(ipv6_dis,10,1); 697 ADD_FIELD32(ipv6xsum_dis,11,1); 698 ADD_FIELD32(ackdis,13,1); 699 ADD_FIELD32(ipfrsp_dis,14,1); 700 ADD_FIELD32(exsten,15,1); 701 }; 702 RFCTL rfctl; 703 704 struct MANC : public Reg<uint32_t> { // 0x5820 MANC Register 705 using Reg<uint32_t>::operator=; 706 ADD_FIELD32(smbus,0,1); // SMBus enabled ##### 707 ADD_FIELD32(asf,1,1); // ASF enabled ##### 708 ADD_FIELD32(ronforce,2,1); // reset of force 709 ADD_FIELD32(rsvd,3,5); // reserved 710 ADD_FIELD32(rmcp1,8,1); // rcmp1 filtering 711 ADD_FIELD32(rmcp2,9,1); // rcmp2 filtering 712 ADD_FIELD32(ipv4,10,1); // enable ipv4 713 ADD_FIELD32(ipv6,11,1); // enable ipv6 714 ADD_FIELD32(snap,12,1); // accept snap 715 ADD_FIELD32(arp,13,1); // filter arp ##### 716 ADD_FIELD32(neighbor,14,1); // neighbor discovery 717 ADD_FIELD32(arp_resp,15,1); // arp response 718 ADD_FIELD32(tcorst,16,1); // tco reset happened 719 ADD_FIELD32(rcvtco,17,1); // receive tco enabled ###### 720 ADD_FIELD32(blkphyrst,18,1);// block phy resets ######## 721 ADD_FIELD32(rcvall,19,1); // receive all 722 ADD_FIELD32(macaddrfltr,20,1); // mac address filtering ###### 723 ADD_FIELD32(mng2host,21,1); // mng2 host packets ####### 724 ADD_FIELD32(ipaddrfltr,22,1); // ip address filtering 725 ADD_FIELD32(xsumfilter,23,1); // checksum filtering 726 ADD_FIELD32(brfilter,24,1); // broadcast filtering 727 ADD_FIELD32(smbreq,25,1); // smb request 728 ADD_FIELD32(smbgnt,26,1); // smb grant 729 ADD_FIELD32(smbclkin,27,1); // smbclkin 730 ADD_FIELD32(smbdatain,28,1); // smbdatain 731 ADD_FIELD32(smbdataout,29,1); // smb data out 732 ADD_FIELD32(smbclkout,30,1); // smb clock out 733 }; 734 MANC manc; 735 736 struct SWSM : public Reg<uint32_t> { // 0x5B50 SWSM register 737 using Reg<uint32_t>::operator=; 738 ADD_FIELD32(smbi,0,1); // Semaphone bit 739 ADD_FIELD32(swesmbi, 1,1); // Software eeporm semaphore 740 ADD_FIELD32(wmng, 2,1); // Wake MNG clock 741 ADD_FIELD32(reserved, 3, 29); 742 }; 743 SWSM swsm; 744 745 struct FWSM : public Reg<uint32_t> { // 0x5B54 FWSM register 746 using Reg<uint32_t>::operator=; 747 ADD_FIELD32(eep_fw_semaphore,0,1); 748 ADD_FIELD32(fw_mode, 1,3); 749 ADD_FIELD32(ide, 4,1); 750 ADD_FIELD32(sol, 5,1); 751 ADD_FIELD32(eep_roload, 6,1); 752 ADD_FIELD32(reserved, 7,8); 753 ADD_FIELD32(fw_val_bit, 15, 1); 754 ADD_FIELD32(reset_cnt, 16, 3); 755 ADD_FIELD32(ext_err_ind, 19, 6); 756 ADD_FIELD32(reserved2, 25, 7); 757 }; 758 FWSM fwsm; 759 760 uint32_t sw_fw_sync; 761 762 void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE 763 { 764 paramOut(cp, "ctrl", ctrl._data); 765 paramOut(cp, "sts", sts._data); 766 paramOut(cp, "eecd", eecd._data); 767 paramOut(cp, "eerd", eerd._data); 768 paramOut(cp, "ctrl_ext", ctrl_ext._data); 769 paramOut(cp, "mdic", mdic._data); 770 paramOut(cp, "icr", icr._data); 771 SERIALIZE_SCALAR(imr); 772 paramOut(cp, "itr", itr._data); 773 SERIALIZE_SCALAR(iam); 774 paramOut(cp, "rctl", rctl._data); 775 paramOut(cp, "fcttv", fcttv._data); 776 paramOut(cp, "tctl", tctl._data); 777 paramOut(cp, "pba", pba._data); 778 paramOut(cp, "fcrtl", fcrtl._data); 779 paramOut(cp, "fcrth", fcrth._data); 780 paramOut(cp, "rdba", rdba._data); 781 paramOut(cp, "rdlen", rdlen._data); 782 paramOut(cp, "srrctl", srrctl._data); 783 paramOut(cp, "rdh", rdh._data); 784 paramOut(cp, "rdt", rdt._data); 785 paramOut(cp, "rdtr", rdtr._data); 786 paramOut(cp, "rxdctl", rxdctl._data); 787 paramOut(cp, "radv", radv._data); 788 paramOut(cp, "rsrpd", rsrpd._data); 789 paramOut(cp, "tdba", tdba._data); 790 paramOut(cp, "tdlen", tdlen._data); 791 paramOut(cp, "tdh", tdh._data); 792 paramOut(cp, "txdca_ctl", txdca_ctl._data); 793 paramOut(cp, "tdt", tdt._data); 794 paramOut(cp, "tidv", tidv._data); 795 paramOut(cp, "txdctl", txdctl._data); 796 paramOut(cp, "tadv", tadv._data); 797 //paramOut(cp, "tdwba", tdwba._data); 798 SERIALIZE_SCALAR(tdwba); 799 paramOut(cp, "rxcsum", rxcsum._data); 800 SERIALIZE_SCALAR(rlpml); 801 paramOut(cp, "rfctl", rfctl._data); 802 paramOut(cp, "manc", manc._data); 803 paramOut(cp, "swsm", swsm._data); 804 paramOut(cp, "fwsm", fwsm._data); 805 SERIALIZE_SCALAR(sw_fw_sync); 806 } 807 808 void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE 809 { 810 paramIn(cp, "ctrl", ctrl._data); 811 paramIn(cp, "sts", sts._data); 812 paramIn(cp, "eecd", eecd._data); 813 paramIn(cp, "eerd", eerd._data); 814 paramIn(cp, "ctrl_ext", ctrl_ext._data); 815 paramIn(cp, "mdic", mdic._data); 816 paramIn(cp, "icr", icr._data); 817 UNSERIALIZE_SCALAR(imr); 818 paramIn(cp, "itr", itr._data); 819 UNSERIALIZE_SCALAR(iam); 820 paramIn(cp, "rctl", rctl._data); 821 paramIn(cp, "fcttv", fcttv._data); 822 paramIn(cp, "tctl", tctl._data); 823 paramIn(cp, "pba", pba._data); 824 paramIn(cp, "fcrtl", fcrtl._data); 825 paramIn(cp, "fcrth", fcrth._data); 826 paramIn(cp, "rdba", rdba._data); 827 paramIn(cp, "rdlen", rdlen._data); 828 paramIn(cp, "srrctl", srrctl._data); 829 paramIn(cp, "rdh", rdh._data); 830 paramIn(cp, "rdt", rdt._data); 831 paramIn(cp, "rdtr", rdtr._data); 832 paramIn(cp, "rxdctl", rxdctl._data); 833 paramIn(cp, "radv", radv._data); 834 paramIn(cp, "rsrpd", rsrpd._data); 835 paramIn(cp, "tdba", tdba._data); 836 paramIn(cp, "tdlen", tdlen._data); 837 paramIn(cp, "tdh", tdh._data); 838 paramIn(cp, "txdca_ctl", txdca_ctl._data); 839 paramIn(cp, "tdt", tdt._data); 840 paramIn(cp, "tidv", tidv._data); 841 paramIn(cp, "txdctl", txdctl._data); 842 paramIn(cp, "tadv", tadv._data); 843 UNSERIALIZE_SCALAR(tdwba); 844 //paramIn(cp, "tdwba", tdwba._data); 845 paramIn(cp, "rxcsum", rxcsum._data); 846 UNSERIALIZE_SCALAR(rlpml); 847 paramIn(cp, "rfctl", rfctl._data); 848 paramIn(cp, "manc", manc._data); 849 paramIn(cp, "swsm", swsm._data); 850 paramIn(cp, "fwsm", fwsm._data); 851 UNSERIALIZE_SCALAR(sw_fw_sync); 852 } 853}; 854} // namespace iGbReg 855