]>
Commit | Line | Data |
---|---|---|
5866d499 AB |
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 | Copyright (c) 2018, Linaro, Limited. All rights reserved.<BR>\r | |
7 | \r | |
9344f092 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
5866d499 AB |
9 | \r |
10 | **/\r | |
11 | \r | |
12 | #include <PiMm.h>\r | |
13 | \r | |
14 | #include <Library/BaseLib.h>\r | |
15 | #include <Library/DebugLib.h>\r | |
16 | #include <Library/MmServicesTableLib.h>\r | |
17 | #include <Library/StandaloneMmDriverEntryPoint.h>\r | |
18 | \r | |
19 | /**\r | |
20 | The entry point of PE/COFF Image for a Standalone MM Driver.\r | |
21 | \r | |
22 | This function is the entry point for a Standalone MM Driver.\r | |
23 | This function must call ProcessLibraryConstructorList() and\r | |
24 | ProcessModuleEntryPointList().\r | |
25 | If the return status from ProcessModuleEntryPointList()\r | |
26 | is an error status, then ProcessLibraryDestructorList() must be called.\r | |
27 | The return value from ProcessModuleEntryPointList() is returned.\r | |
28 | If _gMmRevision is not zero and SystemTable->Hdr.Revision is\r | |
29 | less than _gMmRevision, then return EFI_INCOMPATIBLE_VERSION.\r | |
30 | \r | |
6c61ec4c BD |
31 | @param ImageHandle The image handle of the Standalone MM Driver.\r |
32 | @param MmSystemTable A pointer to the MM System Table.\r | |
5866d499 AB |
33 | \r |
34 | @retval EFI_SUCCESS The Standalone MM Driver exited normally.\r | |
35 | @retval EFI_INCOMPATIBLE_VERSION _gMmRevision is greater than\r | |
36 | MmSystemTable->Hdr.Revision.\r | |
37 | @retval Other Return value from\r | |
38 | ProcessModuleEntryPointList().\r | |
39 | \r | |
40 | **/\r | |
41 | EFI_STATUS\r | |
42 | EFIAPI\r | |
43 | _ModuleEntryPoint (\r | |
44 | IN EFI_HANDLE ImageHandle,\r | |
45 | IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable\r | |
46 | )\r | |
47 | {\r | |
48 | EFI_STATUS Status;\r | |
49 | \r | |
50 | if (_gMmRevision != 0) {\r | |
51 | //\r | |
52 | // Make sure that the MM spec revision of the platform\r | |
53 | // is >= MM spec revision of the driver\r | |
54 | //\r | |
55 | if (MmSystemTable->Hdr.Revision < _gMmRevision) {\r | |
56 | return EFI_INCOMPATIBLE_VERSION;\r | |
57 | }\r | |
58 | }\r | |
59 | \r | |
60 | //\r | |
61 | // Call constructor for all libraries\r | |
62 | //\r | |
63 | ProcessLibraryConstructorList (ImageHandle, MmSystemTable);\r | |
64 | \r | |
65 | //\r | |
66 | // Call the driver entry point\r | |
67 | //\r | |
68 | Status = ProcessModuleEntryPointList (ImageHandle, MmSystemTable);\r | |
69 | \r | |
70 | //\r | |
71 | // If all of the drivers returned errors, then invoke all of the library destructors\r | |
72 | //\r | |
73 | if (EFI_ERROR (Status)) {\r | |
74 | ProcessLibraryDestructorList (ImageHandle, MmSystemTable);\r | |
75 | }\r | |
76 | \r | |
77 | //\r | |
78 | // Return the cumulative return status code from all of the driver entry points\r | |
79 | //\r | |
80 | return Status;\r | |
81 | }\r |