diff options
author | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2006-09-27 15:53:57 -0400 |
---|---|---|
committer | Auke Kok <juke-jan.h.kok@intel.com> | 2006-09-27 15:53:57 -0400 |
commit | caeccb682a2483a79162bb66a431175d4134ae0b (patch) | |
tree | b4f79e694f1cd2332c8294371ba15e1b906f768e | |
parent | 61c2505fd5044d9e108acc6b469d3caa02522043 (diff) |
e1000: add PCI-E capability detection code
Add code to display the detected PCI-E bus width.
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
-rw-r--r-- | drivers/net/e1000/e1000_hw.c | 17 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_hw.h | 6 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 16 |
3 files changed, 35 insertions, 4 deletions
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index dceaf5bd5f5b..48aff8d054f9 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -6556,6 +6556,8 @@ e1000_tbi_adjust_stats(struct e1000_hw *hw, | |||
6556 | void | 6556 | void |
6557 | e1000_get_bus_info(struct e1000_hw *hw) | 6557 | e1000_get_bus_info(struct e1000_hw *hw) |
6558 | { | 6558 | { |
6559 | int32_t ret_val; | ||
6560 | uint16_t pci_ex_link_status; | ||
6559 | uint32_t status; | 6561 | uint32_t status; |
6560 | 6562 | ||
6561 | switch (hw->mac_type) { | 6563 | switch (hw->mac_type) { |
@@ -6565,18 +6567,25 @@ e1000_get_bus_info(struct e1000_hw *hw) | |||
6565 | hw->bus_speed = e1000_bus_speed_unknown; | 6567 | hw->bus_speed = e1000_bus_speed_unknown; |
6566 | hw->bus_width = e1000_bus_width_unknown; | 6568 | hw->bus_width = e1000_bus_width_unknown; |
6567 | break; | 6569 | break; |
6570 | case e1000_82571: | ||
6568 | case e1000_82572: | 6571 | case e1000_82572: |
6569 | case e1000_82573: | 6572 | case e1000_82573: |
6573 | case e1000_80003es2lan: | ||
6570 | hw->bus_type = e1000_bus_type_pci_express; | 6574 | hw->bus_type = e1000_bus_type_pci_express; |
6571 | hw->bus_speed = e1000_bus_speed_2500; | 6575 | hw->bus_speed = e1000_bus_speed_2500; |
6572 | hw->bus_width = e1000_bus_width_pciex_1; | 6576 | ret_val = e1000_read_pcie_cap_reg(hw, |
6577 | PCI_EX_LINK_STATUS, | ||
6578 | &pci_ex_link_status); | ||
6579 | if (ret_val) | ||
6580 | hw->bus_width = e1000_bus_width_unknown; | ||
6581 | else | ||
6582 | hw->bus_width = (pci_ex_link_status & PCI_EX_LINK_WIDTH_MASK) >> | ||
6583 | PCI_EX_LINK_WIDTH_SHIFT; | ||
6573 | break; | 6584 | break; |
6574 | case e1000_82571: | ||
6575 | case e1000_ich8lan: | 6585 | case e1000_ich8lan: |
6576 | case e1000_80003es2lan: | ||
6577 | hw->bus_type = e1000_bus_type_pci_express; | 6586 | hw->bus_type = e1000_bus_type_pci_express; |
6578 | hw->bus_speed = e1000_bus_speed_2500; | 6587 | hw->bus_speed = e1000_bus_speed_2500; |
6579 | hw->bus_width = e1000_bus_width_pciex_4; | 6588 | hw->bus_width = e1000_bus_width_pciex_1; |
6580 | break; | 6589 | break; |
6581 | default: | 6590 | default: |
6582 | status = E1000_READ_REG(hw, STATUS); | 6591 | status = E1000_READ_REG(hw, STATUS); |
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index b9364b5fd76f..434492cc329e 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -418,6 +418,7 @@ void e1000_pci_set_mwi(struct e1000_hw *hw); | |||
418 | void e1000_pci_clear_mwi(struct e1000_hw *hw); | 418 | void e1000_pci_clear_mwi(struct e1000_hw *hw); |
419 | void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); | 419 | void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); |
420 | void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); | 420 | void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); |
421 | int32_t e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value); | ||
421 | /* Port I/O is only supported on 82544 and newer */ | 422 | /* Port I/O is only supported on 82544 and newer */ |
422 | void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value); | 423 | void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value); |
423 | int32_t e1000_disable_pciex_master(struct e1000_hw *hw); | 424 | int32_t e1000_disable_pciex_master(struct e1000_hw *hw); |
@@ -2220,6 +2221,11 @@ struct e1000_host_command_info { | |||
2220 | #define E1000_FACTPS_LAN_FUNC_SEL 0x40000000 | 2221 | #define E1000_FACTPS_LAN_FUNC_SEL 0x40000000 |
2221 | #define E1000_FACTPS_PM_STATE_CHANGED 0x80000000 | 2222 | #define E1000_FACTPS_PM_STATE_CHANGED 0x80000000 |
2222 | 2223 | ||
2224 | /* PCI-Ex Config Space */ | ||
2225 | #define PCI_EX_LINK_STATUS 0x12 | ||
2226 | #define PCI_EX_LINK_WIDTH_MASK 0x3F0 | ||
2227 | #define PCI_EX_LINK_WIDTH_SHIFT 4 | ||
2228 | |||
2223 | /* EEPROM Commands - Microwire */ | 2229 | /* EEPROM Commands - Microwire */ |
2224 | #define EEPROM_READ_OPCODE_MICROWIRE 0x6 /* EEPROM read opcode */ | 2230 | #define EEPROM_READ_OPCODE_MICROWIRE 0x6 /* EEPROM read opcode */ |
2225 | #define EEPROM_WRITE_OPCODE_MICROWIRE 0x5 /* EEPROM write opcode */ | 2231 | #define EEPROM_WRITE_OPCODE_MICROWIRE 0x5 /* EEPROM write opcode */ |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index fd30161d2f12..e2615782966e 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -4473,6 +4473,22 @@ e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) | |||
4473 | pci_write_config_word(adapter->pdev, reg, *value); | 4473 | pci_write_config_word(adapter->pdev, reg, *value); |
4474 | } | 4474 | } |
4475 | 4475 | ||
4476 | int32_t | ||
4477 | e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) | ||
4478 | { | ||
4479 | struct e1000_adapter *adapter = hw->back; | ||
4480 | uint16_t cap_offset; | ||
4481 | |||
4482 | cap_offset = pci_find_capability(adapter->pdev, PCI_CAP_ID_EXP); | ||
4483 | if (!cap_offset) | ||
4484 | return -E1000_ERR_CONFIG; | ||
4485 | |||
4486 | pci_read_config_word(adapter->pdev, cap_offset + reg, value); | ||
4487 | |||
4488 | return E1000_SUCCESS; | ||
4489 | } | ||
4490 | |||
4491 | |||
4476 | void | 4492 | void |
4477 | e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value) | 4493 | e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value) |
4478 | { | 4494 | { |