using dev nameunit prior to probe & attach in pcib_alloc_resource()

From: Jia-Shiun Li <jiashiun_at_gmail.com>
Date: Fri, 13 Oct 2006 05:04:54 +0800
This is a cosmetic bug (probably).

I noticed that pcib prints some null pointer string in verbose dmesg
like the following example. The pcib driver prints "(null) requested
memory...". It turns out that pcib_alloc_resource() intended to use
dev->nameunit to show device name. But the function is called for the
first time during pci bus device enumeration. By the time the driver
probing function is not called yet, and hence no valid nameunit.

I suppose this code fragment in pcib_alloc_resource():

                if (bootverbose)
                        device_printf(dev,"%s requested memory range "
                            "0x%lx-0x%lx: good\n",
                            device_get_nameunit(child), start, end);

should be changed to use something else, for example pci device(slot)
and function numbers, to identify the newly enumerated and yet probed
pci devices. Any comment?

The verbose dmesg example:

pcib3: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pcib3:   secondary bus     1
pcib3:   subordinate bus   1
pcib3:   I/O decode        0xc000-0xcfff
pcib3:   memory decode     0xdec00000-0xdeefffff
pcib3:   prefetched decode 0xdf000000-0xdfffffff
pcib3:   Subtractively decoded bridge.
pci1: <ACPI PCI bus> on pcib3
pci1: physical bus=1
found-> vendor=0x1039, dev=0x6326, revid=0x0b
        bus=1, slot=9, func=0
        class=03-00-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0007, statreg=0x0230, cachelnsz=0 (dwords)
        lattimer=0x40 (1920 ns), mingnt=0x02 (500 ns), maxlat=0x00 (0 ns)
        powerspec 1  supports D0 D2 D3  current D0
        map[10]: type 3, range 32, base df000000, size 23, enabled
pcib3: (null) requested memory range 0xdf000000-0xdf7fffff: good
        map[14]: type 1, range 32, base decf0000, size 16, enabled
pcib3: (null) requested memory range 0xdecf0000-0xdecfffff: good
        map[18]: type 4, range 32, base 0000c400, size  7, enabled
pcib3: (null) requested I/O range 0xc400-0xc47f: in range
found-> vendor=0x8086, dev=0x1229, revid=0x02
        bus=1, slot=10, func=0
        class=02-00-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0007, statreg=0x0280, cachelnsz=0 (dwords)
        lattimer=0x40 (1920 ns), mingnt=0x08 (2000 ns), maxlat=0x38 (14000 ns)
        intpin=a, irq=5
        map[10]: type 3, range 32, base dffff000, size 12, enabled
pcib3: (null) requested memory range 0xdffff000-0xdfffffff: good
        map[14]: type 4, range 32, base 0000c800, size  5, enabled
pcib3: (null) requested I/O range 0xc800-0xc81f: in range
        map[18]: type 1, range 32, base dee00000, size 20, enabled
pcib3: (null) requested memory range 0xdee00000-0xdeefffff: good
pcib3: matched entry for 1.10.INTA
pcib3: slot 10 INTA hardwired to IRQ 21
vgapci0: <VGA-compatible display> port 0xc400-0xc47f mem
0xdf000000-0xdf7fffff,0xdecf0000-0xdecfffff at device 9.0 o
n pci1
fxp0: <Intel 82557 Pro/100 Ethernet> port 0xc800-0xc81f mem
0xdffff000-0xdfffffff,0xdee00000-0xdeefffff irq 21 at de
vice 10.0 on pci1
fxp0: Reserved 0x1000 bytes for rid 0x10 type 3 at 0xdffff000
fxp0: using memory space register mapping
fxp0: PCI IDs: 8086 1229 0000 0000 0002
fxp0: Dynamic Standby mode is disabled
miibus0: <MII bus> on fxp0
amphy0: <Am79C873 10/100 media interface> on miibus0
amphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fxp0: bpf attached
fxp0: Ethernet address: 00:c0:0c:70:10:05
ioapic0: routing intpin 21 (PCI IRQ 21) to vector 49
fxp0: [MPSAFE]

Jia-Shiun.
Received on Thu Oct 12 2006 - 19:05:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:01 UTC