virt_machdep.c revision 296158
179455Sobrien/*- 279455Sobrien * Copyright (c) 2015 Andrew Turner 379455Sobrien * All rights reserved. 479455Sobrien * 579455Sobrien * Redistribution and use in source and binary forms, with or without 679455Sobrien * modification, are permitted provided that the following conditions 779455Sobrien * are met: 879455Sobrien * 1. Redistributions of source code must retain the above copyright 979455Sobrien * notice, this list of conditions and the following disclaimer. 1079455Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1179455Sobrien * notice, this list of conditions and the following disclaimer in the 1279455Sobrien * documentation and/or other materials provided with the distribution. 1379455Sobrien * 1479455Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1579455Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1679455Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1779455Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1879455Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1979455Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2079455Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2179455Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2279455Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2379455Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2479455Sobrien * SUCH DAMAGE. 2579455Sobrien * 2679455Sobrien */ 2779455Sobrien 2879455Sobrien#include "opt_platform.h" 2979455Sobrien 3079455Sobrien#include <sys/cdefs.h> 3179455Sobrien__FBSDID("$FreeBSD: head/sys/arm/qemu/virt_machdep.c 296158 2016-02-28 13:43:58Z andrew $"); 3279455Sobrien 3379455Sobrien#define _ARM32_BUS_DMA_PRIVATE 3479455Sobrien#include <sys/param.h> 3579455Sobrien#include <sys/systm.h> 3679455Sobrien 3779455Sobrien#include <vm/vm.h> 3879455Sobrien 3979455Sobrien#include <machine/bus.h> 4079455Sobrien#include <machine/devmap.h> 4179455Sobrien#include <machine/platform.h> 4279455Sobrien#include <machine/platformvar.h> 4379455Sobrien 4479455Sobrien#include <arm/qemu/virt_mp.h> 4579455Sobrien 4679455Sobrien#include "platform_if.h" 4779455Sobrien 4879455Sobrienstruct arm32_dma_range * 4979455Sobrienbus_dma_get_range(void) 5079455Sobrien{ 5179455Sobrien 5279455Sobrien return (NULL); 5379455Sobrien} 5479455Sobrien 5579455Sobrienint 5679455Sobrienbus_dma_get_range_nb(void) 5779455Sobrien{ 5879455Sobrien 5979455Sobrien return (0); 6079455Sobrien} 6179455Sobrien 6279455Sobrienvoid 6379455Sobriencpu_reset(void) 6479455Sobrien{ 6579455Sobrien 6679455Sobrien while (1); 6779455Sobrien} 6879455Sobrien 6979455Sobrienstatic vm_offset_t 7079455Sobrienvirt_lastaddr(platform_t plat) 7179455Sobrien{ 7279455Sobrien 7379455Sobrien return (arm_devmap_lastaddr()); 7479455Sobrien} 7579455Sobrien 7679455Sobrien/* 7779455Sobrien * Set up static device mappings. 7879455Sobrien */ 7979455Sobrienstatic int 8079455Sobrienvirt_devmap_init(platform_t plat) 8179455Sobrien{ 8279455Sobrien 8379455Sobrien arm_devmap_add_entry(0x09000000, 0x100000); /* Uart */ 8479455Sobrien return (0); 8579455Sobrien} 8679455Sobrien 8779455Sobrienstatic platform_method_t virt_methods[] = { 8879455Sobrien PLATFORMMETHOD(platform_devmap_init, virt_devmap_init), 8979455Sobrien PLATFORMMETHOD(platform_lastaddr, virt_lastaddr), 9079455Sobrien 9179455Sobrien#ifdef SMP 9279455Sobrien PLATFORMMETHOD(platform_mp_start_ap, virt_mp_start_ap), 9379455Sobrien PLATFORMMETHOD(platform_mp_setmaxid, virt_mp_setmaxid), 9479455Sobrien#endif 9579455Sobrien 9679455Sobrien PLATFORMMETHOD_END, 9779455Sobrien}; 9879455Sobrien 9979455SobrienFDT_PLATFORM_DEF(virt, "virt", 0, "linux,dummy-virt"); 10079455Sobrien