Commit 857001f0 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

tg3: Improve PCI function number detection.

Simplify the code to detect PCI function number on 5717, 5719, and 5720.
If shared memory does not have proper signature, read the function number
from register directly.
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c86a8560
...@@ -15441,22 +15441,19 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent) ...@@ -15441,22 +15441,19 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent)
&val); &val);
tp->pci_fn = val & 0x7; tp->pci_fn = val & 0x7;
} }
} else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val); GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) ==
NIC_SRAM_CPMUSTAT_SIG) {
tp->pci_fn = val & TG3_CPMU_STATUS_FMSK_5717;
tp->pci_fn = tp->pci_fn ? 1 : 0;
}
} else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) { GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val); tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val);
if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) == if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) != NIC_SRAM_CPMUSTAT_SIG)
NIC_SRAM_CPMUSTAT_SIG) { val = tr32(TG3_CPMU_STATUS);
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
tp->pci_fn = (val & TG3_CPMU_STATUS_FMSK_5717) ? 1 : 0;
else
tp->pci_fn = (val & TG3_CPMU_STATUS_FMSK_5719) >> tp->pci_fn = (val & TG3_CPMU_STATUS_FMSK_5719) >>
TG3_CPMU_STATUS_FSHFT_5719; TG3_CPMU_STATUS_FSHFT_5719;
} }
}
/* Get eeprom hw config before calling tg3_set_power_state(). /* Get eeprom hw config before calling tg3_set_power_state().
* In particular, the TG3_FLAG_IS_NIC flag must be * In particular, the TG3_FLAG_IS_NIC flag must be
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment