From 3388fdecf2ad6a0edc843284e7068ab8fd39fcd6 Mon Sep 17 00:00:00 2001 From: Richard Spiegel Date: Fri, 17 Aug 2018 08:57:10 -0700 Subject: vendorcode/amd/pi/00670F00/Lib: Remove unused functions The only code still used are LibAmdPciRead() and LibAmdPciWrite(). These functions are used by PspBaseLib. Remove all functions that are not used, directly or indirectly, by LibAmdPciRead() and LibAmdPciWrite(). BUG=b:112688270 TEST=Build grunt Change-Id: Iba5cfbeee8e83ca78279a1bc2a333370c04f55ed Signed-off-by: Richard Spiegel Reviewed-on: https://review.coreboot.org/28194 Reviewed-by: Paul Menzel Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- src/vendorcode/amd/pi/00670F00/Lib/amdlib.c | 90 --------------- src/vendorcode/amd/pi/00670F00/Lib/amdlib.h | 166 ---------------------------- 2 files changed, 256 deletions(-) (limited to 'src') diff --git a/src/vendorcode/amd/pi/00670F00/Lib/amdlib.c b/src/vendorcode/amd/pi/00670F00/Lib/amdlib.c index 7181d1db9c..b03beee287 100644 --- a/src/vendorcode/amd/pi/00670F00/Lib/amdlib.c +++ b/src/vendorcode/amd/pi/00670F00/Lib/amdlib.c @@ -61,13 +61,6 @@ GetPciMmioAddress ( IN AMD_CONFIG_PARAMS *StdHeader ); -VOID -IdsOutPort ( - IN UINT32 Addr, - IN UINT32 Value, - IN UINT32 Flag - ); - VOID CpuidRead ( IN UINT32 CpuidFcnAddress, @@ -582,89 +575,6 @@ GetPciMmioAddress ( return MmioIsEnabled; } -/*---------------------------------------------------------------------------------------*/ -/** - * Verify checksum of binary image (B1/B2/B3) - * - * - * @param[in] ImagePtr Pointer to image start - * @retval TRUE Checksum valid - * @retval FALSE Checksum invalid - */ -BOOLEAN -LibAmdVerifyImageChecksum ( - IN CONST VOID *ImagePtr - ) -{ - // Assume ImagePtr points to the binary start ($AMD) - // Checksum is on an even boundary in AMD_IMAGE_HEADER - - UINT16 Sum; - UINT32 i; - - Sum = 0; - - i = ((AMD_IMAGE_HEADER*) ImagePtr)->ImageSize; - - while (i > 1) { - Sum = Sum + *((UINT16 *)ImagePtr); - ImagePtr = (VOID *) ((UINT8 *)ImagePtr + 2); - i = i - 2; - } - if (i > 0) { - Sum = Sum + *((UINT8 *) ImagePtr); - } - - return (Sum == 0)?TRUE:FALSE; -} - -/*---------------------------------------------------------------------------------------*/ -/** - * Locate AMD binary image that contain specific module - * - * - * @param[in] StartAddress Pointer to start range - * @param[in] EndAddress Pointer to end range - * @param[in] Alignment Image address alignment - * @param[in] ModuleSignature Module signature. - * @retval NULL if image not found - * @retval pointer to image header - */ -CONST VOID * -LibAmdLocateImage ( - IN CONST VOID *StartAddress, - IN CONST VOID *EndAddress, - IN UINT32 Alignment, - IN CONST CHAR8 ModuleSignature[8] - ) - -{ - CONST UINT8 *CurrentPtr = StartAddress; - AMD_MODULE_HEADER *ModuleHeaderPtr; - CONST UINT64 SearchStr = *((UINT64*)ModuleSignature); - - // Search from start to end incrementing by alignment - while ((CurrentPtr >= (UINT8 *) StartAddress) && (CurrentPtr < (UINT8 *) EndAddress)) { - // First find a binary image - if (IMAGE_SIGNATURE == *((UINT32 *) CurrentPtr)) { - // TODO Figure out a way to fix the AGESA binary checksum -// if (LibAmdVerifyImageChecksum (CurrentPtr)) { - // If we have a valid image, search module linked list for a match - ModuleHeaderPtr = (AMD_MODULE_HEADER*)(((AMD_IMAGE_HEADER *) CurrentPtr)->ModuleInfoOffset); - while ((ModuleHeaderPtr != NULL) && - (MODULE_SIGNATURE == *((UINT32*)&(ModuleHeaderPtr->ModuleHeaderSignature)))) { - if (SearchStr == *((UINT64*)&(ModuleHeaderPtr->ModuleIdentifier))) { - return CurrentPtr; - } - ModuleHeaderPtr = (AMD_MODULE_HEADER *)ModuleHeaderPtr->NextBlock; - } -// } - } - CurrentPtr += Alignment; - } - return NULL; -} - BOOLEAN IdsErrorStop ( IN UINT32 FileCode diff --git a/src/vendorcode/amd/pi/00670F00/Lib/amdlib.h b/src/vendorcode/amd/pi/00670F00/Lib/amdlib.h index f41e0c42e9..fc97213036 100644 --- a/src/vendorcode/amd/pi/00670F00/Lib/amdlib.h +++ b/src/vendorcode/amd/pi/00670F00/Lib/amdlib.h @@ -126,11 +126,6 @@ Write64Mem32 ( IN UINT32 Data ); -UINT64 -ReadTSC ( - void - ); - // MSR VOID LibAmdMsrRead ( @@ -163,16 +158,6 @@ LibAmdIoWrite ( IN OUT AMD_CONFIG_PARAMS *StdHeader ); -VOID -LibAmdIoPoll ( - IN ACCESS_WIDTH AccessWidth, - IN UINT16 IoAddress, - IN CONST VOID *Data, - IN CONST VOID *DataMask, - IN UINT64 Delay, - IN OUT AMD_CONFIG_PARAMS *StdHeader - ); - // Memory or MMIO VOID LibAmdMemRead ( @@ -190,16 +175,6 @@ LibAmdMemWrite ( IN OUT AMD_CONFIG_PARAMS *StdHeader ); -VOID -LibAmdMemPoll ( - IN ACCESS_WIDTH AccessWidth, - IN UINT64 MemAddress, - IN CONST VOID *Data, - IN CONST VOID *DataMask, - IN UINT64 Delay, - IN OUT AMD_CONFIG_PARAMS *StdHeader - ); - // PCI VOID LibAmdPciRead ( @@ -217,40 +192,6 @@ LibAmdPciWrite ( IN OUT AMD_CONFIG_PARAMS *StdHeader ); -VOID -LibAmdPciPoll ( - IN ACCESS_WIDTH AccessWidth, - IN PCI_ADDR PciAddress, - IN CONST VOID *Data, - IN CONST VOID *DataMask, - IN UINT64 Delay, - IN OUT AMD_CONFIG_PARAMS *StdHeader - ); - -VOID -LibAmdPciReadBits ( - IN PCI_ADDR Address, - IN UINT8 Highbit, - IN UINT8 Lowbit, - OUT UINT32 *Value, - IN AMD_CONFIG_PARAMS *StdHeader - ); - -VOID -LibAmdPciWriteBits ( - IN PCI_ADDR Address, - IN UINT8 Highbit, - IN UINT8 Lowbit, - IN CONST UINT32 *Value, - IN AMD_CONFIG_PARAMS *StdHeader - ); - -VOID -LibAmdPciFindNextCap ( - IN OUT PCI_ADDR *Address, - IN AMD_CONFIG_PARAMS *StdHeader - ); - // CPUID VOID LibAmdCpuidRead ( @@ -258,111 +199,4 @@ LibAmdCpuidRead ( OUT CPUID_DATA *Value, IN OUT AMD_CONFIG_PARAMS *StdHeader ); - -// Utility Functions -VOID -LibAmdMemFill ( - IN VOID *Destination, - IN UINT8 Value, - IN UINTN FillLength, - IN OUT AMD_CONFIG_PARAMS *StdHeader - ); - -VOID -LibAmdMemCopy ( - IN VOID *Destination, - IN CONST VOID *Source, - IN UINTN CopyLength, - IN OUT AMD_CONFIG_PARAMS *StdHeader - ); - -CONST VOID * -LibAmdLocateImage ( - IN CONST VOID *StartAddress, - IN CONST VOID *EndAddress, - IN UINT32 Alignment, - IN CONST CHAR8 ModuleSignature[8] - ); - -UINT32 -LibAmdGetPackageType ( - IN AMD_CONFIG_PARAMS *StdHeader - ); - -BOOLEAN -LibAmdVerifyImageChecksum ( - IN CONST VOID *ImagePtr - ); - -UINT8 -LibAmdBitScanReverse ( - IN UINT32 value - ); -UINT8 -LibAmdBitScanForward ( - IN UINT32 value - ); - -VOID -LibAmdReadCpuReg ( - IN UINT8 RegNum, - OUT UINT32 *Value - ); -VOID -LibAmdWriteCpuReg ( - IN UINT8 RegNum, - IN UINT32 Value - ); - -VOID -LibAmdWriteBackInvalidateCache ( - void - ); - -VOID -LibAmdSimNowEnterDebugger ( - void - ); - -VOID -LibAmdHDTBreakPoint ( - void - ); - -UINT8 -LibAmdAccessWidth ( - IN ACCESS_WIDTH AccessWidth - ); - -VOID -LibAmdCLFlush ( - IN UINT64 Address, - IN UINT8 Count - ); - -VOID -StopHere ( - void - ); - -VOID -LibAmdFinit ( - void - ); - -VOID -LibAmdFnclex ( - void - ); - -VOID -LibAmdReadMxcsr ( - OUT UINT32 *Value - ); - -VOID -LibAmdWriteMxcsr ( - IN UINT32 *Value - ); - #endif // _AMD_LIB_H_ -- cgit v1.2.3