]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkPkg/Include/Protocol/SmmBase.h
1) Add Include/Framework/BootScript.h that contains defines shared between Boot Scrip...
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmBase.h
index be214736f33045a24e00afdb5448b74938af8b7f..aac73d5b87aa0c057a80d6df1d64081a97b8bab6 100644 (file)
@@ -1,22 +1,37 @@
 /** @file\r
   This file declares SMM Base abstraction protocol.\r
-  This is the base level of compatiblity for SMM drivers.\r
-\r
-  Copyright (c) 2007, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-  Module Name:  SmmBase.h\r
+  This protocol is used to install SMM handlers for support of subsequent SMI/PMI activations. This\r
+  protocol is available on both IA-32 and Itanium based systems.\r
\r
+  The EFI_SMM_BASE_PROTOCOL is a set of services that is exported by a processor device. It is\r
+  a required protocol for the platform processor. This protocol can be used in both boot services and\r
+  runtime mode. However, only the following member functions need to exist into runtime:\r
+  - InSmm()\r
+  - Communicate()\r
+  This protocol is responsible for registering the handler services. The order in which the handlers are\r
+  executed is prescribed only with respect to the MakeLast flag in the RegisterCallback()\r
+  service. The driver exports these registration and unregistration services in boot services mode, but\r
+  the registered handlers will execute through the preboot and runtime. The only way to change the\r
+  behavior of a registered driver after ExitBootServices() has been invoked is to use some\r
+  private communication mechanism with the driver to order it to quiesce. This model permits typical\r
+  use cases, such as invoking the handler to enter ACPI mode, where the OS loader would make this\r
+  call before boot services are terminated. On the other hand, handlers for services such as chipset\r
+  workarounds for the century rollover in CMOS should provide commensurate services throughout\r
+  preboot and OS runtime.\r
 \r
   @par Revision Reference:\r
   This Protocol is defined in Framework of EFI SMM Core Interface Spec\r
   Version 0.9.\r
 \r
+Copyright (c) 2007 - 2009, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
 **/\r
 \r
 #ifndef _SMM_BASE_H_\r
@@ -40,19 +55,19 @@ typedef struct _EFI_SMM_BASE_PROTOCOL             EFI_SMM_BASE_PROTOCOL;
 /**\r
   Entry Point to Callback service\r
 \r
-  @param  SmmImageHandle        A handle allocated by the SMM infrastructure code\r
-                                to uniquely designate a specific DXE SMM driver.\r
-  @param  CommunicationBuffer   A pointer to a collection of data in memory\r
-                                that will be conveyed from a non-SMM environment into an SMM environment.\r
-                                The buffer must be contiguous, physically mapped, and be a physical address.\r
-  @param  SourceSize            The size of the CommunicationBuffer.\r
+  @param[in]  SmmImageHandle        A handle allocated by the SMM infrastructure code\r
+                                    to uniquely designate a specific DXE SMM driver.\r
+  @param[in]  CommunicationBuffer   A pointer to a collection of data in memory\r
+                                    that will be conveyed from a non-SMM environment into an SMM environment.\r
+                                    The buffer must be contiguous, physically mapped, and be a physical address.\r
+  @param[in]  SourceSize            The size of the CommunicationBuffer.\r
 \r
-  @return Status code\r
+  @return     Status code\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_CALLBACK_ENTRY_POINT) (\r
+(EFIAPI *EFI_SMM_CALLBACK_ENTRY_POINT)(\r
   IN EFI_HANDLE             SmmImageHandle,\r
   IN OUT VOID               *CommunicationBuffer OPTIONAL,\r
   IN OUT UINTN              *SourceSize OPTIONAL\r
@@ -65,112 +80,109 @@ EFI_STATUS
   Register a given driver into SMRAM.This is the equivalent of performing\r
   the LoadImage/StartImage into System Management Mode.\r
 \r
-  @param  This                  Protocol instance pointer.\r
-  @param  FilePath              Location of the image to be installed as the handler.\r
-  @param  SourceBuffer          Optional source buffer in case of the image file\r
-                                being in memory.\r
-  @param  SourceSize            Size of the source image file, if in memory.\r
-  @param  ImageHandle           Pointer to the handle that reflects the driver\r
-                                loaded into SMM.\r
-  @param  LegacyIA32Binary      The binary image to load is legacy 16 bit code.\r
-\r
-  @retval EFI_SUCCESS           The operation was successful.\r
-  @retval EFI_OUT_OF_RESOURCES  There were no additional SMRAM resources to load the handler\r
-  @retval EFI_UNSUPPORTED       This platform does not support 16-bit handlers.\r
-  @retval EFI_UNSUPPORTED       In runtime.\r
-  @retval EFI_INVALID_PARAMETER The handlers was not the correct image type\r
+  @param[in]   This                  Protocol instance pointer.\r
+  @param[in]   FilePath              Location of the image to be installed as the handler.\r
+  @param[in]   SourceBuffer          Optional source buffer in case of the image file\r
+                                     being in memory.\r
+  @param[in]   SourceSize            Size of the source image file, if in memory.\r
+  @param[out]  ImageHandle           The handle that the base driver uses to decode \r
+                                     the handler. Unique among SMM handlers only, \r
+                                     not unique across DXE/EFI.\r
+  @param[in]   LegacyIA32Binary      An optional parameter that details that the associated \r
+                                     file is a real-mode IA-32 binary.\r
+\r
+  @retval      EFI_SUCCESS           The operation was successful.\r
+  @retval      EFI_OUT_OF_RESOURCES  There were no additional SMRAM resources to load the handler\r
+  @retval      EFI_UNSUPPORTED       This platform does not support 16-bit handlers.\r
+  @retval      EFI_UNSUPPORTED       In runtime.\r
+  @retval      EFI_INVALID_PARAMETER The handlers was not the correct image type\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_REGISTER_HANDLER) (\r
+(EFIAPI *EFI_SMM_REGISTER_HANDLER)(\r
   IN EFI_SMM_BASE_PROTOCOL                           *This,\r
   IN  EFI_DEVICE_PATH_PROTOCOL                       *FilePath,\r
   IN  VOID                                           *SourceBuffer OPTIONAL,\r
   IN  UINTN                                          SourceSize,\r
   OUT EFI_HANDLE                                     *ImageHandle,\r
   IN  BOOLEAN                                        LegacyIA32Binary OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
-  Remove a given driver SMRAM.  This is the equivalent of performing\r
-  the UnloadImage System Management Mode.\r
+  Removes a handler from execution within SMRAM.  This is the equivalent of performing\r
+  the UnloadImage in System Management Mode.\r
 \r
-  @param  This                  Protocol instance pointer.\r
-  @param  ImageHandle           Pointer to the handle that reflects the driver\r
-                                loaded into SMM.\r
+  @param[in]  This                  Protocol instance pointer.\r
+  @param[in]  ImageHandle           The handler to be removed.\r
 \r
-  @retval EFI_SUCCESS           The operation was successful\r
-  @retval EFI_INVALID_PARAMETER The handler did not exist\r
-  @retval EFI_UNSUPPORTED       In runtime.\r
+  @retval     EFI_SUCCESS           The operation was successful\r
+  @retval     EFI_INVALID_PARAMETER The handler did not exist\r
+  @retval     EFI_UNSUPPORTED       In runtime.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_UNREGISTER_HANDLER) (\r
+(EFIAPI *EFI_SMM_UNREGISTER_HANDLER)(\r
   IN EFI_SMM_BASE_PROTOCOL          *This,\r
   IN EFI_HANDLE                     ImageHandle\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   The SMM Inter-module Communicate Service Communicate() function\r
   provides a services to send/received messages from a registered\r
   EFI service.  The BASE protocol driver is responsible for doing\r
-  any of the copies such that the data lives in boot-service accessible RAM.\r
+  any of the copies such that the data lives in boot-service-accessible RAM.\r
 \r
-  @param  This                  Protocol instance pointer.\r
-  @param  ImageHandle           Pointer to the handle that reflects the driver\r
-                                loaded into SMM.\r
-  @param  CommunicationBuffer   Pointer to the buffer to convey into SMRAM.\r
-  @param  SourceSize            Size of the contents of buffer..\r
+  @param[in]      This                  Protocol instance pointer.\r
+  @param[in]      ImageHandle           The handle of the registered driver.\r
+  @param[in,out]  CommunicationBuffer   Pointer to the buffer to convey into SMRAM.\r
+  @param[in,out]  SourceSize            The size of the data buffer being passed in.\r
+                                        On exit, the size of data being returned.\r
+                                        Zero if the handler does not wish to reply with any data.\r
 \r
-  @retval EFI_SUCCESS           The message was successfully posted\r
-  @retval EFI_INVALID_PARAMETER The buffer was NULL\r
+  @retval         EFI_SUCCESS           The message was successfully posted\r
+  @retval         EFI_INVALID_PARAMETER The buffer was NULL\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_COMMUNICATE) (\r
+(EFIAPI *EFI_SMM_COMMUNICATE)(\r
   IN EFI_SMM_BASE_PROTOCOL          *This,\r
   IN EFI_HANDLE                     ImageHandle,\r
   IN OUT VOID                       *CommunicationBuffer,\r
   IN OUT UINTN                      *SourceSize\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Register a callback to execute within SMM.\r
-  This allows receipt of messages created with the Boot Service COMMUNICATE.\r
-\r
-  @param  This                  Protocol instance pointer.\r
-  @param  CallbackAddress       Address of the callback service\r
-  @param  MakeFirst             If present, will stipulate that the handler is posted\r
-                                to be the first module executed in the dispatch table.\r
-  @param  MakeLast              If present, will stipulate that the handler is posted\r
-                                to be last executed in the dispatch table.\r
-  @param  FloatingPointSave     This is an optional parameter which informs the\r
-                                EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save\r
-                                the floating point register state. If any of the handlers\r
-                                require this, then the state will be saved for all of the handlers.\r
-\r
-  @retval EFI_SUCCESS           The operation was successful\r
-  @retval EFI_OUT_OF_RESOURCES  Not enough space in the dispatch queue\r
-  @retval EFI_UNSUPPORTED       In runtime.\r
-  @retval EFI_UNSUPPORTED       Not in SMM.\r
+  This allows receipt of messages created with EFI_SMM_BASE_PROTOCOL.Communicate().\r
+\r
+  @param[in]  This                  Protocol instance pointer.\r
+  @param[in]  SmmImageHandle        Handle of the callback service.\r
+  @param[in]  CallbackAddress       Address of the callback service.\r
+  @param[in]  MakeLast              If present, will stipulate that the handler is posted to \r
+                                    be executed last in the dispatch table.\r
+  @param[in]  FloatingPointSave     This is an optional parameter which informs the\r
+                                    EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save\r
+                                    the floating point register state. If any of the handlers\r
+                                    require this, then the state will be saved for all of the handlers.\r
+\r
+  @retval     EFI_SUCCESS           The operation was successful\r
+  @retval     EFI_OUT_OF_RESOURCES  Not enough space in the dispatch queue\r
+  @retval     EFI_UNSUPPORTED       In runtime.\r
+  @retval     EFI_UNSUPPORTED       The caller is not in SMM.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_CALLBACK_SERVICE) (\r
+(EFIAPI *EFI_SMM_CALLBACK_SERVICE)(\r
   IN EFI_SMM_BASE_PROTOCOL                            *This,\r
   IN EFI_HANDLE                                       SmmImageHandle,\r
   IN EFI_SMM_CALLBACK_ENTRY_POINT                     CallbackAddress,\r
   IN BOOLEAN                                          MakeLast OPTIONAL,\r
   IN BOOLEAN                                          FloatingPointSave OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   The SmmAllocatePool() function allocates a memory region of Size bytes from memory of\r
@@ -178,67 +190,68 @@ EFI_STATUS
   by Buffer.  This function allocates pages from EFI SMRAM Memory as needed to grow the\r
   requested pool type.  All allocations are eight-byte aligned.\r
 \r
-  @param  This                  Protocol instance pointer.\r
-  @param  PoolType              The type of pool to allocate.\r
-                                The only supported type is EfiRuntimeServicesData;\r
-                                the interface will internally map this runtime request to SMRAM.\r
-  @param  Size                  The number of bytes to allocate from the pool.\r
-  @param  Buffer                A pointer to a pointer to the allocated buffer if the call\r
-                                succeeds; undefined otherwise.\r
+  @param[in]   This                  Protocol instance pointer.\r
+  @param[in]   PoolType              The type of pool to allocate.\r
+                                     The only supported type is EfiRuntimeServicesData;\r
+                                     the interface will internally map this runtime request to \r
+                                     SMRAM for IA-32 and leave as this type for the Itanium \r
+                                     processor family. Other types can be ignored.\r
+  @param[in]   Size                  The number of bytes to allocate from the pool.\r
+  @param[out]  Buffer                A pointer to a pointer to the allocated buffer if the call\r
+                                     succeeds; undefined otherwise.\r
 \r
-  @retval EFI_SUCCESS           The requested number of bytes was allocated.\r
-  @retval EFI_OUT_OF_RESOURCES  The pool requested could not be allocated.\r
-  @retval EFI_INVALID_PARAMETER PoolType was invalid.\r
-  @retval EFI_UNSUPPORTED       In runtime.\r
+  @retval      EFI_SUCCESS           The requested number of bytes was allocated.\r
+  @retval      EFI_OUT_OF_RESOURCES  The pool requested could not be allocated.\r
+  @retval      EFI_UNSUPPORTED       In runtime.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_ALLOCATE_POOL) (\r
+(EFIAPI *EFI_SMM_ALLOCATE_POOL)(\r
   IN EFI_SMM_BASE_PROTOCOL          *This,\r
   IN EFI_MEMORY_TYPE                PoolType,\r
   IN UINTN                          Size,\r
   OUT VOID                          **Buffer\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   The SmmFreePool() function returns the memory specified by Buffer to the system.\r
   On return, the memory's type is EFI SMRAM Memory.  The Buffer that is freed must\r
   have been allocated by SmmAllocatePool().\r
 \r
-  @param  This                  Protocol instance pointer.\r
-  @param  Buffer                Pointer to the buffer allocation.\r
+  @param[in]  This                  Protocol instance pointer.\r
+  @param[in]  Buffer                Pointer to the buffer allocation.\r
 \r
-  @retval EFI_SUCCESS           The memory was returned to the system.\r
-  @retval EFI_INVALID_PARAMETER Buffer was invalid.\r
-  @retval EFI_UNSUPPORTED       In runtime.\r
+  @retval     EFI_SUCCESS           The memory was returned to the system.\r
+  @retval     EFI_INVALID_PARAMETER Buffer was invalid.\r
+  @retval     EFI_UNSUPPORTED       In runtime.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_FREE_POOL) (\r
+(EFIAPI *EFI_SMM_FREE_POOL)(\r
   IN EFI_SMM_BASE_PROTOCOL          *This,\r
   IN VOID                           *Buffer\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   This routine tells caller if execution context is SMM or not.\r
 \r
-  @param  This                  Protocol instance pointer.\r
-  @param  InSmm                 Whether the caller is inside SMM for IA-32 or servicing a PMI for the Itanium processor family.\r
+  @param[in]   This                   Protocol instance pointer.\r
+  @param[out]  InSmm                  Whether the caller is inside SMM for IA-32\r
+                                      or servicing a PMI for the Itanium processor\r
+                                      family.\r
 \r
-  @retval EFI_SUCCESS           The operation was successful\r
+  @retval      EFI_SUCCESS            The operation was successful\r
+  @retval      EFI_INVALID_PARAMETER  InSmm was NULL.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_INSIDE_OUT) (\r
+(EFIAPI *EFI_SMM_INSIDE_OUT)(\r
   IN EFI_SMM_BASE_PROTOCOL          *This,\r
   OUT BOOLEAN                       *InSmm\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   The GetSmstLocation() function returns the locatin of the System Management\r
@@ -246,52 +259,25 @@ EFI_STATUS
   location of the SMST in its entry point and then cache it in some driver\r
   global variable so that the SMST can be invoked in subsequent callbacks.\r
 \r
-  @param  This                  Protocol instance pointer.\r
-  @param  Smst                  Pointer to the SMST.\r
+  @param[in]  This                  Protocol instance pointer.\r
+  @param[in]  Smst                  Pointer to the SMST.\r
 \r
-  @retval EFI_SUCCESS           The operation was successful\r
-  @retval EFI_INVALID_PARAMETER Smst was invalid.\r
-  @retval EFI_UNSUPPORTED       Not in SMM.\r
+  @retval     EFI_SUCCESS           The operation was successful\r
+  @retval     EFI_INVALID_PARAMETER Smst was invalid.\r
+  @retval     EFI_UNSUPPORTED       Not in SMM.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_SMM_GET_SMST_LOCATION) (\r
+(EFIAPI *EFI_SMM_GET_SMST_LOCATION)(\r
   IN EFI_SMM_BASE_PROTOCOL          *This,\r
   IN OUT EFI_SMM_SYSTEM_TABLE       **Smst\r
-  )\r
-;\r
-\r
-/**\r
-  @par Protocol Description:\r
-  This protocol is used to install SMM handlers for support of subsequent SMI/PMI\r
-  activations. This protocol is available on both IA-32 and Itanium-based systems.\r
-\r
-  @param Register\r
-  Registers a handler to run in System Management RAM (SMRAM).\r
-\r
-  @param UnRegister\r
-  Removes a handler from execution in SMRAM.\r
-\r
-  @param Communicate\r
-  Sends/receives a message for a registered handler.\r
-\r
-  @param RegisterCallback\r
-  Registers a callback from the constructor.\r
-\r
-  @param InSmm\r
-  Detects whether the caller is inside or outside of SMM. SName\r
-\r
-  @param SmmAllocatePool\r
-  Allocates SMRAM.\r
-\r
-  @param SmmFreePool\r
-  Deallocates SMRAM.\r
-\r
-  @param GetSmstLocation\r
-  Retrieves the location of the System Management System Table (SMST).\r
+  );\r
 \r
-**/\r
+///\r
+/// This protocol is used to install SMM handlers for support of subsequent SMI/PMI\r
+/// activations. This protocol is available on both IA-32 and Itanium-based systems.\r
+///\r
 struct _EFI_SMM_BASE_PROTOCOL {\r
   EFI_SMM_REGISTER_HANDLER    Register;\r
   EFI_SMM_UNREGISTER_HANDLER  UnRegister;\r