Comment 3 for bug 1338412

Revision history for this message
Alex Hung (alexhung) wrote :

This is a common error and I quote Ivan's analysis on a private bug:
=========================================================
More detail information,
This is caused by the wmi driver(hp-wmi.c) brings the input data 160bits
struct bios_args {
u32 signature;
u32 command;
u32 commandtype;
u32 datasize;
u32 data; --- 4 bytes data
};
into the the acpi method HWMC as Arg1,
    Method (HWMC, 2, NotSerialized)
    {
        CreateDWordField (Arg1, Zero, SGIN)
        CreateDWordField (Arg1, 0x04, COMD)
        CreateDWordField (Arg1, 0x08, CMDT)
        CreateDWordField (Arg1, 0x0C, DSZI)
        CreateByteField (Arg1, 0x10, D008)
        CreateByteField (Arg1, 0x11, D009)
        CreateByteField (Arg1, 0x12, D010)
        CreateField (Arg1, 0x80, 0x0400, D128) --- 128 bytes
        .....
     }

the error occurred because the mismatch between the 4bytes "data" provided, but the firmware 128 bytes "D128" used.
checking with the HP wmi spec, several wmi command type used input date 128 bytes (such as type 36h, Set Peak Shift Times, type 37h Set Battery Charging Times). But this is not used by the hp-wmi.c. It is not reasonable to CreateField for 128bytes at the method beginning, in stead, it should be createfielded while it is used.
So I suggest the firmware should move the
        CreateField (Arg1, 0x80, 0x0400, D128)
into the place that D128 is used, such as the type 36h, 37h.
                        If (LEqual (CMDT, 0x36))
                        {
move to here ---- CreateField (Arg1, 0x80, 0x0400, D128)
                            Store (\_SB.WMID.SPST (D128), Local2)
                            Store (Zero, RETC)
                        }

                        If (LEqual (CMDT, 0x37))
                        {
move to here --- CreateField (Arg1, 0x80, 0x0400, D128)
                            Store (\_SB.WMID.SBCT (D128), Local2)
                            Store (Zero, RETC)
                        }
=========================================================