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