kern/84202: [PR] HT80232 PCI NIC on FreeBSD 5.4-RELEASE
Qiu Quan
jackqqpro at gmail.com
Thu Jul 28 02:40:16 GMT 2005
>Number: 84202
>Category: kern
>Synopsis: [patch] Holtek HT80232 PCI NIC recognition on FreeBSD 5.4-RELEASE
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Jul 28 02:40:15 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: jackqq <jackqqpro at gmail.com>
>Release: FreeBSD 5.4-RELEASE i386
>Organization:
>Environment:
System: FreeBSD jack-qq 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun Jul 24 11:49:30 CST 2005 root at jack-qq:/usr/src/sys/i386/compile/JACKQQ i386
I'm running FreeBSD on my PC having an Intel Tualatin Celeron CPU on an
i815EPT chipset, and a network adapter using Holtek HT80232 chip.
My kernel was customized from GENERIC. (However, even GENERIC failed to
recognize my NIC.) I removed quite a few SCSI/RAID/NIC drivers for
specific vendors/models, leaving only those I'd probably use on my PC.
I also commented out the line for the driver ed(4), which supported my
NIC, in order to test different flags with if_ed.ko. (I didn't quite
know if there was some better way to do this.)
My kernel configuration file is attached below.
>Description:
The Description and Fix sections are excerpted from the posts in the
freebsd-questions mailing list where we discussed this problem.
My ethernet adapter's chip is Holtek's HT80232. It seems to be not
recognized by the GENERIC kernel or any if_*.ko module on FreeBSD
5.4-RELEASE.
I looked for its driver for FreeBSD. Googling "holtek" "ht80232"
"freebsd", I was shown some clues that FreeBSD seemed to support this
chip. The clue was found in /usr/src/share/misc/pci_vendors, where it
said
12C3 Holtek Microelectronics Inc.
0058 HT80232 LAN Adapter (NE2000-compatible)
5598 HT80229 Ethernet Adapter (NE2000-compatible)
Later, I found that the driver ed(4) supported NE2000 NICs, and, it
was included in the GENERIC kernel. But when the machine booting with
GENERIC, the card was not attatched with that driver or even any other
driver. My dmesg(1) is excerpted below:
pcib2: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pcib2: secondary bus 2
pcib2: subordinate bus 2
pcib2: I/O decode 0xc000-0xcfff
pcib2: memory decode 0xee000000-0xefffffff
pcib2: prefetched decode 0xfff00000-0xfffff
pcib2: Subtractively decoded bridge.
ACPI PCI link initial configuration:
pci2: <ACPI PCI bus> on pcib2
pci2: physical bus=2
map[10]: type 1, range 32, base ef000000, size 17, enabled
pcib2: device (null) requested decoded memory range 0xef000000-0xef01ffff
map[14]: type 4, range 32, base 0000c000, size 3, enabled
pcib2: device (null) requested decoded I/O range 0xc000-0xc007
map[18]: type 4, range 32, base 0000c400, size 3, enabled
pcib2: device (null) requested decoded I/O range 0xc400-0xc407
pcib2: matched entry for 2.1.INTA
pcib2: slot 1 INTA hardwired to IRQ 21
found-> vendor=0x12eb, dev=0x0001, revid=0x02
bus=2, slot=1, func=0
class=04-01-00, hdrtype=0x00, mfdev=0
cmdreg=0x0007, statreg=0x0290, cachelnsz=8 (dwords)
lattimer=0x20 (960 ns), mingnt=0x02 (500 ns), maxlat=0x0c (3000 ns)
intpin=a, irq=21
powerspec 1 supports D0 D2 D3 current D0
map[10]: type 4, range 32, base 0000c800, size 6, enabled
pcib2: device (null) requested decoded I/O range 0xc800-0xc83f
pcib2: matched entry for 2.4.INTA
pcib2: slot 4 INTA hardwired to IRQ 18
found-> vendor=0x12c3, dev=0x0058, revid=0x00
bus=2, slot=4, func=0
class=02-00-00, hdrtype=0x00, mfdev=0
cmdreg=0x0003, statreg=0x0280, cachelnsz=0 (dwords)
lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
intpin=a, irq=18
pci2: <multimedia, audio> at device 1.0 (no driver attached)
pci2: <network, ethernet> at device 4.0 (no driver attached)
I noticed that the card was found on pcib2 slot 4, because the vendor
and device codes matched the ones in the FreeBSD source code. Then, I
discovered ed.0 was disabled in /boot/driver.hints, so I modified that
file like this:
# hint.ed.0.at="isa"
# hint.ed.0.disabled="1"
# hint.ed.0.port="0x280"
# hint.ed.0.irq="10"
# hint.ed.0.maddr="0xd8000"
hint.ed.0.at="pci"
However, this didn't work either.
Then, in the reply, Gary gave me some hint of changing flags/hints for
ed(4). I tried setting flags and/or removing hints for ed(4) but it
didn't work. I get the idea from /boot/device.hints that, perhaps not
quite accurately, hints work more with ISA. But my NIC actually belongs
to the PCI family.
The fixes are described in the Fix section.
>How-To-Repeat:
This is a problem involving hardware configuration. So I don't quite
have chances, especially money, to repeat it on different environment.
>Fix:
In /usr/src/sys/dev/ed/if_ed_pci.c, I inserted a line for my card in an
array named pci_ids[], which read
{ 0x005812c3, "NE2000 PCI Ethernet (Holtek HT80232)" },
Finally, I rebuilt the kernel with a dynamic loaded ed(4) driver
(if_ed.ko), which successfully recognized my NIC.
Though without trial, I believe a kernel statically including the
modified ed(4) would also work.
The diff for my modified if_ed_pci.c is attached below.
--- if_ed_pci.c.diff begins here ---
--- /usr/src/sys/dev/ed/if_ed_pci.c.bak Thu Feb 3 06:44:25 2005
+++ /usr/src/sys/dev/ed/if_ed_pci.c Sun Jul 24 11:37:32 2005
@@ -55,6 +55,7 @@
{ 0x19808c4a, "NE2000 PCI Ethernet (Winbond W89C940)" },
{ 0x0e3410bd, "NE2000 PCI Ethernet (Surecom NE-34)" },
{ 0x09261106, "NE2000 PCI Ethernet (VIA VT86C926)" },
+ { 0x005812c3, "NE2000 PCI Ethernet (Holtek HT80232)" },
{ 0x00000000, NULL }
};
--- if_ed_pci.c.diff ends here ---
--- JACKQQ begins here ---
# $Jack-QQ: src/sys/i386/conf/JACKQQ,v 0.1 Sat Jul 24 10:40:52 CST 2005 jackqq Exp $
machine i386
#cpu I486_CPU
#cpu I586_CPU
cpu I686_CPU
ident JACKQQ
# To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" # Default places to look for devices.
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options UFS_ACL # Support for access control lists
options UFS_DIRHASH # Improve performance on big directories
options MD_ROOT # MD is a potential root device
options NFSCLIENT # Network Filesystem Client
options NFSSERVER # Network Filesystem Server
options NFS_ROOT # NFS usable as /, requires NFSCLIENT
options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 Filesystem
options PROCFS # Process filesystem (requires PSEUDOFS)
options PSEUDOFS # Pseudo-filesystem framework
options GEOM_GPT # GUID Partition Tables.
options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!]
options COMPAT_FREEBSD4 # Compatible with FreeBSD4
options SCSI_DELAY=15000 # Delay (in ms) before probing SCSI
options KTRACE # ktrace(1) support
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options AHC_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~128k to driver.
options AHD_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~215k to driver.
options ADAPTIVE_GIANT # Giant mutex is adaptive.
device apic # I/O APIC
# Bus support. Do not remove isa, even if you have no isa slots
device isa
device eisa
device pci
# Floppy drives
device fdc
# ATA and ATAPI devices
device ata
device atadisk # ATA disk drives
device ataraid # ATA RAID drives
device atapicd # ATAPI CDROM drives
device atapifd # ATAPI floppy drives
device atapist # ATAPI tape drives
options ATA_STATIC_ID # Static device numbering
# SCSI peripherals
device scbus # SCSI bus (required for SCSI)
device ch # SCSI media changers
device da # Direct Access (disks)
device sa # Sequential Access (tape etc)
device cd # CD
device pass # Passthrough device (direct SCSI access)
device ses # SCSI Environmental Services (and SAF-TE)
# atkbdc0 controls both the keyboard and the PS/2 mouse
device atkbdc # AT keyboard controller
device atkbd # AT keyboard
device psm # PS/2 mouse
device vga # VGA video card driver
device splash # Splash screen and screen saver support
# syscons is the default console driver, resembling an SCO console
device sc
options SC_ALT_MOUSE_IMAGE # simplified mouse cursor in text mode
options SC_PIXEL_MODE # add support for the raster text mode
device agp # support several AGP chipsets
# Floating point support - do not disable.
device npx
# Power management support (see NOTES for more options)
#device apm
# Add suspend/resume support for the i8254.
device pmtimer
# Serial (COM) ports
device sio # 8250, 16[45]50 based serial ports
# Parallel port
device ppc
device ppbus # Parallel port bus (required)
device lpt # Printer
device plip # TCP/IP over parallel
device ppi # Parallel port interface device
#device vpo # Requires scbus and da
# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device miibus # MII bus support
device re # RealTek 8139C+/8169/8169S/8110S
device rl # RealTek 8129/8139
# ISA Ethernet NICs. pccard NICs included.
# 'device ed' requires 'device miibus'
#device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards
device lnc # NE2100, NE32-VL Lance Ethernet cards
# ISA devices that use the old ISA shims
#device le
# Pseudo devices.
device loop # Network loopback
device mem # Memory and kernel memory devices
device io # I/O device
device random # Entropy device
device ether # Ethernet support
device sl # Kernel SLIP
device ppp # Kernel PPP
device tun # Packet tunnel.
device pty # Pseudo-ttys (telnet etc)
device md # Memory "disks"
device gif # IPv6 and IPv4 tunneling
device faith # IPv6-to-IPv4 relaying (translation)
# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
device bpf # Berkeley packet filter
# USB support
device uhci # UHCI PCI->USB interface
device ohci # OHCI PCI->USB interface
#device ehci # EHCI PCI->USB interface (USB 2.0)
device usb # USB Bus (required)
#device udbp # USB Double Bulk Pipe devices
device ugen # Generic
device uhid # "Human Interface Devices"
device ukbd # Keyboard
device ulpt # Printer
device umass # Disks/Mass storage - Requires scbus and da
device ums # Mouse
device uscanner # Scanners
--- JACKQQ ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list