Home | History | Annotate | Download | only in Pei
      1 /** @file
      2   Internal include file for Status Code Handler PEIM.
      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_PEI_H__
     16 #define __STATUS_CODE_HANDLER_PEI_H__
     17 
     18 
     19 #include <Ppi/ReportStatusCodeHandler.h>
     20 
     21 #include <Guid/MemoryStatusCodeRecord.h>
     22 #include <Guid/StatusCodeDataTypeId.h>
     23 #include <Guid/StatusCodeDataTypeDebug.h>
     24 
     25 #include <Library/DebugLib.h>
     26 #include <Library/PrintLib.h>
     27 #include <Library/ReportStatusCodeLib.h>
     28 #include <Library/SerialPortLib.h>
     29 #include <Library/HobLib.h>
     30 #include <Library/PcdLib.h>
     31 #include <Library/PeiServicesLib.h>
     32 #include <Library/PeimEntryPoint.h>
     33 #include <Library/BaseMemoryLib.h>
     34 
     35 //
     36 // Define the maximum message length
     37 //
     38 #define MAX_DEBUG_MESSAGE_LENGTH 0x100
     39 
     40 /**
     41   Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
     42 
     43   @param  PeiServices      An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
     44   @param  CodeType         Indicates the type of status code being reported.
     45   @param  Value            Describes the current status of a hardware or
     46                            software entity. This includes information about the class and
     47                            subclass that is used to classify the entity as well as an operation.
     48                            For progress codes, the operation is the current activity.
     49                            For error codes, it is the exception.For debug codes,it is not defined at this time.
     50   @param  Instance         The enumeration of a hardware or software entity within
     51                            the system. A system may contain multiple entities that match a class/subclass
     52                            pairing. The instance differentiates between them. An instance of 0 indicates
     53                            that instance information is unavailable, not meaningful, or not relevant.
     54                            Valid instance numbers start with 1.
     55   @param  CallerId         This optional parameter may be used to identify the caller.
     56                            This parameter allows the status code driver to apply different rules to
     57                            different callers.
     58   @param  Data             This optional parameter may be used to pass additional data.
     59 
     60   @retval EFI_SUCCESS      Status code reported to serial I/O successfully.
     61 
     62 **/
     63 EFI_STATUS
     64 EFIAPI
     65 SerialStatusCodeReportWorker (
     66   IN CONST  EFI_PEI_SERVICES        **PeiServices,
     67   IN EFI_STATUS_CODE_TYPE           CodeType,
     68   IN EFI_STATUS_CODE_VALUE          Value,
     69   IN UINT32                         Instance,
     70   IN CONST EFI_GUID                 *CallerId,
     71   IN CONST EFI_STATUS_CODE_DATA     *Data OPTIONAL
     72   );
     73 
     74 
     75 /**
     76   Create the first memory status code GUID'ed HOB as initialization for memory status code worker.
     77 
     78   @retval EFI_SUCCESS  The GUID'ed HOB is created successfully.
     79 
     80 **/
     81 EFI_STATUS
     82 MemoryStatusCodeInitializeWorker (
     83   VOID
     84   );
     85 
     86 /**
     87   Report status code into GUID'ed HOB.
     88 
     89   This function reports status code into GUID'ed HOB. If not all packets are full, then
     90   write status code into available entry. Otherwise, create a new packet for it.
     91 
     92   @param  PeiServices      An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
     93   @param  CodeType         Indicates the type of status code being reported.
     94   @param  Value            Describes the current status of a hardware or
     95                            software entity. This includes information about the class and
     96                            subclass that is used to classify the entity as well as an operation.
     97                            For progress codes, the operation is the current activity.
     98                            For error codes, it is the exception.For debug codes,it is not defined at this time.
     99   @param  Instance         The enumeration of a hardware or software entity within
    100                            the system. A system may contain multiple entities that match a class/subclass
    101                            pairing. The instance differentiates between them. An instance of 0 indicates
    102                            that instance information is unavailable, not meaningful, or not relevant.
    103                            Valid instance numbers start with 1.
    104   @param  CallerId         This optional parameter may be used to identify the caller.
    105                            This parameter allows the status code driver to apply different rules to
    106                            different callers.
    107   @param  Data             This optional parameter may be used to pass additional data.
    108 
    109   @retval EFI_SUCCESS      The function always return EFI_SUCCESS.
    110 
    111 **/
    112 EFI_STATUS
    113 EFIAPI
    114 MemoryStatusCodeReportWorker (
    115   IN CONST  EFI_PEI_SERVICES    **PeiServices,
    116   IN EFI_STATUS_CODE_TYPE       CodeType,
    117   IN EFI_STATUS_CODE_VALUE      Value,
    118   IN UINT32                     Instance,
    119   IN CONST EFI_GUID             *CallerId,
    120   IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
    121   );
    122 
    123 #endif
    124 
    125 
    126