1 /* 2 * xen/include/asm-arm/mmio.h 3 * 4 * ARM I/O handlers 5 * 6 * Copyright (c) 2011 Citrix Systems. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 */ 18 19 #ifndef __ASM_ARM_MMIO_H__ 20 #define __ASM_ARM_MMIO_H__ 21 22 #include <xen/lib.h> 23 #include <xen/rwlock.h> 24 #include <asm/processor.h> 25 #include <asm/regs.h> 26 27 #define MAX_IO_HANDLER 16 28 29 typedef struct 30 { 31 struct hsr_dabt dabt; 32 vaddr_t gva; 33 paddr_t gpa; 34 } mmio_info_t; 35 36 typedef int (*mmio_read_t)(struct vcpu *v, mmio_info_t *info, 37 register_t *r, void *priv); 38 typedef int (*mmio_write_t)(struct vcpu *v, mmio_info_t *info, 39 register_t r, void *priv); 40 41 struct mmio_handler_ops { 42 mmio_read_t read; 43 mmio_write_t write; 44 }; 45 46 struct mmio_handler { 47 paddr_t addr; 48 paddr_t size; 49 const struct mmio_handler_ops *ops; 50 void *priv; 51 }; 52 53 struct vmmio { 54 int num_entries; 55 int max_num_entries; 56 rwlock_t lock; 57 struct mmio_handler *handlers; 58 }; 59 60 extern int handle_mmio(mmio_info_t *info); 61 void register_mmio_handler(struct domain *d, 62 const struct mmio_handler_ops *ops, 63 paddr_t addr, paddr_t size, void *priv); 64 int domain_io_init(struct domain *d, int max_count); 65 void domain_io_free(struct domain *d); 66 67 68 #endif /* __ASM_ARM_MMIO_H__ */ 69 70 /* 71 * Local variables: 72 * mode: C 73 * c-file-style: "BSD" 74 * c-basic-offset: 4 75 * indent-tabs-mode: nil 76 * End: 77 */ 78