179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/** @file
279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  This file declares SMM Base abstraction protocol.
38411f1c002faf9a16c28a643a1c8a32de904a7d7klu  This protocol is used to install SMM handlers for support of subsequent SMI/PMI activations. This
45259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel  protocol is available on both IA-32 and Itanium-based systems.
58411f1c002faf9a16c28a643a1c8a32de904a7d7klu
68411f1c002faf9a16c28a643a1c8a32de904a7d7klu  The EFI_SMM_BASE_PROTOCOL is a set of services that is exported by a processor device. It is
78411f1c002faf9a16c28a643a1c8a32de904a7d7klu  a required protocol for the platform processor. This protocol can be used in both boot services and
85259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel  runtime mode. However, only the following member functions need to exist during runtime:
98411f1c002faf9a16c28a643a1c8a32de904a7d7klu  - InSmm()
108411f1c002faf9a16c28a643a1c8a32de904a7d7klu  - Communicate()
118411f1c002faf9a16c28a643a1c8a32de904a7d7klu  This protocol is responsible for registering the handler services. The order in which the handlers are
128411f1c002faf9a16c28a643a1c8a32de904a7d7klu  executed is prescribed only with respect to the MakeLast flag in the RegisterCallback()
138411f1c002faf9a16c28a643a1c8a32de904a7d7klu  service. The driver exports these registration and unregistration services in boot services mode, but
148411f1c002faf9a16c28a643a1c8a32de904a7d7klu  the registered handlers will execute through the preboot and runtime. The only way to change the
158411f1c002faf9a16c28a643a1c8a32de904a7d7klu  behavior of a registered driver after ExitBootServices() has been invoked is to use some
168411f1c002faf9a16c28a643a1c8a32de904a7d7klu  private communication mechanism with the driver to order it to quiesce. This model permits typical
178411f1c002faf9a16c28a643a1c8a32de904a7d7klu  use cases, such as invoking the handler to enter ACPI mode, where the OS loader would make this
188411f1c002faf9a16c28a643a1c8a32de904a7d7klu  call before boot services are terminated. On the other hand, handlers for services such as chipset
198411f1c002faf9a16c28a643a1c8a32de904a7d7klu  workarounds for the century rollover in CMOS should provide commensurate services throughout
208411f1c002faf9a16c28a643a1c8a32de904a7d7klu  preboot and OS runtime.
2179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
222b3687dbb512ccd3cfbb75fa8966c3c93b3c067dhhtianCopyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
23f22f941ed273753a0426d1234869857f19c28664myronporterThis program and the accompanying materials are licensed and made available under
24f22f941ed273753a0426d1234869857f19c28664myronporterthe terms and conditions of the BSD License that accompanies this distribution.
25f22f941ed273753a0426d1234869857f19c28664myronporterThe full text of the license may be found at
26f22f941ed273753a0426d1234869857f19c28664myronporterhttp://opensource.org/licenses/bsd-license.php.
27f22f941ed273753a0426d1234869857f19c28664myronporter
28f22f941ed273753a0426d1234869857f19c28664myronporterTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
29f22f941ed273753a0426d1234869857f19c28664myronporterWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
30f759064285b16bf55a0b823917038f4ded818c81eric_tian
3179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  @par Revision Reference:
3279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  This Protocol is defined in Framework of EFI SMM Core Interface Spec
3379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  Version 0.9.
3479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
3579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
3679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
3779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing#ifndef _SMM_BASE_H_
3879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing#define _SMM_BASE_H_
3979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
40a77e0eb17aecf3c4504e526063771eb8b4cc0968rsun//
41a77e0eb17aecf3c4504e526063771eb8b4cc0968rsun// Share some common definitions with PI SMM
42a77e0eb17aecf3c4504e526063771eb8b4cc0968rsun//
43a77e0eb17aecf3c4504e526063771eb8b4cc0968rsun#include <Framework/SmmCis.h>
44a77e0eb17aecf3c4504e526063771eb8b4cc0968rsun#include <Protocol/SmmCommunication.h>
45a77e0eb17aecf3c4504e526063771eb8b4cc0968rsun
46d5555a107c528b0a0da12e907e685b469a79d891mdkinney///
47f22f941ed273753a0426d1234869857f19c28664myronporter/// Global ID for the EFI_SMM_BASE_PROTOCOL.
48d5555a107c528b0a0da12e907e685b469a79d891mdkinney///
4979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing#define EFI_SMM_BASE_PROTOCOL_GUID \
5079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  { \
5179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing    0x1390954D, 0xda95, 0x4227, {0x93, 0x28, 0x72, 0x82, 0xc2, 0x17, 0xda, 0xa8 } \
5279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  }
5379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
54d5555a107c528b0a0da12e907e685b469a79d891mdkinney///
55f22f941ed273753a0426d1234869857f19c28664myronporter/// Forward declaration for EFI_SMM_BASE_PROTOCOL.
56d5555a107c528b0a0da12e907e685b469a79d891mdkinney///
57d5555a107c528b0a0da12e907e685b469a79d891mdkinneytypedef struct _EFI_SMM_BASE_PROTOCOL  EFI_SMM_BASE_PROTOCOL;
5879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
59d5555a107c528b0a0da12e907e685b469a79d891mdkinney///
60d5555a107c528b0a0da12e907e685b469a79d891mdkinney/// EFI SMM Handler return codes
61d5555a107c528b0a0da12e907e685b469a79d891mdkinney///
62d5555a107c528b0a0da12e907e685b469a79d891mdkinney///@{
6379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing#define EFI_HANDLER_SUCCESS         0x0000
6479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing#define EFI_HANDLER_CRITICAL_EXIT   0x0001
6579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing#define EFI_HANDLER_SOURCE_QUIESCED 0x0002
6679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing#define EFI_HANDLER_SOURCE_PENDING  0x0003
67d5555a107c528b0a0da12e907e685b469a79d891mdkinney///@}
68d5555a107c528b0a0da12e907e685b469a79d891mdkinney
6979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
7079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  Entry Point to Callback service
7179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
72ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]  SmmImageHandle        A handle allocated by the SMM infrastructure code
73ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                    to uniquely designate a specific DXE SMM driver.
74ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]  CommunicationBuffer   A pointer to a collection of data in memory
75f22f941ed273753a0426d1234869857f19c28664myronporter                                    that will be conveyed from a non-SMM environment
76f22f941ed273753a0426d1234869857f19c28664myronporter                                    into an SMM environment. The buffer must be
77f22f941ed273753a0426d1234869857f19c28664myronporter                                    contiguous and physically mapped, and must be
78f22f941ed273753a0426d1234869857f19c28664myronporter                                    a physical address.
79ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]  SourceSize            The size of the CommunicationBuffer.
8079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
81ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @return     Status code
8279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
8379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
8479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
8579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
8669686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_CALLBACK_ENTRY_POINT)(
8779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_HANDLE             SmmImageHandle,
8879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN OUT VOID               *CommunicationBuffer OPTIONAL,
8979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN OUT UINTN              *SourceSize OPTIONAL
9079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  );
9179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
9279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing//
9379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing// SMM Base Protocol Definition
9479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing//
9579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
965259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel  Register a given driver into SMRAM. This is the equivalent of performing
9779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  the LoadImage/StartImage into System Management Mode.
9879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
99f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]   This                  The protocol instance pointer.
100f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]   FilePath              The location of the image to be installed as the handler.
101f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]   SourceBuffer          An optional source buffer in case the image file
1025259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel                                     is in memory.
103f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]   SourceSize            The size of the source image file, if in memory.
104ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[out]  ImageHandle           The handle that the base driver uses to decode
105f22f941ed273753a0426d1234869857f19c28664myronporter                                     the handler. Unique among SMM handlers only;
106ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                     not unique across DXE/EFI.
1075259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel  @param[in]   LegacyIA32Binary      An optional parameter specifying that the associated
108ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                     file is a real-mode IA-32 binary.
109ac9868ecb859e877a665d1cead72d49dba0db674jljusten
110ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval      EFI_SUCCESS           The operation was successful.
111ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval      EFI_OUT_OF_RESOURCES  There were no additional SMRAM resources to load the handler
112ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval      EFI_UNSUPPORTED       This platform does not support 16-bit handlers.
113f22f941ed273753a0426d1234869857f19c28664myronporter  @retval      EFI_UNSUPPORTED       The platform is in runtime.
114f22f941ed273753a0426d1234869857f19c28664myronporter  @retval      EFI_INVALID_PARAMETER The handlers were not the correct image type.
11579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
11679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
11779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
11879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
11969686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_REGISTER_HANDLER)(
120a77e0eb17aecf3c4504e526063771eb8b4cc0968rsun  IN  EFI_SMM_BASE_PROTOCOL                          *This,
12179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN  EFI_DEVICE_PATH_PROTOCOL                       *FilePath,
12279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN  VOID                                           *SourceBuffer OPTIONAL,
12379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN  UINTN                                          SourceSize,
12479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  OUT EFI_HANDLE                                     *ImageHandle,
12579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN  BOOLEAN                                        LegacyIA32Binary OPTIONAL
126ed66e1bc0d2be0a185fc47adab4930c3b7e2767fvanjeff  );
12779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
12879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
129700a786952c4573a6dd7c7b0c74ea772969f777atding  Removes a handler from execution within SMRAM.  This is the equivalent of performing
130700a786952c4573a6dd7c7b0c74ea772969f777atding  the UnloadImage in System Management Mode.
13179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
132f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]  This                  The protocol instance pointer.
133ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]  ImageHandle           The handler to be removed.
13479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
135f22f941ed273753a0426d1234869857f19c28664myronporter  @retval     EFI_SUCCESS           The operation was successful.
136f22f941ed273753a0426d1234869857f19c28664myronporter  @retval     EFI_INVALID_PARAMETER The handler did not exist.
137f22f941ed273753a0426d1234869857f19c28664myronporter  @retval     EFI_UNSUPPORTED       The platform is in runtime.
13879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
13979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
14079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
14179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
14269686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_UNREGISTER_HANDLER)(
14379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_SMM_BASE_PROTOCOL          *This,
14479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_HANDLE                     ImageHandle
145ed66e1bc0d2be0a185fc47adab4930c3b7e2767fvanjeff  );
14679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
14779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
14879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  The SMM Inter-module Communicate Service Communicate() function
1495259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel  provides a service to send/receive messages from a registered
15079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI service.  The BASE protocol driver is responsible for doing
151700a786952c4573a6dd7c7b0c74ea772969f777atding  any of the copies such that the data lives in boot-service-accessible RAM.
15279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
153f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]      This                  The protocol instance pointer.
154ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]      ImageHandle           The handle of the registered driver.
155f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in,out]  CommunicationBuffer   The pointer to the buffer to convey into SMRAM.
156ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in,out]  SourceSize            The size of the data buffer being passed in.
157ebcfa88032c9591ed319e5a838d003ca821512f5xli                                        On exit, the size of data being returned.
158ebcfa88032c9591ed319e5a838d003ca821512f5xli                                        Zero if the handler does not wish to reply with any data.
15979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
160f22f941ed273753a0426d1234869857f19c28664myronporter  @retval         EFI_SUCCESS           The message was successfully posted.
161f22f941ed273753a0426d1234869857f19c28664myronporter  @retval         EFI_INVALID_PARAMETER The buffer was NULL.
16279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
16379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
16479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
16579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
16669686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_COMMUNICATE)(
16779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_SMM_BASE_PROTOCOL          *This,
16879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_HANDLE                     ImageHandle,
16979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN OUT VOID                       *CommunicationBuffer,
17079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN OUT UINTN                      *SourceSize
171ed66e1bc0d2be0a185fc47adab4930c3b7e2767fvanjeff  );
17279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
17379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
17479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  Register a callback to execute within SMM.
175700a786952c4573a6dd7c7b0c74ea772969f777atding  This allows receipt of messages created with EFI_SMM_BASE_PROTOCOL.Communicate().
17679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
177ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]  This                  Protocol instance pointer.
178ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]  SmmImageHandle        Handle of the callback service.
179ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]  CallbackAddress       Address of the callback service.
180ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]  MakeLast              If present, will stipulate that the handler is posted to
181ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                    be executed last in the dispatch table.
1825259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel  @param[in]  FloatingPointSave     An optional parameter that informs the
183ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                    EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save
1845259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel                                    the floating point register state. If any handler
1855259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel                                    require this, the state will be saved for all handlers.
186ac9868ecb859e877a665d1cead72d49dba0db674jljusten
187f22f941ed273753a0426d1234869857f19c28664myronporter  @retval     EFI_SUCCESS           The operation was successful.
188f22f941ed273753a0426d1234869857f19c28664myronporter  @retval     EFI_OUT_OF_RESOURCES  Not enough space in the dispatch queue.
189f22f941ed273753a0426d1234869857f19c28664myronporter  @retval     EFI_UNSUPPORTED       The platform is in runtime.
190ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval     EFI_UNSUPPORTED       The caller is not in SMM.
19179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
19279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
19379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
19479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
19569686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_CALLBACK_SERVICE)(
19679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_SMM_BASE_PROTOCOL                            *This,
19779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_HANDLE                                       SmmImageHandle,
19879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_SMM_CALLBACK_ENTRY_POINT                     CallbackAddress,
19979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN BOOLEAN                                          MakeLast OPTIONAL,
20079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN BOOLEAN                                          FloatingPointSave OPTIONAL
201ed66e1bc0d2be0a185fc47adab4930c3b7e2767fvanjeff  );
20279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
20379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
20479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  The SmmAllocatePool() function allocates a memory region of Size bytes from memory of
20579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  type PoolType and returns the address of the allocated memory in the location referenced
20679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  by Buffer.  This function allocates pages from EFI SMRAM Memory as needed to grow the
20779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  requested pool type.  All allocations are eight-byte aligned.
20879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
209ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]   This                  Protocol instance pointer.
210ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]   PoolType              The type of pool to allocate.
211ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                     The only supported type is EfiRuntimeServicesData;
212ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                     the interface will internally map this runtime request to
213ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                     SMRAM for IA-32 and leave as this type for the Itanium
214ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                     processor family. Other types can be ignored.
215ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[in]   Size                  The number of bytes to allocate from the pool.
216ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[out]  Buffer                A pointer to a pointer to the allocated buffer if the call
217ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                     succeeds; undefined otherwise.
218ac9868ecb859e877a665d1cead72d49dba0db674jljusten
219ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval      EFI_SUCCESS           The requested number of bytes was allocated.
220ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval      EFI_OUT_OF_RESOURCES  The pool requested could not be allocated.
221f22f941ed273753a0426d1234869857f19c28664myronporter  @retval      EFI_UNSUPPORTED       The platform is in runtime.
22279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
22379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
22479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
22579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
22669686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_ALLOCATE_POOL)(
22779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_SMM_BASE_PROTOCOL          *This,
22879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_MEMORY_TYPE                PoolType,
22979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN UINTN                          Size,
23079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  OUT VOID                          **Buffer
231ed66e1bc0d2be0a185fc47adab4930c3b7e2767fvanjeff  );
23279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
23379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
23479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  The SmmFreePool() function returns the memory specified by Buffer to the system.
23579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  On return, the memory's type is EFI SMRAM Memory.  The Buffer that is freed must
23679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  have been allocated by SmmAllocatePool().
23779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
238f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]  This                  The protocol instance pointer.
239f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]  Buffer                The pointer to the buffer allocation.
24079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
241ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval     EFI_SUCCESS           The memory was returned to the system.
242f22f941ed273753a0426d1234869857f19c28664myronporter  @retval     EFI_INVALID_PARAMETER The buffer was invalid.
243f22f941ed273753a0426d1234869857f19c28664myronporter  @retval     EFI_UNSUPPORTED       The platform is in runtime.
24479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
24579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
24679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
24779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
24869686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_FREE_POOL)(
24979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_SMM_BASE_PROTOCOL          *This,
25079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN VOID                           *Buffer
251ed66e1bc0d2be0a185fc47adab4930c3b7e2767fvanjeff  );
25279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
25379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
25479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  This routine tells caller if execution context is SMM or not.
25579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
256f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]   This                   The protocol instance pointer.
257ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @param[out]  InSmm                  Whether the caller is inside SMM for IA-32
258ac9868ecb859e877a665d1cead72d49dba0db674jljusten                                      or servicing a PMI for the Itanium processor
259ebcfa88032c9591ed319e5a838d003ca821512f5xli                                      family.
26079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
261f22f941ed273753a0426d1234869857f19c28664myronporter  @retval      EFI_SUCCESS            The operation was successful.
262ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval      EFI_INVALID_PARAMETER  InSmm was NULL.
26379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
26479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
26579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
26679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
26769686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_INSIDE_OUT)(
26879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_SMM_BASE_PROTOCOL          *This,
26979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  OUT BOOLEAN                       *InSmm
270ed66e1bc0d2be0a185fc47adab4930c3b7e2767fvanjeff  );
27179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
27279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing/**
2735259c97d7ac7f464c134c3a15186b30e8e8eadffpkandel  The GetSmstLocation() function returns the location of the System Management
27479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  Service Table.  The use of the API is such that a driver can discover the
27579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  location of the SMST in its entry point and then cache it in some driver
27679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  global variable so that the SMST can be invoked in subsequent callbacks.
27779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
278f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]  This                  The protocol instance pointer.
279f22f941ed273753a0426d1234869857f19c28664myronporter  @param[in]  Smst                  The pointer to the SMST.
28079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
281ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval     EFI_SUCCESS           The operation was successful
282ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval     EFI_INVALID_PARAMETER Smst was invalid.
283ac9868ecb859e877a665d1cead72d49dba0db674jljusten  @retval     EFI_UNSUPPORTED       Not in SMM.
28479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
28579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing**/
28679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingtypedef
28779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingEFI_STATUS
28869686d5669e0bc621ded618becf1529ce93ff1fdklu(EFIAPI *EFI_SMM_GET_SMST_LOCATION)(
28979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN EFI_SMM_BASE_PROTOCOL          *This,
29079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  IN OUT EFI_SMM_SYSTEM_TABLE       **Smst
291ed66e1bc0d2be0a185fc47adab4930c3b7e2767fvanjeff  );
29279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
293ebcfa88032c9591ed319e5a838d003ca821512f5xli///
294ebcfa88032c9591ed319e5a838d003ca821512f5xli/// This protocol is used to install SMM handlers for support of subsequent SMI/PMI
295ebcfa88032c9591ed319e5a838d003ca821512f5xli/// activations. This protocol is available on both IA-32 and Itanium-based systems.
296ebcfa88032c9591ed319e5a838d003ca821512f5xli///
29779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingstruct _EFI_SMM_BASE_PROTOCOL {
29879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI_SMM_REGISTER_HANDLER    Register;
29979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI_SMM_UNREGISTER_HANDLER  UnRegister;
30079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI_SMM_COMMUNICATE         Communicate;
30179964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI_SMM_CALLBACK_SERVICE    RegisterCallback;
30279964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI_SMM_INSIDE_OUT          InSmm;
30379964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI_SMM_ALLOCATE_POOL       SmmAllocatePool;
30479964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI_SMM_FREE_POOL           SmmFreePool;
30579964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing  EFI_SMM_GET_SMST_LOCATION   GetSmstLocation;
30679964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing};
30779964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
30879964ac84ea0ca6c68d0dea38245fa83ff1945d1bxingextern EFI_GUID gEfiSmmBaseProtocolGuid;
30979964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing
31079964ac84ea0ca6c68d0dea38245fa83ff1945d1bxing#endif
311