1 /* 2 * Copyright 2020-2021, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _DRIVERS_BUS_FDT_H 6 #define _DRIVERS_BUS_FDT_H 7 8 9 #include <device_manager.h> 10 11 12 struct fdt_bus; 13 struct fdt_device; 14 struct fdt_interrupt_map; 15 16 typedef struct fdt_bus_module_info { 17 driver_module_info info; 18 device_node* (*node_by_phandle)(struct fdt_bus* bus, int phandle); 19 } fdt_bus_module_info; 20 21 typedef struct fdt_device_module_info { 22 driver_module_info info; 23 device_node* (*get_bus)(struct fdt_device* dev); 24 const char* (*get_name)(struct fdt_device* dev); 25 const void* (*get_prop)(struct fdt_device* dev, const char* name, int* len); 26 bool (*get_reg)(struct fdt_device* dev, uint32 ord, uint64* regs, uint64* len); 27 bool (*get_interrupt)(struct fdt_device* dev, uint32 ord, 28 device_node** interruptController, uint64* interrupt); 29 struct fdt_interrupt_map* (*get_interrupt_map)(struct fdt_device* dev); 30 void (*print_interrupt_map)(struct fdt_interrupt_map* interruptMap); 31 uint32 (*lookup_interrupt_map)(struct fdt_interrupt_map* interruptMap, uint32 childAddr, uint32 childIrq); 32 } fdt_device_module_info; 33 34 35 #endif // _DRIVERS_BUS_FDT_H 36