Skip to contentSkip to conversation

False positive iasl compiler error on resource object?

Devel Thomas Renninger 2 participants 5 messages Sep 10, 2010

Subsystems (2)
lore
Share & tools
lore

Thomas Renninger

author
#0 lore raw

I have a machine with a _CRS function which shows:

Method (_CRS, 0, NotSerialized)

{
    Name (XY0, ResourceTemplate ()
    {
             WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
                        0x0000,             // Granularity
                        0x0000,             // Range Minimum
                        0x0000,             // Range Maximum
                        0x0000,             // Translation Offset
                        0x0000,             // Length
                        ,, _Y10, TypeStatic)
     }

This produces the compiler error:
DSDT.dsl.orig 2364: 0x0000, // Length
Error 4122 - ^ Invalid combination of Length and Min/Max fixed flags

Because iasl thinks this hits this condition:
Advanced Configuration and Power Interface Specification Revision 3.0b October 10, 2006
6.4.3.5 Address Space Resource Descriptors
Table 6-38 Valid combination of Address Space Descriptors fields ..
_LEN _MIF _MAF Definition
0 1 1 (Illegal combination)

But the _CRS function can still fill up the length of this resource object parts while _CRS gets executed (and the compiler probably does not take this into account), by e.g.:
CreateWordField (XY0, \_SB.PCI0._CRS._Y10._LEN, LEN9) Store (Local0, LEN9)
and the resource, returned to OS, might fulfill the ACPI specification and return a valid length, _MIF, _MAF combination:
_LEN _MIF _MAF Definition

Quoted 1 line

0 1 1 Fixed size, fixed location resource descriptor.

_GRA must be 0 and _LEN must be (_MAX - _MIN +1).

I wonder whether my above assumptions are correct and the
Error 4122 should get removed from the iasl compiler, at least in this case?

Thanks,

Thomas

author
#1 lore raw
Quoted 1 line · On Friday 10 September 2010 11:33:31 Thomas Renninger wrote:

I have a machine with a _CRS function which shows:

Looks like this (wrong?) check got introduced between:
20100304 (does not show the error) and 20100702 (shows this on quite some machines).

Version 20100806 still has this check.

Thomas

#2 lore raw
In reply to Thomas Renninger

We've provided the -cr option to disable the resource descriptor error checking.

This is an interesting problem. On one hand, we would like to provide static (compile time) error checking as much as possible. On the other hand, the resource descriptors (as well as most any other ASL/AML object) can be dynamically changed.

We've seen many ACPI tables with invalid resource descriptors (at both compile time and runtime), and that is the reason the resource descriptor validation was added to the compiler in the first place.

I don't want to just remove this validation, but yes, perhaps iASL should be able to recognize that this descriptor may be modified at runtime and therefore a static validation cannot be performed.

There are at least a few indicators:

1) The descriptor is basically all zeroes
2) There is a CreateXxxField reference to the descriptor
3) There is a Store to the created field

So, perhaps we could detect the above conditions and then disable validation for this particular descriptor. Note, conditions (2) and (3) may be difficult to detect.

I'm open to suggestions.

Bob

Quoted 61 lines

-----Original Message-----
From: devel-bounces(a)acpica.org [mailto:devel-bounces(a)acpica.org] On Behalf Of Thomas Renninger
Sent: Friday, September 10, 2010 2:34 AM
To: devel(a)acpica.org
Cc: linux-acpi(a)vger.kernel.org; bjorn.helgaas(a)hp.com
Subject: [Devel] False positive iasl compiler error on resource object?

I have a machine with a _CRS function which shows:

Method (_CRS, 0, NotSerialized)
{
Name (XY0, ResourceTemplate ()
{
WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
EntireRange,

                       0x0000,             // Granularity
                       0x0000,             // Range Minimum
                       0x0000,             // Range Maximum
                       0x0000,             // Translation Offset
                       0x0000,             // Length
                       ,, _Y10, TypeStatic)
    }

This produces the compiler error:
DSDT.dsl.orig 2364: 0x0000, // Length
Error 4122 - ^ Invalid combination of
Length and Min/Max fixed flags

Because iasl thinks this hits this condition:
Advanced Configuration and Power Interface Specification Revision 3.0b October 10, 2006
6.4.3.5 Address Space Resource Descriptors
Table 6-38 Valid combination of Address Space Descriptors fields ..
_LEN _MIF _MAF Definition
0 1 1 (Illegal combination)

But the _CRS function can still fill up the length of this resource object parts while _CRS gets executed (and the compiler probably does not take this into account), by e.g.:
CreateWordField (XY0, \_SB.PCI0._CRS._Y10._LEN, LEN9) Store (Local0, LEN9)
and the resource, returned to OS, might fulfill the ACPI specification and return a valid length, _MIF, _MAF combination:
_LEN _MIF _MAF Definition

Quoted 1 line

0 1 1 Fixed size, fixed location resource

descriptor.
_GRA must be 0 and _LEN must be
(_MAX - _MIN +1).

I wonder whether my above assumptions are correct and the Error 4122 should get removed from the iasl compiler, at least in this case?

Thanks,

Thomas
_______________________________________________
Devel mailing list
Devel(a)acpica.org
http://lists.acpica.org/listinfo/devel

author
#3 lore raw
Quoted 2 lines · Robert

We've provided the -cr option to disable the resource descriptor error checking.

AFAIK, these zeroed resources that get filled up dynamically later are a rather common construct. If below additional checks cannot be added this (these?) specific resource checks should better get disabled.

Quoted 19 lines

This is an interesting problem. On one hand, we would like to provide static (compile time) error checking as much as possible. On the other hand, the resource descriptors (as well as most any other ASL/AML object) can be dynamically changed.

We've seen many ACPI tables with invalid resource descriptors (at both compile time and runtime), and that is the reason the resource descriptor validation was added to the compiler in the first place.

I don't want to just remove this validation, but yes, perhaps iASL should be able to recognize that this descriptor may be modified at runtime and therefore a static validation cannot be performed.

There are at least a few indicators:

1) The descriptor is basically all zeroes
2) There is a CreateXxxField reference to the descriptor
3) There is a Store to the created field

Quoted 5 lines

So, perhaps we could detect the above conditions and then disable validation for this particular descriptor. Note, conditions (2) and
(3) may be difficult to detect.

I'm open to suggestions.

Not sure whether runtime checks for this exist already. Bjorn has done some great work there in the past.
If not, that should be by far easier, the so called "low hanging fruit"...

Thomas

#4 lore raw

I'd also like to catch the case where a resource descriptor is created with all zeroes, then never referenced.

Quoted 44 lines

-----Original Message-----
From: Thomas Renninger [mailto:trenn(a)suse.de]
Sent: Friday, September 10, 2010 1:19 PM
To: Moore, Robert
Cc: devel(a)acpica.org; linux-acpi(a)vger.kernel.org; bjorn.helgaas(a)hp.com
Subject: Re: [Devel] False positive iasl compiler error on resource object?

Quoted 2 lines · Robert

We've provided the -cr option to disable the resource descriptor error checking.

AFAIK, these zeroed resources that get filled up dynamically later are a rather common construct. If below additional checks cannot be added this (these?) specific resource checks should better get disabled.

Quoted 19 lines

This is an interesting problem. On one hand, we would like to provide static (compile time) error checking as much as possible. On the other hand, the resource descriptors (as well as most any other ASL/AML object) can be dynamically changed.

We've seen many ACPI tables with invalid resource descriptors (at both compile time and runtime), and that is the reason the resource descriptor validation was added to the compiler in the first place.

I don't want to just remove this validation, but yes, perhaps iASL should be able to recognize that this descriptor may be modified at runtime and therefore a static validation cannot be performed.

There are at least a few indicators:

1) The descriptor is basically all zeroes
2) There is a CreateXxxField reference to the descriptor
3) There is a Store to the created field

Quoted 5 lines

So, perhaps we could detect the above conditions and then disable validation for this particular descriptor. Note, conditions (2) and
(3) may be difficult to detect.

I'm open to suggestions.

Not sure whether runtime checks for this exist already. Bjorn has done some great work there in the past.
If not, that should be by far easier, the so called "low hanging fruit"...

Thomas