From 891766f3b4d6996d02322aa48070d2e7e950e582 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 17 Dec 2011 10:26:17 -0500 Subject: [PATCH] Fix broken _DIS and _SRS methods in ACPI AML irq routing. The RefOf() operator doesn't do what was expected (at least on Linux) - issuing "Store(1, RefOf(PRQ0))" doesn't write to the PRQ0 Field defined on the OperationRegion. Instead, it seems to redefine PRQ0 to be an integer. Fix this by defining the _DIS and _SRS methods as pre-processor macros. This way the RefOf() operator isn't needed. --- src/acpi-dsdt.dsl | 34 +++++---- src/acpi-dsdt.hex | 180 +++++++++++++++++++++++----------------------- 2 files changed, 108 insertions(+), 106 deletions(-) diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl index aff3f48..7082b65 100644 --- a/src/acpi-dsdt.dsl +++ b/src/acpi-dsdt.dsl @@ -508,10 +508,6 @@ DefinitionBlock ( } Return (0x0B) } - Method (IQDI, 1, NotSerialized) { - // _DIS method - disable interrupt - Or(DerefOf(Arg0), 0x80, Arg0) - } Method (IQCR, 1, NotSerialized) { // _CRS method - get current settings Name (PRR0, ResourceTemplate () @@ -525,11 +521,13 @@ DefinitionBlock ( } Return (PRR0) } - Method (IQSR, 2, NotSerialized) { - // _SRS method - set interrupt - CreateDWordField (Arg1, 0x05, PRRI) - Store (PRRI, Arg0) - } + // _DIS method - disable interrupt +#define DISIRQ(PRQVAR) \ + Or(PRQVAR, 0x80, PRQVAR) \ + // _SRS method - set interrupt +#define SETIRQ(PRQVAR, IRQINFO) \ + CreateDWordField (IRQINFO, 0x05, PRRI) \ + Store (PRRI, PRQVAR) Device(LNKA) { Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link @@ -539,9 +537,9 @@ DefinitionBlock ( { 5, 10, 11 } }) Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) } - Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) } + Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ0) } Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) } - Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ0), Arg0) } + Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ0, Arg0) } } Device(LNKB) { Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link @@ -551,9 +549,9 @@ DefinitionBlock ( { 5, 10, 11 } }) Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) } - Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ1)) } + Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ1) } Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) } - Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ1), Arg0) } + Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ1, Arg0) } } Device(LNKC) { Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link @@ -563,9 +561,9 @@ DefinitionBlock ( { 5, 10, 11 } }) Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) } - Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ2)) } + Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ2) } Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) } - Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ2), Arg0) } + Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ2, Arg0) } } Device(LNKD) { Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link @@ -575,9 +573,9 @@ DefinitionBlock ( { 5, 10, 11 } }) Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) } - Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ3)) } + Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ3) } Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) } - Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ3), Arg0) } + Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ3, Arg0) } } Device(LNKS) { Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link @@ -587,7 +585,7 @@ DefinitionBlock ( { 9 } }) Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) } - Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) } + Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ0) } Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) } } } diff --git a/src/acpi-dsdt.hex b/src/acpi-dsdt.hex index a775a2f..5dc7bb4 100644 --- a/src/acpi-dsdt.hex +++ b/src/acpi-dsdt.hex @@ -3,12 +3,12 @@ static unsigned char AmlCode[] = { 0x53, 0x44, 0x54, -0xcf, +0xd3, 0x10, 0x0, 0x0, 0x1, -0x3f, +0x2d, 0x42, 0x58, 0x50, @@ -3126,8 +3126,8 @@ static unsigned char AmlCode[] = { 0xa4, 0x1, 0x10, -0x4d, -0x2c, +0x41, +0x2d, 0x5f, 0x53, 0x42, @@ -3191,19 +3191,6 @@ static unsigned char AmlCode[] = { 0xa, 0xb, 0x14, -0xc, -0x49, -0x51, -0x44, -0x49, -0x1, -0x7d, -0x83, -0x68, -0xa, -0x80, -0x68, -0x14, 0x36, 0x49, 0x51, @@ -3258,30 +3245,9 @@ static unsigned char AmlCode[] = { 0x52, 0x52, 0x30, -0x14, -0x14, -0x49, -0x51, -0x53, -0x52, -0x2, -0x8a, -0x69, -0xa, -0x5, -0x50, -0x52, -0x52, -0x49, -0x70, -0x50, -0x52, -0x52, -0x49, -0x68, 0x5b, 0x82, -0x43, +0x4c, 0x7, 0x4c, 0x4e, @@ -3348,17 +3314,19 @@ static unsigned char AmlCode[] = { 0x51, 0x30, 0x14, -0xf, +0x11, 0x5f, 0x44, 0x49, 0x53, 0x0, -0x49, +0x7d, +0x50, +0x52, 0x51, -0x44, -0x49, -0x71, +0x30, +0xa, +0x80, 0x50, 0x52, 0x51, @@ -3380,25 +3348,32 @@ static unsigned char AmlCode[] = { 0x51, 0x30, 0x14, -0x10, +0x17, 0x5f, 0x53, 0x52, 0x53, 0x1, +0x8a, +0x68, +0xa, +0x5, +0x50, +0x52, +0x52, 0x49, -0x51, -0x53, +0x70, +0x50, +0x52, 0x52, -0x71, +0x49, 0x50, 0x52, 0x51, 0x30, -0x68, 0x5b, 0x82, -0x44, +0x4d, 0x7, 0x4c, 0x4e, @@ -3466,17 +3441,19 @@ static unsigned char AmlCode[] = { 0x51, 0x31, 0x14, -0xf, +0x11, 0x5f, 0x44, 0x49, 0x53, 0x0, -0x49, +0x7d, +0x50, +0x52, 0x51, -0x44, -0x49, -0x71, +0x31, +0xa, +0x80, 0x50, 0x52, 0x51, @@ -3498,25 +3475,32 @@ static unsigned char AmlCode[] = { 0x51, 0x31, 0x14, -0x10, +0x17, 0x5f, 0x53, 0x52, 0x53, 0x1, +0x8a, +0x68, +0xa, +0x5, +0x50, +0x52, +0x52, 0x49, -0x51, -0x53, +0x70, +0x50, 0x52, -0x71, +0x52, +0x49, 0x50, 0x52, 0x51, 0x31, -0x68, 0x5b, 0x82, -0x44, +0x4d, 0x7, 0x4c, 0x4e, @@ -3584,17 +3568,19 @@ static unsigned char AmlCode[] = { 0x51, 0x32, 0x14, -0xf, +0x11, 0x5f, 0x44, 0x49, 0x53, 0x0, -0x49, +0x7d, +0x50, +0x52, 0x51, -0x44, -0x49, -0x71, +0x32, +0xa, +0x80, 0x50, 0x52, 0x51, @@ -3616,25 +3602,32 @@ static unsigned char AmlCode[] = { 0x51, 0x32, 0x14, -0x10, +0x17, 0x5f, 0x53, 0x52, 0x53, 0x1, +0x8a, +0x68, +0xa, +0x5, +0x50, +0x52, +0x52, 0x49, -0x51, -0x53, +0x70, +0x50, +0x52, 0x52, -0x71, +0x49, 0x50, 0x52, 0x51, 0x32, -0x68, 0x5b, 0x82, -0x44, +0x4d, 0x7, 0x4c, 0x4e, @@ -3702,17 +3695,19 @@ static unsigned char AmlCode[] = { 0x51, 0x33, 0x14, -0xf, +0x11, 0x5f, 0x44, 0x49, 0x53, 0x0, -0x49, +0x7d, +0x50, +0x52, 0x51, -0x44, -0x49, -0x71, +0x33, +0xa, +0x80, 0x50, 0x52, 0x51, @@ -3734,25 +3729,32 @@ static unsigned char AmlCode[] = { 0x51, 0x33, 0x14, -0x10, +0x17, 0x5f, 0x53, 0x52, 0x53, 0x1, +0x8a, +0x68, +0xa, +0x5, +0x50, +0x52, +0x52, 0x49, -0x51, -0x53, +0x70, +0x50, +0x52, 0x52, -0x71, +0x49, 0x50, 0x52, 0x51, 0x33, -0x68, 0x5b, 0x82, -0x4b, +0x4d, 0x5, 0x4c, 0x4e, @@ -3812,17 +3814,19 @@ static unsigned char AmlCode[] = { 0x51, 0x30, 0x14, -0xf, +0x11, 0x5f, 0x44, 0x49, 0x53, 0x0, -0x49, +0x7d, +0x50, +0x52, 0x51, -0x44, -0x49, -0x71, +0x30, +0xa, +0x80, 0x50, 0x52, 0x51, -- 2.25.1