Date: Sat, 9 Jan 2010 21:03:19 GMT From: Rafal Jaworowski <raj@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 172869 for review Message-ID: <201001092103.o09L3JH6027487@repoman.freebsd.org>
index | next in thread | raw e-mail
http://p4web.freebsd.org/chv.cgi?CH=172869 Change 172869 by raj@raj_fdt on 2010/01/09 21:03:08 Respect 'status' property if present in the node. Do not instantiate a device unless status == okay. Affected files ... .. //depot/projects/fdt/sys/dev/fdt/fdt_common.c#3 edit .. //depot/projects/fdt/sys/dev/fdt/fdt_common.h#2 edit .. //depot/projects/fdt/sys/dev/fdt/fdtbus.c#2 edit .. //depot/projects/fdt/sys/dev/fdt/simplebus.c#2 edit Differences ... ==== //depot/projects/fdt/sys/dev/fdt/fdt_common.c#3 (text+ko) ==== @@ -59,6 +59,28 @@ #endif int +fdt_is_enabled(phandle_t node) +{ + char *stat; + int ena, len; + + len = OF_getprop_alloc(node, "status", sizeof(char), + (void **)&stat); + + if (len <= 0) + /* It is OK if no 'status' property. */ + return (1); + + /* Anything other than 'okay' means disabled. */ + ena = 0; + if (strncmp((char *)stat, "okay", len) == 0) + ena = 1; + + free(stat, M_OFWPROP); + return (ena); +} + +int fdt_parent_addr_cells(phandle_t node) { pcell_t addr_cells; ==== //depot/projects/fdt/sys/dev/fdt/fdt_common.h#2 (text+ko) ==== @@ -47,5 +47,6 @@ int fdt_reg_to_rl(phandle_t, struct resource_list *, u_long); int fdt_intr_to_rl(phandle_t, struct resource_list *, struct sense_level *); int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *); +int fdt_is_enabled(phandle_t); #endif /* FDT_COMMON_H */ ==== //depot/projects/fdt/sys/dev/fdt/fdtbus.c#2 (text+ko) ==== @@ -213,8 +213,13 @@ /* * Walk the FDT root node and add top-level devices as our children. */ - for (child = OF_child(root); child != 0; child = OF_peer(child)) + for (child = OF_child(root); child != 0; child = OF_peer(child)) { + /* Check and process 'status' property. */ + if (!(fdt_is_enabled(child))) + continue; + newbus_device_from_fdt_node(dev, child); + } return (bus_generic_attach(dev)); } ==== //depot/projects/fdt/sys/dev/fdt/simplebus.c#2 (text+ko) ==== @@ -163,6 +163,7 @@ len = OF_getprop_alloc(root, "model", 1, (void **)&model); if (len <= 0) return; + /* XXX this should be a table with {model->fixup_handler} */ if (!(strcmp(model, "fsl,MPC8572DS") == 0 || strcmp(model, "MPC8555CDS") == 0)) goto out; @@ -248,6 +249,10 @@ */ for (child = OF_child(node); child != 0; child = OF_peer(child)) { + /* Check and process 'status' property. */ + if (!(fdt_is_enabled(child))) + continue; + di = malloc(sizeof(*di), M_SIMPLEBUS, M_WAITOK | M_ZERO); if (ofw_bus_gen_setup_devinfo(&di->di_ofw, child) != 0) { @@ -317,8 +322,6 @@ struct simplebus_devinfo *di; struct resource_list_entry *rle; - debugf("type = %d, rid = %d\n", type, *rid); - /* * Request for the default allocation with a given rid: use resource * list stored in the local device info.help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001092103.o09L3JH6027487>
