cheetah.c revision 181701
1112399Sjake/*- 2112399Sjake * Copyright (c) 2003 Jake Burkholder. 3112399Sjake * All rights reserved. 4112399Sjake * 5112399Sjake * Redistribution and use in source and binary forms, with or without 6112399Sjake * modification, are permitted provided that the following conditions 7112399Sjake * are met: 8112399Sjake * 1. Redistributions of source code must retain the above copyright 9112399Sjake * notice, this list of conditions and the following disclaimer. 10112399Sjake * 2. Redistributions in binary form must reproduce the above copyright 11112399Sjake * notice, this list of conditions and the following disclaimer in the 12112399Sjake * documentation and/or other materials provided with the distribution. 13112399Sjake * 14112399Sjake * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15112399Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16112399Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17112399Sjake * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18112399Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19112399Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20112399Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21112399Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22112399Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23112399Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24112399Sjake * SUCH DAMAGE. 25112399Sjake */ 26112399Sjake 27176994Smarius#include <sys/cdefs.h> 28176994Smarius__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/cheetah.c 181701 2008-08-13 20:30:28Z marius $"); 29176994Smarius 30112399Sjake#include "opt_pmap.h" 31112399Sjake 32112399Sjake#include <sys/param.h> 33181701Smarius#include <sys/systm.h> 34112399Sjake#include <sys/lock.h> 35112399Sjake#include <sys/mutex.h> 36112399Sjake#include <sys/smp.h> 37112399Sjake 38112399Sjake#include <vm/vm.h> 39112399Sjake#include <vm/pmap.h> 40112399Sjake 41112399Sjake#include <machine/cache.h> 42112399Sjake#include <machine/cpufunc.h> 43112399Sjake#include <machine/smp.h> 44113453Sjake#include <machine/tlb.h> 45112399Sjake 46112399Sjake/* 47122464Sjake * Enable level 1 caches. 48122464Sjake */ 49122464Sjakevoid 50122464Sjakecheetah_cache_enable(void) 51122464Sjake{ 52176994Smarius 53122464Sjake} 54122464Sjake 55122464Sjake/* 56122464Sjake * Flush all lines from the level 1 caches. 57122464Sjake */ 58122464Sjakevoid 59122464Sjakecheetah_cache_flush(void) 60122464Sjake{ 61176994Smarius 62122464Sjake} 63122464Sjake 64122464Sjake/* 65112399Sjake * Flush a physical page from the data cache. 66112399Sjake */ 67112399Sjakevoid 68113238Sjakecheetah_dcache_page_inval(vm_paddr_t spa) 69112399Sjake{ 70113238Sjake vm_paddr_t pa; 71112399Sjake void *cookie; 72112399Sjake 73181701Smarius KASSERT((spa & PAGE_MASK) == 0, ("%s: pa not page aligned", __func__)); 74112399Sjake cookie = ipi_dcache_page_inval(tl_ipi_cheetah_dcache_page_inval, spa); 75112399Sjake for (pa = spa; pa < spa + PAGE_SIZE; pa += cache.dc_linesize) 76112399Sjake stxa_sync(pa, ASI_DCACHE_INVALIDATE, 0); 77112399Sjake ipi_wait(cookie); 78112399Sjake} 79112399Sjake 80112399Sjake/* 81112399Sjake * Flush a physical page from the intsruction cache. Instruction cache 82112399Sjake * consistency is maintained by hardware. 83112399Sjake */ 84112399Sjakevoid 85113238Sjakecheetah_icache_page_inval(vm_paddr_t pa) 86112399Sjake{ 87176994Smarius 88112399Sjake} 89113453Sjake 90176994Smarius/* 91176994Smarius * Flush all non-locked mappings from the TLB. 92176994Smarius */ 93113453Sjakevoid 94176994Smariuscheetah_tlb_flush_nonlocked(void) 95176994Smarius{ 96176994Smarius 97176994Smarius panic("cheetah_tlb_flush_nonlocked"); 98176994Smarius} 99176994Smarius 100176994Smarius/* 101176994Smarius * Flush all user mappings from the TLB. 102176994Smarius */ 103176994Smariusvoid 104113453Sjakecheetah_tlb_flush_user(void) 105113453Sjake{ 106176994Smarius 107113453Sjake panic("cheetah_tlb_flush_user"); 108113453Sjake} 109