Fix warnings generated by GCC.
[edk2.git] / DuetPkg / RtPlatformStatusCode / RtPlatformStatusCode.c
blob0f63379f6af0a0c45a3bec76491efc2c9414ccab
1 /*++
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
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.
12 Module Name:
14 RtPlatformStatusCode.c
16 Abstract:
18 Contains NT32 specific implementations required to use status codes.
20 --*/
23 // Statements that include other files.
25 #include "Tiano.h"
26 #include "EfiCommonLib.h"
27 #include "EfiRuntimeLib.h"
28 #include "EfiStatusCode.h"
29 #include "EfiHobLib.h"
30 #include "RtMemoryStatusCodeLib.h"
31 #include "BsDataHubStatusCodeLib.h"
34 // Consumed protocols
36 #include EFI_ARCH_PROTOCOL_CONSUMER (StatusCode)
39 // GUID definitions
41 #include EFI_GUID_DEFINITION (Hob)
44 // Globals only work at BootService Time. NOT at Runtime!
46 EFI_REPORT_STATUS_CODE mPeiReportStatusCode;
49 // Function implementations
51 EFI_STATUS
52 EFIAPI
53 RtPlatformReportStatusCode (
54 IN EFI_STATUS_CODE_TYPE CodeType,
55 IN EFI_STATUS_CODE_VALUE Value,
56 IN UINT32 Instance,
57 IN EFI_GUID * CallerId,
58 IN EFI_STATUS_CODE_DATA * Data OPTIONAL
60 /*++
62 Routine Description:
64 Call all status code listeners in the MonoStatusCode.
66 Arguments:
68 Same as ReportStatusCode service
70 Returns:
72 EFI_SUCCESS Always returns success.
74 --*/
76 RtMemoryReportStatusCode (CodeType, Value, Instance, CallerId, Data);
77 if (EfiAtRuntime ()) {
79 // For now all we do is post code at runtime
81 return EFI_SUCCESS;
84 BsDataHubReportStatusCode (CodeType, Value, Instance, CallerId, Data);
87 // Call back into PEI to get status codes. This is because SecMain contains
88 // status code that reports to Win32.
90 if (mPeiReportStatusCode != NULL) {
91 return mPeiReportStatusCode (CodeType, Value, Instance, CallerId, Data);
94 return EFI_SUCCESS;
97 VOID
98 EFIAPI
99 RtPlatformInitializeStatusCode (
100 IN EFI_HANDLE ImageHandle,
101 IN EFI_SYSTEM_TABLE *SystemTable
103 /*++
105 Routine Description:
107 Initialize the status code listeners.
109 Arguments:
111 (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
113 Returns:
115 None
117 --*/
119 EFI_STATUS Status;
120 VOID *HobList;
121 VOID *Pointer;
123 RtMemoryInitializeStatusCode (ImageHandle, SystemTable);
124 BsDataHubInitializeStatusCode (ImageHandle, SystemTable);
127 // Play any prior status codes to the data hub.
129 PlaybackStatusCodes (BsDataHubReportStatusCode);
132 // If PEI has a ReportStatusCode callback find it and use it before StdErr
133 // is connected.
135 mPeiReportStatusCode = NULL;
137 Status = EfiLibGetSystemConfigurationTable (&gEfiHobListGuid, &HobList);
138 if (!EFI_ERROR (Status)) {
139 Status = GetNextGuidHob (&HobList, &gEfiStatusCodeRuntimeProtocolGuid, &Pointer, NULL);
140 if (!EFI_ERROR (Status)) {
141 mPeiReportStatusCode = (EFI_REPORT_STATUS_CODE) (*(UINTN *) Pointer);