On Thu, Sep 22, 2011 at 12:18:09AM -0400, Kevin O'Connor wrote:
This patch series simplifies the DSDT code. The goal is to separate out the DSDT into different chunks, and to remove some of the duplicated code by using methods.
Kevin O'Connor (4): Delineate ACSP DSL code into sections. Consolidate PCI hotplug definitions together in DSL file. Simplify PCI hotplug acpi macros. Move code from PCI hotplug DSDT macros to methods.
src/acpi-dsdt.dsl | 349 +++++++----- src/acpi-dsdt.hex | 1608 ++++++++++++++++++++++------------------------------- 2 files changed, 875 insertions(+), 1082 deletions(-)
One more simplification patch - this one collapses the PCI IRQ definitions. With the five patches, the acpi-dsdt.dsl code looks like:
acpi-dsdt.dsl | 669 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 310 insertions(+), 359 deletions(-)
The linked in AML code goes from 9609 to 7026 bytes.
-Kevin
From 377ab14226a689e0479b53495840c496e0a91917 Mon Sep 17 00:00:00 2001
From: Kevin O'Connor kevin@koconnor.net Date: Sun, 25 Sep 2011 23:08:58 -0400 Subject: [PATCH] Consolidate DSDT copy-and-paste PCI IRQ code into method calls. To: seabios@seabios.org
Use method calls in LNK[ABCDS] object methods - this reduces the cut-and-paste code. It also makes it simpler and the object size smaller.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/acpi-dsdt.dsl | 320 +++++++++++++++------------------------------------- src/acpi-dsdt.hex | 327 ++++++++++++++++++++++++----------------------------- 2 files changed, 241 insertions(+), 406 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl index e37b2ef..a5f0a4d 100644 --- a/src/acpi-dsdt.dsl +++ b/src/acpi-dsdt.dsl @@ -83,10 +83,7 @@ DefinitionBlock ( #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB) prt_slot0(0x0000), /* Device 1 is power mgmt device, and can only use irq 9 */ - Package() { 0x0001ffff, 0, LNKS, 0 }, - Package() { 0x0001ffff, 1, LNKB, 0 }, - Package() { 0x0001ffff, 2, LNKC, 0 }, - Package() { 0x0001ffff, 3, LNKD, 0 }, + prt_slot(0x0001, LNKS, LNKB, LNKC, LNKD), prt_slot2(0x0002), prt_slot3(0x0003), prt_slot0(0x0004), @@ -619,233 +616,102 @@ DefinitionBlock ( ****************************************************************/
Scope(_SB) { - Field (_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) - { - PRQ0, 8, - PRQ1, 8, - PRQ2, 8, - PRQ3, 8 - } - - Device(LNKA){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 1) - Name(_PRS, ResourceTemplate(){ - Interrupt (, Level, ActiveHigh, Shared) - { 5, 10, 11 } - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ0, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ0, 0x80, PRQ0) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - Interrupt (, Level, ActiveHigh, Shared) - {1} - }) - CreateDWordField (PRR0, 0x05, TMP) - Store (PRQ0, Local0) - If (LLess (Local0, 0x80)) - { - Store (Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } - Method (_SRS, 1, NotSerialized) - { - CreateDWordField (Arg0, 0x05, TMP) - Store (TMP, PRQ0) - } + Field (PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) + { + PRQ0, 8, + PRQ1, 8, + PRQ2, 8, + PRQ3, 8 } - Device(LNKB){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 2) - Name(_PRS, ResourceTemplate(){ - Interrupt (, Level, ActiveHigh, Shared) - { 5, 10, 11 } - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ1, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ1, 0x80, PRQ1) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - Interrupt (, Level, ActiveHigh, Shared) - {1} - }) - CreateDWordField (PRR0, 0x05, TMP) - Store (PRQ1, Local0) - If (LLess (Local0, 0x80)) - { - Store (Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } - Method (_SRS, 1, NotSerialized) - { - CreateDWordField (Arg0, 0x05, TMP) - Store (TMP, PRQ1) - } + + Method (IQST, 1, NotSerialized) { + // _STA method - get status + If (And (0x80, Arg0)) { + Return (0x09) + } + Return (0x0B) } - Device(LNKC){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 3) - Name(_PRS, ResourceTemplate(){ - Interrupt (, Level, ActiveHigh, Shared) - { 5, 10, 11 } - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ2, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ2, 0x80, PRQ2) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - Interrupt (, Level, ActiveHigh, Shared) - {1} - }) - CreateDWordField (PRR0, 0x05, TMP) - Store (PRQ2, Local0) - If (LLess (Local0, 0x80)) - { - Store (Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } - Method (_SRS, 1, NotSerialized) - { - CreateDWordField (Arg0, 0x05, TMP) - Store (TMP, PRQ2) - } + Method (IQDI, 1, NotSerialized) { + // _DIS method - disable interrupt + Or(DerefOf(Arg0), 0x80, Arg0) } - Device(LNKD){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 4) - Name(_PRS, ResourceTemplate(){ - Interrupt (, Level, ActiveHigh, Shared) - { 5, 10, 11 } - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ3, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ3, 0x80, PRQ3) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - Interrupt (, Level, ActiveHigh, Shared) - {1} - }) - CreateDWordField (PRR0, 0x05, TMP) - Store (PRQ3, Local0) - If (LLess (Local0, 0x80)) - { - Store (Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } - Method (_SRS, 1, NotSerialized) - { - CreateDWordField (Arg0, 0x05, TMP) - Store (TMP, PRQ3) - } + Method (IQCR, 1, NotSerialized) { + // _CRS method - get current settings + Name (PRR0, ResourceTemplate () + { + Interrupt (, Level, ActiveHigh, Shared) + { 0 } + }) + CreateDWordField (PRR0, 0x05, PRRI) + If (LLess (Arg0, 0x80)) { + Store (Arg0, PRRI) + } + Return (PRR0) } - Device(LNKS){ - Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link - Name(_UID, 5) - Name(_PRS, ResourceTemplate(){ - Interrupt (, Level, ActiveHigh, Shared) - { 9 } - }) - Method (_STA, 0, NotSerialized) - { - Store (0x0B, Local0) - If (And (0x80, PRQ0, Local1)) - { - Store (0x09, Local0) - } - Return (Local0) - } - Method (_DIS, 0, NotSerialized) - { - Or (PRQ0, 0x80, PRQ0) - } - Method (_CRS, 0, NotSerialized) - { - Name (PRR0, ResourceTemplate () - { - Interrupt (, Level, ActiveHigh, Shared) - {9} - }) - CreateDWordField (PRR0, 0x05, TMP) - Store (PRQ0, Local0) - If (LLess (Local0, 0x80)) - { - Store (Local0, TMP) - } - Else - { - Store (Zero, TMP) - } - Return (PRR0) - } + Method (IQSR, 2, NotSerialized) { + // _SRS method - set interrupt + CreateDWordField (Arg1, 0x05, PRRI) + Store (PRRI, Arg0) + } + + Device(LNKA) { + Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link + Name(_UID, 1) + Name(_PRS, ResourceTemplate(){ + Interrupt (, Level, ActiveHigh, Shared) + { 5, 10, 11 } + }) + Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) } + Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) } + Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) } + Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ0), Arg0) } + } + Device(LNKB) { + Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link + Name(_UID, 2) + Name(_PRS, ResourceTemplate(){ + Interrupt (, Level, ActiveHigh, Shared) + { 5, 10, 11 } + }) + Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) } + Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ1)) } + Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) } + Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ1), Arg0) } + } + Device(LNKC) { + Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link + Name(_UID, 3) + Name(_PRS, ResourceTemplate() { + Interrupt (, Level, ActiveHigh, Shared) + { 5, 10, 11 } + }) + Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) } + Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ2)) } + Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) } + Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ2), Arg0) } + } + Device(LNKD) { + Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link + Name(_UID, 4) + Name(_PRS, ResourceTemplate() { + Interrupt (, Level, ActiveHigh, Shared) + { 5, 10, 11 } + }) + Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) } + Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ3)) } + Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) } + Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ3), Arg0) } + } + Device(LNKS) { + Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link + Name(_UID, 5) + Name(_PRS, ResourceTemplate() { + Interrupt (, Level, ActiveHigh, Shared) + { 9 } + }) + Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) } + Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) } + Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) } } }