RE: PROBLEM: Calling ObjectType on buffer field reports type integer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> This looks like a separate problem to me. On the SB2 there is this piece of code,
> simplified:
> 
>      Name(RQBF, Buffer (0xFF) {})
>      CreateByteField (RQBF, 0x03, ALEN)
> 
>      // ...
>      // GenericSerialBus/AttribRawProcessBytes access to fill RQBF
>      // ...
> 
>      If (/* success and everything is valid */)
>      {
>          Local3 = (ALEN * 0x08)
>          CreateField (RQBF, 0x20, Local3, ARB)
>          Local4 = ARB /* \_SB_._SAN.RQSX.ARB_ */
>      }
>      Else
>      {
>          Local4 = 0x01   // or some other error code as integer
>      }
> 
>      // ...
>      // some more stuff
>      // ...
> 
>      If ((ObjectType (Local4) == One /* Integer */))
>      {
>          // notify that an error has occurred
>      }
>      Else
>      {
>          // success and actually use data from Local4
>      }
> 
> The code in question basically unpacks a payload from some other
> management stuff sent over the OperationRegion.
> 
> Here, ALEN is the length of a dynamically sized payload in bytes, which is
> obtained from the data returned by the OperationRegion access. This can for
> example be 4, making the field length 32 bit. So this is not an issue of the field
> length being larger than intmax bits, it actually is sometimes only 32 bits, or 8
> bits, depending on the response of the driver connected to the
> OperationRegion. Also the DSDT depends on that, see the example below.
> 
> Just to reiterate, the code works fine for payloads with ALEN > 8 (so more than
> 8 bytes), but fails for anything less.

Forget what I said in the previous email. You are correct.

They treat bufferfields that are small enough to fit inside of an integer as a buffer or bufferfield.

I did a bunch of testing on windows and determined that, objects created by Create(Bit|Byte|Word|DWord|Qword)Field
work the same way on both interpreters. They get converted to Integers as outlined in the spec.

We simply need to stop perform the BufferField->Integer conversion for buffer fields created by the ASL CreateField() operators.
I'll get a solution hopefully sometime next week..

Thanks,
Erik

> 
> Also note that this is not something that can be fixed by just telling the
> GenericSerialBus/OperationRegion driver to just return 9 bytes
> instead: There are length-checks on Local4 further down the line to validate it
> actually contains what was requested.
> 
> An example of how this piece of code is actually used, if that helps (again
> simplified):
> 
>      Method (RQST, 1)
>      {
>          // pretty much the code above
>          Return (Local4)     // either payload or integer error code
>      }
> 
>      Scope (_SB.BAT1)
>      {
>          Method (_STA, 0)
>          {
>              Local0 = RQST(0x01)     // request battery status
> 
>              If ((ObjectType (Local0) == 0x03))      // is buffer type
>              {
>                  If ((SizeOf (Local0) == 0x04))      // has length 4
>                  {
>                      CreateDWordField (Local0, 0, BAST)
>                      Return (BAST)
>                  }
>              }
> 
>              Return (0x00)           // return default value
>          }
>      }
> 
> 
> Regards,
> Maximilian




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux