Add hw.fdt sysctl node.
Make FDT blob available via opaque hw.fdt.dtb sysctl, if a DTB has been installed by the time sysctls are registered. Reviewed by: andrew Approved by: sjg (mentor) Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D7411
This commit is contained in:
parent
0ba0d8a6ca
commit
a183d81dc9
@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
||||
@ -60,6 +61,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#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;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#ifndef _FDT_COMMON_H_
|
||||
#define _FDT_COMMON_H_
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/slicer.h>
|
||||
#include <contrib/libfdt/libfdt_env.h>
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
@ -80,6 +81,8 @@ extern struct fdt_pm_mask_entry fdt_pm_mask_table[];
|
||||
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 *);
|
||||
|
@ -95,6 +95,27 @@ OFW_DEF(ofw_fdt);
|
||||
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user