Home | History | Annotate | Line # | Download | only in booke
booke_stubs.c revision 1.6
      1 /*-
      2  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
      3  * All rights reserved.
      4  *
      5  * This code is derived from software contributed to The NetBSD Foundation
      6  * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
      7  * Agency and which was developed by Matt Thomas of 3am Software Foundry.
      8  *
      9  * This material is based upon work supported by the Defense Advanced Research
     10  * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
     11  * Contract No. N66001-09-C-2073.
     12  * Approved for Public Release, Distribution Unlimited
     13  *
     14  * Redistribution and use in source and binary forms, with or without
     15  * modification, are permitted provided that the following conditions
     16  * are met:
     17  * 1. Redistributions of source code must retain the above copyright
     18  *    notice, this list of conditions and the following disclaimer.
     19  * 2. Redistributions in binary form must reproduce the above copyright
     20  *    notice, this list of conditions and the following disclaimer in the
     21  *    documentation and/or other materials provided with the distribution.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     24  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     27  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33  * POSSIBILITY OF SUCH DAMAGE.
     34  */
     35 
     36 #include <sys/cdefs.h>
     37 
     38 __KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.6 2011/06/15 15:22:56 matt Exp $");
     39 
     40 #include <sys/param.h>
     41 #include <sys/cpu.h>
     42 
     43 #include <powerpc/instr.h>
     44 #include <powerpc/booke/cpuvar.h>
     45 
     46 #define	__stub	__section(".stub") __noprofile
     47 
     48 void tlb_set_asid(uint32_t) __stub;
     49 
     50 void
     51 tlb_set_asid(uint32_t asid)
     52 {
     53 	(*cpu_md_ops.md_tlb_ops->md_tlb_set_asid)(asid);
     54 }
     55 
     56 uint32_t tlb_get_asid(void) __stub;
     57 
     58 uint32_t
     59 tlb_get_asid(void)
     60 {
     61 	return (*cpu_md_ops.md_tlb_ops->md_tlb_get_asid)();
     62 }
     63 
     64 void tlb_invalidate_all(void) __stub;
     65 
     66 void
     67 tlb_invalidate_all(void)
     68 {
     69 	(*cpu_md_ops.md_tlb_ops->md_tlb_invalidate_all)();
     70 }
     71 
     72 void tlb_invalidate_globals(void) __stub;
     73 
     74 void
     75 tlb_invalidate_globals(void)
     76 {
     77 	(*cpu_md_ops.md_tlb_ops->md_tlb_invalidate_globals)();
     78 }
     79 
     80 void tlb_invalidate_asids(uint32_t, uint32_t) __stub;
     81 
     82 void
     83 tlb_invalidate_asids(uint32_t asid_lo, uint32_t asid_hi)
     84 {
     85 	(*cpu_md_ops.md_tlb_ops->md_tlb_invalidate_asids)(asid_lo, asid_hi);
     86 }
     87 
     88 void tlb_invalidate_addr(vaddr_t, uint32_t) __stub;
     89 
     90 void
     91 tlb_invalidate_addr(vaddr_t va, uint32_t asid)
     92 {
     93 	(*cpu_md_ops.md_tlb_ops->md_tlb_invalidate_addr)(va, asid);
     94 }
     95 
     96 bool tlb_update_addr(vaddr_t, uint32_t, uint32_t, bool) __stub;
     97 
     98 bool
     99 tlb_update_addr(vaddr_t va, uint32_t asid, uint32_t pte, bool insert_p)
    100 {
    101 	return (*cpu_md_ops.md_tlb_ops->md_tlb_update_addr)(va, asid, pte, insert_p);
    102 }
    103 
    104 void tlb_read_entry(size_t, struct tlbmask *) __stub;
    105 
    106 void
    107 tlb_read_entry(size_t pos, struct tlbmask *tlb)
    108 {
    109 	(*cpu_md_ops.md_tlb_ops->md_tlb_read_entry)(pos, tlb);
    110 }
    111 
    112 u_int tlb_record_asids(u_long *, uint32_t) __stub;
    113 
    114 u_int
    115 tlb_record_asids(u_long *bitmap, uint32_t start)
    116 {
    117 	return (*cpu_md_ops.md_tlb_ops->md_tlb_record_asids)(bitmap, start);
    118 }
    119 
    120 void *tlb_mapiodev(paddr_t, psize_t) __stub;
    121 
    122 void *
    123 tlb_mapiodev(paddr_t pa, psize_t len)
    124 {
    125 	return (*cpu_md_ops.md_tlb_ops->md_tlb_mapiodev)(pa, len);
    126 }
    127 
    128 void tlb_unmapiodev(vaddr_t, vsize_t) __stub;
    129 
    130 void
    131 tlb_unmapiodev(vaddr_t va, vsize_t len)
    132 {
    133 	(*cpu_md_ops.md_tlb_ops->md_tlb_unmapiodev)(va, len);
    134 }
    135 
    136 int tlb_ioreserve(vaddr_t, vsize_t, uint32_t) __stub;
    137 
    138 int
    139 tlb_ioreserve(vaddr_t va, vsize_t len, uint32_t pte)
    140 {
    141 	return (*cpu_md_ops.md_tlb_ops->md_tlb_ioreserve)(va, len, pte);
    142 }
    143 
    144 int tlb_iorelease(vaddr_t) __stub;
    145 
    146 int
    147 tlb_iorelease(vaddr_t va)
    148 {
    149 	return (*cpu_md_ops.md_tlb_ops->md_tlb_iorelease)(va);
    150 }
    151 
    152 void tlb_dump(void (*)(const char *, ...)) __stub;
    153 
    154 void
    155 tlb_dump(void (*pr)(const char *, ...))
    156 {
    157 	(*cpu_md_ops.md_tlb_ops->md_tlb_dump)(pr);
    158 }
    159 
    160 void tlb_walk(void *, bool (*)(void *, vaddr_t, uint32_t, uint32_t))
    161     __stub;
    162 
    163 void
    164 tlb_walk(void *ctx, bool (*func)(void *, vaddr_t, uint32_t, uint32_t))
    165 {
    166 	(*cpu_md_ops.md_tlb_ops->md_tlb_walk)(ctx, func);
    167 }
    168