Re: [PATCH 1/7] em: Print error code and phy/mac type
On Fri, 6 Apr 2018, Jonathan Gray wrote: > On Thu, Apr 05, 2018 at 09:57:17PM +0200, Stefan Fritsch wrote: > > Print the error code if hardware initialization failed. > > > > If EM_DEBUG is defined, print the phy/mac type during attach. > > ok jsg@ > > Though these are just enum values we assign that don't come from the > hardware. > > mac_type is set based on pci product and in some cases revision. > phy_type is mostly set based on hw->phy_id from PHY_ID1/PHY_ID2. My workflow was looking at the code path through the em driver for this hardware, and then look at linux/freebsd what they do differently for the same hardware. Having these two values was necessary for that.
Re: [PATCH 1/7] em: Print error code and phy/mac type
On Thu, Apr 05, 2018 at 09:57:17PM +0200, Stefan Fritsch wrote: > Print the error code if hardware initialization failed. > > If EM_DEBUG is defined, print the phy/mac type during attach. ok jsg@ Though these are just enum values we assign that don't come from the hardware. mac_type is set based on pci product and in some cases revision. phy_type is mostly set based on hw->phy_id from PHY_ID1/PHY_ID2. > --- > sys/dev/pci/if_em.c | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git sys/dev/pci/if_em.c sys/dev/pci/if_em.c > index ec8e35245ef..30df846117c 100644 > --- sys/dev/pci/if_em.c > +++ sys/dev/pci/if_em.c > @@ -557,6 +557,9 @@ em_attach(struct device *parent, struct device *self, > void *aux) > if (!defer) > em_update_link_status(sc); > > +#ifdef EM_DEBUG > + printf(", mac %#x phy %#x", sc->hw.mac_type, sc->hw.phy_type); > +#endif > printf(", address %s\n", ether_sprintf(sc->sc_ac.ac_enaddr)); > > /* Indicate SOL/IDER usage */ > @@ -1860,8 +1863,8 @@ em_hardware_init(struct em_softc *sc) > INIT_DEBUGOUT("\nHardware Initialization Deferred "); > return (EAGAIN); > } > - printf("\n%s: Hardware Initialization Failed\n", > -DEVNAME(sc)); > + printf("\n%s: Hardware Initialization Failed: %d\n", > +DEVNAME(sc), ret_val); > return (EIO); > } > > -- > 2.13.0 >
[PATCH 1/7] em: Print error code and phy/mac type
Print the error code if hardware initialization failed. If EM_DEBUG is defined, print the phy/mac type during attach. --- sys/dev/pci/if_em.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git sys/dev/pci/if_em.c sys/dev/pci/if_em.c index ec8e35245ef..30df846117c 100644 --- sys/dev/pci/if_em.c +++ sys/dev/pci/if_em.c @@ -557,6 +557,9 @@ em_attach(struct device *parent, struct device *self, void *aux) if (!defer) em_update_link_status(sc); +#ifdef EM_DEBUG + printf(", mac %#x phy %#x", sc->hw.mac_type, sc->hw.phy_type); +#endif printf(", address %s\n", ether_sprintf(sc->sc_ac.ac_enaddr)); /* Indicate SOL/IDER usage */ @@ -1860,8 +1863,8 @@ em_hardware_init(struct em_softc *sc) INIT_DEBUGOUT("\nHardware Initialization Deferred "); return (EAGAIN); } - printf("\n%s: Hardware Initialization Failed\n", - DEVNAME(sc)); + printf("\n%s: Hardware Initialization Failed: %d\n", + DEVNAME(sc), ret_val); return (EIO); } -- 2.13.0