From owner-svn-src-head@freebsd.org Sun Aug 2 01:09:32 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEFE89A5420; Sun, 2 Aug 2015 01:09:32 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AEA7E1EB4; Sun, 2 Aug 2015 01:09:32 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t7219WEC041163; Sun, 2 Aug 2015 01:09:32 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t7219UvB041157; Sun, 2 Aug 2015 01:09:30 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201508020109.t7219UvB041157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sun, 2 Aug 2015 01:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286176 - in head/tools/bus_space: . C Python X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Aug 2015 01:09:32 -0000 Author: marcel Date: Sun Aug 2 01:09:30 2015 New Revision: 286176 URL: https://svnweb.freebsd.org/changeset/base/286176 Log: Rename busdma_sync() to busdma_sync_range() and rename the base and size parameters to ofs and len (resp). Add a new busdma_sync() that makes the entire MD coherent. Modified: head/tools/bus_space/C/lang.c head/tools/bus_space/C/libbus.h head/tools/bus_space/Python/lang.c head/tools/bus_space/busdma.c head/tools/bus_space/busdma.h Modified: head/tools/bus_space/C/lang.c ============================================================================== --- head/tools/bus_space/C/lang.c Sun Aug 2 00:56:16 2015 (r286175) +++ head/tools/bus_space/C/lang.c Sun Aug 2 01:09:30 2015 (r286176) @@ -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)); } Modified: head/tools/bus_space/C/libbus.h ============================================================================== --- head/tools/bus_space/C/libbus.h Sun Aug 2 00:56:16 2015 (r286175) +++ head/tools/bus_space/C/libbus.h Sun Aug 2 01:09:30 2015 (r286176) @@ -78,6 +78,7 @@ bus_size_t busdma_seg_get_size(busdma_se #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_ */ Modified: head/tools/bus_space/Python/lang.c ============================================================================== --- head/tools/bus_space/Python/lang.c Sun Aug 2 00:56:16 2015 (r286175) +++ head/tools/bus_space/Python/lang.c Sun Aug 2 01:09:30 2015 (r286176) @@ -384,12 +384,27 @@ busdma_seg_get_size(PyObject *self, PyOb 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 } }; Modified: head/tools/bus_space/busdma.c ============================================================================== --- head/tools/bus_space/busdma.c Sun Aug 2 00:56:16 2015 (r286175) +++ head/tools/bus_space/busdma.c Sun Aug 2 01:09:30 2015 (r286176) @@ -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, 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); Modified: head/tools/bus_space/busdma.h ============================================================================== --- head/tools/bus_space/busdma.h Sun Aug 2 00:56:16 2015 (r286175) +++ head/tools/bus_space/busdma.h Sun Aug 2 01:09:30 2015 (r286176) @@ -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_ */