[SeaBIOS] Compiling SeaBIOS for coreboot has problems with its ACPI code

Moore, Robert robert.moore at intel.com
Wed Aug 8 16:55:01 CEST 2012


>From what we have seen, standard BIOS code often modifies the AML on the fly (before the OS gets the ACPI tables) to handle the various setup options and other things. Some vendors do this better than others (we've seen checksum errors because of this, as well as package length issues because, for example, a byte constant is replaced by a dword constant but there is no room for the 32-bit value.)

Obviously, the iASL compiler knows the offset of not only the start of every ASL statement, but also the start of every argument of every ASL statement.

What we would be willing to provide is a new type of output file that provides arrays of offsets for you to use when modifying the AML. Something like this should be useful for your project, as well as standard BIOS code that needs this information as well.

The -sc option for iASL already provides a limited version of this, but only at the statement level with offsets within a trailing comment field:

    /*
     *      10....{
     *      11....    Method (MAIN, 0, NotSerialized)
     */
    unsigned char    DSDT_Template_MAIN [] =
    {
        0x14,0x08,0x4D,0x41,0x49,0x4E,0x00,         /* 00000023    "..MAIN." */

    /*
     *      12....    {
     *      13....        Return (Zero)
     */
        0xA4,0x00,                                  /* 00000025    ".." */

A new type of output file could instead create arrays of offsets, one offset per ASL term (statement or argument). The format could be something like one array per ASL statement or one array per method. You could then pick and choose which of these arrays you want to use/include into your BIOS code.

Does this sound like it would solve your issues?

Thanks,
Bob


> -----Original Message-----
> From: Gleb Natapov [mailto:gleb at redhat.com]
> Sent: Tuesday, August 07, 2012 11:00 PM
> To: Moore, Robert
> Cc: Michael S. Tsirkin; Tang, Feng; seabios at seabios.org
> Subject: Re: [SeaBIOS] Compiling SeaBIOS for coreboot has problems with
> its ACPI code
> 
> On Tue, Aug 07, 2012 at 07:34:37PM +0000, Moore, Robert wrote:
> > This is very interesting. If I understand correctly, you are using a
> utility plus various directives to generate tables of AML offsets --
> presumably in order to dynamically change AML values, correct?
> >
> Yes.
> 
> > I have to say that I have not seen anything like this, from any BIOS
> vendor.
> >
> Physical HW is not as dynamic (if at all) as virtualized one. We do not
> want to have separate AML table for each possible HW configuration user
> can create while starting QEMU.
> 
> > > By the way, is there interest in adding some of the functionality
> > > that we get by parsing the listing to iasl directly?
> >
> > We are always interested in adding features to make the compiler more
> useful. What would you suggest?
> >
> The tool depends on the compiler output and thus fragile. It broke with
> new compiler version. It would be nice if compiler had a way to
> generate offsets for us.
> 
> > Bob
> >
> >
> > > -----Original Message-----
> > > From: Michael S. Tsirkin [mailto:mst at redhat.com]
> > > Sent: Sunday, August 05, 2012 1:45 PM
> > > To: Moore, Robert
> > > Cc: Idwer Vollering; Kevin O'Connor; seabios at seabios.org; Tang,
> Feng
> > > Subject: Re: [SeaBIOS] Compiling SeaBIOS for coreboot has problems
> > > with its ACPI code
> > >
> > > On Sun, Aug 05, 2012 at 11:36:15PM +0300, Michael S. Tsirkin wrote:
> > > > On Mon, Jul 30, 2012 at 07:42:48PM +0000, Moore, Robert wrote:
> > > > > Yes, you are correct, the listing no longer includes the
> comments.
> > > > >
> > > > > Sorry for causing you a problem.
> > > > >
> > > > > What is happening is that the preprocessor parser is stripping
> > > > > the
> > > comments during the creation of the .i file. Then, the compiler is
> > > invoked on the .i file -- thus, the comments are gone.
> > > > >
> > > > > This is going to take a bit of work to correct, but we will do
> it.
> > > > >
> > > > > In the meantime, try using the -Pn flag to disable the
> > > preprocessor. When this flag is set, the  preprocessor is
> completely
> > > bypassed and the compiler should function as it did previously.
> > > >
> > > >
> > > > So we are doing it this way meanwhile.  If you change this
> > > > preprocessor behaviour like you indicated you would, please let
> us
> > > > know so e can test.
> > > >
> > > > Thanks!
> > >
> > > By the way, is there interest in adding some of the functionality
> > > that we get by parsing the listing to iasl directly?
> > > Here's what our tool currently supports:
> > >
> > > # Process mixed ASL/AML listing (.lst file) produced by iasl -l #
> > > Locate and execute ACPI_EXTRACT directives, output offset info # #
> > > Documentation of ACPI_EXTRACT_* directive tags:
> > > #
> > > # 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>.
> > > #
> > > # A directive must fit on a single code line.
> > > #
> > > # Object type in AML is verified, a mismatch causes a build
> failure.
> > > #
> > > # 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 # # ACPI_EXTRACT is not allowed anywhere else in code,
> > > except in comments.
> > >
> > >
> > > Example:
> > >
> > >            ACPI_EXTRACT_NAME_DWORD_CONST aml_adr_dword
> > >            Name (_ADR, 0x00010000)
> > >
> > > adds the offset of 0x00010000 constant to array aml_adr_dword
> > >
> > > Example:
> > >
> > >           ACPI_EXTRACT_METHOD_STRING aml_ej0_name
> > >           Method (_EJ0, 1) { Return(PCEJ(0x0001)) }
> > >
> > > adds the offset of _EJ0 string to array aml_ej0_name
> > >
> > > ACPI_EXTRACT_ALL_CODE ssdp_pcihp_aml
> > >
> > > names the array to include the generated AML code
> > >
> > > --
> > > MST
> >
> > _______________________________________________
> > SeaBIOS mailing list
> > SeaBIOS at seabios.org
> > http://www.seabios.org/mailman/listinfo/seabios
> 
> --
> 			Gleb.



More information about the SeaBIOS mailing list