]>
Commit | Line | Data |
---|---|---|
43e543bc EL |
1 | /** @file\r |
2 | This file implements the entrypoint and unload function for I2C DXE module.\r | |
3 | \r | |
4 | Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include "I2cDxe.h"\r | |
16 | \r | |
17 | /**\r | |
18 | The user Entry Point for I2C module. The user code starts with this function.\r | |
19 | \r | |
20 | @param[in] ImageHandle The firmware allocated handle for the EFI image.\r | |
21 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
22 | \r | |
23 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
24 | @retval other Some error occurs when executing this entry point.\r | |
25 | \r | |
26 | **/\r | |
27 | EFI_STATUS\r | |
28 | EFIAPI\r | |
29 | InitializeI2c(\r | |
30 | IN EFI_HANDLE ImageHandle,\r | |
31 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
32 | )\r | |
33 | {\r | |
34 | EFI_STATUS Status;\r | |
35 | \r | |
36 | //\r | |
37 | // Install driver model protocol(s).\r | |
38 | //\r | |
39 | Status = InitializeI2cHost ( ImageHandle, SystemTable );\r | |
40 | if ( !EFI_ERROR ( Status ))\r | |
41 | {\r | |
42 | Status = InitializeI2cBus ( ImageHandle, SystemTable );\r | |
43 | }\r | |
44 | return Status;\r | |
45 | }\r | |
46 | \r | |
47 | /**\r | |
48 | This is the unload handle for I2C module.\r | |
49 | \r | |
50 | Disconnect the driver specified by ImageHandle from all the devices in the handle database.\r | |
51 | Uninstall all the protocols installed in the driver entry point.\r | |
52 | \r | |
53 | @param[in] ImageHandle The drivers' driver image.\r | |
54 | \r | |
55 | @retval EFI_SUCCESS The image is unloaded.\r | |
56 | @retval Others Failed to unload the image.\r | |
57 | \r | |
58 | **/\r | |
59 | EFI_STATUS\r | |
60 | EFIAPI\r | |
61 | I2cUnload (\r | |
62 | IN EFI_HANDLE ImageHandle\r | |
63 | )\r | |
64 | {\r | |
65 | EFI_STATUS Status;\r | |
66 | \r | |
67 | //\r | |
68 | // Disconnect the drivers\r | |
69 | //\r | |
70 | Status = I2cBusUnload ( ImageHandle );\r | |
71 | if ( !EFI_ERROR ( Status )) {\r | |
72 | Status = I2cHostUnload ( ImageHandle );\r | |
73 | }\r | |
74 | return Status;\r | |
75 | }\r |