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