Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ofw/openfirm.c
Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | xrefinfo_add(phandle_t node, phandle_t xref, device_t dev) | ||||
xi->xref = xref; | xi->xref = xref; | ||||
xi->dev = dev; | xi->dev = dev; | ||||
mtx_lock(&xreflist_lock); | mtx_lock(&xreflist_lock); | ||||
SLIST_INSERT_HEAD(&xreflist, xi, next_entry); | SLIST_INSERT_HEAD(&xreflist, xi, next_entry); | ||||
mtx_unlock(&xreflist_lock); | mtx_unlock(&xreflist_lock); | ||||
return (xi); | return (xi); | ||||
} | } | ||||
static void | |||||
xrefinfo_remove(struct xrefinfo *xi) | |||||
{ | |||||
mtx_lock(&xreflist_lock); | |||||
SLIST_REMOVE(&xreflist, xi, xrefinfo, next_entry); | |||||
mtx_unlock(&xreflist_lock); | |||||
} | |||||
/* | /* | ||||
* OFW install routines. Highest priority wins, equal priority also | * OFW install routines. Highest priority wins, equal priority also | ||||
* overrides allowing last-set to win. | * overrides allowing last-set to win. | ||||
*/ | */ | ||||
SET_DECLARE(ofw_set, ofw_def_t); | SET_DECLARE(ofw_set, ofw_def_t); | ||||
boolean_t | boolean_t | ||||
OF_install(char *name, int prio) | OF_install(char *name, int prio) | ||||
▲ Show 20 Lines • Show All 499 Lines • ▼ Show 20 Lines | OF_device_register_xref(phandle_t xref, device_t dev) | ||||
if (xref_init_done) { | if (xref_init_done) { | ||||
if ((xi = xrefinfo_find(xref, FIND_BY_XREF)) == NULL) | if ((xi = xrefinfo_find(xref, FIND_BY_XREF)) == NULL) | ||||
xrefinfo_add(xref, xref, dev); | xrefinfo_add(xref, xref, dev); | ||||
else | else | ||||
xi->dev = dev; | xi->dev = dev; | ||||
return (0); | return (0); | ||||
} | } | ||||
panic("Attempt to register device before xreflist_init"); | panic("Attempt to register device before xreflist_init"); | ||||
} | |||||
void | |||||
OF_device_unregister_xref(phandle_t xref, device_t dev) | |||||
{ | |||||
struct xrefinfo *xi; | |||||
if ((xi = xrefinfo_find(xref, FIND_BY_XREF)) == NULL) | |||||
return; | |||||
xrefinfo_remove(xi); | |||||
} | } | ||||
/* Call the method in the scope of a given instance. */ | /* Call the method in the scope of a given instance. */ | ||||
int | int | ||||
OF_call_method(const char *method, ihandle_t instance, int nargs, int nreturns, | OF_call_method(const char *method, ihandle_t instance, int nargs, int nreturns, | ||||
...) | ...) | ||||
{ | { | ||||
va_list ap; | va_list ap; | ||||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |