Home | History | Annotate | Download | only in Protocol
      1 /** @file
      2   Provides the parent dispatch service for a given SMI source generator.
      3 
      4 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
      5 This program and the accompanying materials are licensed and made available under
      6 the terms and conditions of the BSD License that accompanies this distribution.
      7 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   @par Revision Reference:
     14   This Protocol is defined in Framework for EFI SMM Core Interface Spec
     15   Version 0.9.
     16 
     17 **/
     18 
     19 #ifndef _EFI_SMM_SW_DISPATCH_H_
     20 #define _EFI_SMM_SW_DISPATCH_H_
     21 
     22 
     23 //
     24 // Global ID for the SW SMI Protocol
     25 //
     26 #define EFI_SMM_SW_DISPATCH_PROTOCOL_GUID \
     27   { \
     28     0xe541b773, 0xdd11, 0x420c, {0xb0, 0x26, 0xdf, 0x99, 0x36, 0x53, 0xf8, 0xbf } \
     29   }
     30 
     31 typedef struct _EFI_SMM_SW_DISPATCH_PROTOCOL  EFI_SMM_SW_DISPATCH_PROTOCOL;
     32 
     33 //
     34 // Related Definitions
     35 //
     36 //
     37 // A particular chipset may not support all possible software SMI input values.
     38 // For example, the ICH supports only values 00h to 0FFh.  The parent only allows a single
     39 // child registration for each SwSmiInputValue.
     40 //
     41 typedef struct {
     42   UINTN SwSmiInputValue;
     43 } EFI_SMM_SW_DISPATCH_CONTEXT;
     44 
     45 //
     46 // Member functions
     47 //
     48 /**
     49   Dispatch function for a Software SMI handler.
     50 
     51   @param  DispatchHandle        The handle of this dispatch function.
     52   @param  DispatchContext       The pointer to the dispatch function's context.
     53                                 The SwSmiInputValue field is filled in
     54                                 by the software dispatch driver prior to
     55                                 invoking this dispatch function.
     56                                 The dispatch function will only be called
     57                                 for input values for which it is registered.
     58 
     59   @return None
     60 
     61 **/
     62 typedef
     63 VOID
     64 (EFIAPI *EFI_SMM_SW_DISPATCH)(
     65   IN  EFI_HANDLE                    DispatchHandle,
     66   IN  EFI_SMM_SW_DISPATCH_CONTEXT   *DispatchContext
     67   );
     68 
     69 /**
     70   Register a child SMI source dispatch function with a parent SMM driver.
     71 
     72   @param  This                  The pointer to the EFI_SMM_SW_DISPATCH_PROTOCOL instance.
     73   @param  DispatchFunction      The function to install.
     74   @param  DispatchContext       The pointer to the dispatch function's context.
     75                                 Indicates to the register
     76                                 function the Software SMI input value for which
     77                                 to invoke the dispatch function.
     78   @param  DispatchHandle        The handle generated by the dispatcher to track
     79                                 the function instance.
     80 
     81   @retval EFI_SUCCESS           The dispatch function has been successfully
     82                                 registered and the SMI source has been enabled.
     83   @retval EFI_DEVICE_ERROR      The SW driver could not enable the SMI source.
     84   @retval EFI_OUT_OF_RESOURCES  Not enough memory (system or SMM) to manage this
     85                                 child.
     86   @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The SW SMI input value
     87                                 is not within valid range.
     88 
     89 **/
     90 typedef
     91 EFI_STATUS
     92 (EFIAPI *EFI_SMM_SW_REGISTER)(
     93   IN EFI_SMM_SW_DISPATCH_PROTOCOL          *This,
     94   IN EFI_SMM_SW_DISPATCH                   DispatchFunction,
     95   IN EFI_SMM_SW_DISPATCH_CONTEXT           *DispatchContext,
     96   OUT EFI_HANDLE                           *DispatchHandle
     97   );
     98 
     99 /**
    100   Unregister a child SMI source dispatch function with a parent SMM driver
    101 
    102   @param  This                  The pointer to the EFI_SMM_SW_DISPATCH_PROTOCOL instance.
    103   @param  DispatchHandle        The handle of the service to remove.
    104 
    105   @retval EFI_SUCCESS           The dispatch function has been successfully
    106                                 unregistered and the SMI source has been disabled
    107                                 if there are no other registered child dispatch
    108                                 functions for this SMI source.
    109   @retval EFI_INVALID_PARAMETER The handle is invalid.
    110 
    111 **/
    112 typedef
    113 EFI_STATUS
    114 (EFIAPI *EFI_SMM_SW_UNREGISTER)(
    115   IN EFI_SMM_SW_DISPATCH_PROTOCOL          *This,
    116   IN EFI_HANDLE                            DispatchHandle
    117   );
    118 
    119 
    120 //
    121 // Interface structure for the SMM Software SMI Dispatch Protocol
    122 //
    123 /**
    124   Provides the parent dispatch service for a given SMI source generator.
    125 **/
    126 ///
    127 /// Inconsistent with the specification here:
    128 /// In The Framework specification SmmCis, this definition is named as
    129 /// _EFI_SMM_ICHN_DISPATCH_PROTOCOL by mistake.
    130 ///
    131 struct _EFI_SMM_SW_DISPATCH_PROTOCOL {
    132   ///
    133   /// Installs a child service to be dispatched by this protocol.
    134   ///
    135   EFI_SMM_SW_REGISTER   Register;
    136 
    137   ///
    138   /// Removes a child service dispatched by this protocol.
    139   ///
    140   EFI_SMM_SW_UNREGISTER UnRegister;
    141 
    142   ///
    143   /// A read-only field that describes the maximum value that can be used
    144   /// in the EFI_SMM_SW_DISPATCH_PROTOCOL.Register() service.
    145   ///
    146   UINTN                 MaximumSwiValue;
    147 };
    148 
    149 extern EFI_GUID gEfiSmmSwDispatchProtocolGuid;
    150 
    151 #endif
    152