Page MenuHomeFreeBSD

D4879.id13424.diff
No OneTemporary

D4879.id13424.diff

Index: head/sys/arm/arm/nexus.c
===================================================================
--- head/sys/arm/arm/nexus.c
+++ head/sys/arm/arm/nexus.c
@@ -85,6 +85,7 @@
rman_res_t, rman_res_t, rman_res_t, u_int);
static int nexus_activate_resource(device_t, device_t, int, int,
struct resource *);
+static bus_space_tag_t nexus_get_bus_tag(device_t, device_t);
#ifdef ARM_INTRNG
#ifdef SMP
static int nexus_bind_intr(device_t, device_t, struct resource *, int);
@@ -124,6 +125,7 @@
DEVMETHOD(bus_release_resource, nexus_release_resource),
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
+ DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag),
#ifdef ARM_INTRNG
DEVMETHOD(bus_describe_intr, nexus_describe_intr),
#ifdef SMP
@@ -260,6 +262,17 @@
return (rman_release_resource(res));
}
+static bus_space_tag_t
+nexus_get_bus_tag(device_t bus __unused, device_t child __unused)
+{
+
+#ifdef FDT
+ return(fdtbus_bs_tag);
+#else
+ return((void *)1);
+#endif
+}
+
static int
nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
enum intr_polarity pol)
Index: head/sys/arm64/arm64/nexus.c
===================================================================
--- head/sys/arm64/arm64/nexus.c
+++ head/sys/arm64/arm64/nexus.c
@@ -113,6 +113,7 @@
static int nexus_setup_intr(device_t dev, device_t child, struct resource *res,
int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep);
static int nexus_teardown_intr(device_t, device_t, struct resource *, void *);
+static bus_space_tag_t nexus_get_bus_tag(device_t, device_t);
#ifdef SMP
static int nexus_bind_intr(device_t, device_t, struct resource *, int);
#endif
@@ -134,6 +135,7 @@
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
+ DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag),
#ifdef SMP
DEVMETHOD(bus_bind_intr, nexus_bind_intr),
#endif
@@ -307,6 +309,13 @@
}
#endif
+static bus_space_tag_t
+nexus_get_bus_tag(device_t bus __unused, device_t child __unused)
+{
+
+ return(&memmap_bus);
+}
+
static int
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
Index: head/sys/kern/bus_if.m
===================================================================
--- head/sys/kern/bus_if.m
+++ head/sys/kern/bus_if.m
@@ -637,6 +637,17 @@
} DEFAULT bus_generic_get_dma_tag;
/**
+ * @brief Returns bus_space_tag_t for use w/ devices on the bus.
+ *
+ * @param _dev the parent device of @p _child
+ * @param _child the device to which the tag will belong
+ */
+METHOD bus_space_tag_t get_bus_tag {
+ device_t _dev;
+ device_t _child;
+} DEFAULT bus_generic_get_bus_tag;
+
+/**
* @brief Allow the bus to determine the unit number of a device.
*
* @param _dev the parent device of @p _child
Index: head/sys/kern/subr_bus.c
===================================================================
--- head/sys/kern/subr_bus.c
+++ head/sys/kern/subr_bus.c
@@ -4095,6 +4095,22 @@
}
/**
+ * @brief Helper function for implementing BUS_GET_BUS_TAG().
+ *
+ * This simple implementation of BUS_GET_BUS_TAG() simply calls the
+ * BUS_GET_BUS_TAG() method of the parent of @p dev.
+ */
+bus_space_tag_t
+bus_generic_get_bus_tag(device_t dev, device_t child)
+{
+
+ /* Propagate up the bus hierarchy until someone handles it. */
+ if (dev->parent != NULL)
+ return (BUS_GET_BUS_TAG(dev->parent, child));
+ return (NULL);
+}
+
+/**
* @brief Helper function for implementing BUS_GET_RESOURCE().
*
* This implementation of BUS_GET_RESOURCE() uses the
@@ -4576,6 +4592,23 @@
}
/**
+ * @brief Wrapper function for BUS_GET_BUS_TAG().
+ *
+ * This function simply calls the BUS_GET_BUS_TAG() method of the
+ * parent of @p dev.
+ */
+bus_space_tag_t
+bus_get_bus_tag(device_t dev)
+{
+ device_t parent;
+
+ parent = device_get_parent(dev);
+ if (parent == NULL)
+ return (NULL);
+ return (BUS_GET_BUS_TAG(parent, dev));
+}
+
+/**
* @brief Wrapper function for BUS_GET_DOMAIN().
*
* This function simply calls the BUS_GET_DOMAIN() method of the
Index: head/sys/powerpc/powerpc/nexus.c
===================================================================
--- head/sys/powerpc/powerpc/nexus.c
+++ head/sys/powerpc/powerpc/nexus.c
@@ -66,6 +66,7 @@
static bus_teardown_intr_t nexus_teardown_intr;
static bus_activate_resource_t nexus_activate_resource;
static bus_deactivate_resource_t nexus_deactivate_resource;
+static bus_space_tag_t nexus_get_bus_tag(device_t, device_t);
#ifdef SMP
static bus_bind_intr_t nexus_bind_intr;
#endif
@@ -87,6 +88,7 @@
DEVMETHOD(bus_bind_intr, nexus_bind_intr),
#endif
DEVMETHOD(bus_config_intr, nexus_config_intr),
+ DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr),
@@ -155,6 +157,13 @@
return (powerpc_teardown_intr(ih));
}
+static bus_space_tag_t
+nexus_get_bus_tag(device_t bus __unused, device_t child __unused)
+{
+
+ return(&bs_be_tag);
+}
+
#ifdef SMP
static int
nexus_bind_intr(device_t bus __unused, device_t child __unused,
Index: head/sys/sparc64/sparc64/nexus.c
===================================================================
--- head/sys/sparc64/sparc64/nexus.c
+++ head/sys/sparc64/sparc64/nexus.c
@@ -98,6 +98,7 @@
#endif
static bus_describe_intr_t nexus_describe_intr;
static bus_get_dma_tag_t nexus_get_dma_tag;
+static bus_get_bus_tag_t nexus_get_bus_tag;
static ofw_bus_get_devinfo_t nexus_get_devinfo;
static int nexus_inlist(const char *, const char *const *);
@@ -135,6 +136,7 @@
#endif
DEVMETHOD(bus_describe_intr, nexus_describe_intr),
DEVMETHOD(bus_get_dma_tag, nexus_get_dma_tag),
+ DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo, nexus_get_devinfo),
@@ -502,6 +504,13 @@
return (&nexus_dmatag);
}
+static bus_space_tag_t
+nexus_get_bus_tag(device_t bus __unused, device_t child __unused)
+{
+
+ return (&nexus_bustag);
+}
+
static const struct ofw_bus_devinfo *
nexus_get_devinfo(device_t bus __unused, device_t child)
{
Index: head/sys/sys/bus.h
===================================================================
--- head/sys/sys/bus.h
+++ head/sys/sys/bus.h
@@ -30,6 +30,7 @@
#define _SYS_BUS_H_
#include <machine/_limits.h>
+#include <machine/_bus.h>
#include <sys/_bus_dma.h>
#include <sys/ioccom.h>
@@ -383,6 +384,8 @@
void bus_generic_driver_added(device_t dev, driver_t *driver);
bus_dma_tag_t
bus_generic_get_dma_tag(device_t dev, device_t child);
+bus_space_tag_t
+ bus_generic_get_bus_tag(device_t dev, device_t child);
int bus_generic_get_domain(device_t dev, device_t child, int *domain);
struct resource_list *
bus_generic_get_resource_list (device_t, device_t);
@@ -448,6 +451,7 @@
int bus_deactivate_resource(device_t dev, int type, int rid,
struct resource *r);
bus_dma_tag_t bus_get_dma_tag(device_t dev);
+bus_space_tag_t bus_get_bus_tag(device_t dev);
int bus_get_domain(device_t dev, int *domain);
int bus_release_resource(device_t dev, int type, int rid,
struct resource *r);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 28, 6:30 PM (3 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26294777
Default Alt Text
D4879.id13424.diff (7 KB)

Event Timeline