1/*
2 * Copyright (c) 2015 ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Universitaetstr 6, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#ifndef UEFI_MMAP_H
11#define UEFI_MMAP_H
12
13//*******************************************************
14//EFI_VIRTUAL_ADDRESS
15// UEFI Spec v2.5, p.158
16//*******************************************************
17typedef uint64_t EFI_VIRTUAL_ADDRESS;
18
19//*******************************************************
20//EFI_PHYSICAL_ADDRESS
21// UEFI Spec v2.5, p.153
22//*******************************************************
23typedef uint64_t EFI_PHYSICAL_ADDRESS;
24
25
26//*******************************************************
27//EFI_MEMORY_TYPE
28// UEFI Spec v2.5, p.153
29//*******************************************************
30// These type values are discussed in Table 25 and Table 26
31typedef enum {
32    EfiReservedMemoryType,
33    EfiLoaderCode,
34    EfiLoaderData,
35    EfiBootServicesCode,
36    EfiBootServicesData,
37    EfiRuntimeServicesCode,
38    EfiRuntimeServicesData,
39    EfiConventionalMemory,
40    EfiUnusableMemory,
41    EfiACPIReclaimMemory,
42    EfiACPIMemoryNVS,
43    EfiMemoryMappedIO,
44    EfiMemoryMappedIOPortSpace,
45    EfiPalCode,
46    EfiPersistentMemory,
47    EfiMaxMemoryType
48} EFI_MEMORY_TYPE;
49
50//*******************************************************
51// Memory Attribute Definitions
52// from UEFI Spec v2.5, p.157
53//*******************************************************
54// These types can be ���ORed��� together as needed.
55typedef enum {
56    EFI_MEMORY_UC            = 0x0000000000000001,
57    EFI_MEMORY_WC            = 0x0000000000000002,
58    EFI_MEMORY_WT            = 0x0000000000000004,
59    EFI_MEMORY_WB            = 0x0000000000000008,
60    EFI_MEMORY_UCE           = 0x0000000000000010,
61    EFI_MEMORY_WP            = 0x0000000000001000,
62    EFI_MEMORY_RP            = 0x0000000000002000,
63    EFI_MEMORY_XP            = 0x0000000000004000,
64    EFI_MEMORY_NV            = 0x0000000000008000,
65    EFI_MEMORY_MORE_RELIABLE = 0x0000000000010000,
66    EFI_MEMORY_RO            = 0x0000000000020000,
67    EFI_MEMORY_RUNTIME       = 0x8000000000000000,
68} EFI_MEMORY_ATTR;
69
70//*******************************************************
71// Memory Descriptor Version Number
72//*******************************************************
73#define EFI_MEMORY_DESCRIPTOR_VERSION  1
74
75//*******************************************************
76//EFI_MEMORY_DESCRIPTOR
77//*******************************************************
78typedef struct {
79    uint32_t              Type;
80    EFI_PHYSICAL_ADDRESS  PhysicalStart;
81    EFI_VIRTUAL_ADDRESS   VirtualStart;
82    uint64_t              NumberOfPages;
83    uint64_t              Attribute;
84} EFI_MEMORY_DESCRIPTOR;
85
86#endif // UEFI_MMAP_H
87