00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 FILE_LICENCE ( GPL2_ONLY );
00029
00030 #ifndef _IGB_HW_H_
00031 #define _IGB_HW_H_
00032
00033 #include "igb_osdep.h"
00034 #include "igb_regs.h"
00035 #include "igb_defines.h"
00036
00037 struct e1000_hw;
00038
00039 #define E1000_DEV_ID_82576 0x10C9
00040 #define E1000_DEV_ID_82576_FIBER 0x10E6
00041 #define E1000_DEV_ID_82576_SERDES 0x10E7
00042 #define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8
00043 #define E1000_DEV_ID_82576_NS 0x150A
00044 #define E1000_DEV_ID_82576_NS_SERDES 0x1518
00045 #define E1000_DEV_ID_82576_SERDES_QUAD 0x150D
00046 #define E1000_DEV_ID_82575EB_COPPER 0x10A7
00047 #define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9
00048 #define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6
00049 #define E1000_REVISION_0 0
00050 #define E1000_REVISION_1 1
00051 #define E1000_REVISION_2 2
00052 #define E1000_REVISION_3 3
00053 #define E1000_REVISION_4 4
00054
00055 #define E1000_FUNC_0 0
00056 #define E1000_FUNC_1 1
00057
00058 #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0
00059 #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
00060
00061 enum e1000_mac_type {
00062 e1000_undefined = 0,
00063 e1000_82575,
00064 e1000_82576,
00065 e1000_num_macs
00066 };
00067
00068 enum e1000_media_type {
00069 e1000_media_type_unknown = 0,
00070 e1000_media_type_copper = 1,
00071 e1000_media_type_fiber = 2,
00072 e1000_media_type_internal_serdes = 3,
00073 e1000_num_media_types
00074 };
00075
00076 enum e1000_nvm_type {
00077 e1000_nvm_unknown = 0,
00078 e1000_nvm_none,
00079 e1000_nvm_eeprom_spi,
00080 e1000_nvm_flash_hw,
00081 e1000_nvm_flash_sw
00082 };
00083
00084 enum e1000_nvm_override {
00085 e1000_nvm_override_none = 0,
00086 e1000_nvm_override_spi_small,
00087 e1000_nvm_override_spi_large,
00088 };
00089
00090 enum e1000_phy_type {
00091 e1000_phy_unknown = 0,
00092 e1000_phy_none,
00093 e1000_phy_m88,
00094 e1000_phy_igp,
00095 e1000_phy_igp_2,
00096 e1000_phy_gg82563,
00097 e1000_phy_igp_3,
00098 e1000_phy_ife,
00099 e1000_phy_vf,
00100 };
00101
00102 enum e1000_bus_type {
00103 e1000_bus_type_unknown = 0,
00104 e1000_bus_type_pci,
00105 e1000_bus_type_pcix,
00106 e1000_bus_type_pci_express,
00107 e1000_bus_type_reserved
00108 };
00109
00110 enum e1000_bus_speed {
00111 e1000_bus_speed_unknown = 0,
00112 e1000_bus_speed_33,
00113 e1000_bus_speed_66,
00114 e1000_bus_speed_100,
00115 e1000_bus_speed_120,
00116 e1000_bus_speed_133,
00117 e1000_bus_speed_2500,
00118 e1000_bus_speed_5000,
00119 e1000_bus_speed_reserved
00120 };
00121
00122 enum e1000_bus_width {
00123 e1000_bus_width_unknown = 0,
00124 e1000_bus_width_pcie_x1,
00125 e1000_bus_width_pcie_x2,
00126 e1000_bus_width_pcie_x4 = 4,
00127 e1000_bus_width_pcie_x8 = 8,
00128 e1000_bus_width_32,
00129 e1000_bus_width_64,
00130 e1000_bus_width_reserved
00131 };
00132
00133 enum e1000_1000t_rx_status {
00134 e1000_1000t_rx_status_not_ok = 0,
00135 e1000_1000t_rx_status_ok,
00136 e1000_1000t_rx_status_undefined = 0xFF
00137 };
00138
00139 enum e1000_rev_polarity {
00140 e1000_rev_polarity_normal = 0,
00141 e1000_rev_polarity_reversed,
00142 e1000_rev_polarity_undefined = 0xFF
00143 };
00144
00145 enum e1000_fc_mode {
00146 e1000_fc_none = 0,
00147 e1000_fc_rx_pause,
00148 e1000_fc_tx_pause,
00149 e1000_fc_full,
00150 e1000_fc_default = 0xFF
00151 };
00152
00153 enum e1000_ms_type {
00154 e1000_ms_hw_default = 0,
00155 e1000_ms_force_master,
00156 e1000_ms_force_slave,
00157 e1000_ms_auto
00158 };
00159
00160 enum e1000_smart_speed {
00161 e1000_smart_speed_default = 0,
00162 e1000_smart_speed_on,
00163 e1000_smart_speed_off
00164 };
00165
00166 enum e1000_serdes_link_state {
00167 e1000_serdes_link_down = 0,
00168 e1000_serdes_link_autoneg_progress,
00169 e1000_serdes_link_autoneg_complete,
00170 e1000_serdes_link_forced_up
00171 };
00172
00173
00174 struct e1000_rx_desc {
00175 __le64 buffer_addr;
00176 __le16 length;
00177 __le16 csum;
00178 u8 status;
00179 u8 errors;
00180 __le16 special;
00181 };
00182
00183
00184 union e1000_rx_desc_extended {
00185 struct {
00186 __le64 buffer_addr;
00187 __le64 reserved;
00188 } read;
00189 struct {
00190 struct {
00191 __le32 mrq;
00192 union {
00193 __le32 rss;
00194 struct {
00195 __le16 ip_id;
00196 __le16 csum;
00197 } csum_ip;
00198 } hi_dword;
00199 } lower;
00200 struct {
00201 __le32 status_error;
00202 __le16 length;
00203 __le16 vlan;
00204 } upper;
00205 } wb;
00206 };
00207
00208 #define MAX_PS_BUFFERS 4
00209
00210 union e1000_rx_desc_packet_split {
00211 struct {
00212
00213 __le64 buffer_addr[MAX_PS_BUFFERS];
00214 } read;
00215 struct {
00216 struct {
00217 __le32 mrq;
00218 union {
00219 __le32 rss;
00220 struct {
00221 __le16 ip_id;
00222 __le16 csum;
00223 } csum_ip;
00224 } hi_dword;
00225 } lower;
00226 struct {
00227 __le32 status_error;
00228 __le16 length0;
00229 __le16 vlan;
00230 } middle;
00231 struct {
00232 __le16 header_status;
00233 __le16 length[3];
00234 } upper;
00235 __le64 reserved;
00236 } wb;
00237 };
00238
00239
00240 struct e1000_tx_desc {
00241 __le64 buffer_addr;
00242 union {
00243 __le32 data;
00244 struct {
00245 __le16 length;
00246 u8 cso;
00247 u8 cmd;
00248 } flags;
00249 } lower;
00250 union {
00251 __le32 data;
00252 struct {
00253 u8 status;
00254 u8 css;
00255 __le16 special;
00256 } fields;
00257 } upper;
00258 };
00259
00260
00261 struct e1000_context_desc {
00262 union {
00263 __le32 ip_config;
00264 struct {
00265 u8 ipcss;
00266 u8 ipcso;
00267 __le16 ipcse;
00268 } ip_fields;
00269 } lower_setup;
00270 union {
00271 __le32 tcp_config;
00272 struct {
00273 u8 tucss;
00274 u8 tucso;
00275 __le16 tucse;
00276 } tcp_fields;
00277 } upper_setup;
00278 __le32 cmd_and_length;
00279 union {
00280 __le32 data;
00281 struct {
00282 u8 status;
00283 u8 hdr_len;
00284 __le16 mss;
00285 } fields;
00286 } tcp_seg_setup;
00287 };
00288
00289
00290 struct e1000_data_desc {
00291 __le64 buffer_addr;
00292 union {
00293 __le32 data;
00294 struct {
00295 __le16 length;
00296 u8 typ_len_ext;
00297 u8 cmd;
00298 } flags;
00299 } lower;
00300 union {
00301 __le32 data;
00302 struct {
00303 u8 status;
00304 u8 popts;
00305 __le16 special;
00306 } fields;
00307 } upper;
00308 };
00309
00310
00311 struct e1000_hw_stats {
00312 u64 crcerrs;
00313 u64 algnerrc;
00314 u64 symerrs;
00315 u64 rxerrc;
00316 u64 mpc;
00317 u64 scc;
00318 u64 ecol;
00319 u64 mcc;
00320 u64 latecol;
00321 u64 colc;
00322 u64 dc;
00323 u64 tncrs;
00324 u64 sec;
00325 u64 cexterr;
00326 u64 rlec;
00327 u64 xonrxc;
00328 u64 xontxc;
00329 u64 xoffrxc;
00330 u64 xofftxc;
00331 u64 fcruc;
00332 u64 prc64;
00333 u64 prc127;
00334 u64 prc255;
00335 u64 prc511;
00336 u64 prc1023;
00337 u64 prc1522;
00338 u64 gprc;
00339 u64 bprc;
00340 u64 mprc;
00341 u64 gptc;
00342 u64 gorc;
00343 u64 gotc;
00344 u64 rnbc;
00345 u64 ruc;
00346 u64 rfc;
00347 u64 roc;
00348 u64 rjc;
00349 u64 mgprc;
00350 u64 mgpdc;
00351 u64 mgptc;
00352 u64 tor;
00353 u64 tot;
00354 u64 tpr;
00355 u64 tpt;
00356 u64 ptc64;
00357 u64 ptc127;
00358 u64 ptc255;
00359 u64 ptc511;
00360 u64 ptc1023;
00361 u64 ptc1522;
00362 u64 mptc;
00363 u64 bptc;
00364 u64 tsctc;
00365 u64 tsctfc;
00366 u64 iac;
00367 u64 icrxptc;
00368 u64 icrxatc;
00369 u64 ictxptc;
00370 u64 ictxatc;
00371 u64 ictxqec;
00372 u64 ictxqmtc;
00373 u64 icrxdmtc;
00374 u64 icrxoc;
00375 u64 cbtmpc;
00376 u64 htdpmc;
00377 u64 cbrdpc;
00378 u64 cbrmpc;
00379 u64 rpthc;
00380 u64 hgptc;
00381 u64 htcbdpc;
00382 u64 hgorc;
00383 u64 hgotc;
00384 u64 lenerrs;
00385 u64 scvpc;
00386 u64 hrmpc;
00387 u64 doosync;
00388 };
00389
00390
00391 struct e1000_phy_stats {
00392 u32 idle_errors;
00393 u32 receive_errors;
00394 };
00395
00396 struct e1000_host_mng_dhcp_cookie {
00397 u32 signature;
00398 u8 status;
00399 u8 reserved0;
00400 u16 vlan_id;
00401 u32 reserved1;
00402 u16 reserved2;
00403 u8 reserved3;
00404 u8 checksum;
00405 };
00406
00407
00408 struct e1000_host_command_header {
00409 u8 command_id;
00410 u8 command_length;
00411 u8 command_options;
00412 u8 checksum;
00413 };
00414
00415 #define E1000_HI_MAX_DATA_LENGTH 252
00416 struct e1000_host_command_info {
00417 struct e1000_host_command_header command_header;
00418 u8 command_data[E1000_HI_MAX_DATA_LENGTH];
00419 };
00420
00421
00422 struct e1000_host_mng_command_header {
00423 u8 command_id;
00424 u8 checksum;
00425 u16 reserved1;
00426 u16 reserved2;
00427 u16 command_length;
00428 };
00429
00430 #define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8
00431 struct e1000_host_mng_command_info {
00432 struct e1000_host_mng_command_header command_header;
00433 u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH];
00434 };
00435
00436 #include "igb_mac.h"
00437 #include "igb_phy.h"
00438 #include "igb_nvm.h"
00439 #include "igb_manage.h"
00440
00441 struct e1000_mac_operations {
00442
00443 s32 (*init_params)(struct e1000_hw *);
00444 s32 (*id_led_init)(struct e1000_hw *);
00445 s32 (*blink_led)(struct e1000_hw *);
00446 s32 (*check_for_link)(struct e1000_hw *);
00447 bool (*check_mng_mode)(struct e1000_hw *hw);
00448 s32 (*cleanup_led)(struct e1000_hw *);
00449 void (*clear_hw_cntrs)(struct e1000_hw *);
00450 void (*clear_vfta)(struct e1000_hw *);
00451 s32 (*get_bus_info)(struct e1000_hw *);
00452 void (*set_lan_id)(struct e1000_hw *);
00453 s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
00454 s32 (*led_on)(struct e1000_hw *);
00455 s32 (*led_off)(struct e1000_hw *);
00456 void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32);
00457 s32 (*reset_hw)(struct e1000_hw *);
00458 s32 (*init_hw)(struct e1000_hw *);
00459 void (*shutdown_serdes)(struct e1000_hw *);
00460 s32 (*setup_link)(struct e1000_hw *);
00461 s32 (*setup_physical_interface)(struct e1000_hw *);
00462 s32 (*setup_led)(struct e1000_hw *);
00463 void (*write_vfta)(struct e1000_hw *, u32, u32);
00464 void (*mta_set)(struct e1000_hw *, u32);
00465 void (*config_collision_dist)(struct e1000_hw *);
00466 void (*rar_set)(struct e1000_hw *, u8*, u32);
00467 s32 (*read_mac_addr)(struct e1000_hw *);
00468 s32 (*validate_mdi_setting)(struct e1000_hw *);
00469 s32 (*mng_host_if_write)(struct e1000_hw *, u8*, u16, u16, u8*);
00470 s32 (*mng_write_cmd_header)(struct e1000_hw *hw,
00471 struct e1000_host_mng_command_header*);
00472 s32 (*mng_enable_host_if)(struct e1000_hw *);
00473 s32 (*wait_autoneg)(struct e1000_hw *);
00474 };
00475
00476 struct e1000_phy_operations {
00477 s32 (*init_params)(struct e1000_hw *);
00478 s32 (*acquire)(struct e1000_hw *);
00479 s32 (*check_polarity)(struct e1000_hw *);
00480 s32 (*check_reset_block)(struct e1000_hw *);
00481 s32 (*commit)(struct e1000_hw *);
00482 #if 0
00483 s32 (*force_speed_duplex)(struct e1000_hw *);
00484 #endif
00485 s32 (*get_cfg_done)(struct e1000_hw *hw);
00486 #if 0
00487 s32 (*get_cable_length)(struct e1000_hw *);
00488 #endif
00489 s32 (*get_info)(struct e1000_hw *);
00490 s32 (*read_reg)(struct e1000_hw *, u32, u16 *);
00491 s32 (*read_reg_locked)(struct e1000_hw *, u32, u16 *);
00492 void (*release)(struct e1000_hw *);
00493 s32 (*reset)(struct e1000_hw *);
00494 s32 (*set_d0_lplu_state)(struct e1000_hw *, bool);
00495 s32 (*set_d3_lplu_state)(struct e1000_hw *, bool);
00496 s32 (*write_reg)(struct e1000_hw *, u32, u16);
00497 s32 (*write_reg_locked)(struct e1000_hw *, u32, u16);
00498 void (*power_up)(struct e1000_hw *);
00499 void (*power_down)(struct e1000_hw *);
00500 };
00501
00502 struct e1000_nvm_operations {
00503 s32 (*init_params)(struct e1000_hw *);
00504 s32 (*acquire)(struct e1000_hw *);
00505 s32 (*read)(struct e1000_hw *, u16, u16, u16 *);
00506 void (*release)(struct e1000_hw *);
00507 void (*reload)(struct e1000_hw *);
00508 s32 (*update)(struct e1000_hw *);
00509 s32 (*valid_led_default)(struct e1000_hw *, u16 *);
00510 s32 (*validate)(struct e1000_hw *);
00511 s32 (*write)(struct e1000_hw *, u16, u16, u16 *);
00512 };
00513
00514 struct e1000_mac_info {
00515 struct e1000_mac_operations ops;
00516 u8 addr[6];
00517 u8 perm_addr[6];
00518
00519 enum e1000_mac_type type;
00520
00521 u32 collision_delta;
00522 u32 ledctl_default;
00523 u32 ledctl_mode1;
00524 u32 ledctl_mode2;
00525 u32 mc_filter_type;
00526 u32 tx_packet_delta;
00527 u32 txcw;
00528
00529 u16 current_ifs_val;
00530 u16 ifs_max_val;
00531 u16 ifs_min_val;
00532 u16 ifs_ratio;
00533 u16 ifs_step_size;
00534 u16 mta_reg_count;
00535 u16 uta_reg_count;
00536
00537
00538 #define MAX_MTA_REG 128
00539 u32 mta_shadow[MAX_MTA_REG];
00540 u16 rar_entry_count;
00541
00542 u8 forced_speed_duplex;
00543
00544 bool adaptive_ifs;
00545 bool arc_subsystem_valid;
00546 bool asf_firmware_present;
00547 bool autoneg;
00548 bool autoneg_failed;
00549 bool get_link_status;
00550 bool in_ifs_mode;
00551 enum e1000_serdes_link_state serdes_link_state;
00552 bool serdes_has_link;
00553 bool tx_pkt_filtering;
00554 };
00555
00556 struct e1000_phy_info {
00557 struct e1000_phy_operations ops;
00558 enum e1000_phy_type type;
00559
00560 enum e1000_1000t_rx_status local_rx;
00561 enum e1000_1000t_rx_status remote_rx;
00562 enum e1000_ms_type ms_type;
00563 enum e1000_ms_type original_ms_type;
00564 enum e1000_rev_polarity cable_polarity;
00565 enum e1000_smart_speed smart_speed;
00566
00567 u32 addr;
00568 u32 id;
00569 u32 reset_delay_us;
00570 u32 revision;
00571
00572 enum e1000_media_type media_type;
00573
00574 u16 autoneg_advertised;
00575 u16 autoneg_mask;
00576 u16 cable_length;
00577 u16 max_cable_length;
00578 u16 min_cable_length;
00579
00580 u8 mdix;
00581
00582 bool disable_polarity_correction;
00583 bool is_mdix;
00584 bool polarity_correction;
00585 bool reset_disable;
00586 bool speed_downgraded;
00587 bool autoneg_wait_to_complete;
00588 };
00589
00590 struct e1000_nvm_info {
00591 struct e1000_nvm_operations ops;
00592 enum e1000_nvm_type type;
00593 enum e1000_nvm_override override;
00594
00595 u32 flash_bank_size;
00596 u32 flash_base_addr;
00597
00598 u16 word_size;
00599 u16 delay_usec;
00600 u16 address_bits;
00601 u16 opcode_bits;
00602 u16 page_size;
00603 };
00604
00605 struct e1000_bus_info {
00606 enum e1000_bus_type type;
00607 enum e1000_bus_speed speed;
00608 enum e1000_bus_width width;
00609
00610 u16 func;
00611 u16 pci_cmd_word;
00612 };
00613
00614 struct e1000_fc_info {
00615 u32 high_water;
00616 u32 low_water;
00617 u16 pause_time;
00618 bool send_xon;
00619 bool strict_ieee;
00620 enum e1000_fc_mode current_mode;
00621 enum e1000_fc_mode requested_mode;
00622 };
00623
00624 struct e1000_mbx_operations {
00625 s32 (*init_params)(struct e1000_hw *hw);
00626 s32 (*read)(struct e1000_hw *, u32 *, u16, u16);
00627 s32 (*write)(struct e1000_hw *, u32 *, u16, u16);
00628 s32 (*read_posted)(struct e1000_hw *, u32 *, u16, u16);
00629 s32 (*write_posted)(struct e1000_hw *, u32 *, u16, u16);
00630 s32 (*check_for_msg)(struct e1000_hw *, u16);
00631 s32 (*check_for_ack)(struct e1000_hw *, u16);
00632 s32 (*check_for_rst)(struct e1000_hw *, u16);
00633 };
00634
00635 struct e1000_mbx_stats {
00636 u32 msgs_tx;
00637 u32 msgs_rx;
00638
00639 u32 acks;
00640 u32 reqs;
00641 u32 rsts;
00642 };
00643
00644 struct e1000_mbx_info {
00645 struct e1000_mbx_operations ops;
00646 struct e1000_mbx_stats stats;
00647 u32 timeout;
00648 u32 usec_delay;
00649 u16 size;
00650 };
00651
00652 struct e1000_dev_spec_82575 {
00653 bool sgmii_active;
00654 bool global_device_reset;
00655 };
00656
00657 struct e1000_dev_spec_vf {
00658 u32 vf_number;
00659 u32 v2p_mailbox;
00660 };
00661
00662
00663 struct e1000_hw {
00664 void *back;
00665
00666 u8 __iomem *hw_addr;
00667 u8 __iomem *flash_address;
00668 unsigned long io_base;
00669
00670 struct e1000_mac_info mac;
00671 struct e1000_fc_info fc;
00672 struct e1000_phy_info phy;
00673 struct e1000_nvm_info nvm;
00674 struct e1000_bus_info bus;
00675 struct e1000_mbx_info mbx;
00676 struct e1000_host_mng_dhcp_cookie mng_cookie;
00677
00678 union {
00679 struct e1000_dev_spec_82575 _82575;
00680 struct e1000_dev_spec_vf vf;
00681 } dev_spec;
00682
00683 u16 device_id;
00684 u16 subsystem_vendor_id;
00685 u16 subsystem_device_id;
00686 u16 vendor_id;
00687
00688 u8 revision_id;
00689 };
00690
00691 #include "igb_82575.h"
00692
00693
00694 s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
00695 s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
00696
00697 #endif