Subrata Banik | 20fe24b | 2021-12-09 02:46:38 +0530 | [diff] [blame] | 1 | /** @file |
| 2 | Module entry point library for Standalone MM Drivers. |
| 3 | |
| 4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> |
| 5 | Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR> |
| 6 | Copyright (c) 2018, Linaro, Limited. All rights reserved.<BR> |
| 7 | |
| 8 | SPDX-License-Identifier: BSD-2-Clause-Patent |
| 9 | |
| 10 | **/ |
| 11 | |
| 12 | #ifndef __MODULE_ENTRY_POINT_H__ |
| 13 | #define __MODULE_ENTRY_POINT_H__ |
| 14 | |
| 15 | /// |
| 16 | /// Declare the PI Specification Revision that this driver requires to execute |
| 17 | /// correctly. |
| 18 | /// |
| 19 | extern CONST UINT32 _gMmRevision; |
| 20 | |
| 21 | /// |
| 22 | /// Declare the number of unload handler in the image. |
| 23 | /// |
| 24 | extern CONST UINT8 _gDriverUnloadImageCount; |
| 25 | |
| 26 | /** |
| 27 | The entry point of PE/COFF Image for a Standalone MM Driver. |
| 28 | |
| 29 | This function is the entry point for a Standalone MM Driver. |
| 30 | This function must call ProcessLibraryConstructorList() and |
| 31 | ProcessModuleEntryPointList(). |
| 32 | If the return status from ProcessModuleEntryPointList() |
| 33 | is an error status, then ProcessLibraryDestructorList() must be called. |
| 34 | The return value from ProcessModuleEntryPointList() is returned. |
| 35 | If _gMmRevision is not zero and MmSystemTable->Hdr.Revision is |
| 36 | less than _gMmRevision, then return EFI_INCOMPATIBLE_VERSION. |
| 37 | |
| 38 | @param ImageHandle The image handle of the Standalone MM Driver. |
| 39 | @param MmSystemTable A pointer to the MM System Table. |
| 40 | |
| 41 | @retval EFI_SUCCESS The Standalone MM Driver exited normally. |
| 42 | @retval EFI_INCOMPATIBLE_VERSION _gMmRevision is greater than |
| 43 | MmSystemTable->Hdr.Revision. |
| 44 | @retval Other Return value from |
| 45 | ProcessModuleEntryPointList(). |
| 46 | |
| 47 | **/ |
| 48 | EFI_STATUS |
| 49 | EFIAPI |
| 50 | _ModuleEntryPoint ( |
| 51 | IN EFI_HANDLE ImageHandle, |
| 52 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable |
| 53 | ); |
| 54 | |
| 55 | |
| 56 | /** |
| 57 | Auto generated function that calls the library constructors for all of the |
| 58 | module's dependent libraries. |
| 59 | |
| 60 | This function must be called by _ModuleEntryPoint(). |
| 61 | This function calls the set of library constructors for the set of library |
| 62 | instances that a module depends on. This includes library instances that a |
| 63 | module depends on directly and library instances that a module depends on |
| 64 | indirectly through other libraries. This function is auto generated by build |
| 65 | tools and those build tools are responsible for collecting the set of library |
| 66 | instances, determine which ones have constructors, and calling the library |
| 67 | constructors in the proper order based upon each of the library instances own |
| 68 | dependencies. |
| 69 | |
| 70 | @param ImageHandle The image handle of the Standalone MM Driver. |
| 71 | @param MmSystemTable A pointer to the MM System Table. |
| 72 | |
| 73 | **/ |
| 74 | VOID |
| 75 | EFIAPI |
| 76 | ProcessLibraryConstructorList ( |
| 77 | IN EFI_HANDLE ImageHandle, |
| 78 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable |
| 79 | ); |
| 80 | |
| 81 | |
| 82 | /** |
| 83 | Auto generated function that calls the library descructors for all of the |
| 84 | module's dependent libraries. |
| 85 | |
| 86 | This function may be called by _ModuleEntryPoint(). |
| 87 | This function calls the set of library destructors for the set of library |
| 88 | instances that a module depends on. This includes library instances that a |
| 89 | module depends on directly and library instances that a module depends on |
| 90 | indirectly through other libraries. |
| 91 | This function is auto generated by build tools and those build tools are |
| 92 | responsible for collecting the set of library instances, determine which ones |
| 93 | have destructors, and calling the library destructors in the proper order |
| 94 | based upon each of the library instances own dependencies. |
| 95 | |
| 96 | @param ImageHandle The image handle of the Standalone MM Driver. |
| 97 | @param MmSystemTable A pointer to the MM System Table. |
| 98 | |
| 99 | **/ |
| 100 | VOID |
| 101 | EFIAPI |
| 102 | ProcessLibraryDestructorList ( |
| 103 | IN EFI_HANDLE ImageHandle, |
| 104 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable |
| 105 | ); |
| 106 | |
| 107 | |
| 108 | /** |
| 109 | Auto generated function that calls a set of module entry points. |
| 110 | |
| 111 | This function must be called by _ModuleEntryPoint(). |
| 112 | This function calls the set of module entry points. |
| 113 | This function is auto generated by build tools and those build tools are |
| 114 | responsible for collecting the module entry points and calling them in a |
| 115 | specified order. |
| 116 | |
| 117 | @param ImageHandle The image handle of the Standalone MM Driver. |
| 118 | @param MmSystemTable A pointer to the MM System Table. |
| 119 | |
| 120 | @retval EFI_SUCCESS The Standalone MM Driver executed normally. |
| 121 | @retval !EFI_SUCCESS The Standalone MM Driver failed to execute normally. |
| 122 | **/ |
| 123 | EFI_STATUS |
| 124 | EFIAPI |
| 125 | ProcessModuleEntryPointList ( |
| 126 | IN EFI_HANDLE ImageHandle, |
| 127 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable |
| 128 | ); |
| 129 | |
| 130 | /** |
| 131 | Autogenerated function that calls a set of module unload handlers. |
| 132 | |
| 133 | This function must be called from the unload handler registered by _ModuleEntryPoint(). |
| 134 | This function calls the set of module unload handlers. |
| 135 | This function is autogenerated by build tools and those build tools are responsible |
| 136 | for collecting the module unload handlers and calling them in a specified order. |
| 137 | |
| 138 | @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver. |
| 139 | |
| 140 | @retval EFI_SUCCESS The unload handlers executed normally. |
| 141 | @retval !EFI_SUCCESS The unload handlers failed to execute normally. |
| 142 | |
| 143 | **/ |
| 144 | EFI_STATUS |
| 145 | EFIAPI |
| 146 | ProcessModuleUnloadList ( |
| 147 | IN EFI_HANDLE ImageHandle |
| 148 | ); |
| 149 | |
| 150 | #endif |