Bug 81089

Summary: [bge] [patch] FreeBSD 5.4 released version can not use Broadcom NIC 5704
Product: Base System Reporter: fish Hong <fishhong>
Component: amd64Assignee: freebsd-amd64 (Nobody) <amd64>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description fish Hong 2005-05-16 05:20:02 UTC
FreeBSD version 5.4 can not use Broadcom NIC 5704.
FreeBSD version 5.4 RC2 can use Broadcom NIC 5704.
FreeBSD version 5.3 ca use Broadcom NIC 5704.
As we try to find out differenece between of FreeBSD 5.4 & 5.4 RC2.
We find out the different item of  if_bge.c .
The if_bgc.c have the additional item as belows.

diff bge/ orig-bge/
diff bge/if_bge.c orig-bge/if_bge.c
35c35
< __FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.72.2.10 2005/03/22
14:12:31 avatar Exp $");
---
> __FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.72.2.10.2.1 
> 2005/05/06
00:38:51 dwhite Exp $");
3436,3452d3435
<                       /*
<                        * The BCM5704 ASIC appears to have a special
<                        * mechanism for programming the autoneg
<                        * advertisement registers in TBI mode.
<                        */
<                       if (sc->bge_asicrev == BGE_ASICREV_BCM5704) {
<                               uint32_t sgdig;
<                               CSR_WRITE_4(sc, BGE_TX_TBI_AUTONEG, 0);
<                               sgdig = CSR_READ_4(sc, BGE_SGDIG_CFG);
<                               sgdig |= BGE_SGDIGCFG_AUTO|
<                                   BGE_SGDIGCFG_PAUSE_CAP|
<                                   BGE_SGDIGCFG_ASYM_PAUSE;
<                               CSR_WRITE_4(sc, BGE_SGDIG_CFG,
<                                   sgdig|BGE_SGDIGCFG_SEND);
<                               DELAY(5);
<                               CSR_WRITE_4(sc, BGE_SGDIG_CFG, sgdig);
<                       }


If add the addtional item into FreeBSD 5.4 , then do the recomplier the kernel.
FreeBSD 5.4 can use Broadcom NIC 5704

Fix: 

If add the addtional item into the if_bge.c of FreeBSD 5.4 , then do the recomplier the kernel.
FreeBSD 5.4 can use Broadcom NIC 5704


< __FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.72.2.10 2005/03/22
14:12:31 avatar Exp $");
---
> __FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.72.2.10.2.1 
> 2005/05/06
00:38:51 dwhite Exp $");
3436,3452d3435
<                       /*
<                        * The BCM5704 ASIC appears to have a special
<                        * mechanism for programming the autoneg
<                        * advertisement registers in TBI mode.
<                        */
<                       if (sc->bge_asicrev == BGE_ASICREV_BCM5704) {
<                               uint32_t sgdig;
<                               CSR_WRITE_4(sc, BGE_TX_TBI_AUTONEG, 0);
<                               sgdig = CSR_READ_4(sc, BGE_SGDIG_CFG);
<                               sgdig |= BGE_SGDIGCFG_AUTO|
<                                   BGE_SGDIGCFG_PAUSE_CAP|
<                                   BGE_SGDIGCFG_ASYM_PAUSE;
<                               CSR_WRITE_4(sc, BGE_SGDIG_CFG,
<                                   sgdig|BGE_SGDIGCFG_SEND);
<                               DELAY(5);
<                               CSR_WRITE_4(sc, BGE_SGDIG_CFG, sgdig);
<                       }
How-To-Repeat: 1.Use system with Broadcom NIC 5704 to install FreeBSD 5.4.
2.After install finish, use sysinstall to setup network.
3.Broadcom NIC can not get the DHCP.
4.Set the static IP, and the IP can not be used.
Comment 1 fish Hong 2005-05-17 03:25:35 UTC
Hi ,
    I can not reply mail to danny.
So please forward the mail to danny.

THX
Sincerely,
fish

-----Original Message-----
From: fish [mailto:fishhong@nexcom.com.tw] 
Sent: Tuesday, May 17, 2005 10:04 AM
To: 'danny@cs.huji.ac.il'
Subject: amd64/81089: FreeBSD 5.4 released version can not use Broadcom NIC
5704

Hi Danny,
     Good Day.
Here is you want to know.
THX
Sincerely,
fish


Dmesg | grep bge
bg0:<Broadcom 5704S Dual Gigabit Ethernet, ASIC rev. 0x2003> mem
0xfc7c0000-0xfc7cffff,0xfc7d0000-0xfc7dffff irq 28 at device 4.0 on pic1.
Bg1:<Broadcom 5704S Dual Gigabit Ethernet, ASIC rev. 0x2003> mem
0xfc7e0000-0xfc7effff,0xfc7f0000-0xfc7fffff irq 29 at device 4.1 on pic1.


-----Original Message-----
From: Danny Braniss [mailto:danny@cs.huji.ac.il] 
Sent: Monday, May 16, 2005 11:06 PM
To: fish Hong
Subject: Re: amd64/81089: FreeBSD 5.4 released version can not use Broadcom
NIC 5704

could you email me:
	dmesg | grep bge

thanks,
	danny
Comment 2 hma3.gm 2005-07-06 01:13:46 UTC
I'm having the same troubles after updating a Dual AMD64 system to 5.4
stable from 5.3. Looking at your patch, I'm seeing that there is a
diffrence between the if_bge.c files, mine is...

__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.72.2.13 2005/05/22
03:17:49 silby Exp $");

where yours was...
__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.72.2.10.2.1
2005/05/06 00:38:51 dwhite Exp $");

So when I tried to apply the patch, I came up with this error...

../../../dev/bge/if_bge.c: In function `bge_ifmedia_upd':
../../../dev/bge/if_bge.c:3434: warning: 'sc' might be used uninitialized i=
n thi
s function
*** Error code 1

I'm at a loss for what to do, so any help would be great. Here is my dmesg.=
..

Copyright (c) 1992-2005 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD 5.4-STABLE #0: Tue Jul  5 16:03:19 EDT 2005
    root@serverbdb.hogue-school:/usr/src/sys/amd64/compile/DUALAMD64_02
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Opteron(tm) Processor 248 (2191.06-MHz K8-class CPU)
  Origin =3D "AuthenticAMD"  Id =3D 0xf5a  Stepping =3D 10
  Features=3D0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE=
,MCA,CM
OV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>
  AMD Features=3D0xe0500800<SYSCALL,NX,MMX+,LM,3DNow+,3DNow>
real memory  =3D 5368709120 (5120 MB)
avail memory =3D 4116946944 (3926 MB)
ACPI APIC Table: <A M I  OEMAPIC >
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
MADT: Forcing active-low polarity and level trigger for SCI
ioapic0 <Version 1.1> irqs 0-23 on motherboard
ioapic1 <Version 1.1> irqs 24-27 on motherboard
ioapic2 <Version 1.1> irqs 28-31 on motherboard
netsmb_dev: loaded
acpi0: <A M I OEMRSDT> on motherboard
acpi0: Power Button (fixed)
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x5008-0x500b on acpi0
cpu0: <ACPI CPU> on acpi0
acpi_throttle0: <ACPI CPU Throttling> on cpu0
cpu1: <ACPI CPU> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
pci3: <ACPI PCI bus> on pcib1
pci0: <base peripheral, interrupt controller> at device 1.1 (no driver atta=
ched)
pcib2: <ACPI PCI-PCI bridge> at device 2.0 on pci0
pci2: <ACPI PCI bus> on pcib2
mpt0: <LSILogic 1030 Ultra4 Adapter> port 0xe400-0xe4ff mem 0xfe980000-0xfe=
98fff
f,0xfe990000-0xfe99ffff irq 29 at device 1.0 on pci2
mpt1: <LSILogic 1030 Ultra4 Adapter> port 0xe800-0xe8ff mem
0xfe9e0000-0xfe9effff,0xfe9f0000-0xfe9fffff irq 30 at device 1.1 on
pci2
bge0: <Broadcom BCM5704C Dual Gigabit Ethernet, ASIC rev. 0x2002> mem
0xfe9a0000-0xfe9affff,0xfe9b0000-0xfe9bffff irq 31 at device 3.0 on
pci2
miibus0: <MII bus> on bge0
brgphy0: <BCM5704 10/100/1000baseTX PHY> on miibus0
brgphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX,
1000baseTX-FDX, auto
bge0: Ethernet address: 00:00:1a:19:08:b0
bge1: <Broadcom BCM5704C Dual Gigabit Ethernet, ASIC rev. 0x2002> mem
0xfe9c0000-0xfe9cffff,0xfe9d0000-0xfe9dffff irq 28 at device 3.1 on
pci2
miibus1: <MII bus> on bge1
brgphy1: <BCM5704 10/100/1000baseTX PHY> on miibus1
brgphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX,
1000baseTX-FDX, auto
bge1: Ethernet address: 00:00:1a:19:08:b1
pci0: <base peripheral, interrupt controller> at device 2.1 (no driver atta=
ched)
pcib3: <ACPI PCI-PCI bridge> at device 6.0 on pci0
pci1: <ACPI PCI bus> on pcib3
ohci0: <OHCI (generic) USB controller> mem 0xfe3fe000-0xfe3fefff irq
19 at device 0.0 on pci1
usb0: OHCI version 1.0, legacy support
usb0: <OHCI (generic) USB controller> on ohci0
usb0: USB revision 1.0
uhub0: AMD OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 3 ports with 3 removable, self powered
ohci1: <OHCI (generic) USB controller> mem 0xfe3ff000-0xfe3fffff irq
19 at device 0.1 on pci1
usb1: OHCI version 1.0, legacy support
usb1: <OHCI (generic) USB controller> on ohci1
usb1: USB revision 1.0
uhub1: AMD OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 3 ports with 3 removable, self powered
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <AMD 8111 UDMA133 controller> port 0xffa0-0xffaf,0x376,0x170-0x177=
,0x3f
6,0x1f0-0x1f7 at device 7.1 on pci0
ata0: channel #0 on atapci0
ata1: channel #1 on atapci0
pci0: <bridge> at device 7.3 (no driver attached)
acpi_button0: <Power Button> on acpi0
sio0: configured irq 4 not in bitmap of probed irqs 0
sio0: port may not be enabled
sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acp=
i0
sio0: type 16550A, console
orm0: <ISA Option ROM> at iomem 0xc8000-0xcbfff on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x64,0x60 on isa0
sio1: configured irq 3 not in bitmap of probed irqs 0
sio1: port may not be enabled
Timecounters tick every 1.000 msec
acd0: CDROM <SAMSUNG CD-ROM SN-124/S003> at ata1-slave PIO4
Waiting 15 seconds for SCSI devices to settle
ses0 at mpt1 bus 0 target 8 lun 0
ses0: <SDR GEM318P 1> Fixed Processor SCSI-2 device
ses0: 3.300MB/s transfers
ses0: SAF-TE Compliant Device
SMP: AP CPU #1 Launched!
da0 at mpt1 bus 0 target 0 lun 0
da0: <FUJITSU MAP3735NC 0108> Fixed Direct Access SCSI-3 device
da0: 320.000MB/s transfers (160.000MHz, offset 127, 16bit), Tagged
Queueing Enabled
da0: 70103MB (143571316 512 byte sectors: 255H 63S/T 8936C)
da1 at mpt1 bus 0 target 1 lun 0
da1: <FUJITSU MAP3735NC 0108> Fixed Direct Access SCSI-3 device
da1: 320.000MB/s transfers (160.000MHz, offset 127, 16bit), Tagged
Queueing Enabled
da1: 70103MB (143571316 512 byte sectors: 255H 63S/T 8936C)
Mounting root from ufs:/dev/gvinum/root

-hma3
Comment 3 Tilman Keskinoz freebsd_committer freebsd_triage 2006-01-17 13:50:29 UTC
State Changed
From-To: open->closed

This was fixed in if_bge.c's r1.91 and 1.72.2.14 of RELENG_5. 

Please update to a recent RELENG_5 or 6.0.