Changeset 105670 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/SmmAccess/SmmAccessPei.c
- Timestamp:
- Aug 14, 2024 1:16:30 PM (4 months ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-159268 /vendor/edk2/current 103735-103757,103769-103776,129194-164365
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/SmmAccess/SmmAccessPei.c
r101291 r105670 4 4 5 5 - verify & configure the Q35 TSEG in the entry point, 6 - provide SMRAM access by producing PEI_SMM_ACCESS_PPI, 7 - set aside the SMM_S3_RESUME_STATE object at the bottom of TSEG, and expose 8 it via the gEfiAcpiVariableGuid GUID HOB. 6 - provide SMRAM access by producing PEI_SMM_ACCESS_PPI 9 7 10 8 This PEIM runs from RAM, so we can write to variables with static storage … … 12 10 13 11 Copyright (C) 2013, 2015, Red Hat, Inc.<BR> 14 Copyright (c) 2010 , Intel Corporation. All rights reserved.<BR>12 Copyright (c) 2010 - 2024, Intel Corporation. All rights reserved.<BR> 15 13 16 14 SPDX-License-Identifier: BSD-2-Clause-Patent … … 18 16 **/ 19 17 20 #include <Guid/AcpiS3Context.h>21 18 #include <Library/BaseLib.h> 22 19 #include <Library/BaseMemoryLib.h> 23 20 #include <Library/DebugLib.h> 24 #include <Library/HobLib.h>25 21 #include <Library/IoLib.h> 26 22 #include <Library/PcdLib.h> … … 65 61 ) 66 62 { 67 if (DescriptorIndex >= DescIdxCount) { 63 EFI_HOB_GUID_TYPE *GuidHob; 64 EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock; 65 66 // 67 // Get the number of regions in the system that can be usable for SMRAM 68 // 69 GuidHob = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid); 70 DescriptorBlock = GET_GUID_HOB_DATA (GuidHob); 71 ASSERT (DescriptorBlock); 72 73 if (DescriptorIndex >= DescriptorBlock->NumberOfSmmReservedRegions) { 68 74 return EFI_INVALID_PARAMETER; 69 75 } … … 103 109 ) 104 110 { 105 if (DescriptorIndex >= DescIdxCount) { 111 EFI_HOB_GUID_TYPE *GuidHob; 112 EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock; 113 114 // 115 // Get the number of regions in the system that can be usable for SMRAM 116 // 117 GuidHob = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid); 118 DescriptorBlock = GET_GUID_HOB_DATA (GuidHob); 119 ASSERT (DescriptorBlock); 120 121 if (DescriptorIndex >= DescriptorBlock->NumberOfSmmReservedRegions) { 106 122 return EFI_INVALID_PARAMETER; 107 123 } … … 140 156 ) 141 157 { 142 if (DescriptorIndex >= DescIdxCount) { 158 EFI_HOB_GUID_TYPE *GuidHob; 159 EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock; 160 161 // 162 // Get the number of regions in the system that can be usable for SMRAM 163 // 164 GuidHob = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid); 165 DescriptorBlock = GET_GUID_HOB_DATA (GuidHob); 166 ASSERT (DescriptorBlock); 167 168 if (DescriptorIndex >= DescriptorBlock->NumberOfSmmReservedRegions) { 143 169 return EFI_INVALID_PARAMETER; 144 170 } … … 179 205 { 180 206 return SmramAccessGetCapabilities ( 181 This->LockState,182 This->OpenState,183 207 SmramMapSize, 184 208 SmramMap … … 241 265 ) 242 266 { 243 UINT16 HostBridgeDevId; 244 UINT8 EsmramcVal; 245 UINT8 RegMask8; 246 UINT32 TopOfLowRam, TopOfLowRamMb; 247 EFI_STATUS Status; 248 UINTN SmramMapSize; 249 EFI_SMRAM_DESCRIPTOR SmramMap[DescIdxCount]; 250 VOID *GuidHob; 267 UINT16 HostBridgeDevId; 268 UINT8 EsmramcVal; 269 UINT8 RegMask8; 270 UINT32 TopOfLowRam, TopOfLowRamMb; 251 271 252 272 // … … 357 377 ); 358 378 359 //360 // Create the GUID HOB and point it to the first SMRAM range.361 //362 379 GetStates (&mAccess.LockState, &mAccess.OpenState); 363 SmramMapSize = sizeof SmramMap;364 Status = SmramAccessGetCapabilities (365 mAccess.LockState,366 mAccess.OpenState,367 &SmramMapSize,368 SmramMap369 );370 ASSERT_EFI_ERROR (Status);371 372 DEBUG_CODE_BEGIN ();373 {374 UINTN Count;375 UINTN Idx;376 377 Count = SmramMapSize / sizeof SmramMap[0];378 DEBUG ((379 DEBUG_VERBOSE,380 "%a: SMRAM map follows, %d entries\n",381 __func__,382 (INT32)Count383 ));384 DEBUG ((385 DEBUG_VERBOSE,386 "% 20a % 20a % 20a % 20a\n",387 "PhysicalStart(0x)",388 "PhysicalSize(0x)",389 "CpuStart(0x)",390 "RegionState(0x)"391 ));392 for (Idx = 0; Idx < Count; ++Idx) {393 DEBUG ((394 DEBUG_VERBOSE,395 "% 20Lx % 20Lx % 20Lx % 20Lx\n",396 SmramMap[Idx].PhysicalStart,397 SmramMap[Idx].PhysicalSize,398 SmramMap[Idx].CpuStart,399 SmramMap[Idx].RegionState400 ));401 }402 }403 DEBUG_CODE_END ();404 405 GuidHob = BuildGuidHob (406 &gEfiAcpiVariableGuid,407 sizeof SmramMap[DescIdxSmmS3ResumeState]408 );409 if (GuidHob == NULL) {410 return EFI_OUT_OF_RESOURCES;411 }412 413 CopyMem (414 GuidHob,415 &SmramMap[DescIdxSmmS3ResumeState],416 sizeof SmramMap[DescIdxSmmS3ResumeState]417 );418 380 419 381 //
Note:
See TracChangeset
for help on using the changeset viewer.