1 | /** @file
|
---|
2 |
|
---|
3 | Copyright (c) 2023, Google LLC. All rights reserved.<BR>
|
---|
4 |
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef EDKII_MEMORY_ATTRIBUTE_PPI_H_
|
---|
10 | #define EDKII_MEMORY_ATTRIBUTE_PPI_H_
|
---|
11 |
|
---|
12 | #include <Uefi/UefiSpec.h>
|
---|
13 |
|
---|
14 | ///
|
---|
15 | /// Global ID for the EDKII_MEMORY_ATTRIBUTE_PPI.
|
---|
16 | ///
|
---|
17 | #define EDKII_MEMORY_ATTRIBUTE_PPI_GUID \
|
---|
18 | { \
|
---|
19 | 0x1be840de, 0x2d92, 0x41ec, { 0xb6, 0xd3, 0x19, 0x64, 0x13, 0x50, 0x51, 0xfb } \
|
---|
20 | }
|
---|
21 |
|
---|
22 | ///
|
---|
23 | /// Forward declaration for the EDKII_MEMORY_ATTRIBUTE_PPI.
|
---|
24 | ///
|
---|
25 | typedef struct _EDKII_MEMORY_ATTRIBUTE_PPI EDKII_MEMORY_ATTRIBUTE_PPI;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | Set the requested memory permission attributes on a region of memory.
|
---|
29 |
|
---|
30 | BaseAddress and Length must be aligned to EFI_PAGE_SIZE.
|
---|
31 |
|
---|
32 | Attributes must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and
|
---|
33 | EFI_MEMORY_XP, and specifies the attributes that must be set for the
|
---|
34 | region in question. Attributes that are omitted will be cleared from the
|
---|
35 | region only if they are set in AttributeMask.
|
---|
36 |
|
---|
37 | AttributeMask must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and
|
---|
38 | EFI_MEMORY_XP, and specifies the attributes that the call will operate on.
|
---|
39 | AttributeMask must not be 0x0, and must contain at least the bits set in
|
---|
40 | Attributes.
|
---|
41 |
|
---|
42 | @param[in] This The protocol instance pointer.
|
---|
43 | @param[in] BaseAddress The physical address that is the start address
|
---|
44 | of a memory region.
|
---|
45 | @param[in] Length The size in bytes of the memory region.
|
---|
46 | @param[in] Attributes Memory attributes to set or clear.
|
---|
47 | @param[in] AttributeMask Mask of memory attributes to operate on.
|
---|
48 |
|
---|
49 | @retval EFI_SUCCESS The attributes were set for the memory region.
|
---|
50 | @retval EFI_INVALID_PARAMETER Length is zero.
|
---|
51 | AttributeMask is zero.
|
---|
52 | AttributeMask lacks bits set in Attributes.
|
---|
53 | BaseAddress or Length is not suitably aligned.
|
---|
54 | @retval EFI_UNSUPPORTED The processor does not support one or more
|
---|
55 | bytes of the memory resource range specified
|
---|
56 | by BaseAddress and Length.
|
---|
57 | The bit mask of attributes is not supported for
|
---|
58 | the memory resource range specified by
|
---|
59 | BaseAddress and Length.
|
---|
60 | @retval EFI_OUT_OF_RESOURCES Requested attributes cannot be applied due to
|
---|
61 | lack of system resources.
|
---|
62 |
|
---|
63 | **/
|
---|
64 | typedef
|
---|
65 | EFI_STATUS
|
---|
66 | (EFIAPI *EDKII_MEMORY_ATTRIBUTE_SET_PERMISSIONS)(
|
---|
67 | IN EDKII_MEMORY_ATTRIBUTE_PPI *This,
|
---|
68 | IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
---|
69 | IN UINT64 Length,
|
---|
70 | IN UINT64 Attributes,
|
---|
71 | IN UINT64 AttributeMask
|
---|
72 | );
|
---|
73 |
|
---|
74 | ///
|
---|
75 | /// This PPI contains a set of services to manage memory permission attributes.
|
---|
76 | ///
|
---|
77 | struct _EDKII_MEMORY_ATTRIBUTE_PPI {
|
---|
78 | EDKII_MEMORY_ATTRIBUTE_SET_PERMISSIONS SetPermissions;
|
---|
79 | };
|
---|
80 |
|
---|
81 | extern EFI_GUID gEdkiiMemoryAttributePpiGuid;
|
---|
82 |
|
---|
83 | #endif
|
---|