EDK-II常用库函数及API

来源:互联网 发布:三星note8网络信号好吗 编辑:IT博客网 时间:2019/10/14 19:48

Table of Contents

  • 1 EDK-II module Type
  • 2 PCD Access Functions
  • 3 Commonly Use Library Classes
  • 4 The APIs which are frequently used in the commonly used Library
    • 4.1 BaseLib
      • 4.1.1 Linked List related declaration
      • 4.1.2 String Related
    • 4.2 IoLib
    • 4.3 DebugLib
    • 4.4 BaseMemoryLib
    • 4.5 MemoryAllocationLib
    • 4.6 PciExpressLib
    • 4.7 PciLib
    • 4.8 PcdLib

1 EDK-II module Type

EDK-II module typeModule TypeDescriptionSECCPU specific assembly code of SEC phasePEI_COREPEI Core implementationPEIMPEIMs that are complaint with PI specificationDXE_COREDXE Core implementationDXE_DRIVERDXE drivers that exist in boot services and destroied when ExitBootServices() is calledDXE_RUNTIME_DREVERThis Module exist both in boot service environment and runtime service environmentDXE_SAL_DRVIERThis Module is only available to IPF CPUsDXE_SMM_DRIVERThis Moudle type is used by DXE deivers that are loaded into SMRAMUEFI_DIRVERUEFI Drivers that are complaint with UEFI specificationUEFI_APPLICATIONUEFI application. They are always unloaded after exit.

2 PCD Access Functions

PCD access functionsPcdGetx()/PcdSetx()Common get/set function for all PCDs typeFeaturePcdGet()/FeaturePcdSet()Get/set function for "FeaturePcd"FixedPcdGetx()Get function for "FixedPcd"PatchPcdGetx()/PatchPcdSetxGet/Set function for "PatchPcd"

3 Commonly Use Library Classes

BaseLibString, Linked List, Math, CPU realtedSynchronizationLibSynchronization FunctionsPrintLibPrint a formated string to bufferBaseMemoryLibFill Mem, Copy Mem, Zero Mem, GUID OperationMemoryAllocationLibAllocate and free MemoryDebugLibPrint debug or assert memssagesPostCodeLibPOST codeStatusCodeLibProvide services to log status codeIoLibI/O or MMIOPciExpressLibPCI configuration space Access using MMIOPciLibPCI configuatrion space using I/OTimerLibdelay function and performance calculationPcdLibGet and Set PCD

4 The APIs which are frequently used in the commonly used Library

4.1 BaseLib

4.1.1 Linked List related declaration

#include <Library/BaseLib.h>LIST_ENTRY * EFIAPIInitializeListHead (  IN OUT  LIST_ENTRY                *ListHead  );LIST_ENTRY * EFIAPIInsertHeadList (  IN OUT  LIST_ENTRY                *ListHead,  IN OUT  LIST_ENTRY                *Entry  );LIST_ENTRY * EFIAPIInsertTailList (  IN OUT  LIST_ENTRY                *ListHead,  IN OUT  LIST_ENTRY                *Entry  );LIST_ENTRY * EFIAPIGetFirstNode (  IN      CONST LIST_ENTRY          *List  );LIST_ENTRY * EFIAPIGetPreviousNode (  IN      CONST LIST_ENTRY          *List,  IN      CONST LIST_ENTRY          *Node  );LIST_ENTRY * EFIAPIGetNextNode (  IN      CONST LIST_ENTRY          *List,  IN      CONST LIST_ENTRY          *Node  );BOOLEAN EFIAPIIsNodeAtEnd (  IN      CONST LIST_ENTRY          *List,  IN      CONST LIST_ENTRY          *Node  );LIST_ENTRY * EFIAPIRemoveEntryList (  IN      CONST LIST_ENTRY          *Entry  );

4.1.2 String Related

For (char) string:  AsciiStrCat(dst, src);  AsciiStrCmp(first_str, sec_str);  AsciiStrCpy(dst, src);  AsciiStrLen(str);  AsciiStrSize(str);For (unicode) string:  StrCat(dst, src);  StrCmp(fist_str, sec_str);  StrCpy(dst, src);  StrLen(str);  StrSize(str);

4.2 IoLib

IO Operation:  IoRead8/16/32/64(port);  IoWrite8/16/32/64(port);  IoAnd8/16/32/64(port, and_data);  IoOr8/16/32/64(port, or_data);  IoAndThenOr8/16/32/64(port, and_data, or_data);MMIO Operation:  MmioRead8/16/32/64(address);  MmioWrite8/16/32/64(address);  MmioReadBuffer8/16/32/64(addr, len, buffer);  MmioWriteBuffer8/16/32/64(addr, len, buffer);  MmioAnd8/16/32/64(addr, and_data);  MmioOr8/16/32/64(addr, or_data);  MmioAndThenOr8/16/32/64(addr, and_data, or_data);

4.3 DebugLib

VOIDEFIAPIDebugPrint (  IN  UINTN        ErrorLevel,  IN  CONST CHAR8  *Format,  ...  );

4.4 BaseMemoryLib

ScanMem8/16/32/64(buf, len, val);SetMem/16/32/64(buf, len, val);CopyMem(dst, src, len);CopyGuid(dst, src);CompareMem(dst, src, len);

4.5 MemoryAllocationLib

AllocateAlignedPages/ReservedPages/RuntimePages(pages, algin);AllocatePool(size);ReallocatePool(old_size, new_size, buffer);AllocateZeroPoll(size);FreePool(buf);

4.6 PciExpressLib

MACRO:  PCI_EXPRESS_LIB_ADDRESS(Bus,Device,Function,Offset)Functions:  PciExpressRead8/16/32(addr);  PciExpressWrite8/16/32(addr, data);  PciExpressReadBuffer(addr, size, buf);  PciExpressWriteBuffer(addr, size, buf);  PciExpressAnd8/16/32(addr, and_data);  PciExpressOr8/16/32(addr, or_data);  PciExpressAndThenOr8/16/32(addr, and_data, or_data);

4.7 PciLib

MACRO:  PCI_LIB_ADDRESS(Bus,Device,Function,Register)Functions:  PciRead8/16/32(addr);  PciWrite8/16/32(addr, data);  PciReadBuffer(addr, size, buf);  PciWriteBuffer(addr, size, buf);  PciAnd8/16/32(addr, and_data);  PciOr8/16/32(addr, or_data);  PciAndThenOr8/16/32(addr, and_data, or_data);

4.8 PcdLib

MACROs:  PcdGet8/16/32/64(token);  PcdSet8/16/32/64(token);  FeaturePcdGet(token);  FixedPcdGet8/16/32/64(token);


0 0
原创粉丝点击