#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/DebugLib.h>\r
-#include <Library/QemuFwCfgLib.h>\r
-#include <Library/QemuFwCfgS3Lib.h>\r
#include <Protocol/LockBox.h>\r
#include <LockBoxLib.h>\r
\r
\r
@param MemoryType Memory type of memory to allocate.\r
@param Size Size of memory to allocate.\r
- \r
+\r
@return Allocated address for output.\r
\r
**/\r
STATIC\r
VOID *\r
AllocateMemoryBelow4G (\r
- IN EFI_MEMORY_TYPE MemoryType,\r
- IN UINTN Size\r
+ IN EFI_MEMORY_TYPE MemoryType,\r
+ IN UINTN Size\r
)\r
{\r
UINTN Pages;\r
EFI_PHYSICAL_ADDRESS Address;\r
EFI_STATUS Status;\r
- VOID* Buffer;\r
+ VOID *Buffer;\r
UINTN AllocRemaining;\r
\r
- Pages = EFI_SIZE_TO_PAGES (Size);\r
+ Pages = EFI_SIZE_TO_PAGES (Size);\r
Address = 0xffffffff;\r
\r
//\r
// allocations, and use these to allocate memory for small buffers.\r
//\r
ASSERT (mLockBoxGlobal->Signature == LOCK_BOX_GLOBAL_SIGNATURE);\r
- if ((UINTN) mLockBoxGlobal->SubPageRemaining >= Size) {\r
- Buffer = (VOID*)(UINTN) mLockBoxGlobal->SubPageBuffer;\r
- mLockBoxGlobal->SubPageBuffer += (UINT32) Size;\r
- mLockBoxGlobal->SubPageRemaining -= (UINT32) Size;\r
+ if ((UINTN)mLockBoxGlobal->SubPageRemaining >= Size) {\r
+ Buffer = (VOID *)(UINTN)mLockBoxGlobal->SubPageBuffer;\r
+ mLockBoxGlobal->SubPageBuffer += (UINT32)Size;\r
+ mLockBoxGlobal->SubPageRemaining -= (UINT32)Size;\r
return Buffer;\r
}\r
\r
- Status = gBS->AllocatePages (\r
- AllocateMaxAddress,\r
- MemoryType,\r
- Pages,\r
- &Address\r
- );\r
+ Status = gBS->AllocatePages (\r
+ AllocateMaxAddress,\r
+ MemoryType,\r
+ Pages,\r
+ &Address\r
+ );\r
if (EFI_ERROR (Status)) {\r
return NULL;\r
}\r
\r
- Buffer = (VOID *) (UINTN) Address;\r
+ Buffer = (VOID *)(UINTN)Address;\r
ZeroMem (Buffer, EFI_PAGES_TO_SIZE (Pages));\r
\r
AllocRemaining = EFI_PAGES_TO_SIZE (Pages) - Size;\r
- if (AllocRemaining > (UINTN) mLockBoxGlobal->SubPageRemaining) {\r
- mLockBoxGlobal->SubPageBuffer = (UINT32) (Address + Size);\r
- mLockBoxGlobal->SubPageRemaining = (UINT32) AllocRemaining;\r
+ if (AllocRemaining > (UINTN)mLockBoxGlobal->SubPageRemaining) {\r
+ mLockBoxGlobal->SubPageBuffer = (UINT32)(Address + Size);\r
+ mLockBoxGlobal->SubPageRemaining = (UINT32)AllocRemaining;\r
}\r
\r
return Buffer;\r
}\r
\r
-\r
/**\r
Allocates a buffer of type EfiACPIMemoryNVS.\r
\r
return AllocateMemoryBelow4G (EfiACPIMemoryNVS, AllocationSize);\r
}\r
\r
-\r
EFI_STATUS\r
EFIAPI\r
LockBoxDxeLibInitialize (\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
- VOID *Interface;\r
+ EFI_STATUS Status;\r
+ VOID *Interface;\r
\r
Status = LockBoxLibInitialize ();\r
if (!EFI_ERROR (Status)) {\r
- if (QemuFwCfgS3Enabled ()) {\r
+ if (PcdGetBool (PcdAcpiS3Enable)) {\r
//\r
// When S3 enabled, the first driver run with this library linked will\r
// have this library constructor to install LockBox protocol on the\r