[coreboot-gerrit] New patch to review for coreboot: 68a4849 AMD Trinity: Remove unnecessary lookup table copy

Bruce Griffith (Bruce.Griffith@se-eng.com) gerrit at coreboot.org
Thu Jun 6 20:37:16 CEST 2013


Bruce Griffith (Bruce.Griffith at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3394

-gerrit

commit 68a48497eade08d8955e21ae76c5dd1edff0a37a
Author: Bruce Griffith <Bruce.Griffith at se-eng.com>
Date:   Tue Jun 4 14:22:25 2013 -0600

    AMD Trinity: Remove unnecessary lookup table copy
    
    The DDI connector table and the PCIe Port List lookup table are
    copied onto HEAP.  This copy is not needed since these are lookup
    tables used to define the platform configuration.
    
    Change-Id: If4760f80e08faa8da4fd11337a3812f89cf805f9
    Signed-off-by: Bruce Griffith <Bruce.Griffith at se-eng.com>
---
 src/mainboard/amd/parmer/PlatformGnbPcie.c | 55 ++++++++----------------------
 1 file changed, 14 insertions(+), 41 deletions(-)

diff --git a/src/mainboard/amd/parmer/PlatformGnbPcie.c b/src/mainboard/amd/parmer/PlatformGnbPcie.c
index 1925db8..784f6d9 100644
--- a/src/mainboard/amd/parmer/PlatformGnbPcie.c
+++ b/src/mainboard/amd/parmer/PlatformGnbPcie.c
@@ -71,7 +71,7 @@
  * 38 DP2_TX[P,N]6
  */
 
-PCIe_PORT_DESCRIPTOR PortList [] = {
+static const PCIe_PORT_DESCRIPTOR PortList [] = {
 	/* PCIe port, Lanes 8:23, PCI Device Number 2, PCIE SLOT0 x16 */
 	{
 		0, /* Descriptor flags */
@@ -121,7 +121,7 @@ PCIe_PORT_DESCRIPTOR PortList [] = {
 	},
 };
 
-PCIe_DDI_DESCRIPTOR DdiList [] = {
+static const PCIe_DDI_DESCRIPTOR DdiList [] = {
 	/* DP0 to HDMI0/DP */
 	{
 		0,
@@ -143,13 +143,6 @@ PCIe_DDI_DESCRIPTOR DdiList [] = {
 	},
 };
 
-PCIe_COMPLEX_DESCRIPTOR Trinity = {
-        DESCRIPTOR_TERMINATE_LIST,
-        0,
-        &PortList[0],
-        &DdiList[0]
-};
-
 /*---------------------------------------------------------------------------------------*/
 /**
  *  OemCustomizeInitEarly
@@ -171,10 +164,8 @@ OemCustomizeInitEarly (
 	IN  OUT AMD_EARLY_PARAMS    *InitEarly
 	)
 {
-	AGESA_STATUS         Status;
-	VOID                 *TrinityPcieComplexListPtr;
-	VOID                 *TrinityPciePortPtr;
-	VOID                 *TrinityPcieDdiPtr;
+	AGESA_STATUS            Status;
+	PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
 
 	ALLOCATE_HEAP_PARAMS AllocHeapParams;
 
@@ -183,46 +174,28 @@ OemCustomizeInitEarly (
 	/*  */
 	/* Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR */
 	/*  */
-	AllocHeapParams.RequestedBufferSize = sizeof(Trinity) + sizeof(PortList) + sizeof(DdiList);
+	AllocHeapParams.RequestedBufferSize = sizeof(PCIe_COMPLEX_DESCRIPTOR);
 
 	AllocHeapParams.BufferHandle = AMD_MEM_MISC_HANDLES_START;
 	AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
 	Status = HeapAllocateBuffer (&AllocHeapParams, &InitEarly->StdHeader);
 	if ( Status!= AGESA_SUCCESS) {
-		/* Could not allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR */
+		/* Could not allocate buffer for PCIe_COMPLEX_DESCRIPTOR */
 		ASSERT(FALSE);
 		return;
 	}
 
-	TrinityPcieComplexListPtr  =  (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
-
-	AllocHeapParams.BufferPtr += sizeof(Trinity);
-	TrinityPciePortPtr         =  (PCIe_PORT_DESCRIPTOR *)AllocHeapParams.BufferPtr;
+	PcieComplexListPtr  =  (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
 
-	AllocHeapParams.BufferPtr += sizeof(PortList);
-	TrinityPcieDdiPtr          =  (PCIe_DDI_DESCRIPTOR *) AllocHeapParams.BufferPtr;
-
-	LibAmdMemFill (TrinityPcieComplexListPtr,
+	LibAmdMemFill (PcieComplexListPtr,
 		       0,
-		       sizeof(Trinity),
+		       sizeof(PCIe_COMPLEX_DESCRIPTOR),
 		       &InitEarly->StdHeader);
 
-	LibAmdMemFill (TrinityPciePortPtr,
-		       0,
-		       sizeof(PortList),
-		       &InitEarly->StdHeader);
-
-	LibAmdMemFill (TrinityPcieDdiPtr,
-		       0,
-		       sizeof(DdiList),
-		       &InitEarly->StdHeader);
-
-	LibAmdMemCopy  (TrinityPcieComplexListPtr, &Trinity, sizeof(Trinity), &InitEarly->StdHeader);
-	LibAmdMemCopy  (TrinityPciePortPtr, &PortList[0], sizeof(PortList), &InitEarly->StdHeader);
-	LibAmdMemCopy  (TrinityPcieDdiPtr, &DdiList[0], sizeof(DdiList), &InitEarly->StdHeader);
-
-	((PCIe_COMPLEX_DESCRIPTOR*)TrinityPcieComplexListPtr)->PciePortList =  (PCIe_PORT_DESCRIPTOR*)TrinityPciePortPtr;
-	((PCIe_COMPLEX_DESCRIPTOR*)TrinityPcieComplexListPtr)->DdiLinkList  =  (PCIe_DDI_DESCRIPTOR*)TrinityPcieDdiPtr;
+	PcieComplexListPtr->Flags        = DESCRIPTOR_TERMINATE_LIST;
+	PcieComplexListPtr->SocketId     = 0;
+	PcieComplexListPtr->PciePortList = PortList;
+	PcieComplexListPtr->DdiLinkList  = DdiList;
 
-	InitEarly->GnbConfig.PcieComplexList = TrinityPcieComplexListPtr;
+	InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
 }



More information about the coreboot-gerrit mailing list