Skip to contentSkip to conversation

pcnet32 does not use the PROM address on powerpc

PATCH New Olaf Hering 1 participant 3 messages Oct 8, 2005 – Oct 10, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Does anyone remember why ppc is handled special in pcnet32_probe1()? It as added to Linus tree around 2.6.14, I dont find relevant patches in our bugzilla. It was likely added during early ppc64 bringup.

google doesnt know the patch submitter, perhaps jgarzik has some old records from around 2000/2001?

I have a 44p 270, which gets all 0xFF as MAC address if I power if off and on again. Further reboots do not fix it.
But it does get the correct one if I boot into SMS and do a netboot, further reboots will always get the correct MAC address

I think these 0xFF happen also on other systems, I have seen them on B50 as well. We should just remove the #ifdef.

....

    if (memcmp(promaddr, dev->dev_addr, 6)
        || !is_valid_ether_addr(dev->dev_addr)) {
#ifndef __powerpc__
        if (is_valid_ether_addr(promaddr)) {
#else   
        if (!is_valid_ether_addr(dev->dev_addr)
            && is_valid_ether_addr(promaddr)) {
#endif
            if (pcnet32_debug & NETIF_MSG_PROBE) {
                printk(" warning: CSR address invalid,\n");
                printk(KERN_INFO "    using instead PROM address of");
            }
            memcpy(dev->dev_addr, promaddr, 6);
        }
    }

....

Signature · 2 lines
short story of a lazy sysadmin:
 alias appserv=wotan
#1 lore raw
Quoted 4 lines · Olaf Hering

I have a 44p 270, which gets all 0xFF as MAC address if I power if off and on again. Further reboots do not fix it.
But it does get the correct one if I boot into SMS and do a netboot, further reboots will always get the correct MAC address

The CSR will get the correct value after the first ifup:

(none):/# modprobe -v pcnet32
insmod /lib/modules/2.6.13.3-20051007_rtas-ppc64/kernel/drivers/net/mii.ko 
insmod /lib/modules/2.6.13.3-20051007_rtas-ppc64/kernel/drivers/net/pcnet32.ko 
(none):/# ip link set eth0 up
(none):/# rmmod pcnet32
(none):/# modprobe -v pcnet32
insmod /lib/modules/2.6.13.3-20051007_rtas-ppc64/kernel/drivers/net/mii.ko 
insmod /lib/modules/2.6.13.3-20051007_rtas-ppc64/kernel/drivers/net/pcnet32.ko 
(none):/# dmesg | tail -n 15
pcnet32.c:v1.30j 29.04.2005 [email protected]
PCI: Enabling device: (0000:00:10.0), cmd 143
pcnet32: PCnet/FAST 79C971 at 0xfff400, prom 0004ace4a6d7 csr ffffffffffff, warning: CSR address invalid,
    using instead PROM address of 00 04 ac e4 a6 d7
    tx_start_pt(0x0c00):~220 bytes, BCR18(68e1):BurstWrEn BurstRdEn DWordIO NoUFlow 
    SRAMSIZE=0x7f00, SRAM_BND=0x4000, assigned IRQ 18.
eth0: registered as PCnet/FAST 79C971
pcnet32: 1 cards_found.
eth0: link up, 100Mbps, half-duplex, lpa 0x40A1
pcnet32.c:v1.30j 29.04.2005 [email protected]
pcnet32: PCnet/FAST 79C971 at 0xfff400, prom 0004ace4a6d7 csr 0004ace4a6d7, 00 04 ac e4 a6 d7
    tx_start_pt(0x0c00):~220 bytes, BCR18(68e1):BurstWrEn BurstRdEn DWordIO NoUFlow 
    SRAMSIZE=0x7f00, SRAM_BND=0x4000, assigned IRQ 18.
eth0: registered as PCnet/FAST 79C971
pcnet32: 1 cards_found.
Signature · 2 lines
short story of a lazy sysadmin:
 alias appserv=wotan
#2 lore raw

PATCH 1/1 pcnet32 does not use the PROM address on powerpc

Quoted 6 lines · Olaf Hering
Quoted 4 lines · Olaf Hering

I have a 44p 270, which gets all 0xFF as MAC address if I power if off and on again. Further reboots do not fix it.
But it does get the correct one if I boot into SMS and do a netboot, further reboots will always get the correct MAC address

The CSR contains garbage after a coldboot on RS/6000. One some systems (like my 44p 270) the MAC address is all FF, on others (like my B50) it is ff:ff:ff:fd:ff:6b.

It can eventually be fixed by loading pcnet32, set the interface into the UP state, rmmod pcnet32 and load it again. But this worked only on the 270.

Only netbooting after a cold start provides the correct MAC address via prom and CSR. This makes it very unreliable.
I dont know why the MAC is stored in two different places. Remove the special case for powerpc, which was added in early 2.4 development.

 drivers/net/pcnet32.c |    5 -----
 1 files changed, 5 deletions(-)
drivers/net/pcnet32.c +0 -5
Index: linux-2.6.14-rc3/drivers/net/pcnet32.c
===================================================================
@@ -1172,12 +1172,7 @@ pcnet32_probe1(unsigned long ioaddr, int
 
     if (memcmp(promaddr, dev->dev_addr, 6)
 	|| !is_valid_ether_addr(dev->dev_addr)) {
-#ifndef __powerpc__
 	if (is_valid_ether_addr(promaddr)) {
-#else
-	if (!is_valid_ether_addr(dev->dev_addr)
-	    && is_valid_ether_addr(promaddr)) {
-#endif
 	    if (pcnet32_debug & NETIF_MSG_PROBE) {
 		printk(" warning: CSR address invalid,\n");
 		printk(KERN_INFO "    using instead PROM address of");
Signature · 2 lines
short story of a lazy sysadmin:
 alias appserv=wotan