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