MdePkg 相关Lib
MdePkg\Include\Library
edk2-stable202105目前为止MdePkg一共声明了67个头文件
UnitTestHostBaseLib|Test/UnitTest/Include/Library/UnitTestHostBaseLib.h比较特殊,放在Test文件夹下,其余都在Include/Library路径下
dec文件中LibraryClasses项中会声明相应的Lib和其包含路径的对应的头文件,规范起见一般统一放在Include/Library路径下,一般来说LibraryClassesName和头文件*.h会取相同的命名,有些LibraryClasses不是common的,和架构有关,需要通过[LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]来指明Lib可以在那些架构中使用,例如SMM SMI只适用于IA32 X64架构
dec中定义了LibraryClassesName,并且和Include\Library中声明的头文件关联起来了,对应的LibraryInstance放在Library文件夹下,一般为了统一取的文件夹名也是和LibraryClassesName相同,最后LibraryClasses Mapping的时候会将dec中声明的Lib和实现的LibraryInstance Module的inf对应上,会出现dec出现的Lib,dsc中没有对应,猜想应该是只想共本Pkg调用,所以未对外暴露接口
LibraryClasses中声明的接口对应的实现我们叫做LibraryInstance,这个会包在dsc文件里的Components中,实现也是和架构有关的,所以会卡[Components.IA32, Components.X64, Components.ARM, Components.AARCH64]的条件,主要看这个实现部分在对应的架构能不能被用
一般来说,一个LibraryClass的LibraryInstance可能有多个,常见的如CpuLib有两个Instance,一个为Null,那就对应Library/BaseCpuLib和Library/BaseCpuLibNull两个文件夹,还有就是不同Phase有不同的实现,例如BaseMemoryLib对应Library/BaseMemoryLib,Library/BaseMemoryLibMmx,Library/BaseMemoryLibOptDxe,Library/BaseMemoryLibOptPei,Library/BaseMemoryLibRepStr,Library/BaseMemoryLibSse2这几个文件夹下对应的inf的LibraryInstance,还有就是instance跨Pkg的情况,一般lib都是本Pkg声明和实现,但不绝对,其中MemoryAllocationLib是在MdePkg声明的,但存在instance在MdeModulePkg,DxeCoreMemoryAllocationLib.inf
PiSmmCoreMemoryAllocationLib.inf,类似的还有SmmServicesTableLib.h,HobLib.h
| *.h | LibraryClassesName | LibraryInstance |
|---|---|---|
| BaseLib.h | BaseLib | BaseLib.inf |
| BaseMemoryLib.h | BaseMemoryLib | BaseMemoryLib.inf PeiMemoryLib.inf UefiMemoryLib.inf BaseMemoryLibMmx.inf BaseMemoryLibOptDxe.inf BaseMemoryLibOptPei.inf BaseMemoryLibRepStr.inf BaseMemoryLibSse2.inf |
| CacheMaintenanceLib.h | CacheMaintenanceLib | BaseCacheMaintenanceLib.inf BaseCacheMaintenanceLibNull.inf |
| CpuLib.h | CpuLib | BaseCpuLib.inf BaseCpuLibNull.inf |
| DebugLib.h | DebugLib | BaseDebugLibNull.inf BaseDebugLibSerialPort.inf DxeRuntimeDebugLibSerialPort.inf UefiDebugLibConOut.inf UefiDebugLibDebugPortProtocol.inf UefiDebugLibStdErr.inf |
| DebugPrintErrorLevelLib.h | DebugPrintErrorLevelLib | BaseDebugPrintErrorLevelLib.inf |
| DevicePathLib.h | DevicePathLib | UefiDevicePathLib.inf UefiDevicePathLibStandaloneMm.inf UefiDevicePathLibOptional DevicePathProtocol.inf UefiDevicePathLibDevicePathProtocol.inf |
| DxeCoreEntryPoint.h | DxeCoreEntryPoint | DxeCoreEntryPoint.inf |
| DxeServicesLib.h | DxeServicesLib | DxeServicesLib.inf |
| DxeServicesTableLib.h | DxeServicesTableLib | DxeServicesTableLib.inf |
| ExtractGuidSectionLib.h | ExtractGuidedSectionLib | PeiExtractGuidedSectionLib.inf DxeExtractGuidedSectionLib.inf BaseExtractGuidedSectionLib.inf |
| FileHandleLib.h | FileHandleLib | UefiFileHandleLib.inf |
| HobLib.h | HobLib | DxeCoreHobLib.inf PeiHobLib.inf DxeHobLib.inf (MdeModulePkg) BaseHobLibNull.inf |
| HstiLib.h | HstiLib | DxeHstiLib.inf |
| IoLib.h | IoLib | DxeIoLibCpuIo2.inf PeiIoLibCpuIo.inf PeiIoLibCpuIo.inf BaseIoLibIntrinsic.inf BaseIoLibIntrinsicSev.inf BaseIoLibIntrinsicArmVirt.inf |
| MemoryAllocationLib.h | MemoryAllocationLib | UefiMemoryAllocationLib.inf SmmMemoryAllocationLib.inf (MdeModulePkg) DxeCoreMemoryAllocationLib.infPiSmmCoreMemoryAllocationLib.infBaseMemoryAllocationLibNull.inf |
| MmServicesTableLib.h | MmServicesTableLib | MmServicesTableLib.inf |
| MmUnblockMemoryLib.h | MmUnblockMemoryLib | MmUnblockMemoryLibNull.inf |
| OrderedCollectionLib.h | OrderedCollectionLib | BaseOrderedCollection RedBlackTreeLib.inf |
| PcdLib.h | PcdLib | BasePcdLibNull.inf PeiPcdLib.inf DxePcdLib.inf SmmIoLibSmmCpuIo2.inf |
| PciCf8Lib.h | PciCf8Lib | BasePciCf8Lib.inf |
| PciExpressLib.h | PciExpressLib | BasePciLibPciExpress.inf DxeRuntimePciExpressLib.inf SmmPciExpressLib.inf |
| PciLib.h | PciLib | PeiPciLibPciCfg2.inf UefiPciLibPciRootBridgeIo.inf |
| PciSegmentInfoLib.h | PciSegmentInfoLib | BasePciSegmentInfoLibNull.inf |
| PciSegmentLib.h | PciSegmentLib | BasePciSegmentLibSegmentInfo.inf BasePciSegmentLibPci.inf PeiPciSegmentLibPciCfg2.inf DxeRuntimePciSegmentLib SegmentInfo.inf UefiPciSegmentLib PciRootBridgeIo.inf |
| PeCoffExtraActionLib.h | PeCoffExtraActionLib | BasePeCoffExtraActionLibNull.inf |
| PeCoffGetEntryPointLib.h | PeCoffGetEntryPointLib | BasePeCoffGetEntryPointLib.inf |
| PeCoffLib.h | PeCoffLib | BasePeCoffLib.inf |
| PeiCoreEntryPoint.h | PeiCoreEntryPoint | PeiCoreEntryPoint.inf |
| PeimEntryPoint.h | PeimEntryPoint | PeimEntryPoint.inf |
| PeiServicesLib.h | PeiServicesLib | PeiServicesLib.inf |
| PeiServicesTablePointerLib.h | PeiServicesTablePointerLib | PeiServicesTablePointerLib.inf PeiServicesTablePointerLibIdt.inf |
| PerformanceLib.h | PerformanceLib | BasePerformanceLibNull.inf |
| PostCodeLib.h | PostCodeLib | BasePostCodeLibDebug.inf BasePostCodeLibPort80.inf PeiDxePostCodeLibReportStatusCode.inf |
| PrintLib.h | PrintLib | BasePrintLib.inf |
| RegisterFilterLib.h | RegisterFilterLib | RegisterFilterLibNull.inf |
| ReportStatusCodeLib.h | ReportStatusCodeLib | BaseReportStatusCodeLibNull.inf |
| ResourcePublicationLib.h | ResourcePublicationLib | PeiResourcePublicationLib.inf |
| RngLib.h | RngLib(IA32 X64 AARCH64) | DxeRngLib.inf BaseRngLibNull.inf BaseRngLibTimerLib.inf BaseRngLib.inf |
| S3BootScriptLib.h | S3BootScriptLib | BaseS3BootScriptLibNull.inf |
| S3IoLib.h | S3IoLib | BaseS3IoLib.inf |
| S3PciLib.h | S3PciLib | BaseS3PciLib.inf |
| S3PciSegmentLib.h | PciSegmentInfoLib | BaseS3PciSegmentLib.inf |
| S3SmbusLib.h | S3SmbusLib | BaseS3SmbusLib.inf |
| S3StallLib.h | S3StallLib | BaseS3StallLib.inf |
| SafeIntLib.h | SafeIntLib | BaseSafeIntLib.inf TestBaseSafeIntLibPei.inf TestBaseSafeIntLibDxe.inf TestBaseSafeIntLibSmm.inf TestBaseSafeIntLibUefiShell.inf |
| SerialPortLib.h | SerialPortLib | BaseSerialPortLibNull.inf |
| SmbusLib.h | SmbusLib | BaseSmbusLibNull.inf PeiSmbusLibSmbus2Ppi.inf DxeSmbusLib.inf |
| SmiHandlerProfileLib.h | SmiHandlerProfileLib(IA32 X64) | SmiHandlerProfileLibNull.inf |
| SmmIoLib.h | SmmIoLib(IA32 X64) | SmmIoLibSmmCpuIo2.inf SmmIoLib.inf |
| SmmLib.h | SmmLib(IA32 X64) | SmmLibNull.inf |
| SmmMemLib.h | SmmMemLib(IA32 X64) | SmmMemLib.inf |
| SmmPeriodicSmiLib.h | SmmPeriodicSmiLib(IA32 X64) | SmmPeriodicSmiLib.inf |
| SmmServicesTableLib.h | SmmServicesTableLib(IA32 X64) | StandaloneMmServicesTableLib.inf SmmServicesTableLib.inf (MdeModulePkg) PiSmmCoreSmmServicesTableLib.inf |
| StandloneMmDriverEntryPoint.h | StandaloneMmDriverEntryPoint | StandaloneMmDriverEntryPoint.inf |
| SynchronizationLib.h | SynchronizationLib | BaseSynchronizationLib.inf |
| TimerLib.h | TimerLib | BaseTimerLibNullTemplate.inf SecPeiDxeTimerLibCpu.inf |
| UefiApplicationEntryPoint.h | UefiApplicationEntryPoint | UefiApplicationEntryPoint.inf |
| UefiBootServicesTableLib.h | UefiBootServicesTableLib | UefiBootServicesTableLib.inf |
| UefiDecompressLib.h | UefiDecompressLib | BaseUefiDecompressLib.inf BaseUefiTianoCustomDecompressLib.inf |
| UefiDriverEntryPoint.h | UefiDriverEntryPoint | UefiDriverEntryPoint.inf |
| UefiLib.h | UefiLib | UefiLib.inf |
| UefiRuntimeLib.h | UefiRuntimeLib | UefiRuntimeLib.inf |
| UefiRuntimeSerivcesTablelib.h | UefiRuntimeServicesTableLib | UefiRuntimeServicesTableLib.inf |
| UefiScsiLib.h | UefiScsiLib | UefiScsiLib.inf |
| UefiUsbLib.h | UefiUsbLib | UefiUsbLib.inf |
| UnitTestLib.h | UnitTestLib | BaseLibUnitTestsUefi.inf |
MdeModulePkg 相关Lib
MdeModulePkg\Include\Library
edk2-stable202105目前为止MdeModulePkg一共声明了32个头文件
| *.h | LibraryClassesName | LibraryInstance |
|---|---|---|
| AuthVariableLib.h | AuthVariableLib | AuthVariableLibNull.inf |
| BmpSupportLib.h | BmpSupportLib | BaseBmpSupportLib.inf |
| BootLogoLib.h | BootLogoLib | BootLogoLib.inf |
| CapsuleLib.h | CapsuleLib | DxeCapsuleLibNull.inf DxeCapsuleLib.inf DxeRuntimeCapsuleLib.inf |
| CpuExceptionHandlerLib.h | CpuExceptionHandlerLib | CpuExceptionHandler LibNull.inf |
| CustomizedDisplayLib.h | CustomizedDisplayLib | CustomizedDisplayLib.inf |
| DebugAgentLib.h | DebugAgentLib | DebugAgentLibNull.inf |
| DisplayUpdateProgressLib.h | DisplayUpdateProgressLib | DisplayUpdate ProgressLibGraphics.inf |
| FileExplorerLib.h | FileExplorerLib | FileExplorerLib.inf |
| FmpAuthenticationLib.h | FmpAuthenticationLib | FmpAuthen ticationLibNull.inf |
| FrameBufferBltLib.h | FrameBufferBltLib | FrameBufferBltLib.inf |
| HiiLib.h | HiiLib | UefiHiiLib.inf |
| IpmiLib.h | IpmiLib | BaseIpmiLibNull.inf PeiIpmiLibIpmiPpi.inf DxeIpmiLibIpmiProtocol.inf SmmIpmiLibSmm IpmiProtocol.inf |
| LockBoxLib.h | LockBoxLib | SmmLockBoxPeiLib.inf SmmLockBoxDxeLib.inf SmmLockBoxStand aloneMmLib.inf LockBoxNullLib.inf |
| MemoryProfileLib.h | MemoryProfileLib | |
| NonDiscoverableDeviceRegistrationLib.h | NonDiscoverableDeviceRegistrationLib | NonDiscoverable DeviceRegistrationLib.inf |
| OemHookStatusCodeLib.h | OemHookStatusCodeLib | OemHookStatusCode LibNull.inf |
| PciHostBridgeLib.h | PciHostBridgeLib | PciHostBridgeLibNull.inf |
| PlatformBootManagerLib.h | PlatformBootManagerLib | PlatformBootManager LibNull.inf |
| PlatformHookLib.h | PlatformHookLib | BasePlatform HookLibNull.inf SmmCorePlatform HookLibNull.inf |
| PlatformVarCleanupLib.h | PlatformVarCleanupLib | PlatformVarCleanupLib.inf |
| ResetSystemLib.h | ResetSystemLib | BaseResetSystemLibNull.inf |
| ResetUtilityLib.h | ResetUtilityLib | ResetUtilityLib.inf |
| SecurityManagementLib.h | SecurityManagementLib | DxeSecurity ManagementLib.inf |
| SmmCorePlatformHookLib.h | SmmCorePlatformHookLib | SmmCorePlatform HookLibNull.inf |
| SortLib.h | SortLib | BaseSortLib.inf |
| TpmMeasurementLib.h | TpmMeasurementLib | TpmMeasurementLibNull.inf |
| UefiBootMangerLib.h | UefiBootManagerLib | UefiBootManagerLib.inf |
| UefiHiiServiceLib.h | UefiHiiServicesLib | UefiHiiServicesLib.inf |
| VarCheckLib.h | VarCheckLib | VarCheckLib.inf |
| VariablePolicyHelperLib.h | VariablePolicyHelperLib | VariablePolicyLib RuntimeDxe.inf |
| VariablePolicyLib.h | VariablePolicyLib | VariablePolicyLib.inf |