Home | History | Annotate | Line # | Download | only in xscale
ixp425.c revision 1.2
      1 /*	$NetBSD: ixp425.c,v 1.2 2003/05/23 09:41:02 ichiro Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2003
      5  *	Ichiro FUKUHARA <ichiro (at) ichiro.org>.
      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 Ichiro FUKUHARA.
     19  * 4. The name of the company nor the name of the author may be used to
     20  *    endorse or promote products derived from this software without specific
     21  *    prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
     24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26  * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
     27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  * SUCH DAMAGE.
     34  */
     35 
     36 #include <sys/cdefs.h>
     37 __KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.2 2003/05/23 09:41:02 ichiro Exp $");
     38 
     39 #include <sys/param.h>
     40 #include <sys/systm.h>
     41 #include <sys/device.h>
     42 #include <uvm/uvm.h>
     43 
     44 #include <machine/bus.h>
     45 
     46 #include <arm/xscale/ixp425reg.h>
     47 #include <arm/xscale/ixp425var.h>
     48 
     49 static struct ixp425_softc *ixp425_softc;
     50 
     51 void
     52 ixp425_attach(struct ixp425_softc *sc)
     53 {
     54 	ixp425_softc = sc;
     55 
     56 	printf("\n");
     57 }
     58 
     59 /*
     60  * IXP425 specific I/O registers mapping table
     61  */
     62 static struct pmap_ent	map_tbl_ixp425[] = {
     63 	{ "IXP425 Peripheral Registers",
     64 	  IXP425_IO_VBASE, IXP425_IO_HWBASE,
     65 	  IXP425_IO_SIZE,
     66 	  VM_PROT_READ|VM_PROT_WRITE,
     67 	  PTE_NOCACHE, },
     68 	{ "IXP425 Expansion bus Registers",
     69 	  IXP425_EXP_VBASE, IXP425_EXP_HWBASE,
     70 	  IXP425_EXP_SIZE,
     71 	  VM_PROT_READ|VM_PROT_WRITE,
     72 	  PTE_NOCACHE, },
     73 	{ "IXP425 PCI Configuration Registers",
     74 	  IXP425_PCI_VBASE, IXP425_PCI_HWBASE,
     75 	  IXP425_PCI_SIZE,
     76 	  VM_PROT_READ|VM_PROT_WRITE,
     77 	  PTE_NOCACHE, },
     78 
     79 	{ NULL, 0, 0, 0, 0, 0 },
     80 };
     81 
     82 /*
     83  * mapping virtual memories
     84  */
     85 void
     86 ixp425_pmap_chunk_table(vaddr_t l1pt, struct pmap_ent* m)
     87 {
     88 	int loop;
     89 
     90 	loop = 0;
     91 	while (m[loop].msg) {
     92 #ifdef DEBUG
     93 		printf("mapping 0x%lx(0x%05lx) -> 0x%lx %s...\n",
     94 			m[loop].pa, m[loop].sz, m[loop].va, m[loop].msg);
     95 #endif
     96 		pmap_map_chunk(l1pt, m[loop].va, m[loop].pa,
     97 			       m[loop].sz, m[loop].prot, m[loop].cache);
     98 		++loop;
     99 	}
    100 }
    101 
    102 /*
    103  * mapping I/O registers
    104  */
    105 void
    106 ixp425_pmap_io_reg(vaddr_t l1pt)
    107 {
    108 	ixp425_pmap_chunk_table(l1pt, map_tbl_ixp425);
    109 }
    110