AMD Kabini: Add "const" modifier to AGESA 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.

This same change was made for AMD Trinity APUs (Family15tn) [1].

[1] 283ba78 AGESA: Add "const" modifier to function parameters

Change-Id: I2bdd9fc5e027e938de9df0f923b95da934bb48dc
Signed-off-by: Bruce Griffith <Bruce.Griffith@se-eng.com>
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
Tested-by: Bruce Griffith <bruce.griffith@se-eng.com>
Reviewed-on: http://review.coreboot.org/3837
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
This commit is contained in:
Bruce Griffith 2013-07-29 02:34:26 -06:00 committed by Bruce Griffith
parent abebe80161
commit aea318f35d
6 changed files with 67 additions and 67 deletions

View File

@ -948,8 +948,8 @@ typedef struct {
* @li @b Bit31 - last descriptor in topology * @li @b Bit31 - last descriptor in topology
*/ */
IN UINT32 SocketId; ///< Socket Id 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 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 PCIe_DDI_DESCRIPTOR *DdiLinkList; ///< Pointer to array DDI link descriptors (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 IN VOID *Reserved; ///< Reserved for future use
} PCIe_COMPLEX_DESCRIPTOR; } PCIe_COMPLEX_DESCRIPTOR;

View File

@ -84,7 +84,7 @@ AmdAgesaDispatcher (
DISPATCH_TABLE *Entry; DISPATCH_TABLE *Entry;
UINT32 ImageStart; UINT32 ImageStart;
UINT32 ImageEnd; UINT32 ImageEnd;
AMD_IMAGE_HEADER* AltImagePtr; CONST AMD_IMAGE_HEADER* AltImagePtr;
Status = AGESA_UNSUPPORTED; Status = AGESA_UNSUPPORTED;
ImageEntry = NULL; ImageEntry = NULL;

View File

@ -84,8 +84,8 @@ VOID
STATIC STATIC
LibAmdGetDataFromPtr ( LibAmdGetDataFromPtr (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
OUT UINT32 *TemData, OUT UINT32 *TemData,
OUT UINT32 *TempDataMask OUT UINT32 *TempDataMask
); );
@ -522,7 +522,7 @@ VOID
LibAmdIoWrite ( LibAmdIoWrite (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT16 IoAddress, IN UINT16 IoAddress,
IN VOID *Value, IN CONST VOID *Value,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
{ {
@ -560,8 +560,8 @@ VOID
LibAmdIoRMW ( LibAmdIoRMW (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT16 IoAddress, IN UINT16 IoAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
{ {
@ -592,8 +592,8 @@ VOID
LibAmdIoPoll ( LibAmdIoPoll (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT16 IoAddress, IN UINT16 IoAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN UINT64 Delay, IN UINT64 Delay,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
@ -659,7 +659,7 @@ VOID
LibAmdMemWrite ( LibAmdMemWrite (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT64 MemAddress, IN UINT64 MemAddress,
IN VOID *Value, IN CONST VOID *Value,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
{ {
@ -697,8 +697,8 @@ VOID
LibAmdMemRMW ( LibAmdMemRMW (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT64 MemAddress, IN UINT64 MemAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
{ {
@ -729,8 +729,8 @@ VOID
LibAmdMemPoll ( LibAmdMemPoll (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT64 MemAddress, IN UINT64 MemAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN UINT64 Delay, IN UINT64 Delay,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
@ -810,7 +810,7 @@ VOID
LibAmdPciWrite ( LibAmdPciWrite (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN PCI_ADDR PciAddress, IN PCI_ADDR PciAddress,
IN VOID *Value, IN CONST VOID *Value,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
{ {
@ -866,8 +866,8 @@ VOID
LibAmdPciRMW ( LibAmdPciRMW (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN PCI_ADDR PciAddress, IN PCI_ADDR PciAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
{ {
@ -898,8 +898,8 @@ VOID
LibAmdPciPoll ( LibAmdPciPoll (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN PCI_ADDR PciAddress, IN PCI_ADDR PciAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN UINT64 Delay, IN UINT64 Delay,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
@ -998,7 +998,7 @@ LibAmdPciWriteBits (
IN PCI_ADDR Address, IN PCI_ADDR Address,
IN UINT8 Highbit, IN UINT8 Highbit,
IN UINT8 Lowbit, IN UINT8 Lowbit,
IN UINT32 *Value, IN CONST UINT32 *Value,
IN AMD_CONFIG_PARAMS *StdHeader IN AMD_CONFIG_PARAMS *StdHeader
) )
{ {
@ -1134,13 +1134,13 @@ LibAmdMemFill (
VOID VOID
LibAmdMemCopy ( LibAmdMemCopy (
IN VOID *Destination, IN VOID *Destination,
IN VOID *Source, IN CONST VOID *Source,
IN UINTN CopyLength, IN UINTN CopyLength,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
) )
{ {
UINT8 *Dest; UINT8 *Dest;
UINT8 *SourcePtr; CONST UINT8 *SourcePtr;
ASSERT (StdHeader != NULL); ASSERT (StdHeader != NULL);
Dest = Destination; Dest = Destination;
SourcePtr = Source; SourcePtr = Source;
@ -1160,7 +1160,7 @@ LibAmdMemCopy (
*/ */
BOOLEAN BOOLEAN
LibAmdVerifyImageChecksum ( LibAmdVerifyImageChecksum (
IN VOID *ImagePtr IN CONST VOID *ImagePtr
) )
{ {
// Assume ImagePtr points to the binary start ($AMD) // Assume ImagePtr points to the binary start ($AMD)
@ -1197,19 +1197,19 @@ LibAmdVerifyImageChecksum (
* @retval NULL if image not found * @retval NULL if image not found
* @retval pointer to image header * @retval pointer to image header
*/ */
VOID * CONST VOID *
LibAmdLocateImage ( LibAmdLocateImage (
IN VOID *StartAddress, IN CONST VOID *StartAddress,
IN VOID *EndAddress, IN CONST VOID *EndAddress,
IN UINT32 Alignment, IN UINT32 Alignment,
IN CHAR8 ModuleSignature[8] IN CONST CHAR8 ModuleSignature[8]
) )
{ {
UINT8 *CurrentPtr; CONST UINT8 *CurrentPtr;
AMD_MODULE_HEADER *ModuleHeaderPtr; AMD_MODULE_HEADER *ModuleHeaderPtr;
UINT64 *SearchStr; CONST UINT64 *SearchStr;
UINT64 *InputStr; CONST UINT64 *InputStr;
CurrentPtr = StartAddress; CurrentPtr = StartAddress;
InputStr = (UINT64 *)ModuleSignature; InputStr = (UINT64 *)ModuleSignature;
@ -1273,8 +1273,8 @@ VOID
STATIC STATIC
LibAmdGetDataFromPtr ( LibAmdGetDataFromPtr (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
OUT UINT32 *TemData, OUT UINT32 *TemData,
OUT UINT32 *TempDataMask OUT UINT32 *TempDataMask
) )

View File

@ -155,7 +155,7 @@ VOID
LibAmdIoWrite ( LibAmdIoWrite (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT16 IoAddress, IN UINT16 IoAddress,
IN VOID *Value, IN CONST VOID *Value,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -163,8 +163,8 @@ VOID
LibAmdIoRMW ( LibAmdIoRMW (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT16 IoAddress, IN UINT16 IoAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -172,8 +172,8 @@ VOID
LibAmdIoPoll ( LibAmdIoPoll (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT16 IoAddress, IN UINT16 IoAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN UINT64 Delay, IN UINT64 Delay,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -191,7 +191,7 @@ VOID
LibAmdMemWrite ( LibAmdMemWrite (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT64 MemAddress, IN UINT64 MemAddress,
IN VOID *Value, IN CONST VOID *Value,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -199,8 +199,8 @@ VOID
LibAmdMemRMW ( LibAmdMemRMW (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT64 MemAddress, IN UINT64 MemAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -208,8 +208,8 @@ VOID
LibAmdMemPoll ( LibAmdMemPoll (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN UINT64 MemAddress, IN UINT64 MemAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN UINT64 Delay, IN UINT64 Delay,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -227,7 +227,7 @@ VOID
LibAmdPciWrite ( LibAmdPciWrite (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN PCI_ADDR PciAddress, IN PCI_ADDR PciAddress,
IN VOID *Value, IN CONST VOID *Value,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -235,8 +235,8 @@ VOID
LibAmdPciRMW ( LibAmdPciRMW (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN PCI_ADDR PciAddress, IN PCI_ADDR PciAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -244,8 +244,8 @@ VOID
LibAmdPciPoll ( LibAmdPciPoll (
IN ACCESS_WIDTH AccessWidth, IN ACCESS_WIDTH AccessWidth,
IN PCI_ADDR PciAddress, IN PCI_ADDR PciAddress,
IN VOID *Data, IN CONST VOID *Data,
IN VOID *DataMask, IN CONST VOID *DataMask,
IN UINT64 Delay, IN UINT64 Delay,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
@ -264,7 +264,7 @@ LibAmdPciWriteBits (
IN PCI_ADDR Address, IN PCI_ADDR Address,
IN UINT8 Highbit, IN UINT8 Highbit,
IN UINT8 Lowbit, IN UINT8 Lowbit,
IN UINT32 *Value, IN CONST UINT32 *Value,
IN AMD_CONFIG_PARAMS *StdHeader IN AMD_CONFIG_PARAMS *StdHeader
); );
@ -294,17 +294,17 @@ LibAmdMemFill (
VOID VOID
LibAmdMemCopy ( LibAmdMemCopy (
IN VOID *Destination, IN VOID *Destination,
IN VOID *Source, IN CONST VOID *Source,
IN UINTN CopyLength, IN UINTN CopyLength,
IN OUT AMD_CONFIG_PARAMS *StdHeader IN OUT AMD_CONFIG_PARAMS *StdHeader
); );
VOID * CONST VOID *
LibAmdLocateImage ( LibAmdLocateImage (
IN VOID *StartAddress, IN CONST VOID *StartAddress,
IN VOID *EndAddress, IN CONST VOID *EndAddress,
IN UINT32 Alignment, IN UINT32 Alignment,
IN CHAR8 ModuleSignature[8] IN CONST CHAR8 ModuleSignature[8]
); );
UINT32 UINT32
@ -314,7 +314,7 @@ LibAmdGetPackageType (
BOOLEAN BOOLEAN
LibAmdVerifyImageChecksum ( LibAmdVerifyImageChecksum (
IN VOID *ImagePtr IN CONST VOID *ImagePtr
); );
UINT8 UINT8

View File

@ -90,17 +90,17 @@ PcieInputParserGetEngineDescriptor (
UINTN UINTN
PcieInputParserGetNumberOfEngines ( PcieInputParserGetNumberOfEngines (
IN PCIe_COMPLEX_DESCRIPTOR *Complex IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex
); );
UINTN UINTN
PcieInputParserGetNumberOfComplexes ( PcieInputParserGetNumberOfComplexes (
IN PCIe_COMPLEX_DESCRIPTOR *ComplexList IN CONST PCIe_COMPLEX_DESCRIPTOR *ComplexList
); );
UINTN UINTN
PcieInputParserGetLengthOfPcieEnginesList ( PcieInputParserGetLengthOfPcieEnginesList (
IN PCIe_COMPLEX_DESCRIPTOR *Complex IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex
); );
/*----------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------*/
@ -115,7 +115,7 @@ PcieInputParserGetLengthOfPcieEnginesList (
*/ */
UINTN UINTN
PcieInputParserGetNumberOfComplexes ( PcieInputParserGetNumberOfComplexes (
IN PCIe_COMPLEX_DESCRIPTOR *ComplexList IN CONST PCIe_COMPLEX_DESCRIPTOR *ComplexList
) )
{ {
UINTN Result; UINTN Result;
@ -138,11 +138,11 @@ PcieInputParserGetNumberOfComplexes (
*/ */
UINTN UINTN
PcieInputParserGetLengthOfPcieEnginesList ( PcieInputParserGetLengthOfPcieEnginesList (
IN PCIe_COMPLEX_DESCRIPTOR *Complex IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex
) )
{ {
UINTN Result; UINTN Result;
PCIe_PORT_DESCRIPTOR *PciePortList; CONST PCIe_PORT_DESCRIPTOR *PciePortList;
Result = 0; Result = 0;
PciePortList = Complex->PciePortList; PciePortList = Complex->PciePortList;
while (PciePortList != NULL) { while (PciePortList != NULL) {
@ -163,11 +163,11 @@ PcieInputParserGetLengthOfPcieEnginesList (
*/ */
STATIC UINTN STATIC UINTN
PcieInputParserGetLengthOfDdiEnginesList ( PcieInputParserGetLengthOfDdiEnginesList (
IN PCIe_COMPLEX_DESCRIPTOR *Complex IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex
) )
{ {
UINTN Result; UINTN Result;
PCIe_DDI_DESCRIPTOR *DdiLinkList; CONST PCIe_DDI_DESCRIPTOR *DdiLinkList;
Result = 0; Result = 0;
DdiLinkList = Complex->DdiLinkList; DdiLinkList = Complex->DdiLinkList;
while (DdiLinkList != NULL) { while (DdiLinkList != NULL) {
@ -189,7 +189,7 @@ PcieInputParserGetLengthOfDdiEnginesList (
*/ */
UINTN UINTN
PcieInputParserGetNumberOfEngines ( PcieInputParserGetNumberOfEngines (
IN PCIe_COMPLEX_DESCRIPTOR *Complex IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex
) )
{ {
UINTN Result; UINTN Result;

View File

@ -48,12 +48,12 @@
UINTN UINTN
PcieInputParserGetNumberOfComplexes ( PcieInputParserGetNumberOfComplexes (
IN PCIe_COMPLEX_DESCRIPTOR *ComplexList IN CONST PCIe_COMPLEX_DESCRIPTOR *ComplexList
); );
UINTN UINTN
PcieInputParserGetNumberOfEngines ( PcieInputParserGetNumberOfEngines (
IN PCIe_COMPLEX_DESCRIPTOR *Complex IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex
); );
@ -77,7 +77,7 @@ PcieInputParserGetComplexDescriptorOfSocket (
UINTN UINTN
PcieInputParserGetLengthOfPcieEnginesList ( PcieInputParserGetLengthOfPcieEnginesList (
IN PCIe_COMPLEX_DESCRIPTOR *Complex IN CONST PCIe_COMPLEX_DESCRIPTOR *Complex
); );
#endif #endif