[SeaBIOS] [PATCH 5/6] acpi_extract: detect DeviceOp

Igor Mammedov imammedo at redhat.com
Tue Jul 31 18:26:18 CEST 2012


On Tue, Jul 31, 2012 at 11:52:12AM +0200, Paolo Bonzini wrote:
> The DeviceOp AML opcode has more or less the same structure as ProcessorOp,
> except that there is no processor ID.
> 
> Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> ---
>  tools/acpi_extract.py |   28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/tools/acpi_extract.py b/tools/acpi_extract.py
> index 81fa4aa..3295678 100755
> --- a/tools/acpi_extract.py
> +++ b/tools/acpi_extract.py
> @@ -164,6 +164,28 @@ def aml_name_word_const(offset):
>  def aml_name_byte_const(offset):
>      return aml_data_byte_const(aml_name_string(offset) + 4)
>  
> +def aml_device_start(offset):
> +    #0x5B 0x82 DeviceOp PkgLength NameString
> +    if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)):
> +        die( "Name offset 0x%x: expected 0x5B 0x82 actual 0x%x 0x%x" %
> +             (offset, aml[offset], aml[offset + 1]));
> +    return offset
> +
> +def aml_device_string(offset):
> +    #0x5B 0x82 DeviceOp PkgLength NameString
> +    start = aml_device_start(offset)
> +    offset += 2
> +    pkglenbytes = aml_pkglen_bytes(offset)
> +    offset += pkglenbytes
> +    return offset
> +
> +def aml_device_end(offset):
> +    start = aml_device_start(offset)
> +    offset += 2
> +    pkglenbytes = aml_pkglen_bytes(offset)
> +    pkglen = aml_pkglen(offset)
> +    return offset + pkglen
> +
>  def aml_processor_start(offset):
>      #0x5B 0x83 ProcessorOp PkgLength NameString ProcID
>      if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x83)):
> @@ -271,6 +293,12 @@ for i in range(len(asl)):
>          offset = aml_name_string(offset)
>      elif (directive == "ACPI_EXTRACT_METHOD_STRING"):
>          offset = aml_method_string(offset)
> +    elif (directive == "ACPI_EXTRACT_DEVICE_START"):
> +        offset = aml_device_start(offset)
> +    elif (directive == "ACPI_EXTRACT_DEVICE_STRING"):
> +        offset = aml_device_string(offset)
> +    elif (directive == "ACPI_EXTRACT_DEVICE_END"):
> +        offset = aml_device_end(offset)
>      elif (directive == "ACPI_EXTRACT_PROCESSOR_START"):
>          offset = aml_processor_start(offset)
>      elif (directive == "ACPI_EXTRACT_PROCESSOR_STRING"):
> -- 
> 1.7.10.4
> 
 
it looks like something I've done before experimenting with containers:
 https://github.com/imammedo/seabios/commit/61b2eb0cecbba06b7a5f47c93a45bde84cafbba9 
 
Acked-By: Igor Mammedov <imammedo at redhat.com>
> _______________________________________________
> SeaBIOS mailing list
> SeaBIOS at seabios.org
> http://www.seabios.org/mailman/listinfo/seabios



More information about the SeaBIOS mailing list