167fb10f3SMarcel Moolenaar /*- 24f027abdSMarcel Moolenaar * Copyright (c) 2014, 2015 Marcel Moolenaar 367fb10f3SMarcel Moolenaar * All rights reserved. 467fb10f3SMarcel Moolenaar * 567fb10f3SMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 667fb10f3SMarcel Moolenaar * modification, are permitted provided that the following conditions 767fb10f3SMarcel Moolenaar * are met: 867fb10f3SMarcel Moolenaar * 967fb10f3SMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 1067fb10f3SMarcel Moolenaar * notice, this list of conditions and the following disclaimer. 1167fb10f3SMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 1267fb10f3SMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 1367fb10f3SMarcel Moolenaar * documentation and/or other materials provided with the distribution. 1467fb10f3SMarcel Moolenaar * 1567fb10f3SMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1667fb10f3SMarcel Moolenaar * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1767fb10f3SMarcel Moolenaar * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1867fb10f3SMarcel Moolenaar * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1967fb10f3SMarcel Moolenaar * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2067fb10f3SMarcel Moolenaar * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2167fb10f3SMarcel Moolenaar * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2267fb10f3SMarcel Moolenaar * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2367fb10f3SMarcel Moolenaar * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2467fb10f3SMarcel Moolenaar * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2567fb10f3SMarcel Moolenaar * 2667fb10f3SMarcel Moolenaar * $FreeBSD$ 2767fb10f3SMarcel Moolenaar */ 2867fb10f3SMarcel Moolenaar 2967fb10f3SMarcel Moolenaar #ifndef _DEV_PROTO_DEV_H_ 3067fb10f3SMarcel Moolenaar #define _DEV_PROTO_DEV_H_ 3167fb10f3SMarcel Moolenaar 3267fb10f3SMarcel Moolenaar #include <sys/ioccom.h> 3367fb10f3SMarcel Moolenaar 3467fb10f3SMarcel Moolenaar #define PROTO_IOC_CLASS 'h' 3567fb10f3SMarcel Moolenaar 3667fb10f3SMarcel Moolenaar struct proto_ioc_region { 3767fb10f3SMarcel Moolenaar unsigned long address; 3867fb10f3SMarcel Moolenaar unsigned long size; 3967fb10f3SMarcel Moolenaar }; 4067fb10f3SMarcel Moolenaar 4167fb10f3SMarcel Moolenaar #define PROTO_IOC_REGION _IOWR(PROTO_IOC_CLASS, 1, struct proto_ioc_region) 4267fb10f3SMarcel Moolenaar 434f027abdSMarcel Moolenaar struct proto_ioc_busdma { 444f027abdSMarcel Moolenaar unsigned int request; 454f027abdSMarcel Moolenaar #define PROTO_IOC_BUSDMA_TAG_CREATE 1 464f027abdSMarcel Moolenaar #define PROTO_IOC_BUSDMA_TAG_DERIVE 2 474f027abdSMarcel Moolenaar #define PROTO_IOC_BUSDMA_TAG_DESTROY 3 485dcca8e8SMarcel Moolenaar #define PROTO_IOC_BUSDMA_MEM_ALLOC 10 495dcca8e8SMarcel Moolenaar #define PROTO_IOC_BUSDMA_MEM_FREE 11 50*89abdea8SMarcel Moolenaar #define PROTO_IOC_BUSDMA_MD_CREATE 20 51*89abdea8SMarcel Moolenaar #define PROTO_IOC_BUSDMA_MD_DESTROY 21 52*89abdea8SMarcel Moolenaar #define PROTO_IOC_BUSDMA_MD_LOAD 22 534f027abdSMarcel Moolenaar unsigned long key; 544f027abdSMarcel Moolenaar union { 554f027abdSMarcel Moolenaar struct { 564f027abdSMarcel Moolenaar unsigned long align; 574f027abdSMarcel Moolenaar unsigned long bndry; 584f027abdSMarcel Moolenaar unsigned long maxaddr; 594f027abdSMarcel Moolenaar unsigned long maxsz; 604f027abdSMarcel Moolenaar unsigned long maxsegsz; 614f027abdSMarcel Moolenaar unsigned int nsegs; 624f027abdSMarcel Moolenaar unsigned int datarate; 634f027abdSMarcel Moolenaar unsigned int flags; 644f027abdSMarcel Moolenaar } tag; 655dcca8e8SMarcel Moolenaar struct { 665dcca8e8SMarcel Moolenaar unsigned long tag; 675dcca8e8SMarcel Moolenaar unsigned int flags; 68*89abdea8SMarcel Moolenaar unsigned long virt_addr; 69*89abdea8SMarcel Moolenaar unsigned long virt_size; 7090a1793cSMarcel Moolenaar unsigned int phys_nsegs; 7190a1793cSMarcel Moolenaar unsigned long phys_addr; 7290a1793cSMarcel Moolenaar unsigned long bus_addr; 7390a1793cSMarcel Moolenaar unsigned int bus_nsegs; 74*89abdea8SMarcel Moolenaar } md; 754f027abdSMarcel Moolenaar } u; 764f027abdSMarcel Moolenaar unsigned long result; 774f027abdSMarcel Moolenaar }; 784f027abdSMarcel Moolenaar 794f027abdSMarcel Moolenaar #define PROTO_IOC_BUSDMA _IOWR(PROTO_IOC_CLASS, 2, struct proto_ioc_busdma) 804f027abdSMarcel Moolenaar 8167fb10f3SMarcel Moolenaar #endif /* _DEV_PROTO_H_ */ 82