xref: /netbsd-src/sys/arch/arm/xscale/ixp425.c (revision d710132b4b8ce7f7cccaaf660cb16aa16b4077a0)
1 /*	$NetBSD: ixp425.c,v 1.3 2003/05/24 01:59:32 ichiro Exp $ */
2 
3 /*
4  * Copyright (c) 2003
5  *	Ichiro FUKUHARA <ichiro@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.3 2003/05/24 01:59:32 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 #include <evbarm/ixdp425/ixdp425reg.h>
50 
51 static struct ixp425_softc *ixp425_softc;
52 
53 void
54 ixp425_attach(struct ixp425_softc *sc)
55 {
56 	ixp425_softc = sc;
57 
58 	printf("\n");
59 }
60 
61 /*
62  * IXP425 specific I/O registers mapping table
63  */
64 static struct pmap_ent	map_tbl_ixp425[] = {
65 	{ "IXP425 Peripheral Registers",
66 	  IXP425_IO_VBASE, IXP425_IO_HWBASE,
67 	  IXP425_IO_SIZE,
68 	  VM_PROT_READ|VM_PROT_WRITE,
69 	  PTE_NOCACHE, },
70 	{ "IXP425 Expansion bus Registers",
71 	  IXP425_EXP_VBASE, IXP425_EXP_HWBASE,
72 	  IXP425_EXP_SIZE,
73 	  VM_PROT_READ|VM_PROT_WRITE,
74 	  PTE_NOCACHE, },
75 	{ "IXP425 PCI Configuration Registers",
76 	  IXP425_PCI_VBASE, IXP425_PCI_HWBASE,
77 	  IXP425_PCI_SIZE,
78 	  VM_PROT_READ|VM_PROT_WRITE,
79 	  PTE_NOCACHE, },
80 
81 	{ NULL, 0, 0, 0, 0, 0 },
82 };
83 
84 /*
85  * mapping virtual memories
86  */
87 void
88 ixp425_pmap_chunk_table(vaddr_t l1pt, struct pmap_ent* m)
89 {
90 	int loop;
91 
92 	loop = 0;
93 	while (m[loop].msg) {
94 #ifdef DEBUG
95 		printf("mapping 0x%lx(0x%05lx) -> 0x%lx %s...\n",
96 			m[loop].pa, m[loop].sz, m[loop].va, m[loop].msg);
97 #endif
98 		pmap_map_chunk(l1pt, m[loop].va, m[loop].pa,
99 			       m[loop].sz, m[loop].prot, m[loop].cache);
100 		++loop;
101 	}
102 }
103 
104 /*
105  * mapping I/O registers
106  */
107 void
108 ixp425_pmap_io_reg(vaddr_t l1pt)
109 {
110 	ixp425_pmap_chunk_table(l1pt, map_tbl_ixp425);
111 }
112