From 283ba7841581c5ffe64d1f0985cfa94be661b927 Mon Sep 17 00:00:00 2001 From: Bruce Griffith Date: Tue, 4 Jun 2013 14:16:24 -0600 Subject: [PATCH] AGESA: Add "const" modifier to function parameters Add CONST modifiers to read-only pass-by-reference function parameters in AGESA. This allows the use of "const" modifiers on the declaration of lookup tables that are pass-by-reference. These will be used to identify tables that are copied onto the HEAP but don't need to be. Change-Id: Ie1187a427804fddf47b935a110ad23931a3447a9 Signed-off-by: Bruce Griffith Reviewed-on: http://review.coreboot.org/3393 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/vendorcode/amd/agesa/f15tn/AGESA.h | 4 +- .../amd/agesa/f15tn/Legacy/Proc/Dispatcher.c | 2 +- src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c | 60 +++++++++---------- src/vendorcode/amd/agesa/f15tn/Lib/amdlib.h | 44 +++++++------- .../Modules/GnbPcieConfig/PcieInputParser.c | 12 ++-- .../Modules/GnbPcieConfig/PcieInputParser.h | 6 +- 6 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/vendorcode/amd/agesa/f15tn/AGESA.h b/src/vendorcode/amd/agesa/f15tn/AGESA.h index 9bd2e88369..d78e1ae9d5 100644 --- a/src/vendorcode/amd/agesa/f15tn/AGESA.h +++ b/src/vendorcode/amd/agesa/f15tn/AGESA.h @@ -976,8 +976,8 @@ typedef struct { * @li @b Bit31 - last descriptor in topology */ IN UINT32 SocketId; ///< Socket Id - IN PCIe_PORT_DESCRIPTOR *PciePortList; ///< Pointer to array of PCIe port descriptors or NULL (Last element of array must be terminated with DESCRIPTOR_TERMINATE_LIST). - IN PCIe_DDI_DESCRIPTOR *DdiLinkList; ///< Pointer to array DDI link descriptors (Last element of array must be terminated with DESCRIPTOR_TERMINATE_LIST). + IN CONST PCIe_PORT_DESCRIPTOR *PciePortList; ///< Pointer to array of PCIe port descriptors or NULL (Last element of array must be terminated with DESCRIPTOR_TERMINATE_LIST). + IN CONST PCIe_DDI_DESCRIPTOR *DdiLinkList; ///< Pointer to array DDI link descriptors (Last element of array must be terminated with DESCRIPTOR_TERMINATE_LIST). IN VOID *Reserved; ///< Reserved for future use } PCIe_COMPLEX_DESCRIPTOR; diff --git a/src/vendorcode/amd/agesa/f15tn/Legacy/Proc/Dispatcher.c b/src/vendorcode/amd/agesa/f15tn/Legacy/Proc/Dispatcher.c index 49f305bd24..0ee6d05183 100644 --- a/src/vendorcode/amd/agesa/f15tn/Legacy/Proc/Dispatcher.c +++ b/src/vendorcode/amd/agesa/f15tn/Legacy/Proc/Dispatcher.c @@ -111,7 +111,7 @@ AmdAgesaDispatcher ( DISPATCH_TABLE *Entry; UINT32 ImageStart; UINT32 ImageEnd; - AMD_IMAGE_HEADER* AltImagePtr; + CONST AMD_IMAGE_HEADER* AltImagePtr; Status = AGESA_UNSUPPORTED; ImageEntry = NULL; diff --git a/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c b/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c index 81ff635086..d468a0a803 100644 --- a/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c +++ b/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.c @@ -111,8 +111,8 @@ VOID STATIC LibAmdGetDataFromPtr ( IN ACCESS_WIDTH AccessWidth, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, OUT UINT32 *TemData, OUT UINT32 *TempDataMask ); @@ -549,7 +549,7 @@ VOID LibAmdIoWrite ( IN ACCESS_WIDTH AccessWidth, IN UINT16 IoAddress, - IN VOID *Value, + IN CONST VOID *Value, IN OUT AMD_CONFIG_PARAMS *StdHeader ) { @@ -587,8 +587,8 @@ VOID LibAmdIoRMW ( IN ACCESS_WIDTH AccessWidth, IN UINT16 IoAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN OUT AMD_CONFIG_PARAMS *StdHeader ) { @@ -619,8 +619,8 @@ VOID LibAmdIoPoll ( IN ACCESS_WIDTH AccessWidth, IN UINT16 IoAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN UINT64 Delay, IN OUT AMD_CONFIG_PARAMS *StdHeader ) @@ -686,7 +686,7 @@ VOID LibAmdMemWrite ( IN ACCESS_WIDTH AccessWidth, IN UINT64 MemAddress, - IN VOID *Value, + IN CONST VOID *Value, IN OUT AMD_CONFIG_PARAMS *StdHeader ) { @@ -724,8 +724,8 @@ VOID LibAmdMemRMW ( IN ACCESS_WIDTH AccessWidth, IN UINT64 MemAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN OUT AMD_CONFIG_PARAMS *StdHeader ) { @@ -756,8 +756,8 @@ VOID LibAmdMemPoll ( IN ACCESS_WIDTH AccessWidth, IN UINT64 MemAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN UINT64 Delay, IN OUT AMD_CONFIG_PARAMS *StdHeader ) @@ -837,7 +837,7 @@ VOID LibAmdPciWrite ( IN ACCESS_WIDTH AccessWidth, IN PCI_ADDR PciAddress, - IN VOID *Value, + IN CONST VOID *Value, IN OUT AMD_CONFIG_PARAMS *StdHeader ) { @@ -893,8 +893,8 @@ VOID LibAmdPciRMW ( IN ACCESS_WIDTH AccessWidth, IN PCI_ADDR PciAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN OUT AMD_CONFIG_PARAMS *StdHeader ) { @@ -925,8 +925,8 @@ VOID LibAmdPciPoll ( IN ACCESS_WIDTH AccessWidth, IN PCI_ADDR PciAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN UINT64 Delay, IN OUT AMD_CONFIG_PARAMS *StdHeader ) @@ -1025,7 +1025,7 @@ LibAmdPciWriteBits ( IN PCI_ADDR Address, IN UINT8 Highbit, IN UINT8 Lowbit, - IN UINT32 *Value, + IN CONST UINT32 *Value, IN AMD_CONFIG_PARAMS *StdHeader ) { @@ -1161,13 +1161,13 @@ LibAmdMemFill ( VOID LibAmdMemCopy ( IN VOID *Destination, - IN VOID *Source, + IN CONST VOID *Source, IN UINTN CopyLength, IN OUT AMD_CONFIG_PARAMS *StdHeader ) { UINT8 *Dest; - UINT8 *SourcePtr; + CONST UINT8 *SourcePtr; ASSERT (StdHeader != NULL); Dest = Destination; SourcePtr = Source; @@ -1187,7 +1187,7 @@ LibAmdMemCopy ( */ BOOLEAN LibAmdVerifyImageChecksum ( - IN VOID *ImagePtr + IN CONST VOID *ImagePtr ) { // Assume ImagePtr points to the binary start ($AMD) @@ -1224,19 +1224,19 @@ LibAmdVerifyImageChecksum ( * @retval NULL if image not found * @retval pointer to image header */ -VOID * +CONST VOID * LibAmdLocateImage ( - IN VOID *StartAddress, - IN VOID *EndAddress, + IN CONST VOID *StartAddress, + IN CONST VOID *EndAddress, IN UINT32 Alignment, - IN CHAR8 ModuleSignature[8] + IN CONST CHAR8 ModuleSignature[8] ) { - UINT8 *CurrentPtr; + CONST UINT8 *CurrentPtr; AMD_MODULE_HEADER *ModuleHeaderPtr; - UINT64 *SearchStr; - UINT64 *InputStr; + CONST UINT64 *SearchStr; + CONST UINT64 *InputStr; CurrentPtr = StartAddress; InputStr = (UINT64 *)ModuleSignature; @@ -1300,8 +1300,8 @@ VOID STATIC LibAmdGetDataFromPtr ( IN ACCESS_WIDTH AccessWidth, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, OUT UINT32 *TemData, OUT UINT32 *TempDataMask ) diff --git a/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.h b/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.h index d95d22ec8d..10ec9899a6 100644 --- a/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.h +++ b/src/vendorcode/amd/agesa/f15tn/Lib/amdlib.h @@ -182,7 +182,7 @@ VOID LibAmdIoWrite ( IN ACCESS_WIDTH AccessWidth, IN UINT16 IoAddress, - IN VOID *Value, + IN CONST VOID *Value, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -190,8 +190,8 @@ VOID LibAmdIoRMW ( IN ACCESS_WIDTH AccessWidth, IN UINT16 IoAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -199,8 +199,8 @@ VOID LibAmdIoPoll ( IN ACCESS_WIDTH AccessWidth, IN UINT16 IoAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN UINT64 Delay, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -218,7 +218,7 @@ VOID LibAmdMemWrite ( IN ACCESS_WIDTH AccessWidth, IN UINT64 MemAddress, - IN VOID *Value, + IN CONST VOID *Value, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -226,8 +226,8 @@ VOID LibAmdMemRMW ( IN ACCESS_WIDTH AccessWidth, IN UINT64 MemAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -235,8 +235,8 @@ VOID LibAmdMemPoll ( IN ACCESS_WIDTH AccessWidth, IN UINT64 MemAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN UINT64 Delay, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -254,7 +254,7 @@ VOID LibAmdPciWrite ( IN ACCESS_WIDTH AccessWidth, IN PCI_ADDR PciAddress, - IN VOID *Value, + IN CONST VOID *Value, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -262,8 +262,8 @@ VOID LibAmdPciRMW ( IN ACCESS_WIDTH AccessWidth, IN PCI_ADDR PciAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -271,8 +271,8 @@ VOID LibAmdPciPoll ( IN ACCESS_WIDTH AccessWidth, IN PCI_ADDR PciAddress, - IN VOID *Data, - IN VOID *DataMask, + IN CONST VOID *Data, + IN CONST VOID *DataMask, IN UINT64 Delay, IN OUT AMD_CONFIG_PARAMS *StdHeader ); @@ -291,7 +291,7 @@ LibAmdPciWriteBits ( IN PCI_ADDR Address, IN UINT8 Highbit, IN UINT8 Lowbit, - IN UINT32 *Value, + IN CONST UINT32 *Value, IN AMD_CONFIG_PARAMS *StdHeader ); @@ -321,17 +321,17 @@ LibAmdMemFill ( VOID LibAmdMemCopy ( IN VOID *Destination, - IN VOID *Source, + IN CONST VOID *Source, IN UINTN CopyLength, IN OUT AMD_CONFIG_PARAMS *StdHeader ); -VOID * +CONST VOID * LibAmdLocateImage ( - IN VOID *StartAddress, - IN VOID *EndAddress, + IN CONST VOID *StartAddress, + IN CONST VOID *EndAddress, IN UINT32 Alignment, - IN CHAR8 ModuleSignature[8] + IN CONST CHAR8 ModuleSignature[8] ); UINT32 @@ -341,7 +341,7 @@ LibAmdGetPackageType ( BOOLEAN LibAmdVerifyImageChecksum ( - IN VOID *ImagePtr + IN CONST VOID *ImagePtr ); UINT8 diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig/PcieInputParser.c b/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig/PcieInputParser.c index b4b6106772..9d428cec42 100644 --- a/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig/PcieInputParser.c +++ b/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig/PcieInputParser.c @@ -113,7 +113,7 @@ */ UINTN PcieInputParserGetNumberOfComplexes ( - IN PCIe_COMPLEX_DESCRIPTOR *ComplexList + IN CONST PCIe_COMPLEX_DESCRIPTOR *ComplexList ) { UINTN Result; @@ -136,11 +136,11 @@ PcieInputParserGetNumberOfComplexes ( */ UINTN PcieInputParserGetLengthOfPcieEnginesList ( - IN PCIe_COMPLEX_DESCRIPTOR *Complex + IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex ) { UINTN Result; - PCIe_PORT_DESCRIPTOR *PciePortList; + CONST PCIe_PORT_DESCRIPTOR *PciePortList; Result = 0; PciePortList = Complex->PciePortList; while (PciePortList != NULL) { @@ -161,11 +161,11 @@ PcieInputParserGetLengthOfPcieEnginesList ( */ STATIC UINTN PcieInputParserGetLengthOfDdiEnginesList ( - IN PCIe_COMPLEX_DESCRIPTOR *Complex + IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex ) { UINTN Result; - PCIe_DDI_DESCRIPTOR *DdiLinkList; + CONST PCIe_DDI_DESCRIPTOR *DdiLinkList; Result = 0; DdiLinkList = Complex->DdiLinkList; while (DdiLinkList != NULL) { @@ -187,7 +187,7 @@ PcieInputParserGetLengthOfDdiEnginesList ( */ UINTN PcieInputParserGetNumberOfEngines ( - IN PCIe_COMPLEX_DESCRIPTOR *Complex + IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex ) { UINTN Result; diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig/PcieInputParser.h b/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig/PcieInputParser.h index 630f9ae187..a2f6e4a803 100644 --- a/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig/PcieInputParser.h +++ b/src/vendorcode/amd/agesa/f15tn/Proc/GNB/Modules/GnbPcieConfig/PcieInputParser.h @@ -75,12 +75,12 @@ UINTN PcieInputParserGetNumberOfComplexes ( - IN PCIe_COMPLEX_DESCRIPTOR *ComplexList + IN CONST PCIe_COMPLEX_DESCRIPTOR *ComplexList ); UINTN PcieInputParserGetNumberOfEngines ( - IN PCIe_COMPLEX_DESCRIPTOR *Complex + IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex ); @@ -104,7 +104,7 @@ PcieInputParserGetComplexDescriptorOfSocket ( UINTN PcieInputParserGetLengthOfPcieEnginesList ( - IN PCIe_COMPLEX_DESCRIPTOR *Complex + IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex ); #endif