Ronak Kanabar | 1ae366f | 2023-06-07 01:21:56 +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 | Auto generated function that calls the library constructors for all of the |
| 57 | module's dependent libraries. |
| 58 | |
| 59 | This function must be called by _ModuleEntryPoint(). |
| 60 | This function calls the set of library constructors for the set of library |
| 61 | instances that a module depends on. This includes library instances that a |
| 62 | module depends on directly and library instances that a module depends on |
| 63 | indirectly through other libraries. This function is auto generated by build |
| 64 | tools and those build tools are responsible for collecting the set of library |
| 65 | instances, determine which ones have constructors, and calling the library |
| 66 | constructors in the proper order based upon each of the library instances own |
| 67 | dependencies. |
| 68 | |
| 69 | @param ImageHandle The image handle of the Standalone MM Driver. |
| 70 | @param MmSystemTable A pointer to the MM System Table. |
| 71 | |
| 72 | **/ |
| 73 | VOID |
| 74 | EFIAPI |
| 75 | ProcessLibraryConstructorList ( |
| 76 | IN EFI_HANDLE ImageHandle, |
| 77 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable |
| 78 | ); |
| 79 | |
| 80 | /** |
| 81 | Auto generated function that calls the library descructors for all of the |
| 82 | module's dependent libraries. |
| 83 | |
| 84 | This function may be called by _ModuleEntryPoint(). |
| 85 | This function calls the set of library destructors for the set of library |
| 86 | instances that a module depends on. This includes library instances that a |
| 87 | module depends on directly and library instances that a module depends on |
| 88 | indirectly through other libraries. |
| 89 | This function is auto generated by build tools and those build tools are |
| 90 | responsible for collecting the set of library instances, determine which ones |
| 91 | have destructors, and calling the library destructors in the proper order |
| 92 | based upon each of the library instances own dependencies. |
| 93 | |
| 94 | @param ImageHandle The image handle of the Standalone MM Driver. |
| 95 | @param MmSystemTable A pointer to the MM System Table. |
| 96 | |
| 97 | **/ |
| 98 | VOID |
| 99 | EFIAPI |
| 100 | ProcessLibraryDestructorList ( |
| 101 | IN EFI_HANDLE ImageHandle, |
| 102 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable |
| 103 | ); |
| 104 | |
| 105 | /** |
| 106 | Auto generated function that calls a set of module entry points. |
| 107 | |
| 108 | This function must be called by _ModuleEntryPoint(). |
| 109 | This function calls the set of module entry points. |
| 110 | This function is auto generated by build tools and those build tools are |
| 111 | responsible for collecting the module entry points and calling them in a |
| 112 | specified order. |
| 113 | |
| 114 | @param ImageHandle The image handle of the Standalone MM Driver. |
| 115 | @param MmSystemTable A pointer to the MM System Table. |
| 116 | |
| 117 | @retval EFI_SUCCESS The Standalone MM Driver executed normally. |
| 118 | @retval !EFI_SUCCESS The Standalone MM Driver failed to execute normally. |
| 119 | **/ |
| 120 | EFI_STATUS |
| 121 | EFIAPI |
| 122 | ProcessModuleEntryPointList ( |
| 123 | IN EFI_HANDLE ImageHandle, |
| 124 | IN EFI_MM_SYSTEM_TABLE *MmSystemTable |
| 125 | ); |
| 126 | |
| 127 | /** |
| 128 | Autogenerated function that calls a set of module unload handlers. |
| 129 | |
| 130 | This function must be called from the unload handler registered by _ModuleEntryPoint(). |
| 131 | This function calls the set of module unload handlers. |
| 132 | This function is autogenerated by build tools and those build tools are responsible |
| 133 | for collecting the module unload handlers and calling them in a specified order. |
| 134 | |
| 135 | @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver. |
| 136 | |
| 137 | @retval EFI_SUCCESS The unload handlers executed normally. |
| 138 | @retval !EFI_SUCCESS The unload handlers failed to execute normally. |
| 139 | |
| 140 | **/ |
| 141 | EFI_STATUS |
| 142 | EFIAPI |
| 143 | ProcessModuleUnloadList ( |
| 144 | IN EFI_HANDLE ImageHandle |
| 145 | ); |
| 146 | |
| 147 | #endif |