VOID GnbLibMemRead ( IN UINT64 Address, IN ACCESS_WIDTH Width, OUT VOID *Value, IN VOID *StdHeader ) { if (Width == AccessWidth64) { LibAmdMemRead (AccessWidth32, Address, Value, StdHeader); LibAmdMemRead (AccessWidth32, Address + 4, (VOID *) ((UINT64)Value + 4), StdHeader); } else { LibAmdMemRead (Width, Address, Value, StdHeader); } }
/**< cimFchStall - Reserved */ VOID CimFchStall ( IN UINT32 uSec, IN AMD_CONFIG_PARAMS *StdHeader ) { UINT16 timerAddr; UINT32 startTime; UINT32 elapsedTime; LibAmdMemRead (AccessWidth16, (UINT64) (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REG64), &timerAddr, StdHeader); if ( timerAddr == 0 ) { uSec = uSec / 2; while ( uSec != 0 ) { LibAmdIoRead (AccessWidth8, FCHOEM_IO_DELAY_PORT, (UINT8*)&elapsedTime, StdHeader); uSec--; } } else { LibAmdIoRead (AccessWidth32, timerAddr, &startTime, StdHeader); for ( ;; ) { LibAmdIoRead (AccessWidth32, timerAddr, &elapsedTime, StdHeader); if ( elapsedTime < startTime ) { elapsedTime = elapsedTime + FCH_MAX_TIMER - startTime; } else { elapsedTime = elapsedTime - startTime; } if ( (elapsedTime * FCHOEM_ELAPSED_TIME_UNIT / FCHOEM_ELAPSED_TIME_DIVIDER) > uSec ) { break; } } } }
/** * GetChipSysMode - Get Chip status * * * @param[in] Value - Return Chip strap status * StrapStatus [15.0] - Hudson-2 chip Strap Status * @li <b>0001</b> - Not USED FWH * @li <b>0002</b> - Not USED LPC ROM * @li <b>0004</b> - EC enabled * @li <b>0008</b> - Reserved * @li <b>0010</b> - Internal Clock mode * @param[in] StdHeader * */ VOID GetChipSysMode ( IN VOID *Value, IN AMD_CONFIG_PARAMS *StdHeader ) { LibAmdMemRead (AccessWidth8, (UINT64) (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG80), Value, StdHeader); }
VOID GnbLibMemRead ( IN UINT64 Address, IN ACCESS_WIDTH Width, OUT VOID *Value, IN VOID *StdHeader ) { LibAmdMemRead (Width, Address, Value, StdHeader); }
/** * Read Debug Print Memory * * * @param[in] AccessWidth Access width * @param[in] MemAddress Memory address * @param[in] Value Pointer to data * */ VOID STATIC AmdIdsDpRamRead ( IN ACCESS_WIDTH AccessWidth, IN UINT64 MemAddress, OUT VOID *Value ) { LibAmdMemRead (AccessWidth, MemAddress, Value, NULL); }
/** * Prepare a MMIO entry on a family 15h Carrizo core. * * @param[in] CurrentEntry Current entry to process * * @return Pointer to next table entry */ CS_RESTORATION_ENTRY_HEADER* F15CzProcessMmioEntry ( IN CS_RESTORATION_ENTRY_HEADER *CurrentEntry ) { CS_MMIO *MmioEntry; MmioEntry = (CS_MMIO *) CurrentEntry; if (MmioEntry->Header.SaveReadValue) { LibAmdMemRead (AccessWidth32, MmioEntry->Address, &MmioEntry->Value, NULL); } MmioEntry++; return &MmioEntry->Header; }
/** * Prepare an FCH 8bit memory mapped IO entry on a family 15h Carrizo core. * * @param[in] CurrentEntry Current entry to process * * @return Pointer to next table entry */ CS_RESTORATION_ENTRY_HEADER* F15CzProcessFchMmioByteEntry ( IN CS_RESTORATION_ENTRY_HEADER *CurrentEntry ) { UINT64 MmioAddress; CS_FCH_MMIO_BYTE *FchMmioByteEntry; FchMmioByteEntry = (CS_FCH_MMIO_BYTE *) CurrentEntry; if (FchMmioByteEntry->Header.SaveReadValue) { MmioAddress = FCH_MMIO_BASE + FchMmioByteEntry->Address; LibAmdMemRead (AccessWidth8, MmioAddress, &FchMmioByteEntry->Value, NULL); } FchMmioByteEntry++; return &FchMmioByteEntry->Header; }
/** * Prepare an FCH 16bit memory mapped IO bits entry on a family 15h Carrizo core. * * @param[in] CurrentEntry Current entry to process * * @return Pointer to next table entry */ CS_RESTORATION_ENTRY_HEADER* F15CzProcessFchMmioWordBitsEntry ( IN CS_RESTORATION_ENTRY_HEADER *CurrentEntry ) { UINT64 MmioAddress; CS_FCH_MMIO_WORD_BITS *FchMmioWordBitsEntry; FchMmioWordBitsEntry = (CS_FCH_MMIO_WORD_BITS *) CurrentEntry; if (FchMmioWordBitsEntry->Header.SaveReadValue) { MmioAddress = FCH_MMIO_BASE + FchMmioWordBitsEntry->Address; LibAmdMemRead (AccessWidth16, MmioAddress, &FchMmioWordBitsEntry->Value, NULL); FchMmioWordBitsEntry->Value &= ~FchMmioWordBitsEntry->Mask; } FchMmioWordBitsEntry++; return &FchMmioWordBitsEntry->Header; }
/** * Prepare an FCH AB link entry on a family 15h Carrizo core. * * @param[in] CurrentEntry Current entry to process * * @return Pointer to next table entry */ CS_RESTORATION_ENTRY_HEADER* F15CzProcessFchAbEntry ( IN CS_RESTORATION_ENTRY_HEADER *CurrentEntry ) { UINT32 RegisterIndex; UINT64 MmioAddr; CS_FCH_AB *FchAbEntry; FchAbEntry = (CS_FCH_AB *) CurrentEntry; if (FchAbEntry->Header.SaveReadValue) { if (AbIoAddress == 0xFFFF) { MmioAddr = 0xFED803E0; LibAmdMemRead (AccessWidth16, MmioAddr, &AbIoAddress, NULL); } RegisterIndex = FchAbEntry->Address + 0xC0000000; LibAmdIoWrite (AccessWidth32, AbIoAddress, &RegisterIndex, NULL); LibAmdIoRead (AccessWidth32, AbIoAddress + 4, &FchAbEntry->Value, NULL); } FchAbEntry++; return &FchAbEntry->Header; }
/** GetRomSigPtr - Reserved **/ VOID* GetRomSigPtr ( IN UINTN *RomSigPtr, IN AMD_CONFIG_PARAMS *StdHeader ) { UINT32 RomPtr; UINT32 RomSig; UINT16 MswAddr; *RomSigPtr = 0; MswAddr = 0xFFF0; do { RomPtr = (MswAddr << 16) + FCH_ROMSIG_BASE_IO; LibAmdMemRead (AccessWidth32, (UINT64) RomPtr, &RomSig, StdHeader); if (RomSig == FCH_ROMSIG_SIGNATURE) { *RomSigPtr = RomPtr; break; } MswAddr <<= 1; } while (MswAddr != 0xFE00); return RomSigPtr; }