143e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li/** @file 243e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li This file implements the entrypoint and unload function for I2C DXE module. 343e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 443e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> 543e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li This program and the accompanying materials 643e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li are licensed and made available under the terms and conditions of the BSD License 743e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li which accompanies this distribution. The full text of the license may be found at 843e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li http://opensource.org/licenses/bsd-license.php 943e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 1043e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 1143e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 1243e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 1343e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li**/ 1443e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 1543e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li#include "I2cDxe.h" 1643e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 1743e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li/** 1843e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li The user Entry Point for I2C module. The user code starts with this function. 1943e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 2043e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li @param[in] ImageHandle The firmware allocated handle for the EFI image. 2143e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li @param[in] SystemTable A pointer to the EFI System Table. 2243e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 2343e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li @retval EFI_SUCCESS The entry point is executed successfully. 2443e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li @retval other Some error occurs when executing this entry point. 2543e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 2643e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li**/ 2743e543bcaa235955a93547a3e06cefcaf9ee605cElvin LiEFI_STATUS 2843e543bcaa235955a93547a3e06cefcaf9ee605cElvin LiEFIAPI 2943e543bcaa235955a93547a3e06cefcaf9ee605cElvin LiInitializeI2c( 3043e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li IN EFI_HANDLE ImageHandle, 3143e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li IN EFI_SYSTEM_TABLE *SystemTable 3243e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li ) 3343e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li{ 3443e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li EFI_STATUS Status; 3543e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 3643e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li // 3743e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li // Install driver model protocol(s). 3843e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li // 3943e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li Status = InitializeI2cHost ( ImageHandle, SystemTable ); 4043e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li if ( !EFI_ERROR ( Status )) 4143e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li { 4243e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li Status = InitializeI2cBus ( ImageHandle, SystemTable ); 4343e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li } 4443e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li return Status; 4543e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li} 4643e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 4743e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li/** 4843e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li This is the unload handle for I2C module. 4943e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 5043e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li Disconnect the driver specified by ImageHandle from all the devices in the handle database. 5143e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li Uninstall all the protocols installed in the driver entry point. 5243e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 5343e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li @param[in] ImageHandle The drivers' driver image. 5443e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 5543e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li @retval EFI_SUCCESS The image is unloaded. 5643e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li @retval Others Failed to unload the image. 5743e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 5843e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li**/ 5943e543bcaa235955a93547a3e06cefcaf9ee605cElvin LiEFI_STATUS 6043e543bcaa235955a93547a3e06cefcaf9ee605cElvin LiEFIAPI 6143e543bcaa235955a93547a3e06cefcaf9ee605cElvin LiI2cUnload ( 6243e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li IN EFI_HANDLE ImageHandle 6343e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li ) 6443e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li{ 6543e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li EFI_STATUS Status; 6643e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li 6743e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li // 6843e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li // Disconnect the drivers 6943e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li // 7043e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li Status = I2cBusUnload ( ImageHandle ); 7143e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li if ( !EFI_ERROR ( Status )) { 7243e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li Status = I2cHostUnload ( ImageHandle ); 7343e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li } 7443e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li return Status; 7543e543bcaa235955a93547a3e06cefcaf9ee605cElvin Li} 76