1 /*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 32 #include <sys/param.h> 33 #include <sys/systm.h> 34 #include <sys/errno.h> 35 #include <sys/smp.h> 36 37 #include <machine/vmm.h> 38 #include "io/iommu.h" 39 40 static int 41 amdv_init(int ipinum) 42 { 43 44 printf("amdv_init: not implemented\n"); 45 return (ENXIO); 46 } 47 48 static int 49 amdv_cleanup(void) 50 { 51 52 printf("amdv_cleanup: not implemented\n"); 53 return (ENXIO); 54 } 55 56 static void 57 amdv_resume(void) 58 { 59 } 60 61 static void * 62 amdv_vminit(struct vm *vm, struct pmap *pmap) 63 { 64 65 printf("amdv_vminit: not implemented\n"); 66 return (NULL); 67 } 68 69 static int 70 amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap) 71 { 72 73 printf("amdv_vmrun: not implemented\n"); 74 return (ENXIO); 75 } 76 77 static void 78 amdv_vmcleanup(void *arg) 79 { 80 81 printf("amdv_vmcleanup: not implemented\n"); 82 return; 83 } 84 85 static int 86 amdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval) 87 { 88 89 printf("amdv_getreg: not implemented\n"); 90 return (EINVAL); 91 } 92 93 static int 94 amdv_setreg(void *arg, int vcpu, int regnum, uint64_t val) 95 { 96 97 printf("amdv_setreg: not implemented\n"); 98 return (EINVAL); 99 } 100 101 static int 102 amdv_getdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) 103 { 104 105 printf("amdv_get_desc: not implemented\n"); 106 return (EINVAL); 107 } 108 109 static int 110 amdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) 111 { 112 113 printf("amdv_get_desc: not implemented\n"); 114 return (EINVAL); 115 } 116 117 static int 118 amdv_inject_event(void *vmi, int vcpu, int type, int vector, 119 uint32_t error_code, int error_code_valid) 120 { 121 122 printf("amdv_inject_event: not implemented\n"); 123 return (EINVAL); 124 } 125 126 static int 127 amdv_getcap(void *arg, int vcpu, int type, int *retval) 128 { 129 130 printf("amdv_getcap: not implemented\n"); 131 return (EINVAL); 132 } 133 134 static int 135 amdv_setcap(void *arg, int vcpu, int type, int val) 136 { 137 138 printf("amdv_setcap: not implemented\n"); 139 return (EINVAL); 140 } 141 142 static struct vmspace * 143 amdv_vmspace_alloc(vm_offset_t min, vm_offset_t max) 144 { 145 146 printf("amdv_vmspace_alloc: not implemented\n"); 147 return (NULL); 148 } 149 150 static void 151 amdv_vmspace_free(struct vmspace *vmspace) 152 { 153 154 printf("amdv_vmspace_free: not implemented\n"); 155 return; 156 } 157 158 static struct vlapic * 159 amdv_vlapic_init(void *arg, int vcpuid) 160 { 161 162 panic("amdv_vlapic_init: not implmented"); 163 } 164 165 static void 166 amdv_vlapic_cleanup(void *arg, struct vlapic *vlapic) 167 { 168 169 panic("amdv_vlapic_cleanup: not implemented"); 170 } 171 172 struct vmm_ops vmm_ops_amd = { 173 amdv_init, 174 amdv_cleanup, 175 amdv_resume, 176 amdv_vminit, 177 amdv_vmrun, 178 amdv_vmcleanup, 179 amdv_getreg, 180 amdv_setreg, 181 amdv_getdesc, 182 amdv_setdesc, 183 amdv_inject_event, 184 amdv_getcap, 185 amdv_setcap, 186 amdv_vmspace_alloc, 187 amdv_vmspace_free, 188 amdv_vlapic_init, 189 amdv_vlapic_cleanup, 190 }; 191 192 static int 193 amd_iommu_init(void) 194 { 195 196 printf("amd_iommu_init: not implemented\n"); 197 return (ENXIO); 198 } 199 200 static void 201 amd_iommu_cleanup(void) 202 { 203 204 printf("amd_iommu_cleanup: not implemented\n"); 205 } 206 207 static void 208 amd_iommu_enable(void) 209 { 210 211 printf("amd_iommu_enable: not implemented\n"); 212 } 213 214 static void 215 amd_iommu_disable(void) 216 { 217 218 printf("amd_iommu_disable: not implemented\n"); 219 } 220 221 static void * 222 amd_iommu_create_domain(vm_paddr_t maxaddr) 223 { 224 225 printf("amd_iommu_create_domain: not implemented\n"); 226 return (NULL); 227 } 228 229 static void 230 amd_iommu_destroy_domain(void *domain) 231 { 232 233 printf("amd_iommu_destroy_domain: not implemented\n"); 234 } 235 236 static uint64_t 237 amd_iommu_create_mapping(void *domain, vm_paddr_t gpa, vm_paddr_t hpa, 238 uint64_t len) 239 { 240 241 printf("amd_iommu_create_mapping: not implemented\n"); 242 return (0); 243 } 244 245 static uint64_t 246 amd_iommu_remove_mapping(void *domain, vm_paddr_t gpa, uint64_t len) 247 { 248 249 printf("amd_iommu_remove_mapping: not implemented\n"); 250 return (0); 251 } 252 253 static void 254 amd_iommu_add_device(void *domain, int bus, int slot, int func) 255 { 256 257 printf("amd_iommu_add_device: not implemented\n"); 258 } 259 260 static void 261 amd_iommu_remove_device(void *domain, int bus, int slot, int func) 262 { 263 264 printf("amd_iommu_remove_device: not implemented\n"); 265 } 266 267 static void 268 amd_iommu_invalidate_tlb(void *domain) 269 { 270 271 printf("amd_iommu_invalidate_tlb: not implemented\n"); 272 } 273 274 struct iommu_ops iommu_ops_amd = { 275 amd_iommu_init, 276 amd_iommu_cleanup, 277 amd_iommu_enable, 278 amd_iommu_disable, 279 amd_iommu_create_domain, 280 amd_iommu_destroy_domain, 281 amd_iommu_create_mapping, 282 amd_iommu_remove_mapping, 283 amd_iommu_add_device, 284 amd_iommu_remove_device, 285 amd_iommu_invalidate_tlb, 286 }; 287