xref: /optee_os/core/lib/libefi/include/efi/mmram.h (revision 941a58d78c99c4754fbd4ec3079ec9e1d596af8f)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
4  *
5  * @par Reference(s):
6  * - UEFI Platform Initialization Specification
7  *   (https://uefi.org/specs/PI/1.8/index.html)
8  */
9 
10 #ifndef __MMRAM_H
11 #define __MMRAM_H
12 
13 #include "efi_types.h"
14 
15 /**
16  * MMRAM states and capabilities
17  * Cf) UEFI Platform Initialization Specification Version 1.8, IV-5.3.5
18  */
19 #define EFI_MMRAM_OPEN                0x00000001
20 #define EFI_MMRAM_CLOSED              0x00000002
21 #define EFI_MMRAM_LOCKED              0x00000004
22 #define EFI_CACHEABLE                 0x00000008
23 #define EFI_ALLOCATED                 0x00000010
24 #define EFI_NEEDS_TESTING             0x00000020
25 #define EFI_NEEDS_ECC_INITIALIZATION  0x00000040
26 
27 #define EFI_SMRAM_OPEN    EFI_MMRAM_OPEN
28 #define EFI_SMRAM_CLOSED  EFI_MMRAM_CLOSED
29 #define EFI_SMRAM_LOCKED  EFI_MMRAM_LOCKED
30 
31 struct efi_mmram_descriptor {
32 	efi_physical_address_t physical_start;
33 	efi_physical_address_t cpu_start;
34 	uint64_t physical_size;
35 	uint64_t region_state;
36 };
37 
38 /**
39  * MMRAM block descriptor
40  * This definition comes from
41  *     https://github.com/samimujawar/edk2/blob/master/StandaloneMmPkg/Include/Guid/MmramMemoryReserve.h
42  */
43 struct efi_mmram_hob_descriptor_block {
44 	uint32_t number_of_mm_reserved_regions;
45 	struct efi_mmram_descriptor descriptor[];
46 };
47 
48 #endif
49