Home | History | Annotate | Line # | Download | only in footbridge
footbridge_machdep.c revision 1.5
      1 /*	$NetBSD: footbridge_machdep.c,v 1.5 2002/01/05 22:41:48 chris Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1997 Mark Brinicombe.
      5  * Copyright (c) 1997 Causality Limited
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This product includes software developed by Mark Brinicombe
     19  *	for the NetBSD Project.
     20  * 4. The name of the company nor the name of the author may be used to
     21  *    endorse or promote products derived from this software without specific
     22  *    prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     25  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     26  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     27  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     28  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     30  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  */
     36 
     37 #include <sys/param.h>
     38 #include <sys/systm.h>
     39 #include <uvm/uvm_extern.h>
     40 #include <machine/pmap.h>
     41 #include <arm/footbridge/footbridge.h>
     42 #include <arm/footbridge/dc21285mem.h>
     43 
     44 extern pt_entry_t *pmap_pte	__P((pmap_t pmap, vm_offset_t va));
     45 
     46 /*
     47  * For optimal cache cleaning we need two 16K banks of
     48  * virtual address space that NOTHING else will access
     49  * and then we alternate the cache cleaning between the
     50  * two banks.
     51  * The cache cleaning code requires requires 2 banks aligned
     52  * on total size boundry so the banks can be alternated by
     53  * eorring the size bit (assumes the bank size is a power of 2)
     54  *
     55  * On the DC21285 we have a special cache clean area so we will
     56  * use it.
     57  */
     58 
     59 extern unsigned int sa110_cache_clean_addr;
     60 extern unsigned int sa110_cache_clean_size;
     61 
     62 #if 0
     63 void
     64 footbridge_sa110_cc_setup(void)
     65 {
     66 	vm_offset_t vaddr;
     67 	vm_offset_t addr;
     68 	int cleanarea;
     69 	int loop;
     70 	pt_entry_t *pte;
     71 
     72 	cleanarea = (NBPG * 4) * 2;
     73 	vaddr = uvm_km_valloc(kernel_map, cleanarea + (NBPG * 4));
     74 	addr = (vaddr + (cleanarea - 1)) & ~(cleanarea - 1);
     75 
     76 /*	printf("vaddr=%x addr=%x\n", vaddr, addr);*/
     77 
     78 	for (loop = 0; loop < cleanarea; loop += NBPG) {
     79 		pte = pmap_pte(pmap_kernel(), (addr + loop));
     80 		*pte = L2_PTE(DC21285_SA_CACHE_FLUSH_BASE + loop, AP_KR);
     81 	}
     82 	sa110_cache_clean_addr = addr;
     83 	sa110_cache_clean_size = cleanarea / 2;
     84 }
     85 #else
     86 void
     87 footbridge_sa110_cc_setup(void)
     88 {
     89 	sa110_cache_clean_addr = DC21285_CACHE_FLUSH_VBASE;
     90 	sa110_cache_clean_size = (NBPG * 4);
     91 }
     92 #endif
     93