Lines Matching +full:a +full:- +full:child +full:- +full:node +full:- +full:property

1 /*-
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 device_t child);
109 phandle_t root, child;
116 sc->sc_addr_cells = 1;
117 OF_getencprop(root, "#address-cells", &sc->sc_addr_cells,
118 sizeof(sc->sc_addr_cells));
120 for (child = OF_child(root); child != 0; child = OF_peer(child)) {
123 if (ofw_bus_gen_setup_devinfo(dinfo, child) != 0) {
130 dinfo->obd_name);
143 ofw_cpulist_get_devinfo(device_t dev, device_t child)
145 return (device_get_ivars(child));
150 static int ofw_cpu_read_ivar(device_t dev, device_t child, int index,
186 ofw_cpu_is_runnable(phandle_t node)
189 * Per the DeviceTree Specification, a cpu node (under /cpus) that
190 * has 'status = disabled' indicates that "the CPU is in a quiescent
193 * A quiescent CPU that specifies an "enable-method", such as
194 * "spin-table", can still be used by the kernel.
196 * Lacking this, any CPU marked "disabled" or other non-okay status
199 return (ofw_bus_node_status_okay(node) ||
200 OF_hasprop(node, "enable-method"));
236 "Cannot get freq of property clocks\n");
238 sc->sc_nominal_mhz = freq / 1000000;
252 phandle_t node;
259 if (nitems(sc->sc_reg) < psc->sc_addr_cells) {
265 node = ofw_bus_get_node(dev);
267 /* Read and validate the reg property for use later */
268 sc->sc_reg_valid = false;
269 rv = OF_getencprop(node, "reg", sc->sc_reg, sizeof(sc->sc_reg));
271 device_printf(dev, "missing 'reg' property\n");
274 device_printf(dev, "Malformed reg property\n");
275 } else if ((rv / 4) != psc->sc_addr_cells) {
279 sc->sc_reg_valid = true;
283 * On powerpc, "interrupt-servers" denotes a SMT CPU. Look for any
286 if (OF_hasprop(node, "ibm,ppc-interrupt-server#s")) {
291 if ((nservers = OF_getencprop_alloc(node,
292 "ibm,ppc-interrupt-server#s", (void **)&servers)) < 0)
299 sc->sc_cpu_pcpu =
301 if (sc->sc_cpu_pcpu == NULL) {
312 if (sc->sc_cpu_pcpu == NULL) {
318 sc->sc_cpu_pcpu = pcpu_find(device_get_unit(dev));
320 if (OF_getencprop(node, "clock-frequency", &cell, sizeof(cell)) < 0) {
324 "missing 'clock-frequency' property\n");
327 sc->sc_nominal_mhz = cell / 1000000; /* convert to MHz */
329 if (sc->sc_nominal_mhz != 0 && bootverbose)
331 sc->sc_nominal_mhz);
339 ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
348 *result = (uintptr_t)sc->sc_cpu_pcpu;
351 if (sc->sc_nominal_mhz > 0) {
352 *result = (uintptr_t)sc->sc_nominal_mhz;
358 *result = psc->sc_addr_cells;
361 if (sc->sc_reg_valid) {
362 *result = (uintptr_t)sc->sc_reg;
374 phandle_t node, child;
384 node = OF_finddevice("/cpus");
385 if (node == -1)
386 return (-1);
389 if (OF_getencprop(node, "#address-cells", &addr_cells,
391 return (-1);
393 for (child = OF_child(node); child != 0; child = OF_peer(child),
395 /* Check if child is a CPU */
397 rv = OF_getprop(child, "device_type", device_type,
398 sizeof(device_type) - 1);
409 * those that have been enabled, or do provide a method
412 if (only_runnable && !ofw_cpu_is_runnable(child))
416 * Check we have a register to identify the cpu
418 rv = OF_getencprop(child, "reg", reg,
423 if (callback == NULL || callback(id, child, addr_cells, reg))