Skip to content

Commit

Permalink
Merge branch 'master' into ovmf-fix-network-disable
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 11, 2024
2 parents 2530c1f + 599c830 commit b51f98b
Show file tree
Hide file tree
Showing 337 changed files with 8,428 additions and 1,830 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/GitHub.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def add_reviewers_to_pr(
# If a comment has already been made for these non-collaborators,
# do not make another comment.
if (
comment.user.login == "github-actions[bot]"
comment.user.login == "tianocore-assign-reviewers[bot]"
and "WARNING: Cannot add some reviewers" in comment.body
and all(u in comment.body for u in non_collaborators)
):
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Build/
__pycache__/
tags/
.vscode/
.venv/
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
34 changes: 23 additions & 11 deletions .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 Expand Up @@ -373,9 +382,9 @@ def _get_template_file_contents(self) -> None:
file_template_path = pathlib.Path(os.path.join(self._plugin_path, file_template_name))
self._file_template_contents = file_template_path.read_text()
except KeyError:
logging.warning("A file header template is not specified in the config file.")
logging.info("A file header template is not specified in the config file.")
except FileNotFoundError:
logging.warning("The specified file header template file was not found.")
logging.info("The specified file header template file was not found.")
try:
func_template_name = parser["dummy_section"]["cmt_insert_func_header"]

Expand All @@ -385,9 +394,9 @@ def _get_template_file_contents(self) -> None:
func_template_path = pathlib.Path(os.path.join(self._plugin_path, func_template_name))
self._func_template_contents = func_template_path.read_text()
except KeyError:
logging.warning("A function header template is not specified in the config file.")
logging.info("A function header template is not specified in the config file.")
except FileNotFoundError:
logging.warning("The specified function header template file was not found.")
logging.info("The specified function header template file was not found.")

def _initialize_app_info(self) -> None:
"""
Expand Down Expand Up @@ -563,22 +572,21 @@ def _process_uncrustify_results(self) -> None:
self._formatted_file_error_count = len(formatted_files)

if self._formatted_file_error_count > 0:
logging.warning(f'Uncrustify found {self._formatted_file_error_count} files with formatting errors')
logging.error(f'Uncrustify found {self._formatted_file_error_count} files with formatting errors\n')
self._tc.LogStdError(f"Uncrustify found {self._formatted_file_error_count} files with formatting errors:\n")
logging.critical(
logging.warning(
"Visit the following instructions to learn "
"how to find the detailed formatting errors in Azure "
"DevOps CI: "
"https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting#how-to-find-uncrustify-formatting-errors-in-continuous-integration-ci")
"more about uncrustify setup instructions and CI:"
"https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting\n")

if self._output_file_diffs:
logging.info("Calculating file diffs. This might take a while...")

for formatted_file in formatted_files:
pre_formatted_file = formatted_file[:-len(UncrustifyCheck.FORMATTED_FILE_EXTENSION)]

logging.error(f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}")
self._tc.LogStdError(f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n")
logging.info(f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}")

if (self._output_file_diffs or
self._file_template_contents is not None or
Expand All @@ -589,19 +597,23 @@ def _process_uncrustify_results(self) -> None:

if (self._file_template_contents is not None and
self._file_template_contents in formatted_file_text):
logging.info(f"File header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}")
self._tc.LogStdError(f"File header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n")

if (self._func_template_contents is not None and
self._func_template_contents in formatted_file_text):
logging.info(f"A function header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}")
self._tc.LogStdError(f"A function header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n")

if self._output_file_diffs:
with open(pre_formatted_file) as pf:
pre_formatted_file_text = pf.read()

for line in difflib.unified_diff(pre_formatted_file_text.split('\n'), formatted_file_text.split('\n'), fromfile=pre_formatted_file, tofile=formatted_file, n=3):
logging.error(line)
self._tc.LogStdError(line)

logging.error('\n')
self._tc.LogStdError('\n')

def _remove_tree(self, dir_path: str, ignore_errors: bool = False) -> None:
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
2 changes: 0 additions & 2 deletions ArmPkg/ArmPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf

FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf

ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
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: 4 additions & 2 deletions ArmVirtPkg/ArmVirt.dsc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,10 @@
#
# Enable NX memory protection for all non-code regions, including OEM and OS
# reserved ones, with the exception of LoaderData regions, of which OS loaders
# (i.e., GRUB) may assume that its contents are executable.
# reserved ones.
# By passing --pcd PcdDxeNxMemoryProtectionPolicy=0xC000000000007FD1 on the
# build command line you can allow code execution in EfiLoaderData. This is
# required when using some outdated GRUB versions.
#
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC000000000007FD5
Expand Down
Loading

0 comments on commit b51f98b

Please sign in to comment.