FreeBSD kernel amd64 OFW device code
ofw_bus_subr.h File Reference
#include <sys/bus.h>
#include <dev/ofw/openfirm.h>
#include "ofw_bus_if.h"
Include dependency graph for ofw_bus_subr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ofw_bus_iinfo
 
struct  ofw_compat_data
 

Macros

#define ORIP_NOINT   -1
 
#define ORIR_NOTFOUND   0xffffffff
 
#define FDTCOMPAT_PNP_DESCR   "Z:compat;P:#;"
 
#define FDTCOMPAT_PNP_INFO(t, busname)    MODULE_PNP_INFO(FDTCOMPAT_PNP_DESCR, busname, t, t, sizeof(t) / sizeof(t[0]));
 
#define OFWBUS_PNP_INFO(t)   FDTCOMPAT_PNP_INFO(t, ofwbus)
 
#define SIMPLEBUS_PNP_INFO(t)   FDTCOMPAT_PNP_INFO(t, simplebus)
 

Functions

int ofw_bus_gen_setup_devinfo (struct ofw_bus_devinfo *, phandle_t)
 
void ofw_bus_gen_destroy_devinfo (struct ofw_bus_devinfo *)
 
void ofw_bus_setup_iinfo (phandle_t, struct ofw_bus_iinfo *, int)
 
int ofw_bus_lookup_imap (phandle_t, struct ofw_bus_iinfo *, void *, int, void *, int, void *, int, phandle_t *)
 
int ofw_bus_search_intrmap (void *, int, void *, int, void *, int, void *, void *, void *, int, phandle_t *)
 
int ofw_bus_msimap (phandle_t, uint16_t, phandle_t *, uint32_t *)
 
int ofw_bus_reg_to_rl (device_t, phandle_t, pcell_t, pcell_t, struct resource_list *)
 
int ofw_bus_assigned_addresses_to_rl (device_t, phandle_t, pcell_t, pcell_t, struct resource_list *)
 
int ofw_bus_intr_to_rl (device_t, phandle_t, struct resource_list *, int *)
 
int ofw_bus_intr_by_rid (device_t, phandle_t, int, phandle_t *, int *, pcell_t **)
 
const char * ofw_bus_get_status (device_t dev)
 
int ofw_bus_status_okay (device_t dev)
 
int ofw_bus_node_status_okay (phandle_t node)
 
phandle_t ofw_bus_find_iparent (phandle_t)
 
int ofw_bus_is_compatible (device_t, const char *)
 
int ofw_bus_is_compatible_strict (device_t, const char *)
 
int ofw_bus_node_is_compatible (phandle_t, const char *)
 
const struct ofw_compat_dataofw_bus_search_compatible (device_t, const struct ofw_compat_data *)
 
int ofw_bus_has_prop (device_t, const char *)
 
phandle_t ofw_bus_find_compatible (phandle_t, const char *)
 
phandle_t ofw_bus_find_child (phandle_t, const char *)
 
device_t ofw_bus_find_child_device_by_phandle (device_t bus, phandle_t node)
 Return child of bus whose phandle is node. More...
 
int ofw_bus_parse_xref_list_alloc (phandle_t node, const char *list_name, const char *cells_name, int idx, phandle_t *producer, int *ncells, pcell_t **cells)
 
int ofw_bus_parse_xref_list_get_length (phandle_t node, const char *list_name, const char *cells_name, int *count)
 
int ofw_bus_find_string_index (phandle_t node, const char *list_name, const char *name, int *idx)
 
int ofw_bus_string_list_to_array (phandle_t node, const char *list_name, const char ***array)
 

Variables

ofw_bus_get_compat_t ofw_bus_gen_get_compat
 
ofw_bus_get_model_t ofw_bus_gen_get_model
 
ofw_bus_get_name_t ofw_bus_gen_get_name
 
ofw_bus_get_node_t ofw_bus_gen_get_node
 
ofw_bus_get_type_t ofw_bus_gen_get_type
 
bus_child_pnpinfo_t ofw_bus_gen_child_pnpinfo
 

Macro Definition Documentation

◆ FDTCOMPAT_PNP_DESCR

#define FDTCOMPAT_PNP_DESCR   "Z:compat;P:#;"

Definition at line 68 of file ofw_bus_subr.h.

◆ FDTCOMPAT_PNP_INFO

#define FDTCOMPAT_PNP_INFO (   t,
  busname 
)     MODULE_PNP_INFO(FDTCOMPAT_PNP_DESCR, busname, t, t, sizeof(t) / sizeof(t[0]));

Definition at line 69 of file ofw_bus_subr.h.

◆ OFWBUS_PNP_INFO

#define OFWBUS_PNP_INFO (   t)    FDTCOMPAT_PNP_INFO(t, ofwbus)

Definition at line 72 of file ofw_bus_subr.h.

◆ ORIP_NOINT

#define ORIP_NOINT   -1

Definition at line 44 of file ofw_bus_subr.h.

◆ ORIR_NOTFOUND

#define ORIR_NOTFOUND   0xffffffff

Definition at line 45 of file ofw_bus_subr.h.

◆ SIMPLEBUS_PNP_INFO

#define SIMPLEBUS_PNP_INFO (   t)    FDTCOMPAT_PNP_INFO(t, simplebus)

Definition at line 73 of file ofw_bus_subr.h.

Function Documentation

◆ ofw_bus_assigned_addresses_to_rl()

int ofw_bus_assigned_addresses_to_rl ( device_t  dev,
phandle_t  node,
pcell_t  acells,
pcell_t  scells,
struct resource_list *  rl 
)

Definition at line 552 of file ofw_bus_subr.c.

References dev, and ofw_bus_reg_to_rl_helper().

Here is the call graph for this function:

◆ ofw_bus_find_child()

phandle_t ofw_bus_find_child ( phandle_t  start,
const char *  child_name 
)

Definition at line 719 of file ofw_bus_subr.c.

References child, OF_child(), OF_getprop_alloc(), and OF_peer().

Referenced by ofw_graph_get_endpoint_by_idx(), and ofw_graph_get_port_by_idx().

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

◆ ofw_bus_find_child_device_by_phandle()

device_t ofw_bus_find_child_device_by_phandle ( device_t  bus,
phandle_t  node 
)

Return child of bus whose phandle is node.

A direct child of will be returned if it its phandle in the OFW tree is node. Otherwise, NULL is returned.

Parameters
busThe bus to examine
nodeThe phandle_t to look for.

Definition at line 770 of file ofw_bus_subr.c.

References child.

◆ ofw_bus_find_compatible()

phandle_t ofw_bus_find_compatible ( phandle_t  node,
const char *  onecompat 
)

Definition at line 741 of file ofw_bus_subr.c.

References child, OF_child(), OF_peer(), ofw_bus_find_compatible(), and ofw_bus_node_is_compatible().

Referenced by ofw_bus_find_compatible().

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

◆ ofw_bus_find_iparent()

phandle_t ofw_bus_find_iparent ( phandle_t  node)

Definition at line 565 of file ofw_bus_subr.c.

References iparent, OF_hasprop(), OF_parent(), OF_searchencprop(), and OF_xref_from_node().

Referenced by ofw_bus_intr_by_rid(), and ofw_bus_intr_to_rl().

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

◆ ofw_bus_find_string_index()

int ofw_bus_find_string_index ( phandle_t  node,
const char *  list_name,
const char *  name,
int *  idx 
)

Definition at line 915 of file ofw_bus_subr.c.

References OF_getprop_alloc().

Here is the call graph for this function:

◆ ofw_bus_gen_destroy_devinfo()

void ofw_bus_gen_destroy_devinfo ( struct ofw_bus_devinfo *  obd)

Definition at line 72 of file ofw_bus_subr.c.

Referenced by ofw_cpulist_attach().

Here is the caller graph for this function:

◆ ofw_bus_gen_setup_devinfo()

int ofw_bus_gen_setup_devinfo ( struct ofw_bus_devinfo *  obd,
phandle_t  node 
)

Definition at line 55 of file ofw_bus_subr.c.

References OF_getprop_alloc().

Referenced by ofw_cpulist_attach(), and ofwbus_attach().

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

◆ ofw_bus_get_status()

const char * ofw_bus_get_status ( device_t  dev)

Definition at line 163 of file ofw_bus_subr.c.

References dev.

Referenced by ofw_bus_status_okay().

Here is the caller graph for this function:

◆ ofw_bus_has_prop()

int ofw_bus_has_prop ( device_t  dev,
const char *  propname 
)

Definition at line 303 of file ofw_bus_subr.c.

References dev, OF_hasprop(), and ofw_bus_get_node().

Here is the call graph for this function:

◆ ofw_bus_intr_by_rid()

int ofw_bus_intr_by_rid ( device_t  dev,
phandle_t  node,
int  wanted_rid,
phandle_t producer,
int *  ncells,
pcell_t **  cells 
)

Definition at line 648 of file ofw_bus_subr.c.

References dev, icells, iparent, OF_getencprop_alloc_multi(), OF_node_from_xref(), OF_parent(), OF_searchencprop(), OF_xref_from_node(), and ofw_bus_find_iparent().

Here is the call graph for this function:

◆ ofw_bus_intr_to_rl()

int ofw_bus_intr_to_rl ( device_t  dev,
phandle_t  node,
struct resource_list *  rl,
int *  rlen 
)

◆ ofw_bus_is_compatible()

int ofw_bus_is_compatible ( device_t  dev,
const char *  onecompat 
)

Definition at line 251 of file ofw_bus_subr.c.

References dev, OF_getproplen(), ofw_bus_get_compat(), ofw_bus_get_node(), and ofw_bus_node_is_compatible_int().

Referenced by ofw_bus_search_compatible().

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

◆ ofw_bus_is_compatible_strict()

int ofw_bus_is_compatible_strict ( device_t  dev,
const char *  compatible 
)

Definition at line 271 of file ofw_bus_subr.c.

References dev, and ofw_bus_get_compat().

Here is the call graph for this function:

◆ ofw_bus_lookup_imap()

int ofw_bus_lookup_imap ( phandle_t  node,
struct ofw_bus_iinfo ii,
void *  reg,
int  regsz,
void *  pintr,
int  pintrsz,
void *  mintr,
int  mintrsz,
phandle_t iparent 
)

Definition at line 339 of file ofw_bus_subr.c.

References iparent, OF_getencprop(), ofw_bus_search_intrmap(), ofw_bus_iinfo::opi_addrc, ofw_bus_iinfo::opi_imap, ofw_bus_iinfo::opi_imapmsk, and ofw_bus_iinfo::opi_imapsz.

Referenced by ofw_pcib_route_interrupt().

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

◆ ofw_bus_msimap()

int ofw_bus_msimap ( phandle_t  node,
uint16_t  pci_rid,
phandle_t msi_parent,
uint32_t *  msi_rid 
)

Definition at line 444 of file ofw_bus_subr.c.

References OF_getencprop(), and OF_getencprop_alloc_multi().

Here is the call graph for this function:

◆ ofw_bus_node_is_compatible()

int ofw_bus_node_is_compatible ( phandle_t  node,
const char *  compatstr 
)

Definition at line 232 of file ofw_bus_subr.c.

References OF_getprop(), OF_getproplen(), ofw_bus_node_is_compatible_int(), and OFW_COMPAT_LEN.

Referenced by ofw_bus_find_compatible().

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

◆ ofw_bus_node_status_okay()

int ofw_bus_node_status_okay ( phandle_t  node)

Definition at line 188 of file ofw_bus_subr.c.

References OF_getprop(), OF_getproplen(), and OFW_STATUS_LEN.

Here is the call graph for this function:

◆ ofw_bus_parse_xref_list_alloc()

int ofw_bus_parse_xref_list_alloc ( phandle_t  node,
const char *  list_name,
const char *  cells_name,
int  idx,
phandle_t producer,
int *  ncells,
pcell_t **  cells 
)

Definition at line 879 of file ofw_bus_subr.c.

References ofw_bus_parse_xref_list_internal().

Here is the call graph for this function:

◆ ofw_bus_parse_xref_list_get_length()

int ofw_bus_parse_xref_list_get_length ( phandle_t  node,
const char *  list_name,
const char *  cells_name,
int *  count 
)

Definition at line 903 of file ofw_bus_subr.c.

References ofw_bus_parse_xref_list_internal().

Here is the call graph for this function:

◆ ofw_bus_reg_to_rl()

int ofw_bus_reg_to_rl ( device_t  dev,
phandle_t  node,
pcell_t  acells,
pcell_t  scells,
struct resource_list *  rl 
)

Definition at line 544 of file ofw_bus_subr.c.

References dev, and ofw_bus_reg_to_rl_helper().

Here is the call graph for this function:

◆ ofw_bus_search_compatible()

const struct ofw_compat_data * ofw_bus_search_compatible ( device_t  dev,
const struct ofw_compat_data compat 
)

Definition at line 288 of file ofw_bus_subr.c.

References dev, ofw_compat_data::ocd_str, and ofw_bus_is_compatible().

Here is the call graph for this function:

◆ ofw_bus_search_intrmap()

int ofw_bus_search_intrmap ( void *  intr,
int  intrsz,
void *  regs,
int  physsz,
void *  imap,
int  imapsz,
void *  imapmsk,
void *  maskbuf,
void *  result,
int  rintrsz,
phandle_t iparent 
)

Definition at line 379 of file ofw_bus_subr.c.

References iparent, OF_getencprop(), OF_node_from_xref(), OF_searchencprop(), and parent.

Referenced by ofw_bus_lookup_imap().

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

◆ ofw_bus_setup_iinfo()

void ofw_bus_setup_iinfo ( phandle_t  node,
struct ofw_bus_iinfo ii,
int  intrsz 
)

Definition at line 314 of file ofw_bus_subr.c.

References OF_getencprop(), OF_getencprop_alloc(), ofw_bus_iinfo::opi_addrc, ofw_bus_iinfo::opi_imap, ofw_bus_iinfo::opi_imapmsk, and ofw_bus_iinfo::opi_imapsz.

Referenced by ofw_pcib_init().

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

◆ ofw_bus_status_okay()

int ofw_bus_status_okay ( device_t  dev)

Definition at line 175 of file ofw_bus_subr.c.

References dev, and ofw_bus_get_status().

Referenced by ofw_bus_gen_child_pnpinfo().

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

◆ ofw_bus_string_list_to_array()

int ofw_bus_string_list_to_array ( phandle_t  node,
const char *  list_name,
const char ***  array 
)

Definition at line 945 of file ofw_bus_subr.c.

References OF_getprop_alloc().

Here is the call graph for this function:

Variable Documentation

◆ ofw_bus_gen_child_pnpinfo

bus_child_pnpinfo_t ofw_bus_gen_child_pnpinfo

Definition at line 86 of file ofw_bus_subr.h.

◆ ofw_bus_gen_get_compat

ofw_bus_get_compat_t ofw_bus_gen_get_compat

Definition at line 79 of file ofw_bus_subr.h.

◆ ofw_bus_gen_get_model

ofw_bus_get_model_t ofw_bus_gen_get_model

Definition at line 80 of file ofw_bus_subr.h.

◆ ofw_bus_gen_get_name

ofw_bus_get_name_t ofw_bus_gen_get_name

Definition at line 81 of file ofw_bus_subr.h.

◆ ofw_bus_gen_get_node

ofw_bus_get_node_t ofw_bus_gen_get_node

Definition at line 82 of file ofw_bus_subr.h.

◆ ofw_bus_gen_get_type

ofw_bus_get_type_t ofw_bus_gen_get_type

Definition at line 83 of file ofw_bus_subr.h.