]> git.proxmox.com Git - mirror_edk2.git/blame - StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c
StandaloneMmPkg: Add CPU driver suitable for ARM Platforms.
[mirror_edk2.git] / StandaloneMmPkg / Library / StandaloneMmDriverEntryPoint / StandaloneMmDriverEntryPoint.c
CommitLineData
0f4db639
SV
1/** @file\r
2 Entry point to a Standalone MM driver.\r
3\r
4Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
5Copyright (c) 2016 - 2018, ARM Ltd. All rights reserved.<BR>\r
6\r
7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT 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
22VOID\r
23EFIAPI\r
24ProcessLibraryConstructorList (\r
25 IN EFI_HANDLE ImageHandle,\r
26 IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r
27 );\r
28\r
29EFI_STATUS\r
30EFIAPI\r
31ProcessModuleEntryPointList (\r
32 IN EFI_HANDLE ImageHandle,\r
33 IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r
34 );\r
35\r
36VOID\r
37EFIAPI\r
38ProcessLibraryDestructorList (\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
68EFI_STATUS\r
69EFIAPI\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