This patch is mostly documenting the functionality, but it also fixes
a return value which wasn't added correctly when there is no resource.
 I've also added code in my tree to remove zero-sized resources, but
since it hasn't made me magically boot Windows yet... I guess it's not
worth risking breaking it for someone else.

Signed-off-by: Myles Watson <[email protected]>

Thanks,
Myles
Index: svn/src/northbridge/amd/amdk8/amdk8_util.asl
===================================================================
--- svn.orig/src/northbridge/amd/amdk8/amdk8_util.asl
+++ svn/src/northbridge/amd/amdk8/amdk8_util.asl
@@ -84,6 +84,7 @@ Scope (\_SB)
 		Return (Local0)
 	}
 
+	/*GetBus (Node, Link) */
 	Method (GBUS, 2, NotSerialized)
 	{
 		Store (0x00, Local0)
@@ -107,6 +108,7 @@ Scope (\_SB)
 		Return (0x00)
 	}
 
+	/*GetBusResources (Node, Link) */
 	Method (GWBN, 2, NotSerialized)
 	{
 		Name (BUF0, ResourceTemplate ()
@@ -146,6 +148,7 @@ Scope (\_SB)
 		Return (RTAG (BUF0))
 	}
 
+	/*GetMemoryResources (Node, Link) */
 	Method (GMEM, 2, NotSerialized)
 	{
 		Name (BUF0, ResourceTemplate ()
@@ -166,21 +169,25 @@ Scope (\_SB)
 		Store (0x00, Local3)
 		While (LLess (Local0, 0x10))
 		{
+			/* Get first register pair of MMIO values from the SSDT table. */
 			Store (DerefOf (Index (\_SB.PCI0.MMIO, Local0)), Local1)
 			Increment (Local0)
 			Store (DerefOf (Index (\_SB.PCI0.MMIO, Local0)), Local2)
-			If (LEqual (And (Local1, 0x03), 0x03))
+			If (LEqual (And (Local1, 0x03), 0x03)) /* Pair enabled. */
 			{
-				If (LEqual (Arg0, And (Local2, 0x07)))
+				If (LEqual (Arg0, And (Local2, 0x07))) /* Check to see if the node number matches. */
 				{
+					/* If we got passed 0xFF for the Link or this is the Link. */
 					If (LOr (LEqual (Arg1, 0xFF), LEqual (Arg1, ShiftRight (And (Local2, 0x30), 0x04))))
 					{
+						/* Extract the Base and Limit from the register.*/
 						Store (ShiftLeft (And (Local1, 0xFFFFFF00), 0x08), MMIN)
 						Store (ShiftLeft (And (Local2, 0xFFFFFF00), 0x08), MMAX)
 						Or (MMAX, 0xFFFF, MMAX)
 						Subtract (MMAX, MMIN, MLEN)
 						Increment (MLEN)
 
+						/* If I've already done this once. */
 						If (Local4)
 						{
 							Concatenate (RTAG (BUF0), Local3, Local5)
@@ -189,24 +196,22 @@ Scope (\_SB)
 						Else
 						{
 							Store (RTAG (BUF0), Local3)
+							Increment (Local4)
 						}
-
-						Increment (Local4)
 					}
 				}
 			}
-
 			Increment (Local0)
 		}
 
-		If (LNot (Local4))
+		If (LNot (Local4)) /* No resources for this node and link. */
 		{
-			Store (BUF0, Local3)
+			Store (RTAG (BUF0), Local3)
 		}
-
 		Return (Local3)
 	}
 
+	/*GetIOResources (Node, Link) */
 	Method (GIOR, 2, NotSerialized)
 	{
 		Name (BUF0, ResourceTemplate ()
@@ -230,18 +235,21 @@ Scope (\_SB)
 			Store (DerefOf (Index (\_SB.PCI0.PCIO, Local0)), Local1)
 			Increment (Local0)
 			Store (DerefOf (Index (\_SB.PCI0.PCIO, Local0)), Local2)
-			If (LEqual (And (Local1, 0x03), 0x03))
+			If (LEqual (And (Local1, 0x03), 0x03)) /* Pair enabled. */
 			{
-				If (LEqual (Arg0, And (Local2, 0x07)))
+				If (LEqual (Arg0, And (Local2, 0x07))) /* Check to see if the node number matches. */
 				{
+					/* If we got passed 0xFF for the Link or this is the Link. */
 					If (LOr (LEqual (Arg1, 0xFF), LEqual (Arg1, ShiftRight (And (Local2, 0x30), 0x04))))
 					{
+						/* Extract the Base and Limit from the register.*/
 						Store (And (Local1, 0x01FFF000), PMIN)
 						Store (And (Local2, 0x01FFF000), PMAX)
 						Or (PMAX, 0x0FFF, PMAX)
 						Subtract (PMAX, PMIN, PLEN)
 						Increment (PLEN)
 
+						/* If I've already done this once. */
 						If (Local4)
 						{
 							Concatenate (RTAG (BUF0), Local3, Local5)
Index: svn/src/northbridge/amd/amdfam10/amdfam10_util.asl
===================================================================
--- svn.orig/src/northbridge/amd/amdfam10/amdfam10_util.asl
+++ svn/src/northbridge/amd/amdfam10/amdfam10_util.asl
@@ -99,6 +99,7 @@ Scope (\_SB)
 		Return (Local0)
 	}
 
+	/*GetBus (Node, Link) */
 	Method (GBUS, 2, NotSerialized)
 	{
 		Store (0x00, Local0)
@@ -122,6 +123,7 @@ Scope (\_SB)
 		Return (0x00)
 	}
 
+	/*GetBusResources (Node, Link) */
 	Method (GWBN, 2, NotSerialized)
 	{
 		Name (BUF0, ResourceTemplate ()
@@ -161,6 +163,7 @@ Scope (\_SB)
 		Return (RTAG (BUF0))
 	}
 
+	/*GetMemoryResources (Node, Link) */
 	Method (GMEM, 2, NotSerialized)
 	{
 		Name (BUF0, ResourceTemplate ()
@@ -181,21 +184,25 @@ Scope (\_SB)
 		Store (0x00, Local3)
 		While (LLess (Local0, 0x80)) // 0x20 links * 2(mem, prefmem ) *2 ( base, limit )
 		{
+			/* Get first register pair of MMIO values from the SSDT table. */
 			Store (DerefOf (Index (\_SB.PCI0.MMIO, Local0)), Local1)
 			Increment (Local0)
 			Store (DerefOf (Index (\_SB.PCI0.MMIO, Local0)), Local2)
-			If (LEqual (And (Local1, 0x03), 0x03))
+			If (LEqual (And (Local1, 0x03), 0x03)) /* Pair enabled. */
 			{
-				If (LEqual (Arg0, And (Local2, 0x3f)))
+				If (LEqual (Arg0, And (Local2, 0x3f))) /* Check to see if the node number matches. */
 				{
+					/* If we got passed 0xFF for the Link or this is the Link. */
 					If (LOr (LEqual (Arg1, 0xFF), LEqual (Arg1, ShiftRight (And (Local1, 0x70), 0x04))))
 					{
+						/* Extract the Base and Limit from the register.*/
 						Store (ShiftLeft (And (Local1, 0xFFFFFF00), 0x08), MMIN)
 						Store (ShiftLeft (And (Local2, 0xFFFFFF00), 0x08), MMAX)
 						Or (MMAX, 0xFFFF, MMAX)
 						Subtract (MMAX, MMIN, MLEN)
 						Increment (MLEN)
 
+						/* If I've already done this once. */
 						If (Local4)
 						{
 							Concatenate (RTAG (BUF0), Local3, Local5)
@@ -204,24 +211,22 @@ Scope (\_SB)
 						Else
 						{
 							Store (RTAG (BUF0), Local3)
+							Increment (Local4)
 						}
-
-						Increment (Local4)
 					}
 				}
 			}
-
 			Increment (Local0)
 		}
 
-		If (LNot (Local4))
+		If (LNot (Local4)) /* No resources for this node and link. */
 		{
-			Store (BUF0, Local3)
+			Store (RTAG (BUF0), Local3)
 		}
-
 		Return (Local3)
 	}
 
+	/*GetIOResources (Node, Link) */
 	Method (GIOR, 2, NotSerialized)
 	{
 		Name (BUF0, ResourceTemplate ()
@@ -245,18 +250,21 @@ Scope (\_SB)
 			Store (DerefOf (Index (\_SB.PCI0.PCIO, Local0)), Local1)
 			Increment (Local0)
 			Store (DerefOf (Index (\_SB.PCI0.PCIO, Local0)), Local2)
-			If (LEqual (And (Local1, 0x03), 0x03))
+			If (LEqual (And (Local1, 0x03), 0x03)) /* Pair enabled. */
 			{
-				If (LEqual (Arg0, And (Local2, 0x3f)))
+				If (LEqual (Arg0, And (Local2, 0x3f))) /* Check to see if the node number matches. */
 				{
+					/* If we got passed 0xFF for the Link or this is the Link. */
 					If (LOr (LEqual (Arg1, 0xFF), LEqual (Arg1, ShiftRight (And (Local1, 0x70), 0x04))))
 					{
+						/* Extract the Base and Limit from the register.*/
 						Store (And (Local1, 0x01FFF000), PMIN)
 						Store (And (Local2, 0x01FFF000), PMAX)
 						Or (PMAX, 0x0FFF, PMAX)
 						Subtract (PMAX, PMIN, PLEN)
 						Increment (PLEN)
 
+						/* If I've already done this once. */
 						If (Local4)
 						{
 							Concatenate (RTAG (BUF0), Local3, Local5)
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to