summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2013-03-28 17:21:44 +0000
committerbrad <brad@openbsd.org>2013-03-28 17:21:44 +0000
commite65efa0e925553ccfaeb71e9876ca86ce82e6626 (patch)
tree0ff8a98316cbd9c32d148b6a91b6ccac15cd4536
parentsys/param.h gets you sys/types.h automatically (diff)
downloadwireguard-openbsd-e65efa0e925553ccfaeb71e9876ca86ce82e6626.tar.xz
wireguard-openbsd-e65efa0e925553ccfaeb71e9876ca86ce82e6626.zip
Let mii_attach() know where the PHY is located instead of scanning
for it since we know where it will be anyway and remove the code from the MII bus read/write functions to force reading/writing from the predetermined location. Copied from bge(4) and this is what the upstream FreeBSD bce(4) driver has done once FreBSD gained a mii_attach(). ok dlg@ sthen@
-rw-r--r--sys/dev/pci/if_bnx.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index 5fb65f7f3de..878791359e1 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnx.c,v 1.100 2013/01/13 05:45:10 brad Exp $ */
+/* $OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -914,7 +914,7 @@ bnx_attachhook(void *xsc)
if (sc->bnx_phy_flags & BNX_PHY_SERDES_FLAG)
mii_flags |= MIIF_HAVEFIBER;
mii_attach(&sc->bnx_dev, &sc->bnx_mii, 0xffffffff,
- MII_PHY_ANY, MII_OFFSET_ANY, mii_flags);
+ sc->bnx_phy_addr, MII_OFFSET_ANY, mii_flags);
if (LIST_FIRST(&sc->bnx_mii.mii_phys) == NULL) {
printf("%s: no PHY found!\n", sc->bnx_dev.dv_xname);
@@ -1100,13 +1100,6 @@ bnx_miibus_read_reg(struct device *dev, int phy, int reg)
u_int32_t val;
int i;
- /* Make sure we are accessing the correct PHY address. */
- if (phy != sc->bnx_phy_addr) {
- DBPRINT(sc, BNX_VERBOSE,
- "Invalid PHY address %d for PHY read!\n", phy);
- return(0);
- }
-
/*
* The BCM5709S PHY is an IEEE Clause 45 PHY
* with special mappings to work with IEEE
@@ -1185,13 +1178,6 @@ bnx_miibus_write_reg(struct device *dev, int phy, int reg, int val)
u_int32_t val1;
int i;
- /* Make sure we are accessing the correct PHY address. */
- if (phy != sc->bnx_phy_addr) {
- DBPRINT(sc, BNX_VERBOSE, "Invalid PHY address %d for PHY write!\n",
- phy);
- return;
- }
-
DBPRINT(sc, BNX_EXCESSIVE, "%s(): phy = %d, reg = 0x%04X, "
"val = 0x%04X\n", __FUNCTION__,
phy, (u_int16_t) reg & 0xffff, (u_int16_t) val & 0xffff);