UefiLib:
Add two new interfaces of EfiCreateEventLegacyBootEx & EfiCreateEventReadyToBootEx Fix a bug in EfiCreateEventLegacyBoot & EfiCreateEventReadyToBoot. (#51) PciLib: Add missing ASSERT()s in PciReadBuffer() & PciWriteBuffer() (#70) IoLib Add ASSERT()s to check alignment. MemoryAllocationLib: For AllocateXXXCopyBuffer(). Add ASSERT()s for cases when allocations fails. BaseLib: Change the return type of InternalMathModU64x32 from UINT64 to UINT32 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@416 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -415,6 +415,34 @@ EfiCreateEventLegacyBoot (
|
|||||||
OUT EFI_EVENT *LegacyBootEvent
|
OUT EFI_EVENT *LegacyBootEvent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create an EFI event in the Legacy Boot Event Group and allows
|
||||||
|
the caller to specify a notification function.
|
||||||
|
|
||||||
|
This function abstracts the creation of the Legacy Boot Event.
|
||||||
|
The Framework moved from a proprietary to UEFI 2.0 based mechanism.
|
||||||
|
This library abstracts the caller from how this event is created to prevent
|
||||||
|
to code form having to change with the version of the specification supported.
|
||||||
|
If LegacyBootEvent is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param NotifyTpl The task priority level of the event.
|
||||||
|
@param NotifyFunction The notification function to call when the event is signaled.
|
||||||
|
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.
|
||||||
|
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Event was created.
|
||||||
|
@retval Other Event was not created.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
EfiCreateEventLegacyBootEx (
|
||||||
|
IN EFI_TPL NotifyTpl,
|
||||||
|
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||||
|
IN VOID *NotifyContext, OPTIONAL
|
||||||
|
OUT EFI_EVENT *LegacyBootEvent
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a Read to Boot Event.
|
Create a Read to Boot Event.
|
||||||
|
|
||||||
@ -437,6 +465,34 @@ EfiCreateEventReadyToBoot (
|
|||||||
OUT EFI_EVENT *ReadyToBootEvent
|
OUT EFI_EVENT *ReadyToBootEvent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create an EFI event in the Ready To Boot Event Group and allows
|
||||||
|
the caller to specify a notification function.
|
||||||
|
|
||||||
|
This function abstracts the creation of the Ready to Boot Event.
|
||||||
|
The Framework moved from a proprietary to UEFI 2.0 based mechanism.
|
||||||
|
This library abstracts the caller from how this event is created to prevent
|
||||||
|
to code form having to change with the version of the specification supported.
|
||||||
|
If ReadyToBootEvent is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param NotifyTpl The task priority level of the event.
|
||||||
|
@param NotifyFunction The notification function to call when the event is signaled.
|
||||||
|
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.
|
||||||
|
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Event was created.
|
||||||
|
@retval Other Event was not created.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
EfiCreateEventReadyToBootEx (
|
||||||
|
IN EFI_TPL NotifyTpl,
|
||||||
|
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||||
|
IN VOID *NotifyContext, OPTIONAL
|
||||||
|
OUT EFI_EVENT *ReadyToBootEvent
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize a Firmware Volume (FV) Media Device Path node.
|
Initialize a Firmware Volume (FV) Media Device Path node.
|
||||||
|
|
||||||
|
@ -121,14 +121,14 @@ InternalMathDivU64x32 (
|
|||||||
return Dividend / Divisor;
|
return Dividend / Divisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT64
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalMathModU64x32 (
|
InternalMathModU64x32 (
|
||||||
IN UINT64 Dividend,
|
IN UINT64 Dividend,
|
||||||
IN UINT32 Divisor
|
IN UINT32 Divisor
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return Dividend % Divisor;
|
return (UINT32)(Dividend % Divisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT64
|
UINT64
|
||||||
|
@ -1298,6 +1298,11 @@ PciCf8ReadBuffer (
|
|||||||
{
|
{
|
||||||
UINTN EndAddress;
|
UINTN EndAddress;
|
||||||
|
|
||||||
|
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
|
||||||
|
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
|
||||||
|
ASSERT ((StartAddress + Size - 1) <= 0x0FFFFFFF);
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
EndAddress = StartAddress + Size;
|
EndAddress = StartAddress + Size;
|
||||||
|
|
||||||
if (StartAddress < EndAddress && (StartAddress & 1)) {
|
if (StartAddress < EndAddress && (StartAddress & 1)) {
|
||||||
@ -1382,6 +1387,11 @@ PciCf8WriteBuffer (
|
|||||||
{
|
{
|
||||||
UINTN EndAddress;
|
UINTN EndAddress;
|
||||||
|
|
||||||
|
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
|
||||||
|
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
|
||||||
|
ASSERT ((StartAddress + Size - 1) <= 0x0FFFFFFF);
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
EndAddress = StartAddress + Size;
|
EndAddress = StartAddress + Size;
|
||||||
|
|
||||||
if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) {
|
if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) {
|
||||||
|
@ -1195,6 +1195,11 @@ PciExpressReadBuffer (
|
|||||||
{
|
{
|
||||||
UINTN EndAddress;
|
UINTN EndAddress;
|
||||||
|
|
||||||
|
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
|
||||||
|
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
|
||||||
|
ASSERT ((StartAddress + Size - 1) <= 0x0FFFFFFF);
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
EndAddress = StartAddress + Size;
|
EndAddress = StartAddress + Size;
|
||||||
|
|
||||||
if (StartAddress < EndAddress && (StartAddress & 1)) {
|
if (StartAddress < EndAddress && (StartAddress & 1)) {
|
||||||
@ -1278,6 +1283,11 @@ PciExpressWriteBuffer (
|
|||||||
{
|
{
|
||||||
UINTN EndAddress;
|
UINTN EndAddress;
|
||||||
|
|
||||||
|
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
|
||||||
|
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
|
||||||
|
ASSERT ((StartAddress + Size - 1) <= 0x0FFFFFFF);
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
EndAddress = StartAddress + Size;
|
EndAddress = StartAddress + Size;
|
||||||
|
|
||||||
if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) {
|
if ((StartAddress < EndAddress) && ((StartAddress & 1)!= 0)) {
|
||||||
|
@ -474,6 +474,9 @@ InternalAllocateCopyPool (
|
|||||||
{
|
{
|
||||||
VOID *Memory;
|
VOID *Memory;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
|
||||||
|
|
||||||
Memory = InternalAllocatePool (PoolType, AllocationSize);
|
Memory = InternalAllocatePool (PoolType, AllocationSize);
|
||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
||||||
@ -793,6 +796,9 @@ InternalAllocateAlignedCopyPool (
|
|||||||
{
|
{
|
||||||
VOID *Memory;
|
VOID *Memory;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
|
||||||
|
|
||||||
Memory = InternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);
|
Memory = InternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);
|
||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
||||||
|
@ -39,7 +39,6 @@ IoRead8 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
|
||||||
return CpuIo->IoRead8 (PeiServices, CpuIo, (UINT64) Port);
|
return CpuIo->IoRead8 (PeiServices, CpuIo, (UINT64) Port);
|
||||||
@ -72,7 +71,6 @@ IoWrite8 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
|
||||||
CpuIo->IoWrite8 (PeiServices, CpuIo, (UINT64) Port, Value);
|
CpuIo->IoWrite8 (PeiServices, CpuIo, (UINT64) Port, Value);
|
||||||
@ -104,9 +102,11 @@ IoRead16 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Port is aligned on a 16-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Port & 1) == 0);
|
||||||
return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64) Port);
|
return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64) Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,9 +137,11 @@ IoWrite16 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Port is aligned on a 16-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Port & 1) == 0);
|
||||||
CpuIo->IoWrite16 (PeiServices, CpuIo, (UINT64) Port, Value);
|
CpuIo->IoWrite16 (PeiServices, CpuIo, (UINT64) Port, Value);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
@ -169,9 +171,11 @@ IoRead32 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Port is aligned on a 32-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Port & 3) == 0);
|
||||||
return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64) Port);
|
return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64) Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,9 +206,11 @@ IoWrite32 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Port is aligned on a 32-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Port & 3) == 0);
|
||||||
CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64) Port, Value);
|
CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64) Port, Value);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
@ -234,9 +240,11 @@ IoRead64 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Port is aligned on a 64-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Port & 7) == 0);
|
||||||
return CpuIo->IoRead64 (PeiServices, CpuIo, (UINT64) Port);
|
return CpuIo->IoRead64 (PeiServices, CpuIo, (UINT64) Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,9 +275,11 @@ IoWrite64 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Port is aligned on a 64-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Port & 7) == 0);
|
||||||
CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64) Port, Value);
|
CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64) Port, Value);
|
||||||
return Value;;
|
return Value;;
|
||||||
}
|
}
|
||||||
@ -299,7 +309,6 @@ MmioRead8 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
|
||||||
return CpuIo->MemRead8 (PeiServices, CpuIo, (UINT64) Address);
|
return CpuIo->MemRead8 (PeiServices, CpuIo, (UINT64) Address);
|
||||||
@ -330,7 +339,6 @@ MmioWrite8 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
|
||||||
CpuIo->MemWrite8 (PeiServices, CpuIo, (UINT64) Address, Value);
|
CpuIo->MemWrite8 (PeiServices, CpuIo, (UINT64) Address, Value);
|
||||||
@ -362,9 +370,11 @@ MmioRead16 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Address is aligned on a 16-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Address & 1) == 0);
|
||||||
return CpuIo->MemRead16 (PeiServices, CpuIo, (UINT64) Address);
|
return CpuIo->MemRead16 (PeiServices, CpuIo, (UINT64) Address);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -394,9 +404,11 @@ MmioWrite16 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Address is aligned on a 16-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Address & 1) == 0);
|
||||||
CpuIo->MemWrite16 (PeiServices, CpuIo, (UINT64) Address, Value);
|
CpuIo->MemWrite16 (PeiServices, CpuIo, (UINT64) Address, Value);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
@ -426,9 +438,11 @@ MmioRead32 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Address is aligned on a 32-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Address & 3) == 0);
|
||||||
return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64) Address);
|
return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64) Address);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -458,9 +472,11 @@ MmioWrite32 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Address is aligned on a 32-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Address & 3) == 0);
|
||||||
CpuIo->MemWrite32 (PeiServices, CpuIo, (UINT64) Address, Value);
|
CpuIo->MemWrite32 (PeiServices, CpuIo, (UINT64) Address, Value);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
@ -490,9 +506,11 @@ MmioRead64 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Address is aligned on a 64-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Address & 7) == 0);
|
||||||
return CpuIo->MemRead64 (PeiServices, CpuIo, (UINT64) Address);
|
return CpuIo->MemRead64 (PeiServices, CpuIo, (UINT64) Address);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -522,9 +540,11 @@ MmioWrite64 (
|
|||||||
|
|
||||||
PeiServices = GetPeiServicesTablePointer ();
|
PeiServices = GetPeiServicesTablePointer ();
|
||||||
CpuIo = (*PeiServices)->CpuIo;
|
CpuIo = (*PeiServices)->CpuIo;
|
||||||
|
|
||||||
ASSERT (CpuIo != NULL);
|
ASSERT (CpuIo != NULL);
|
||||||
|
//
|
||||||
|
// Make sure Address is aligned on a 64-bit boundary.
|
||||||
|
//
|
||||||
|
ASSERT ((Address & 7) == 0);
|
||||||
CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64) Address, Value);
|
CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64) Address, Value);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
@ -451,6 +451,9 @@ InternalAllocateCopyPool (
|
|||||||
{
|
{
|
||||||
VOID *Memory;
|
VOID *Memory;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
|
||||||
|
|
||||||
Memory = InternalAllocatePool (PoolType, AllocationSize);
|
Memory = InternalAllocatePool (PoolType, AllocationSize);
|
||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
||||||
@ -477,6 +480,9 @@ AllocateCopyPool (
|
|||||||
{
|
{
|
||||||
VOID *Memory;
|
VOID *Memory;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
|
||||||
|
|
||||||
Memory = AllocatePool (AllocationSize);
|
Memory = AllocatePool (AllocationSize);
|
||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
||||||
@ -791,6 +797,9 @@ InternalAllocateAlignedCopyPool (
|
|||||||
{
|
{
|
||||||
VOID *Memory;
|
VOID *Memory;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
|
||||||
|
|
||||||
Memory = InternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);
|
Memory = InternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);
|
||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
||||||
@ -820,6 +829,9 @@ AllocateAlignedCopyPool (
|
|||||||
{
|
{
|
||||||
VOID *Memory;
|
VOID *Memory;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
|
||||||
|
|
||||||
Memory = AllocateAlignedPool (AllocationSize, Alignment);
|
Memory = AllocateAlignedPool (AllocationSize, Alignment);
|
||||||
if (Memory != NULL) {
|
if (Memory != NULL) {
|
||||||
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
Memory = CopyMem (Memory, Buffer, AllocationSize);
|
||||||
|
@ -16,7 +16,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
/**
|
||||||
|
An empty function to pass error checking of CreateEventEx ().
|
||||||
|
|
||||||
|
This empty function enusres that EFI_EVENT_NOTIFY_SIGNAL_ALL is error
|
||||||
|
checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
InternalEmptyFuntion (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a Legacy Boot Event.
|
Create a Legacy Boot Event.
|
||||||
@ -39,6 +53,42 @@ EFIAPI
|
|||||||
EfiCreateEventLegacyBoot (
|
EfiCreateEventLegacyBoot (
|
||||||
OUT EFI_EVENT *LegacyBootEvent
|
OUT EFI_EVENT *LegacyBootEvent
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
return EfiCreateEventLegacyBootEx (
|
||||||
|
EFI_TPL_CALLBACK,
|
||||||
|
InternalEmptyFuntion,
|
||||||
|
NULL,
|
||||||
|
LegacyBootEvent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create an EFI event in the Legacy Boot Event Group and allows
|
||||||
|
the caller to specify a notification function.
|
||||||
|
|
||||||
|
This function abstracts the creation of the Legacy Boot Event.
|
||||||
|
The Framework moved from a proprietary to UEFI 2.0 based mechanism.
|
||||||
|
This library abstracts the caller from how this event is created to prevent
|
||||||
|
to code form having to change with the version of the specification supported.
|
||||||
|
If LegacyBootEvent is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param NotifyTpl The task priority level of the event.
|
||||||
|
@param NotifyFunction The notification function to call when the event is signaled.
|
||||||
|
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.
|
||||||
|
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Event was created.
|
||||||
|
@retval Other Event was not created.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
EfiCreateEventLegacyBootEx (
|
||||||
|
IN EFI_TPL NotifyTpl,
|
||||||
|
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||||
|
IN VOID *NotifyContext, OPTIONAL
|
||||||
|
OUT EFI_EVENT *LegacyBootEvent
|
||||||
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
@ -50,9 +100,9 @@ EfiCreateEventLegacyBoot (
|
|||||||
//
|
//
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EFI_EVENT_SIGNAL_LEGACY_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
|
EFI_EVENT_SIGNAL_LEGACY_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
|
||||||
EFI_TPL_CALLBACK,
|
NotifyTpl,
|
||||||
NULL,
|
NotifyFunction,
|
||||||
NULL,
|
NotifyContext,
|
||||||
LegacyBootEvent
|
LegacyBootEvent
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@ -61,18 +111,17 @@ EfiCreateEventLegacyBoot (
|
|||||||
//
|
//
|
||||||
Status = gBS->CreateEventEx (
|
Status = gBS->CreateEventEx (
|
||||||
EVENT_NOTIFY_SIGNAL,
|
EVENT_NOTIFY_SIGNAL,
|
||||||
EFI_TPL_CALLBACK,
|
NotifyTpl,
|
||||||
NULL,
|
NotifyFunction,
|
||||||
NULL,
|
NotifyContext,
|
||||||
&gEfiEventLegacyBootGuid,
|
&gEfiEventLegacyBootGuid,
|
||||||
LegacyBootEvent
|
LegacyBootEvent
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a Read to Boot Event.
|
Create a Read to Boot Event.
|
||||||
|
|
||||||
@ -94,6 +143,42 @@ EFIAPI
|
|||||||
EfiCreateEventReadyToBoot (
|
EfiCreateEventReadyToBoot (
|
||||||
OUT EFI_EVENT *ReadyToBootEvent
|
OUT EFI_EVENT *ReadyToBootEvent
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
return EfiCreateEventReadyToBootEx (
|
||||||
|
EFI_TPL_CALLBACK,
|
||||||
|
InternalEmptyFuntion,
|
||||||
|
NULL,
|
||||||
|
ReadyToBootEvent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create an EFI event in the Ready To Boot Event Group and allows
|
||||||
|
the caller to specify a notification function.
|
||||||
|
|
||||||
|
This function abstracts the creation of the Ready to Boot Event.
|
||||||
|
The Framework moved from a proprietary to UEFI 2.0 based mechanism.
|
||||||
|
This library abstracts the caller from how this event is created to prevent
|
||||||
|
to code form having to change with the version of the specification supported.
|
||||||
|
If ReadyToBootEvent is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param NotifyTpl The task priority level of the event.
|
||||||
|
@param NotifyFunction The notification function to call when the event is signaled.
|
||||||
|
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.
|
||||||
|
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Event was created.
|
||||||
|
@retval Other Event was not created.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
EfiCreateEventReadyToBootEx (
|
||||||
|
IN EFI_TPL NotifyTpl,
|
||||||
|
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||||
|
IN VOID *NotifyContext, OPTIONAL
|
||||||
|
OUT EFI_EVENT *ReadyToBootEvent
|
||||||
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
@ -105,9 +190,9 @@ EfiCreateEventReadyToBoot (
|
|||||||
//
|
//
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
|
EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
|
||||||
EFI_TPL_CALLBACK,
|
NotifyTpl,
|
||||||
NULL,
|
NotifyFunction,
|
||||||
NULL,
|
NotifyContext,
|
||||||
ReadyToBootEvent
|
ReadyToBootEvent
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@ -116,9 +201,9 @@ EfiCreateEventReadyToBoot (
|
|||||||
//
|
//
|
||||||
Status = gBS->CreateEventEx (
|
Status = gBS->CreateEventEx (
|
||||||
EVENT_NOTIFY_SIGNAL,
|
EVENT_NOTIFY_SIGNAL,
|
||||||
EFI_TPL_CALLBACK,
|
NotifyTpl,
|
||||||
NULL,
|
NotifyFunction,
|
||||||
NULL,
|
NotifyContext,
|
||||||
&gEfiEventReadyToBootGuid,
|
&gEfiEventReadyToBootGuid,
|
||||||
ReadyToBootEvent
|
ReadyToBootEvent
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user