FreeBSD/sys/arm64/arm64/gic_v3_fdt.c
/*
 * Bus capability support for GICv3.
 * Collects and configures device informations and finally
 * adds ITS device as a child of GICv3 in Newbus hierarchy.
 */
Bus capability support for GICv3.
Collects and configures device informations and finally
adds ITS device as a child of GICv3 in Newbus hierarchy.
Bus capability support for GICv3 . Collects and configures device informations and finally adds ITS device as a child of GICv3 in Newbus hierarchy .
static int
gic_v3_ofw_bus_attach(device_t dev)
{
	struct gic_v3_ofw_devinfo *di;
	device_t child;
	phandle_t parent, node;
	pcell_t addr_cells, size_cells;
	parent = ofw_bus_get_node(dev);
	if (parent > 0) {
		addr_cells = 2;
		OF_getencprop(parent, "#address-cells", &addr_cells,
		    sizeof(addr_cells));
		size_cells = 2;
		OF_getencprop(parent, "#size-cells", &size_cells,
		    sizeof(size_cells));
		for (node = OF_child(parent); node > 0; node = OF_peer(node)) {
			di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO);
			if (ofw_bus_gen_setup_devinfo(&di->di_dinfo, node)) {
				if (bootverbose) {
					device_printf(dev,
					    "Could not set up devinfo for ITS\n");
				}
				free(di, M_GIC_V3);
				continue;
			}
			resource_list_init(&di->di_rl);
			ofw_bus_reg_to_rl(dev, node, addr_cells, size_cells,
			    &di->di_rl);
			child = device_add_child(dev, NULL, -1);
			if (!child) {
				if (bootverbose) {
					device_printf(dev,
					    "Could not add child: %s\n",
					    di->di_dinfo.obd_name);
				}
				resource_list_free(&di->di_rl);
				ofw_bus_gen_destroy_devinfo(&di->di_dinfo);
				free(di, M_GIC_V3);
				continue;
			}
			device_set_ivars(child, di);
		}
	}
	return (bus_generic_attach(dev));
}
static int gic_v3_ofw_bus_attach ( device_t dev ) { struct gic_v3_ofw_devinfo * di ; device_t child ; phandle_t parent , node ; pcell_t addr_cells , size_cells ; parent = ofw_bus_get_node ( dev ) ; if ( parent > 0 ) { addr_cells = 2 ; OF_getencprop ( parent , " " , & addr_cells , sizeof ( addr_cells ) ) ; size_cells = 2 ; OF_getencprop ( parent , " " , & size_cells , sizeof ( size_cells ) ) ; for ( node = OF_child ( parent ) ; node > 0 ; node = OF_peer ( node ) ) { di = malloc ( sizeof ( * di ) , M_GIC_V3 , M_WAITOK | M_ZERO ) ; if ( ofw_bus_gen_setup_devinfo ( & di -> di_dinfo , node ) ) { if ( bootverbose ) { device_printf ( dev , " \n " ) ; } free ( di , M_GIC_V3 ) ; continue ; } resource_list_init ( & di -> di_rl ) ; ofw_bus_reg_to_rl ( dev , node , addr_cells , size_cells , & di -> di_rl ) ; child = device_add_child ( dev , NULL , -1 ) ; if ( ! child ) { if ( bootverbose ) { device_printf ( dev , " \n " , di -> di_dinfo . obd_name ) ; } resource_list_free ( & di -> di_rl ) ; ofw_bus_gen_destroy_devinfo ( & di -> di_dinfo ) ; free ( di , M_GIC_V3 ) ; continue ; } device_set_ivars ( child , di ) ; } } return ( bus_generic_attach ( dev ) ) ; }
Bus capability support for GICv3.
Bus capability support for GICv3 .
/* Iterate through all GIC subordinates */ /* Allocate and populate devinfo. */ /* Initialize and populate resource list. */ /* Should not have any interrupts, so don't add any */ /* Add newbus device for this FDT node */