Home | History | Annotate | Download | only in Protocol
      1 /** @file
      2   This protocol provide registering and unregistering services to status code
      3   consumers while in DXE.
      4 
      5   Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<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 __REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
     17 #define __REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
     18 
     19 #define EFI_RSC_HANDLER_PROTOCOL_GUID \
     20   { \
     21     0x86212936, 0xe76, 0x41c8, {0xa0, 0x3a, 0x2a, 0xf2, 0xfc, 0x1c, 0x39, 0xe2} \
     22   }
     23 
     24 typedef
     25 EFI_STATUS
     26 (EFIAPI *EFI_RSC_HANDLER_CALLBACK)(
     27   IN EFI_STATUS_CODE_TYPE   CodeType,
     28   IN EFI_STATUS_CODE_VALUE  Value,
     29   IN UINT32                 Instance,
     30   IN EFI_GUID               *CallerId,
     31   IN EFI_STATUS_CODE_DATA   *Data
     32 );
     33 
     34 /**
     35   Register the callback function for ReportStatusCode() notification.
     36 
     37   When this function is called the function pointer is added to an internal list and any future calls to
     38   ReportStatusCode() will be forwarded to the Callback function. During the bootservices,
     39   this is the callback for which this service can be invoked. The report status code router
     40   will create an event such that the callback function is only invoked at the TPL for which it was
     41   registered. The entity that registers for the callback should also register for an event upon
     42   generation of exit boot services and invoke the unregister service.
     43   If the handler does not have a TPL dependency, it should register for a callback at TPL high. The
     44   router infrastructure will support making callbacks at runtime, but the caller for runtime invocation
     45   must meet the following criteria:
     46   1. must be a runtime driver type so that its memory is not reclaimed
     47   2. not unregister at exit boot services so that the router will still have its callback address
     48   3. the caller must be self-contained (eg. Not call out into any boot-service interfaces) and be
     49   runtime safe, in general.
     50 
     51   @param[in] Callback   A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is called when
     52                         a call to ReportStatusCode() occurs.
     53   @param[in] Tpl        TPL at which callback can be safely invoked.
     54 
     55   @retval  EFI_SUCCESS              Function was successfully registered.
     56   @retval  EFI_INVALID_PARAMETER    The callback function was NULL.
     57   @retval  EFI_OUT_OF_RESOURCES     The internal buffer ran out of space. No more functions can be
     58                                     registered.
     59   @retval  EFI_ALREADY_STARTED      The function was already registered. It can't be registered again.
     60 **/
     61 typedef
     62 EFI_STATUS
     63 (EFIAPI *EFI_RSC_HANDLER_REGISTER)(
     64   IN EFI_RSC_HANDLER_CALLBACK   Callback,
     65   IN EFI_TPL                    Tpl
     66 );
     67 
     68 /**
     69   Remove a previously registered callback function from the notification list.
     70 
     71   A callback function must be unregistered before it is deallocated. It is important that any registered
     72   callbacks that are not runtime complaint be unregistered when ExitBootServices() is called.
     73 
     74   @param[in]  Callback  A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is to be
     75                         unregistered.
     76 
     77   @retval EFI_SUCCESS           The function was successfully unregistered.
     78   @retval EFI_INVALID_PARAMETER The callback function was NULL.
     79   @retval EFI_NOT_FOUND         The callback function was not found to be unregistered.
     80 **/
     81 typedef
     82 EFI_STATUS
     83 (EFIAPI *EFI_RSC_HANDLER_UNREGISTER)(
     84   IN EFI_RSC_HANDLER_CALLBACK Callback
     85 );
     86 
     87 typedef struct {
     88   EFI_RSC_HANDLER_REGISTER Register;
     89   EFI_RSC_HANDLER_UNREGISTER Unregister;
     90 } EFI_RSC_HANDLER_PROTOCOL;
     91 
     92 extern EFI_GUID gEfiRscHandlerProtocolGuid;
     93 
     94 #endif // __REPORT_STATUS_CODE_HANDLER_H__
     95