Skip to content

Commit

Permalink
Merge branch 'release/202302' into core_adv_logger
Browse files Browse the repository at this point in the history
  • Loading branch information
kuqin12 authored Nov 15, 2023
2 parents 1892ea7 + 9ce0c1f commit 6cd5ee2
Show file tree
Hide file tree
Showing 36 changed files with 1,866 additions and 40 deletions.
11 changes: 10 additions & 1 deletion .azurepipelines/MuDevOpsWrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resources:
type: github
endpoint: microsoft
name: microsoft/mu_devops
ref: refs/tags/v7.0.1
ref: refs/tags/v7.2.0

parameters:
- name: do_ci_build
Expand All @@ -40,6 +40,13 @@ parameters:
displayName: Perform Stuart PR Evaluation
type: boolean
default: true
- name: calculate_code_coverage
displayName: Calculate Code Coverage From Unit Tests
default: false
- name: coverage_publish_target
displayName: Code Coverage Publish Target
type: string
default: 'ado' # 'ado', 'codecov'
- name: container_build
displayName: Flag for whether this repo should do stuart_setup
type: boolean
Expand Down Expand Up @@ -86,6 +93,8 @@ jobs:
do_ci_build: ${{ parameters.do_ci_build }}
do_ci_setup: ${{ parameters.do_ci_setup }}
do_pr_eval: ${{ parameters.do_pr_eval }}
calculate_code_coverage: ${{ parameters.calculate_code_coverage }}
coverage_publish_target: ${{ parameters.coverage_publish_target }}
do_non_ci_setup: ${{ parameters.do_non_ci_setup }}
do_non_ci_build: ${{ parameters.do_non_ci_build }}
build_matrix: ${{ parameters.build_matrix }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ jobs:
approval_check:
if: |
github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot'
uses: microsoft/mu_devops/.github/workflows/AutoApprover.yml@v7.0.1
uses: microsoft/mu_devops/.github/workflows/AutoApprover.yml@v7.2.0
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
merge_check:
if: |
github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'uefibot'
uses: microsoft/mu_devops/.github/workflows/AutoMerger.yml@v7.0.1
uses: microsoft/mu_devops/.github/workflows/AutoMerger.yml@v7.2.0
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/issue-assignment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ on:

jobs:
apply:
uses: microsoft/mu_devops/.github/workflows/IssueAssignment.yml@v7.0.1
uses: microsoft/mu_devops/.github/workflows/IssueAssignment.yml@v7.2.0
2 changes: 1 addition & 1 deletion .github/workflows/label-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ on:

jobs:
apply:
uses: microsoft/mu_devops/.github/workflows/Labeler.yml@v7.0.1
uses: microsoft/mu_devops/.github/workflows/Labeler.yml@v7.2.0
2 changes: 1 addition & 1 deletion .github/workflows/label-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ on:

jobs:
sync:
uses: microsoft/mu_devops/.github/workflows/LabelSyncer.yml@v7.0.1
uses: microsoft/mu_devops/.github/workflows/LabelSyncer.yml@v7.2.0
2 changes: 1 addition & 1 deletion .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ on:

jobs:
draft:
uses: microsoft/mu_devops/.github/workflows/ReleaseDrafter.yml@v7.0.1
uses: microsoft/mu_devops/.github/workflows/ReleaseDrafter.yml@v7.2.0
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ on:

jobs:
check:
uses: microsoft/mu_devops/.github/workflows/Stale.yml@v7.0.1
uses: microsoft/mu_devops/.github/workflows/Stale.yml@v7.2.0
2 changes: 1 addition & 1 deletion .github/workflows/triage-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ on:

jobs:
triage:
uses: microsoft/mu_devops/.github/workflows/IssueTriager.yml@v7.0.1
uses: microsoft/mu_devops/.github/workflows/IssueTriager.yml@v7.2.0
1 change: 1 addition & 0 deletions AdvLoggerPkg/AdvLoggerPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@

[Components]
AdvLoggerPkg/Library/BaseDebugLibAdvancedLogger/BaseDebugLibAdvancedLogger.inf
AdvLoggerPkg/Library/BasePanicLibAdvancedLogger/BasePanicLibAdvancedLogger.inf

[Components.IA32]
AdvLoggerPkg/Library/AdvancedLoggerLib/Pei/AdvancedLoggerLib.inf
Expand Down
12 changes: 11 additions & 1 deletion AdvLoggerPkg/Docs/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The following libraries are used with AdvancedLogger:
| AdvancedLoggerLib | One per module type - used to provide access to the in memory log buffer |
| AdvLoggerSmmAccessLib | Used to intercept GetVariable in order to provide an OS utility the ability to read the log |
| BaseDebugLibAdvancedLogger | Basic Dxe etc DebugLib |
| BasePanicLibAdvancedLogger | Basic PanicLib that applies to all PI boot phases that AdvancedLoggerLib supports. |
| DebugAgent | Used to intercept SEC initialization |
| PeiDebugLibAdvancedLogger | Basic Pei DebugLib |
| AdvancedLoggerHdwPortLib | Hook for a hardware port to capture debug messages as they are written to the log. |
Expand Down Expand Up @@ -242,6 +243,15 @@ and the follow change is needed in the .fdf:
INF AdvLoggerPkg/AdvancedFileLogger/AdvancedFileLogger.inf
```

## Advanced Logger Retrieval From Windows

The Advanced Logger can be retrieved from Windows using the [DecodeUefiLog](../Application/DecodeUefiLog/ReadMe.md)
python utility. The utility runs under windows and retrieves the log through the `AdvLoggerAccessLib` instance
provided by the platform.

If reading of the log fails, please verify that the `AdvLoggerAccessLib` instance in the platform is either the
`AdvLoggerMmAccessLib` or the `AdvLoggerSmmAccessLib` and not the NULL instance provided by MdeModulePkg.

## Hardware Logging Level

The v3 data header supports a new field of hardware debugging level to support setting the serial print configurable
Expand All @@ -267,5 +277,5 @@ result in hardware printing not functional.

## Copyright

Copyright (C) Microsoft Corporation. All rights reserved.
Copyright (C) Microsoft Corporation. All rights reserved. \
SPDX-License-Identifier: BSD-2-Clause-Patent
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ DxeCoreAdvancedLoggerLibConstructor (
LoggerInfo->LogBufferSize = EFI_PAGES_TO_SIZE (FixedPcdGet32 (PcdAdvancedLoggerPages)) - sizeof (ADVANCED_LOGGER_INFO);
LoggerInfo->LogCurrent = LoggerInfo->LogBuffer;
LoggerInfo->HwPrintLevel = FixedPcdGet32 (PcdAdvancedLoggerHdwPortDebugPrintErrorLevel);
mMaxAddress = PA_FROM_PTR (LoggerInfo) + LoggerInfo->LogBufferSize;
mMaxAddress = LoggerInfo->LogBuffer + LoggerInfo->LogBufferSize;
mBufferSize = LoggerInfo->LogBufferSize;
} else {
DEBUG ((DEBUG_ERROR, "%a: Error allocating Advanced Logger Buffer\n", __FUNCTION__));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/** @file
An instance of the Panic Library that outputs to advanced logger.
Copyright (c) Microsoft Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <Base.h>
#include <Library/BaseLib.h>
#include <Library/PrintLib.h>
#include <Library/AdvancedLoggerLib.h>
#include <Library/PanicLib.h>

//
// Define the maximum panic message length that this library supports
//
#define MAX_PANIC_MESSAGE_LENGTH 0x100

/**
Prints a panic message containing a filename, line number, and description.
This is always followed by a dead loop.
Print a message of the form "PANIC <FileName>(<LineNumber>): <Description>\n"
to the debug output device. Immediately after that CpuDeadLoop() is called.
If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
@param FileName The pointer to the name of the source file that generated the panic condition.
@param LineNumber The line number in the source file that generated the panic condition
@param Description The pointer to the description of the panic condition.
**/
VOID
EFIAPI
PanicReport (
IN CONST CHAR8 *FileName,
IN UINTN LineNumber,
IN CONST CHAR8 *Description
)
{
CHAR8 Buffer[MAX_PANIC_MESSAGE_LENGTH];

if (FileName == NULL) {
FileName = "(NULL) Filename";
}

if (Description == NULL) {
Description = "(NULL) Description";
}

AsciiSPrint (Buffer, sizeof (Buffer), "PANIC [%a] %a(%d): %a\n", gEfiCallerBaseName, FileName, LineNumber, Description);

// Note: 0x80000000 is used instead of DEBUG_ERROR to avoid a dependency on DebugLib.h just for that value.
// The high bit being set for error status codes is defined per the UEFI Specification (2.10 section below).
// https://uefi.org/specs/UEFI/2.10/Apx_D_Status_Codes.html#status-codes
AdvancedLoggerWrite (0x80000000, Buffer, AsciiStrnLenS (Buffer, sizeof (Buffer)));

//
// Deadloop since the system is in an unrecoverable state.
//
CpuDeadLoop ();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## @file
# An instance of the Panic Library that outputs to advanced logger.
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = BasePanicLibAdvancedLogger
FILE_GUID = 536D781D-A6A6-4831-AAB8-1E391DA2DD06
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = PanicLib

#
# VALID_ARCHITECTURES = ANY
#

[Packages]
MdePkg/MdePkg.dec
AdvLoggerPkg/AdvLoggerPkg.dec

[LibraryClasses]
AdvancedLoggerLib
BaseLib
PrintLib

[Sources]
BasePanicLibAdvancedLogger.c
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ members = [
RustAdvancedLoggerDxe = {path = "AdvLoggerPkg/Crates/RustAdvancedLoggerDxe"}
RustBootServicesAllocatorDxe = {path = "MsCorePkg/Crates/RustBootServicesAllocatorDxe"}
HidIo = {path = "HidPkg/Crates/HidIo"}

hidparser = {git = "https://github.com/microsoft/mu_rust_hid.git", branch = "main"}
HiiKeyboardLayout = {path = "HidPkg/Crates/HiiKeyboardLayout"}

r-efi = "4.3.0"
rustversion = "1.0.14"
Expand Down
6 changes: 5 additions & 1 deletion HidPkg/Crates/HiiKeyboardLayout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ use r_efi::{
};
use scroll::{ctx, Pread, Pwrite};

/// GUID for default keyboard layout.
pub const DEFAULT_KEYBOARD_LAYOUT_GUID: efi::Guid =
efi::Guid::from_fields(0x3a4d7a7c, 0x18a, 0x4b42, 0x81, 0xb3, &[0xdc, 0x10, 0xe3, 0xb5, 0x91, 0xbd]);

/// HII Keyboard Package List
/// Refer to UEFI spec version 2.10 section 33.3.1.2 which defines the generic header structure. This implementation
/// only supports HII Keyboard Packages; other HII package types (or mixes) are not supported.
Expand Down Expand Up @@ -465,7 +469,7 @@ macro_rules! key_descriptor {
#[rustfmt::skip]
pub fn get_default_keyboard_layout() -> HiiKeyboardLayout {
HiiKeyboardLayout {
guid: efi::Guid::from_fields(0x3a4d7a7c, 0x18a, 0x4b42, 0x81, 0xb3, &[0xdc, 0x10, 0xe3, 0xb5, 0x91, 0xbd]),
guid: DEFAULT_KEYBOARD_LAYOUT_GUID,
keys: vec![
key!(EfiKey::C1, 'a', 'A', '\0', '\0', NULL_MODIFIER, AFFECTED_BY_STANDARD_SHIFT | AFFECTED_BY_CAPS_LOCK),
key!(EfiKey::B5, 'b', 'B', '\0', '\0', NULL_MODIFIER, AFFECTED_BY_STANDARD_SHIFT | AFFECTED_BY_CAPS_LOCK),
Expand Down
1 change: 1 addition & 0 deletions HidPkg/UefiHidDxe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ test = false
[dependencies]
HidIo = {workspace=true}
hidparser = {workspace=true}
HiiKeyboardLayout = {workspace=true}
memoffset = {workspace=true}
r-efi = {workspace=true}
rustversion = {workspace=true}
Expand Down
3 changes: 2 additions & 1 deletion HidPkg/UefiHidDxe/src/driver_binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn initialize_driver_binding(image_handle: efi::Handle) -> Result<(), efi::S
stop: uefi_hid_driver_binding_stop,
version: 1,
image_handle: driver_binding_handle,
driver_binding_handle: driver_binding_handle,
driver_binding_handle,
}));

let status = (boot_services.install_protocol_interface)(
Expand All @@ -43,6 +43,7 @@ pub fn initialize_driver_binding(image_handle: efi::Handle) -> Result<(), efi::S
);

if status.is_error() {
drop(unsafe { Box::from_raw(driver_binding_ptr) });
return Err(status);
}

Expand Down
2 changes: 1 addition & 1 deletion HidPkg/UefiHidDxe/src/hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use rust_advanced_logger_dxe::{debugln, DEBUG_ERROR, DEBUG_WARN};
use crate::{keyboard, keyboard::KeyboardContext, pointer, pointer::PointerContext, BOOT_SERVICES};

pub struct HidContext {
hid_io: *mut hid_io::protocol::Protocol,
pub hid_io: *mut hid_io::protocol::Protocol,
pub keyboard_context: *mut KeyboardContext,
pub pointer_context: *mut PointerContext,
}
Expand Down
Loading

0 comments on commit 6cd5ee2

Please sign in to comment.