1 /** @file 2 Internal include file for Status Code Handler Driver. 3 4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> 5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> 6 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 #ifndef __STATUS_CODE_HANDLER_RUNTIME_DXE_H__ 17 #define __STATUS_CODE_HANDLER_RUNTIME_DXE_H__ 18 19 #include <Protocol/ReportStatusCodeHandler.h> 20 21 #include <Guid/MemoryStatusCodeRecord.h> 22 #include <Guid/StatusCodeDataTypeId.h> 23 #include <Guid/StatusCodeDataTypeDebug.h> 24 #include <Guid/EventGroup.h> 25 26 #include <Library/SynchronizationLib.h> 27 #include <Library/BaseMemoryLib.h> 28 #include <Library/DebugLib.h> 29 #include <Library/ReportStatusCodeLib.h> 30 #include <Library/PrintLib.h> 31 #include <Library/PcdLib.h> 32 #include <Library/HobLib.h> 33 #include <Library/UefiDriverEntryPoint.h> 34 #include <Library/UefiBootServicesTableLib.h> 35 #include <Library/MemoryAllocationLib.h> 36 #include <Library/UefiRuntimeLib.h> 37 #include <Library/SerialPortLib.h> 38 39 // 40 // Define the maximum message length 41 // 42 #define MAX_DEBUG_MESSAGE_LENGTH 0x100 43 44 extern RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable; 45 46 /** 47 Locates Serial I/O Protocol as initialization for serial status code worker. 48 49 @retval EFI_SUCCESS Serial I/O Protocol is successfully located. 50 51 **/ 52 EFI_STATUS 53 EfiSerialStatusCodeInitializeWorker ( 54 VOID 55 ); 56 57 58 /** 59 Convert status code value and extended data to readable ASCII string, send string to serial I/O device. 60 61 @param CodeType Indicates the type of status code being reported. 62 @param Value Describes the current status of a hardware or software entity. 63 This included information about the class and subclass that is used to 64 classify the entity as well as an operation. 65 @param Instance The enumeration of a hardware or software entity within 66 the system. Valid instance numbers start with 1. 67 @param CallerId This optional parameter may be used to identify the caller. 68 This parameter allows the status code driver to apply different rules to 69 different callers. 70 @param Data This optional parameter may be used to pass additional data. 71 72 @retval EFI_SUCCESS Status code reported to serial I/O successfully. 73 @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called. 74 @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK. 75 76 **/ 77 EFI_STATUS 78 EFIAPI 79 SerialStatusCodeReportWorker ( 80 IN EFI_STATUS_CODE_TYPE CodeType, 81 IN EFI_STATUS_CODE_VALUE Value, 82 IN UINT32 Instance, 83 IN EFI_GUID *CallerId, 84 IN EFI_STATUS_CODE_DATA *Data OPTIONAL 85 ); 86 87 /** 88 Initialize runtime memory status code table as initialization for runtime memory status code worker 89 90 @retval EFI_SUCCESS Runtime memory status code table successfully initialized. 91 @retval others Errors from gBS->InstallConfigurationTable(). 92 93 **/ 94 EFI_STATUS 95 RtMemoryStatusCodeInitializeWorker ( 96 VOID 97 ); 98 99 /** 100 Report status code into runtime memory. If the runtime pool is full, roll back to the 101 first record and overwrite it. 102 103 @param CodeType Indicates the type of status code being reported. 104 @param Value Describes the current status of a hardware or software entity. 105 This included information about the class and subclass that is used to 106 classify the entity as well as an operation. 107 @param Instance The enumeration of a hardware or software entity within 108 the system. Valid instance numbers start with 1. 109 @param CallerId This optional parameter may be used to identify the caller. 110 This parameter allows the status code driver to apply different rules to 111 different callers. 112 @param Data This optional parameter may be used to pass additional data. 113 114 @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table. 115 116 **/ 117 EFI_STATUS 118 EFIAPI 119 RtMemoryStatusCodeReportWorker ( 120 IN EFI_STATUS_CODE_TYPE CodeType, 121 IN EFI_STATUS_CODE_VALUE Value, 122 IN UINT32 Instance, 123 IN EFI_GUID *CallerId, 124 IN EFI_STATUS_CODE_DATA *Data OPTIONAL 125 ); 126 127 #endif 128