162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Copyright (c) 2018 Intel Corporation */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef _IGC_BASE_H_ 562306a36Sopenharmony_ci#define _IGC_BASE_H_ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci/* forward declaration */ 862306a36Sopenharmony_civoid igc_rx_fifo_flush_base(struct igc_hw *hw); 962306a36Sopenharmony_civoid igc_power_down_phy_copper_base(struct igc_hw *hw); 1062306a36Sopenharmony_cibool igc_is_device_id_i225(struct igc_hw *hw); 1162306a36Sopenharmony_cibool igc_is_device_id_i226(struct igc_hw *hw); 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci/* Transmit Descriptor - Advanced */ 1462306a36Sopenharmony_ciunion igc_adv_tx_desc { 1562306a36Sopenharmony_ci struct { 1662306a36Sopenharmony_ci __le64 buffer_addr; /* Address of descriptor's data buf */ 1762306a36Sopenharmony_ci __le32 cmd_type_len; 1862306a36Sopenharmony_ci __le32 olinfo_status; 1962306a36Sopenharmony_ci } read; 2062306a36Sopenharmony_ci struct { 2162306a36Sopenharmony_ci __le64 rsvd; /* Reserved */ 2262306a36Sopenharmony_ci __le32 nxtseq_seed; 2362306a36Sopenharmony_ci __le32 status; 2462306a36Sopenharmony_ci } wb; 2562306a36Sopenharmony_ci}; 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/* Context descriptors */ 2862306a36Sopenharmony_cistruct igc_adv_tx_context_desc { 2962306a36Sopenharmony_ci __le32 vlan_macip_lens; 3062306a36Sopenharmony_ci __le32 launch_time; 3162306a36Sopenharmony_ci __le32 type_tucmd_mlhl; 3262306a36Sopenharmony_ci __le32 mss_l4len_idx; 3362306a36Sopenharmony_ci}; 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci/* Adv Transmit Descriptor Config Masks */ 3662306a36Sopenharmony_ci#define IGC_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp packet */ 3762306a36Sopenharmony_ci#define IGC_ADVTXD_TSTAMP_REG_1 0x00010000 /* Select register 1 for timestamp */ 3862306a36Sopenharmony_ci#define IGC_ADVTXD_TSTAMP_REG_2 0x00020000 /* Select register 2 for timestamp */ 3962306a36Sopenharmony_ci#define IGC_ADVTXD_TSTAMP_REG_3 0x00030000 /* Select register 3 for timestamp */ 4062306a36Sopenharmony_ci#define IGC_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ 4162306a36Sopenharmony_ci#define IGC_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ 4262306a36Sopenharmony_ci#define IGC_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */ 4362306a36Sopenharmony_ci#define IGC_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ 4462306a36Sopenharmony_ci#define IGC_ADVTXD_DCMD_RS 0x08000000 /* Report Status */ 4562306a36Sopenharmony_ci#define IGC_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */ 4662306a36Sopenharmony_ci#define IGC_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */ 4762306a36Sopenharmony_ci#define IGC_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */ 4862306a36Sopenharmony_ci#define IGC_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define IGC_RAR_ENTRIES 16 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* Receive Descriptor - Advanced */ 5362306a36Sopenharmony_ciunion igc_adv_rx_desc { 5462306a36Sopenharmony_ci struct { 5562306a36Sopenharmony_ci __le64 pkt_addr; /* Packet buffer address */ 5662306a36Sopenharmony_ci __le64 hdr_addr; /* Header buffer address */ 5762306a36Sopenharmony_ci } read; 5862306a36Sopenharmony_ci struct { 5962306a36Sopenharmony_ci struct { 6062306a36Sopenharmony_ci union { 6162306a36Sopenharmony_ci __le32 data; 6262306a36Sopenharmony_ci struct { 6362306a36Sopenharmony_ci __le16 pkt_info; /*RSS type, Pkt type*/ 6462306a36Sopenharmony_ci /* Split Header, header buffer len */ 6562306a36Sopenharmony_ci __le16 hdr_info; 6662306a36Sopenharmony_ci } hs_rss; 6762306a36Sopenharmony_ci } lo_dword; 6862306a36Sopenharmony_ci union { 6962306a36Sopenharmony_ci __le32 rss; /* RSS Hash */ 7062306a36Sopenharmony_ci struct { 7162306a36Sopenharmony_ci __le16 ip_id; /* IP id */ 7262306a36Sopenharmony_ci __le16 csum; /* Packet Checksum */ 7362306a36Sopenharmony_ci } csum_ip; 7462306a36Sopenharmony_ci } hi_dword; 7562306a36Sopenharmony_ci } lower; 7662306a36Sopenharmony_ci struct { 7762306a36Sopenharmony_ci __le32 status_error; /* ext status/error */ 7862306a36Sopenharmony_ci __le16 length; /* Packet length */ 7962306a36Sopenharmony_ci __le16 vlan; /* VLAN tag */ 8062306a36Sopenharmony_ci } upper; 8162306a36Sopenharmony_ci } wb; /* writeback */ 8262306a36Sopenharmony_ci}; 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci/* Additional Transmit Descriptor Control definitions */ 8562306a36Sopenharmony_ci#define IGC_TXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Tx Queue */ 8662306a36Sopenharmony_ci#define IGC_TXDCTL_SWFLUSH 0x04000000 /* Transmit Software Flush */ 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci/* Additional Receive Descriptor Control definitions */ 8962306a36Sopenharmony_ci#define IGC_RXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Rx Queue */ 9062306a36Sopenharmony_ci#define IGC_RXDCTL_SWFLUSH 0x04000000 /* Receive Software Flush */ 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci/* SRRCTL bit definitions */ 9362306a36Sopenharmony_ci#define IGC_SRRCTL_BSIZEPKT_MASK GENMASK(6, 0) 9462306a36Sopenharmony_ci#define IGC_SRRCTL_BSIZEPKT(x) FIELD_PREP(IGC_SRRCTL_BSIZEPKT_MASK, \ 9562306a36Sopenharmony_ci (x) / 1024) /* in 1 KB resolution */ 9662306a36Sopenharmony_ci#define IGC_SRRCTL_BSIZEHDR_MASK GENMASK(13, 8) 9762306a36Sopenharmony_ci#define IGC_SRRCTL_BSIZEHDR(x) FIELD_PREP(IGC_SRRCTL_BSIZEHDR_MASK, \ 9862306a36Sopenharmony_ci (x) / 64) /* in 64 bytes resolution */ 9962306a36Sopenharmony_ci#define IGC_SRRCTL_DESCTYPE_MASK GENMASK(27, 25) 10062306a36Sopenharmony_ci#define IGC_SRRCTL_DESCTYPE_ADV_ONEBUF FIELD_PREP(IGC_SRRCTL_DESCTYPE_MASK, 1) 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci#endif /* _IGC_BASE_H */ 103