Index: head/sys/dev/fdt/fdt_common.h =================================================================== --- head/sys/dev/fdt/fdt_common.h +++ head/sys/dev/fdt/fdt_common.h @@ -32,6 +32,7 @@ #ifndef _FDT_COMMON_H_ #define _FDT_COMMON_H_ +#include #include #include #include @@ -80,6 +81,8 @@ extern u_char fdt_static_dtb; #endif +SYSCTL_DECL(_hw_fdt); + int fdt_addrsize_cells(phandle_t, int *, int *); u_long fdt_data_get(void *, int); int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *); Index: head/sys/dev/fdt/fdt_common.c =================================================================== --- head/sys/dev/fdt/fdt_common.c +++ head/sys/dev/fdt/fdt_common.c @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -60,6 +61,8 @@ #define FDT_REG_CELLS 4 +SYSCTL_NODE(_hw, OID_AUTO, fdt, CTLFLAG_RD, 0, "Flattened Device Tree"); + vm_paddr_t fdt_immr_pa; vm_offset_t fdt_immr_va; vm_offset_t fdt_immr_size; Index: head/sys/dev/ofw/ofw_fdt.c =================================================================== --- head/sys/dev/ofw/ofw_fdt.c +++ head/sys/dev/ofw/ofw_fdt.c @@ -96,6 +96,27 @@ static void *fdtp = NULL; static int +sysctl_handle_dtb(SYSCTL_HANDLER_ARGS) +{ + + return (sysctl_handle_opaque(oidp, fdtp, fdt_totalsize(fdtp), req)); +} + +static void +sysctl_register_fdt_oid(void *arg) +{ + + /* If there is no FDT registered, skip adding the sysctl */ + if (fdtp == NULL) + return; + + SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_fdt), OID_AUTO, "dtb", + CTLTYPE_OPAQUE | CTLFLAG_RD, NULL, 0, sysctl_handle_dtb, "", + "Device Tree Blob"); +} +SYSINIT(dtb_oid, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_register_fdt_oid, 0); + +static int ofw_fdt_init(ofw_t ofw, void *data) { int err;