On Sun, Feb 14, 2010 at 08:36:56PM -0800, bruce wrote:
> I've been trying to get OpenBSD working with a new Dell Inspiron
> Zino, and I've run into what I think may be a bug in mii_physubr.c.
>
> First, the symptoms:
>
> (1) /bsd.rd works just fine. I can use the BCM57780 GigE
> network card as bge0 and reach the network. OpenBSD installs
> correctly.
>
> (2) /bsd panics during bootup. The last lines on console read:
> Starting network
> panic: mii_phy_setmedia
> (and then a warning about reporting errors)
>
> This is with the 4.6 CD set, but I get the same behavior with the
> latest snapshot. Looking at the source code to mii_physubr.c, I
> see that the panic occurs here at line 96:
>
> #ifdef DIAGNOSTIC
> if (ife->ifm_data < 0 || ife->ifm_data >= MII_NMEDIA)
> panic("mii_phy_setmedia");
> #endif
>
> It turns out that in bsd.rd, DIAGNOSTIC is not defined, so
> the section is skipped and everything works. In bsd,
> the value ife->ifm_data is MII_NMEDIA. After a little
> more poking around, I found that ife->ifm_data is set to
> MII_NMEDIA at line 461 of mii_physubr.c:
>
> if (sc->mii_capabilities & BMSR_ANEG) {
> ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst),
> MII_NMEDIA); /* intentionally invalid index */
> }
>
> I've put a bunch of printf's in both places, and I know
> for sure that that section of code, for the BCM57780
> using the bge driver and ukphy, will have BMSR_ANEG set
> in mii_capabilities and will fail in this way.
> BMSR_ANEG is defined in mii.h:
>
> define BMSR_ANEG 0x0008 /* Autonegotiation capable */
>
> Does this mean that if the network device supports Autonegotiation,
> then kernel panic? I can't possibly be reading this right.
Sounds like it is expecting the autonegotiation process to set
ife->ifm_data to the correct value. But the autonegotiation is
failing, incomplete or not being done.
.... Ken
>
> If I comment out the panic, then everything works fine: the OS
> boots, the bge0 device works properly, I can reach the network,
> everything is hunky dory. The system is at least stable
> enough for me to be writing this email. But, I'm now running
> my own hacked kernel, which is a little more bleeding edge
> than I'm used to. So, what's the real bug here?
>
> Thanks,
> -Bruce