FreeBSD kernel amd64 OFW device code
|
#include <sys/types.h>
#include <machine/_bus.h>
#include <sys/malloc.h>
#include <machine/ofw_machdep.h>
Go to the source code of this file.
Macros | |
#define | OFW_STD_DIRECT "ofw_std" /* Standard OF interface */ |
#define | OFW_STD_REAL "ofw_real" /* Real-mode OF interface */ |
#define | OFW_STD_32BIT "ofw_32bit" /* 32-bit OF interface */ |
#define | OFW_FDT "ofw_fdt" /* Flattened Device Tree */ |
Typedefs | |
typedef uint32_t | ihandle_t |
typedef uint32_t | phandle_t |
typedef uint32_t | pcell_t |
Functions | |
MALLOC_DECLARE (M_OFWPROP) | |
boolean_t | OF_install (char *name, int prio) |
int | OF_init (void *cookie) |
int | OF_test (const char *name) |
void | OF_printf (const char *fmt,...) |
phandle_t | OF_peer (phandle_t node) |
phandle_t | OF_child (phandle_t node) |
phandle_t | OF_parent (phandle_t node) |
ssize_t | OF_getproplen (phandle_t node, const char *propname) |
ssize_t | OF_getprop (phandle_t node, const char *propname, void *buf, size_t len) |
ssize_t | OF_getencprop (phandle_t node, const char *prop, pcell_t *buf, size_t len) |
int | OF_hasprop (phandle_t node, const char *propname) |
ssize_t | OF_searchprop (phandle_t node, const char *propname, void *buf, size_t len) |
ssize_t | OF_searchencprop (phandle_t node, const char *propname, pcell_t *buf, size_t len) |
ssize_t | OF_getprop_alloc (phandle_t node, const char *propname, void **buf) |
ssize_t | OF_getprop_alloc_multi (phandle_t node, const char *propname, int elsz, void **buf) |
ssize_t | OF_getencprop_alloc (phandle_t node, const char *propname, void **buf) |
ssize_t | OF_getencprop_alloc_multi (phandle_t node, const char *propname, int elsz, void **buf) |
void | OF_prop_free (void *buf) |
int | OF_nextprop (phandle_t node, const char *propname, char *buf, size_t len) |
int | OF_setprop (phandle_t node, const char *name, const void *buf, size_t len) |
ssize_t | OF_canon (const char *path, char *buf, size_t len) |
phandle_t | OF_finddevice (const char *path) |
ssize_t | OF_package_to_path (phandle_t node, char *buf, size_t len) |
phandle_t | OF_node_from_xref (phandle_t xref) |
phandle_t | OF_xref_from_node (phandle_t node) |
device_t | OF_device_from_xref (phandle_t xref) |
phandle_t | OF_xref_from_device (device_t dev) |
int | OF_device_register_xref (phandle_t xref, device_t dev) |
ihandle_t | OF_open (const char *path) |
void | OF_close (ihandle_t instance) |
ssize_t | OF_read (ihandle_t instance, void *buf, size_t len) |
ssize_t | OF_write (ihandle_t instance, const void *buf, size_t len) |
int | OF_seek (ihandle_t instance, uint64_t where) |
phandle_t | OF_instance_to_package (ihandle_t instance) |
ssize_t | OF_instance_to_path (ihandle_t instance, char *buf, size_t len) |
int | OF_call_method (const char *method, ihandle_t instance, int nargs, int nreturns,...) |
void * | OF_claim (void *virtrequest, size_t size, u_int align) |
void | OF_release (void *virt, size_t size) |
void | OF_enter (void) |
void | OF_exit (void) __attribute__((noreturn)) |
int | OF_interpret (const char *cmd, int nreturns,...) |
int | OF_decode_addr (phandle_t dev, int regno, bus_space_tag_t *ptag, bus_space_handle_t *phandle, bus_size_t *sz) |
#define OFW_FDT "ofw_fdt" /* Flattened Device Tree */ |
Definition at line 98 of file openfirm.h.
#define OFW_STD_32BIT "ofw_32bit" /* 32-bit OF interface */ |
Definition at line 97 of file openfirm.h.
#define OFW_STD_DIRECT "ofw_std" /* Standard OF interface */ |
Definition at line 95 of file openfirm.h.
#define OFW_STD_REAL "ofw_real" /* Real-mode OF interface */ |
Definition at line 96 of file openfirm.h.
typedef uint32_t ihandle_t |
Definition at line 72 of file openfirm.h.
typedef uint32_t pcell_t |
Definition at line 74 of file openfirm.h.
typedef uint32_t phandle_t |
Definition at line 73 of file openfirm.h.
MALLOC_DECLARE | ( | M_OFWPROP | ) |
int OF_call_method | ( | const char * | method, |
ihandle_t | instance, | ||
int | nargs, | ||
int | nreturns, | ||
... | |||
) |
Definition at line 711 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
ssize_t OF_canon | ( | const char * | path, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 554 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Definition at line 335 of file openfirm.c.
References xrefinfo::node, ofw_def_impl, and ofw_obj.
Referenced by OF_child_xref_phandle(), ofw_bus_find_child(), ofw_bus_find_compatible(), ofw_cpu_early_foreach(), ofw_cpulist_attach(), ofw_graph_get_endpoint_by_idx(), ofw_graph_get_port_by_idx(), ofw_graph_port_get_num_endpoints(), ofw_pcib_init(), ofwbus_attach(), openfirm_checkid(), and openfirm_ioctl().
void * OF_claim | ( | void * | virtrequest, |
size_t | size, | ||
u_int | align | ||
) |
Definition at line 800 of file openfirm.c.
References ofw_def_impl, ofw_obj, and size.
void OF_close | ( | ihandle_t | instance | ) |
Definition at line 752 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
int OF_decode_addr | ( | phandle_t | dev, |
int | regno, | ||
bus_space_tag_t * | ptag, | ||
bus_space_handle_t * | phandle, | ||
bus_size_t * | sz | ||
) |
device_t OF_device_from_xref | ( | phandle_t | xref | ) |
Definition at line 663 of file openfirm.c.
References xrefinfo::dev, FIND_BY_XREF, xrefinfo::xref, and xrefinfo_find().
Referenced by ofw_graph_get_device_by_port_ep().
int OF_device_register_xref | ( | phandle_t | xref, |
device_t | dev | ||
) |
Definition at line 689 of file openfirm.c.
References dev, xrefinfo::dev, FIND_BY_XREF, xrefinfo::xref, xrefinfo_add(), and xrefinfo_find().
void OF_enter | ( | void | ) |
Definition at line 826 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
void OF_exit | ( | void | ) |
Definition at line 837 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
phandle_t OF_finddevice | ( | const char * | path | ) |
Definition at line 565 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by cn_drvinit(), g_ofwd_init(), OF_init(), ofw_cnprobe(), ofw_cpu_early_foreach(), ofw_parse_bootargs(), and openfirm_ioctl().
Definition at line 397 of file openfirm.c.
References xrefinfo::node, and OF_getprop().
Referenced by get_addr_props(), OF_child_xref_phandle(), OF_init(), OF_searchencprop(), OF_xref_from_node(), ofw_bus_lookup_imap(), ofw_bus_msimap(), ofw_bus_parse_xref_list_internal(), ofw_bus_search_intrmap(), ofw_bus_setup_iinfo(), ofw_cnprobe(), ofw_cpu_attach(), ofw_cpu_early_foreach(), ofw_cpulist_attach(), ofw_graph_get_endpoint_by_idx(), ofw_graph_get_port_by_idx(), ofw_graph_get_remote_endpoint(), ofw_pcib_fill_ranges(), ofw_pcib_init(), ofw_pcib_nranges(), and ofw_reg_to_paddr().
ssize_t OF_getencprop_alloc | ( | phandle_t | node, |
const char * | propname, | ||
void ** | buf | ||
) |
Definition at line 492 of file openfirm.c.
References OF_getencprop_alloc_multi().
Referenced by ofw_bus_setup_iinfo(), and ofw_cpu_attach().
ssize_t OF_getencprop_alloc_multi | ( | phandle_t | node, |
const char * | propname, | ||
int | elsz, | ||
void ** | buf | ||
) |
Definition at line 505 of file openfirm.c.
References OF_getprop_alloc_multi().
Referenced by OF_getencprop_alloc(), ofw_bus_intr_by_rid(), ofw_bus_intr_to_rl(), ofw_bus_msimap(), ofw_bus_parse_xref_list_internal(), and ofw_bus_reg_to_rl_helper().
ssize_t OF_getprop | ( | phandle_t | node, |
const char * | propname, | ||
void * | buf, | ||
size_t | len | ||
) |
Definition at line 387 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by cn_drvinit(), g_ofwd_init(), get_addr_props(), OF_getencprop(), OF_getprop_alloc(), OF_getprop_alloc_multi(), OF_searchprop(), ofw_bus_node_is_compatible(), ofw_bus_node_status_okay(), ofw_cpu_early_foreach(), ofw_parse_bootargs(), and openfirm_ioctl().
ssize_t OF_getprop_alloc | ( | phandle_t | node, |
const char * | propname, | ||
void ** | buf | ||
) |
Definition at line 446 of file openfirm.c.
References OF_getprop(), and OF_getproplen().
Referenced by ofw_bus_find_child(), ofw_bus_find_string_index(), ofw_bus_gen_setup_devinfo(), ofw_bus_reg_to_rl_helper(), ofw_bus_string_list_to_array(), ofw_graph_get_remote_parent(), and ofw_graph_port_get_num_endpoints().
ssize_t OF_getprop_alloc_multi | ( | phandle_t | node, |
const char * | propname, | ||
int | elsz, | ||
void ** | buf | ||
) |
Definition at line 471 of file openfirm.c.
References OF_getprop(), and OF_getproplen().
Referenced by OF_getencprop_alloc_multi().
ssize_t OF_getproplen | ( | phandle_t | node, |
const char * | propname | ||
) |
Definition at line 368 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by OF_getprop_alloc(), OF_getprop_alloc_multi(), OF_hasprop(), ofw_bus_is_compatible(), ofw_bus_node_is_compatible(), ofw_bus_node_status_okay(), ofw_pcib_fill_ranges(), ofw_pcib_nranges(), and openfirm_ioctl().
int OF_hasprop | ( | phandle_t | node, |
const char * | propname | ||
) |
Definition at line 379 of file openfirm.c.
References OF_getproplen().
Referenced by ofw_bus_find_iparent(), ofw_bus_has_prop(), ofw_cpu_attach(), and ofw_cpu_early_foreach().
int OF_init | ( | void * | cookie | ) |
Definition at line 230 of file openfirm.c.
References OF_finddevice(), OF_getencprop(), ofw_def_impl, ofw_kernel_kops, ofw_kernel_obj, ofw_obj, and stdout.
boolean_t OF_install | ( | char * | name, |
int | prio | ||
) |
Definition at line 199 of file openfirm.c.
References ofw_def_impl.
Definition at line 357 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by ofw_fdt_instance_to_path().
ssize_t OF_instance_to_path | ( | ihandle_t | instance, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 576 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
int OF_interpret | ( | const char * | cmd, |
int | nreturns, | ||
... | |||
) |
Definition at line 296 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
int OF_nextprop | ( | phandle_t | node, |
const char * | propname, | ||
char * | buf, | ||
size_t | len | ||
) |
Definition at line 532 of file openfirm.c.
References ofw_def_impl, ofw_obj, and size.
Referenced by openfirm_ioctl().
Definition at line 627 of file openfirm.c.
References FIND_BY_XREF, xrefinfo::node, OF_child_xref_phandle(), OF_peer(), xrefinfo::xref, and xrefinfo_find().
Referenced by ofw_bus_intr_by_rid(), ofw_bus_intr_to_rl(), ofw_bus_parse_xref_list_internal(), ofw_bus_search_intrmap(), ofw_fdt_instance_to_package(), and ofw_graph_get_remote_parent().
ihandle_t OF_open | ( | const char * | path | ) |
Definition at line 741 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by g_ofwd_init().
ssize_t OF_package_to_path | ( | phandle_t | node, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 587 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by g_ofwd_init(), and ofw_fdt_instance_to_path().
Definition at line 346 of file openfirm.c.
References xrefinfo::node, ofw_def_impl, and ofw_obj.
Referenced by OF_searchencprop(), OF_searchprop(), ofw_bus_find_iparent(), ofw_bus_intr_by_rid(), ofw_bus_intr_to_rl(), ofw_graph_get_remote_parent(), ofw_pcib_fill_ranges(), ofw_pcib_nranges(), and ofw_reg_to_paddr().
Definition at line 324 of file openfirm.c.
References xrefinfo::node, ofw_def_impl, and ofw_obj.
Referenced by OF_child_xref_phandle(), OF_node_from_xref(), ofw_bus_find_child(), ofw_bus_find_compatible(), ofw_cpu_early_foreach(), ofw_cpulist_attach(), ofw_graph_get_endpoint_by_idx(), ofw_graph_get_port_by_idx(), ofw_graph_port_get_num_endpoints(), ofw_pcib_init(), ofwbus_attach(), ofwbus_identify(), ofwbus_probe(), openfirm_checkid(), openfirm_ioctl(), and xrefinfo_init().
void OF_printf | ( | const char * | fmt, |
... | |||
) |
Definition at line 271 of file openfirm.c.
References OF_putchar().
void OF_prop_free | ( | void * | buf | ) |
Definition at line 524 of file openfirm.c.
Referenced by ofw_cpu_attach().
ssize_t OF_read | ( | ihandle_t | instance, |
void * | buf, | ||
size_t | len | ||
) |
Definition at line 763 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by ofw_cngetc(), and ofwd_startio().
void OF_release | ( | void * | virt, |
size_t | size | ||
) |
Definition at line 811 of file openfirm.c.
References ofw_def_impl, ofw_obj, and size.
Definition at line 431 of file openfirm.c.
References xrefinfo::node, OF_getencprop(), and OF_parent().
Referenced by ofw_bus_find_iparent(), ofw_bus_intr_by_rid(), ofw_bus_intr_to_rl(), and ofw_bus_search_intrmap().
ssize_t OF_searchprop | ( | phandle_t | node, |
const char * | propname, | ||
void * | buf, | ||
size_t | len | ||
) |
Definition at line 420 of file openfirm.c.
References xrefinfo::node, OF_getprop(), and OF_parent().
int OF_seek | ( | ihandle_t | instance, |
uint64_t | where | ||
) |
Definition at line 785 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by ofwd_startio().
int OF_setprop | ( | phandle_t | node, |
const char * | name, | ||
const void * | buf, | ||
size_t | len | ||
) |
Definition at line 543 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by openfirm_ioctl().
int OF_test | ( | const char * | name | ) |
Definition at line 286 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
ssize_t OF_write | ( | ihandle_t | instance, |
const void * | buf, | ||
size_t | len | ||
) |
Definition at line 774 of file openfirm.c.
References ofw_def_impl, and ofw_obj.
Referenced by OF_putchar(), ofw_cnputc(), ofwd_startio(), and ofwtty_outwakeup().
phandle_t OF_xref_from_device | ( | device_t | dev | ) |
Definition at line 676 of file openfirm.c.
References dev, FIND_BY_DEV, xrefinfo::xref, and xrefinfo_find().
Definition at line 644 of file openfirm.c.
References FIND_BY_NODE, xrefinfo::node, OF_getencprop(), xrefinfo::xref, and xrefinfo_find().
Referenced by ofw_bus_find_iparent(), ofw_bus_intr_by_rid(), ofw_bus_intr_to_rl(), and ofw_graph_get_device_by_port_ep().