]>
Commit | Line | Data |
---|---|---|
e386b444 | 1 | /** @file\r |
2 | Entry point library instance to a UEFI application.\r | |
3 | \r | |
4 | Copyright (c) 2007, Intel Corporation<BR>\r | |
5 | All rights reserved. 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 | //\r | |
c7d265a9 | 16 | // The package level header files this module uses\r |
e386b444 | 17 | //\r |
c7d265a9 | 18 | #include <Uefi.h>\r |
19 | //\r | |
20 | // The protocols, PPI and GUID defintions for this module\r | |
21 | //\r | |
22 | //\r | |
23 | // The Library classes this module consumes\r | |
24 | //\r | |
25 | #include <Library/UefiApplicationEntryPoint.h>\r | |
26 | #include <Library/UefiBootServicesTableLib.h>\r | |
e386b444 | 27 | \r |
28 | /**\r | |
29 | Enrty point to UEFI application.\r | |
30 | \r | |
31 | @param ImageHandle ImageHandle of the loaded driver.\r | |
32 | @param SystemTable Pointer to the EFI System Table.\r | |
33 | \r | |
34 | @retval EFI_SUCCESS One or more of the drivers returned a success code.\r | |
35 | @retval !EFI_SUCESS The return status from the last driver entry point in the list.\r | |
36 | \r | |
37 | **/\r | |
38 | EFI_STATUS\r | |
39 | EFIAPI\r | |
40 | _ModuleEntryPoint (\r | |
41 | IN EFI_HANDLE ImageHandle,\r | |
42 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
43 | )\r | |
44 | {\r | |
45 | EFI_STATUS Status;\r | |
46 | \r | |
47 | if (_gUefiDriverRevision != 0) {\r | |
48 | //\r | |
49 | // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the application.\r | |
50 | //\r | |
51 | if (SystemTable->Hdr.Revision < _gUefiDriverRevision) {\r | |
52 | return EFI_INCOMPATIBLE_VERSION;\r | |
53 | }\r | |
54 | }\r | |
55 | \r | |
56 | //\r | |
57 | // Call constructor for all libraries.\r | |
58 | //\r | |
59 | ProcessLibraryConstructorList (ImageHandle, SystemTable);\r | |
60 | \r | |
61 | //\r | |
62 | // Call the module's entry point\r | |
63 | //\r | |
64 | Status = ProcessModuleEntryPointList (ImageHandle, SystemTable);\r | |
65 | \r | |
66 | //\r | |
67 | // Process destructor for all libraries.\r | |
68 | //\r | |
69 | ProcessLibraryDestructorList (ImageHandle, SystemTable);\r | |
70 | \r | |
71 | //\r | |
72 | // Return the return status code from the driver entry point\r | |
73 | //\r | |
74 | return Status;\r | |
75 | }\r | |
76 | \r | |
77 | /**\r | |
78 | Invoke the destuctors of all libraries and call gBS->Exit\r | |
79 | to return control to firmware core.\r | |
80 | \r | |
81 | @param Status Status returned by the application that is exiting.\r | |
82 | \r | |
83 | @retval VOID\r | |
84 | \r | |
85 | **/\r | |
86 | VOID\r | |
87 | EFIAPI\r | |
88 | Exit (\r | |
89 | IN EFI_STATUS Status\r | |
90 | )\r | |
91 | \r | |
92 | {\r | |
93 | ProcessLibraryDestructorList (gImageHandle, gST);\r | |
94 | \r | |
95 | gBS->Exit (gImageHandle, Status, 0, NULL);\r | |
96 | }\r | |
97 | \r | |
98 | /**\r | |
99 | Enrty point wrapper of UEFI Application.\r | |
100 | \r | |
101 | @param ImageHandle ImageHandle of the loaded driver.\r | |
102 | @param SystemTable Pointer to the EFI System Table.\r | |
103 | \r | |
104 | @retval EFI_SUCCESS One or more of the drivers returned a success code.\r | |
105 | @retval !EFI_SUCESS The return status from the last driver entry point in the list.\r | |
106 | \r | |
107 | **/\r | |
108 | EFI_STATUS\r | |
109 | EFIAPI\r | |
110 | EfiMain (\r | |
111 | IN EFI_HANDLE ImageHandle,\r | |
112 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
113 | )\r | |
114 | {\r | |
115 | return _ModuleEntryPoint (ImageHandle, SystemTable);\r | |
116 | }\r |