On Fri, March 8, 2013 13:42, Martin Pieuchot wrote:
kirby@ reported [0] back in February that the gem(4) on his PowerMac
G5 wasn't working. Apparently the logic to determine which PHY to use
doesn't work with these machines when the firmware has powered down the
chip. At least that's what FreeBSD and linux code say and it seems to
correspond to the behavior I observed: when the NIC is used for
netbooting the correct PHY is attached.
Diff below is taken from FreeBSD and force the use of the internal PHY
on Apple models. This makes the gem(4) on my PowerMac G5 usable even if
I don't netboot. I also verified that it does not introduce a regression
on my G4.
Ok?
My G5's gem now works. Thanks!
gem0 at pci7 dev 15 function 0 Apple K2 GMAC rev 0x00: irq 41, address
00:0a:95:8f:3d:84
brgphy0 at gem0 phy 1: BCM54K2 10/100/1000baseT PHY, rev. 0
No regression on my PoweBook4,3.
[0] http://marc.info/?l=openbsd-miscm=136074529112590w=2
Index: gem.c
===
RCS file: /cvs/src/sys/dev/ic/gem.c,v
retrieving revision 1.98
diff -u -p -r1.98 gem.c
--- gem.c 1 Dec 2012 10:04:58 - 1.98
+++ gem.c 7 Mar 2013 16:52:31 -
@@ -275,11 +275,14 @@ gem_config(struct gem_softc *sc)
MII_OFFSET_ANY, mii_flags);
}
- /*
+ /*
* Fall back on an internal PHY if no external PHY was found.
+ * Note that with Apple (K2) GMACs GEM_MIF_CONFIG_MDI0 can't be
+ * trusted when the firmware has powered down the chip
*/
child = LIST_FIRST(mii-mii_phys);
- if (child == NULL sc-sc_mif_config GEM_MIF_CONFIG_MDI0) {
+ if (child == NULL
+ (sc-sc_mif_config GEM_MIF_CONFIG_MDI0 || GEM_IS_APPLE(sc))) {
sc-sc_mif_config = ~GEM_MIF_CONFIG_PHY_SEL;
bus_space_write_4(sc-sc_bustag, sc-sc_h1,
GEM_MIF_CONFIG, sc-sc_mif_config);
Index: gemvar.h
===
RCS file: /cvs/src/sys/dev/ic/gemvar.h,v
retrieving revision 1.26
diff -u -p -r1.26 gemvar.h
--- gemvar.h 20 Sep 2010 07:40:41 - 1.26
+++ gemvar.h 7 Mar 2013 16:50:39 -
@@ -151,6 +151,10 @@ struct gem_softc {
#define GEM_APPLE_GMAC 3 /* Apple GMAC */
#define GEM_APPLE_K2_GMAC4 /* Apple K2 GMAC */
+#define GEM_IS_APPLE(sc)
\
+ ((sc)-sc_variant == GEM_APPLE_GMAC || \
+ (sc)-sc_variant == GEM_APPLE_K2_GMAC)
+
u_int sc_flags; /* */
#define GEM_GIGABIT 0x0001 /* has a gigabit PHY */