From owner-svn-src-all@freebsd.org Fri Jul 3 05:45:00 2015 Return-Path: Delivered-To: svn-src-all@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 0446F993D67; Fri, 3 Jul 2015 05:45:00 +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 CFADB2F70; Fri, 3 Jul 2015 05:44:59 +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 t635ixE9074279; Fri, 3 Jul 2015 05:44:59 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t635ixbS074277; Fri, 3 Jul 2015 05:44:59 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201507030544.t635ixbS074277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Fri, 3 Jul 2015 05:44:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285074 - head/sys/dev/proto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2015 05:45:00 -0000 Author: marcel Date: Fri Jul 3 05:44:58 2015 New Revision: 285074 URL: https://svnweb.freebsd.org/changeset/base/285074 Log: Implement unload and sync operations. Modified: head/sys/dev/proto/proto_busdma.c head/sys/dev/proto/proto_dev.h Modified: head/sys/dev/proto/proto_busdma.c ============================================================================== --- head/sys/dev/proto/proto_busdma.c Fri Jul 3 03:34:21 2015 (r285073) +++ head/sys/dev/proto/proto_busdma.c Fri Jul 3 05:44:58 2015 (r285074) @@ -306,6 +306,28 @@ proto_busdma_md_load(struct proto_busdma return (0); } +static int +proto_busdma_md_unload(struct proto_busdma *busdma, struct proto_md *md) +{ + + if (!md->physaddr) + return (ENXIO); + bus_dmamap_unload(md->bd_tag, md->bd_map); + md->physaddr = 0; + return (0); +} + +static int +proto_busdma_sync(struct proto_busdma *busdma, struct proto_md *md, + struct proto_ioc_busdma *ioc) +{ + + if (!md->physaddr) + return (ENXIO); + bus_dmamap_sync(md->bd_tag, md->bd_map, ioc->u.sync.op); + return (0); +} + static struct proto_md * proto_busdma_md_lookup(struct proto_busdma *busdma, u_long key) { @@ -419,6 +441,22 @@ proto_busdma_ioctl(struct proto_softc *s } error = proto_busdma_md_load(busdma, md, ioc, td); break; + case PROTO_IOC_BUSDMA_MD_UNLOAD: + md = proto_busdma_md_lookup(busdma, ioc->key); + if (md == NULL) { + error = EINVAL; + break; + } + error = proto_busdma_md_unload(busdma, md); + break; + case PROTO_IOC_BUSDMA_SYNC: + md = proto_busdma_md_lookup(busdma, ioc->key); + if (md == NULL) { + error = EINVAL; + break; + } + error = proto_busdma_sync(busdma, md, ioc); + break; default: error = EINVAL; break; Modified: head/sys/dev/proto/proto_dev.h ============================================================================== --- head/sys/dev/proto/proto_dev.h Fri Jul 3 03:34:21 2015 (r285073) +++ head/sys/dev/proto/proto_dev.h Fri Jul 3 05:44:58 2015 (r285074) @@ -50,6 +50,8 @@ struct proto_ioc_busdma { #define PROTO_IOC_BUSDMA_MD_CREATE 20 #define PROTO_IOC_BUSDMA_MD_DESTROY 21 #define PROTO_IOC_BUSDMA_MD_LOAD 22 +#define PROTO_IOC_BUSDMA_MD_UNLOAD 29 +#define PROTO_IOC_BUSDMA_SYNC 30 unsigned long key; union { struct { @@ -72,6 +74,11 @@ struct proto_ioc_busdma { unsigned long bus_addr; unsigned int bus_nsegs; } md; + struct { + unsigned int op; + unsigned long base; + unsigned long size; + } sync; } u; unsigned long result; };