X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=OvmfPkg%2FLibrary%2FQemuFwCfgLib%2FQemuFwCfgLib.c;h=7f42f38d1c05cca65225e962b5d530dd01a1daed;hp=d79d0a444ca714d7fd5832990772e7c77e693d4c;hb=61a044c6c15f5806a30ff23409ba5287d9d07163;hpb=509e6b5a034f0e121c6de9bedd08532bf54cc4f7 diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c index d79d0a444c..7f42f38d1c 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -45,78 +45,6 @@ QemuFwCfgSelectItem ( IoWrite16 (FW_CFG_IO_SELECTOR, (UINT16)(UINTN) QemuFwCfgItem); } - -/** - Transfer an array of bytes, or skip a number of bytes, using the DMA - interface. - - @param[in] Size Size in bytes to transfer or skip. - - @param[in,out] Buffer Buffer to read data into or write data from. Ignored, - and may be NULL, if Size is zero, or Control is - FW_CFG_DMA_CTL_SKIP. - - @param[in] Control One of the following: - FW_CFG_DMA_CTL_WRITE - write to fw_cfg from Buffer. - FW_CFG_DMA_CTL_READ - read from fw_cfg into Buffer. - FW_CFG_DMA_CTL_SKIP - skip bytes in fw_cfg. -**/ -VOID -InternalQemuFwCfgDmaBytes ( - IN UINT32 Size, - IN OUT VOID *Buffer OPTIONAL, - IN UINT32 Control - ) -{ - volatile FW_CFG_DMA_ACCESS Access; - UINT32 AccessHigh, AccessLow; - UINT32 Status; - - ASSERT (Control == FW_CFG_DMA_CTL_WRITE || Control == FW_CFG_DMA_CTL_READ || - Control == FW_CFG_DMA_CTL_SKIP); - - if (Size == 0) { - return; - } - - Access.Control = SwapBytes32 (Control); - Access.Length = SwapBytes32 (Size); - Access.Address = SwapBytes64 ((UINTN)Buffer); - - // - // Delimit the transfer from (a) modifications to Access, (b) in case of a - // write, from writes to Buffer by the caller. - // - MemoryFence (); - - // - // Start the transfer. - // - AccessHigh = (UINT32)RShiftU64 ((UINTN)&Access, 32); - AccessLow = (UINT32)(UINTN)&Access; - IoWrite32 (0x514, SwapBytes32 (AccessHigh)); - IoWrite32 (0x518, SwapBytes32 (AccessLow)); - - // - // Don't look at Access.Control before starting the transfer. - // - MemoryFence (); - - // - // Wait for the transfer to complete. - // - do { - Status = SwapBytes32 (Access.Control); - ASSERT ((Status & FW_CFG_DMA_CTL_ERROR) == 0); - } while (Status != 0); - - // - // After a read, the caller will want to use Buffer. - // - MemoryFence (); -} - - /** Reads firmware configuration bytes into a buffer @@ -368,31 +296,3 @@ QemuFwCfgFindFile ( return RETURN_NOT_FOUND; } - - -/** - Determine if S3 support is explicitly enabled. - - @retval TRUE if S3 support is explicitly enabled. - FALSE otherwise. This includes unavailability of the firmware - configuration interface. -**/ -BOOLEAN -EFIAPI -QemuFwCfgS3Enabled ( - VOID - ) -{ - RETURN_STATUS Status; - FIRMWARE_CONFIG_ITEM FwCfgItem; - UINTN FwCfgSize; - UINT8 SystemStates[6]; - - Status = QemuFwCfgFindFile ("etc/system-states", &FwCfgItem, &FwCfgSize); - if (Status != RETURN_SUCCESS || FwCfgSize != sizeof SystemStates) { - return FALSE; - } - QemuFwCfgSelectItem (FwCfgItem); - QemuFwCfgReadBytes (sizeof SystemStates, SystemStates); - return (BOOLEAN) (SystemStates[3] & BIT7); -}