Author: gber Date: Fri Sep 14 09:36:35 2012 New Revision: 240485 URL: http://svn.freebsd.org/changeset/base/240485
Log: Add fdt_get_unit() function. Obtained from: Semihalf Modified: head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_common.h Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Fri Sep 14 09:33:35 2012 (r240484) +++ head/sys/dev/fdt/fdt_common.c Fri Sep 14 09:36:35 2012 (r240485) @@ -697,3 +697,14 @@ fdt_get_mem_regions(struct mem_region *m out: return (rv); } + +int +fdt_get_unit(device_t dev) +{ + const char * name; + + name = ofw_bus_get_name(dev); + name = strchr(name, '@') + 1; + + return (strtol(name,NULL,0)); +} Modified: head/sys/dev/fdt/fdt_common.h ============================================================================== --- head/sys/dev/fdt/fdt_common.h Fri Sep 14 09:33:35 2012 (r240484) +++ head/sys/dev/fdt/fdt_common.h Fri Sep 14 09:36:35 2012 (r240485) @@ -110,5 +110,6 @@ int fdt_pci_route_intr(int, int, int, in int fdt_ranges_verify(pcell_t *, int, int, int, int); int fdt_reg_to_rl(phandle_t, struct resource_list *); int fdt_pm(phandle_t); +int fdt_get_unit(device_t); #endif /* _FDT_COMMON_H_ */ _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"