]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/WinNtOemHookStatusCodeHandlerPei/WinNtOemHookStatusCodeHandlerPei.c
Enable Report Status Code Router introduced in PI 1.2 for PEI and DXE.
[mirror_edk2.git] / Nt32Pkg / WinNtOemHookStatusCodeHandlerPei / WinNtOemHookStatusCodeHandlerPei.c
1 /** @file
2 OEM hook status code handler PEIM which produces general handler and hook it
3 onto the PEI status code router.
4
5 Copyright (c) 2006 - 2009, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 //
17 // The package level header files this module uses
18 //
19 #include <WinNtPeim.h>
20
21 //
22 // The protocols, PPI and GUID defintions for this module
23 //
24 #include <Ppi/ReportStatusCodeHandler.h>
25 //
26 // The Library classes this module consumes
27 //
28 #include <Library/DebugLib.h>
29 #include <Library/PeiServicesLib.h>
30 #include <Library/PeimEntryPoint.h>
31 #include <Library/OemHookStatusCodeLib.h>
32
33 EFI_STATUS
34 EFIAPI
35 OemHookStatusCodeReportWrapper (
36 IN CONST EFI_PEI_SERVICES **PeiServices,
37 IN EFI_STATUS_CODE_TYPE CodeType,
38 IN EFI_STATUS_CODE_VALUE Value,
39 IN UINT32 Instance,
40 IN CONST EFI_GUID *CallerId, OPTIONAL
41 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
42 )
43 {
44 return OemHookStatusCodeReport (
45 CodeType,
46 Value,
47 Instance,
48 (EFI_GUID *) CallerId,
49 (EFI_STATUS_CODE_DATA *) Data
50 );
51 }
52
53 /**
54 Entry point of OEM hook status code handler PEIM.
55
56 This function is the entry point of this OEM hook status code handler PEIM.
57 It initializes and registers OEM status code handler.
58
59 @param FileHandle Handle of the file being invoked.
60 @param PeiServices Describes the list of possible PEI Services.
61
62 @retval EFI_SUCESS The entry point executes successfully.
63
64 **/
65 EFI_STATUS
66 EFIAPI
67 WinNtOemHookStatusCodeHandlerPeiEntry (
68 IN EFI_PEI_FILE_HANDLE FileHandle,
69 IN CONST EFI_PEI_SERVICES **PeiServices
70 )
71 {
72 EFI_STATUS Status;
73 EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi;
74
75 Status = PeiServicesLocatePpi (
76 &gEfiPeiRscHandlerPpiGuid,
77 0,
78 NULL,
79 (VOID **) &RscHandlerPpi
80 );
81 ASSERT_EFI_ERROR (Status);
82
83 OemHookStatusCodeInitialize ();
84
85 Status = RscHandlerPpi->Register (OemHookStatusCodeReportWrapper);
86 ASSERT_EFI_ERROR (Status);
87
88 return EFI_SUCCESS;
89 }