On Mon, Jul 30, 2012 at 09:52:18PM +0400, Alexander Polakov wrote:
> Hi,
>
> I started working on porting ACPI WMI (WMI stands for Windows Management
> Instrumentation, it's ACPI extension by Microsoft) driver from NetBSD hoping
> it will help me with my HP Compaq 6910p problem [1].
>
> Currently, device attaches, and I can do some simple stuff, like dumping
> its guids table (and attach dumb acpihp on top of it).
>
> acpiwmi0 at acpi0: ACPI WMI Interface
> acpiwmi0: {5FB7F034-2C63-45E9-BE91-3D44E2C707E4} oid 4141 count 01 flags 02
> acpiwmi0: {95F24279-4D7B-4334-9387-ACCDC67EF61C} oid 0080 count 01 flags 08
> acpiwmi0: {2B814318-4BE8-4707-9D84-A190A859B5D0} oid 00A0 count 01 flags 08
> acpiwmi0: {05901221-D566-11D1-B2F0-00A0C9062910} oid 4241 count 01 flags 00
> acpiwmi0: {1F4C91EB-DC5C-460B-951D-C7CB9B4B8D5E} oid 4142 count 01 flags 02
> acpiwmi0: {2D114B49-2DFB-4130-B8FE-4A3C09E75133} oid 4342 count 35 flags 00
> acpiwmi0: {988D08E3-68F4-4C35-AF3E-6A1B8106F83C} oid 4442 count 14 flags 00
> acpiwmi0: {14EA9746-CE1F-4098-A0E0-7045CB4DA745} oid 4542 count 01 flags 00
> acpiwmi0: {322F2028-0F84-4901-988E-015176049E2D} oid 4642 count 02 flags 00
> acpiwmi0: {8232DE3D-663D-4327-A8F4-E293ADB9BF05} oid 4742 count 00 flags 00
> acpiwmi0: {8F1F6436-9F42-42C8-BADC-0E9424F20C9A} oid 4842 count 00 flags 00
> acpiwmi0: {8F1F6435-9F42-42C8-BADC-0E9424F20C9A} oid 4942 count 00 flags 00
> acpihp0 at acpiwmi0: HP WMI mappings
>
> What really bothers me here is acpi_wmi_init_ec() function, which claims
> to install "address space handler" for the EC space.
>
> Here it is:
>
> static void
> acpi_wmi_init_ec(struct acpi_wmi_softc *sc)
> {
>
>
> rv = AcpiInstallAddressSpaceHandler(sc->sc_node->ad_handle,
> ACPI_ADR_SPACE_EC, acpi_wmi_ec_handler, NULL, sc);
>
> if (ACPI_FAILURE(rv))
> sc->sc_ecdev = NULL;
> }
>
> You can see code for AcpiInstallAddressSpaceHandler() here [2].
>
> The handler itself looks like this:
>
> /*
> * Handler for EC regions, which may be embedded in WMI.
> */
> static int
> acpi_wmi_ec_handler(uint32_t func, ACPI_PHYSICAL_ADDRESS addr,
> uint32_t width, ACPI_INTEGER *val, void *setup, void *aux)
> {
> struct acpi_wmi_softc *sc = aux;
>
> if (aux == NULL || val == NULL)
> return AE_BAD_PARAMETER;
>
> if (addr > 0xFF || width % 8 != 0)
> return AE_BAD_ADDRESS;
>
> switch (func) {
>
> case ACPI_READ:
> (void)acpiec_bus_read(sc->sc_ecdev, addr, val, width);
> break;
>
> case ACPI_WRITE:
> (void)acpiec_bus_write(sc->sc_ecdev, addr, *val, width);
> break;
>
> default:
> return AE_BAD_PARAMETER;
> }
>
> return AE_OK;
> }
>
> My problem is that I can't find something similar in our ACPI stack.
> NetBSD installs address space handler in their EC driver too, but
> OpenBSD doesn't do this. Can I safely ignore this piece of code, or
> is it crucial for properly operating the device?
>
> Begging for a helping hand from ACPI guru.
>
> [1]
> http://old.nabble.com/HP-6910p%3A-keyboard---touchpad-not-working-p34156209.html
> [2]
> http://grok.x12.su/source/xref/netbsd/sys/external/intel-public/acpica/dist/events/evxfregn.c#130
>
It's likely important, so you should probably look for a way to implement the
missing parts.
-ml