Changeset 80721 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp
- Timestamp:
- Sep 11, 2019 8:46:37 AM (5 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 added
- 11 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-129237 /vendor/edk2/current 103735-103757,103769-103776,129194-133213
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
r77662 r80721 11 11 performs basic validation. 12 12 13 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> 14 This program and the accompanying materials 15 are licensed and made available under the terms and conditions of the BSD License 16 which accompanies this distribution. The full text of the license may be found at 17 http://opensource.org/licenses/bsd-license.php 18 19 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 20 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR> 14 SPDX-License-Identifier: BSD-2-Clause-Patent 21 15 22 16 **/ … … 40 34 #include <Library/DevicePathLib.h> 41 35 #include <Library/UefiLib.h> 42 #include <Library/PcdLib.h>43 36 #include <Library/BmpSupportLib.h> 44 37 … … 88 81 @param[in] ImageHeader FMP image header 89 82 @param[in] FmpDevicePath DevicePath associated with the FMP producer 83 @param[in] CapFileName Capsule file name 90 84 91 85 @retval EFI_SUCCESS The capsule status variable is recorded. … … 98 92 IN UINTN PayloadIndex, 99 93 IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, 100 IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL 94 IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath, OPTIONAL 95 IN CHAR16 *CapFileName OPTIONAL 101 96 ); 102 97 … … 116 111 IN UINTN Completion 117 112 ); 113 114 /** 115 Return if this capsule is a capsule name capsule, based upon CapsuleHeader. 116 117 @param[in] CapsuleHeader A pointer to EFI_CAPSULE_HEADER 118 119 @retval TRUE It is a capsule name capsule. 120 @retval FALSE It is not a capsule name capsule. 121 **/ 122 BOOLEAN 123 IsCapsuleNameCapsule ( 124 IN EFI_CAPSULE_HEADER *CapsuleHeader 125 ) 126 { 127 return CompareGuid (&CapsuleHeader->CapsuleGuid, &gEdkiiCapsuleOnDiskNameGuid); 128 } 118 129 119 130 /** … … 1042 1053 Record FMP capsule status. 1043 1054 1044 @param[in] HandleA FMP handle.1055 @param[in] Handle A FMP handle. 1045 1056 @param[in] CapsuleHeader The capsule image header 1046 1057 @param[in] CapsuleStatus The capsule process stauts 1047 1058 @param[in] PayloadIndex FMP payload index 1048 1059 @param[in] ImageHeader FMP image header 1060 @param[in] CapFileName Capsule file name 1049 1061 **/ 1050 1062 VOID … … 1054 1066 IN EFI_STATUS CapsuleStatus, 1055 1067 IN UINTN PayloadIndex, 1056 IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader 1068 IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, 1069 IN CHAR16 *CapFileName OPTIONAL 1057 1070 ) 1058 1071 { … … 1078 1091 PayloadIndex, 1079 1092 ImageHeader, 1080 FmpDevicePath 1093 FmpDevicePath, 1094 CapFileName 1081 1095 ); 1082 1096 … … 1123 1137 1124 1138 @param[in] CapsuleHeader Points to a capsule header. 1139 @param[in] CapFileName Capsule file name. 1125 1140 @param[out] ResetRequired Indicates whether reset is required or not. 1126 1141 … … 1134 1149 ProcessFmpCapsuleImage ( 1135 1150 IN EFI_CAPSULE_HEADER *CapsuleHeader, 1151 IN CHAR16 *CapFileName, OPTIONAL 1136 1152 OUT BOOLEAN *ResetRequired OPTIONAL 1137 1153 ) … … 1153 1169 1154 1170 if (!IsFmpCapsuleGuid(&CapsuleHeader->CapsuleGuid)) { 1155 return ProcessFmpCapsuleImage ((EFI_CAPSULE_HEADER *)((UINTN)CapsuleHeader + CapsuleHeader->HeaderSize), ResetRequired);1171 return ProcessFmpCapsuleImage ((EFI_CAPSULE_HEADER *)((UINTN)CapsuleHeader + CapsuleHeader->HeaderSize), CapFileName, ResetRequired); 1156 1172 } 1157 1173 … … 1235 1251 EFI_NOT_READY, 1236 1252 Index - FmpCapsuleHeader->EmbeddedDriverCount, 1237 ImageHeader 1253 ImageHeader, 1254 CapFileName 1238 1255 ); 1239 1256 continue; … … 1247 1264 EFI_ABORTED, 1248 1265 Index - FmpCapsuleHeader->EmbeddedDriverCount, 1249 ImageHeader 1266 ImageHeader, 1267 CapFileName 1250 1268 ); 1251 1269 continue; … … 1270 1288 Status, 1271 1289 Index - FmpCapsuleHeader->EmbeddedDriverCount, 1272 ImageHeader 1290 ImageHeader, 1291 CapFileName 1273 1292 ); 1274 1293 } … … 1422 1441 } 1423 1442 1443 // 1444 // Check capsule file name capsule 1445 // 1446 if (IsCapsuleNameCapsule(CapsuleHeader)) { 1447 return EFI_SUCCESS; 1448 } 1449 1424 1450 if (IsFmpCapsule(CapsuleHeader)) { 1451 // 1452 // Fake capsule header is valid case in QueryCapsuleCpapbilities(). 1453 // 1454 if (CapsuleHeader->HeaderSize == CapsuleHeader->CapsuleImageSize) { 1455 return EFI_SUCCESS; 1456 } 1425 1457 // 1426 1458 // Check layout of FMP capsule … … 1438 1470 1439 1471 @param[in] CapsuleHeader Points to a capsule header. 1472 @param[in] CapFileName Capsule file name. 1440 1473 @param[out] ResetRequired Indicates whether reset is required or not. 1441 1474 … … 1449 1482 ProcessThisCapsuleImage ( 1450 1483 IN EFI_CAPSULE_HEADER *CapsuleHeader, 1484 IN CHAR16 *CapFileName, OPTIONAL 1451 1485 OUT BOOLEAN *ResetRequired OPTIONAL 1452 1486 ) … … 1486 1520 // 1487 1521 DEBUG((DEBUG_INFO, "ProcessFmpCapsuleImage ...\n")); 1488 Status = ProcessFmpCapsuleImage(CapsuleHeader, ResetRequired);1522 Status = ProcessFmpCapsuleImage(CapsuleHeader, CapFileName, ResetRequired); 1489 1523 DEBUG((DEBUG_INFO, "ProcessFmpCapsuleImage - %r\n", Status)); 1490 1524 … … 1513 1547 ) 1514 1548 { 1515 return ProcessThisCapsuleImage (CapsuleHeader, NULL );1549 return ProcessThisCapsuleImage (CapsuleHeader, NULL, NULL); 1516 1550 } 1517 1551 -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
r77662 r80721 4 4 # Capsule library instance for DXE_DRIVER module types. 5 5 # 6 # Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> 7 # This program and the accompanying materials 8 # are licensed and made available under the terms and conditions of the BSD License 9 # which accompanies this distribution. The full text of the license may be found at 10 # http://opensource.org/licenses/bsd-license.php 11 # 12 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 6 # Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR> 7 # SPDX-License-Identifier: BSD-2-Clause-Patent 14 8 # 15 9 ## … … 29 23 # The following information is for reference only and not required by the build tools. 30 24 # 31 # VALID_ARCHITECTURES = IA32 X64 IPFEBC25 # VALID_ARCHITECTURES = IA32 X64 EBC 32 26 # 33 27 … … 36 30 DxeCapsuleProcessLib.c 37 31 DxeCapsuleReportLib.c 32 CapsuleOnDisk.c 33 CapsuleOnDisk.h 38 34 39 35 [Packages] … … 54 50 BmpSupportLib 55 51 DisplayUpdateProgressLib 52 FileHandleLib 53 UefiBootManagerLib 56 54 57 55 [Pcd] … … 66 64 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleStatusCodeUpdateFirmwareFailed ## CONSUMES 67 65 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleStatusCodeResettingSystem ## CONSUMES 66 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleInRamSupport ## CONSUMES 67 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleOnDiskSupport ## CONSUMES 68 gEfiMdeModulePkgTokenSpaceGuid.PcdCodRelocationDevPath ## SOMETIMES_CONSUMES 69 gEfiMdeModulePkgTokenSpaceGuid.PcdCoDRelocationFileName ## CONSUMES 68 70 69 71 [Protocols] … … 72 74 gEdkiiVariableLockProtocolGuid ## SOMETIMES_CONSUMES 73 75 gEdkiiFirmwareManagementProgressProtocolGuid ## SOMETIMES_CONSUMES 76 gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES 77 gEfiBlockIoProtocolGuid ## CONSUMES 78 gEfiDiskIoProtocolGuid ## CONSUMES 74 79 75 80 [Guids] … … 81 86 gEfiCapsuleVendorGuid ## SOMETIMES_CONSUMES ## Variable:L"CapsuleUpdateData" 82 87 gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event 88 gEfiPartTypeSystemPartGuid ## SOMETIMES_CONSUMES 89 gEfiCapsuleVendorGuid ## SOMETIMES_CONSUMES ## Variable:L"CodRelocationInfo" 90 ## SOMETIMES_CONSUMES ## Variable:L"OsIndications" 91 ## SOMETIMES_PRODUCES ## Variable:L"OsIndications" 92 ## SOMETIMES_CONSUMES ## Variable:L"BootNext" 93 ## SOMETIMES_PRODUCES ## Variable:L"BootNext" 94 gEfiGlobalVariableGuid 95 gEdkiiCapsuleOnDiskNameGuid ## SOMETIMES_CONSUMES ## GUID 83 96 84 97 [Depex] -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.uni
r77662 r80721 6 6 // Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 7 7 // 8 // This program and the accompanying materials 9 // are licensed and made available under the terms and conditions of the BSD License 10 // which accompanies this distribution. The full text of the license may be found at 11 // http://opensource.org/licenses/bsd-license.php 12 // 13 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 8 // SPDX-License-Identifier: BSD-2-Clause-Patent 15 9 // 16 10 // **/ -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLib.c
r77662 r80721 10 10 input and do basic validation. 11 11 12 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> 13 This program and the accompanying materials 14 are licensed and made available under the terms and conditions of the BSD License 15 which accompanies this distribution. The full text of the license may be found at 16 http://opensource.org/licenses/bsd-license.php 17 18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 19 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR> 13 SPDX-License-Identifier: BSD-2-Clause-Patent 20 14 21 15 **/ … … 99 93 ); 100 94 95 /** 96 Return if this capsule is a capsule name capsule, based upon CapsuleHeader. 97 98 @param[in] CapsuleHeader A pointer to EFI_CAPSULE_HEADER 99 100 @retval TRUE It is a capsule name capsule. 101 @retval FALSE It is not a capsule name capsule. 102 **/ 103 BOOLEAN 104 IsCapsuleNameCapsule ( 105 IN EFI_CAPSULE_HEADER *CapsuleHeader 106 ); 107 108 /** 109 Check the integrity of the capsule name capsule. 110 If the capsule is vaild, return the physical address of each capsule name string. 111 112 @param[in] CapsuleHeader Pointer to the capsule header of a capsule name capsule. 113 @param[out] CapsuleNameNum Number of capsule name. 114 115 @retval NULL Capsule name capsule is not valid. 116 @retval CapsuleNameBuf Array of capsule name physical address. 117 118 **/ 119 EFI_PHYSICAL_ADDRESS * 120 ValidateCapsuleNameCapsuleIntegrity ( 121 IN EFI_CAPSULE_HEADER *CapsuleHeader, 122 OUT UINTN *CapsuleNameNum 123 ); 124 101 125 extern BOOLEAN mDxeCapsuleLibEndOfDxe; 102 126 BOOLEAN mNeedReset = FALSE; 103 127 104 128 VOID **mCapsulePtr; 129 CHAR16 **mCapsuleNamePtr; 105 130 EFI_STATUS *mCapsuleStatusArray; 106 131 UINT32 mCapsuleTotalNumber; … … 112 137 113 138 @param[in] CapsuleHeader Points to a capsule header. 139 @param[in] CapFileName Capsule file name. 114 140 @param[out] ResetRequired Indicates whether reset is required or not. 115 141 … … 123 149 ProcessThisCapsuleImage ( 124 150 IN EFI_CAPSULE_HEADER *CapsuleHeader, 151 IN CHAR16 *CapFileName, OPTIONAL 125 152 OUT BOOLEAN *ResetRequired OPTIONAL 126 153 ); … … 192 219 EFI_PEI_HOB_POINTERS HobPointer; 193 220 UINTN Index; 221 UINTN Index2; 222 UINTN Index3; 223 UINTN CapsuleNameNumber; 224 UINTN CapsuleNameTotalNumber; 225 UINTN CapsuleNameCapsuleTotalNumber; 226 VOID **CapsuleNameCapsulePtr; 227 EFI_PHYSICAL_ADDRESS *CapsuleNameAddress; 228 229 CapsuleNameNumber = 0; 230 CapsuleNameTotalNumber = 0; 231 CapsuleNameCapsuleTotalNumber = 0; 232 CapsuleNameCapsulePtr = NULL; 194 233 195 234 // … … 201 240 HobPointer.Header->HobType = EFI_HOB_TYPE_UNUSED; // Mark this hob as invalid 202 241 } else { 203 mCapsuleTotalNumber++; 242 if (IsCapsuleNameCapsule((VOID *)(UINTN)HobPointer.Capsule->BaseAddress)) { 243 CapsuleNameCapsuleTotalNumber++; 244 } else { 245 mCapsuleTotalNumber++; 246 } 204 247 } 205 248 HobPointer.Raw = GET_NEXT_HOB (HobPointer); … … 231 274 SetMemN (mCapsuleStatusArray, sizeof (EFI_STATUS) * mCapsuleTotalNumber, EFI_NOT_READY); 232 275 276 CapsuleNameCapsulePtr = (VOID **) AllocateZeroPool (sizeof (VOID *) * CapsuleNameCapsuleTotalNumber); 277 if (CapsuleNameCapsulePtr == NULL) { 278 DEBUG ((DEBUG_ERROR, "Allocate CapsuleNameCapsulePtr fail!\n")); 279 FreePool (mCapsulePtr); 280 FreePool (mCapsuleStatusArray); 281 mCapsulePtr = NULL; 282 mCapsuleStatusArray = NULL; 283 mCapsuleTotalNumber = 0; 284 return ; 285 } 286 233 287 // 234 288 // Find all capsule images from hob 235 289 // 236 290 HobPointer.Raw = GetHobList (); 237 Index = 0; 291 Index = 0; 292 Index2 = 0; 238 293 while ((HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_UEFI_CAPSULE, HobPointer.Raw)) != NULL) { 239 mCapsulePtr [Index++] = (VOID *) (UINTN) HobPointer.Capsule->BaseAddress; 294 if (IsCapsuleNameCapsule ((VOID *) (UINTN) HobPointer.Capsule->BaseAddress)) { 295 CapsuleNameCapsulePtr [Index2++] = (VOID *) (UINTN) HobPointer.Capsule->BaseAddress; 296 } else { 297 mCapsulePtr [Index++] = (VOID *) (UINTN) HobPointer.Capsule->BaseAddress; 298 } 240 299 HobPointer.Raw = GET_NEXT_HOB (HobPointer); 241 300 } 301 302 // 303 // Find Capsule On Disk Names 304 // 305 for (Index = 0; Index < CapsuleNameCapsuleTotalNumber; Index ++) { 306 CapsuleNameAddress = ValidateCapsuleNameCapsuleIntegrity (CapsuleNameCapsulePtr[Index], &CapsuleNameNumber); 307 if (CapsuleNameAddress != NULL ) { 308 CapsuleNameTotalNumber += CapsuleNameNumber; 309 } 310 } 311 312 if (CapsuleNameTotalNumber == mCapsuleTotalNumber) { 313 mCapsuleNamePtr = (CHAR16 **) AllocateZeroPool (sizeof (CHAR16 *) * mCapsuleTotalNumber); 314 if (mCapsuleNamePtr == NULL) { 315 DEBUG ((DEBUG_ERROR, "Allocate mCapsuleNamePtr fail!\n")); 316 FreePool (mCapsulePtr); 317 FreePool (mCapsuleStatusArray); 318 FreePool (CapsuleNameCapsulePtr); 319 mCapsulePtr = NULL; 320 mCapsuleStatusArray = NULL; 321 mCapsuleTotalNumber = 0; 322 return ; 323 } 324 325 for (Index = 0, Index3 = 0; Index < CapsuleNameCapsuleTotalNumber; Index ++) { 326 CapsuleNameAddress = ValidateCapsuleNameCapsuleIntegrity (CapsuleNameCapsulePtr[Index], &CapsuleNameNumber); 327 if (CapsuleNameAddress != NULL ) { 328 for (Index2 = 0; Index2 < CapsuleNameNumber; Index2 ++) { 329 mCapsuleNamePtr[Index3 ++] = (CHAR16 *)(UINTN) CapsuleNameAddress[Index2]; 330 } 331 } 332 } 333 } else { 334 mCapsuleNamePtr = NULL; 335 } 336 337 FreePool (CapsuleNameCapsulePtr); 242 338 } 243 339 … … 403 499 UINT16 EmbeddedDriverCount; 404 500 BOOLEAN ResetRequired; 501 CHAR16 *CapsuleName; 405 502 406 503 REPORT_STATUS_CODE(EFI_PROGRESS_CODE, (EFI_SOFTWARE | PcdGet32(PcdStatusCodeSubClassCapsule) | PcdGet32(PcdCapsuleStatusCodeProcessCapsulesBegin))); … … 415 512 // 416 513 DEBUG ((DEBUG_ERROR, "We can not find capsule data in capsule update boot mode.\n")); 514 mNeedReset = TRUE; 417 515 return EFI_SUCCESS; 418 516 } … … 437 535 for (Index = 0; Index < mCapsuleTotalNumber; Index++) { 438 536 CapsuleHeader = (EFI_CAPSULE_HEADER*) mCapsulePtr [Index]; 537 CapsuleName = (mCapsuleNamePtr == NULL) ? NULL : mCapsuleNamePtr[Index]; 439 538 if (CompareGuid (&CapsuleHeader->CapsuleGuid, &gWindowsUxCapsuleGuid)) { 440 539 DEBUG ((DEBUG_INFO, "ProcessThisCapsuleImage (Ux) - 0x%x\n", CapsuleHeader)); 441 540 DEBUG ((DEBUG_INFO, "Display logo capsule is found.\n")); 442 Status = ProcessThisCapsuleImage (CapsuleHeader, NULL);541 Status = ProcessThisCapsuleImage (CapsuleHeader, CapsuleName, NULL); 443 542 mCapsuleStatusArray [Index] = EFI_SUCCESS; 444 543 DEBUG((DEBUG_INFO, "ProcessThisCapsuleImage (Ux) - %r\n", Status)); … … 458 557 } 459 558 CapsuleHeader = (EFI_CAPSULE_HEADER*) mCapsulePtr [Index]; 559 CapsuleName = (mCapsuleNamePtr == NULL) ? NULL : mCapsuleNamePtr[Index]; 460 560 if (!CompareGuid (&CapsuleHeader->CapsuleGuid, &gWindowsUxCapsuleGuid)) { 461 561 // … … 478 578 DEBUG((DEBUG_INFO, "ProcessThisCapsuleImage - 0x%x\n", CapsuleHeader)); 479 579 ResetRequired = FALSE; 480 Status = ProcessThisCapsuleImage (CapsuleHeader, &ResetRequired);580 Status = ProcessThisCapsuleImage (CapsuleHeader, CapsuleName, &ResetRequired); 481 581 mCapsuleStatusArray [Index] = Status; 482 582 DEBUG((DEBUG_INFO, "ProcessThisCapsuleImage - %r\n", Status)); … … 537 637 538 638 The capsules reported in EFI_HOB_UEFI_CAPSULE are processed. 539 If there is no EFI_HOB_UEFI_CAPSULE, this routine does nothing. 639 If there is no EFI_HOB_UEFI_CAPSULE, it means error occurs, force reset to 640 normal boot path. 540 641 541 642 This routine should be called twice in BDS. -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleProcessLibNull.c
r77662 r80721 5 5 6 6 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 http://opensource.org/licenses/bsd-license.php 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 7 SPDX-License-Identifier: BSD-2-Clause-Patent 14 8 15 9 **/ -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c
r77662 r80721 2 2 DXE capsule report related function. 3 3 4 Copyright (c) 2016 - 2017, 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. 4 Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR> 5 SPDX-License-Identifier: BSD-2-Clause-Patent 12 6 13 7 **/ … … 35 29 36 30 #include <IndustryStandard/WindowsUxCapsule.h> 31 32 /** 33 This routine is called to clear CapsuleOnDisk Relocation Info variable. 34 Total Capsule On Disk length is recorded in this variable 35 36 @retval EFI_SUCCESS Capsule On Disk flags are cleared 37 38 **/ 39 EFI_STATUS 40 CoDClearCapsuleRelocationInfo( 41 VOID 42 ); 37 43 38 44 /** … … 181 187 @param[in] ImageHeader FMP image header 182 188 @param[in] FmpDevicePath DevicePath associated with the FMP producer 189 @param[in] CapFileName Capsule file name 183 190 184 191 @retval EFI_SUCCESS The capsule status variable is recorded. … … 191 198 IN UINTN PayloadIndex, 192 199 IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, 193 IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL 200 IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath, OPTIONAL 201 IN CHAR16 *CapFileName OPTIONAL 194 202 ) 195 203 { … … 201 209 CHAR16 *DevicePathStr; 202 210 UINTN DevicePathStrSize; 203 204 DevicePathStr = NULL; 211 UINTN CapFileNameSize; 212 213 DevicePathStr = NULL; 214 CapFileNameSize = sizeof(CHAR16); 215 205 216 if (FmpDevicePath != NULL) { 206 217 DevicePathStr = ConvertDevicePathToText (FmpDevicePath, FALSE, FALSE); … … 211 222 DevicePathStrSize = sizeof(CHAR16); 212 223 } 213 // 214 // Allocate zero CHAR16 for CapsuleFileName. 215 // 216 CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) + DevicePathStrSize; 224 225 if (CapFileName != NULL) { 226 CapFileNameSize = StrSize(CapFileName); 227 } 228 229 // 230 // Allocate room for CapsuleFileName. 231 // 232 CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + CapFileNameSize + DevicePathStrSize; 233 217 234 CapsuleResultVariable = AllocateZeroPool (CapsuleResultVariableSize); 218 235 if (CapsuleResultVariable == NULL) { … … 232 249 CapsuleResultVariableFmp->UpdateImageIndex = ImageHeader->UpdateImageIndex; 233 250 CopyGuid (&CapsuleResultVariableFmp->UpdateImageTypeId, &ImageHeader->UpdateImageTypeId); 251 252 if (CapFileName != NULL) { 253 CopyMem((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP), CapFileName, CapFileNameSize); 254 } 255 234 256 if (DevicePathStr != NULL) { 235 CopyMem ((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16), DevicePathStr, DevicePathStrSize);257 CopyMem ((UINT8 *)CapsuleResultVariableFmp + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + CapFileNameSize, DevicePathStr, DevicePathStrSize); 236 258 FreePool (DevicePathStr); 237 259 DevicePathStr = NULL; … … 408 430 409 431 /** 432 Initialize capsule relocation info variable. 433 **/ 434 VOID 435 InitCapsuleRelocationInfo ( 436 VOID 437 ) 438 { 439 EFI_STATUS Status; 440 EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; 441 442 CoDClearCapsuleRelocationInfo(); 443 444 // 445 // Unlock Capsule On Disk relocation Info variable only when Capsule On Disk flag is enabled 446 // 447 if (!CoDCheckCapsuleOnDiskFlag()) { 448 Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock); 449 if (!EFI_ERROR (Status)) { 450 Status = VariableLock->RequestToLock (VariableLock, COD_RELOCATION_INFO_VAR_NAME, &gEfiCapsuleVendorGuid); 451 ASSERT_EFI_ERROR (Status); 452 } 453 } 454 } 455 456 /** 410 457 Initialize capsule related variables. 411 458 **/ … … 418 465 InitCapsuleMaxVariable(); 419 466 InitCapsuleLastVariable(); 467 InitCapsuleRelocationInfo(); 468 420 469 // 421 470 // No need to clear L"Capsule####", because OS/APP should refer L"CapsuleLast" -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLibNull.c
r77662 r80721 4 4 does not need record capsule status variable. 5 5 6 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 http://opensource.org/licenses/bsd-license.php 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 6 Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR> 7 SPDX-License-Identifier: BSD-2-Clause-Patent 14 8 15 9 **/ … … 46 40 @param[in] ImageHeader FMP image header 47 41 @param[in] FmpDevicePath DevicePath associated with the FMP producer 42 @param[in] CapFileName Capsule file name 48 43 49 44 @retval EFI_SUCCESS The capsule status variable is recorded. … … 56 51 IN UINTN PayloadIndex, 57 52 IN EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *ImageHeader, 58 IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath OPTIONAL 53 IN EFI_DEVICE_PATH_PROTOCOL *FmpDevicePath, OPTIONAL 54 IN CHAR16 *CapFileName OPTIONAL 59 55 ) 60 56 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleRuntime.c
r77662 r80721 3 3 4 4 Copyright (c) 2016 - 2017, 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. 5 SPDX-License-Identifier: BSD-2-Clause-Patent 12 6 13 7 **/ … … 30 24 extern BOOLEAN mIsVirtualAddrConverted; 31 25 EFI_EVENT mDxeRuntimeCapsuleLibVirtualAddressChangeEvent = NULL; 26 EFI_EVENT mDxeRuntimeCapsuleLibReadyToBootEvent = NULL; 32 27 33 28 /** … … 45 40 ) 46 41 { 47 UINTN Index; 48 EFI_CONFIGURATION_TABLE *ConfigEntry; 42 gRT->ConvertPointer (EFI_OPTIONAL_PTR, (VOID **)&mEsrtTable); 43 mIsVirtualAddrConverted = TRUE; 44 } 45 46 /** 47 Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. 48 49 @param[in] Event The Event that is being processed. 50 @param[in] Context The Event Context. 51 52 **/ 53 STATIC 54 VOID 55 EFIAPI 56 DxeCapsuleLibReadyToBootEventNotify ( 57 IN EFI_EVENT Event, 58 IN VOID *Context 59 ) 60 { 61 UINTN Index; 62 EFI_CONFIGURATION_TABLE *ConfigEntry; 63 EFI_SYSTEM_RESOURCE_TABLE *EsrtTable; 49 64 50 65 // … … 66 81 // Search Esrt to check given capsule is qualified 67 82 // 68 mEsrtTable = (EFI_SYSTEM_RESOURCE_TABLE *) ConfigEntry->VendorTable; 83 EsrtTable = (EFI_SYSTEM_RESOURCE_TABLE *) ConfigEntry->VendorTable; 84 85 mEsrtTable = AllocateRuntimeCopyPool ( 86 sizeof (EFI_SYSTEM_RESOURCE_TABLE) + 87 EsrtTable->FwResourceCount * sizeof (EFI_SYSTEM_RESOURCE_ENTRY), 88 EsrtTable); 89 ASSERT (mEsrtTable != NULL); 69 90 70 91 // 71 // Update protocol pointer to Esrt Table.92 // Set FwResourceCountMax to a sane value. 72 93 // 73 gRT->ConvertPointer (0x00, (VOID**) &(mEsrtTable));94 mEsrtTable->FwResourceCountMax = mEsrtTable->FwResourceCount; 74 95 } 75 76 mIsVirtualAddrConverted = TRUE;77 78 96 } 79 97 … … 108 126 ASSERT_EFI_ERROR (Status); 109 127 128 // 129 // Register notify function to cache the FMP capsule GUIDs at ReadyToBoot. 130 // 131 Status = gBS->CreateEventEx ( 132 EVT_NOTIFY_SIGNAL, 133 TPL_CALLBACK, 134 DxeCapsuleLibReadyToBootEventNotify, 135 NULL, 136 &gEfiEventReadyToBootGuid, 137 &mDxeRuntimeCapsuleLibReadyToBootEvent 138 ); 139 ASSERT_EFI_ERROR (Status); 140 110 141 return EFI_SUCCESS; 111 142 } … … 134 165 ASSERT_EFI_ERROR (Status); 135 166 167 // 168 // Close the ReadyToBoot event. 169 // 170 Status = gBS->CloseEvent (mDxeRuntimeCapsuleLibReadyToBootEvent); 171 ASSERT_EFI_ERROR (Status); 172 136 173 return EFI_SUCCESS; 137 174 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
r77662 r80721 4 4 # Capsule library instance for DXE_RUNTIME_DRIVER module types. 5 5 # 6 # Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> 7 # This program and the accompanying materials 8 # are licensed and made available under the terms and conditions of the BSD License 9 # which accompanies this distribution. The full text of the license may be found at 10 # http://opensource.org/licenses/bsd-license.php 11 # 12 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 6 # Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR> 7 # SPDX-License-Identifier: BSD-2-Clause-Patent 14 8 # 15 9 ## … … 31 25 # The following information is for reference only and not required by the build tools. 32 26 # 33 # VALID_ARCHITECTURES = IA32 X64 IPFEBC27 # VALID_ARCHITECTURES = IA32 X64 EBC 34 28 # 35 29 … … 57 51 BmpSupportLib 58 52 59 [Pcd]60 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleMax ## CONSUMES61 gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCapsuleProcessFlag ## CONSUMES62 63 gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeSubClassCapsule ## CONSUMES64 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleStatusCodeProcessCapsulesBegin ## CONSUMES65 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleStatusCodeProcessCapsulesEnd ## CONSUMES66 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleStatusCodeUpdatingFirmware ## CONSUMES67 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleStatusCodeUpdateFirmwareSuccess ## CONSUMES68 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleStatusCodeUpdateFirmwareFailed ## CONSUMES69 gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleStatusCodeResettingSystem ## CONSUMES70 53 71 54 [Protocols] … … 84 67 gEfiCapsuleVendorGuid ## SOMETIMES_CONSUMES ## Variable:L"CapsuleUpdateData" 85 68 gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event 69 gEfiEventReadyToBootGuid ## CONSUMES ## Event 86 70 gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event 71 gEdkiiCapsuleOnDiskNameGuid ## SOMETIMES_CONSUMES ## GUID 87 72 88 73 [Depex] -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.uni
r77662 r80721 6 6 // Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 7 7 // 8 // This program and the accompanying materials 9 // are licensed and made available under the terms and conditions of the BSD License 10 // which accompanies this distribution. The full text of the license may be found at 11 // http://opensource.org/licenses/bsd-license.php 12 // 13 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 8 // SPDX-License-Identifier: BSD-2-Clause-Patent 15 9 // 16 10 // **/
Note:
See TracChangeset
for help on using the changeset viewer.