1 | /** @file
|
---|
2 | Internal include file for the dummy Legacy Region 2 Protocol implementation.
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef __DUMMY_LEGACY_REGION2_H__
|
---|
10 | #define __DUMMY_LEGACY_REGION2_H__
|
---|
11 |
|
---|
12 | #include <Protocol/LegacyRegion2.h>
|
---|
13 | #include <Library/DebugLib.h>
|
---|
14 | #include <Library/UefiBootServicesTableLib.h>
|
---|
15 |
|
---|
16 | /**
|
---|
17 | Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.
|
---|
18 |
|
---|
19 | If the On parameter evaluates to TRUE, this function enables memory reads in the address range
|
---|
20 | Start to (Start + Length - 1).
|
---|
21 | If the On parameter evaluates to FALSE, this function disables memory reads in the address range
|
---|
22 | Start to (Start + Length - 1).
|
---|
23 |
|
---|
24 | @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
---|
25 | @param Start[in] The beginning of the physical address of the region whose attributes
|
---|
26 | should be modified.
|
---|
27 | @param Length[in] The number of bytes of memory whose attributes should be modified.
|
---|
28 | The actual number of bytes modified may be greater than the number
|
---|
29 | specified.
|
---|
30 | @param Granularity[out] The number of bytes in the last region affected. This may be less
|
---|
31 | than the total number of bytes affected if the starting address
|
---|
32 | was not aligned to a region's starting address or if the length
|
---|
33 | was greater than the number of bytes in the first region.
|
---|
34 | @param On[in] Decode / Non-Decode flag.
|
---|
35 |
|
---|
36 | @retval EFI_SUCCESS The region's attributes were successfully modified.
|
---|
37 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
---|
38 |
|
---|
39 | **/
|
---|
40 | EFI_STATUS
|
---|
41 | EFIAPI
|
---|
42 | LegacyRegion2Decode (
|
---|
43 | IN EFI_LEGACY_REGION2_PROTOCOL *This,
|
---|
44 | IN UINT32 Start,
|
---|
45 | IN UINT32 Length,
|
---|
46 | OUT UINT32 *Granularity,
|
---|
47 | IN BOOLEAN *On
|
---|
48 | );
|
---|
49 |
|
---|
50 | /**
|
---|
51 | Modify the hardware to disallow memory writes in a region.
|
---|
52 |
|
---|
53 | This function changes the attributes of a memory range to not allow writes.
|
---|
54 |
|
---|
55 | @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
---|
56 | @param Start[in] The beginning of the physical address of the region whose
|
---|
57 | attributes should be modified.
|
---|
58 | @param Length[in] The number of bytes of memory whose attributes should be modified.
|
---|
59 | The actual number of bytes modified may be greater than the number
|
---|
60 | specified.
|
---|
61 | @param Granularity[out] The number of bytes in the last region affected. This may be less
|
---|
62 | than the total number of bytes affected if the starting address was
|
---|
63 | not aligned to a region's starting address or if the length was
|
---|
64 | greater than the number of bytes in the first region.
|
---|
65 |
|
---|
66 | @retval EFI_SUCCESS The region's attributes were successfully modified.
|
---|
67 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
---|
68 |
|
---|
69 | **/
|
---|
70 | EFI_STATUS
|
---|
71 | EFIAPI
|
---|
72 | LegacyRegion2Lock (
|
---|
73 | IN EFI_LEGACY_REGION2_PROTOCOL *This,
|
---|
74 | IN UINT32 Start,
|
---|
75 | IN UINT32 Length,
|
---|
76 | OUT UINT32 *Granularity
|
---|
77 | );
|
---|
78 |
|
---|
79 | /**
|
---|
80 | Modify the hardware to disallow memory attribute changes in a region.
|
---|
81 |
|
---|
82 | This function makes the attributes of a region read only. Once a region is boot-locked with this
|
---|
83 | function, the read and write attributes of that region cannot be changed until a power cycle has
|
---|
84 | reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.
|
---|
85 |
|
---|
86 | @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
---|
87 | @param Start[in] The beginning of the physical address of the region whose
|
---|
88 | attributes should be modified.
|
---|
89 | @param Length[in] The number of bytes of memory whose attributes should be modified.
|
---|
90 | The actual number of bytes modified may be greater than the number
|
---|
91 | specified.
|
---|
92 | @param Granularity[out] The number of bytes in the last region affected. This may be less
|
---|
93 | than the total number of bytes affected if the starting address was
|
---|
94 | not aligned to a region's starting address or if the length was
|
---|
95 | greater than the number of bytes in the first region.
|
---|
96 |
|
---|
97 | @retval EFI_SUCCESS The region's attributes were successfully modified.
|
---|
98 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
---|
99 | @retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in
|
---|
100 | a way that will not affect memory regions outside the legacy memory
|
---|
101 | region.
|
---|
102 |
|
---|
103 | **/
|
---|
104 | EFI_STATUS
|
---|
105 | EFIAPI
|
---|
106 | LegacyRegion2BootLock (
|
---|
107 | IN EFI_LEGACY_REGION2_PROTOCOL *This,
|
---|
108 | IN UINT32 Start,
|
---|
109 | IN UINT32 Length,
|
---|
110 | OUT UINT32 *Granularity
|
---|
111 | );
|
---|
112 |
|
---|
113 | /**
|
---|
114 | Modify the hardware to allow memory writes in a region.
|
---|
115 |
|
---|
116 | This function changes the attributes of a memory range to allow writes.
|
---|
117 |
|
---|
118 | @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
---|
119 | @param Start[in] The beginning of the physical address of the region whose
|
---|
120 | attributes should be modified.
|
---|
121 | @param Length[in] The number of bytes of memory whose attributes should be modified.
|
---|
122 | The actual number of bytes modified may be greater than the number
|
---|
123 | specified.
|
---|
124 | @param Granularity[out] The number of bytes in the last region affected. This may be less
|
---|
125 | than the total number of bytes affected if the starting address was
|
---|
126 | not aligned to a region's starting address or if the length was
|
---|
127 | greater than the number of bytes in the first region.
|
---|
128 |
|
---|
129 | @retval EFI_SUCCESS The region's attributes were successfully modified.
|
---|
130 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
---|
131 |
|
---|
132 | **/
|
---|
133 | EFI_STATUS
|
---|
134 | EFIAPI
|
---|
135 | LegacyRegion2Unlock (
|
---|
136 | IN EFI_LEGACY_REGION2_PROTOCOL *This,
|
---|
137 | IN UINT32 Start,
|
---|
138 | IN UINT32 Length,
|
---|
139 | OUT UINT32 *Granularity
|
---|
140 | );
|
---|
141 |
|
---|
142 | /**
|
---|
143 | Get region information for the attributes of the Legacy Region.
|
---|
144 |
|
---|
145 | This function is used to discover the granularity of the attributes for the memory in the legacy
|
---|
146 | region. Each attribute may have a different granularity and the granularity may not be the same
|
---|
147 | for all memory ranges in the legacy region.
|
---|
148 |
|
---|
149 | @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
---|
150 | @param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
|
---|
151 | buffer.
|
---|
152 | @param Descriptor[out] A pointer to a pointer used to return a buffer where the legacy
|
---|
153 | region information is deposited. This buffer will contain a list of
|
---|
154 | DescriptorCount number of region descriptors. This function will
|
---|
155 | provide the memory for the buffer.
|
---|
156 |
|
---|
157 | @retval EFI_SUCCESS The region's attributes were successfully modified.
|
---|
158 | @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
---|
159 |
|
---|
160 | **/
|
---|
161 | EFI_STATUS
|
---|
162 | EFIAPI
|
---|
163 | LegacyRegionGetInfo (
|
---|
164 | IN EFI_LEGACY_REGION2_PROTOCOL *This,
|
---|
165 | OUT UINT32 *DescriptorCount,
|
---|
166 | OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor
|
---|
167 | );
|
---|
168 |
|
---|
169 | #endif
|
---|