FreeBSD kernel amd64 OFW device code
openfirm.h File Reference
#include <sys/types.h>
#include <machine/_bus.h>
#include <sys/malloc.h>
#include <machine/ofw_machdep.h>
Include dependency graph for openfirm.h:
This graph shows which files directly or indirectly include this file:

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)
 

Macro Definition Documentation

◆ OFW_FDT

#define OFW_FDT   "ofw_fdt" /* Flattened Device Tree */

Definition at line 98 of file openfirm.h.

◆ OFW_STD_32BIT

#define OFW_STD_32BIT   "ofw_32bit" /* 32-bit OF interface */

Definition at line 97 of file openfirm.h.

◆ OFW_STD_DIRECT

#define OFW_STD_DIRECT   "ofw_std" /* Standard OF interface */

Definition at line 95 of file openfirm.h.

◆ OFW_STD_REAL

#define OFW_STD_REAL   "ofw_real" /* Real-mode OF interface */

Definition at line 96 of file openfirm.h.

Typedef Documentation

◆ ihandle_t

typedef uint32_t ihandle_t

Definition at line 72 of file openfirm.h.

◆ pcell_t

typedef uint32_t pcell_t

Definition at line 74 of file openfirm.h.

◆ phandle_t

typedef uint32_t phandle_t

Definition at line 73 of file openfirm.h.

Function Documentation

◆ MALLOC_DECLARE()

MALLOC_DECLARE ( M_OFWPROP  )

◆ OF_call_method()

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.

◆ OF_canon()

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.

◆ OF_child()

◆ OF_claim()

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.

◆ OF_close()

void OF_close ( ihandle_t  instance)

Definition at line 752 of file openfirm.c.

References ofw_def_impl, and ofw_obj.

◆ OF_decode_addr()

int OF_decode_addr ( phandle_t  dev,
int  regno,
bus_space_tag_t *  ptag,
bus_space_handle_t *  phandle,
bus_size_t *  sz 
)

◆ OF_device_from_xref()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OF_device_register_xref()

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().

Here is the call graph for this function:

◆ OF_enter()

void OF_enter ( void  )

Definition at line 826 of file openfirm.c.

References ofw_def_impl, and ofw_obj.

◆ OF_exit()

void OF_exit ( void  )

Definition at line 837 of file openfirm.c.

References ofw_def_impl, and ofw_obj.

◆ OF_finddevice()

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().

Here is the caller graph for this function:

◆ OF_getencprop()

◆ OF_getencprop_alloc()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OF_getencprop_alloc_multi()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OF_getprop()

ssize_t OF_getprop ( phandle_t  node,
const char *  propname,
void *  buf,
size_t  len 
)

◆ OF_getprop_alloc()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OF_getprop_alloc_multi()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OF_getproplen()

ssize_t OF_getproplen ( phandle_t  node,
const char *  propname 
)

◆ OF_hasprop()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OF_init()

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.

Here is the call graph for this function:

◆ OF_install()

boolean_t OF_install ( char *  name,
int  prio 
)

Definition at line 199 of file openfirm.c.

References ofw_def_impl.

◆ OF_instance_to_package()

phandle_t OF_instance_to_package ( ihandle_t  instance)

Definition at line 357 of file openfirm.c.

References ofw_def_impl, and ofw_obj.

Referenced by ofw_fdt_instance_to_path().

Here is the caller graph for this function:

◆ OF_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.

◆ OF_interpret()

int OF_interpret ( const char *  cmd,
int  nreturns,
  ... 
)

Definition at line 296 of file openfirm.c.

References ofw_def_impl, and ofw_obj.

◆ OF_nextprop()

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().

Here is the caller graph for this function:

◆ OF_node_from_xref()

phandle_t OF_node_from_xref ( phandle_t  xref)

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OF_open()

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().

Here is the caller graph for this function:

◆ OF_package_to_path()

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().

Here is the caller graph for this function:

◆ OF_parent()

◆ OF_peer()

◆ OF_printf()

void OF_printf ( const char *  fmt,
  ... 
)

Definition at line 271 of file openfirm.c.

References OF_putchar().

Here is the call graph for this function:

◆ OF_prop_free()

void OF_prop_free ( void *  buf)

Definition at line 524 of file openfirm.c.

Referenced by ofw_cpu_attach().

Here is the caller graph for this function:

◆ OF_read()

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().

Here is the caller graph for this function:

◆ OF_release()

void OF_release ( void *  virt,
size_t  size 
)

Definition at line 811 of file openfirm.c.

References ofw_def_impl, ofw_obj, and size.

◆ OF_searchencprop()

ssize_t OF_searchencprop ( phandle_t  node,
const char *  propname,
pcell_t buf,
size_t  len 
)

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OF_searchprop()

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().

Here is the call graph for this function:

◆ OF_seek()

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().

Here is the caller graph for this function:

◆ OF_setprop()

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().

Here is the caller graph for this function:

◆ OF_test()

int OF_test ( const char *  name)

Definition at line 286 of file openfirm.c.

References ofw_def_impl, and ofw_obj.

◆ OF_write()

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().

Here is the caller graph for this function:

◆ OF_xref_from_device()

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().

Here is the call graph for this function:

◆ OF_xref_from_node()

phandle_t OF_xref_from_node ( phandle_t  node)

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().

Here is the call graph for this function:
Here is the caller graph for this function: