Subject: Re: ACPI address32 resource support
To: Nicolas Joly <njoly@pasteur.fr>
From: Quentin Garnier <cube@cubidou.net>
List: current-users
Date: 09/24/2007 12:44:06
--SAbzvNCM/REt5CdL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Sep 24, 2007 at 12:17:13PM +0200, Nicolas Joly wrote:
>=20
> Hi,
>=20
> I recently found that some hpet@acpi devices do not attach correctly
> because of missing ACPI address32 resource support.
>=20
> By example, on a Dell Poweredge 860 :
>=20
>  hpet0 at acpi0 (HPET, PNP0103-0)
>  hpet0: unable to find mem register resource
>=20
> I tracked this to our ACPI resource parsing which do not support
> address32 (=3D DWord Address Space Descriptor).
>=20
> sys/dev/acpi/acpi_resource.c:
>         case ACPI_RESOURCE_TYPE_ADDRESS32:
>                 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
>                                      "Address32 unimplemented\n"));
>                 break;
>=20
> And the device require it:
>     Device(HPET) {
>         Name(_HID, 0x0301d041)
>         Name(_UID, 0x0)
>         Name(_STA, 0xb)
>         Name(_CRS, Buffer(0x1c) {0x87, 0x17, 0x0, 0x0, 0xd, 0x1, 0x0, 0x0=
, 0x0, 0x0, 0x0, 0x0, 0xd0, 0xfe, 0xff, 0x3, 0xd0, 0xfe, 0x0, 0x0, 0x0, 0x0=
, 0x0, 0x4, 0x0, 0x0, 0x79, 0x0
>         /* ResourceTemplate() {
>          0x0000  DWordMemory(ResourceConsumer, PosDecode, MinFixed, MaxFi=
xed, NonCacheable, ReadWrite, 0x0, 0xfed00000, 0xfed003ff, 0x0, 0x400, 121,=
 '', AddressRangeMemory, TypeStatic)
>         } */
>          })
>     }
>=20
> The attached patch fix it by addind ACPI address32 resource support
> (fixed size only).
>=20
> hpet0 at acpi0 (HPET, PNP0103-0)
> hpet0: mem 0xfed00000-0xfed003ff
> hpet0: Found 64-bits HPET, will only use lowest 32-bits
> timecounter: Timecounter "hpet0" frequency 14318179 Hz quality 2000
>=20
> I'd like to to commit it, but want some review from an ACPI guru
> before.

It's mostly fine.  I'd add a check that the device is a consumer of the
resource, and looking at FreeBSD's code, they also check the length is
not zero.  Apart from that it's mostly identical.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUBRveU9tgoQloHrPnoAQKY0Qf/bcMExdtTN01xTS/WySmeiOKG94rCgQFJ
EUruxzPrsLexwURNMkw7LVTjKYYgYGM+qIzoVBiGebBAcar33juIS9HBtqHMc84Y
TaQTAyOCD5IwNHvIFo5WSOjhAVlvvVd0VwurjoILGeahmW1fvgEB/P/YXLKYqOAS
l68qFdOC4h7OAT+bSLT8htGcY3xUJMiQ/pO1TEeNpWxv4EXqq0SQra3gTJTOeRYi
8s6em/DuSXo+y2WPaZN2IszawXMOV4OFnkdtF/dv1zfv/jPAOqNqit1GYS8CpIkm
1Z6pUE9n5cQrJvdXQTIWC+NoevSF9JOFr0UsPieUbwLZruP6f7Tx8A==
=Li46
-----END PGP SIGNATURE-----

--SAbzvNCM/REt5CdL--