]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/I2c/I2cDxe/I2cDxe.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / I2c / I2cDxe / I2cDxe.c
1 /** @file
2 This file implements the entrypoint and unload function for I2C DXE module.
3
4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "I2cDxe.h"
10
11 /**
12 The user Entry Point for I2C module. The user code starts with this function.
13
14 @param[in] ImageHandle The firmware allocated handle for the EFI image.
15 @param[in] SystemTable A pointer to the EFI System Table.
16
17 @retval EFI_SUCCESS The entry point is executed successfully.
18 @retval other Some error occurs when executing this entry point.
19
20 **/
21 EFI_STATUS
22 EFIAPI
23 InitializeI2c(
24 IN EFI_HANDLE ImageHandle,
25 IN EFI_SYSTEM_TABLE *SystemTable
26 )
27 {
28 EFI_STATUS Status;
29
30 //
31 // Install driver model protocol(s).
32 //
33 Status = InitializeI2cHost ( ImageHandle, SystemTable );
34 if ( !EFI_ERROR ( Status ))
35 {
36 Status = InitializeI2cBus ( ImageHandle, SystemTable );
37 }
38 return Status;
39 }
40
41 /**
42 This is the unload handle for I2C module.
43
44 Disconnect the driver specified by ImageHandle from all the devices in the handle database.
45 Uninstall all the protocols installed in the driver entry point.
46
47 @param[in] ImageHandle The drivers' driver image.
48
49 @retval EFI_SUCCESS The image is unloaded.
50 @retval Others Failed to unload the image.
51
52 **/
53 EFI_STATUS
54 EFIAPI
55 I2cUnload (
56 IN EFI_HANDLE ImageHandle
57 )
58 {
59 EFI_STATUS Status;
60
61 //
62 // Disconnect the drivers
63 //
64 Status = I2cBusUnload ( ImageHandle );
65 if ( !EFI_ERROR ( Status )) {
66 Status = I2cHostUnload ( ImageHandle );
67 }
68 return Status;
69 }