1222798Smarcel/*- 2222798Smarcel * Copyright (c) 2011 Marcel Moolenaar 3222798Smarcel * All rights reserved. 4222798Smarcel * 5222798Smarcel * Redistribution and use in source and binary forms, with or without 6222798Smarcel * modification, are permitted provided that the following conditions 7222798Smarcel * are met: 8222798Smarcel * 9222798Smarcel * 1. Redistributions of source code must retain the above copyright 10222798Smarcel * notice, this list of conditions and the following disclaimer. 11222798Smarcel * 2. Redistributions in binary form must reproduce the above copyright 12222798Smarcel * notice, this list of conditions and the following disclaimer in the 13222798Smarcel * documentation and/or other materials provided with the distribution. 14222798Smarcel * 15222798Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16222798Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17222798Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18222798Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19222798Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20222798Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21222798Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22222798Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23222798Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24222798Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25222798Smarcel */ 26222798Smarcel 27222798Smarcel#include <sys/cdefs.h> 28222798Smarcel__FBSDID("$FreeBSD$"); 29222798Smarcel 30222798Smarcel#include <stand.h> 31222798Smarcel#include <machine/ia64_cpu.h> 32222798Smarcel 33222798Smarcel#include "libia64.h" 34222798Smarcel 35222798Smarcelvoid 36222798Smarcelia64_sync_icache(vm_offset_t va, size_t sz) 37222798Smarcel{ 38222798Smarcel uintptr_t pa; 39222798Smarcel size_t cnt, max; 40222798Smarcel 41222798Smarcel while (sz > 0) { 42222798Smarcel max = sz; 43222798Smarcel pa = (uintptr_t)ia64_va2pa(va, &max); 44222798Smarcel for (cnt = 0; cnt < max; cnt += 32) 45222798Smarcel ia64_fc_i(pa + cnt); 46222798Smarcel ia64_sync_i(); 47222798Smarcel va += max; 48222798Smarcel sz -= max; 49222798Smarcel } 50222798Smarcel ia64_srlz_i(); 51222798Smarcel} 52