176ab2dc37d8bdd7bfc441083dded3f154187c04arsun/** @file 276ab2dc37d8bdd7bfc441083dded3f154187c04arsun SMM Sx Dispatch Protocol as defined in PI 1.2 Specification 376ab2dc37d8bdd7bfc441083dded3f154187c04arsun Volume 4 System Management Mode Core Interface. 476ab2dc37d8bdd7bfc441083dded3f154187c04arsun 576ab2dc37d8bdd7bfc441083dded3f154187c04arsun Provides the parent dispatch service for a given Sx-state source generator. 676ab2dc37d8bdd7bfc441083dded3f154187c04arsun 79df063a06aef048c042498e2f542fb693e93493ahhtian Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 89df063a06aef048c042498e2f542fb693e93493ahhtian This program and the accompanying materials 976ab2dc37d8bdd7bfc441083dded3f154187c04arsun are licensed and made available under the terms and conditions of the BSD License 1076ab2dc37d8bdd7bfc441083dded3f154187c04arsun which accompanies this distribution. The full text of the license may be found at 1176ab2dc37d8bdd7bfc441083dded3f154187c04arsun http://opensource.org/licenses/bsd-license.php 1276ab2dc37d8bdd7bfc441083dded3f154187c04arsun 1376ab2dc37d8bdd7bfc441083dded3f154187c04arsun THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 1476ab2dc37d8bdd7bfc441083dded3f154187c04arsun WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 1576ab2dc37d8bdd7bfc441083dded3f154187c04arsun 1676ab2dc37d8bdd7bfc441083dded3f154187c04arsun**/ 1776ab2dc37d8bdd7bfc441083dded3f154187c04arsun 1876ab2dc37d8bdd7bfc441083dded3f154187c04arsun#ifndef _SMM_SX_DISPATCH2_H_ 1976ab2dc37d8bdd7bfc441083dded3f154187c04arsun#define _SMM_SX_DISPATCH2_H_ 2076ab2dc37d8bdd7bfc441083dded3f154187c04arsun 2176ab2dc37d8bdd7bfc441083dded3f154187c04arsun#include <Pi/PiSmmCis.h> 2276ab2dc37d8bdd7bfc441083dded3f154187c04arsun 2376ab2dc37d8bdd7bfc441083dded3f154187c04arsun#define EFI_SMM_SX_DISPATCH2_PROTOCOL_GUID \ 2476ab2dc37d8bdd7bfc441083dded3f154187c04arsun { \ 2576ab2dc37d8bdd7bfc441083dded3f154187c04arsun 0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d } \ 2676ab2dc37d8bdd7bfc441083dded3f154187c04arsun } 2776ab2dc37d8bdd7bfc441083dded3f154187c04arsun 2876ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 2976ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// Sleep states S0-S5 3076ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 3176ab2dc37d8bdd7bfc441083dded3f154187c04arsuntypedef enum { 3276ab2dc37d8bdd7bfc441083dded3f154187c04arsun SxS0, 3376ab2dc37d8bdd7bfc441083dded3f154187c04arsun SxS1, 3476ab2dc37d8bdd7bfc441083dded3f154187c04arsun SxS2, 3576ab2dc37d8bdd7bfc441083dded3f154187c04arsun SxS3, 3676ab2dc37d8bdd7bfc441083dded3f154187c04arsun SxS4, 3776ab2dc37d8bdd7bfc441083dded3f154187c04arsun SxS5, 3876ab2dc37d8bdd7bfc441083dded3f154187c04arsun EfiMaximumSleepType 3976ab2dc37d8bdd7bfc441083dded3f154187c04arsun} EFI_SLEEP_TYPE; 4076ab2dc37d8bdd7bfc441083dded3f154187c04arsun 4176ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 4276ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// Sleep state phase: entry or exit 4376ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 4476ab2dc37d8bdd7bfc441083dded3f154187c04arsuntypedef enum { 4576ab2dc37d8bdd7bfc441083dded3f154187c04arsun SxEntry, 4676ab2dc37d8bdd7bfc441083dded3f154187c04arsun SxExit, 4776ab2dc37d8bdd7bfc441083dded3f154187c04arsun EfiMaximumPhase 4876ab2dc37d8bdd7bfc441083dded3f154187c04arsun} EFI_SLEEP_PHASE; 4976ab2dc37d8bdd7bfc441083dded3f154187c04arsun 5076ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 5176ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// The dispatch function's context 5276ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 5376ab2dc37d8bdd7bfc441083dded3f154187c04arsuntypedef struct { 5476ab2dc37d8bdd7bfc441083dded3f154187c04arsun EFI_SLEEP_TYPE Type; 5576ab2dc37d8bdd7bfc441083dded3f154187c04arsun EFI_SLEEP_PHASE Phase; 5676ab2dc37d8bdd7bfc441083dded3f154187c04arsun} EFI_SMM_SX_REGISTER_CONTEXT; 5776ab2dc37d8bdd7bfc441083dded3f154187c04arsun 5876ab2dc37d8bdd7bfc441083dded3f154187c04arsuntypedef struct _EFI_SMM_SX_DISPATCH2_PROTOCOL EFI_SMM_SX_DISPATCH2_PROTOCOL; 5976ab2dc37d8bdd7bfc441083dded3f154187c04arsun 6076ab2dc37d8bdd7bfc441083dded3f154187c04arsun/** 6176ab2dc37d8bdd7bfc441083dded3f154187c04arsun Provides the parent dispatch service for a given Sx source generator. 6276ab2dc37d8bdd7bfc441083dded3f154187c04arsun 6376ab2dc37d8bdd7bfc441083dded3f154187c04arsun This service registers a function (DispatchFunction) which will be called when the sleep state 6476ab2dc37d8bdd7bfc441083dded3f154187c04arsun event specified by RegisterContext is detected. On return, DispatchHandle contains a 6576ab2dc37d8bdd7bfc441083dded3f154187c04arsun unique handle which may be used later to unregister the function using UnRegister(). 6676ab2dc37d8bdd7bfc441083dded3f154187c04arsun The DispatchFunction will be called with Context set to the same value as was passed into 6776ab2dc37d8bdd7bfc441083dded3f154187c04arsun this function in RegisterContext and with CommBuffer and CommBufferSize set to 6876ab2dc37d8bdd7bfc441083dded3f154187c04arsun NULL and 0 respectively. 6976ab2dc37d8bdd7bfc441083dded3f154187c04arsun 7076ab2dc37d8bdd7bfc441083dded3f154187c04arsun @param[in] This Pointer to the EFI_SMM_SX_DISPATCH2_PROTOCOL instance. 7176ab2dc37d8bdd7bfc441083dded3f154187c04arsun @param[in] DispatchFunction Function to register for handler when the specified sleep state event occurs. 7276ab2dc37d8bdd7bfc441083dded3f154187c04arsun @param[in] RegisterContext Pointer to the dispatch function's context. 7376ab2dc37d8bdd7bfc441083dded3f154187c04arsun The caller fills this context in before calling 7476ab2dc37d8bdd7bfc441083dded3f154187c04arsun the register function to indicate to the register 7576ab2dc37d8bdd7bfc441083dded3f154187c04arsun function which Sx state type and phase the caller 7676ab2dc37d8bdd7bfc441083dded3f154187c04arsun wishes to be called back on. For this intertace, 7776ab2dc37d8bdd7bfc441083dded3f154187c04arsun the Sx driver will call the registered handlers for 7876ab2dc37d8bdd7bfc441083dded3f154187c04arsun all Sx type and phases, so the Sx state handler(s) 7976ab2dc37d8bdd7bfc441083dded3f154187c04arsun must check the Type and Phase field of the Dispatch 8076ab2dc37d8bdd7bfc441083dded3f154187c04arsun context and act accordingly. 8176ab2dc37d8bdd7bfc441083dded3f154187c04arsun @param[out] DispatchHandle Handle of dispatch function, for when interfacing 8276ab2dc37d8bdd7bfc441083dded3f154187c04arsun with the parent Sx state SMM driver. 8376ab2dc37d8bdd7bfc441083dded3f154187c04arsun 8476ab2dc37d8bdd7bfc441083dded3f154187c04arsun @retval EFI_SUCCESS The dispatch function has been successfully 8576ab2dc37d8bdd7bfc441083dded3f154187c04arsun registered and the SMI source has been enabled. 8676ab2dc37d8bdd7bfc441083dded3f154187c04arsun @retval EFI_UNSUPPORTED The Sx driver or hardware does not support that 8776ab2dc37d8bdd7bfc441083dded3f154187c04arsun Sx Type/Phase. 8876ab2dc37d8bdd7bfc441083dded3f154187c04arsun @retval EFI_DEVICE_ERROR The Sx driver was unable to enable the SMI source. 8976ab2dc37d8bdd7bfc441083dded3f154187c04arsun @retval EFI_INVALID_PARAMETER RegisterContext is invalid. Type & Phase are not 9076ab2dc37d8bdd7bfc441083dded3f154187c04arsun within valid range. 9176ab2dc37d8bdd7bfc441083dded3f154187c04arsun @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this 9276ab2dc37d8bdd7bfc441083dded3f154187c04arsun child. 9376ab2dc37d8bdd7bfc441083dded3f154187c04arsun**/ 9476ab2dc37d8bdd7bfc441083dded3f154187c04arsuntypedef 9576ab2dc37d8bdd7bfc441083dded3f154187c04arsunEFI_STATUS 96a2bb197e806240386b5bbb8e77a7d4f2208d14cersun(EFIAPI *EFI_SMM_SX_REGISTER2)( 9776ab2dc37d8bdd7bfc441083dded3f154187c04arsun IN CONST EFI_SMM_SX_DISPATCH2_PROTOCOL *This, 9876ab2dc37d8bdd7bfc441083dded3f154187c04arsun IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction, 9976ab2dc37d8bdd7bfc441083dded3f154187c04arsun IN CONST EFI_SMM_SX_REGISTER_CONTEXT *RegisterContext, 10076ab2dc37d8bdd7bfc441083dded3f154187c04arsun OUT EFI_HANDLE *DispatchHandle 10176ab2dc37d8bdd7bfc441083dded3f154187c04arsun ); 10276ab2dc37d8bdd7bfc441083dded3f154187c04arsun 10376ab2dc37d8bdd7bfc441083dded3f154187c04arsun/** 10476ab2dc37d8bdd7bfc441083dded3f154187c04arsun Unregisters an Sx-state service. 10576ab2dc37d8bdd7bfc441083dded3f154187c04arsun 10676ab2dc37d8bdd7bfc441083dded3f154187c04arsun This service removes the handler associated with DispatchHandle so that it will no longer be 10776ab2dc37d8bdd7bfc441083dded3f154187c04arsun called in response to sleep event. 10876ab2dc37d8bdd7bfc441083dded3f154187c04arsun 10976ab2dc37d8bdd7bfc441083dded3f154187c04arsun @param[in] This Pointer to the EFI_SMM_SX_DISPATCH2_PROTOCOL instance. 11076ab2dc37d8bdd7bfc441083dded3f154187c04arsun @param[in] DispatchHandle Handle of the service to remove. 11176ab2dc37d8bdd7bfc441083dded3f154187c04arsun 11276ab2dc37d8bdd7bfc441083dded3f154187c04arsun @retval EFI_SUCCESS The service has been successfully removed. 11376ab2dc37d8bdd7bfc441083dded3f154187c04arsun @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid. 11476ab2dc37d8bdd7bfc441083dded3f154187c04arsun**/ 11576ab2dc37d8bdd7bfc441083dded3f154187c04arsuntypedef 11676ab2dc37d8bdd7bfc441083dded3f154187c04arsunEFI_STATUS 117a2bb197e806240386b5bbb8e77a7d4f2208d14cersun(EFIAPI *EFI_SMM_SX_UNREGISTER2)( 11876ab2dc37d8bdd7bfc441083dded3f154187c04arsun IN CONST EFI_SMM_SX_DISPATCH2_PROTOCOL *This, 11976ab2dc37d8bdd7bfc441083dded3f154187c04arsun IN EFI_HANDLE DispatchHandle 12076ab2dc37d8bdd7bfc441083dded3f154187c04arsun ); 12176ab2dc37d8bdd7bfc441083dded3f154187c04arsun 12276ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 12376ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// Interface structure for the SMM Sx Dispatch Protocol 12476ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 12576ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// The EFI_SMM_SX_DISPATCH2_PROTOCOL provides the ability to install child handlers to 12676ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// respond to sleep state related events. 12776ab2dc37d8bdd7bfc441083dded3f154187c04arsun/// 12876ab2dc37d8bdd7bfc441083dded3f154187c04arsunstruct _EFI_SMM_SX_DISPATCH2_PROTOCOL { 129a2bb197e806240386b5bbb8e77a7d4f2208d14cersun EFI_SMM_SX_REGISTER2 Register; 130a2bb197e806240386b5bbb8e77a7d4f2208d14cersun EFI_SMM_SX_UNREGISTER2 UnRegister; 13176ab2dc37d8bdd7bfc441083dded3f154187c04arsun}; 13276ab2dc37d8bdd7bfc441083dded3f154187c04arsun 13376ab2dc37d8bdd7bfc441083dded3f154187c04arsunextern EFI_GUID gEfiSmmSxDispatch2ProtocolGuid; 13476ab2dc37d8bdd7bfc441083dded3f154187c04arsun 13576ab2dc37d8bdd7bfc441083dded3f154187c04arsun#endif 136