Abstract
The PCI-Tree is part of NeBoot's architecture (https://github.com/nekernel-org/neboot) it is used to report and make devices discoverable by the stage-two program (which is also referred as a bootloader) this article will go through how the PCI-Tree works and why NeBoot needs it.
The Mahrouss Table
The Mahrouss Table (or MT) is a data structure used to identify the root leaf of the PCI-Tree. You'd access it in order to access other elements in the tree.
You'd call in NeBoot for instance:
cb_pci_append_tree("null", pci_struct, sizeof(pci_struct_type));
This will add the "null" entry to the Mahrouss Table of a pci_struct (of any type) and makes it discoverable to the Stage-Two binary running.
The Data Structure
/// used by guest to resolve hardware peripherals.
struct hw_cb_pci_tree {
cb_pci_num_t d_magic;
cb_pci_num_t d_version;
cb_pci_num_t d_off_props;
cb_pci_num_t d_off_struct;
cb_pci_num_t d_sz_props;
cb_pci_num_t d_sz_struct;
cb_pci_num_t d_first_node;
cb_pci_num_t d_next_sibling;
cb_pci_char_t d_name[NB_PCI_NAME_LEN];
};
This data structure defines a PCI-Tree leaf, used to then iterate over its elements. We use it to keep track of metadata and the other tree's addresses.
What's the need?
Such data structures are necessary for a firmware to work, like the device tree, we need to make the life of the bootloader and kernel easier in terms of driver development.
Conclusion
While the architecture is simple to understand and straightforward to implement, the PCI-Tree has multiple advantages and solves the problem of device drivers development.
Amlal.