]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Rename busdma_sync() to busdma_sync_range() and rename the
authormarcel <marcel@FreeBSD.org>
Sun, 2 Aug 2015 01:09:30 +0000 (01:09 +0000)
committermarcel <marcel@FreeBSD.org>
Sun, 2 Aug 2015 01:09:30 +0000 (01:09 +0000)
base and size parameters to ofs and len (resp). Add a new
busdma_sync() that makes the entire MD coherent.

tools/bus_space/C/lang.c
tools/bus_space/C/libbus.h
tools/bus_space/Python/lang.c
tools/bus_space/busdma.c
tools/bus_space/busdma.h

index f9b404b1b26c8a2c5e213088de758af43277b9c2..3ef454466f9de0faeb944555dff37bf3a3ecae3a 100644 (file)
@@ -227,8 +227,15 @@ busdma_seg_get_size(busdma_seg_t seg)
 }
 
 int
-busdma_sync(busdma_md_t md, int op, bus_addr_t base, bus_size_t size)
+busdma_sync(busdma_md_t md, int op)
 {
 
-       return (bd_sync(md, op, base, size));
+       return (bd_sync(md, op, 0UL, ~0UL));
+}
+
+int
+busdma_sync_range(busdma_md_t md, int op, bus_size_t ofs, bus_size_t len)
+{
+
+       return (bd_sync(md, op, ofs, len));
 }
index 0fae9879d2ce04f8c64a58aaff1b52423b19bfcf..1f0c3f17651683aad1fe5a3790ebc59d22d48109 100644 (file)
@@ -78,6 +78,7 @@ bus_size_t    busdma_seg_get_size(busdma_seg_t seg);
 #define        BUSDMA_SYNC_PREWRITE    4
 #define        BUSDMA_SYNC_POSTWRITE   8
 
-int    busdma_sync(busdma_md_t md, int op, bus_addr_t, bus_size_t);
+int    busdma_sync(busdma_md_t md, int op);
+int    busdma_sync_range(busdma_md_t md, int op, bus_size_t, bus_size_t);
 
 #endif /* _LIBBUS_SPACE_H_ */
index 48a112ba0c30d4c03554e30041d3660fc5c5f768..0fde8fc1bb62b764c6be26646f347d70d7e4371b 100644 (file)
@@ -384,12 +384,27 @@ busdma_seg_get_size(PyObject *self, PyObject *args)
 static PyObject *
 busdma_sync(PyObject *self, PyObject *args)
 {
-       u_long base, size;
        int error, mdid, op;
 
-       if (!PyArg_ParseTuple(args, "iikk", &mdid, &op, &base, &size))
+       if (!PyArg_ParseTuple(args, "ii", &mdid, &op))
                return (NULL);
-       error = bd_sync(mdid, op, base, size);
+       error = bd_sync(mdid, op, 0UL, ~0UL);
+       if (error) {
+               PyErr_SetString(PyExc_IOError, strerror(error));
+               return (NULL);
+       }
+       Py_RETURN_NONE;
+}
+
+static PyObject *
+busdma_sync_range(PyObject *self, PyObject *args)
+{
+       u_long ofs, len;
+       int error, mdid, op;
+
+       if (!PyArg_ParseTuple(args, "iikk", &mdid, &op, &ofs, &len))
+               return (NULL);
+       error = bd_sync(mdid, op, ofs, len);
        if (error) {
                PyErr_SetString(PyExc_IOError, strerror(error));
                return (NULL);
@@ -448,7 +463,9 @@ static PyMethodDef busdma_methods[] = {
        "Return the size of the segment." },
 
     { "sync", busdma_sync, METH_VARARGS,
-       "Keep memory/caches coherent WRT to DMA." },
+       "Make the entire memory descriptor coherent WRT to DMA." },
+    { "sync_range", busdma_sync_range, METH_VARARGS,
+       "Make part of the memory descriptor coherent WRT to DMA." },
 
     { NULL, NULL, 0, NULL }
 };
index 3f948b72f983b3aaddeb41f2764e22c74f9ef386..04a9da8b2ef4b1b796cbd4f323bef81800ab177b 100644 (file)
@@ -536,7 +536,7 @@ bd_seg_get_size(int sid, u_long *size_p)
 }
 
 int
-bd_sync(int mdid, u_int op, u_long base, u_long size)
+bd_sync(int mdid, u_int op, u_long ofs, u_long len)
 {
        struct proto_ioc_busdma ioc;
        struct obj *md;
@@ -549,8 +549,8 @@ bd_sync(int mdid, u_int op, u_long base, u_long size)
        ioc.request = PROTO_IOC_BUSDMA_SYNC;
        ioc.key = md->key;
        ioc.u.sync.op = op;
-       ioc.u.sync.base = base;
-       ioc.u.sync.size = size;
+       ioc.u.sync.base = ofs;
+       ioc.u.sync.size = len;
        if (ioctl(md->fd, PROTO_IOC_BUSDMA, &ioc) == -1)
                return (errno);
 
index cf9d4f27542f244169e70adef1c177353df58ef0..ec4890dd201f1c47785f7e3868500eba28c2a396 100644 (file)
@@ -51,6 +51,6 @@ int   bd_md_next_seg(int mdid, int sid);
 int    bd_seg_get_addr(int sid, u_long *);
 int    bd_seg_get_size(int sid, u_long *);
 
-int    bd_sync(int mdid, u_int op, u_long base, u_long size);
+int    bd_sync(int mdid, u_int op, u_long ofs, u_long len);
 
 #endif /* _TOOLS_BUS_DMA_H_ */