Page MenuHomeFreeBSD

D22945.1796220905.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D22945.1796220905.diff

Index: share/man/man9/OF_device_from_xref.9
===================================================================
--- share/man/man9/OF_device_from_xref.9
+++ share/man/man9/OF_device_from_xref.9
@@ -32,12 +32,15 @@
.Nm OF_device_from_xref ,
.Nm OF_xref_from_device ,
.Nm OF_device_register_xref
+.Nm OF_device_unregister_xref
.Nd "manage mappings between xrefs and devices"
.Sh SYNOPSIS
.In dev/ofw/ofw_bus.h
.In dev/ofw/ofw_bus_subr.h
.Ft int
.Fn OF_device_register_xref "phandle_t xref" "device_t dev"
+.Ft void
+.Fn OF_device_unregister_xref "phandle_t xref" "device_t dev"
.Ft device_t
.Fn OF_device_from_xref "phandle_t xref"
.Ft phandle_t
@@ -60,6 +63,15 @@
already exists, it is replaced with the new one.
The function always returns 0.
.Pp
+.Fn OF_device_unregister_xref
+removes a map entry from the effective phandle
+.Fa xref
+to device
+.Fa dev .
+If a mapping entry for
+.Fa xref
+does not exists, it silently returns.
+.Pp
.Fn OF_device_from_xref
returns a device_t instance associated with the effective phandle
.Fa xref .
Index: sys/dev/ofw/openfirm.h
===================================================================
--- sys/dev/ofw/openfirm.h
+++ sys/dev/ofw/openfirm.h
@@ -151,6 +151,7 @@
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);
+void OF_device_unregister_xref(phandle_t xref, device_t dev);
/* Device I/O functions */
ihandle_t OF_open(const char *path);
Index: sys/dev/ofw/openfirm.c
===================================================================
--- sys/dev/ofw/openfirm.c
+++ sys/dev/ofw/openfirm.c
@@ -189,6 +189,15 @@
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
* overrides allowing last-set to win.
@@ -706,6 +715,16 @@
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. */
int
OF_call_method(const char *method, ihandle_t instance, int nargs, int nreturns,

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 2, 2:15 PM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42148297
Default Alt Text
D22945.1796220905.diff (2 KB)

Event Timeline