EFI MEMORY TYPE

From PhoenixWiki

Jump to: navigation, search

Prototype

typedef enum {
  EfiReservedMemoryType,
  EfiLoaderCode,
  EfiLoaderData,
  EfiBootServicesCode,
  EfiBootServicesData,
  EfiRuntimeServicesCode,
  EfiRuntimeServicesData,
  EfiConventionalMemory,
  EfiUnusableMemory,
  EfiACPIReclaimMemory,
  EfiACPIMemoryNVS,
  EfiMemoryMappedIO,
  EfiMemoryMappedIOPortSpace,
  EfiPalCode,
  EfiMaxMemoryType
} EFI_MEMORY_TYPE;

Description

When memory is allocated, it is “typed” according to the values in EFI_MEMORY_TYPE. Some of the types have a different usage before ExitBootServices() is called than they do afterwards. The first table below lists each type and its usage before the call; the second lists each type and its usage after the call.



Memory Type Usage before ExitBootServices()
Mnemonic Description
EfiReservedMemoryType Not used.
EfiLoaderCode The code portions of a loaded application. (Note that UEFI OS loaders are UEFI applications.)
EfiLoaderData The data portions of a loaded application and the default data allocation type used by an application to allocate pool memory.
EfiBootServicesCode The code portions of a loaded Boot Services Driver.
EfiBootServicesData The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot Services Driver to allocate pool memory.
EfiRuntimeServicesCode The code portions of a loaded Runtime Services Driver.
EfiRuntimeServicesData The data portions of a loaded Runtime Services Driver and the default data allocation type used by a Runtime Services Driver to allocate pool memory.
EfiConventionalMemory Free (unallocated) memory.
EfiUnusableMemory Memory in which errors have been detected.
EfiACPIReclaimMemory Memory that holds the ACPI tables.
EfiACPIMemoryNVS Address space reserved for use by the firmware.
EfiMemoryMappedIO Used by system firmware to request that a memory-mapped IO region be mapped by the OS to a virtual address so it can be accessed by EFI runtime services.
EfiMemoryMappedIOPortSpace System memory-mapped IO region that is used to translate memory cycles to IO cycles by the processor. Note: There is only one region of type EfiMemoryMappedIoPortSpace defined in the architecture for Itanium-based platforms. As a result, there should be one and only one region of type EfiMemoryMappedIoPortSpace in the EFI memory map of an Itanium-based platform.
EfiPalCode Address space reserved by the firmware for code that is part of the processor.
Memory Type Usage after ExitBootServices()
Mnemonic Description
EfiReservedMemoryType Not used.
EfiLoaderCode The Loader and/or OS may use this memory as they see fit. Note: the OS loader that called ExitBootServices() is utilizing one or

more EfiLoaderCode ranges.

EfiLoaderData The Loader and/or OS may use this memory as they see fit. Note: the OS loader that called ExitBootServices() is utilizing one or

more EfiLoaderData ranges.

EfiBootServicesCode Memory available for general use.
EfiBootServicesData Memory available for general use.
EfiRuntimeServicesCode The memory in this range is to be preserved by the loader and OS in the working and ACPI S1–S3 states.
EfiRuntimeServicesData The memory in this range is to be preserved by the loader and OS in the working and ACPI S1–S3 states.
EfiConventionalMemory Memory available for general use.
EfiUnusableMemory Memory that contains errors and is not to be used.
EfiACPIReclaimMemory This memory is to be preserved by the loader and OS until ACPI is enabled. Once ACPI is enabled, the memory in this range is available for general use.
EfiACPIMemoryNVS This memory is to be preserved by the loader and OS in the working and ACPI S1–S3 states.
EfiMemoryMappedIO This memory is not used by the OS. All system memory-mapped IO information should come from ACPI tables.
EfiMemoryMappedIOPortSpace This memory is not used by the OS. All system memory-mapped IO port space information should come from ACPI tables.
EfiPalCode This memory is to be preserved by the loader and OS in the working and ACPI S1–S3 states. This memory may also have other attributes that are defined by the processor implementation

Note: An image that calls ExitBootServices() first calls GetMemoryMap() to obtain the current memory map. Following the ExitBootServices() call, the image implicitly owns all unused memory in the map. This includes memory types EfiLoaderCode, EfiLoaderData, EfiBootServicesCode, EfiBootServicesData, and EfiConventionalMemory. A UEFI-compatible loader and operating system must preserve the memory marked as EfiRuntimeServicesCode and EfiRuntimeServicesData.


Copyright (C) 2008 Phoenix Technologies Ltd. All Rights Reserved. Portions (C) 2005 UEFI Forum, Inc. Used with permission.

Personal tools