Changeset 58466 in vbox for trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/CapsulePei
- Timestamp:
- Oct 29, 2015 4:30:44 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 103777
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
- Property svn:mergeinfo changed
/vendor/edk2/current merged: 103769-103776
- Property svn:mergeinfo changed
-
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/CapsulePei/Capsule.h
r58459 r58466 40 40 #include "Common/CommonHeader.h" 41 41 42 #ifdef MDE_CPU_IA32 42 #ifdef MDE_CPU_IA32 43 43 44 44 #pragma pack(1) … … 79 79 UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU) 80 80 UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page 81 UINT64 MustBe1:1; // Must be 1 81 UINT64 MustBe1:1; // Must be 1 82 82 UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write 83 83 UINT64 Available:3; // Available for use by system software … … 103 103 UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU) 104 104 UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page 105 UINT64 MustBe1:1; // Must be 1 105 UINT64 MustBe1:1; // Must be 1 106 106 UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write 107 107 UINT64 Available:3; // Available for use by system software -
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
r58459 r58466 39 39 UefiCapsule.c 40 40 Capsule.h 41 Common/CapsuleCoalesce.c 41 Common/CapsuleCoalesce.c 42 42 43 43 [Packages] … … 69 69 gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES 70 70 gPeiCapsulePpiGuid ## PRODUCES 71 72 [Ppis.IA32] 71 72 [Ppis.IA32] 73 73 gEfiPeiLoadFilePpiGuid ## SOMETIMES_CONSUMES 74 74 -
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
r58459 r58466 45 45 @param DataSize How big a free block we want to find 46 46 47 @return A pointer to a memory block of at least DataSize that lies somewhere 47 @return A pointer to a memory block of at least DataSize that lies somewhere 48 48 between MemBase and (MemBase + MemSize). The memory pointed to does not 49 49 contain any of the capsule block descriptors or capsule blocks pointed to … … 89 89 90 90 @retval NULL could not relocate the descriptors 91 @retval Pointer to the base of the successfully-relocated block descriptors. 91 @retval Pointer to the base of the successfully-relocated block descriptors. 92 92 93 93 **/ … … 107 107 108 108 @retval FALSE Capsule is OK 109 @retval TRUE Capsule is corrupted 109 @retval TRUE Capsule is corrupted 110 110 111 111 **/ … … 167 167 @param DataSize How big a free block we want to find 168 168 169 @return A pointer to a memory block of at least DataSize that lies somewhere 169 @return A pointer to a memory block of at least DataSize that lies somewhere 170 170 between MemBase and (MemBase + MemSize). The memory pointed to does not 171 171 contain any of the capsule block descriptors or capsule blocks pointed to … … 411 411 412 412 @retval NULL could not relocate the descriptors 413 @retval Pointer to the base of the successfully-relocated block descriptors. 413 @retval Pointer to the base of the successfully-relocated block descriptors. 414 414 415 415 **/ … … 698 698 699 699 @retval FALSE Capsule is OK 700 @retval TRUE Capsule is corrupted 700 @retval TRUE Capsule is corrupted 701 701 702 702 **/ … … 730 730 where capsule data corruption occurs. 731 731 732 The test pattern mode fills in memory with a counting UINT32 value. 732 The test pattern mode fills in memory with a counting UINT32 value. 733 733 If the capsule is not divided up in a multiple of 4-byte blocks, then 734 734 things get messy doing the check. Therefore there are some cases … … 824 824 BuildCapsuleDescriptors ( 825 825 IN EFI_PHYSICAL_ADDRESS *BlockListBuffer, 826 OUT EFI_CAPSULE_BLOCK_DESCRIPTOR **BlockDescriptorList 826 OUT EFI_CAPSULE_BLOCK_DESCRIPTOR **BlockDescriptorList 827 827 ) 828 828 { … … 867 867 Index ++; 868 868 } 869 869 870 870 if (HeadBlock != NULL) { 871 871 *BlockDescriptorList = HeadBlock; … … 889 889 | | Capsule [0] | | | 890 890 | ------------------------- | | 891 | Capsule Image | | 891 | Capsule Image | | 892 892 CapsuleImageBase-->+---------------------------+ 893 893 | ------------------------- | | … … 962 962 UINT8 *RelocPtr; 963 963 UINT64 *AddDataPtr; 964 UINTN CapsuleTimes; 965 UINT64 SizeLeft; 966 UINT64 CapsuleImageSize; 964 UINTN CapsuleTimes; 965 UINT64 SizeLeft; 966 UINT64 CapsuleImageSize; 967 967 UINTN CapsuleSize; 968 968 UINTN CapsuleNumber; … … 1224 1224 //Here is the end of the current capsule image. 1225 1225 // 1226 CapsuleBeginFlag = TRUE; 1226 CapsuleBeginFlag = TRUE; 1227 1227 } 1228 1228 } else { -
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
r58459 r58466 44 44 /** 45 45 Calculate the total size of page table. 46 46 47 47 @return The size of page table. 48 49 48 49 50 50 **/ 51 51 UINTN … … 129 129 IN EFI_PHYSICAL_ADDRESS PageTablesAddress 130 130 ) 131 { 131 { 132 132 UINT32 RegEax; 133 133 UINT32 RegEdx; … … 193 193 194 194 // 195 // Pre-allocate big pages to avoid later allocations. 195 // Pre-allocate big pages to avoid later allocations. 196 196 // 197 197 BigPageAddress = (UINTN) PageTablesAddress; … … 222 222 if (Page1GSupport) { 223 223 PageDirectory1GEntry = (VOID *) PageDirectoryPointerEntry; 224 224 225 225 for (IndexOfPageDirectoryEntries = 0; IndexOfPageDirectoryEntries < 512; IndexOfPageDirectoryEntries++, PageDirectory1GEntry++, PageAddress += SIZE_1GB) { 226 226 // … … 237 237 // Each Directory Pointer entries points to a page of Page Directory entires. 238 238 // So allocate space for them and fill them in in the IndexOfPageDirectoryEntries loop. 239 // 239 // 240 240 PageDirectoryEntry = (VOID *) BigPageAddress; 241 241 BigPageAddress += SIZE_4KB; … … 291 291 SWITCH_64_TO_32_CONTEXT *ReturnContext 292 292 ) 293 { 293 { 294 294 // 295 295 // Restore original GDT 296 296 // 297 297 AsmWriteGdtr (&ReturnContext->Gdtr); 298 298 299 299 // 300 300 // return to original caller 301 301 // 302 302 LongJump ((BASE_LIBRARY_JUMP_BUFFER *)(UINTN)EntrypointContext->JumpBuffer, 1); 303 303 304 304 // 305 305 // never be here 306 // 306 // 307 307 ASSERT (FALSE); 308 308 } … … 339 339 // 340 340 CreateIdentityMappingPageTables (PageTableAddress); 341 341 342 342 // 343 343 // Create 64-bit GDT … … 365 365 ); 366 366 } 367 367 368 368 // 369 369 // Convert to 32-bit Status and return … … 373 373 Status = ENCODE_ERROR ((UINTN) ReturnContext->ReturnStatus); 374 374 } 375 375 376 376 return Status; 377 377 } … … 411 411 ZeroMem (&Context, sizeof (SWITCH_32_TO_64_CONTEXT)); 412 412 ZeroMem (&ReturnContext, sizeof (SWITCH_64_TO_32_CONTEXT)); 413 413 414 414 MemoryBase64 = (UINT64) (UINTN) *MemoryBase; 415 415 MemorySize64 = (UINT64) (UINTN) *MemorySize; … … 417 417 418 418 // 419 // Merge memory range reserved for stack and page table 419 // Merge memory range reserved for stack and page table 420 420 // 421 421 if (LongModeBuffer->StackBaseAddress < LongModeBuffer->PageTableAddress) { … … 426 426 ReservedRangeEnd = LongModeBuffer->StackBaseAddress + LongModeBuffer->StackSize; 427 427 } 428 428 429 429 // 430 430 // Check if memory range reserved is overlap with MemoryBase ~ MemoryBase + MemorySize. … … 445 445 MemorySize64 = (UINT64)(UINTN)(ReservedRangeBase - MemoryBase64); 446 446 } 447 } 448 447 } 448 449 449 // 450 450 // Initialize context jumping to 64-bit enviroment … … 467 467 // 468 468 ReturnContext.ReturnStatus = 0; 469 469 470 470 // 471 471 // Save original GDT 472 472 // 473 473 AsmReadGdtr ((IA32_DESCRIPTOR *)&ReturnContext.Gdtr); 474 474 475 475 Status = Thunk32To64 (LongModeBuffer->PageTableAddress, &Context, &ReturnContext); 476 476 477 477 if (!EFI_ERROR (Status)) { 478 478 *MemoryBase = (VOID *) (UINTN) MemoryBase64; … … 576 576 ValidIndex = 0; 577 577 CapsuleDataPtr64 = 0; 578 578 579 579 Status = PeiServicesLocatePpi ( 580 580 &gEfiPeiReadOnlyVariable2PpiGuid, … … 627 627 break; 628 628 } 629 629 630 630 // 631 631 // If this BlockList has been linked before, skip this variable … … 643 643 } 644 644 } 645 645 646 646 // 647 647 // Cache BlockList which has been processed … … 651 651 } 652 652 } 653 653 654 654 return EFI_SUCCESS; 655 655 } … … 732 732 CHAR16 CapsuleVarName[30]; 733 733 CHAR16 *TempVarName; 734 EFI_PHYSICAL_ADDRESS CapsuleDataPtr64; 734 EFI_PHYSICAL_ADDRESS CapsuleDataPtr64; 735 735 EFI_STATUS Status; 736 736 EFI_BOOT_MODE BootMode; … … 755 755 Status = PeiServicesGetBootMode (&BootMode); 756 756 if (EFI_ERROR (Status) || (BootMode != BOOT_ON_FLASH_UPDATE)) { 757 DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update path.\n")); 757 DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update path.\n")); 758 758 Status = EFI_NOT_FOUND; 759 759 goto Done; 760 760 } 761 761 762 762 // 763 763 // User may set the same ScatterGatherList with several different variables, … … 798 798 Index++; 799 799 } 800 800 801 801 DEBUG ((EFI_D_INFO,"Capsule variable count = %d\n", VariableCount)); 802 802 803 803 // 804 804 // The last entry is the end flag. … … 813 813 goto Done; 814 814 } 815 815 816 816 ZeroMem (VariableArrayAddress, (VariableCount + 1) * sizeof (EFI_PHYSICAL_ADDRESS)); 817 817 818 818 // 819 819 // Find out if we actually have a capsule. … … 842 842 goto Done; 843 843 } 844 844 845 845 Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint, &CoalesceImageMachineType); 846 846 if ((EFI_ERROR (Status)) || (CoalesceImageMachineType != EFI_IMAGE_MACHINE_X64)) { … … 864 864 Status = CapsuleDataCoalesce (PeiServices, (EFI_PHYSICAL_ADDRESS *)(UINTN)VariableArrayAddress, MemoryBase, MemorySize); 865 865 #endif 866 866 867 867 DEBUG ((EFI_D_INFO, "Capsule Coalesce Status = %r!\n", Status)); 868 868 … … 870 870 DEBUG ((EFI_D_ERROR, "There is not enough memory to process capsule!\n")); 871 871 } 872 872 873 873 if (Status == EFI_NOT_FOUND) { 874 874 DEBUG ((EFI_D_ERROR, "Fail to parse capsule descriptor in memory!\n")); … … 903 903 } 904 904 /** 905 This function will look at a capsule and determine if it's a test pattern. 905 This function will look at a capsule and determine if it's a test pattern. 906 906 If it is, then it will verify it and emit an error message if corruption is detected. 907 907 908 908 @param PeiServices Standard pei services pointer 909 909 @param CapsuleBase Base address of coalesced capsule, which is preceeded … … 994 994 EFI_PHYSICAL_ADDRESS BaseAddress; 995 995 UINT64 Length; 996 996 997 997 PrivateData = (EFI_CAPSULE_PEIM_PRIVATE_DATA *) CapsuleBase; 998 998 if (PrivateData->Signature != EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE) { … … 1050 1050 BuildCvHob (BaseAddress, Length); 1051 1051 } 1052 1052 1053 1053 return EFI_SUCCESS; 1054 1054 } -
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
r58459 r58466 46 46 // Save the IA32 IDT Descriptor 47 47 // 48 AsmReadIdtr ((IA32_DESCRIPTOR *) &Ia32Idtr); 48 AsmReadIdtr ((IA32_DESCRIPTOR *) &Ia32Idtr); 49 49 50 50 // … … 54 54 X64Idtr.Base = (UINTN) IdtEntryTable; 55 55 X64Idtr.Limit = (UINT16) (sizeof (IA32_IDT_GATE_DESCRIPTOR) * EXCEPTION_VECTOR_NUMBER - 1); 56 AsmWriteIdtr ((IA32_DESCRIPTOR *) &X64Idtr); 56 AsmWriteIdtr ((IA32_DESCRIPTOR *) &X64Idtr); 57 57 58 58 // … … 61 61 Status = InitializeCpuExceptionHandlers (NULL); 62 62 ASSERT_EFI_ERROR (Status); 63 63 64 64 // 65 65 // Initialize Debug Agent to support source level debug … … 76 76 (UINTN *) (UINTN) EntrypointContext->MemorySize64Ptr 77 77 ); 78 78 79 79 ReturnContext->ReturnStatus = Status; 80 80 … … 86 86 // Restore IA32 IDT table 87 87 // 88 AsmWriteIdtr ((IA32_DESCRIPTOR *) &Ia32Idtr); 89 88 AsmWriteIdtr ((IA32_DESCRIPTOR *) &Ia32Idtr); 89 90 90 // 91 91 // Finish to coalesce capsule, and return to 32-bit mode. … … 97 97 (UINT32) (UINTN) ReturnContext, 98 98 (UINT32) (EntrypointContext->StackBufferBase + EntrypointContext->StackBufferLength) 99 ); 100 99 ); 100 101 101 // 102 102 // Should never be here.
Note:
See TracChangeset
for help on using the changeset viewer.