XenevaOS
Loading...
Searching...
No Matches
Macros | Functions | Variables
dtb.c File Reference
#include <dtb.h>
#include <aucon.h>
#include <_null.h>
#include <string.h>
#include <Mm/vmmngr.h>
#include <Mm/pmmngr.h>
Include dependency graph for dtb.c:

Macros

#define FDT_MAGIC   0xd00dfeed
 
#define FDT_BEGIN_NODE   0x1
 
#define FDT_END_NODE   0x2
 
#define FDT_PROP   0x3
 
#define FDT_NOP   0x4
 
#define FDT_END   0x9
 

Functions

uint32_t AuDTBSwap32 (uint32_t from)
 AuDTBSwap32 – swaps 32 bit value.
 
uint64_t AuDTBSwap64 (uint64_t from)
 AuDTBSwap64 – swaps 64 bit value.
 
uint16_t AuDTBSwap16 (uint16_t from)
 AuDTBSwap16 – swaps 16 bit value.
 
uint32_tAuDeviceTreeGetSubNode (uint32_t *node, char *strings, const char *name, uint32_t **node_out, int(*cmp)(const char *a, const char *b))
 
uint32_tAuDeviceTreeFindPropertyInternal (uint32_t *node, char *strings, const char *property, uint32_t **out)
 
uint32_tAuDeviceTreeGetNode (const char *name)
 AuDeviceTreeGetNode – searches and get the offset of the node.
 
uint32_tAuDeviceTreeFindProperty (uint32_t *node, const char *property)
 AuDeviceTreeFindProperty – searches for a property within a node.
 
uint32_t AuDeviceTreeGetAddressCells (uint32_t *node)
 AuDeviceTreeGetAddressCells – get the value from address cells property.
 
uint32_t AuDeviceTreeGetSizeCells (uint32_t *node)
 AuDeviceTreeGetSizeCells – get the value from size cells property.
 
uint64_t AuDeviceTreeGetRegAddress (uint32_t *node, uint32_t addressCell)
 AuDeviceTreeGetRegAddress – get the MMIO address from reg property.
 
uint64_t AuDeviceTreeGetRegSize (uint32_t *node, uint32_t addressCell, uint32_t sizeCell)
 AuDeviceTreeGetRegSize – get the size value from reg property.
 
void AuDeviceTreeInitialize (KERNEL_BOOT_INFO *info)
 AuDeviceTreeInitialize – initialize the device tree.
 
void AuDeviceTreeMapMMIO ()
 AuDeviceTreeMapMMIO – Maps the physical device tree address to MMIO address range.
 

Variables

uint64_tdtbAddress
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2025, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ FDT_BEGIN_NODE

#define FDT_BEGIN_NODE   0x1

◆ FDT_END

#define FDT_END   0x9

◆ FDT_END_NODE

#define FDT_END_NODE   0x2

◆ FDT_MAGIC

#define FDT_MAGIC   0xd00dfeed

◆ FDT_NOP

#define FDT_NOP   0x4

◆ FDT_PROP

#define FDT_PROP   0x3

Function Documentation

◆ AuDeviceTreeFindProperty()

uint32_t * AuDeviceTreeFindProperty ( uint32_t node,
const char *  property 
)

AuDeviceTreeFindProperty – searches for a property within a node.

Parameters
node– Pointer to node offset
property– Property name

◆ AuDeviceTreeFindPropertyInternal()

uint32_t * AuDeviceTreeFindPropertyInternal ( uint32_t node,
char *  strings,
const char *  property,
uint32_t **  out 
)

◆ AuDeviceTreeGetAddressCells()

uint32_t AuDeviceTreeGetAddressCells ( uint32_t node)

AuDeviceTreeGetAddressCells – get the value from address cells property.

Parameters
node– Pointer to node

◆ AuDeviceTreeGetNode()

uint32_t * AuDeviceTreeGetNode ( const char *  name)

AuDeviceTreeGetNode – searches and get the offset of the node.

Parameters
name– Node name

◆ AuDeviceTreeGetRegAddress()

uint64_t AuDeviceTreeGetRegAddress ( uint32_t node,
uint32_t  addressCell 
)

AuDeviceTreeGetRegAddress – get the MMIO address from reg property.

Parameters
node– Pointer to parent node
addressCell– size of address cell

◆ AuDeviceTreeGetRegSize()

uint64_t AuDeviceTreeGetRegSize ( uint32_t node,
uint32_t  addressCell,
uint32_t  sizeCell 
)

AuDeviceTreeGetRegSize – get the size value from reg property.

Parameters
node– Pointer to parent node
addressCell– size of address cell
sizeCell– value of size cell

◆ AuDeviceTreeGetSizeCells()

uint32_t AuDeviceTreeGetSizeCells ( uint32_t node)

AuDeviceTreeGetSizeCells – get the value from size cells property.

Parameters
node– Pointer to node

◆ AuDeviceTreeGetSubNode()

uint32_t * AuDeviceTreeGetSubNode ( uint32_t node,
char *  strings,
const char *  name,
uint32_t **  node_out,
int(*)(const char *a, const char *b)  cmp 
)

◆ AuDeviceTreeInitialize()

void AuDeviceTreeInitialize ( KERNEL_BOOT_INFO info)

AuDeviceTreeInitialize – initialize the device tree.

Parameters
fdt_address– device tree address passed by bootloader

◆ AuDeviceTreeMapMMIO()

void AuDeviceTreeMapMMIO ( )

AuDeviceTreeMapMMIO – Maps the physical device tree address to MMIO address range.

◆ AuDTBSwap16()

uint16_t AuDTBSwap16 ( uint16_t  from)

AuDTBSwap16 – swaps 16 bit value.

Parameters
from– value to swap

◆ AuDTBSwap32()

uint32_t AuDTBSwap32 ( uint32_t  from)

AuDTBSwap32 – swaps 32 bit value.

Parameters
from– value to swap

◆ AuDTBSwap64()

uint64_t AuDTBSwap64 ( uint64_t  from)

AuDTBSwap64 – swaps 64 bit value.

Parameters
from– value to swap

Variable Documentation

◆ dtbAddress

uint64_t* dtbAddress