OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <Guid/OcVariable.h>
#include <Protocol/AppleRamDisk.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcAppleRamDiskLib.h>
#include <Library/OcFileLib.h>
#include <Library/OcMemoryLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcCryptoLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiLib.h>
Go to the source code of this file.
Macros | |
#define | INTERNAL_ASSERT_EXTENT_TABLE_VALID(ExtentTable) |
Functions | |
STATIC VOID | InternalAddAllocatedArea (IN OUT APPLE_RAM_DISK_EXTENT_TABLE **ExtentTable, IN EFI_PHYSICAL_ADDRESS AllocatedArea, IN UINTN AllocatedAreaSize) |
STATIC UINTN | InternalAllocateRemainingSize (IN EFI_PHYSICAL_ADDRESS BaseAddress, IN EFI_PHYSICAL_ADDRESS TopAddress, IN EFI_MEMORY_TYPE MemoryType, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINTN RemainingSize, IN OUT APPLE_RAM_DISK_EXTENT_TABLE **ExtentTable) |
STATIC CONST APPLE_RAM_DISK_EXTENT_TABLE * | InternalAppleRamDiskAllocate (IN UINTN Size, IN EFI_MEMORY_TYPE MemoryType, IN BOOLEAN PreferHighMem) |
CONST APPLE_RAM_DISK_EXTENT_TABLE * | OcAppleRamDiskAllocate (IN UINTN Size, IN EFI_MEMORY_TYPE MemoryType) |
BOOLEAN | OcAppleRamDiskRead (IN CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable, IN UINTN Offset, IN UINTN Size, OUT VOID *Buffer) |
BOOLEAN | OcAppleRamDiskWrite (IN CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable, IN UINTN Offset, IN UINTN Size, IN CONST VOID *Buffer) |
BOOLEAN | OcAppleRamDiskLoadFile (IN CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable, IN EFI_FILE_PROTOCOL *File, IN UINTN FileSize) |
VOID | OcAppleRamDiskFree (IN CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable) |
Apple RAM Disk library.
Copyright (C) 2019, Download-Fritz. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcAppleRamDiskLib.c.
#define INTERNAL_ASSERT_EXTENT_TABLE_VALID | ( | ExtentTable | ) |
Definition at line 34 of file OcAppleRamDiskLib.c.
STATIC VOID InternalAddAllocatedArea | ( | IN OUT APPLE_RAM_DISK_EXTENT_TABLE ** | ExtentTable, |
IN EFI_PHYSICAL_ADDRESS | AllocatedArea, | ||
IN UINTN | AllocatedAreaSize ) |
Insert allocated area into extent list. If no extent list was created, then it gets allocated.
[in,out] | ExtentTable | Extent table, potentially pointing to NULL. |
[in] | AllocatedArea | Allocated area of 1 or more pages. @paran[in] AllocatedAreaSize Actual size of allocated area in bytes. |
Definition at line 52 of file OcAppleRamDiskLib.c.
STATIC UINTN InternalAllocateRemainingSize | ( | IN EFI_PHYSICAL_ADDRESS | BaseAddress, |
IN EFI_PHYSICAL_ADDRESS | TopAddress, | ||
IN EFI_MEMORY_TYPE | MemoryType, | ||
IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
IN UINTN | MemoryMapSize, | ||
IN UINTN | DescriptorSize, | ||
IN UINTN | RemainingSize, | ||
IN OUT APPLE_RAM_DISK_EXTENT_TABLE ** | ExtentTable ) |
Perform allocation of RemainingSize data with biggest contiguous area first strategy. Allocation extent map is put to the first allocated extent.
[in] | BaseAddress | Starting allocation address. |
[in] | TopAddress | Ending allocation address. |
[in] | MemoryType | Requested memory type. |
[in,out] | MemoryMap | Current memory map modified as we go. |
[in] | MemoryMapSize | Current memory map size. |
[in] | DescriptorSize | Current memory map descriptor size. |
[in] | RemainingSize | Remaining size to allocate. |
[in,out] | ExtentTable | Updated pointer to allocated area. |
Size | of allocated data. |
Definition at line 112 of file OcAppleRamDiskLib.c.
STATIC CONST APPLE_RAM_DISK_EXTENT_TABLE * InternalAppleRamDiskAllocate | ( | IN UINTN | Size, |
IN EFI_MEMORY_TYPE | MemoryType, | ||
IN BOOLEAN | PreferHighMem ) |
Request allocation of Size bytes in extents table. Extents are put to the first allocated page.
[in] | Size | Requested memory size. |
[in] | MemoryType | Requested memory type. |
[in] | PreferHighMem | Try to allocate in upper 4GB first. |
Allocated | extent table. |
Definition at line 237 of file OcAppleRamDiskLib.c.
CONST APPLE_RAM_DISK_EXTENT_TABLE * OcAppleRamDiskAllocate | ( | IN UINTN | Size, |
IN EFI_MEMORY_TYPE | MemoryType ) |
Request allocation of Size bytes in extents table.
[in] | Size | Requested memory size. |
[in] | MemoryType | Requested memory type. |
Allocated | extent table. |
Definition at line 322 of file OcAppleRamDiskLib.c.
VOID OcAppleRamDiskFree | ( | IN CONST APPLE_RAM_DISK_EXTENT_TABLE * | ExtentTable | ) |
Free RAM disk.
[in] | ExtentTable | Allocated extent table. |
Definition at line 602 of file OcAppleRamDiskLib.c.
BOOLEAN OcAppleRamDiskLoadFile | ( | IN CONST APPLE_RAM_DISK_EXTENT_TABLE * | ExtentTable, |
IN EFI_FILE_PROTOCOL * | File, | ||
IN UINTN | FileSize ) |
Definition at line 472 of file OcAppleRamDiskLib.c.
BOOLEAN OcAppleRamDiskRead | ( | IN CONST APPLE_RAM_DISK_EXTENT_TABLE * | ExtentTable, |
IN UINTN | Offset, | ||
IN UINTN | Size, | ||
OUT VOID * | Buffer ) |
Read RAM disk data.
[in] | ExtentTable | Allocated extent table. |
[in] | Offset | Offset in RAM disk. |
[in] | Size | Amount of data to read. |
[out] | Buffer | Resulting data. |
TRUE | on success. |
Definition at line 354 of file OcAppleRamDiskLib.c.
BOOLEAN OcAppleRamDiskWrite | ( | IN CONST APPLE_RAM_DISK_EXTENT_TABLE * | ExtentTable, |
IN UINTN | Offset, | ||
IN UINTN | Size, | ||
IN CONST VOID * | Buffer ) |
Write RAM disk data.
[in] | ExtentTable | Allocated extent table. |
[in] | Offset | Offset in RAM disk. |
[in] | Size | Amount of data to write. |
[in] | Buffer | Source data. |
TRUE | on success. |
Definition at line 413 of file OcAppleRamDiskLib.c.