]>
Commit | Line | Data |
---|---|---|
0f4db639 SV |
1 | /** @file\r |
2 | Entry point to a Standalone MM driver.\r | |
3 | \r | |
4 | Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r | |
5 | Copyright (c) 2016 - 2018, ARM Ltd. All rights reserved.<BR>\r | |
6 | \r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #include <PiMm.h>\r | |
18 | \r | |
19 | #include <Library/BaseLib.h>\r | |
20 | #include <Library/DebugLib.h>\r | |
21 | \r | |
22 | VOID\r | |
23 | EFIAPI\r | |
24 | ProcessLibraryConstructorList (\r | |
25 | IN EFI_HANDLE ImageHandle,\r | |
26 | IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r | |
27 | );\r | |
28 | \r | |
29 | EFI_STATUS\r | |
30 | EFIAPI\r | |
31 | ProcessModuleEntryPointList (\r | |
32 | IN EFI_HANDLE ImageHandle,\r | |
33 | IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r | |
34 | );\r | |
35 | \r | |
36 | VOID\r | |
37 | EFIAPI\r | |
38 | ProcessLibraryDestructorList (\r | |
39 | IN EFI_HANDLE ImageHandle,\r | |
40 | IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r | |
41 | );\r | |
42 | \r | |
43 | /**\r | |
44 | The entry point of PE/COFF Image for a Standalone MM Driver.\r | |
45 | \r | |
46 | This function is the entry point for a Standalone MM Driver.\r | |
47 | This function must call ProcessLibraryConstructorList() and\r | |
48 | ProcessModuleEntryPointList().\r | |
49 | If the return status from ProcessModuleEntryPointList()\r | |
50 | is an error status, then ProcessLibraryDestructorList() must be called.\r | |
51 | The return value from ProcessModuleEntryPointList() is returned.\r | |
52 | If _gDriverUnloadImageCount is greater than zero, then an unload\r | |
53 | handler must be registered for this image\r | |
54 | and the unload handler must invoke ProcessModuleUnloadList().\r | |
55 | If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is less\r | |
56 | than _gUefiDriverRevison, then return EFI_INCOMPATIBLE_VERSION.\r | |
57 | \r | |
58 | \r | |
59 | @param ImageHandle The image handle of the Standalone MM Driver.\r | |
60 | @param SystemTable A pointer to the EFI System Table.\r | |
61 | \r | |
62 | @retval EFI_SUCCESS The Standalone MM Driver exited normally.\r | |
63 | @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than\r | |
64 | SystemTable->Hdr.Revision.\r | |
65 | @retval Other Return value from ProcessModuleEntryPointList().\r | |
66 | \r | |
67 | **/\r | |
68 | EFI_STATUS\r | |
69 | EFIAPI\r | |
70 | _ModuleEntryPoint (\r | |
71 | IN EFI_HANDLE ImageHandle,\r | |
72 | IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r | |
73 | )\r | |
74 | {\r | |
75 | EFI_STATUS Status;\r | |
76 | \r | |
77 | //\r | |
78 | // Call constructor for all libraries\r | |
79 | //\r | |
80 | ProcessLibraryConstructorList (ImageHandle, MmSystemTable);\r | |
81 | \r | |
82 | //\r | |
83 | // Call the driver entry point\r | |
84 | //\r | |
85 | Status = ProcessModuleEntryPointList (ImageHandle, MmSystemTable);\r | |
86 | \r | |
87 | //\r | |
88 | // If all of the drivers returned errors, then invoke all of the library destructors\r | |
89 | //\r | |
90 | if (EFI_ERROR (Status)) {\r | |
91 | ProcessLibraryDestructorList (ImageHandle, MmSystemTable);\r | |
92 | }\r | |
93 | \r | |
94 | //\r | |
95 | // Return the cumulative return status code from all of the driver entry points\r | |
96 | //\r | |
97 | return Status;\r | |
98 | }\r | |
99 | \r |