From 589304e67fbfcbb7c250d1a3031ef23c4fb8a41b Mon Sep 17 00:00:00 2001 From: yhsu3 Date: Sun, 8 Sep 2024 17:45:54 +0800 Subject: Support Report Status Code in the UefiPxe driver. Report PXE error status via Status Code, with this design, it will be flexible to register a status code handler via gEfiRscHandlerProtocolGuid to output the customized error code to other telemetry service. The subclass code is `EFI_IO_BUS_IP_NETWORK` Signed-off-by: Ethan Hsu --- NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c | 7 +++++++ NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 7 +++++++ NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h | 1 + NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf | 1 + 4 files changed, 16 insertions(+) (limited to 'NetworkPkg') diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c index f22a151e25..0af791dc5f 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c @@ -1268,5 +1268,12 @@ ON_EXIT: AsciiPrint ("\n PXE-E99: Unexpected network error.\n"); } + REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( + EFI_ERROR_CODE, + (EFI_STATUS_CODE_VALUE)(EFI_IO_BUS_IP_NETWORK | EFI_OEM_SPECIFIC | ((EFI_STATUS_CODE_VALUE)(Status & 0x1F))), + (VOID *)&(PxeBcMode->UsingIpv6), + sizeof (PxeBcMode->UsingIpv6) + ); + return Status; } diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c index 0a4baf6f90..e296474471 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c @@ -72,6 +72,13 @@ EfiPxeBcStart ( return EFI_UNSUPPORTED; } + REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( + EFI_PROGRESS_CODE, + EFI_IO_BUS_IP_NETWORK | EFI_IOB_PC_RECONFIG, + (VOID *)&(Mode->UsingIpv6), + sizeof (Mode->UsingIpv6) + ); + if (Mode->UsingIpv6) { AsciiPrint ("\n>>Start PXE over IPv6"); // diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h index 732889f23d..cdb9b34480 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h @@ -48,6 +48,7 @@ #include #include #include +#include typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA; typedef struct _PXEBC_PRIVATE_PROTOCOL PXEBC_PRIVATE_PROTOCOL; diff --git a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf index 3371c150be..d5aba1376a 100644 --- a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf +++ b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf @@ -62,6 +62,7 @@ DpcLib DevicePathLib PcdLib + ReportStatusCodeLib [Protocols] ## TO_START -- cgit v1.2.3