Patchwork ACPI: XP doesn't like qwords...

login
register
about
Submitter Tobias Diedrich
Date 2010-11-03 22:29:14
Message ID <20101103222914.GF21368@yumi.tdiedrich.de>
Download mbox | patch
Permalink /patch/2240/
State Superseded
Headers show

Comments

Tobias Diedrich - 2010-11-03 22:29:14
Since XP only implements parts of ACPI 2.0, it chokes on the TOM2 qword in the
SSDT, which is present if a board uses k8acpi_write_vars.

With the acpigen_write_name_qword("TOM2"... in place I get a
Stop A5 (0x11, 0x8, <virtual address of SSDT>, <somevalue>)
bluescreen on boot.

This patch replaces the qword with a dword, which contains (TOM2 >> 20),
giving us 1MB granularity and a limit of almost 4Exabyte of memory.
I added corresponding ShiftLeft calls in the commented out dsdt
sections that would use TOM2 if they were not commented out.

This problem was introduced with
http://tracker.coreboot.org/trac/coreboot/changeset/3953

Note that all corresponding DSDTs currently only ever check TOM2 against 0.

Signed-off-by: Tobias Diedrich <ranma+coreboot@tdiedrich.de>

---
Peter Stuge - 2010-11-04 07:33:37
Tobias Diedrich wrote:
> This patch replaces the qword with a dword, which contains (TOM2 >> 20),

Could the name be changed to reflect this?


//Peter
Tobias Diedrich - 2010-11-04 09:22:53
Peter Stuge wrote:
> Tobias Diedrich wrote:
> > This patch replaces the qword with a dword, which contains (TOM2 >> 20),
> 
> Could the name be changed to reflect this?

Any suggestions?
Being limited to 4 characters there is not much you can do to convey this...

TM2S? (Top of memory 2 shifted)

Patch

Index: src/northbridge/amd/amdk8/amdk8_acpi.c
===================================================================
--- src/northbridge/amd/amdk8/amdk8_acpi.c.orig	2010-11-03 23:19:03.000000000 +0100
+++ src/northbridge/amd/amdk8/amdk8_acpi.c	2010-11-03 23:19:37.000000000 +0100
@@ -270,7 +270,15 @@ 
 	msr = rdmsr(TOP_MEM);
 	lens += acpigen_write_name_dword("TOM1", msr.lo);
 	msr = rdmsr(TOP_MEM2);
-	lens += acpigen_write_name_qword("TOM2", (((uint64_t) msr.hi) << 32) | msr.lo);
+	/*
+	 * Since XP only implements parts of ACPI 2.0, we can't use a qword
+	 * here.
+	 * See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt
+	 * slide 22ff.
+	 * Shift value right by 20 bit to make it fit into 32bit,
+	 * giving us 1MB granularity and a limit of almost 4Exabyte of memory.
+	 */
+	lens += acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20);
 
 	lens += k8acpi_write_HT();
 	//minus opcode
Index: src/mainboard/gigabyte/ma78gm/dsdt.asl
===================================================================
--- src/mainboard/gigabyte/ma78gm/dsdt.asl.orig	2010-11-03 23:19:03.000000000 +0100
+++ src/mainboard/gigabyte/ma78gm/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1168,7 +1168,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1614,7 +1614,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/asrock/939a785gmh/dsdt.asl
===================================================================
--- src/mainboard/asrock/939a785gmh/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/asrock/939a785gmh/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1122,7 +1122,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1530,7 +1530,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/kontron/kt690/dsdt.asl
===================================================================
--- src/mainboard/kontron/kt690/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/kontron/kt690/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1129,7 +1129,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1557,7 +1557,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/gigabyte/ma785gmt/dsdt.asl
===================================================================
--- src/mainboard/gigabyte/ma785gmt/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/gigabyte/ma785gmt/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1168,7 +1168,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1614,7 +1614,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/amd/mahogany/dsdt.asl
===================================================================
--- src/mainboard/amd/mahogany/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/amd/mahogany/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1126,7 +1126,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1572,7 +1572,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/amd/pistachio/dsdt.asl
===================================================================
--- src/mainboard/amd/pistachio/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/amd/pistachio/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1128,7 +1128,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1480,7 +1480,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/amd/dbm690t/dsdt.asl
===================================================================
--- src/mainboard/amd/dbm690t/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/amd/dbm690t/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1129,7 +1129,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1557,7 +1557,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/amd/mahogany_fam10/dsdt.asl
===================================================================
--- src/mainboard/amd/mahogany_fam10/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/amd/mahogany_fam10/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1168,7 +1168,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1614,7 +1614,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/amd/tilapia_fam10/dsdt.asl
===================================================================
--- src/mainboard/amd/tilapia_fam10/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/amd/tilapia_fam10/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1168,7 +1168,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1614,7 +1614,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/iei/kino-780am2-fam10/dsdt.asl
===================================================================
--- src/mainboard/iei/kino-780am2-fam10/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/iei/kino-780am2-fam10/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1168,7 +1168,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1614,7 +1614,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/jetway/pa78vm5/dsdt.asl
===================================================================
--- src/mainboard/jetway/pa78vm5/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/jetway/pa78vm5/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1168,7 +1168,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1614,7 +1614,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/technexion/tim8690/dsdt.asl
===================================================================
--- src/mainboard/technexion/tim8690/dsdt.asl.orig	2010-11-03 23:19:28.000000000 +0100
+++ src/mainboard/technexion/tim8690/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1129,7 +1129,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1557,7 +1557,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/technexion/tim5690/dsdt.asl
===================================================================
--- src/mainboard/technexion/tim5690/dsdt.asl.orig	2010-11-03 23:19:29.000000000 +0100
+++ src/mainboard/technexion/tim5690/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1129,7 +1129,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1557,7 +1557,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/
 
Index: src/mainboard/asus/m4a785-m/dsdt.asl
===================================================================
--- src/mainboard/asus/m4a785-m/dsdt.asl.orig	2010-11-03 23:19:29.000000000 +0100
+++ src/mainboard/asus/m4a785-m/dsdt.asl	2010-11-03 23:19:37.000000000 +0100
@@ -1168,7 +1168,7 @@ 
 		/* Note: Only need HID on Primary Bus */
 		Device(PCI0) {
 			External (TOM1)
-			External (TOM2)
+			External (TOM2) /* (<real tom2> >> 20) to make it fit into 32 bit for XP */
 			Name(_HID, EISAID("PNP0A03"))
 			Name(_ADR, 0x00180000)	/* Dev# = BSP Dev#, Func# = 0 */
 			Method(_BBN, 0) { /* Bus number = 0 */
@@ -1614,7 +1614,8 @@ 
 				/*
 				* If(LNotEqual(TOM2, 0x00000000)){
 				*	Store(0x100000000,DMHB)			DRAM from 4GB to TopMem2
-				*	Subtract(TOM2, 0x100000000, DMHL)
+				*	ShiftLeft(TOM2, 20, Local0)
+				*	Subtract(Local0, 0x100000000, DMHL)
 				* }
 				*/