1 /** @file 2 Internal include file for Status Code Handler Driver. 3 4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #ifndef __STATUS_CODE_HANDLER_RUNTIME_DXE_H__ 16 #define __STATUS_CODE_HANDLER_RUNTIME_DXE_H__ 17 18 #include <Protocol/ReportStatusCodeHandler.h> 19 20 #include <Guid/MemoryStatusCodeRecord.h> 21 #include <Guid/StatusCodeDataTypeId.h> 22 #include <Guid/StatusCodeDataTypeDebug.h> 23 #include <Guid/EventGroup.h> 24 25 #include <Library/SynchronizationLib.h> 26 #include <Library/BaseMemoryLib.h> 27 #include <Library/DebugLib.h> 28 #include <Library/ReportStatusCodeLib.h> 29 #include <Library/PrintLib.h> 30 #include <Library/PcdLib.h> 31 #include <Library/HobLib.h> 32 #include <Library/UefiDriverEntryPoint.h> 33 #include <Library/UefiBootServicesTableLib.h> 34 #include <Library/MemoryAllocationLib.h> 35 #include <Library/UefiRuntimeLib.h> 36 #include <Library/SerialPortLib.h> 37 38 // 39 // Define the maximum message length 40 // 41 #define MAX_DEBUG_MESSAGE_LENGTH 0x100 42 43 // 44 // Runtime memory status code worker definition 45 // 46 typedef struct { 47 UINT32 RecordIndex; 48 UINT32 NumberOfRecords; 49 UINT32 MaxRecordsNumber; 50 } RUNTIME_MEMORY_STATUSCODE_HEADER; 51 52 extern RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable; 53 54 /** 55 Locates Serial I/O Protocol as initialization for serial status code worker. 56 57 @retval EFI_SUCCESS Serial I/O Protocol is successfully located. 58 59 **/ 60 EFI_STATUS 61 EfiSerialStatusCodeInitializeWorker ( 62 VOID 63 ); 64 65 66 /** 67 Convert status code value and extended data to readable ASCII string, send string to serial I/O device. 68 69 @param CodeType Indicates the type of status code being reported. 70 @param Value Describes the current status of a hardware or software entity. 71 This included information about the class and subclass that is used to 72 classify the entity as well as an operation. 73 @param Instance The enumeration of a hardware or software entity within 74 the system. Valid instance numbers start with 1. 75 @param CallerId This optional parameter may be used to identify the caller. 76 This parameter allows the status code driver to apply different rules to 77 different callers. 78 @param Data This optional parameter may be used to pass additional data. 79 80 @retval EFI_SUCCESS Status code reported to serial I/O successfully. 81 @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called. 82 @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK. 83 84 **/ 85 EFI_STATUS 86 EFIAPI 87 SerialStatusCodeReportWorker ( 88 IN EFI_STATUS_CODE_TYPE CodeType, 89 IN EFI_STATUS_CODE_VALUE Value, 90 IN UINT32 Instance, 91 IN EFI_GUID *CallerId, 92 IN EFI_STATUS_CODE_DATA *Data OPTIONAL 93 ); 94 95 /** 96 Initialize runtime memory status code table as initialization for runtime memory status code worker 97 98 @retval EFI_SUCCESS Runtime memory status code table successfully initialized. 99 100 **/ 101 EFI_STATUS 102 RtMemoryStatusCodeInitializeWorker ( 103 VOID 104 ); 105 106 /** 107 Report status code into runtime memory. If the runtime pool is full, roll back to the 108 first record and overwrite it. 109 110 @param CodeType Indicates the type of status code being reported. 111 @param Value Describes the current status of a hardware or software entity. 112 This included information about the class and subclass that is used to 113 classify the entity as well as an operation. 114 @param Instance The enumeration of a hardware or software entity within 115 the system. Valid instance numbers start with 1. 116 @param CallerId This optional parameter may be used to identify the caller. 117 This parameter allows the status code driver to apply different rules to 118 different callers. 119 @param Data This optional parameter may be used to pass additional data. 120 121 @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table. 122 123 **/ 124 EFI_STATUS 125 EFIAPI 126 RtMemoryStatusCodeReportWorker ( 127 IN EFI_STATUS_CODE_TYPE CodeType, 128 IN EFI_STATUS_CODE_VALUE Value, 129 IN UINT32 Instance, 130 IN EFI_GUID *CallerId, 131 IN EFI_STATUS_CODE_DATA *Data OPTIONAL 132 ); 133 134 #endif 135