10ea833c2SMark Cave-Ayland /* 20ea833c2SMark Cave-Ayland * QEMU sun4u IOMMU emulation 30ea833c2SMark Cave-Ayland * 40ea833c2SMark Cave-Ayland * Copyright (c) 2006 Fabrice Bellard 50ea833c2SMark Cave-Ayland * Copyright (c) 2012,2013 Artyom Tarasenko 60ea833c2SMark Cave-Ayland * Copyright (c) 2017 Mark Cave-Ayland 70ea833c2SMark Cave-Ayland * 80ea833c2SMark Cave-Ayland * Permission is hereby granted, free of charge, to any person obtaining a copy 90ea833c2SMark Cave-Ayland * of this software and associated documentation files (the "Software"), to deal 100ea833c2SMark Cave-Ayland * in the Software without restriction, including without limitation the rights 110ea833c2SMark Cave-Ayland * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 120ea833c2SMark Cave-Ayland * copies of the Software, and to permit persons to whom the Software is 130ea833c2SMark Cave-Ayland * furnished to do so, subject to the following conditions: 140ea833c2SMark Cave-Ayland * 150ea833c2SMark Cave-Ayland * The above copyright notice and this permission notice shall be included in 160ea833c2SMark Cave-Ayland * all copies or substantial portions of the Software. 170ea833c2SMark Cave-Ayland * 180ea833c2SMark Cave-Ayland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 190ea833c2SMark Cave-Ayland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 200ea833c2SMark Cave-Ayland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 210ea833c2SMark Cave-Ayland * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 220ea833c2SMark Cave-Ayland * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 230ea833c2SMark Cave-Ayland * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 240ea833c2SMark Cave-Ayland * THE SOFTWARE. 250ea833c2SMark Cave-Ayland */ 260ea833c2SMark Cave-Ayland 270ea833c2SMark Cave-Ayland #ifndef SUN4U_IOMMU_H 280ea833c2SMark Cave-Ayland #define SUN4U_IOMMU_H 290ea833c2SMark Cave-Ayland 300ea833c2SMark Cave-Ayland #include "hw/sysbus.h" 31*db1015e9SEduardo Habkost #include "qom/object.h" 320ea833c2SMark Cave-Ayland 330ea833c2SMark Cave-Ayland #define IOMMU_NREGS 3 340ea833c2SMark Cave-Ayland 35*db1015e9SEduardo Habkost struct IOMMUState { 360ea833c2SMark Cave-Ayland SysBusDevice parent_obj; 370ea833c2SMark Cave-Ayland 380ea833c2SMark Cave-Ayland AddressSpace iommu_as; 390ea833c2SMark Cave-Ayland IOMMUMemoryRegion iommu; 400ea833c2SMark Cave-Ayland 410ea833c2SMark Cave-Ayland MemoryRegion iomem; 420ea833c2SMark Cave-Ayland uint64_t regs[IOMMU_NREGS]; 43*db1015e9SEduardo Habkost }; 44*db1015e9SEduardo Habkost typedef struct IOMMUState IOMMUState; 450ea833c2SMark Cave-Ayland 460ea833c2SMark Cave-Ayland #define TYPE_SUN4U_IOMMU "sun4u-iommu" 470ea833c2SMark Cave-Ayland #define SUN4U_IOMMU(obj) OBJECT_CHECK(IOMMUState, (obj), TYPE_SUN4U_IOMMU) 480ea833c2SMark Cave-Ayland 494c9fbc38SMark Cave-Ayland #define TYPE_SUN4U_IOMMU_MEMORY_REGION "sun4u-iommu-memory-region" 500ea833c2SMark Cave-Ayland 510ea833c2SMark Cave-Ayland #endif 52