Skip to content

Commit

Permalink
[Cherry-Pick] Support Report Status Code in the UefiPxe driver.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
yhsu3 authored and apop5 committed Sep 12, 2024
1 parent 88b6c1e commit 95a58f8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1276,5 +1276,12 @@ PxeBcLoadBootFile (
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;
}
7 changes: 7 additions & 0 deletions NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
//
Expand Down
1 change: 1 addition & 0 deletions NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <Library/DpcLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PcdLib.h>
#include <Library/ReportStatusCodeLib.h>

typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA;
typedef struct _PXEBC_PRIVATE_PROTOCOL PXEBC_PRIVATE_PROTOCOL;
Expand Down
1 change: 1 addition & 0 deletions NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
DpcLib
DevicePathLib
PcdLib
ReportStatusCodeLib

[Protocols]
## TO_START
Expand Down

0 comments on commit 95a58f8

Please sign in to comment.