Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/gic_v3_fdt.c
| Show First 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | if (bootverbose) { | ||||
| device_printf(dev, | device_printf(dev, | ||||
| "Failed to attach ITS to this GIC\n"); | "Failed to attach ITS to this GIC\n"); | ||||
| } | } | ||||
| } | } | ||||
| if (device_get_children(dev, &sc->gic_children, &sc->gic_nchildren) != 0) | if (device_get_children(dev, &sc->gic_children, &sc->gic_nchildren) != 0) | ||||
| sc->gic_nchildren = 0; | sc->gic_nchildren = 0; | ||||
| gic_v3_alloc_maint_res(dev); | |||||
| return (err); | return (err); | ||||
| error: | error: | ||||
| if (bootverbose) { | if (bootverbose) { | ||||
| device_printf(dev, | device_printf(dev, | ||||
| "Failed to attach. Error %d\n", err); | "Failed to attach. Error %d\n", err); | ||||
| } | } | ||||
| /* Failure so free resources */ | /* Failure so free resources */ | ||||
| gic_v3_detach(dev); | gic_v3_detach(dev); | ||||
| return (err); | return (err); | ||||
| } | } | ||||
| /* OFW bus interface */ | /* OFW bus interface */ | ||||
| struct gic_v3_ofw_devinfo { | struct gic_v3_ofw_devinfo { | ||||
| struct gic_v3_devinfo di_gic_dinfo; | struct gic_v3_devinfo di_gic_dinfo; | ||||
| struct ofw_bus_devinfo di_dinfo; | struct ofw_bus_devinfo di_dinfo; | ||||
| struct resource_list di_rl; | struct resource_list di_rl; | ||||
| }; | }; | ||||
| static int | static int | ||||
| gic_v3_fdt_print_child(device_t bus, device_t child) | gic_v3_fdt_print_child(device_t bus, device_t child) | ||||
| { | { | ||||
| struct gic_v3_ofw_devinfo *di = device_get_ivars(child); | struct gic_v3_ofw_devinfo *di; | ||||
| struct resource_list *rl = &di->di_rl; | struct resource_list *rl; | ||||
| int retval = 0; | int retval = 0; | ||||
| retval += bus_print_child_header(bus, child); | retval += bus_print_child_header(bus, child); | ||||
| di = device_get_ivars(child); | |||||
| if (di == NULL) | |||||
| goto footer; | |||||
| rl = &di->di_rl; | |||||
| retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx"); | retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx"); | ||||
| footer: | |||||
| retval += bus_print_child_footer(bus, child); | retval += bus_print_child_footer(bus, child); | ||||
| return (retval); | return (retval); | ||||
| } | } | ||||
| static const struct ofw_bus_devinfo * | static const struct ofw_bus_devinfo * | ||||
| gic_v3_ofw_get_devinfo(device_t bus __unused, device_t child) | gic_v3_ofw_get_devinfo(device_t bus __unused, device_t child) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | gic_v3_ofw_bus_attach(device_t dev) | ||||
| parent = ofw_bus_get_node(dev); | parent = ofw_bus_get_node(dev); | ||||
| if (parent > 0) { | if (parent > 0) { | ||||
| addr_cells = 2; | addr_cells = 2; | ||||
| OF_getencprop(parent, "#address-cells", &addr_cells, | OF_getencprop(parent, "#address-cells", &addr_cells, | ||||
| sizeof(addr_cells)); | sizeof(addr_cells)); | ||||
| size_cells = 2; | size_cells = 2; | ||||
| OF_getencprop(parent, "#size-cells", &size_cells, | OF_getencprop(parent, "#size-cells", &size_cells, | ||||
| sizeof(size_cells)); | sizeof(size_cells)); | ||||
| /* Iterate through all GIC subordinates */ | /* Iterate through all GIC subordinates */ | ||||
| for (node = OF_child(parent); node > 0; node = OF_peer(node)) { | for (node = OF_child(parent); node > 0; node = OF_peer(node)) { | ||||
| /* Allocate and populate devinfo. */ | /* Allocate and populate devinfo. */ | ||||
| di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO); | di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO); | ||||
| /* Read the numa node, or -1 if there is none */ | /* Read the numa node, or -1 if there is none */ | ||||
| if (OF_getencprop(node, "numa-node-id", | if (OF_getencprop(node, "numa-node-id", | ||||
| &di->di_gic_dinfo.gic_domain, | &di->di_gic_dinfo.gic_domain, | ||||
| ▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines | |||||