From owner-freebsd-gnome@FreeBSD.ORG Tue Mar 20 17:18:29 2007 Return-Path: X-Original-To: freebsd-gnome@freebsd.org Delivered-To: freebsd-gnome@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7890A16A401 for ; Tue, 20 Mar 2007 17:18:29 +0000 (UTC) (envelope-from jylefort@FreeBSD.org) Received: from host-212-68-244-81.brutele.be (host-212-68-244-81.brutele.be [212.68.244.81]) by mx1.freebsd.org (Postfix) with ESMTP id 0842F13C45E for ; Tue, 20 Mar 2007 17:18:25 +0000 (UTC) (envelope-from jylefort@FreeBSD.org) Received: from jsite.lefort.net (jsite.lefort.net [192.168.1.2]) by gateway.lefort.net (Postfix) with ESMTP id F286954C6; Tue, 20 Mar 2007 18:18:22 +0100 (CET) Received: from jsite.lefort.net (localhost [127.0.0.1]) by jsite.lefort.net (Postfix) with SMTP id B197436; Tue, 20 Mar 2007 18:18:22 +0100 (CET) Date: Tue, 20 Mar 2007 18:18:22 +0100 From: Jean-Yves Lefort To: Nick Withers Message-Id: <20070320181822.c02595b9.jylefort@FreeBSD.org> In-Reply-To: <20070320213838.dbef0f41.nick@nickwithers.com> References: <20070319205346.e5e46409.nick@nickwithers.com> <20070320063524.421ad658.jylefort@FreeBSD.org> <20070320213838.dbef0f41.nick@nickwithers.com> X-Mailer: Sylpheed running on FreeBSD Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Tue__20_Mar_2007_18_18_22_+0100_3dkELgrL8LFq1s.8" Cc: freebsd-gnome@freebsd.org, manphiz@gmail.com Subject: Re: Possible missing file in hal installation X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2007 17:18:29 -0000 --Signature=_Tue__20_Mar_2007_18_18_22_+0100_3dkELgrL8LFq1s.8 Content-Type: multipart/mixed; boundary="Multipart=_Tue__20_Mar_2007_18_18_22_+0100_G5MA_sIPNzrLXyI8" --Multipart=_Tue__20_Mar_2007_18_18_22_+0100_G5MA_sIPNzrLXyI8 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit On Tue, 20 Mar 2007 21:38:38 +1100 Nick Withers wrote: > On Tue, 20 Mar 2007 06:35:24 +0100 > Jean-Yves Lefort wrote: > > > On Mon, 19 Mar 2007 20:53:46 +1100 > > Nick Withers wrote: > > > > > Firstly, I've just pasted the existing thread in from > > > "http://lists.freebsd.org/pipermail/freebsd-gnome/2007-January/016501.html", > > > sorry if I stuffed it up at all and my apologies to those with > > > threaded mail clients... > > > > > > > On Wed, 2007-01-03 at 21:13 +0800, manphiz at gmail.com wrote: > > > > > Joe Marcus Clarke wrote: > > > > > > No, there is nothing useful here. The ktrace looks good. > > > > > > The last thing hald does is read the PCI config registers > > > > > > (part of the initial PCI bus probe). You need to get a > > > > > > full backtrace from hald once it appears to lock up. To do > > > > > > that, you should run hald manually, then use gdb to bind to > > > > > > it once it's locked up. Then get a full backtrace. > > > > > > > > > > > > Joe > > > > > > > > > > > > > > > > > Thanks a lot for the instruction! I attached to the > > > > > deadlocked process, and get this backtrace: > > > > > > > > > > (gdb) bt > > > > > #0 hf_pci_probe () at hf-pci.c:150 > > > > > #1 0x0805ced7 in osspec_probe () at osspec.c:96 > > > > > #2 0x080551dd in main (argc=3, argv=0xbfbfeb5c) at hald.c:578 > > > > > > > > This backtrace doesn't make sense. Line 150 of hf-pci.c is not > > > > in hf_pci_probe(). The real line 150 represents a loop that > > > > iterates through the devices list. This list must be finite. > > > > I don't see how this problem could occur based on this > > > > information. > > > > > > I appear to be in a similar scenario on my HP Compaq Presario > > > B3820 (believe I'm using the latest firmware versions). > > > > > (snip) > > > > If anyone's got an idea or two up their sleeves about how I might > > > go about fixing this, I'd be very grateful to hear about it! > > > > Please install sysutils/pciutils and send me the output of "lspci > > -v". > > With pleasure! > ____ > > presario# lspci -v > pcilib: Bus 02 seen twice (firmware bug). Ignored. > 00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 21) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, fast devsel, latency 0 > Memory at e0000000 (32-bit, prefetchable) > Capabilities: [e4] Vendor Specific Information > Capabilities: [a0] AGP version 2.0 > > 00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 21) (prog-if 00 [Normal decode]) > Flags: bus master, 66MHz, fast devsel, latency 96 > Bus: primary=00, secondary=01, subordinate=01, sec-latency=64 > I/O behind bridge: 00003000-00003fff > Memory behind bridge: d0100000-d01fffff > Prefetchable memory behind bridge: d8000000-dfffffff > > 00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 03) (prog-if 00 [UHCI]) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 0, IRQ 9 > I/O ports at 1800 > > 00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 03) (prog-if 00 [UHCI]) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 0, IRQ 9 > I/O ports at 1820 > > 00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 03) (prog-if 00 [UHCI]) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 0, IRQ 9 > I/O ports at 1840 > > 00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 03) (prog-if 20 [EHCI]) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 0, IRQ 7 > Memory at d0000000 (32-bit, non-prefetchable) > Capabilities: [50] Power Management version 2 > Capabilities: [58] Debug port > > 00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 83) (prog-if 00 [Normal decode]) > Flags: bus master, fast devsel, latency 0 > Bus: primary=00, secondary=02, subordinate=02, sec-latency=64 > I/O behind bridge: 00004000-00004fff > Memory behind bridge: d0200000-d02fffff > > 00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 03) > Flags: bus master, medium devsel, latency 0 > > 00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 03) (prog-if 8a [Master SecP PriP]) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 0, IRQ 255 > I/O ports at > I/O ports at > I/O ports at > I/O ports at > I/O ports at 1860 > > 00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 03) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: medium devsel, IRQ 9 > I/O ports at 1880 > > 00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 03) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 0, IRQ 9 > I/O ports at 1c00 > I/O ports at 18c0 > Memory at d0000c00 (32-bit, non-prefetchable) > Memory at d0000800 (32-bit, non-prefetchable) > Capabilities: [50] Power Management version 2 > > 00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 03) (prog-if 00 [Generic]) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 0, IRQ 9 > I/O ports at 2400 > I/O ports at 2000 > Capabilities: [50] Power Management version 2 > > 01:00.0 VGA compatible controller: ATI Technologies Inc RV350 [Mobility Radeon 9600 M10] (prog-if 00 [VGA]) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, fast Back2Back, 66MHz, medium devsel, latency 66, IRQ 9 > Memory at d8000000 (32-bit, prefetchable) > I/O ports at 3000 > Memory at d0100000 (32-bit, non-prefetchable) > Capabilities: [58] AGP version 2.0 > Capabilities: [50] Power Management version 2 > > 02:07.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev a9) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 32, IRQ 9 > Memory at d0202000 (32-bit, non-prefetchable) > Bus: primary=00, secondary=02, subordinate=02, sec-latency=32 > 16-bit legacy interface ports at 0001 > > 02:07.1 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev a9) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 32, IRQ 9 > Memory at d0203000 (32-bit, non-prefetchable) > Bus: primary=00, secondary=03, subordinate=03, sec-latency=32 > 16-bit legacy interface ports at 0001 > > 02:07.2 FireWire (IEEE 1394): Ricoh Co Ltd R5C552 IEEE 1394 Controller (rev 01) (prog-if 10 [OHCI]) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 64, IRQ 9 > Memory at d0201000 (32-bit, non-prefetchable) > Capabilities: [dc] Power Management version 2 > > 02:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10) > Subsystem: Hewlett-Packard Company Unknown device 3089 > Flags: bus master, medium devsel, latency 64, IRQ 9 > I/O ports at 4000 > Memory at d0201800 (32-bit, non-prefetchable) > Capabilities: [50] Power Management version 2 > > 02:09.0 Network controller: Intel Corporation PRO/Wireless 2200BG Network Connection (rev 05) > Subsystem: Hewlett-Packard Company Unknown device 12f6 > Flags: bus master, medium devsel, latency 64, IRQ 9 > Memory at d0200000 (32-bit, non-prefetchable) > Capabilities: [dc] Power Management version 2 > ____ > > Also, since I forgot last time and in case it's useful, here's a > dmesg: > ____ > > Copyright (c) 1992-2007 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 is a registered trademark of The FreeBSD Foundation. > FreeBSD 6.2-RELEASE-p3 #0: Sun Mar 18 00:29:02 EST 2007 > nick@presario.shmon.net:/usr/obj/usr/src/sys/PRESARIO > Timecounter "i8254" frequency 1193182 Hz quality 0 > CPU: Intel(R) Pentium(R) M processor 1.70GHz (1694.51-MHz 686-class CPU) > Origin = "GenuineIntel" Id = 0x6d6 Stepping = 6 > Features=0xafe9f9bf > Features2=0x180 > real memory = 536281088 (511 MB) > avail memory = 514777088 (490 MB) > kbd1 at kbdmux0 > acpi0: on motherboard > acpi0: Power Button (fixed) > Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000 > acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0 > acpi_ec0: port 0x62,0x66 on acpi0 > cpu0: on acpi0 > acpi_perf0: on cpu0 > acpi_perf0: failed in PERF_STATUS attach > device_attach: acpi_perf0 attach returned 6 > acpi_perf0: on cpu0 > acpi_perf0: failed in PERF_STATUS attach > device_attach: acpi_perf0 attach returned 6 > acpi_throttle0: on cpu0 > acpi_acad0: on acpi0 > battery0: on acpi0 > acpi_lid0: on acpi0 > acpi_button0: on acpi0 > acpi_button1: on acpi0 > pcib0: port 0xcf8-0xcff on acpi0 > pci_link0: BIOS IRQ 10 for 0.29.INTA is invalid > pci_link3: BIOS IRQ 3 for 0.29.INTB is invalid > pci_link2: BIOS IRQ 11 for 0.29.INTC is invalid > pci_link1: BIOS IRQ 5 for 0.31.INTB is invalid > pci0: on pcib0 > agp0: mem 0xe0000000-0xefffffff at device 0.0 on pci0 > pcib1: at device 1.0 on pci0 > pci_link0: BIOS IRQ 10 for 1.0.INTA is invalid > pci1: on pcib1 > drm0: port 0x3000-0x30ff mem 0xd8000000-0xdfffffff,0xd0100000-0xd010ffff irq 9 at device 0.0 on pci1 > info: [drm] AGP at 0xe0000000 256MB > info: [drm] Initialized radeon 1.24.0 20060225 > uhci0: port 0x1800-0x181f irq 9 at device 29.0 on pci0 > uhci0: [GIANT-LOCKED] > usb0: on uhci0 > usb0: USB revision 1.0 > uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 > uhub0: 2 ports with 2 removable, self powered > uhci1: port 0x1820-0x183f irq 9 at device 29.1 on pci0 > uhci1: [GIANT-LOCKED] > usb1: on uhci1 > usb1: USB revision 1.0 > uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 > uhub1: 2 ports with 2 removable, self powered > uhci2: port 0x1840-0x185f irq 9 at device 29.2 on pci0 > uhci2: [GIANT-LOCKED] > usb2: on uhci2 > usb2: USB revision 1.0 > uhub2: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 > uhub2: 2 ports with 2 removable, self powered > ehci0: mem 0xd0000000-0xd00003ff irq 7 at device 29.7 on pci0 > ehci0: [GIANT-LOCKED] > usb3: EHCI version 1.0 > usb3: companion controllers, 2 ports each: usb0 usb1 usb2 > usb3: on ehci0 > usb3: USB revision 2.0 > uhub3: Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1 > uhub3: 6 ports with 6 removable, self powered > pcib2: at device 30.0 on pci0 > pci_link2: BIOS IRQ 11 for 2.7.INTC is invalid > pci_link1: BIOS IRQ 5 for 2.8.INTA is invalid > pci_link2: BIOS IRQ 11 for 2.9.INTA is invalid > pci2: on pcib2 > cbb0: at device 7.0 on pci2 > cardbus0: on cbb0 > pccard0: <16-bit PCCard bus> on cbb0 > cbb1: at device 7.1 on pci2 > cardbus1: on cbb1 > pccard1: <16-bit PCCard bus> on cbb1 > fwohci0: mem 0xd0201000-0xd02017ff irq 9 at device 7.2 on pci2 > fwohci0: OHCI version 1.0 (ROM=1) > fwohci0: No. of Isochronous channels is 4. > fwohci0: EUI64 10:cf:fd:00:00:13:93:66 > fwohci0: Phy 1394a available S400, 2 ports. > fwohci0: Link S400, max_rec 2048 bytes. > firewire0: on fwohci0 > fwohci0: Initiate bus reset > fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode > firewire0: 1 nodes, maxhop <= 0, cable IRM = 0 (me) > firewire0: bus manager 0 (me) > rl0: port 0x4000-0x40ff mem 0xd0201800-0xd02018ff irq 9 at device 8.0 on pci2 > miibus0: on rl0 > rlphy0: on miibus0 > rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto > rl0: Ethernet address: 00:13:21:10:b0:77 > iwi0: mem 0xd0200000-0xd0200fff irq 9 at device 9.0 on pci2 > iwi0: Ethernet address: 00:0e:35:d6:8b:3f > isab0: at device 31.0 on pci0 > isa0: on isab0 > atapci0: port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x1860-0x186f at device 31.1 on pci0 > ata0: on atapci0 > ata1: on atapci0 > pci0: at device 31.3 (no driver attached) > pcm0: port 0x1c00-0x1cff,0x18c0-0x18ff mem 0xd0000c00-0xd0000dff,0xd0000800-0xd00008ff irq 9 at device 31.5 on pci0 > pcm0: > pci0: at device 31.6 (no driver attached) > acpi_tz0: on acpi0 > atkbdc0: port 0x60,0x64 irq 1 on acpi0 > atkbd0: irq 1 on atkbdc0 > kbd0 at atkbd0 > atkbd0: [GIANT-LOCKED] > psm0: irq 12 on atkbdc0 > psm0: [GIANT-LOCKED] > psm0: model Generic PS/2 mouse, device ID 0 > pmtimer0 on isa0 > orm0: at iomem 0xc0000-0xcffff,0xd0000-0xd0fff,0xdf000-0xdffff,0xe0000-0xe3fff on isa0 > sc0: at flags 0x100 on isa0 > sc0: VGA <16 virtual consoles, flags=0x300> > vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 > ukbd0: Logitech Logitech USB Keyboard, rev 1.10/15.00, addr 2, iclass 3/1 > kbd2 at ukbd0 > uhid0: Logitech Logitech USB Keyboard, rev 1.10/15.00, addr 2, iclass 3/1 > ums0: Logitech USB-PS/2 Optical Mouse, rev 2.00/21.00, addr 2, iclass 3/1 > ums0: 8 buttons and Z dir. > Timecounter "TSC" frequency 1694511574 Hz quality 800 > Timecounters tick every 1.000 msec > ipfw2 (+ipv6) initialized, divert loadable, rule-based forwarding disabled, default to deny, logging limited to 1000 packets/entry by default > ad0: 57231MB at ata0-master UDMA100 > cpu0: Cx states changed > acd0: FAILURE - MODE_SENSE_BIG timed out > acd0: DVDR at ata1-master UDMA33 > cd0 at ata1 bus 0 target 0 lun 0 > cd0: Removable CD-ROM SCSI-0 device > cd0: 33.000MB/s transfers > cd0: cd present [3474532 x 2048 byte records] > Trying to mount root from ufs:/dev/ad0s1a The attached patch should fix the problem. Please test it. -- Jean-Yves Lefort jylefort@FreeBSD.org http://lefort.be.eu.org/ --Multipart=_Tue__20_Mar_2007_18_18_22_+0100_G5MA_sIPNzrLXyI8 Content-Type: text/plain; name="hal-pci.diff" Content-Disposition: attachment; filename="hal-pci.diff" Content-Transfer-Encoding: quoted-printable Index: hald/freebsd/hf-pci.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /space/cvs/marcuscom-cvs/hal/hald/freebsd/hf-pci.c,v retrieving revision 1.23 diff -u -r1.23 hf-pci.c --- hald/freebsd/hf-pci.c 5 Nov 2006 21:21:45 -0000 1.23 +++ hald/freebsd/hf-pci.c 20 Mar 2007 17:15:56 -0000 @@ -3,7 +3,7 @@ * * hf-pci.c : enumerate PCI devices * - * Copyright (C) 2006 Jean-Yves Lefort + * Copyright (C) 2006, 2007 Jean-Yves Lefort * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ =20 #include #include +#include #include #include #include @@ -48,11 +49,16 @@ =20 /* from sys/dev/pci/pcireg.h */ #define PCIR_SECBUS_1 0x19 +#define PCIR_HDRTYPE 0x0e +#define PCIM_HDRTYPE_BRIDGE 0x01 +#define PCIM_HDRTYPE_CARDBUS 0x02 =20 typedef struct { + HalDevice *device; struct pci_conf p; int secondary_bus; + int header_type; } DeviceInfo; =20 static int hf_pci_fd; @@ -140,73 +146,41 @@ HAL_INFO(("unable to open %s: %s", HF_PCI_DEVICE, g_strerror(errno))); } =20 -static GSList * -hf_pci_lookup (GSList *devices, int bus) -{ - if (bus !=3D 0) - { - GSList *l; - - HF_LIST_FOREACH(l, devices) - { - DeviceInfo *info =3D l->data; - - if (info->secondary_bus =3D=3D bus) - return l; - } - } - - return NULL; -} - -static GSList * -hf_pci_get_root (GSList *devices) -{ - GSList *root; - DeviceInfo *info; - int bus; - - g_return_val_if_fail(devices !=3D NULL, NULL); - - root =3D devices; - info =3D root->data; - - bus =3D info->p.pc_sel.pc_bus; - while (bus !=3D -1) - { - GSList *new_root; - - new_root =3D hf_pci_lookup(devices, bus); - bus =3D -1; - - if (new_root) - { - root =3D new_root; - info =3D root->data; - bus =3D info->p.pc_sel.pc_bus; - } - } - - return root; -} - static void -hf_pci_probe (void) +hf_pci_probe_bus (HalDevice *parent, int bus, bitstr_t *busmap) { + struct pci_match_conf match_conf; struct pci_conf_io pc; struct pci_conf conf[255]; struct pci_conf *p; GSList *devices =3D NULL; + GSList *l; =20 - if (hf_pci_fd < 0) - return; + g_return_if_fail(busmap !=3D NULL); + g_return_if_fail(bus >=3D 0 && bus <=3D 0xff); + + /* test taken from sysutils/pciutils */ + if (bit_test(busmap, bus)) + { + HAL_WARNING(("PCI bus %.2x appearing twice (firmware bug), ignored",= bus)); + return; + } + + bit_set(busmap, bus); =20 start: + memset(&match_conf, 0, sizeof(match_conf)); + match_conf.pc_sel.pc_bus =3D bus; + match_conf.flags =3D PCI_GETCONF_MATCH_BUS; + memset(&pc, 0, sizeof(pc)); + pc.pat_buf_len =3D sizeof(match_conf); + pc.num_patterns =3D 1; + pc.patterns =3D &match_conf; pc.match_buf_len =3D sizeof(conf); pc.matches =3D conf; =20 - /* build a list of PCI devices */ + /* get the devices located on the specified bus */ =20 do { @@ -230,50 +204,64 @@ } =20 for (p =3D conf; p < &conf[pc.num_matches]; p++) - if (! hf_device_store_match(hald_get_gdl(), - hal_property_new_int("pci.freebsd.bus", p->pc_sel.pc_bus), - hal_property_new_int("pci.freebsd.device", p->pc_sel.pc_dev), - hal_property_new_int("pci.freebsd.function", p->pc_sel.pc_func), - NULL)) - { - DeviceInfo *info; - - info =3D g_new(DeviceInfo, 1); - info->p =3D *p; - info->secondary_bus =3D hf_pci_get_register(p, PCIR_SECBUS_1); + { + DeviceInfo *info; + + info =3D g_new(DeviceInfo, 1); + info->device =3D hf_device_store_match(hald_get_gdl(), + hal_property_new_int("pci.freebsd.bus", p->pc_sel.pc_bus), + hal_property_new_int("pci.freebsd.device", p->pc_sel.pc_dev), + hal_property_new_int("pci.freebsd.function", p->pc_sel.pc_func= ), + NULL); + info->p =3D *p; + info->secondary_bus =3D hf_pci_get_register(p, PCIR_SECBUS_1); + info->header_type =3D hf_pci_get_register(p, PCIR_HDRTYPE); =20 - devices =3D g_slist_prepend(devices, info); - } + devices =3D g_slist_prepend(devices, info); + } } while (pc.status =3D=3D PCI_GETCONF_MORE_DEVS); =20 - /* add the devices (parents first) */ + /* add the devices and probe the children of bridges */ =20 - while (devices) + HF_LIST_FOREACH(l, devices) { - GSList *root; - DeviceInfo *info; - HalDevice *parent =3D NULL; + DeviceInfo *info =3D l->data; =20 - root =3D hf_pci_get_root(devices); - g_assert(root !=3D NULL); + /* + * If the device already exists, we are reprobing (from + * osspec_device_reprobe()). In this case we must not add it + * again, but only probe its children if it is a bridge. + */ + if (! info->device) + { + info->device =3D hf_pci_device_new(parent, &info->p, info->secondary_bu= s); + if (hf_device_preprobe(info->device)) + hf_device_add(info->device); + else + continue; /* device ignored */ + } =20 - info =3D root->data; + if (info->header_type =3D=3D PCIM_HDRTYPE_BRIDGE || info->header_typ= e =3D=3D PCIM_HDRTYPE_CARDBUS) + /* a bridge or cardbus, probe its children */ + hf_pci_probe_bus(info->device, info->secondary_bus, busmap); + } =20 - if (info->p.pc_sel.pc_bus !=3D 0) - parent =3D hal_device_store_match_key_value_int(hald_get_gdl(), "pci.free= bsd.secondary_bus", info->p.pc_sel.pc_bus); + /* cleanup */ =20 - if (! parent || ! hal_device_property_get_bool(parent, "info.ignore"= )) - { - HalDevice *device; + g_slist_foreach(devices, (GFunc) g_free, NULL); + g_slist_free(devices); +} =20 - device =3D hf_pci_device_new(parent, &info->p, info->secondary_bus); - hf_device_preprobe_and_add(device); - } +static void +hf_pci_probe (void) +{ + bitstr_t bit_decl(busmap, 256) =3D { 0 }; =20 - devices =3D g_slist_delete_link(devices, root); - g_free(info); - } + if (hf_pci_fd < 0) + return; + + hf_pci_probe_bus(NULL, 0, busmap); } =20 HFHandler hf_pci_handler =3D { --Multipart=_Tue__20_Mar_2007_18_18_22_+0100_G5MA_sIPNzrLXyI8-- --Signature=_Tue__20_Mar_2007_18_18_22_+0100_3dkELgrL8LFq1s.8 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFGABdeyzD7UaO4AGoRAtfUAJ4xAKUgmcctRUBMjaYIyUgGNkgCUgCdHKGz AjvNLtNmi8V9jrIDBVqm5jo= =NHV0 -----END PGP SIGNATURE----- --Signature=_Tue__20_Mar_2007_18_18_22_+0100_3dkELgrL8LFq1s.8--