svn commit: r235097 - in projects/altix2/sys: kern sys
Marcel Moolenaar
marcel at FreeBSD.org
Sun May 6 17:31:30 UTC 2012
Author: marcel
Date: Sun May 6 17:31:29 2012
New Revision: 235097
URL: http://svn.freebsd.org/changeset/base/235097
Log:
Add device_get_busdma_tag() and device_set_busdma_tag() for 2 reasons:
1. It allows us to keep track of the tags that are being created for
a device, and
2. It allows us to implement inheritance of constraints within newbus
and without using bus_get_dma_tag() for now.
These functions are in part the result of building busdma/mi alongside
the existing bus_dma implementation. They may not stay.
Modified:
projects/altix2/sys/kern/subr_bus.c
projects/altix2/sys/sys/bus.h
Modified: projects/altix2/sys/kern/subr_bus.c
==============================================================================
--- projects/altix2/sys/kern/subr_bus.c Sun May 6 16:41:27 2012 (r235096)
+++ projects/altix2/sys/kern/subr_bus.c Sun May 6 17:31:29 2012 (r235097)
@@ -134,6 +134,8 @@ struct device {
void *ivars; /**< instance variables */
void *softc; /**< current driver's variables */
+ void *busdma_tag; /**< first created DMA tag */
+
struct sysctl_ctx_list sysctl_ctx; /**< state for sysctl variables */
struct sysctl_oid *sysctl_tree; /**< state for sysctl variables */
};
@@ -2259,6 +2261,15 @@ device_get_unit(device_t dev)
}
/**
+ * @brief Return the first DMA root tag created for the device
+ */
+void *
+device_get_busdma_tag(device_t dev)
+{
+ return (dev->busdma_tag);
+}
+
+/**
* @brief Return the device's description string
*/
const char *
@@ -2350,6 +2361,19 @@ device_set_desc_internal(device_t dev, c
}
/**
+ * @brief Set or replace the first DMA root tag
+ */
+void *
+device_set_busdma_tag(device_t dev, void *tag)
+{
+ void *prev;
+
+ prev = dev->busdma_tag;
+ dev->busdma_tag = tag;
+ return (prev);
+}
+
+/**
* @brief Set the device's description
*
* The value of @c desc should be a string constant that will not
Modified: projects/altix2/sys/sys/bus.h
==============================================================================
--- projects/altix2/sys/sys/bus.h Sun May 6 16:41:27 2012 (r235096)
+++ projects/altix2/sys/sys/bus.h Sun May 6 17:31:29 2012 (r235097)
@@ -432,6 +432,11 @@ void device_disable(device_t dev);
void device_enable(device_t dev);
device_t device_find_child(device_t dev, const char *classname,
int unit);
+/*
+ * XXX busdma/mi
+ * device_get_busdma_tag() returns a busdma_tag_t
+ */
+void *device_get_busdma_tag(device_t dev);
const char *device_get_desc(device_t dev);
devclass_t device_get_devclass(device_t dev);
driver_t *device_get_driver(device_t dev);
@@ -458,6 +463,12 @@ int device_probe_and_attach(device_t dev
int device_probe_child(device_t bus, device_t dev);
int device_quiesce(device_t dev);
void device_quiet(device_t dev);
+/*
+ * XXX busdma/mi
+ * device_set_busdma_tag() returns a busdma_tag_t
+ * The tag argument is of type busdma_tag_t as well.
+ */
+void *device_set_busdma_tag(device_t dev, void *tag);
void device_set_desc(device_t dev, const char* desc);
void device_set_desc_copy(device_t dev, const char* desc);
int device_set_devclass(device_t dev, const char *classname);
More information about the svn-src-projects
mailing list