Subject: Re: ACPI and invalid devices
To: Manuel Bouyer <>
From: Quentin Garnier <>
List: port-amd64
Date: 03/09/2007 18:24:59
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Mar 09, 2007 at 05:51:09PM +0100, Manuel Bouyer wrote:
> Hi,
> an ACPI kernel doesn't boot on the dell 2950, it panics in pci_make_tag()
> because this function is called with bus 0 device 0xffff function 0xffff.
> With the attached patch it boots and I didn't notice any bad effects.
> Does it make sense ?

The low word encodes the function, thus the test should against 8.

The reason why this happens is found in DSDT, in method INIS (in scope
\_SB):  it is called by _INI method of \_SB (thus very early), and aims
at deactivating PCIe-to-PCI bridges under some condition.

While it's not a bad idea to sanity check the values we pass to
pci_make_tag, it's probably better to skip the device if it is not
active.  When dev_list is populated in that function, there is a call to
AcpiGetObjectInfo():  you should immediately test for its status before
you go on with it, using the same test you can find in mpacpi_pcibus_cb
(look for ACPI_STA_OK).

That means re-organising the for loop a bit, malloc'ing dev after that

> Index: x86/mpacpi.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=
> RCS file: /cvsroot/src/sys/arch/x86/x86/mpacpi.c,v
> retrieving revision 1.44
> diff -u -r1.44 mpacpi.c
> --- x86/mpacpi.c	16 Nov 2006 01:32:39 -0000	1.44
> +++ x86/mpacpi.c	24 Feb 2007 17:08:46 -0000
> @@ -510,6 +510,9 @@
>  		if (ACPI_FAILURE(rv))
>  			return -1;
> =20
> +		if (ACPI_HIWORD(val) >=3D 32 || ACPI_LOWORD(val) >=3D 32)=20
> +			return -1;
> +
>  		tag =3D pci_make_tag(acpi->sc_pc, bus,
>  		    ACPI_HIWORD(val), ACPI_LOWORD(val));
> =20

Quentin Garnier - -
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.6 (NetBSD)