mirror of
https://github.com/opnsense/src.git
synced 2026-06-04 22:32:43 -04:00
After another thought there is another nail for the mii_phy_dev_probe()-
hammer.
This commit is contained in:
parent
2bf52b991f
commit
2e0b466321
1 changed files with 12 additions and 19 deletions
|
|
@ -82,6 +82,15 @@ DRIVER_MODULE(rlphy, miibus, rlphy_driver, rlphy_devclass, 0, 0);
|
|||
static int rlphy_service(struct mii_softc *, struct mii_data *, int);
|
||||
static void rlphy_status(struct mii_softc *);
|
||||
|
||||
/*
|
||||
* RealTek internal PHYs don't have vendor/device ID registers;
|
||||
* re(4) and rl(4) fake up a return value of all zeros.
|
||||
*/
|
||||
static const struct mii_phydesc rlintphys[] = {
|
||||
{ 0, 0, "RealTek internal media interface" },
|
||||
MII_PHY_END
|
||||
};
|
||||
|
||||
static const struct mii_phydesc rlphys[] = {
|
||||
MII_PHY_DESC(REALTEK, RTL8201L),
|
||||
MII_PHY_END
|
||||
|
|
@ -90,7 +99,6 @@ static const struct mii_phydesc rlphys[] = {
|
|||
static int
|
||||
rlphy_probe(device_t dev)
|
||||
{
|
||||
struct mii_attach_args *ma;
|
||||
const char *nic;
|
||||
int rv;
|
||||
|
||||
|
|
@ -98,25 +106,10 @@ rlphy_probe(device_t dev)
|
|||
if (rv <= 0)
|
||||
return (rv);
|
||||
|
||||
/*
|
||||
* RealTek interal PHYs don't have vendor/device ID registers;
|
||||
* the `re' and `rl' drivers fake up a return value of all zeros.
|
||||
*/
|
||||
ma = device_get_ivars(dev);
|
||||
if (MII_OUI(ma->mii_id1, ma->mii_id2) != 0 ||
|
||||
MII_MODEL(ma->mii_id2) != 0)
|
||||
return (ENXIO);
|
||||
|
||||
/*
|
||||
* Make sure the parent is an `rl' or an `re'.
|
||||
*/
|
||||
nic = device_get_name(device_get_parent(device_get_parent(dev)));
|
||||
if (strcmp(nic, "rl") != 0 && strcmp(nic, "re") != 0)
|
||||
return (ENXIO);
|
||||
|
||||
device_set_desc(dev, "RealTek internal media interface");
|
||||
|
||||
return (BUS_PROBE_DEFAULT);
|
||||
if (strcmp(nic, "rl") == 0 && strcmp(nic, "re") == 0)
|
||||
return (mii_phy_dev_probe(dev, rlintphys, BUS_PROBE_DEFAULT));
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Reference in a new issue