xref: /openbmc/qemu/include/hw/sparc/sun4u_iommu.h (revision 0ea833c2)
1*0ea833c2SMark Cave-Ayland /*
2*0ea833c2SMark Cave-Ayland  * QEMU sun4u IOMMU emulation
3*0ea833c2SMark Cave-Ayland  *
4*0ea833c2SMark Cave-Ayland  * Copyright (c) 2006 Fabrice Bellard
5*0ea833c2SMark Cave-Ayland  * Copyright (c) 2012,2013 Artyom Tarasenko
6*0ea833c2SMark Cave-Ayland  * Copyright (c) 2017 Mark Cave-Ayland
7*0ea833c2SMark Cave-Ayland  *
8*0ea833c2SMark Cave-Ayland  * Permission is hereby granted, free of charge, to any person obtaining a copy
9*0ea833c2SMark Cave-Ayland  * of this software and associated documentation files (the "Software"), to deal
10*0ea833c2SMark Cave-Ayland  * in the Software without restriction, including without limitation the rights
11*0ea833c2SMark Cave-Ayland  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12*0ea833c2SMark Cave-Ayland  * copies of the Software, and to permit persons to whom the Software is
13*0ea833c2SMark Cave-Ayland  * furnished to do so, subject to the following conditions:
14*0ea833c2SMark Cave-Ayland  *
15*0ea833c2SMark Cave-Ayland  * The above copyright notice and this permission notice shall be included in
16*0ea833c2SMark Cave-Ayland  * all copies or substantial portions of the Software.
17*0ea833c2SMark Cave-Ayland  *
18*0ea833c2SMark Cave-Ayland  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19*0ea833c2SMark Cave-Ayland  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20*0ea833c2SMark Cave-Ayland  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21*0ea833c2SMark Cave-Ayland  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22*0ea833c2SMark Cave-Ayland  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23*0ea833c2SMark Cave-Ayland  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24*0ea833c2SMark Cave-Ayland  * THE SOFTWARE.
25*0ea833c2SMark Cave-Ayland  */
26*0ea833c2SMark Cave-Ayland 
27*0ea833c2SMark Cave-Ayland #ifndef SUN4U_IOMMU_H
28*0ea833c2SMark Cave-Ayland #define SUN4U_IOMMU_H
29*0ea833c2SMark Cave-Ayland 
30*0ea833c2SMark Cave-Ayland #include "qemu-common.h"
31*0ea833c2SMark Cave-Ayland #include "hw/sysbus.h"
32*0ea833c2SMark Cave-Ayland 
33*0ea833c2SMark Cave-Ayland #define IOMMU_NREGS             3
34*0ea833c2SMark Cave-Ayland 
35*0ea833c2SMark Cave-Ayland typedef struct IOMMUState {
36*0ea833c2SMark Cave-Ayland     SysBusDevice parent_obj;
37*0ea833c2SMark Cave-Ayland 
38*0ea833c2SMark Cave-Ayland     AddressSpace iommu_as;
39*0ea833c2SMark Cave-Ayland     IOMMUMemoryRegion iommu;
40*0ea833c2SMark Cave-Ayland 
41*0ea833c2SMark Cave-Ayland     MemoryRegion iomem;
42*0ea833c2SMark Cave-Ayland     uint64_t regs[IOMMU_NREGS];
43*0ea833c2SMark Cave-Ayland } IOMMUState;
44*0ea833c2SMark Cave-Ayland 
45*0ea833c2SMark Cave-Ayland #define TYPE_SUN4U_IOMMU "sun4u-iommu"
46*0ea833c2SMark Cave-Ayland #define SUN4U_IOMMU(obj) OBJECT_CHECK(IOMMUState, (obj), TYPE_SUN4U_IOMMU)
47*0ea833c2SMark Cave-Ayland 
48*0ea833c2SMark Cave-Ayland #define TYPE_APB_IOMMU_MEMORY_REGION "pbm-iommu-memory-region"
49*0ea833c2SMark Cave-Ayland 
50*0ea833c2SMark Cave-Ayland #endif
51