Add fdt_get_unit() function.

Obtained from:	Semihalf
This commit is contained in:
gber 2012-09-14 09:36:35 +00:00
parent 5dd175c3fd
commit 5208b599ff
2 changed files with 12 additions and 0 deletions

View File

@ -697,3 +697,14 @@ fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint32_t *memsize)
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));
}

View File

@ -110,5 +110,6 @@ int fdt_pci_route_intr(int, int, int, int, struct fdt_pci_intr *, int *);
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_ */