1221828Sgrehan/*- 2221828Sgrehan * Copyright (c) 2011 NetApp, Inc. 3221828Sgrehan * All rights reserved. 4221828Sgrehan * 5221828Sgrehan * Redistribution and use in source and binary forms, with or without 6221828Sgrehan * modification, are permitted provided that the following conditions 7221828Sgrehan * are met: 8221828Sgrehan * 1. Redistributions of source code must retain the above copyright 9221828Sgrehan * notice, this list of conditions and the following disclaimer. 10221828Sgrehan * 2. Redistributions in binary form must reproduce the above copyright 11221828Sgrehan * notice, this list of conditions and the following disclaimer in the 12221828Sgrehan * documentation and/or other materials provided with the distribution. 13221828Sgrehan * 14221828Sgrehan * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND 15221828Sgrehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16221828Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17221828Sgrehan * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE 18221828Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19221828Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20221828Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21221828Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22221828Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23221828Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24221828Sgrehan * SUCH DAMAGE. 25221828Sgrehan * 26221828Sgrehan * $FreeBSD$ 27221828Sgrehan */ 28221828Sgrehan 29221828Sgrehan#include <sys/cdefs.h> 30221828Sgrehan__FBSDID("$FreeBSD$"); 31221828Sgrehan 32221828Sgrehan#include <sys/param.h> 33221828Sgrehan#include <sys/systm.h> 34221828Sgrehan#include <sys/errno.h> 35223621Sgrehan#include <sys/smp.h> 36221828Sgrehan 37221828Sgrehan#include <machine/vmm.h> 38221828Sgrehan#include "io/iommu.h" 39221828Sgrehan 40221828Sgrehanstatic int 41221828Sgrehanamdv_init(void) 42221828Sgrehan{ 43221828Sgrehan 44221828Sgrehan printf("amdv_init: not implemented\n"); 45221828Sgrehan return (ENXIO); 46221828Sgrehan} 47221828Sgrehan 48221828Sgrehanstatic int 49221828Sgrehanamdv_cleanup(void) 50221828Sgrehan{ 51221828Sgrehan 52221828Sgrehan printf("amdv_cleanup: not implemented\n"); 53221828Sgrehan return (ENXIO); 54221828Sgrehan} 55221828Sgrehan 56221828Sgrehanstatic void * 57256072Sneelamdv_vminit(struct vm *vm, struct pmap *pmap) 58221828Sgrehan{ 59221828Sgrehan 60221828Sgrehan printf("amdv_vminit: not implemented\n"); 61221828Sgrehan return (NULL); 62221828Sgrehan} 63221828Sgrehan 64221828Sgrehanstatic int 65256072Sneelamdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap) 66221828Sgrehan{ 67221828Sgrehan 68221828Sgrehan printf("amdv_vmrun: not implemented\n"); 69221828Sgrehan return (ENXIO); 70221828Sgrehan} 71221828Sgrehan 72221828Sgrehanstatic void 73221828Sgrehanamdv_vmcleanup(void *arg) 74221828Sgrehan{ 75221828Sgrehan 76221828Sgrehan printf("amdv_vmcleanup: not implemented\n"); 77221828Sgrehan return; 78221828Sgrehan} 79221828Sgrehan 80221828Sgrehanstatic int 81221828Sgrehanamdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval) 82221828Sgrehan{ 83221828Sgrehan 84221828Sgrehan printf("amdv_getreg: not implemented\n"); 85221828Sgrehan return (EINVAL); 86221828Sgrehan} 87221828Sgrehan 88221828Sgrehanstatic int 89221828Sgrehanamdv_setreg(void *arg, int vcpu, int regnum, uint64_t val) 90221828Sgrehan{ 91221828Sgrehan 92221828Sgrehan printf("amdv_setreg: not implemented\n"); 93221828Sgrehan return (EINVAL); 94221828Sgrehan} 95221828Sgrehan 96221828Sgrehanstatic int 97221828Sgrehanamdv_getdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) 98221828Sgrehan{ 99221828Sgrehan 100221828Sgrehan printf("amdv_get_desc: not implemented\n"); 101221828Sgrehan return (EINVAL); 102221828Sgrehan} 103221828Sgrehan 104221828Sgrehanstatic int 105221828Sgrehanamdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) 106221828Sgrehan{ 107221828Sgrehan 108221828Sgrehan printf("amdv_get_desc: not implemented\n"); 109221828Sgrehan return (EINVAL); 110221828Sgrehan} 111221828Sgrehan 112221828Sgrehanstatic int 113221828Sgrehanamdv_inject_event(void *vmi, int vcpu, int type, int vector, 114221828Sgrehan uint32_t error_code, int error_code_valid) 115221828Sgrehan{ 116221828Sgrehan 117221828Sgrehan printf("amdv_inject_event: not implemented\n"); 118221828Sgrehan return (EINVAL); 119221828Sgrehan} 120221828Sgrehan 121221828Sgrehanstatic int 122221828Sgrehanamdv_getcap(void *arg, int vcpu, int type, int *retval) 123221828Sgrehan{ 124221828Sgrehan 125221828Sgrehan printf("amdv_getcap: not implemented\n"); 126221828Sgrehan return (EINVAL); 127221828Sgrehan} 128221828Sgrehan 129221828Sgrehanstatic int 130221828Sgrehanamdv_setcap(void *arg, int vcpu, int type, int val) 131221828Sgrehan{ 132221828Sgrehan 133221828Sgrehan printf("amdv_setcap: not implemented\n"); 134221828Sgrehan return (EINVAL); 135221828Sgrehan} 136221828Sgrehan 137256072Sneelstatic struct vmspace * 138256072Sneelamdv_vmspace_alloc(vm_offset_t min, vm_offset_t max) 139256072Sneel{ 140256072Sneel 141256072Sneel printf("amdv_vmspace_alloc: not implemented\n"); 142256072Sneel return (NULL); 143256072Sneel} 144256072Sneel 145256072Sneelstatic void 146256072Sneelamdv_vmspace_free(struct vmspace *vmspace) 147256072Sneel{ 148256072Sneel 149256072Sneel printf("amdv_vmspace_free: not implemented\n"); 150256072Sneel return; 151256072Sneel} 152256072Sneel 153221828Sgrehanstruct vmm_ops vmm_ops_amd = { 154221828Sgrehan amdv_init, 155221828Sgrehan amdv_cleanup, 156221828Sgrehan amdv_vminit, 157221828Sgrehan amdv_vmrun, 158221828Sgrehan amdv_vmcleanup, 159221828Sgrehan amdv_getreg, 160221828Sgrehan amdv_setreg, 161221828Sgrehan amdv_getdesc, 162221828Sgrehan amdv_setdesc, 163221828Sgrehan amdv_inject_event, 164221828Sgrehan amdv_getcap, 165256072Sneel amdv_setcap, 166256072Sneel amdv_vmspace_alloc, 167256072Sneel amdv_vmspace_free, 168221828Sgrehan}; 169221828Sgrehan 170221828Sgrehanstatic int 171221828Sgrehanamd_iommu_init(void) 172221828Sgrehan{ 173221828Sgrehan 174221828Sgrehan printf("amd_iommu_init: not implemented\n"); 175221828Sgrehan return (ENXIO); 176221828Sgrehan} 177221828Sgrehan 178221828Sgrehanstatic void 179221828Sgrehanamd_iommu_cleanup(void) 180221828Sgrehan{ 181221828Sgrehan 182221828Sgrehan printf("amd_iommu_cleanup: not implemented\n"); 183221828Sgrehan} 184221828Sgrehan 185221828Sgrehanstatic void 186221828Sgrehanamd_iommu_enable(void) 187221828Sgrehan{ 188221828Sgrehan 189221828Sgrehan printf("amd_iommu_enable: not implemented\n"); 190221828Sgrehan} 191221828Sgrehan 192221828Sgrehanstatic void 193221828Sgrehanamd_iommu_disable(void) 194221828Sgrehan{ 195221828Sgrehan 196221828Sgrehan printf("amd_iommu_disable: not implemented\n"); 197221828Sgrehan} 198221828Sgrehan 199221828Sgrehanstatic void * 200221828Sgrehanamd_iommu_create_domain(vm_paddr_t maxaddr) 201221828Sgrehan{ 202221828Sgrehan 203221828Sgrehan printf("amd_iommu_create_domain: not implemented\n"); 204221828Sgrehan return (NULL); 205221828Sgrehan} 206221828Sgrehan 207221828Sgrehanstatic void 208221828Sgrehanamd_iommu_destroy_domain(void *domain) 209221828Sgrehan{ 210221828Sgrehan 211221828Sgrehan printf("amd_iommu_destroy_domain: not implemented\n"); 212221828Sgrehan} 213221828Sgrehan 214221828Sgrehanstatic uint64_t 215221828Sgrehanamd_iommu_create_mapping(void *domain, vm_paddr_t gpa, vm_paddr_t hpa, 216221828Sgrehan uint64_t len) 217221828Sgrehan{ 218221828Sgrehan 219221828Sgrehan printf("amd_iommu_create_mapping: not implemented\n"); 220221828Sgrehan return (0); 221221828Sgrehan} 222221828Sgrehan 223241362Sneelstatic uint64_t 224241362Sneelamd_iommu_remove_mapping(void *domain, vm_paddr_t gpa, uint64_t len) 225241362Sneel{ 226241362Sneel 227241362Sneel printf("amd_iommu_remove_mapping: not implemented\n"); 228241362Sneel return (0); 229241362Sneel} 230241362Sneel 231221828Sgrehanstatic void 232221828Sgrehanamd_iommu_add_device(void *domain, int bus, int slot, int func) 233221828Sgrehan{ 234221828Sgrehan 235221828Sgrehan printf("amd_iommu_add_device: not implemented\n"); 236221828Sgrehan} 237221828Sgrehan 238221828Sgrehanstatic void 239221828Sgrehanamd_iommu_remove_device(void *domain, int bus, int slot, int func) 240221828Sgrehan{ 241221828Sgrehan 242221828Sgrehan printf("amd_iommu_remove_device: not implemented\n"); 243221828Sgrehan} 244221828Sgrehan 245241362Sneelstatic void 246241362Sneelamd_iommu_invalidate_tlb(void *domain) 247241362Sneel{ 248241362Sneel 249241362Sneel printf("amd_iommu_invalidate_tlb: not implemented\n"); 250241362Sneel} 251241362Sneel 252221828Sgrehanstruct iommu_ops iommu_ops_amd = { 253221828Sgrehan amd_iommu_init, 254221828Sgrehan amd_iommu_cleanup, 255221828Sgrehan amd_iommu_enable, 256221828Sgrehan amd_iommu_disable, 257221828Sgrehan amd_iommu_create_domain, 258221828Sgrehan amd_iommu_destroy_domain, 259221828Sgrehan amd_iommu_create_mapping, 260241362Sneel amd_iommu_remove_mapping, 261221828Sgrehan amd_iommu_add_device, 262221828Sgrehan amd_iommu_remove_device, 263241362Sneel amd_iommu_invalidate_tlb, 264221828Sgrehan}; 265