1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 3 #include <xen/device_tree.h> 4 #include <xen/init.h> 5 #include <xen/lib.h> 6 intc_dt_preinit(void)7void __init intc_dt_preinit(void) 8 { 9 struct dt_device_node *node; 10 uint8_t num_intc = 0; 11 12 dt_for_each_device_node( dt_host, node ) 13 { 14 if ( !dt_get_property(node, "interrupt-controller", NULL) ) 15 continue; 16 17 if ( !dt_get_parent(node) ) 18 continue; 19 20 if ( !device_init(node, DEVICE_INTERRUPT_CONTROLLER, NULL) ) 21 { 22 /* NOTE: Only one interrupt controller is supported */ 23 num_intc = 1; 24 break; 25 } 26 } 27 28 if ( !num_intc ) 29 panic("Unable to find compatible interrupt controller in the device tree\n"); 30 31 /* Set the interrupt controller as the primary interrupt controller */ 32 dt_interrupt_controller = node; 33 dt_device_set_used_by(node, DOMID_XEN); 34 } 35 36 /* 37 * Local variables: 38 * mode: C 39 * c-file-style: "BSD" 40 * c-basic-offset: 4 41 * indent-tabs-mode: nil 42 * End: 43 */ 44