/[gxemul]/trunk/src/include/ppc_bat.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/src/include/ppc_bat.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (show annotations)
Mon Oct 8 16:19:23 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 8056 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1055 2005/11/25 22:48:36 debug Exp $
20051031	Adding disassembly support for more ARM instructions (clz,
		smul* etc), and adding a hack to support "new tiny" pages
		for StrongARM.
20051101	Minor documentation updates (NetBSD 2.0.2 -> 2.1, and OpenBSD
		3.7 -> 3.8, and lots of testing).
		Changing from 1-sector PIO mode 0 transfers to 128-sector PIO
		mode 3 (in dev_wdc).
		Various minor ARM dyntrans updates (pc-relative loads from
		within the same page as the instruction are now treated as
		constant "mov").
20051102	Re-enabling instruction combinations (they were accidentally
		disabled).
		Dyntrans TLB entries are now overwritten using a round-robin
		scheme instead of randomly. This increases performance.
		Fixing a typo in file.c (thanks to Chuan-Hua Chang for
		noticing it).
		Experimenting with adding ATAPI support to dev_wdc (to make
		emulated *BSD detect cdroms as cdroms, not harddisks).
20051104	Various minor updates.
20051105	Continuing on the ATAPI emulation. Seems to work well enough
		for a NetBSD/cats installation, but not OpenBSD/cats.
		Various other updates.
20051106	Modifying the -Y command line option to allow scaleup with
		certain graphic controllers (only dev_vga so far), not just
		scaledown.
		Some minor dyntrans cleanups.
20051107	Beginning a cleanup up the PCI subsystem (removing the
		read_register hack, etc).
20051108	Continuing the cleanup; splitting up some pci devices into a
		normal autodev device and some separate pci glue code.
20051109	Continuing on the PCI bus stuff; all old pci_*.c have been
		incorporated into normal devices and/or rewritten as glue code
		only, adding a dummy Intel 82371AB PIIX4 for Malta (not really
		tested yet).
		Minor pckbc fix so that Linux doesn't complain.
		Working on the DEC 21143 NIC (ethernet mac rom stuff mostly).
		Various other minor fixes.
20051110	Some more ARM dyntrans fine-tuning (e.g. some instruction
		combinations (cmps followed by conditional branch within the
		same page) and special cases for DPIs with regform when the
		shifter isn't used).
20051111	ARM dyntrans updates: O(n)->O(1) for just-mark-as-non-
		writable in the generic pc_to_pointers function, and some other
		minor hacks.
		Merging Cobalt and evbmips (Malta) ISA interrupt handling,
		and some minor fixes to allow Linux to accept harddisk irqs.
20051112	Minor device updates (pckbc, dec21143, lpt, ...), most
		importantly fixing the ALI M1543/M5229 so that harddisk irqs
		work with Linux/CATS.
20051113	Some more generalizations of the PCI subsystem.
		Finally took the time to add a hack for SCSI CDROM TOCs; this
		enables OpenBSD to use partition 'a' (as needed by the OpenBSD
		installer), and Windows NT's installer to get a bit further.
		Also fixing dev_wdc to allow Linux to detect ATAPI CDROMs.
		Continuing on the DEC 21143.
20051114	Minor ARM dyntrans tweaks; ARM cmps+branch optimization when
		comparing with 0, and generalizing the xchg instr. comb.
		Adding disassembly of ARM mrrc/mcrr and q{,d}{add,sub}.
20051115	Continuing on various PPC things (BATs, other address trans-
		lation things, various loads/stores, BeBox emulation, etc.).
		Beginning to work on PPC interrupt/exception support.
20051116	Factoring out some code which initializes legacy ISA devices
		from those machines that use them (bus_isa).
		Continuing on PPC interrupt/exception support.
20051117	Minor Malta fixes: RTC year offset = 80, disabling a speed hack
		which caused NetBSD to detect a too fast cpu, and adding a new
		hack to make Linux detect a faster cpu.
		Continuing on the Artesyn PM/PPC emulation mode.
		Adding an Algor emulation skeleton (P4032 and P5064);
		implementing some of the basics.
		Continuing on PPC emulation in general; usage of unimplemented
		SPRs is now easier to track, continuing on memory/exception
		related issues, etc.
20051118	More work on PPC emulation (tgpr0..3, exception handling,
		memory stuff, syscalls, etc.).
20051119	Changing the ARM dyntrans code to mostly use cpu->pc, and not
		necessarily use arm reg 15. Seems to work.
		Various PPC updates; continuing on the PReP emulation mode.
20051120	Adding a workaround/hack to dev_mc146818 to allow NetBSD/prep
		to detect the clock.
20051121	More cleanup of the PCI bus (memory and I/O bases, etc).
		Continuing on various PPC things (decrementer and timebase,
		WDCs on obio (on PReP) use irq 13, not 14/15).
20051122	Continuing on the CPC700 controller (interrupts etc) for PMPPC,
		and on PPC stuff in general.
		Finally! After some bug fixes to the virtual to physical addr
		translation, NetBSD/{prep,pmppc} 2.1 reach userland and are
		stable enough to be interacted with.
		More PCI updates; reverse-endian device access for PowerPC etc.
20051123	Generalizing the IEEE floating point subsystem (moving it out
		from src/cpus/cpu_mips_coproc.c into a new src/float_emul.c).
		Input via slave xterms was sometimes not really working; fixing
		this for ns16550, and a warning message is now displayed if
		multiple non-xterm consoles are active.
		Adding some PPC floating point support, etc.
		Various interrupt related updates (dev_wdc, _ns16550, _8259,
		and the isa32 common code in machine.c).
		NetBSD/prep can now be installed! :-) (Well, with some manual
		commands necessary before running sysinst.) Updating the
		documentation and various other things to reflect this.
20051124	Various minor documentation updates.
		Continuing the work on the DEC 21143 NIC.
20051125	LOTS of work on the 21143. Both OpenBSD and NetBSD work fine
		with it now, except that OpenBSD sometimes gives a time-out
		warning.
		Minor documentation updates.

==============  RELEASE 0.3.7  ==============


1 /* GXemul: $Id: ppc_bat.h,v 1.1 2005/11/17 21:26:07 debug Exp $ */
2 /* $NetBSD: bat.h,v 1.5 2003/03/14 06:21:19 matt Exp $ */
3
4 #ifndef _POWERPC_OEA_BAT_H_
5 #define _POWERPC_OEA_BAT_H_
6
7 /*-
8 * Copyright (c) 1999 The NetBSD Foundation, Inc.
9 * All rights reserved.
10 *
11 * This code is derived from software contributed to The NetBSD Foundation
12 * by Jason R. Thorpe.
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 * 3. All advertising materials mentioning features or use of this software
23 * must display the following acknowledgement:
24 * This product includes software developed by the NetBSD
25 * Foundation, Inc. and its contributors.
26 * 4. Neither the name of The NetBSD Foundation nor the names of its
27 * contributors may be used to endorse or promote products derived
28 * from this software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
31 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
32 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
34 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 * POSSIBILITY OF SUCH DAMAGE.
41 */
42
43 /*
44 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
45 * Copyright (C) 1995, 1996 TooLs GmbH.
46 * All rights reserved.
47 *
48 * Redistribution and use in source and binary forms, with or without
49 * modification, are permitted provided that the following conditions
50 * are met:
51 * 1. Redistributions of source code must retain the above copyright
52 * notice, this list of conditions and the following disclaimer.
53 * 2. Redistributions in binary form must reproduce the above copyright
54 * notice, this list of conditions and the following disclaimer in the
55 * documentation and/or other materials provided with the distribution.
56 * 3. All advertising materials mentioning features or use of this software
57 * must display the following acknowledgement:
58 * This product includes software developed by TooLs GmbH.
59 * 4. The name of TooLs GmbH may not be used to endorse or promote products
60 * derived from this software without specific prior written permission.
61 *
62 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
63 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
64 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
65 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
66 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
67 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
68 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
69 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
70 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
71 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
72 */
73
74 #if 0
75 #ifndef _LOCORE
76 struct bat {
77 register_t batu;
78 register_t batl;
79 };
80 #endif
81 #endif
82
83 /* Lower BAT bits (all but PowerPC 601): */
84 #define BAT_RPN (~0x1ffff) /* physical block start */
85 #define BAT_XPN 0x00000e00 /* eXtended physical page number (0-2) */
86 #define BAT_W 0x00000040 /* 1 = write-through, 0 = write-back */
87 #define BAT_I 0x00000020 /* cache inhibit */
88 #define BAT_M 0x00000010 /* memory coherency enable */
89 #define BAT_G 0x00000008 /* guarded region (not on 601) */
90 #define BAT_X 0x00000004 /* eXtended physical page number (3) */
91
92 /*
93 * BAT_XPN and BAT_X are only used when HID0[XAEN] == 1 and are used
94 * to generate the 4 MSB of physical address
95 */
96
97 #define BAT_PP 0x00000003 /* PP mask */
98 #define BAT_PP_NONE 0x00000000 /* no access permission */
99 #define BAT_PP_RO_S 0x00000001 /* read-only (soft) */
100 #define BAT_PP_RW 0x00000002 /* read/write */
101 #define BAT_PP_RO 0x00000003 /* read-only */
102
103 /* Upper BAT bits (all but PowerPC 601): */
104 #define BAT_EPI (~0x1ffffL) /* effective block start */
105 #define BAT_BL 0x00001ffc /* block length */
106 #define BAT_Vs 0x00000002 /* valid in supervisor mode */
107 #define BAT_Vu 0x00000001 /* valid in user mode */
108
109 #define BAT_XBL 0x0001e000 /* eXtended Block Length (*) */
110 #define BAT_XBL_512M 0x00002000 /* XBL for 512MB */
111 #define BAT_XBL_1G 0x00006000 /* XBL for 1GB */
112 #define BAT_XBL_2G 0x0000e000 /* XBL for 2GB */
113 #define BAT_XBL_4G 0x0001e000 /* XBL for 4GB */
114
115 #define BAT_V (BAT_Vs|BAT_Vu)
116
117 /* Block Length encoding (all but PowerPC 601): */
118 #define BAT_BL_128K 0x00000000
119 #define BAT_BL_256K 0x00000004
120 #define BAT_BL_512K 0x0000000c
121 #define BAT_BL_1M 0x0000001c
122 #define BAT_BL_2M 0x0000003c
123 #define BAT_BL_4M 0x0000007c
124 #define BAT_BL_8M 0x000000fc
125 #define BAT_BL_16M 0x000001fc
126 #define BAT_BL_32M 0x000003fc
127 #define BAT_BL_64M 0x000007fc
128 #define BAT_BL_128M 0x00000ffc
129 #define BAT_BL_256M 0x00001ffc
130
131 #define BATU(va, len, v) \
132 (((va) & BAT_EPI) | ((len) & BAT_BL) | ((v) & BAT_V))
133
134 #define BATL(pa, wimg, pp) \
135 (((pa) & BAT_RPN) | (wimg) | (pp))
136
137 #define BAT_VA_MATCH_P(batu,va) \
138 (((~(((batu)&BAT_BL)<<15))&(va)&BAT_EPI)==((batu)&BAT_EPI))
139
140 #define BAT_PA_MATCH_P(batu,batl,pa) \
141 (((~(((batu)&BAT_BL)<<15))&(pa)&BAT_RPN)==((batl)&BAT_RPN))
142
143 #define BAT_VALID_P(batu, msr) \
144 (((msr)&PSL_PR)?(((batu)&BAT_Vu)==BAT_Vu):(((batu)&BAT_Vs)==BAT_Vs))
145
146 /* Lower BAT bits (PowerPC 601): */
147 #define BAT601_PBN 0xfffe0000 /* physical block number */
148 #define BAT601_V 0x00000040 /* valid */
149 #define BAT601_BSM 0x0000003f /* block size mask */
150
151 /* Upper BAT bits (PowerPC 601): */
152 #define BAT601_BLPI 0xfffe0000 /* block logical page index */
153 #define BAT601_W 0x00000040 /* 1 = write-through, 0 = write-back */
154 #define BAT601_I 0x00000020 /* cache inhibit */
155 #define BAT601_M 0x00000010 /* memory coherency enable */
156 #define BAT601_Ks 0x00000008 /* key-supervisor */
157 #define BAT601_Ku 0x00000004 /* key-user */
158
159 /*
160 * Permission bits on the PowerPC 601 are modified by the appropriate
161 * Key bit:
162 *
163 * Key PP Access
164 * 0 NONE read/write
165 * 0 RO_S read/write
166 * 0 RW read/write
167 * 0 RO read-only
168 *
169 * 1 NONE none
170 * 1 RO_S read-only
171 * 1 RW read/write
172 * 1 RO read-only
173 */
174 #define BAT601_PP 0x00000003
175 #define BAT601_PP_NONE 0x00000000 /* no access permission */
176 #define BAT601_PP_RO_S 0x00000001 /* read-only (soft) */
177 #define BAT601_PP_RW 0x00000002 /* read/write */
178 #define BAT601_PP_RO 0x00000003 /* read-only */
179
180 /* Block Size Mask encoding (PowerPC 601): */
181 #define BAT601_BSM_128K 0x00000000
182 #define BAT601_BSM_256K 0x00000001
183 #define BAT601_BSM_512K 0x00000003
184 #define BAT601_BSM_1M 0x00000007
185 #define BAT601_BSM_2M 0x0000000f
186 #define BAT601_BSM_4M 0x0000001f
187 #define BAT601_BSM_8M 0x0000003f
188
189 #define BATU601(va, wim, key, pp) \
190 (((va) & BAT601_BLPI) | (wim) | (key) | (pp))
191
192 #define BATL601(pa, size, v) \
193 (((pa) & BAT601_PBN) | (v) | (size))
194
195 #define BAT601_VA_MATCH_P(batu, batl, va) \
196 (((~(((batl)&BAT601_BSM)<<17))&(va)&BAT601_BLPI)==((batu)&BAT601_BLPI))
197
198 #define BAT601_VALID_P(batl) \
199 ((batl) & BAT601_V)
200
201 #ifdef _KERNEL
202 #ifndef _LOCORE
203 void oea_batinit(paddr_t, ...);
204 void oea_iobat_add(paddr_t, register_t);
205 void oea_iobat_remove(paddr_t);
206 extern struct bat battable[];
207 #endif
208 #endif
209
210 #endif /* _POWERPC_OEA_BAT_H_ */

  ViewVC Help
Powered by ViewVC 1.1.26