Initial import.
[mirror_edk2.git] / EdkModulePkg / Universal / StatusCode / RuntimeDxe / Ipf / IpfStatusCode.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 IpfStatusCode.c
15
16 Abstract:
17
18 Contains the IPF installation function and an ESAL entry.
19
20 --*/
21
22 #include "StatusCode.h"
23
24 SAL_RETURN_REGS
25 ReportStatusCodeEsalServicesClassCommonEntry (
26 IN UINT64 FunctionId,
27 IN UINT64 Arg2,
28 IN UINT64 Arg3,
29 IN UINT64 Arg4,
30 IN UINT64 Arg5,
31 IN UINT64 Arg6,
32 IN UINT64 Arg7,
33 IN UINT64 Arg8,
34 IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,
35 IN BOOLEAN VirtualMode,
36 IN VOID *Global
37 )
38 /*++
39
40 Routine Description:
41
42 Main entry for Extended SAL ReportStatusCode Services
43
44 Arguments:
45
46 FunctionId Function Id which needed to be called
47 Arg2 Efi status code type
48 Arg3 Efi status code value
49 Arg4 Instance number
50 Arg5 Caller Id
51 Arg6 Efi status code data
52 Arg7 Not used
53 Arg8 Not used
54 ExtendedSalProc Esal Proc pointer
55 VirtualMode If this function is called in virtual mode
56 Global This module's global variable pointer
57
58 Returns:
59
60 SAL_RETURN_REGS
61
62 --*/
63 {
64 SAL_RETURN_REGS ReturnVal;
65
66 switch (FunctionId) {
67
68 case ReportStatusCodeService:
69 ReturnVal.Status = StatusCodeReportStatusCode (
70 (EFI_STATUS_CODE_TYPE) Arg2,
71 (EFI_STATUS_CODE_VALUE) Arg3,
72 (UINT32) Arg4,
73 (EFI_GUID *) Arg5,
74 (EFI_STATUS_CODE_DATA *) Arg6
75 );
76 break;
77
78 default:
79 ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;
80 break;
81 }
82
83 return ReturnVal;
84 }
85
86 EFI_STATUS
87 EFIAPI
88 InstallStatusCode (
89 IN EFI_HANDLE ImageHandle,
90 IN EFI_SYSTEM_TABLE *SystemTable
91 )
92 /*++
93
94 Routine Description:
95
96 Install the ReportStatusCode runtime service.
97
98 Arguments:
99
100 ImageHandle Image handle of the loaded driver
101 SystemTable Pointer to the System Table
102
103 Returns:
104
105 EFI_SUCCESS The function always returns success.
106
107 --*/
108 {
109 //
110 // Initialize RT status code
111 //
112 InitializeStatusCode (ImageHandle, SystemTable);
113
114 //
115 // Initialize ESAL capabilities
116 //
117 RegisterEsalClass (
118 &gEfiExtendedSalStatusCodeServicesProtocolGuid,
119 NULL,
120 ReportStatusCodeEsalServicesClassCommonEntry,
121 StatusCode,
122 NULL
123 );
124
125 return EFI_SUCCESS;
126 }