1 /** @file
2   Pei Core Status Code Support
3 
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #include "PeiMain.h"
10 
main(int argc,char const * argv[])11 /**
12 
13   Core version of the Status Code reporter
14 
15 
16   @param PeiServices     An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
17   @param CodeType        Type of Status Code.
18   @param Value           Value to output for Status Code.
19   @param Instance        Instance Number of this status code.
20   @param CallerId        ID of the caller of this status code.
21   @param Data            Optional data associated with this status code.
22 
23   @retval EFI_SUCCESS             if status code is successfully reported
24   @retval EFI_NOT_AVAILABLE_YET   if StatusCodePpi has not been installed
25 
26 **/
27 EFI_STATUS
28 EFIAPI
29 PeiReportStatusCode (
30   IN CONST EFI_PEI_SERVICES         **PeiServices,
31   IN EFI_STATUS_CODE_TYPE           CodeType,
32   IN EFI_STATUS_CODE_VALUE          Value,
33   IN UINT32                         Instance,
34   IN CONST EFI_GUID                 *CallerId,
35   IN CONST EFI_STATUS_CODE_DATA     *Data OPTIONAL
36   )
37 {
38   EFI_STATUS                Status;
39   EFI_PEI_PROGRESS_CODE_PPI *StatusCodePpi;
40 
41   //
42   // Locate StatusCode Ppi.
43   //
44   Status = PeiServicesLocatePpi (
45              &gEfiPeiStatusCodePpiGuid,
46              0,
47              NULL,
48              (VOID **)&StatusCodePpi
49              );
50 
51   if (!EFI_ERROR (Status)) {
52     Status = StatusCodePpi->ReportStatusCode (
53                             PeiServices,
54                             CodeType,
55                             Value,
56                             Instance,
57                             CallerId,
58                             Data
59                             );
60 
61    return Status;
62   }
63 
64   return  EFI_NOT_AVAILABLE_YET;
65 }
66 
67 
68 
69