Skip to content

Commit ca01c06

Browse files
authored
Merge branch 'release/202502' into sync-basetools/release/202502/v2025020002.1.0
2 parents b3901c3 + 381bf9f commit ca01c06

File tree

12 files changed

+128
-6
lines changed

12 files changed

+128
-6
lines changed

BaseTools/Conf/build_rule.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@
294294
$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).map $(OUTPUT_DIR)(+)$(MODULE_NAME).map
295295
$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
296296
$(CP) $(OUTPUT_DIR)(+)$(MODULE_NAME).efi $(BIN_DIR)(+)$(MODULE_NAME).efi
297+
$(CP) $(DEBUG_DIR)(+)$(TARGET_TRIPLE)(+)$(RUST_TARGET)(+)$(MODULE_NAME).pdb $(OUTPUT_DIR)
297298

298299
[Static-Library-File.RUST_MODULE]
299300
<InputFile>

BaseTools/Source/C/BrotliCompress/GNUmakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ OBJECTS = \
2222
brotli/c/dec/bit_reader.o \
2323
brotli/c/dec/decode.o \
2424
brotli/c/dec/huffman.o \
25+
brotli/c/dec/prefix.o \
2526
brotli/c/dec/state.o \
27+
brotli/c/dec/static_init.o \
2628
brotli/c/enc/backward_references.o \
2729
brotli/c/enc/backward_references_hq.o \
2830
brotli/c/enc/bit_cost.o \
@@ -40,6 +42,8 @@ OBJECTS = \
4042
brotli/c/enc/memory.o \
4143
brotli/c/enc/metablock.o \
4244
brotli/c/enc/static_dict.o \
45+
brotli/c/enc/static_dict_lut.o \
46+
brotli/c/enc/static_init.o \
4347
brotli/c/enc/utf8_util.o
4448

4549
include $(MAKEROOT)/Makefiles/app.makefile

BaseTools/Source/C/BrotliCompress/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ DEC_OBJ = \
2424
brotli\c\dec\bit_reader.obj \
2525
brotli\c\dec\decode.obj \
2626
brotli\c\dec\huffman.obj \
27-
brotli\c\dec\state.obj
27+
brotli\c\dec\prefix.obj \
28+
brotli\c\dec\state.obj \
29+
brotli\c\dec\static_init.obj
2830
ENC_OBJ = \
2931
brotli\c\enc\command.obj \
3032
brotli\c\enc\compound_dictionary.obj \
@@ -46,6 +48,8 @@ ENC_OBJ = \
4648
brotli\c\enc\memory.obj \
4749
brotli\c\enc\metablock.obj \
4850
brotli\c\enc\static_dict.obj \
51+
brotli\c\enc\static_dict_lut.obj \
52+
brotli\c\enc\static_init.obj \
4953
brotli\c\enc\utf8_util.obj
5054

5155
OBJECTS = \
Submodule brotli updated 266 files

MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliCustomDecompressLib.inf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
brotli/c/dec/bit_reader.c
5050
brotli/c/dec/decode.c
5151
brotli/c/dec/huffman.c
52+
brotli/c/dec/prefix.c
5253
brotli/c/dec/state.c
54+
brotli/c/dec/static_init.c
5355
brotli/c/include/brotli/decode.h
5456
brotli/c/include/brotli/port.h
5557
brotli/c/include/brotli/types.h
Submodule brotli updated 266 files
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @file
2+
Include file to support building the third-party brotli.
3+
4+
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
5+
SPDX-License-Identifier: BSD-2-Clause-Patent
6+
7+
**/
8+
9+
#include <brotli/types.h>

MdeModulePkg/Universal/Variable/Pei/Variable.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,19 @@ FindVariableEx (
896896
MaxIndex = (VARIABLE_HEADER *)((UINT8 *)IndexTable->StartPtr + Offset);
897897
GetVariableHeader (StoreInfo, MaxIndex, &VariableHeader);
898898
if (CompareWithValidVariable (StoreInfo, MaxIndex, VariableHeader, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {
899+
// MU_CHANGE Start - Skip variables with deleted state (0x3C)
900+
//
901+
// Skip variables with deleted state (0x3C).
902+
// When a variable is deleted, the state becomes 0x3C (VAR_IN_DELETED_TRANSITION & VAR_DELETED & VAR_ADDED).
903+
// The original logic incorrectly accepted these deleted variables as valid in variable store.
904+
// This check ensures only valid states (0x3F or 0x3E) are processed.
905+
//
906+
if (VariableHeader->State == (VAR_IN_DELETED_TRANSITION & VAR_DELETED & VAR_ADDED)) {
907+
continue;
908+
}
909+
910+
// MU_CHANGE End
911+
899912
if (VariableHeader->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) {
900913
InDeletedVariable = PtrTrack->CurrPtr;
901914
} else {

NetworkPkg/SnpDxe/Snp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ SimpleNetworkDriverStart (
324324

325325
DEBUG ((DEBUG_NET, "\nSnpNotifyNetworkInterfaceIdentifier() "));
326326

327+
Snp = NULL;
328+
327329
Status = gBS->OpenProtocol (
328330
Controller,
329331
&gEfiDevicePathProtocolGuid,

StandaloneMmPkg/Drivers/StandaloneMmIplPei/StandaloneMmIplPei.c

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,10 @@ CreatMmHobList (
454454
MmProfileDataHob,
455455
Block
456456
);
457-
FreePages (PlatformHobList, EFI_SIZE_TO_PAGES (PlatformHobSize));
457+
if (PlatformHobSize != 0) {
458+
FreePages (PlatformHobList, EFI_SIZE_TO_PAGES (PlatformHobSize));
459+
}
460+
458461
ASSERT (Status == RETURN_BUFFER_TOO_SMALL);
459462
ASSERT (FoundationHobSize != 0);
460463

@@ -652,6 +655,7 @@ ExecuteMmCoreFromMmram (
652655
)
653656
{
654657
EFI_STATUS Status;
658+
EFI_STATUS AccessStatus; // MU_CHANGE: Separate variable to avoid overwriting Status
655659
UINTN PageCount;
656660
VOID *MmHobList;
657661
UINTN MmHobSize;
@@ -661,6 +665,10 @@ ExecuteMmCoreFromMmram (
661665
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
662666
STANDALONE_MM_FOUNDATION_ENTRY_POINT Entry;
663667
EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *Block;
668+
EFI_PEI_MM_ACCESS_PPI *MmAccess;
669+
UINTN Size;
670+
UINTN Index;
671+
UINTN MmramRangeCount;
664672

665673
MmFvBase = 0;
666674
MmFvSize = 0;
@@ -670,6 +678,40 @@ ExecuteMmCoreFromMmram (
670678
Status = LocateMmCoreFv (&MmFvBase, &MmFvSize, &MmCoreFileName, &ImageContext.Handle);
671679
ASSERT_EFI_ERROR (Status);
672680

681+
//
682+
// Prepare an MM access PPI for MM RAM.
683+
//
684+
MmAccess = NULL;
685+
MmramRangeCount = 0;
686+
Status = PeiServicesLocatePpi (
687+
&gEfiPeiMmAccessPpiGuid,
688+
0,
689+
NULL,
690+
(VOID **)&MmAccess
691+
);
692+
if (!EFI_ERROR (Status)) {
693+
//
694+
// Open all MMRAM ranges, if MmAccess is available.
695+
//
696+
Size = 0;
697+
Status = MmAccess->GetCapabilities ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), MmAccess, &Size, NULL);
698+
if (Status != EFI_BUFFER_TOO_SMALL) {
699+
// This is not right...
700+
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
701+
return EFI_DEVICE_ERROR;
702+
}
703+
704+
MmramRangeCount = Size / sizeof (EFI_MMRAM_DESCRIPTOR);
705+
for (Index = 0; Index < MmramRangeCount; Index++) {
706+
Status = MmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), MmAccess, Index);
707+
if (EFI_ERROR (Status)) {
708+
DEBUG ((DEBUG_ERROR, "MM IPL failed to open MMRAM windows index %d - %r\n", Index, Status));
709+
ASSERT_EFI_ERROR (Status);
710+
goto Done;
711+
}
712+
}
713+
}
714+
673715
//
674716
// Initialize ImageContext
675717
//
@@ -680,7 +722,7 @@ ExecuteMmCoreFromMmram (
680722
//
681723
Status = PeCoffLoaderGetImageInfo (&ImageContext);
682724
if (EFI_ERROR (Status)) {
683-
return Status;
725+
goto Done;
684726
}
685727

686728
PageCount = (UINTN)EFI_SIZE_TO_PAGES ((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment);
@@ -690,7 +732,8 @@ ExecuteMmCoreFromMmram (
690732
//
691733
ImageContext.ImageAddress = MmIplAllocateMmramPage (PageCount, &Block);
692734
if (ImageContext.ImageAddress == 0) {
693-
return EFI_NOT_FOUND;
735+
Status = EFI_NOT_FOUND;
736+
goto Done;
694737
}
695738

696739
//
@@ -753,6 +796,48 @@ ExecuteMmCoreFromMmram (
753796
}
754797
}
755798

799+
Done:
800+
if (MmAccess != NULL) {
801+
//
802+
// Close all MMRAM ranges, if MmAccess is available.
803+
//
804+
for (Index = 0; Index < MmramRangeCount; Index++) {
805+
// MU_CHANGE START: Will not return if error occurs
806+
AccessStatus = MmAccess->Close ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), MmAccess, Index);
807+
if (EFI_ERROR (AccessStatus)) {
808+
DEBUG ((DEBUG_ERROR, "MM IPL failed to close MMRAM windows index %d - %r\n", Index, AccessStatus));
809+
ASSERT (FALSE);
810+
}
811+
812+
// MU_CHANGE END: Will not return if error occurs
813+
814+
//
815+
// Print debug message that the MMRAM window is now closed.
816+
//
817+
DEBUG ((DEBUG_INFO, "MM IPL closed MMRAM window index %d\n", Index));
818+
819+
//
820+
// Lock the MMRAM (Note: Locking MMRAM may not be supported on all platforms)
821+
//
822+
// MU_CHANGE START: Will not return if error occurs and allow UNSUPPORTED
823+
AccessStatus = MmAccess->Lock ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), MmAccess, Index);
824+
if (EFI_ERROR (AccessStatus) && (AccessStatus != EFI_UNSUPPORTED)) {
825+
//
826+
// Print error message that the MMRAM failed to lock...
827+
//
828+
DEBUG ((DEBUG_ERROR, "MM IPL could not lock MMRAM (Index %d) after executing MM Core %r\n", Index, AccessStatus));
829+
ASSERT (FALSE);
830+
}
831+
832+
// MU_CHANGE END: Will not return if error occurs and allow UNSUPPORTED
833+
834+
//
835+
// Print debug message that the MMRAM window is now locked.
836+
//
837+
DEBUG ((DEBUG_INFO, "MM IPL locked MMRAM window index %d\n", Index));
838+
}
839+
}
840+
756841
return Status;
757842
}
758843

0 commit comments

Comments
 (0)