//************************************************************************* //************************************************************************* //** ** //** (C)Copyright 1985-2011, American Megatrends, Inc. ** //** ** //** All Rights Reserved. ** //** ** //** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** //** ** //** Phone: (770)-246-8600 ** //** ** //************************************************************************* //************************************************************************* //************************************************************************* // $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Platform/AcpiPlatformSmi.c 1 2/09/12 12:30a Yurenlai $ // // $Revision: 1 $ // // $Date: 2/09/12 12:30a $ //************************************************************************* // Revision History // ---------------- // $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Platform/AcpiPlatformSmi.c $ // // 1 2/09/12 12:30a Yurenlai // Initial check in. // //************************************************************************* // //---------------------------------------------------------------------------- // // Name: AcpiPlatformSmi.c // // Description: This file contains code for all AcpiPlatform SMI events // //---------------------------------------------------------------------------- // //---------------------------------------------------------------------------- // Include(s) //---------------------------------------------------------------------------- #include #include #include #include "SmmChildDispatch.h" // Produced Protocols // Consumed Protocols #include //---------------------------------------------------------------------------- // Constant, Macro and Type Definition(s) //---------------------------------------------------------------------------- // Constant Definition(s) // Macro Definition(s) // Type Definition(s) // Function Prototype(s) //---------------------------------------------------------------------------- // Variable and External Declaration(s) //---------------------------------------------------------------------------- // Variable Declaration(s) // GUID Definition(s) EFI_GUID gEfiSmmBaseProtocolGuid = EFI_SMM_BASE_PROTOCOL_GUID; EFI_GUID gSxDispatchProtocolGuid = EFI_SMM_SX_DISPATCH_PROTOCOL_GUID; // //---------------------------------------------------------------------------- // // Procedure: S3PowerReductionFunction // // Description: Driving GPIO46 Output to low // // Input: None // // Output: None // //---------------------------------------------------------------------------- // VOID S3PowerReductionFunction(VOID) { // UINT32 Buffer32; // Buffer32 = IoRead32(GPIO_BASE_ADDRESS + ICH_GPIO_GP_LVL2); // GPIO Level Select 2 Register // Buffer32 &= 0xFFFFBFFF; // IoWrite32(GPIO_BASE_ADDRESS + ICH_GPIO_GP_LVL2, Buffer32); // Program GPIO level drive to logic high } // //---------------------------------------------------------------------------- // // Procedure: AcpiPlatformSxSmiHandler // // Description: This is a AcpiPlatform Sx SMI Handler for Calpella Platform. // // Input: DispatchHandle - EFI Handle // DispatchContext - Pointer to the EFI_SMM_SX_DISPATCH_CONTEXT // // Output: None // //---------------------------------------------------------------------------- // VOID AcpiPlatformSxSmiHandler( IN EFI_HANDLE DispatchHandle, IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext) { if (DispatchContext->Type == SxS3) S3PowerReductionFunction(); } // //---------------------------------------------------------------------------- // // Procedure: InSmmFunction // // Description: Installs AcpiPlatform SMM Child Dispatcher Handler. // // Parameters: ImageHandle - Image handle // *SystemTable - Pointer to the system table // // Returns: EFI_STATUS // // Modified: // // Referrals: // // Notes: // //---------------------------------------------------------------------------- // EFI_STATUS InSmmFunction ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; EFI_HANDLE Handle; EFI_SMM_BASE_PROTOCOL *SmmBaseProtocol; // Sx SMI EFI_SMM_SX_DISPATCH_PROTOCOL *pSxDispatch; EFI_SMM_SX_DISPATCH_CONTEXT SxS1Context = {SxS1, SxEntry}; EFI_SMM_SX_DISPATCH_CONTEXT SxS3Context = {SxS3, SxEntry}; EFI_SMM_SX_DISPATCH_CONTEXT SxS4Context = {SxS4, SxEntry}; EFI_SMM_SX_DISPATCH_CONTEXT SxS5Context = {SxS5, SxEntry}; Status = pBS->LocateProtocol( &gEfiSmmBaseProtocolGuid, \ NULL, \ &SmmBaseProtocol ); if (EFI_ERROR(Status)) return Status; // Local SMI Procotol Status = pBS->LocateProtocol( &gSxDispatchProtocolGuid, NULL, &pSxDispatch); if (EFI_ERROR(Status)) pSxDispatch = NULL; // Register SMIs if (pSxDispatch != NULL) { Status = pSxDispatch->Register( pSxDispatch, AcpiPlatformSxSmiHandler, &SxS1Context, &Handle); Status = pSxDispatch->Register( pSxDispatch, AcpiPlatformSxSmiHandler, &SxS3Context, &Handle); Status = pSxDispatch->Register( pSxDispatch, AcpiPlatformSxSmiHandler, &SxS4Context, &Handle); Status = pSxDispatch->Register( pSxDispatch, AcpiPlatformSxSmiHandler, &SxS5Context, &Handle); } return EFI_SUCCESS; } // //---------------------------------------------------------------------------- // // Procedure: InitializeAcpiPlatformSMISmm // // Description: Installs AcpiPlatform SMM Child Dispatcher Handler. // // Parameters: ImageHandle - Image handle // *SystemTable - Pointer to the system table // // Returns: EFI_STATUS // //---------------------------------------------------------------------------- // EFI_STATUS InitializeAcpiPlatformSMISmm ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { InitAmiLib(ImageHandle, SystemTable); return InitSmmHandler(ImageHandle, SystemTable, InSmmFunction, NULL); } //************************************************************************* //************************************************************************* //** ** //** (C)Copyright 1985-2011, American Megatrends, Inc. ** //** ** //** All Rights Reserved. ** //** ** //** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** //** ** //** Phone: (770)-246-8600 ** //** ** //************************************************************************* //*************************************************************************