-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create memory bin override library to allow for more extensive platfo…
…rm customization (#194) Adds a memory bin override library that allows a platform to customize logic around memory bin locations in DXE. - [ ] Impacts functionality? - [ ] Impacts security? - [x] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? Tested on the Q35 platform with a custom memory bin override library Add the new NULL version of the library to the platform DSC file ``` MemoryBinOverrideLib|MdeModulePkg/Library/MemoryBinOverrideLibNull/MemoryBinOverrideLibNull.inf ```
- Loading branch information
1 parent
9a7c897
commit 76b86ea
Showing
9 changed files
with
172 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** @file | ||
Header definitions for the memory bin override library. This library allows | ||
a platform to override the location or size of the memory type bins. | ||
Copyright (c) Microsoft Corporation | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MEMORY_BIN_OVERRIDE_LIB_H__ | ||
#define MEMORY_BIN_OVERRIDE_LIB_H__ | ||
|
||
/** | ||
Reports a runtime memory bin location to the override library. | ||
@param[in] Type The memory type for the reported bin. | ||
@param[in] BaseAddress The base physical address of the reported bin. | ||
@param[in] NumberOfPages The number of pages in the reported bin. | ||
**/ | ||
VOID | ||
EFIAPI | ||
ReportMemoryBinLocation ( | ||
IN EFI_MEMORY_TYPE Type, | ||
IN EFI_PHYSICAL_ADDRESS BaseAddress, | ||
IN UINT64 NumberOfPages | ||
); | ||
|
||
/** | ||
Checks if the library needs to override the given memory bin allocation type, | ||
location, and size. If this function encounters internal errors, the | ||
parameters should remain unchanged. | ||
@param[in] Type The memory type of the bin. | ||
@param[out] BaseAddress The base address of the bin override on return. | ||
@param[out] NumberOfPages The number of pages of the bin override on return. | ||
@param[out] AllocationType The allocation type for the bin, AllocateAddress | ||
if an override was provided. | ||
**/ | ||
VOID | ||
EFIAPI | ||
GetMemoryBinOverride ( | ||
IN EFI_MEMORY_TYPE Type, | ||
OUT EFI_PHYSICAL_ADDRESS *BaseAddress, | ||
OUT UINT32 *NumberOfPages, | ||
OUT EFI_ALLOCATE_TYPE *AllocationType | ||
); | ||
|
||
#endif |
52 changes: 52 additions & 0 deletions
52
MdeModulePkg/Library/MemoryBinOverrideLibNull/MemoryBinOverrideLibNull.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
NULL implementation of the memory bin override lib. | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <Uefi.h> | ||
#include <Library/BaseLib.h> | ||
#include <Library/MemoryBinOverrideLib.h> | ||
|
||
/** | ||
Reports a runtime memory bin location to the override library. | ||
@param[in] Type The memory type for the reported bin. | ||
@param[in] BaseAddress The base physical address of the reported bin. | ||
@param[in] NumberOfPages The number of pages in the reported bin. | ||
**/ | ||
VOID | ||
EFIAPI | ||
ReportMemoryBinLocation ( | ||
IN EFI_MEMORY_TYPE Type, | ||
IN EFI_PHYSICAL_ADDRESS BaseAddress, | ||
IN UINT64 NumberOfPages | ||
) | ||
{ | ||
return; | ||
} | ||
|
||
/** | ||
Checks if the library needs to override the given memory bin allocation type, | ||
location, and size. If this function encounters internal errors, the | ||
parameters should remain unchanged. | ||
@param[in] Type The memory type of the bin. | ||
@param[out] BaseAddress The base address of the bin override on return. | ||
@param[out] NumberOfPages The number of pages of the bin override on return. | ||
@param[out] AllocationType The allocation type for the bin, AllocateAddress | ||
if an override was provided. | ||
**/ | ||
VOID | ||
EFIAPI | ||
GetMemoryBinOverride ( | ||
IN EFI_MEMORY_TYPE Type, | ||
OUT EFI_PHYSICAL_ADDRESS *BaseAddress, | ||
OUT UINT32 *NumberOfPages, | ||
OUT EFI_ALLOCATE_TYPE *AllocationType | ||
) | ||
{ | ||
return; | ||
} |
31 changes: 31 additions & 0 deletions
31
MdeModulePkg/Library/MemoryBinOverrideLibNull/MemoryBinOverrideLibNull.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## @file | ||
# NULL implementation of the memory bin override lib. | ||
# | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 1.27 | ||
BASE_NAME = MemoryOverrideLibNull | ||
FILE_GUID = 368687CE-3189-4C26-A6EB-615B64CAA911 | ||
MODULE_TYPE = DXE_CORE | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = MemoryBinOverrideLib | ||
|
||
# | ||
# The following information is for reference only and not required by the build tools. | ||
# | ||
# VALID_ARCHITECTURES = IA32 X64 AARCH64 | ||
# | ||
|
||
[Sources] | ||
MemoryBinOverrideLibNull.c | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
MdeModulePkg/MdeModulePkg.dec | ||
|
||
[LibraryClasses] | ||
BaseLib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters