162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Copyright(c) 1999 - 2018 Intel Corporation. */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef _E1000_DEFINES_H_ 562306a36Sopenharmony_ci#define _E1000_DEFINES_H_ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci/* Number of Transmit and Receive Descriptors must be a multiple of 8 */ 862306a36Sopenharmony_ci#define REQ_TX_DESCRIPTOR_MULTIPLE 8 962306a36Sopenharmony_ci#define REQ_RX_DESCRIPTOR_MULTIPLE 8 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci/* IVAR valid bit */ 1262306a36Sopenharmony_ci#define E1000_IVAR_VALID 0x80 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci/* Receive Descriptor bit definitions */ 1562306a36Sopenharmony_ci#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ 1662306a36Sopenharmony_ci#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */ 1762306a36Sopenharmony_ci#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */ 1862306a36Sopenharmony_ci#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ 1962306a36Sopenharmony_ci#define E1000_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */ 2062306a36Sopenharmony_ci#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ 2162306a36Sopenharmony_ci#define E1000_RXD_STAT_IPCS 0x40 /* IP xsum calculated */ 2262306a36Sopenharmony_ci#define E1000_RXD_ERR_SE 0x02 /* Symbol Error */ 2362306a36Sopenharmony_ci#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define E1000_RXDEXT_STATERR_LB 0x00040000 2662306a36Sopenharmony_ci#define E1000_RXDEXT_STATERR_CE 0x01000000 2762306a36Sopenharmony_ci#define E1000_RXDEXT_STATERR_SE 0x02000000 2862306a36Sopenharmony_ci#define E1000_RXDEXT_STATERR_SEQ 0x04000000 2962306a36Sopenharmony_ci#define E1000_RXDEXT_STATERR_CXE 0x10000000 3062306a36Sopenharmony_ci#define E1000_RXDEXT_STATERR_TCPE 0x20000000 3162306a36Sopenharmony_ci#define E1000_RXDEXT_STATERR_IPE 0x40000000 3262306a36Sopenharmony_ci#define E1000_RXDEXT_STATERR_RXE 0x80000000 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci/* Same mask, but for extended and packet split descriptors */ 3562306a36Sopenharmony_ci#define E1000_RXDEXT_ERR_FRAME_ERR_MASK ( \ 3662306a36Sopenharmony_ci E1000_RXDEXT_STATERR_CE | \ 3762306a36Sopenharmony_ci E1000_RXDEXT_STATERR_SE | \ 3862306a36Sopenharmony_ci E1000_RXDEXT_STATERR_SEQ | \ 3962306a36Sopenharmony_ci E1000_RXDEXT_STATERR_CXE | \ 4062306a36Sopenharmony_ci E1000_RXDEXT_STATERR_RXE) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci/* Device Control */ 4362306a36Sopenharmony_ci#define E1000_CTRL_RST 0x04000000 /* Global reset */ 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci/* Device Status */ 4662306a36Sopenharmony_ci#define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */ 4762306a36Sopenharmony_ci#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */ 4862306a36Sopenharmony_ci#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */ 4962306a36Sopenharmony_ci#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ 5062306a36Sopenharmony_ci#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ 5162306a36Sopenharmony_ci#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#define SPEED_10 10 5462306a36Sopenharmony_ci#define SPEED_100 100 5562306a36Sopenharmony_ci#define SPEED_1000 1000 5662306a36Sopenharmony_ci#define HALF_DUPLEX 1 5762306a36Sopenharmony_ci#define FULL_DUPLEX 2 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/* Transmit Descriptor bit definitions */ 6062306a36Sopenharmony_ci#define E1000_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ 6162306a36Sopenharmony_ci#define E1000_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ 6262306a36Sopenharmony_ci#define E1000_TXD_CMD_DEXT 0x20000000 /* Desc extension (0 = legacy) */ 6362306a36Sopenharmony_ci#define E1000_TXD_STAT_DD 0x00000001 /* Desc Done */ 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#define MAX_JUMBO_FRAME_SIZE 0x3F00 6662306a36Sopenharmony_ci#define MAX_STD_JUMBO_FRAME_SIZE 9216 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci/* 802.1q VLAN Packet Size */ 6962306a36Sopenharmony_ci#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMA'd) */ 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci/* Error Codes */ 7262306a36Sopenharmony_ci#define E1000_SUCCESS 0 7362306a36Sopenharmony_ci#define E1000_ERR_CONFIG 3 7462306a36Sopenharmony_ci#define E1000_ERR_MAC_INIT 5 7562306a36Sopenharmony_ci#define E1000_ERR_MBX 15 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci/* SRRCTL bit definitions */ 7862306a36Sopenharmony_ci#define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ 7962306a36Sopenharmony_ci#define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00 8062306a36Sopenharmony_ci#define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */ 8162306a36Sopenharmony_ci#define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000 8262306a36Sopenharmony_ci#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000 8362306a36Sopenharmony_ci#define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000 8462306a36Sopenharmony_ci#define E1000_SRRCTL_DROP_EN 0x80000000 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F 8762306a36Sopenharmony_ci#define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci/* Additional Descriptor Control definitions */ 9062306a36Sopenharmony_ci#define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Que */ 9162306a36Sopenharmony_ci#define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Rx Que */ 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci/* Direct Cache Access (DCA) definitions */ 9462306a36Sopenharmony_ci#define E1000_DCA_TXCTRL_TX_WB_RO_EN BIT(11) /* Tx Desc writeback RO bit */ 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */ 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci#endif /* _E1000_DEFINES_H_ */ 99