TianoCore EDK2 master
Loading...
Searching...
No Matches
FdtParserLib.c File Reference

Go to the source code of this file.

Macros

#define MEMORY_ATTRIBUTE_DEFAULT
 
#define ROOT_BRIDGE_SUPPORTS_DEFAULT
 

Enumerations

enum  FDT_NODE_TYPE {
  ReservedMemory = 1 , Memory , FrameBuffer , PciRootBridge ,
  Options , DoNothing
}
 

Functions

EFI_HOB_HANDOFF_INFO_TABLE *EFIAPI HobConstructor (IN VOID *EfiMemoryBottom, IN VOID *EfiMemoryTop, IN VOID *EfiFreeMemoryBottom, IN VOID *EfiFreeMemoryTop)
 
VOID RecordMemoryNode (INT32 Node)
 
BOOLEAN CheckMemoryNodeIfInit (INT32 Node)
 
FDT_NODE_TYPE CheckNodeType (CHAR8 *NodeString, INT32 Depth)
 
VOID ParseMemory (IN VOID *Fdt, IN INT32 Node)
 
VOID ParseReservedMemory (IN VOID *Fdt, IN INT32 Node)
 
CHAR8 * ParseFrameBuffer (IN VOID *Fdt, IN INT32 Node)
 
VOID ParseOptions (IN VOID *Fdt, IN INT32 Node, OUT UINT8 *PciEnumDone, OUT EFI_BOOT_MODE *BootMode)
 
VOID ParsegraphicNode (IN VOID *Fdt, IN INT32 SubNode)
 
VOID ParseSerialPort (IN VOID *Fdt, IN INT32 SubNode)
 
VOID ParsePciRootBridge (IN VOID *Fdt, IN INT32 Node, IN UINT8 RootBridgeCount, IN CHAR8 *GmaStr, IN UINT8 *index)
 
UINTN EFIAPI ParseDtb (IN VOID *FdtBase)
 
UINTN EFIAPI FdtNodeParser (IN VOID *FdtBase)
 
UINTN EFIAPI UplInitHob (IN VOID *FdtBase)
 

Variables

VOID * mHobList
 
UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGESmPciRootBridgeInfo = NULL
 
INT32 mNode [0x500] = { 0 }
 
UINT32 mNodeIndex = 0
 
UPL_PCI_SEGMENT_INFO_HOBmUplPciSegmentInfoHob
 

Detailed Description

Copyright (c) 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file FdtParserLib.c.

Macro Definition Documentation

◆ MEMORY_ATTRIBUTE_DEFAULT

#define MEMORY_ATTRIBUTE_DEFAULT
Value:
(EFI_RESOURCE_ATTRIBUTE_PRESENT | \
EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \
EFI_RESOURCE_ATTRIBUTE_TESTED | \
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | \
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | \
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | \
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE )

Definition at line 44 of file FdtParserLib.c.

◆ ROOT_BRIDGE_SUPPORTS_DEFAULT

#define ROOT_BRIDGE_SUPPORTS_DEFAULT
Value:
#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY
MEM cycles 0xA0000-0xBFFFF (24 bit decode)
Definition: PciIo.h:52
#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO
I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
Definition: PciIo.h:54
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16
I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
Definition: PciIo.h:67
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO
I/O cycles 0x0100-0x03FF or greater (10 bit decode)
Definition: PciIo.h:50
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16
I/O cycles 0x0100-0x03FF or greater (16 bit decode)
Definition: PciIo.h:65
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16
I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
Definition: PciIo.h:66
#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO
I/O cycles 0x0000-0x00FF (10 bit decode)
Definition: PciIo.h:49
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO
I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
Definition: PciIo.h:51
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO
I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
Definition: PciIo.h:53

Definition at line 52 of file FdtParserLib.c.

Enumeration Type Documentation

◆ FDT_NODE_TYPE

enum FDT_NODE_TYPE

Definition at line 35 of file FdtParserLib.c.

Function Documentation

◆ CheckMemoryNodeIfInit()

BOOLEAN CheckMemoryNodeIfInit ( INT32  Node)

Check the memory node if initialized.

Parameters
[in]Nodememory node is going to parsing..
Returns
TRUE memory node was initialized. don't parse it again.
FALSE memory node wasn't initialized , go to parse it.

Definition at line 116 of file FdtParserLib.c.

◆ CheckNodeType()

FDT_NODE_TYPE CheckNodeType ( CHAR8 *  NodeString,
INT32  Depth 
)

It will check device node from FDT.

Parameters
[in]NodeStringDevice node name string.
[in]DepthCheck layer of Device node , only parse the 1st layer
Returns
FDT_NODE_TYPE what type of the device node.

Definition at line 140 of file FdtParserLib.c.

◆ FdtNodeParser()

UINTN EFIAPI FdtNodeParser ( IN VOID *  FdtBase)

It will Parse FDT -node based on information from bootloaders.

Parameters
[in]FdtBaseThe starting memory address of FdtBase
Return values
HobListThe base address of Hoblist.

Definition at line 1002 of file FdtParserLib.c.

◆ HobConstructor()

EFI_HOB_HANDOFF_INFO_TABLE *EFIAPI HobConstructor ( IN VOID *  EfiMemoryBottom,
IN VOID *  EfiMemoryTop,
IN VOID *  EfiFreeMemoryBottom,
IN VOID *  EfiFreeMemoryTop 
)

Build a Handoff Information Table HOB

This function initialize a HOB region from EfiMemoryBegin to EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should be inside the HOB region.

Parameters
[in]EfiMemoryBottomTotal memory start address
[in]EfiMemoryTopTotal memory end address.
[in]EfiFreeMemoryBottomFree memory start address
[in]EfiFreeMemoryTopFree memory end address.
Returns
The pointer to the handoff HOB table.

Definition at line 54 of file Hob.c.

◆ ParseDtb()

UINTN EFIAPI ParseDtb ( IN VOID *  FdtBase)

It will parse FDT based on DTB from bootloaders.

Parameters
[in]FdtBaseAddress of the Fdt data.
Returns
The address to the new hob list

Definition at line 792 of file FdtParserLib.c.

◆ ParseFrameBuffer()

CHAR8 * ParseFrameBuffer ( IN VOID *  Fdt,
IN INT32  Node 
)

It will ParseFrameBuffer node from FDT.

Parameters
[in]FdtAddress of the Fdt data.
[in]SubNodefirst Sub node of the PCI root bridge node.
Returns
GmaStr Graphic device node name string.

Definition at line 322 of file FdtParserLib.c.

◆ ParsegraphicNode()

VOID ParsegraphicNode ( IN VOID *  Fdt,
IN INT32  SubNode 
)

It will Parsegraphic node from FDT.

Parameters
[in]FdtAddress of the Fdt data.
[in]SubNodefirst Sub node of the PCI root bridge node.

Definition at line 488 of file FdtParserLib.c.

◆ ParseMemory()

VOID ParseMemory ( IN VOID *  Fdt,
IN INT32  Node 
)

It will ParseMemory node from FDT.

Parameters
[in]FdtAddress of the Fdt data.
[in]SubNodefirst node of the PCI root bridge node.

Definition at line 168 of file FdtParserLib.c.

◆ ParseOptions()

VOID ParseOptions ( IN VOID *  Fdt,
IN INT32  Node,
OUT UINT8 *  PciEnumDone,
OUT EFI_BOOT_MODE BootMode 
)

It will ParseOptions node from FDT.

Parameters
[in]FdtAddress of the Fdt data.
[in]SubNodefirst Sub node of the PCI root bridge node.
[out]PciEnumDoneInit ParsePciRootBridge node for ParsePciRootBridge.
[out]BootModeInit the system boot mode

Definition at line 392 of file FdtParserLib.c.

◆ ParsePciRootBridge()

VOID ParsePciRootBridge ( IN VOID *  Fdt,
IN INT32  Node,
IN UINT8  RootBridgeCount,
IN CHAR8 *  GmaStr,
IN UINT8 *  index 
)

It will ParsePciRootBridge node from FDT.

Parameters
[in]FdtAddress of the Fdt data.
[in]Nodefirst node of the Fdt data.
[in]PciEnumDoneTo use ParsePciRootBridge node.
[in]RootBridgeCountNumber of pci RootBridge.
[in]GmaStrGraphic device node name string.
[in]indexIndex of ParsePciRootBridge node.

Definition at line 641 of file FdtParserLib.c.

◆ ParseReservedMemory()

VOID ParseReservedMemory ( IN VOID *  Fdt,
IN INT32  Node 
)

It will ParseReservedMemory node from FDT.

Parameters
[in]FdtAddress of the Fdt data.
[in]SubNodefirst node of the PCI root bridge node.

Definition at line 226 of file FdtParserLib.c.

◆ ParseSerialPort()

VOID ParseSerialPort ( IN VOID *  Fdt,
IN INT32  SubNode 
)

It will ParseSerialPort node from FDT.

Parameters
[in]FdtAddress of the Fdt data.
[in]SubNodefirst Sub node of the PCI root bridge node.

Definition at line 569 of file FdtParserLib.c.

◆ RecordMemoryNode()

VOID RecordMemoryNode ( INT32  Node)

It will record the memory node initialized.

Parameters
[in]Nodememory node is going to parsing..

Definition at line 98 of file FdtParserLib.c.

◆ UplInitHob()

UINTN EFIAPI UplInitHob ( IN VOID *  FdtBase)

It will initialize HOBs for UPL.

Parameters
[in]FdtBaseAddress of the Fdt data.
Return values
EFI_SUCCESSIf it completed successfully.
OthersIf it failed to initialize HOBs.

Definition at line 1019 of file FdtParserLib.c.

Variable Documentation

◆ mHobList

VOID* mHobList
extern

Definition at line 25 of file HobLib.c.

◆ mNode

INT32 mNode[0x500] = { 0 }

Definition at line 64 of file FdtParserLib.c.

◆ mNodeIndex

UINT32 mNodeIndex = 0

Definition at line 65 of file FdtParserLib.c.

◆ mPciRootBridgeInfo

Definition at line 63 of file FdtParserLib.c.

◆ mUplPciSegmentInfoHob

UPL_PCI_SEGMENT_INFO_HOB* mUplPciSegmentInfoHob

Definition at line 66 of file FdtParserLib.c.