Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset de3db94a in mainline


Ignore:
Timestamp:
2012-03-02T15:12:01Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
71232af
Parents:
dabbe28
Message:

map OpenFirmware? device tree into sysinfo

Location:
kernel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/src/ppc32.c

    rdabbe28 rde3db94a  
    173173                ofw_tree_walk_by_device_type("display", display_register, NULL);
    174174#endif
     175                /* Map OFW information into sysinfo */
     176                ofw_sysinfo_map();
    175177               
    176178                /* Initialize IRQ routing */
  • kernel/arch/sparc64/src/sun4u/sparc64.c

    rdabbe28 rde3db94a  
    9494{
    9595        if (config.cpu_active == 1) {
     96                /* Map OFW information into sysinfo */
     97                ofw_sysinfo_map();
     98               
    9699                /*
    97100                 * We have 2^11 different interrupt vectors.
  • kernel/arch/sparc64/src/sun4v/sparc64.c

    rdabbe28 rde3db94a  
    9292{
    9393        if (config.cpu_active == 1) {
     94                /* Map OFW information into sysinfo */
     95                ofw_sysinfo_map();
     96               
    9497                /*
    9598                 * We have 2^11 different interrupt vectors.
  • kernel/genarch/include/ofw/ofw_tree.h

    rdabbe28 rde3db94a  
    6868extern void ofw_tree_init(ofw_tree_node_t *);
    6969extern void ofw_tree_print(void);
     70extern void ofw_sysinfo_map(void);
    7071
    7172extern const char *ofw_tree_node_name(const ofw_tree_node_t *);
  • kernel/genarch/src/ofw/ofw_tree.c

    rdabbe28 rde3db94a  
    3838#include <genarch/ofw/ofw_tree.h>
    3939#include <mm/slab.h>
     40#include <sysinfo/sysinfo.h>
    4041#include <memstr.h>
    4142#include <str.h>
     
    355356}
    356357
     358/** Map OpenFirmware device subtree rooted in a node into sysinfo.
     359 *
     360 * Child nodes are processed recursively and peer nodes are processed
     361 * iteratively in order to avoid stack overflow.
     362 *
     363 * @param node Root of the subtree.
     364 * @param path Current path, NULL for the very root of the entire tree.
     365 *
     366 */
     367static void ofw_tree_node_sysinfo(ofw_tree_node_t *node, const char *path)
     368{
     369        char *cur_path = (char *) malloc(PATH_MAX_LEN, 0);
     370       
     371        for (ofw_tree_node_t *cur = node; cur; cur = cur->peer) {
     372                if ((cur->parent) && (path))
     373                        snprintf(cur_path, PATH_MAX_LEN, "%s.%s", path, cur->da_name);
     374                else
     375                        snprintf(cur_path, PATH_MAX_LEN, "firmware.%s", cur->da_name);
     376               
     377                sysinfo_set_item_undefined(cur_path, NULL);
     378               
     379                if (cur->child)
     380                        ofw_tree_node_sysinfo(cur->child, cur_path);
     381        }
     382       
     383        free(cur_path);
     384}
     385
     386/** Map the OpenFirmware device tree into sysinfo. */
     387void ofw_sysinfo_map(void)
     388{
     389        ofw_tree_node_sysinfo(ofw_root, NULL);
     390}
     391
    357392/** @}
    358393 */
Note: See TracChangeset for help on using the changeset viewer.