PERFORCE change 182477 for review
Jakub Wojciech Klama
jceel at FreeBSD.org
Mon Aug 16 19:53:07 UTC 2010
http://p4web.freebsd.org/@@182477?ac=10
Change 182477 by jceel at jceel on 2010/08/16 19:52:28
Add checking channel capabilities in gpdma_utils
Affected files ...
.. //depot/projects/soc2010/jceel_dma/sys/dev/gpdma/gpdma_utils.c#2 edit
Differences ...
==== //depot/projects/soc2010/jceel_dma/sys/dev/gpdma/gpdma_utils.c#2 (text+ko) ====
@@ -82,7 +82,16 @@
void
gpdma_memutils_init(struct resource **res, int nch, void *arg)
{
+ const struct gpdma_capabilities *caps;
+
+ caps = gpdma_get_caps(res[0]);
+
+ if ((caps->dc_ops & GPDMA_COPY) == 0)
+ return;
+ if ((caps->dc_buffers & GPDMABUF_BLOCK) == 0)
+ return;
+
dma_memutils_channel = res[0];
mtx_init(&dma_memutils_mtx, "dma_memutils", "dma", MTX_DEF);
@@ -102,14 +111,12 @@
int err = 0, status;
pmap_t pmap;
- printf("dma_memcpy(dst=%p, src=%p, len=%d, flags=%d)\n", to, from, len, flags);
+ if (flags & IS_PHYSICAL)
+ return (ENOTSUP);
if (dma_memutils_channel == NULL)
return (ENOTSUP);
- if (flags & IS_PHYSICAL)
- return (ENOTSUP);
-
mtx_lock_spin(&dma_memutils_mtx);
if (dma_memutils_busy == 1) {
mtx_unlock_spin(&dma_memutils_mtx);
@@ -138,8 +145,8 @@
gpdma_set_buffer_layout(xfer, GPDMA_BUF_SRC, GPDMABUF_BLOCK);
if (flags & IS_PHYSICAL) {
- gpdma_load_buffer_raw(xfer, GPDMA_BUF_DST, (bus_addr_t)to, len);
- gpdma_load_buffer_raw(xfer, GPDMA_BUF_SRC, (bus_addr_t)from, len);
+ /* Currently not supported */
+ return (ENOTSUP);
} else {
if (flags & DST_IS_USER) {
iovdst.iov_base = to;
@@ -190,13 +197,7 @@
status = gpdma_get_transfer_status(cookie);
- printf("src: %16D\n", from, " ");
- printf("dst: %16D\n", to, " ");
-
out:
- if (err)
- printf("error: %d\n", err);
-
mtx_lock_spin(&dma_memutils_mtx);
dma_memutils_busy = 0;
mtx_unlock_spin(&dma_memutils_mtx);
@@ -206,14 +207,6 @@
int
dma_bzero(void *addr, int len, int flags)
{
-#if 0
- gpdma_transfer_t xfer;
- void *cookie;
- int err, status;
-
- if (dma_memutils_channel == NULL)
- return (-1);
-#endif
-
- return (0);
+ /* Currently not supported */
+ return (ENOTSUP);
}
More information about the p4-projects
mailing list