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