Exemplo n.º 1
0
def get_physical_memory(tree: FdtParser, config: Config) -> List[Region]:
    ''' returns a list of regions representing physical memory as used by the kernel '''
    regions = get_memory_regions(tree)
    reserved = parse_reserved_regions(tree.get_path('/reserved-memory'))
    regions = reserve_regions(regions, reserved)
    regions, extra_reserved, physBase = align_memory(regions, config)

    return regions, reserved.union(extra_reserved), physBase
Exemplo n.º 2
0
def get_elfloader_devices(tree: fdt.FdtParser, rules: rule.HardwareYaml):
    devices = []

    # serial device
    chosen = tree.get_path('/chosen')
    if not chosen.has_prop('stdout-path') or type(
            chosen.get_prop('stdout-path')) != pyfdt.pyfdt.FdtPropertyStrings:
        logging.info(
            'DT has no stdout-path, elfloader may not produce output!')
    else:
        val = chosen.get_prop('stdout-path').strings[0]
        if val[0] == '/':
            path = val
        else:
            path = tree.lookup_alias(val)
        devices.append(tree.get_path(path))
    return devices
Exemplo n.º 3
0
def get_cpus(tree: FdtParser) -> List[WrappedNode]:
    ' Return a list of all the CPUs described in this device tree. '
    cpus_node = tree.get_path('/cpus')

    found_cpus = []
    for node in cpus_node:
        if node.has_prop('device_type') and node.get_prop('device_type').strings[0] == 'cpu':
            found_cpus.append(node)

    return found_cpus