mirror of https://github.com/acidanthera/audk.git
107 lines
2.5 KiB
C
107 lines
2.5 KiB
C
|
/**@file
|
||
|
|
||
|
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
||
|
Copyright (c) 2011, Andrei Warkentin <andreiw@motorola.com>
|
||
|
|
||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||
|
|
||
|
**/
|
||
|
|
||
|
//
|
||
|
// The package level header files this module uses
|
||
|
//
|
||
|
#include <PiPei.h>
|
||
|
|
||
|
//
|
||
|
// The Library classes this module consumes
|
||
|
//
|
||
|
#include <Library/BaseMemoryLib.h>
|
||
|
#include <Library/BaseLib.h>
|
||
|
#include <Library/DebugLib.h>
|
||
|
#include <Library/HobLib.h>
|
||
|
#include <Library/PlatformInitLib.h>
|
||
|
|
||
|
VOID
|
||
|
EFIAPI
|
||
|
PlatformAddIoMemoryBaseSizeHob (
|
||
|
IN EFI_PHYSICAL_ADDRESS MemoryBase,
|
||
|
IN UINT64 MemorySize
|
||
|
)
|
||
|
{
|
||
|
BuildResourceDescriptorHob (
|
||
|
EFI_RESOURCE_MEMORY_MAPPED_IO,
|
||
|
EFI_RESOURCE_ATTRIBUTE_PRESENT |
|
||
|
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
|
||
|
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
|
||
|
EFI_RESOURCE_ATTRIBUTE_TESTED,
|
||
|
MemoryBase,
|
||
|
MemorySize
|
||
|
);
|
||
|
}
|
||
|
|
||
|
VOID
|
||
|
EFIAPI
|
||
|
PlatformAddReservedMemoryBaseSizeHob (
|
||
|
IN EFI_PHYSICAL_ADDRESS MemoryBase,
|
||
|
IN UINT64 MemorySize,
|
||
|
IN BOOLEAN Cacheable
|
||
|
)
|
||
|
{
|
||
|
BuildResourceDescriptorHob (
|
||
|
EFI_RESOURCE_MEMORY_RESERVED,
|
||
|
EFI_RESOURCE_ATTRIBUTE_PRESENT |
|
||
|
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
|
||
|
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
|
||
|
(Cacheable ?
|
||
|
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
|
||
|
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
|
||
|
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE :
|
||
|
0
|
||
|
) |
|
||
|
EFI_RESOURCE_ATTRIBUTE_TESTED,
|
||
|
MemoryBase,
|
||
|
MemorySize
|
||
|
);
|
||
|
}
|
||
|
|
||
|
VOID
|
||
|
EFIAPI
|
||
|
PlatformAddIoMemoryRangeHob (
|
||
|
IN EFI_PHYSICAL_ADDRESS MemoryBase,
|
||
|
IN EFI_PHYSICAL_ADDRESS MemoryLimit
|
||
|
)
|
||
|
{
|
||
|
PlatformAddIoMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));
|
||
|
}
|
||
|
|
||
|
VOID
|
||
|
EFIAPI
|
||
|
PlatformAddMemoryBaseSizeHob (
|
||
|
IN EFI_PHYSICAL_ADDRESS MemoryBase,
|
||
|
IN UINT64 MemorySize
|
||
|
)
|
||
|
{
|
||
|
BuildResourceDescriptorHob (
|
||
|
EFI_RESOURCE_SYSTEM_MEMORY,
|
||
|
EFI_RESOURCE_ATTRIBUTE_PRESENT |
|
||
|
EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
|
||
|
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
|
||
|
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
|
||
|
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
|
||
|
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
|
||
|
EFI_RESOURCE_ATTRIBUTE_TESTED,
|
||
|
MemoryBase,
|
||
|
MemorySize
|
||
|
);
|
||
|
}
|
||
|
|
||
|
VOID
|
||
|
EFIAPI
|
||
|
PlatformAddMemoryRangeHob (
|
||
|
IN EFI_PHYSICAL_ADDRESS MemoryBase,
|
||
|
IN EFI_PHYSICAL_ADDRESS MemoryLimit
|
||
|
)
|
||
|
{
|
||
|
PlatformAddMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));
|
||
|
}
|