qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 repost 2/9] i386: add ACPI table files from s


From: Hu Tao
Subject: Re: [Qemu-devel] [PATCH v2 repost 2/9] i386: add ACPI table files from seabios
Date: Mon, 15 Jul 2013 15:49:18 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jul 10, 2013 at 04:51:38PM +0300, Michael S. Tsirkin wrote:

<...>

> diff --git a/hw/i386/ssdt-misc.dsl b/hw/i386/ssdt-misc.dsl
> new file mode 100644
> index 0000000..ac11e96
> --- /dev/null
> +++ b/hw/i386/ssdt-misc.dsl
> @@ -0,0 +1,73 @@
> +/*
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> +
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> +
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +ACPI_EXTRACT_ALL_CODE ssdp_misc_aml
> +
> +DefinitionBlock ("ssdt-misc.aml", "SSDT", 0x01, "BXPC", "BXSSDTSUSP", 0x1)
> +{
> +
> +/****************************************************************
> + * PCI memory ranges
> + ****************************************************************/
> +
> +    Scope(\) {
> +       ACPI_EXTRACT_NAME_DWORD_CONST acpi_pci32_start
> +       Name(P0S, 0x12345678)
> +       ACPI_EXTRACT_NAME_DWORD_CONST acpi_pci32_end
> +       Name(P0E, 0x12345678)
> +       ACPI_EXTRACT_NAME_BYTE_CONST acpi_pci64_valid
> +       Name(P1V, 0x12)
> +       ACPI_EXTRACT_NAME_BUFFER8 acpi_pci64_start
> +       Name(P1S, Buffer() { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
> +       ACPI_EXTRACT_NAME_BUFFER8 acpi_pci64_end
> +       Name(P1E, Buffer() { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
> +       ACPI_EXTRACT_NAME_BUFFER8 acpi_pci64_length
> +       Name(P1L, Buffer() { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
> +    }
> +
> +
> +/****************************************************************
> + * Suspend
> + ****************************************************************/
> +
> +    Scope(\) {
> +    /*
> +     * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type 
> codes:
> +     * must match piix4 emulation.
> +     */
> +
> +        ACPI_EXTRACT_NAME_STRING acpi_s3_name
> +        Name(_S3, Package(0x04) {
> +            One,  /* PM1a_CNT.SLP_TYP */
> +            One,  /* PM1b_CNT.SLP_TYP */
> +            Zero,  /* reserved */
> +            Zero   /* reserved */
> +        })
> +        ACPI_EXTRACT_NAME_STRING acpi_s4_name
> +        ACPI_EXTRACT_PKG_START acpi_s4_pkg
> +        Name(_S4, Package(0x04) {
> +            0x2,  /* PM1a_CNT.SLP_TYP */
> +            0x2,  /* PM1b_CNT.SLP_TYP */
> +            Zero,  /* reserved */
> +            Zero   /* reserved */
> +        })
> +        Name(_S5, Package(0x04) {
> +            Zero,  /* PM1a_CNT.SLP_TYP */
> +            Zero,  /* PM1b_CNT.SLP_TYP */
> +            Zero,  /* reserved */
> +            Zero   /* reserved */
> +        })
> +    }

Device(PEVT) is lost here, but added back in patch 9/9.

> +}

<...>

> diff --git a/scripts/acpi_extract.py b/scripts/acpi_extract.py
> new file mode 100755
> index 0000000..fbedc6b
> --- /dev/null
> +++ b/scripts/acpi_extract.py
> @@ -0,0 +1,362 @@
> +#!/usr/bin/python
> +# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <address@hidden>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License along
> +# with this program; if not, see <http://www.gnu.org/licenses/>.
> +
> +# Process mixed ASL/AML listing (.lst file) produced by iasl -l
> +# Locate and execute ACPI_EXTRACT directives, output offset info
> +# 

Trailing space here,

> +# Documentation of ACPI_EXTRACT_* directive tags:
> +# 

here,

> +# These directive tags output offset information from AML for BIOS runtime
> +# table generation.
> +# Each directive is of the form:
> +# ACPI_EXTRACT_<TYPE> <array_name> <Operator> (...)
> +# and causes the extractor to create an array
> +# named <array_name> with offset, in the generated AML,
> +# of an object of a given type in the following <Operator>.
> +# 

here,

> +# A directive must fit on a single code line.
> +# 

here,

> +# Object type in AML is verified, a mismatch causes a build failure.
> +# 

here,
> +# Directives and operators currently supported are:
> +# ACPI_EXTRACT_NAME_DWORD_CONST - extract a Dword Const object from Name()
> +# ACPI_EXTRACT_NAME_WORD_CONST - extract a Word Const object from Name()
> +# ACPI_EXTRACT_NAME_BYTE_CONST - extract a Byte Const object from Name()
> +# ACPI_EXTRACT_METHOD_STRING - extract a NameString from Method()
> +# ACPI_EXTRACT_NAME_STRING - extract a NameString from Name()
> +# ACPI_EXTRACT_PROCESSOR_START - start of Processor() block
> +# ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor()
> +# ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1
> +# ACPI_EXTRACT_PKG_START - start of Package block
> +#
> +# ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode
> +# 

here,

> +# ACPI_EXTRACT is not allowed anywhere else in code, except in comments.
> +
> +import re;
> +import sys;
> +import fileinput;
> +
> +aml = []
> +asl = []
> +output = {}
> +debug = ""
> +
> +class asl_line:
> +    line = None
> +    lineno = None
> +    aml_offset = None
> +
> +def die(diag):
> +    sys.stderr.write("Error: %s; %s\n" % (diag, debug))
> +    sys.exit(1)
> +    

and here.

> +#Store an ASL command, matching AML offset, and input line (for debugging)
> +def add_asl(lineno, line):
> +    l = asl_line()
> +    l.line = line
> +    l.lineno = lineno
> +    l.aml_offset = len(aml)
> +    asl.append(l)

<...>


Otherwise,

Reviewed-by: Hu Tao <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]