reedwind / lib

0 stars 0 forks source link

Bug 724 - Scope forward reference should be warning, not error #248

Closed reedwind closed 11 years ago

reedwind commented 11 years ago

Reported by: Mitch Bradley wmb@firmworks.com Reported at: 2008-06-19 19:20:34

Product: ACPICA Component: iASL Compiler Platform: All OS: Linux Priority: P3 Severity: normal

reedwind commented 11 years ago

Commented by: Mitch Bradley wmb@firmworks.com Commented at: 2008-06-19 19:20:34

Bug detailed description:

Treating a scope forward reference as an error instead of a warning is too severe, because of the following use case.

Suppose that you want to use an SSDT to add additional devices to a scope (for example "_SB.PCI0" that is defined in the DSDT. Operationally, that should work, because scope already exists when the SSDT is interpreted, iasl won't let you do it, because the "separate compilation" of the SSDT doesn't know what has already been defined in the DSDT.

The Microsoft compiler does the right thing, issuing a warning message but still generating (correct) code.

The fix is simple - just replace "ASL_ERROR" with "ASL_WARNING" in the following lines of aslload.c :

           AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,

... AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op,

Reproduce steps:

iasl won't generate an output file for the following, but Microsoft asl will:

DefinitionBlock ("ssdt.aml", "SSDT", 3, "OLPC ", "XO-1 ", 0x00001000) { Scope (_SB.PCI0) { } }

Current result:

Expected result:

Basic root-causing log:

reedwind commented 11 years ago

Commented by: Bob Moore robert.moore@intel.com Commented at: 2008-06-19 21:52:00

This is the purpose of the External() operator. In the example provided:

DefinitionBlock ("ssdt.aml", "SSDT", 3, "OLPC ", "XO-1 ", 0x00001000) {

External (_SB.PCI0, DeviceObj)

Scope (_SB.PCI0) { } } Intel ACPI Component Architecture ASL Optimizing Compiler version 20080321 [May 9 2008] Copyright (C) 2000 - 2008 Intel Corporation Supports ACPI Specification Revision 3.0a

ASL Input: ssdt.asl - 9 lines, 140 bytes, 1 keywords AML Output: ssdt.aml - 48 bytes, 1 named objects, 0 executable opcodes

Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 0 Optimizations

In general, iASL is much tighter than the MS compiler in many areas of the language; unresolved named references is one of them.

I don't like the fact that 2 errors pop out from the original example code, and this should be fixed. However, without the external, the named reference is in fact unresolved and probably should be an error like all other unresolved references.

reedwind commented 11 years ago

Commented by: Mitch Bradley wmb@firmworks.com Commented at: 2008-06-20 11:11:17

Thanks for the clarification.

Perhaps, while fixing the 2-error thing, the message could be amended to mention External, as a help to future ACPI neophytes.

reedwind commented 11 years ago

Commented by: Bob Moore robert.moore@intel.com Commented at: 2008-06-21 10:28:22

Yes, I'll try to make it clearer.

Thanks for the feedback, feel free to ask questions on the mailing list or submit any problems you may find.