1 /* 2 * Copyright (c) 2020 Travis Geiselbrecht 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8 #pragma once 9 10 #include <sys/types.h> 11 12 /* 13 * A set of routines to assist with walking a Flattened Device Tree in memory 14 * for interesting nodes. Uses libfdt internally. 15 */ 16 17 struct fdt_walk_callbacks { 18 void (*mem)(uint64_t base, uint64_t len, void *cookie); 19 void *memcookie; 20 void (*cpu)(uint64_t id, void *cookie); 21 void *cpucookie; 22 void (*pcie)(uint64_t ecam_base, size_t len, uint8_t bus_start, uint8_t bus_end, void *cookie); 23 void *pciecookie; 24 }; 25 26 status_t fdt_walk(const void *fdt, const struct fdt_walk_callbacks *); 27 28