1517904deSPeter Grehan /*- 2517904deSPeter Grehan * Copyright 2021 Intel Corp 3517904deSPeter Grehan * Copyright 2021 Rubicon Communications, LLC (Netgate) 4517904deSPeter Grehan * SPDX-License-Identifier: BSD-3-Clause 5517904deSPeter Grehan */ 6517904deSPeter Grehan 7517904deSPeter Grehan #ifndef _IGC_HW_H_ 8517904deSPeter Grehan #define _IGC_HW_H_ 9517904deSPeter Grehan 10517904deSPeter Grehan #include "igc_osdep.h" 11517904deSPeter Grehan #include "igc_regs.h" 12517904deSPeter Grehan #include "igc_defines.h" 13517904deSPeter Grehan 14517904deSPeter Grehan struct igc_hw; 15517904deSPeter Grehan 16517904deSPeter Grehan #define IGC_DEV_ID_I225_LM 0x15F2 17517904deSPeter Grehan #define IGC_DEV_ID_I225_V 0x15F3 18517904deSPeter Grehan #define IGC_DEV_ID_I225_K 0x3100 19517904deSPeter Grehan #define IGC_DEV_ID_I225_I 0x15F8 20517904deSPeter Grehan #define IGC_DEV_ID_I220_V 0x15F7 21517904deSPeter Grehan #define IGC_DEV_ID_I225_K2 0x3101 22517904deSPeter Grehan #define IGC_DEV_ID_I225_LMVP 0x5502 23*bf0aa72fSKevin Bowling #define IGC_DEV_ID_I226_K 0x3102 24*bf0aa72fSKevin Bowling #define IGC_DEV_ID_I226_LMVP 0x5503 25517904deSPeter Grehan #define IGC_DEV_ID_I225_IT 0x0D9F 26517904deSPeter Grehan #define IGC_DEV_ID_I226_LM 0x125B 27517904deSPeter Grehan #define IGC_DEV_ID_I226_V 0x125C 28517904deSPeter Grehan #define IGC_DEV_ID_I226_IT 0x125D 29517904deSPeter Grehan #define IGC_DEV_ID_I221_V 0x125E 30517904deSPeter Grehan #define IGC_DEV_ID_I226_BLANK_NVM 0x125F 31517904deSPeter Grehan #define IGC_DEV_ID_I225_BLANK_NVM 0x15FD 32517904deSPeter Grehan 33517904deSPeter Grehan #define IGC_REVISION_0 0 34517904deSPeter Grehan #define IGC_REVISION_1 1 35517904deSPeter Grehan #define IGC_REVISION_2 2 36517904deSPeter Grehan #define IGC_REVISION_3 3 37517904deSPeter Grehan #define IGC_REVISION_4 4 38517904deSPeter Grehan 39517904deSPeter Grehan #define IGC_FUNC_1 1 40517904deSPeter Grehan 41517904deSPeter Grehan #define IGC_ALT_MAC_ADDRESS_OFFSET_LAN0 0 42517904deSPeter Grehan #define IGC_ALT_MAC_ADDRESS_OFFSET_LAN1 3 43517904deSPeter Grehan 44517904deSPeter Grehan enum igc_mac_type { 45517904deSPeter Grehan igc_undefined = 0, 46517904deSPeter Grehan igc_i225, 47517904deSPeter Grehan igc_num_macs /* List is 1-based, so subtract 1 for TRUE count. */ 48517904deSPeter Grehan }; 49517904deSPeter Grehan 50517904deSPeter Grehan enum igc_media_type { 51517904deSPeter Grehan igc_media_type_unknown = 0, 52517904deSPeter Grehan igc_media_type_copper = 1, 53517904deSPeter Grehan igc_num_media_types 54517904deSPeter Grehan }; 55517904deSPeter Grehan 56517904deSPeter Grehan enum igc_nvm_type { 57517904deSPeter Grehan igc_nvm_unknown = 0, 58517904deSPeter Grehan igc_nvm_eeprom_spi, 59517904deSPeter Grehan igc_nvm_flash_hw, 60517904deSPeter Grehan igc_nvm_invm, 61517904deSPeter Grehan }; 62517904deSPeter Grehan 63517904deSPeter Grehan enum igc_phy_type { 64517904deSPeter Grehan igc_phy_unknown = 0, 65517904deSPeter Grehan igc_phy_none, 66517904deSPeter Grehan igc_phy_i225, 67517904deSPeter Grehan }; 68517904deSPeter Grehan 69517904deSPeter Grehan enum igc_bus_type { 70517904deSPeter Grehan igc_bus_type_unknown = 0, 71517904deSPeter Grehan igc_bus_type_pci, 72517904deSPeter Grehan igc_bus_type_pcix, 73517904deSPeter Grehan igc_bus_type_pci_express, 74517904deSPeter Grehan igc_bus_type_reserved 75517904deSPeter Grehan }; 76517904deSPeter Grehan 77517904deSPeter Grehan enum igc_bus_speed { 78517904deSPeter Grehan igc_bus_speed_unknown = 0, 79517904deSPeter Grehan igc_bus_speed_33, 80517904deSPeter Grehan igc_bus_speed_66, 81517904deSPeter Grehan igc_bus_speed_100, 82517904deSPeter Grehan igc_bus_speed_120, 83517904deSPeter Grehan igc_bus_speed_133, 84517904deSPeter Grehan igc_bus_speed_2500, 85517904deSPeter Grehan igc_bus_speed_5000, 86517904deSPeter Grehan igc_bus_speed_reserved 87517904deSPeter Grehan }; 88517904deSPeter Grehan 89517904deSPeter Grehan enum igc_bus_width { 90517904deSPeter Grehan igc_bus_width_unknown = 0, 91517904deSPeter Grehan igc_bus_width_pcie_x1, 92517904deSPeter Grehan igc_bus_width_pcie_x2, 93517904deSPeter Grehan igc_bus_width_pcie_x4 = 4, 94517904deSPeter Grehan igc_bus_width_pcie_x8 = 8, 95517904deSPeter Grehan igc_bus_width_32, 96517904deSPeter Grehan igc_bus_width_64, 97517904deSPeter Grehan igc_bus_width_reserved 98517904deSPeter Grehan }; 99517904deSPeter Grehan 100517904deSPeter Grehan enum igc_fc_mode { 101517904deSPeter Grehan igc_fc_none = 0, 102517904deSPeter Grehan igc_fc_rx_pause, 103517904deSPeter Grehan igc_fc_tx_pause, 104517904deSPeter Grehan igc_fc_full, 105517904deSPeter Grehan igc_fc_default = 0xFF 106517904deSPeter Grehan }; 107517904deSPeter Grehan 108517904deSPeter Grehan enum igc_ms_type { 109517904deSPeter Grehan igc_ms_hw_default = 0, 110517904deSPeter Grehan igc_ms_force_master, 111517904deSPeter Grehan igc_ms_force_slave, 112517904deSPeter Grehan igc_ms_auto 113517904deSPeter Grehan }; 114517904deSPeter Grehan 115517904deSPeter Grehan enum igc_smart_speed { 116517904deSPeter Grehan igc_smart_speed_default = 0, 117517904deSPeter Grehan igc_smart_speed_on, 118517904deSPeter Grehan igc_smart_speed_off 119517904deSPeter Grehan }; 120517904deSPeter Grehan 121517904deSPeter Grehan #define __le16 u16 122517904deSPeter Grehan #define __le32 u32 123517904deSPeter Grehan #define __le64 u64 124517904deSPeter Grehan /* Receive Descriptor */ 125517904deSPeter Grehan struct igc_rx_desc { 126517904deSPeter Grehan __le64 buffer_addr; /* Address of the descriptor's data buffer */ 127517904deSPeter Grehan __le16 length; /* Length of data DMAed into data buffer */ 128517904deSPeter Grehan __le16 csum; /* Packet checksum */ 129517904deSPeter Grehan u8 status; /* Descriptor status */ 130517904deSPeter Grehan u8 errors; /* Descriptor Errors */ 131517904deSPeter Grehan __le16 special; 132517904deSPeter Grehan }; 133517904deSPeter Grehan 134517904deSPeter Grehan /* Receive Descriptor - Extended */ 135517904deSPeter Grehan union igc_rx_desc_extended { 136517904deSPeter Grehan struct { 137517904deSPeter Grehan __le64 buffer_addr; 138517904deSPeter Grehan __le64 reserved; 139517904deSPeter Grehan } read; 140517904deSPeter Grehan struct { 141517904deSPeter Grehan struct { 142517904deSPeter Grehan __le32 mrq; /* Multiple Rx Queues */ 143517904deSPeter Grehan union { 144517904deSPeter Grehan __le32 rss; /* RSS Hash */ 145517904deSPeter Grehan struct { 146517904deSPeter Grehan __le16 ip_id; /* IP id */ 147517904deSPeter Grehan __le16 csum; /* Packet Checksum */ 148517904deSPeter Grehan } csum_ip; 149517904deSPeter Grehan } hi_dword; 150517904deSPeter Grehan } lower; 151517904deSPeter Grehan struct { 152517904deSPeter Grehan __le32 status_error; /* ext status/error */ 153517904deSPeter Grehan __le16 length; 154517904deSPeter Grehan __le16 vlan; /* VLAN tag */ 155517904deSPeter Grehan } upper; 156517904deSPeter Grehan } wb; /* writeback */ 157517904deSPeter Grehan }; 158517904deSPeter Grehan 159517904deSPeter Grehan #define MAX_PS_BUFFERS 4 160517904deSPeter Grehan 161517904deSPeter Grehan /* Number of packet split data buffers (not including the header buffer) */ 162517904deSPeter Grehan #define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1) 163517904deSPeter Grehan 164517904deSPeter Grehan /* Receive Descriptor - Packet Split */ 165517904deSPeter Grehan union igc_rx_desc_packet_split { 166517904deSPeter Grehan struct { 167517904deSPeter Grehan /* one buffer for protocol header(s), three data buffers */ 168517904deSPeter Grehan __le64 buffer_addr[MAX_PS_BUFFERS]; 169517904deSPeter Grehan } read; 170517904deSPeter Grehan struct { 171517904deSPeter Grehan struct { 172517904deSPeter Grehan __le32 mrq; /* Multiple Rx Queues */ 173517904deSPeter Grehan union { 174517904deSPeter Grehan __le32 rss; /* RSS Hash */ 175517904deSPeter Grehan struct { 176517904deSPeter Grehan __le16 ip_id; /* IP id */ 177517904deSPeter Grehan __le16 csum; /* Packet Checksum */ 178517904deSPeter Grehan } csum_ip; 179517904deSPeter Grehan } hi_dword; 180517904deSPeter Grehan } lower; 181517904deSPeter Grehan struct { 182517904deSPeter Grehan __le32 status_error; /* ext status/error */ 183517904deSPeter Grehan __le16 length0; /* length of buffer 0 */ 184517904deSPeter Grehan __le16 vlan; /* VLAN tag */ 185517904deSPeter Grehan } middle; 186517904deSPeter Grehan struct { 187517904deSPeter Grehan __le16 header_status; 188517904deSPeter Grehan /* length of buffers 1-3 */ 189517904deSPeter Grehan __le16 length[PS_PAGE_BUFFERS]; 190517904deSPeter Grehan } upper; 191517904deSPeter Grehan __le64 reserved; 192517904deSPeter Grehan } wb; /* writeback */ 193517904deSPeter Grehan }; 194517904deSPeter Grehan 195517904deSPeter Grehan /* Transmit Descriptor */ 196517904deSPeter Grehan struct igc_tx_desc { 197517904deSPeter Grehan __le64 buffer_addr; /* Address of the descriptor's data buffer */ 198517904deSPeter Grehan union { 199517904deSPeter Grehan __le32 data; 200517904deSPeter Grehan struct { 201517904deSPeter Grehan __le16 length; /* Data buffer length */ 202517904deSPeter Grehan u8 cso; /* Checksum offset */ 203517904deSPeter Grehan u8 cmd; /* Descriptor control */ 204517904deSPeter Grehan } flags; 205517904deSPeter Grehan } lower; 206517904deSPeter Grehan union { 207517904deSPeter Grehan __le32 data; 208517904deSPeter Grehan struct { 209517904deSPeter Grehan u8 status; /* Descriptor status */ 210517904deSPeter Grehan u8 css; /* Checksum start */ 211517904deSPeter Grehan __le16 special; 212517904deSPeter Grehan } fields; 213517904deSPeter Grehan } upper; 214517904deSPeter Grehan }; 215517904deSPeter Grehan 216517904deSPeter Grehan /* Offload Context Descriptor */ 217517904deSPeter Grehan struct igc_context_desc { 218517904deSPeter Grehan union { 219517904deSPeter Grehan __le32 ip_config; 220517904deSPeter Grehan struct { 221517904deSPeter Grehan u8 ipcss; /* IP checksum start */ 222517904deSPeter Grehan u8 ipcso; /* IP checksum offset */ 223517904deSPeter Grehan __le16 ipcse; /* IP checksum end */ 224517904deSPeter Grehan } ip_fields; 225517904deSPeter Grehan } lower_setup; 226517904deSPeter Grehan union { 227517904deSPeter Grehan __le32 tcp_config; 228517904deSPeter Grehan struct { 229517904deSPeter Grehan u8 tucss; /* TCP checksum start */ 230517904deSPeter Grehan u8 tucso; /* TCP checksum offset */ 231517904deSPeter Grehan __le16 tucse; /* TCP checksum end */ 232517904deSPeter Grehan } tcp_fields; 233517904deSPeter Grehan } upper_setup; 234517904deSPeter Grehan __le32 cmd_and_length; 235517904deSPeter Grehan union { 236517904deSPeter Grehan __le32 data; 237517904deSPeter Grehan struct { 238517904deSPeter Grehan u8 status; /* Descriptor status */ 239517904deSPeter Grehan u8 hdr_len; /* Header length */ 240517904deSPeter Grehan __le16 mss; /* Maximum segment size */ 241517904deSPeter Grehan } fields; 242517904deSPeter Grehan } tcp_seg_setup; 243517904deSPeter Grehan }; 244517904deSPeter Grehan 245517904deSPeter Grehan /* Offload data descriptor */ 246517904deSPeter Grehan struct igc_data_desc { 247517904deSPeter Grehan __le64 buffer_addr; /* Address of the descriptor's buffer address */ 248517904deSPeter Grehan union { 249517904deSPeter Grehan __le32 data; 250517904deSPeter Grehan struct { 251517904deSPeter Grehan __le16 length; /* Data buffer length */ 252517904deSPeter Grehan u8 typ_len_ext; 253517904deSPeter Grehan u8 cmd; 254517904deSPeter Grehan } flags; 255517904deSPeter Grehan } lower; 256517904deSPeter Grehan union { 257517904deSPeter Grehan __le32 data; 258517904deSPeter Grehan struct { 259517904deSPeter Grehan u8 status; /* Descriptor status */ 260517904deSPeter Grehan u8 popts; /* Packet Options */ 261517904deSPeter Grehan __le16 special; 262517904deSPeter Grehan } fields; 263517904deSPeter Grehan } upper; 264517904deSPeter Grehan }; 265517904deSPeter Grehan 266517904deSPeter Grehan /* Statistics counters collected by the MAC */ 267517904deSPeter Grehan struct igc_hw_stats { 268517904deSPeter Grehan u64 crcerrs; 269517904deSPeter Grehan u64 algnerrc; 270517904deSPeter Grehan u64 symerrs; 271517904deSPeter Grehan u64 rxerrc; 272517904deSPeter Grehan u64 mpc; 273517904deSPeter Grehan u64 scc; 274517904deSPeter Grehan u64 ecol; 275517904deSPeter Grehan u64 mcc; 276517904deSPeter Grehan u64 latecol; 277517904deSPeter Grehan u64 colc; 278517904deSPeter Grehan u64 dc; 279517904deSPeter Grehan u64 tncrs; 280517904deSPeter Grehan u64 sec; 281517904deSPeter Grehan u64 rlec; 282517904deSPeter Grehan u64 xonrxc; 283517904deSPeter Grehan u64 xontxc; 284517904deSPeter Grehan u64 xoffrxc; 285517904deSPeter Grehan u64 xofftxc; 286517904deSPeter Grehan u64 fcruc; 287517904deSPeter Grehan u64 prc64; 288517904deSPeter Grehan u64 prc127; 289517904deSPeter Grehan u64 prc255; 290517904deSPeter Grehan u64 prc511; 291517904deSPeter Grehan u64 prc1023; 292517904deSPeter Grehan u64 prc1522; 293517904deSPeter Grehan u64 tlpic; 294517904deSPeter Grehan u64 rlpic; 295517904deSPeter Grehan u64 gprc; 296517904deSPeter Grehan u64 bprc; 297517904deSPeter Grehan u64 mprc; 298517904deSPeter Grehan u64 gptc; 299517904deSPeter Grehan u64 gorc; 300517904deSPeter Grehan u64 gotc; 301517904deSPeter Grehan u64 rnbc; 302517904deSPeter Grehan u64 ruc; 303517904deSPeter Grehan u64 rfc; 304517904deSPeter Grehan u64 roc; 305517904deSPeter Grehan u64 rjc; 306517904deSPeter Grehan u64 mgprc; 307517904deSPeter Grehan u64 mgpdc; 308517904deSPeter Grehan u64 mgptc; 309517904deSPeter Grehan u64 tor; 310517904deSPeter Grehan u64 tot; 311517904deSPeter Grehan u64 tpr; 312517904deSPeter Grehan u64 tpt; 313517904deSPeter Grehan u64 ptc64; 314517904deSPeter Grehan u64 ptc127; 315517904deSPeter Grehan u64 ptc255; 316517904deSPeter Grehan u64 ptc511; 317517904deSPeter Grehan u64 ptc1023; 318517904deSPeter Grehan u64 ptc1522; 319517904deSPeter Grehan u64 mptc; 320517904deSPeter Grehan u64 bptc; 321517904deSPeter Grehan u64 tsctc; 322517904deSPeter Grehan u64 iac; 323517904deSPeter Grehan u64 rxdmtc; 324517904deSPeter Grehan u64 htdpmc; 325517904deSPeter Grehan u64 rpthc; 326517904deSPeter Grehan u64 hgptc; 327517904deSPeter Grehan u64 hgorc; 328517904deSPeter Grehan u64 hgotc; 329517904deSPeter Grehan u64 lenerrs; 330517904deSPeter Grehan u64 scvpc; 331517904deSPeter Grehan u64 hrmpc; 332517904deSPeter Grehan u64 doosync; 333517904deSPeter Grehan u64 o2bgptc; 334517904deSPeter Grehan u64 o2bspc; 335517904deSPeter Grehan u64 b2ospc; 336517904deSPeter Grehan u64 b2ogprc; 337517904deSPeter Grehan }; 338517904deSPeter Grehan 339517904deSPeter Grehan #include "igc_mac.h" 340517904deSPeter Grehan #include "igc_phy.h" 341517904deSPeter Grehan #include "igc_nvm.h" 342517904deSPeter Grehan 343517904deSPeter Grehan /* Function pointers for the MAC. */ 344517904deSPeter Grehan struct igc_mac_operations { 345517904deSPeter Grehan s32 (*init_params)(struct igc_hw *); 346517904deSPeter Grehan s32 (*check_for_link)(struct igc_hw *); 347517904deSPeter Grehan void (*clear_hw_cntrs)(struct igc_hw *); 348517904deSPeter Grehan void (*clear_vfta)(struct igc_hw *); 349517904deSPeter Grehan s32 (*get_bus_info)(struct igc_hw *); 350517904deSPeter Grehan void (*set_lan_id)(struct igc_hw *); 351517904deSPeter Grehan s32 (*get_link_up_info)(struct igc_hw *, u16 *, u16 *); 352517904deSPeter Grehan void (*update_mc_addr_list)(struct igc_hw *, u8 *, u32); 353517904deSPeter Grehan s32 (*reset_hw)(struct igc_hw *); 354517904deSPeter Grehan s32 (*init_hw)(struct igc_hw *); 355517904deSPeter Grehan s32 (*setup_link)(struct igc_hw *); 356517904deSPeter Grehan s32 (*setup_physical_interface)(struct igc_hw *); 357517904deSPeter Grehan void (*write_vfta)(struct igc_hw *, u32, u32); 358517904deSPeter Grehan void (*config_collision_dist)(struct igc_hw *); 359517904deSPeter Grehan int (*rar_set)(struct igc_hw *, u8*, u32); 360517904deSPeter Grehan s32 (*read_mac_addr)(struct igc_hw *); 361517904deSPeter Grehan s32 (*validate_mdi_setting)(struct igc_hw *); 362517904deSPeter Grehan s32 (*acquire_swfw_sync)(struct igc_hw *, u16); 363517904deSPeter Grehan void (*release_swfw_sync)(struct igc_hw *, u16); 364517904deSPeter Grehan }; 365517904deSPeter Grehan 366517904deSPeter Grehan /* When to use various PHY register access functions: 367517904deSPeter Grehan * 368517904deSPeter Grehan * Func Caller 369517904deSPeter Grehan * Function Does Does When to use 370517904deSPeter Grehan * ~~~~~~~~~~~~ ~~~~~ ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 371517904deSPeter Grehan * X_reg L,P,A n/a for simple PHY reg accesses 372517904deSPeter Grehan * X_reg_locked P,A L for multiple accesses of different regs 373517904deSPeter Grehan * on different pages 374517904deSPeter Grehan * X_reg_page A L,P for multiple accesses of different regs 375517904deSPeter Grehan * on the same page 376517904deSPeter Grehan * 377517904deSPeter Grehan * Where X=[read|write], L=locking, P=sets page, A=register access 378517904deSPeter Grehan * 379517904deSPeter Grehan */ 380517904deSPeter Grehan struct igc_phy_operations { 381517904deSPeter Grehan s32 (*init_params)(struct igc_hw *); 382517904deSPeter Grehan s32 (*acquire)(struct igc_hw *); 383517904deSPeter Grehan s32 (*check_reset_block)(struct igc_hw *); 384517904deSPeter Grehan s32 (*force_speed_duplex)(struct igc_hw *); 385517904deSPeter Grehan s32 (*get_info)(struct igc_hw *); 386517904deSPeter Grehan s32 (*set_page)(struct igc_hw *, u16); 387517904deSPeter Grehan s32 (*read_reg)(struct igc_hw *, u32, u16 *); 388517904deSPeter Grehan s32 (*read_reg_locked)(struct igc_hw *, u32, u16 *); 389517904deSPeter Grehan s32 (*read_reg_page)(struct igc_hw *, u32, u16 *); 390517904deSPeter Grehan void (*release)(struct igc_hw *); 391517904deSPeter Grehan s32 (*reset)(struct igc_hw *); 392517904deSPeter Grehan s32 (*set_d0_lplu_state)(struct igc_hw *, bool); 393517904deSPeter Grehan s32 (*set_d3_lplu_state)(struct igc_hw *, bool); 394517904deSPeter Grehan s32 (*write_reg)(struct igc_hw *, u32, u16); 395517904deSPeter Grehan s32 (*write_reg_locked)(struct igc_hw *, u32, u16); 396517904deSPeter Grehan s32 (*write_reg_page)(struct igc_hw *, u32, u16); 397517904deSPeter Grehan void (*power_up)(struct igc_hw *); 398517904deSPeter Grehan void (*power_down)(struct igc_hw *); 399517904deSPeter Grehan }; 400517904deSPeter Grehan 401517904deSPeter Grehan /* Function pointers for the NVM. */ 402517904deSPeter Grehan struct igc_nvm_operations { 403517904deSPeter Grehan s32 (*init_params)(struct igc_hw *); 404517904deSPeter Grehan s32 (*acquire)(struct igc_hw *); 405517904deSPeter Grehan s32 (*read)(struct igc_hw *, u16, u16, u16 *); 406517904deSPeter Grehan void (*release)(struct igc_hw *); 407517904deSPeter Grehan void (*reload)(struct igc_hw *); 408517904deSPeter Grehan s32 (*update)(struct igc_hw *); 409517904deSPeter Grehan s32 (*validate)(struct igc_hw *); 410517904deSPeter Grehan s32 (*write)(struct igc_hw *, u16, u16, u16 *); 411517904deSPeter Grehan }; 412517904deSPeter Grehan 413517904deSPeter Grehan struct igc_info { 414517904deSPeter Grehan s32 (*get_invariants)(struct igc_hw *hw); 415517904deSPeter Grehan struct igc_mac_operations *mac_ops; 416517904deSPeter Grehan const struct igc_phy_operations *phy_ops; 417517904deSPeter Grehan struct igc_nvm_operations *nvm_ops; 418517904deSPeter Grehan }; 419517904deSPeter Grehan 420517904deSPeter Grehan extern const struct igc_info igc_i225_info; 421517904deSPeter Grehan 422517904deSPeter Grehan struct igc_mac_info { 423517904deSPeter Grehan struct igc_mac_operations ops; 424517904deSPeter Grehan u8 addr[ETH_ADDR_LEN]; 425517904deSPeter Grehan u8 perm_addr[ETH_ADDR_LEN]; 426517904deSPeter Grehan 427517904deSPeter Grehan enum igc_mac_type type; 428517904deSPeter Grehan 429517904deSPeter Grehan u32 mc_filter_type; 430517904deSPeter Grehan 431517904deSPeter Grehan u16 current_ifs_val; 432517904deSPeter Grehan u16 ifs_max_val; 433517904deSPeter Grehan u16 ifs_min_val; 434517904deSPeter Grehan u16 ifs_ratio; 435517904deSPeter Grehan u16 ifs_step_size; 436517904deSPeter Grehan u16 mta_reg_count; 437517904deSPeter Grehan u16 uta_reg_count; 438517904deSPeter Grehan 439517904deSPeter Grehan /* Maximum size of the MTA register table in all supported adapters */ 440517904deSPeter Grehan #define MAX_MTA_REG 128 441517904deSPeter Grehan u32 mta_shadow[MAX_MTA_REG]; 442517904deSPeter Grehan u16 rar_entry_count; 443517904deSPeter Grehan 444517904deSPeter Grehan u8 forced_speed_duplex; 445517904deSPeter Grehan 446517904deSPeter Grehan bool asf_firmware_present; 447517904deSPeter Grehan bool autoneg; 448517904deSPeter Grehan bool get_link_status; 449517904deSPeter Grehan u32 max_frame_size; 450517904deSPeter Grehan }; 451517904deSPeter Grehan 452517904deSPeter Grehan struct igc_phy_info { 453517904deSPeter Grehan struct igc_phy_operations ops; 454517904deSPeter Grehan enum igc_phy_type type; 455517904deSPeter Grehan 456517904deSPeter Grehan enum igc_smart_speed smart_speed; 457517904deSPeter Grehan 458517904deSPeter Grehan u32 addr; 459517904deSPeter Grehan u32 id; 460517904deSPeter Grehan u32 reset_delay_us; /* in usec */ 461517904deSPeter Grehan u32 revision; 462517904deSPeter Grehan 463517904deSPeter Grehan enum igc_media_type media_type; 464517904deSPeter Grehan 465517904deSPeter Grehan u16 autoneg_advertised; 466517904deSPeter Grehan u16 autoneg_mask; 467517904deSPeter Grehan 468517904deSPeter Grehan u8 mdix; 469517904deSPeter Grehan 470517904deSPeter Grehan bool polarity_correction; 471517904deSPeter Grehan bool speed_downgraded; 472517904deSPeter Grehan bool autoneg_wait_to_complete; 473517904deSPeter Grehan }; 474517904deSPeter Grehan 475517904deSPeter Grehan struct igc_nvm_info { 476517904deSPeter Grehan struct igc_nvm_operations ops; 477517904deSPeter Grehan enum igc_nvm_type type; 478517904deSPeter Grehan 479517904deSPeter Grehan u16 word_size; 480517904deSPeter Grehan u16 delay_usec; 481517904deSPeter Grehan u16 address_bits; 482517904deSPeter Grehan u16 opcode_bits; 483517904deSPeter Grehan u16 page_size; 484517904deSPeter Grehan }; 485517904deSPeter Grehan 486517904deSPeter Grehan struct igc_bus_info { 487517904deSPeter Grehan enum igc_bus_type type; 488517904deSPeter Grehan enum igc_bus_speed speed; 489517904deSPeter Grehan enum igc_bus_width width; 490517904deSPeter Grehan 491517904deSPeter Grehan u16 func; 492517904deSPeter Grehan u16 pci_cmd_word; 493517904deSPeter Grehan }; 494517904deSPeter Grehan 495517904deSPeter Grehan struct igc_fc_info { 496517904deSPeter Grehan u32 high_water; /* Flow control high-water mark */ 497517904deSPeter Grehan u32 low_water; /* Flow control low-water mark */ 498517904deSPeter Grehan u16 pause_time; /* Flow control pause timer */ 499517904deSPeter Grehan u16 refresh_time; /* Flow control refresh timer */ 500517904deSPeter Grehan bool send_xon; /* Flow control send XON */ 501517904deSPeter Grehan bool strict_ieee; /* Strict IEEE mode */ 502517904deSPeter Grehan enum igc_fc_mode current_mode; /* FC mode in effect */ 503517904deSPeter Grehan enum igc_fc_mode requested_mode; /* FC mode requested by caller */ 504517904deSPeter Grehan }; 505517904deSPeter Grehan 506517904deSPeter Grehan struct igc_dev_spec_i225 { 507517904deSPeter Grehan bool eee_disable; 508517904deSPeter Grehan bool clear_semaphore_once; 509517904deSPeter Grehan u32 mtu; 510517904deSPeter Grehan }; 511517904deSPeter Grehan 512517904deSPeter Grehan struct igc_hw { 513517904deSPeter Grehan void *back; 514517904deSPeter Grehan 515517904deSPeter Grehan u8 *hw_addr; 516517904deSPeter Grehan u8 *flash_address; 517517904deSPeter Grehan unsigned long io_base; 518517904deSPeter Grehan 519517904deSPeter Grehan struct igc_mac_info mac; 520517904deSPeter Grehan struct igc_fc_info fc; 521517904deSPeter Grehan struct igc_phy_info phy; 522517904deSPeter Grehan struct igc_nvm_info nvm; 523517904deSPeter Grehan struct igc_bus_info bus; 524517904deSPeter Grehan 525517904deSPeter Grehan union { 526517904deSPeter Grehan struct igc_dev_spec_i225 _i225; 527517904deSPeter Grehan } dev_spec; 528517904deSPeter Grehan 529517904deSPeter Grehan u16 device_id; 530517904deSPeter Grehan u16 subsystem_vendor_id; 531517904deSPeter Grehan u16 subsystem_device_id; 532517904deSPeter Grehan u16 vendor_id; 533517904deSPeter Grehan 534517904deSPeter Grehan u8 revision_id; 535517904deSPeter Grehan }; 536517904deSPeter Grehan 537517904deSPeter Grehan #include "igc_i225.h" 538517904deSPeter Grehan #include "igc_base.h" 539517904deSPeter Grehan 540517904deSPeter Grehan /* These functions must be implemented by drivers */ 541517904deSPeter Grehan s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value); 542517904deSPeter Grehan s32 igc_write_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value); 543517904deSPeter Grehan void igc_read_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value); 544517904deSPeter Grehan void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value); 545517904deSPeter Grehan 546517904deSPeter Grehan #endif 547