Skip to content

Commit

Permalink
Merge branch 'master' into root-bridges-host-provided-fix-aperture-init
Browse files Browse the repository at this point in the history
  • Loading branch information
xpahos authored Oct 9, 2024
2 parents 9e172c0 + 7bac0a9 commit 45c667a
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 30 deletions.
11 changes: 6 additions & 5 deletions BaseTools/Plugin/CodeQL/CodeQlAnalyzePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# A build plugin that analyzes a CodeQL database.
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

Expand Down Expand Up @@ -78,6 +79,11 @@ def do_post_build(self, builder: UefiBuilder) -> int:
# Packages are allowed to specify package-specific query specifiers
# in the package CI YAML file that override the global query specifier.
audit_only = False
global_audit_only = builder.env.GetValue("STUART_CODEQL_AUDIT_ONLY")
if global_audit_only:
if global_audit_only.strip().lower() == "true":
audit_only = True

query_specifiers = None
package_config_file = Path(os.path.join(
self.package_path, self.package + ".ci.yaml"))
Expand All @@ -94,11 +100,6 @@ def do_post_build(self, builder: UefiBuilder) -> int:
f"{str(package_config_file)}")
query_specifiers = plugin_data["QuerySpecifiers"]

global_audit_only = builder.env.GetValue("STUART_CODEQL_AUDIT_ONLY")
if global_audit_only:
if global_audit_only.strip().lower() == "true":
audit_only = True

if audit_only:
logging.info(f"CodeQL Analyze plugin is in audit only mode for "
f"{self.package} ({self.target}).")
Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Scripts/SetupGit.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def write_config_value(repo, section, option, data):
action='store_true',
required=False)
PARSER.add_argument('-n', '--name', type=str, metavar='repo',
choices=['edk2', 'edk2-platforms', 'edk2-non-osi'],
choices=['edk2', 'edk2-platforms', 'edk2-non-osi', 'edk2-test'],
help='set the repo name to configure for, if not '
'detected automatically',
required=False)
Expand Down
2 changes: 1 addition & 1 deletion DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ AmlSetPkgLength (
// Write to the Buffer.
*Buffer = LeadByte;
CurrentOffset = 1;
while (CurrentOffset < (Offset + 1)) {
while (CurrentOffset < (Offset + (UINT8)1)) {
CurrentShift = (UINT8)((CurrentOffset - 1) * 8);
ComputedLength = Length & (UINT32)(0x00000FF0 << CurrentShift);
ComputedLength = (ComputedLength) >> (4 + CurrentShift);
Expand Down
4 changes: 4 additions & 0 deletions EmulatorPkg/Win/Host/WinGopInput.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ WinNtWndRegisterKeyNotify (

Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);

if (Private == NULL) {
return EFI_INVALID_PARAMETER;
}

Private->MakeRegisterdKeyCallback = MakeCallBack;
Private->BreakRegisterdKeyCallback = BreakCallBack;
Private->RegisterdKeyCallbackContext = Context;
Expand Down
1 change: 1 addition & 0 deletions EmulatorPkg/Win/Host/WinGopScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ WinNtGraphicsWindowOpen (

GopPrivateCreateQ (Private, &Private->QueueForRead);

Private->Signature = GRAPHICS_PRIVATE_DATA_SIGNATURE;
Private->GraphicsWindowIo.Size = WinNtWndSize;
Private->GraphicsWindowIo.CheckKey = WinNtWndCheckKey;
Private->GraphicsWindowIo.GetKey = WinNtWndGetKey;
Expand Down
2 changes: 1 addition & 1 deletion FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ EvaluateDependency (
{
EFI_STATUS Status;
UINT8 *Iterator;
UINT8 Index;
UINTN Index;
DEPEX_ELEMENT Element1;
DEPEX_ELEMENT Element2;
GUID ImageTypeId;
Expand Down
12 changes: 10 additions & 2 deletions MdePkg/Include/Library/DebugLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,12 @@ UnitTestDebugAssert (
If MDEPKG_NDEBUG is defined or the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit
of PcdDebugProperyMask is clear, then this macro computes the offset, in bytes,
of the field specified by Field from the beginning of the data structure specified
by TYPE. This offset is subtracted from Record, and is used to return a pointer
to a data structure of the type specified by TYPE.
by TYPE. This offset is subtracted from Record, and is used to compute a pointer
to a data structure of the type specified by TYPE. The Signature field of the
data structure specified by TYPE is compared to TestSignature. If the signatures
match, then a pointer to the pointer to a data structure of the type specified by
TYPE is returned. If the signatures do not match, then NULL is returned to
signify that the passed in data structure is invalid.
If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit
of PcdDebugProperyMask is set, then this macro computes the offset, in bytes,
Expand Down Expand Up @@ -628,9 +632,13 @@ UnitTestDebugAssert (
#define CR(Record, TYPE, Field, TestSignature) \
(DebugAssertEnabled () && (BASE_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
(TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
(BASE_CR (Record, TYPE, Field)->Signature != TestSignature) ? \
NULL : \
BASE_CR (Record, TYPE, Field)
#else
#define CR(Record, TYPE, Field, TestSignature) \
(BASE_CR (Record, TYPE, Field)->Signature != TestSignature) ? \
NULL : \
BASE_CR (Record, TYPE, Field)
#endif

Expand Down
43 changes: 42 additions & 1 deletion UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,43 @@ EFI_PEI_PPI_DESCRIPTOR mEndOfPeiSignalPpi = {
NULL
};

#if (FixedPcdGetBool (PcdHandOffFdtEnable) == 0)

/**
Notify ReadyToPayLoad signal.
@param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param[in] NotifyDescriptor Address of the notification descriptor data structure.
@param[in] Ppi Address of the PPI that was installed.
@retval EFI_SUCCESS Hobs data is discovered.
@return Others No Hobs data is discovered.
**/
EFI_STATUS
EFIAPI
EndOfPeiPpiNotifyCallback (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
)
{
EFI_STATUS Status;

//
// Ready to Payload phase signal
//
Status = PeiServicesInstallPpi (&gReadyToPayloadSignalPpi);

return Status;
}

EFI_PEI_NOTIFY_DESCRIPTOR mEndOfPeiNotifyList[] = {
{
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiEndOfPeiSignalPpiGuid,
EndOfPeiPpiNotifyCallback
}
};
#endif

/**
The wrapper function of PeiLoadImageLoadImage().
@param This - Pointer to EFI_PEI_LOAD_FILE_PPI.
Expand Down Expand Up @@ -144,13 +181,14 @@ PeiLoadFileLoadPayload (
*ImageSizeArg = Context.PayloadSize;
*EntryPoint = Context.PayloadEntryPoint;

#if (FixedPcdGetBool (PcdHandOffFdtEnable))

Status = PeiServicesInstallPpi (&mEndOfPeiSignalPpi);
ASSERT_EFI_ERROR (Status);

Status = PeiServicesInstallPpi (&gReadyToPayloadSignalPpi);
ASSERT_EFI_ERROR (Status);

#if (FixedPcdGetBool (PcdHandOffFdtEnable))
Hob = GetFirstGuidHob (&gUniversalPayloadDeviceTreeGuid);
if (Hob != NULL) {
Fdt = (UNIVERSAL_PAYLOAD_DEVICE_TREE *)GET_GUID_HOB_DATA (Hob);
Expand Down Expand Up @@ -178,6 +216,9 @@ PeiLoadFileLoadPayload (
NULL,
TopOfStack
);
#else
Status = PeiServicesNotifyPpi (&mEndOfPeiNotifyList[0]);
ASSERT_EFI_ERROR (Status);
#endif

return EFI_SUCCESS;
Expand Down
4 changes: 2 additions & 2 deletions UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ AddUnitTestFailure (
UnitTest->FailureType = FailureType;
AsciiStrCpyS (
&UnitTest->FailureMessage[0],
UNIT_TEST_TESTFAILUREMSG_LENGTH,
UNIT_TEST_MAX_STRING_LENGTH,
FailureMessage
);

Expand All @@ -50,7 +50,7 @@ UnitTestLogFailure (
)
{
UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle;
CHAR8 LogString[UNIT_TEST_TESTFAILUREMSG_LENGTH];
CHAR8 LogString[UNIT_TEST_MAX_STRING_LENGTH];
VA_LIST Marker;

//
Expand Down
9 changes: 4 additions & 5 deletions UnitTestFrameworkPkg/Library/UnitTestLib/Log.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include <Library/PrintLib.h>
#include <Library/PcdLib.h>

#define UNIT_TEST_MAX_SINGLE_LOG_STRING_LENGTH (512)
#define UNIT_TEST_MAX_LOG_BUFFER SIZE_16KB
#define UNIT_TEST_MAX_LOG_BUFFER SIZE_16KB

struct _UNIT_TEST_LOG_PREFIX_STRING {
UNIT_TEST_STATUS LogLevel;
Expand Down Expand Up @@ -85,7 +84,7 @@ AddStringToUnitTestLog (
UnitTest->Log,
UNIT_TEST_MAX_LOG_BUFFER / sizeof (CHAR8),
String,
UNIT_TEST_MAX_SINGLE_LOG_STRING_LENGTH
UNIT_TEST_MAX_STRING_LENGTH
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to add unit test log string. Status = %r\n", Status));
Expand Down Expand Up @@ -160,8 +159,8 @@ UnitTestLog (
)
{
UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle;
CHAR8 NewFormatString[UNIT_TEST_MAX_SINGLE_LOG_STRING_LENGTH];
CHAR8 LogString[UNIT_TEST_MAX_SINGLE_LOG_STRING_LENGTH];
CHAR8 NewFormatString[UNIT_TEST_MAX_STRING_LENGTH];
CHAR8 LogString[UNIT_TEST_MAX_STRING_LENGTH];
CONST CHAR8 *LogTypePrefix;
VA_LIST Marker;

Expand Down
6 changes: 3 additions & 3 deletions UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ UpdateTestFromSave (
Test->FailureType = MatchingTest->FailureType;
AsciiStrnCpyS (
&Test->FailureMessage[0],
UNIT_TEST_TESTFAILUREMSG_LENGTH,
UNIT_TEST_MAX_STRING_LENGTH,
&MatchingTest->FailureMessage[0],
UNIT_TEST_TESTFAILUREMSG_LENGTH
UNIT_TEST_MAX_STRING_LENGTH
);

//
Expand Down Expand Up @@ -748,7 +748,7 @@ SerializeState (
//
TestSaveData->Result = UnitTest->Result;
TestSaveData->FailureType = UnitTest->FailureType;
AsciiStrnCpyS (&TestSaveData->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH, &UnitTest->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH);
AsciiStrnCpyS (&TestSaveData->FailureMessage[0], UNIT_TEST_MAX_STRING_LENGTH, &UnitTest->FailureMessage[0], UNIT_TEST_MAX_STRING_LENGTH);

//
// If there is a log, save the log.
Expand Down
12 changes: 3 additions & 9 deletions UnitTestFrameworkPkg/PrivateInclude/UnitTestFrameworkTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
///
/// The maximum length of a string stored in the unit test framework
///
#define UNIT_TEST_MAX_STRING_LENGTH (120)
#define UNIT_TEST_MAX_STRING_LENGTH (512)

///
/// The size of a firngerprint used to save/resume execution of a unit test
Expand All @@ -24,12 +24,6 @@
///
#define UNIT_TEST_FINGERPRINT_SIZE (sizeof (UINT32))

///
/// The maximum length of a test failure message stored in the unit test
/// framework
///
#define UNIT_TEST_TESTFAILUREMSG_LENGTH (120)

///
/// FAILURE_TYPE used to record the type of assert that was triggered by a unit
/// test.
Expand All @@ -54,7 +48,7 @@ typedef struct {
CHAR8 *Name; // can't have spaces and should be short
CHAR8 *Log;
FAILURE_TYPE FailureType;
CHAR8 FailureMessage[UNIT_TEST_TESTFAILUREMSG_LENGTH];
CHAR8 FailureMessage[UNIT_TEST_MAX_STRING_LENGTH];
UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE];
UNIT_TEST_STATUS Result;
UNIT_TEST_FUNCTION RunTest;
Expand Down Expand Up @@ -117,7 +111,7 @@ typedef struct {
typedef struct {
UINT32 Size; // Size of the UNIT_TEST_SAVE_TEST including Log[]
UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE]; // Fingerprint of the test itself.
CHAR8 FailureMessage[UNIT_TEST_TESTFAILUREMSG_LENGTH];
CHAR8 FailureMessage[UNIT_TEST_MAX_STRING_LENGTH];
FAILURE_TYPE FailureType;
UNIT_TEST_STATUS Result;
CHAR8 Log[];
Expand Down

0 comments on commit 45c667a

Please sign in to comment.