Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ishih1 authored Nov 11, 2024
2 parents e8023ca + 171335e commit 99f1993
Show file tree
Hide file tree
Showing 204 changed files with 5,712 additions and 1,264 deletions.
16 changes: 8 additions & 8 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[submodule "BaseTools/Source/C/BrotliCompress/brotli"]
path = BaseTools/Source/C/BrotliCompress/brotli
url = https://github.com/google/brotli
ignore = untracked
ignore = untracked
[submodule "RedfishPkg/Library/JsonLib/jansson"]
path = RedfishPkg/Library/JsonLib/jansson
url = https://github.com/akheron/jansson
Expand All @@ -25,16 +25,16 @@
url = https://github.com/google/googletest.git
[submodule "UnitTestFrameworkPkg/Library/SubhookLib/subhook"]
path = UnitTestFrameworkPkg/Library/SubhookLib/subhook
url = https://github.com/Zeex/subhook.git
[submodule "MdePkg/Library/BaseFdtLib/libfdt"]
path = MdePkg/Library/BaseFdtLib/libfdt
url = https://github.com/devicetree-org/pylibfdt.git
url = https://github.com/tianocore/edk2-subhook.git
[submodule "MdePkg/Library/BaseFdtLib/libfdt"]
path = MdePkg/Library/BaseFdtLib/libfdt
url = https://github.com/devicetree-org/pylibfdt.git
[submodule "MdePkg/Library/MipiSysTLib/mipisyst"]
path = MdePkg/Library/MipiSysTLib/mipisyst
url = https://github.com/MIPI-Alliance/public-mipi-sys-t.git
[submodule "CryptoPkg/Library/MbedTlsLib/mbedtls"]
path = CryptoPkg/Library/MbedTlsLib/mbedtls
url = https://github.com/ARMmbed/mbedtls
[submodule "SecurityPkg/DeviceSecurity/SpdmLib/libspdm"]
path = SecurityPkg/DeviceSecurity/SpdmLib/libspdm
url = https://github.com/DMTF/libspdm.git
[submodule "SecurityPkg/DeviceSecurity/SpdmLib/libspdm"]
path = SecurityPkg/DeviceSecurity/SpdmLib/libspdm
url = https://github.com/DMTF/libspdm.git
17 changes: 17 additions & 0 deletions .pytool/Plugin/UncrustifyCheck/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ plugin execution.
By default, files in paths matched in a .gitignore file or a recognized git submodule are excluded. If this option
is `True`, the plugin will not attempt to recognize these files and exclude them.

### `UNCRUSTIFY_IN_PLACE=TRUE`

This command supports any uncrustify changes to be made in-place to the files in the workspace. This is useful for
formatting any failing code before submitting a PR. Since this is an option for a local developer to use that would
modify their files, it must be explicitly specified as a CLI argument or set as an environment variable.

_NOTE:_ This is _not_ an option in the config `yaml`. It is an option passed directly into the tool based on local
developer need.

#### Example Usage

In this example, Uncrustify would format files in `UefiCpuPkg` without running any other plugins or building any code.

```bash
stuart_ci_build -c .pytool/CISettings.py -p UefiCpuPkg -t NO-TARGET UNCRUSTIFY_IN_PLACE=TRUE --disable-all UncrustifyCheck=run
```

## High-Level Plugin Operation

This plugin generates two main sets of temporary files:
Expand Down
11 changes: 10 additions & 1 deletion .pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def RunBuildPlugin(self, package_rel_path: str, edk2_path: Edk2Path, package_con
"""
try:
# Initialize plugin and check pre-requisites.
self._env = environment_config
self._initialize_environment_info(
package_rel_path, edk2_path, package_config, tc)
self._initialize_configuration()
Expand Down Expand Up @@ -270,9 +271,17 @@ def _execute_uncrustify(self) -> None:
Executes Uncrustify with the initialized configuration.
"""
output = StringIO()
params = ['-c', self._app_config_file]
params += ['-F', self._app_input_file_path]
params += ['--if-changed']
if self._env.GetValue("UNCRUSTIFY_IN_PLACE", "FALSE") == "TRUE":
params += ['--replace', '--no-backup']
else:
params += ['--suffix', UncrustifyCheck.FORMATTED_FILE_EXTENSION]
self._app_exit_code = RunCmd(
self._app_path,
f"-c {self._app_config_file} -F {self._app_input_file_path} --if-changed --suffix {UncrustifyCheck.FORMATTED_FILE_EXTENSION}", outstream=output)
" ".join(params),
outstream=output)
self._app_output = output.getvalue().strip().splitlines()

def _get_files_ignored_in_config(self):
Expand Down
1 change: 0 additions & 1 deletion ArmPkg/ArmPkg.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"IgnoreFiles": [
"Library/ArmSoftFloatLib/berkeley-softfloat-3",
"Library/ArmSoftFloatLib/ArmSoftFloatLib.c",
"Library/CompilerIntrinsicsLib",
"Universal/Smbios/SmbiosMiscDxe"
]
},
Expand Down
8 changes: 4 additions & 4 deletions ArmPkg/Drivers/ArmGic/ArmGicLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ ArmGicEndOfInterrupt (
VOID
EFIAPI
ArmGicSetInterruptPriority (
IN UINTN GicDistributorBase,
IN UINTN GicRedistributorBase,
IN UINTN Source,
IN UINTN Priority
IN UINTN GicDistributorBase,
IN UINTN GicRedistributorBase,
IN UINTN Source,
IN UINT32 Priority
)
{
UINT32 RegOffset;
Expand Down
8 changes: 4 additions & 4 deletions ArmPkg/Include/Library/ArmGicLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ ArmGicSetPriorityMask (
VOID
EFIAPI
ArmGicSetInterruptPriority (
IN UINTN GicDistributorBase,
IN UINTN GicRedistributorBase,
IN UINTN Source,
IN UINTN Priority
IN UINTN GicDistributorBase,
IN UINTN GicRedistributorBase,
IN UINTN Source,
IN UINT32 Priority
);

VOID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ DescribeExceptionSyndrome (
DEBUG ((DEBUG_ERROR, "\n %a \n", Message));
}

#ifndef MDEPKG_NDEBUG
STATIC
CONST CHAR8 *
BaseName (
Expand All @@ -177,8 +176,6 @@ BaseName (
return Str;
}

#endif

/**
This is the default action to take on an unexpected exception
Expand Down
32 changes: 16 additions & 16 deletions ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ VideoCopyHorizontalOverlap (
UINT16 *SourcePixel16bit;
UINT16 *DestinationPixel16bit;

UINT32 SourcePixelY;
UINT32 DestinationPixelY;
UINTN SizeIn32Bits;
UINTN SizeIn16Bits;
UINTN SourcePixelY;
UINTN DestinationPixelY;
UINTN SizeIn32Bits;
UINTN SizeIn16Bits;

Status = EFI_SUCCESS;

Expand Down Expand Up @@ -271,8 +271,8 @@ BltVideoFill (
VOID *DestinationAddr;
UINT16 *DestinationPixel16bit;
UINT16 Pixel16bit;
UINT32 DestinationPixelX;
UINT32 DestinationLine;
UINTN DestinationPixelX;
UINTN DestinationLine;
UINTN WidthInBytes;

Status = EFI_SUCCESS;
Expand Down Expand Up @@ -420,11 +420,11 @@ BltVideoToBltBuffer (
VOID *DestinationAddr;
UINT16 *SourcePixel16bit;
UINT16 Pixel16bit;
UINT32 SourcePixelX;
UINT32 SourceLine;
UINT32 DestinationPixelX;
UINT32 DestinationLine;
UINT32 BltBufferHorizontalResolution;
UINTN SourcePixelX;
UINTN SourceLine;
UINTN DestinationPixelX;
UINTN DestinationLine;
UINTN BltBufferHorizontalResolution;
UINTN WidthInBytes;

Status = EFI_SUCCESS;
Expand Down Expand Up @@ -583,11 +583,11 @@ BltBufferToVideo (
VOID *SourceAddr;
VOID *DestinationAddr;
UINT16 *DestinationPixel16bit;
UINT32 SourcePixelX;
UINT32 SourceLine;
UINT32 DestinationPixelX;
UINT32 DestinationLine;
UINT32 BltBufferHorizontalResolution;
UINTN SourcePixelX;
UINTN SourceLine;
UINTN DestinationPixelX;
UINTN DestinationLine;
UINTN BltBufferHorizontalResolution;
UINTN WidthInBytes;

Status = EFI_SUCCESS;
Expand Down
14 changes: 7 additions & 7 deletions ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PL061Locate (
OUT UINTN *RegisterBase
)
{
UINT32 Index;
UINTN Index;

for (Index = 0; Index < mPL061PlatformGpio->GpioControllerCount; Index++) {
if ( (Gpio >= mPL061PlatformGpio->GpioController[Index].GpioIndex)
Expand Down Expand Up @@ -74,18 +74,18 @@ UINTN
EFIAPI
PL061EffectiveAddress (
IN UINTN Address,
IN UINTN Mask
IN UINT8 Mask
)
{
return ((Address + PL061_GPIO_DATA_REG_OFFSET) + (Mask << 2));
return ((Address + PL061_GPIO_DATA_REG_OFFSET) + (UINTN)(Mask << 2));
}

STATIC
UINTN
UINT8
EFIAPI
PL061GetPins (
IN UINTN Address,
IN UINTN Mask
IN UINT8 Mask
)
{
return MmioRead8 (PL061EffectiveAddress (Address, Mask));
Expand All @@ -96,8 +96,8 @@ VOID
EFIAPI
PL061SetPins (
IN UINTN Address,
IN UINTN Mask,
IN UINTN Value
IN UINT8 Mask,
IN UINT8 Value
)
{
MmioWrite8 (PL061EffectiveAddress (Address, Mask), Value);
Expand Down
2 changes: 1 addition & 1 deletion ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
#define PL061_GPIO_PINS 8

// All bits low except one bit high, native bit length
#define GPIO_PIN_MASK(Pin) (1UL << ((UINTN)(Pin)))
#define GPIO_PIN_MASK(Pin) (UINT8)(1 << (Pin & (PL061_GPIO_PINS - 1)))

#endif // __PL061_GPIO_H__
4 changes: 2 additions & 2 deletions ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
STATIC EFI_EVENT mEfiExitBootServicesEvent;
STATIC EFI_HARDWARE_INTERRUPT_PROTOCOL *mInterrupt;
STATIC EFI_WATCHDOG_TIMER_NOTIFY mWatchdogNotify;
STATIC UINT32 mTimerPeriod;
STATIC UINT64 mTimerPeriod;

/**
Make sure the SP805 registers are unlocked for writing.
Expand Down Expand Up @@ -101,7 +101,7 @@ SP805Stop (
{
// Disable interrupts
if ((MmioRead32 (SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_INTEN) != 0) {
MmioAnd32 (SP805_WDOG_CONTROL_REG, ~SP805_WDOG_CTRL_INTEN);
MmioAnd32 (SP805_WDOG_CONTROL_REG, (UINT32) ~SP805_WDOG_CTRL_INTEN);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
#define PL111_CTRL_LCD_16BPP_565 (6 << 1)
#define PL111_CTRL_LCD_12BPP_444 (7 << 1)
#define PL111_CTRL_LCD_BPP(Bpp) ((Bpp) << 1)
#define PL111_CTRL_LCD_EN 1
#define PL111_CTRL_LCD_EN 1U

/**********************************************************************/

Expand Down
6 changes: 3 additions & 3 deletions ArmVirtPkg/ArmVirtKvmTool.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,17 @@
UefiCpuPkg/CpuMmio2Dxe/CpuMmio2Dxe.inf {
<LibraryClasses>
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
}
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
<LibraryClasses>
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
}
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
<LibraryClasses>
NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
NULL|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
}
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
OvmfPkg/Virtio10Dxe/Virtio10.inf
Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Conf/tools_def.template
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
DEFINE CLANGDWARF_IA32_TARGET = -target i686-pc-linux-gnu
DEFINE CLANGDWARF_X64_TARGET = -target x86_64-pc-linux-gnu

DEFINE CLANGDWARF_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-unaligned-access -Wno-unneeded-internal-declaration
DEFINE CLANGDWARF_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-unaligned-access
DEFINE CLANGDWARF_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGDWARF_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference

###########################
Expand Down
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
11 changes: 10 additions & 1 deletion BaseTools/Source/C/GenFw/Elf64Convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -1482,9 +1482,18 @@ WriteSections64 (
- (SecOffset - SecShdr->sh_addr));
VerboseMsg ("Relocation: 0x%08X", *(UINT32 *)Targ);
break;
case R_X86_64_REX_GOTPCRELX:
//
// This is a relaxable GOTPCREL relocation, and the linker may have
// applied this relaxation without updating the relocation type.
// In the position independent code model, only transformations
// from MOV to LEA are possible for REX-prefixed instructions.
//
if (Targ[-2] == 0x8d) { // LEA
break;
}
case R_X86_64_GOTPCREL:
case R_X86_64_GOTPCRELX:
case R_X86_64_REX_GOTPCRELX:
VerboseMsg ("R_X86_64_GOTPCREL family");
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
Expand Down
Loading

0 comments on commit 99f1993

Please sign in to comment.