1 diff -ruN proll_18.orig/Makefile proll-patch7/Makefile
2 --- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000
3 +++ proll-patch7/Makefile 2004-11-13 15:50:49.000000000 +0000
7 make -C espresso-ser all
11 make -C mrcoffee clean
13 make -C krups-ser clean
14 make -C espresso clean
15 make -C espresso-ser clean
17 diff -ruN proll_18.orig/qemu/Makefile proll-patch7/qemu/Makefile
18 --- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000
19 +++ proll-patch7/qemu/Makefile 2005-03-02 16:41:50.000000000 +0000
23 +# qemu/Makefile - make PROLL for QEMU
24 +# $Id: proll.patch,v 1.3 2005-03-13 09:43:36 bellard Exp $
26 +# Copyright 1999 Pete Zaitcev
27 +# This is Free Software is licensed under terms of GNU General Public License.
32 +#CROSS = /usr/local/sparc/bin/sparc-sun-linux-
33 +CROSS = sparc-unknown-linux-gnu-
35 +CROSSCC = $(CROSS)gcc
40 +ELFTOAOUT = elftoaout
45 +# Due to remapping algorithm PROLBASE should be algned on PMD.
46 +# We make PROLBASE a define instead of using _start because we
47 +# want to shift it to form a PGD entry. A relocatable label will not work.
48 +# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>.
49 +PROLBASE = 0xffd00000
50 +PROLRODATA = 0xffd07000
51 +PROLDATA = 0xffd09000
55 +# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6.
56 +# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them.
57 +# __ANSI__ is supposed to be on by default but it is not.
58 +CFLAGS = -O2 -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -g -DQEMU
59 +ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g
60 +# Solaris or Linux/i386 cross compilation
61 +#CFLAGS = -Iinclude -O
63 +LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA)
68 +OBJS = head.o wuf.o wof.o main.o $(CONSOLE) \
69 + printf.o le.o system_qemu.o iommu.o \
70 + arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o \
71 + vconsole.o hconsole.o rconsole.o vcons_zs.o
76 + $(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS)
78 +head.o: head.S $(SRC)/phys_jj.h \
79 + $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h
80 + $(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S
82 +main.o: main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \
83 + $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \
84 + $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h
85 + $(CROSSCC) $(CFLAGS) -c $*.c
86 +openprom.o: openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \
87 + $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h
88 + $(CROSSCC) $(CFLAGS) -c $*.c
90 +system_qemu.o: system_qemu.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \
91 + $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \
92 + $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h
93 + $(CROSSCC) $(CFLAGS) -c $*.c
94 +iommu.o: $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \
95 + $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h
96 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
97 +vconsole.o: $(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h
98 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
99 +vcons_zs.o: $(SRC)/vcons_zs.c $(SRC)/vconsole.h $(SRC)/system.h
100 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
101 +hconsole.o: $(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h
102 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
103 +rconsole.o: $(SRC)/rconsole.c $(SRC)/rconsole.h
104 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
105 +printf.o: $(SRC)/printf.c
106 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
107 +le.o: $(SRC)/le.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/netpriv.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/net.h $(SRC)/phys_jj.h
108 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
110 +arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h
111 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
112 +netinit.o: $(SRC)/netinit.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h
113 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
114 +tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h
115 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
116 +udp.o: $(SRC)/udp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h
117 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
118 +packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h
119 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
120 +sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h
121 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
122 +bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \
123 + $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h
124 + $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c
127 + $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
129 + $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
135 +# $(CC) -o genlab genlab.o
139 + $(RM) $(PROLLEXE) proll.aout
141 +proll.aout: $(PROLLEXE)
142 + $(ELFTOAOUT) -o proll.aout $(PROLLEXE)
143 diff -ruN proll_18.orig/qemu/head.S proll-patch7/qemu/head.S
144 --- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000
145 +++ proll-patch7/qemu/head.S 2005-03-02 15:30:47.000000000 +0000
148 + ** Standalone startup code for Linux PROM emulator.
149 + ** Copyright 1999 Pete A. Zaitcev
150 + ** This code is licensed under GNU General Public License.
153 + * $Id: proll.patch,v 1.3 2005-03-13 09:43:36 bellard Exp $
159 +/* #include <asm/head.h> */ /* Trap entries. Do not use. */
160 +#include "phys_jj.h"
162 +#define C_LABEL(name) name
163 +#define REGWIN_SZ 0x40
165 +#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */
167 + /* 22 is 24-2, (va)>>(SRMMU_PGDIR_SHIFT-PTESIZESHFT) */
168 +#define VATOPGDOFF(va) (((va)>>22)&0x3FC)
169 +#define VATOPMDOFF(va) (((va)>>16)&0xFC)
171 +#define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */
173 +/* Here are some trap goodies */
176 +/* Generic trap entry. */
177 +#define TRAP_ENTRY(type, label) \
178 + rd %psr, %l0; b label; rd %wim, %l3; nop;
181 +/* Data/text faults. */
182 +#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7;
183 +#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7;
186 +/* This is for traps we should NEVER get. */
187 +#define BAD_TRAP(num) \
188 + rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
190 +/* This is for traps when we want just skip the instruction which caused it */
191 +#define SKIP_TRAP(type, name) \
192 + jmpl %l2, %g0; rett %l2 + 4; nop; nop;
194 +/* Notice that for the system calls we pull a trick. We load up a
195 + * different pointer to the system call vector table in %l7, but call
196 + * the same generic system call low-level entry point. The trap table
197 + * entry sequences are also HyperSparc pipeline friendly ;-)
200 +/* Software trap for Linux system calls. */
201 +#define LINUX_SYSCALL_TRAP \
202 + sethi %hi(C_LABEL(sys_call_table)), %l7; \
203 + or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
204 + b linux_sparc_syscall; \
207 +/* Software trap for SunOS4.1.x system calls. */
208 +#define SUNOS_SYSCALL_TRAP \
210 + sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
211 + b linux_sparc_syscall; \
212 + or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
214 +/* Software trap for Slowaris system calls. */
215 +#define SOLARIS_SYSCALL_TRAP \
216 + b solaris_syscall; \
221 +#define INDIRECT_SOLARIS_SYSCALL(x) \
223 + b solaris_syscall; \
227 +#define BREAKPOINT_TRAP \
228 + b breakpoint_trap; \
233 +/* Software trap for Sparc-netbsd system calls. */
234 +#define NETBSD_SYSCALL_TRAP \
235 + sethi %hi(C_LABEL(sys_call_table)), %l7; \
236 + or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
240 +/* The Get Condition Codes software trap for userland. */
241 +#define GETCC_TRAP \
242 + b getcc_trap_handler; mov %psr, %l0; nop; nop;
244 +/* The Set Condition Codes software trap for userland. */
245 +#define SETCC_TRAP \
246 + b setcc_trap_handler; mov %psr, %l0; nop; nop;
248 +/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
249 + * gets handled with another macro.
251 +#define TRAP_ENTRY_INTERRUPT(int_level) \
252 + mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
254 +/* NMI's (Non Maskable Interrupts) are special, you can't keep them
255 + * from coming in, and basically if you get one, the shows over. ;(
256 + * On the sun4c they are usually asynchronous memory errors, on the
257 + * the sun4m they could be either due to mem errors or a software
258 + * initiated interrupt from the prom/kern on an SMP box saying "I
259 + * command you to do CPU tricks, read your mailbox for more info."
262 + rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
266 +/* Window overflows/underflows are special and we need to try to be as
267 + * efficient as possible here....
269 +#define WINDOW_SPILL \
270 + rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;
272 +#define WINDOW_FILL \
273 + rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;
275 +#define STUB_TRAP ba stub_trap; nop; nop; nop;
277 +#define TRAP_ENTRY(a,b) STUB_TRAP
278 +#define SKIP_TRAP(a,b) STUB_TRAP
279 +#define SUNOS_SYSCALL_TRAP STUB_TRAP
280 +#define SOLARIS_SYSCALL_TRAP STUB_TRAP
281 +#define NETBSD_SYSCALL_TRAP STUB_TRAP
282 +#define LINUX_SYSCALL_TRAP STUB_TRAP
283 +#define BREAKPOINT_TRAP STUB_TRAP
284 +#define NMI_TRAP STUB_TRAP
285 +#define GETCC_TRAP STUB_TRAP
286 +#define SETCC_TRAP STUB_TRAP
287 +#define BAD_TRAP(n) STUB_TRAP
288 +#define TRAP_ENTRY_INTERRUPT(i) STUB_TRAP
289 +#define INDIRECT_SOLARIS_SYSCALL(i) STUB_TRAP
292 + .globl start, _start
295 + .globl spill_window_entry, fill_window_entry
297 +#define EXPORT_TRAP(trap) \
299 + .type trap,function; \
314 +EXPORT_TRAP(t_irq10)
315 +EXPORT_TRAP(t_irq11)
316 +EXPORT_TRAP(t_irq12)
317 +EXPORT_TRAP(t_irq13)
318 +EXPORT_TRAP(t_irq14)
319 +EXPORT_TRAP(t_irq15)
322 +t_zero: b goprol; nop; nop; nop;
323 +t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
324 +t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
325 +t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
326 +t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
327 +t_wovf: WINDOW_SPILL /* Window Overflow */
328 +t_wunf: WINDOW_FILL /* Window Underflow */
329 +t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
330 +t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
331 +t_dflt: SRMMU_DFAULT /* Data Miss Exception */
332 +t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
333 +t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
334 +t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
335 +t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
336 +t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
337 +t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
338 +t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
339 +t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
340 +t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
341 +t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
342 +t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
343 +t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
344 +t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
345 +t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
346 +t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
347 +t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
348 +t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
349 +t_nmi: NMI_TRAP /* Level 15 (NMI) */
350 +t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
351 +t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
352 +t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
353 +t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
354 +t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
355 +t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
356 +t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
357 +t_dacce:SRMMU_DFAULT /* Data Access Error */
358 +t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
359 +t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
360 +t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
361 +t_bad2d: BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f)
362 + BAD_TRAP(0x30) BAD_TRAP(0x31) BAD_TRAP(0x32) BAD_TRAP(0x33)
363 + BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) BAD_TRAP(0x37)
364 + BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
365 +t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
366 + BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f)
367 + BAD_TRAP(0x40) BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43)
368 + BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) BAD_TRAP(0x47)
369 + BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
370 + BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
371 + BAD_TRAP(0x50) BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53)
372 + BAD_TRAP(0x54) BAD_TRAP(0x55) BAD_TRAP(0x56) BAD_TRAP(0x57)
373 + BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) BAD_TRAP(0x5b)
374 + BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
375 + BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63)
376 + BAD_TRAP(0x64) BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67)
377 + BAD_TRAP(0x68) BAD_TRAP(0x69) BAD_TRAP(0x6a) BAD_TRAP(0x6b)
378 + BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) BAD_TRAP(0x6f)
379 + BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
380 + BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77)
381 + BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b)
382 + BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f)
383 +t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */
384 +t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
385 +t_divz: BAD_TRAP(0x82) /* Divide by zero trap */
386 +t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
387 +t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
388 +t_rchk: BAD_TRAP(0x85) /* Range Check */
389 +t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
390 +t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
391 +t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */
392 +t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */
393 +t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d)
394 + BAD_TRAP(0x8e) BAD_TRAP(0x8f)
395 +t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
396 +t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93)
397 + BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97)
398 + BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
399 +t_getcc:GETCC_TRAP /* Get Condition Codes */
400 +t_setcc:SETCC_TRAP /* Set Condition Codes */
401 +t_bada2:BAD_TRAP(0xa2) BAD_TRAP(0xa3)
402 + BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
403 +t_slowi:INDIRECT_SOLARIS_SYSCALL(156)
404 + BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
405 + BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf)
406 + BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3)
407 + BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7)
408 + BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) BAD_TRAP(0xbb)
409 + BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
410 +t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3)
411 + BAD_TRAP(0xc4) BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7)
412 + BAD_TRAP(0xc8) BAD_TRAP(0xc9) BAD_TRAP(0xca) BAD_TRAP(0xcb)
413 + BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) BAD_TRAP(0xcf)
414 + BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
415 +t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7)
416 + BAD_TRAP(0xd8) BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb)
417 + BAD_TRAP(0xdc) BAD_TRAP(0xdd) BAD_TRAP(0xde) BAD_TRAP(0xdf)
418 + BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) BAD_TRAP(0xe3)
419 + BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
420 +t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb)
421 + BAD_TRAP(0xec) BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef)
422 + BAD_TRAP(0xf0) BAD_TRAP(0xf1) BAD_TRAP(0xf2) BAD_TRAP(0xf3)
423 + BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) BAD_TRAP(0xf7)
424 + BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
425 +t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)
426 +dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
427 +dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
430 + set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
431 + set 0x00ffffff, %g4
432 + sta %g4, [%g5] ASI_M_BYPASS
438 + .align 0x1000 ! PAGE_SIZE
439 + .globl C_LABEL(bootup_user_stack)
440 + .type bootup_user_stack,#object
441 + .size bootup_user_stack,0x2000
442 +C_LABEL(bootup_user_stack): .skip 0x2000
447 + ! %g1 contains end of memory
448 + set PHYS_JJ_EEPROM + 0x30, %g1
449 + lda [%g1] ASI_M_BYPASS, %g1
450 + ! map PROLDATA to PROLBASE+PROLSIZE to end of ram
451 + set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables
452 + sub %g1, %g2, %g2 ! start of private memory
453 + srl %g2, 0x4, %g7 ! ctx table at s+0x0
454 + add %g2, 0x400, %g3 ! l1 table at s+0x400
457 + sta %g3, [%g2] ASI_M_BYPASS
458 + add %g2, 0x400, %g2 ! s+0x400
459 + add %g2, 0x800, %g3 ! l2 table for ram (00xxxxxx) at s+0x800
462 + sta %g3, [%g2] ASI_M_BYPASS
463 + add %g2, 0x500, %g3 ! l2 table for rom (ffxxxxxx) at s+0x900
464 + add %g2, 0x3fc, %g2 ! s+0x7fc
467 + sta %g3, [%g2] ASI_M_BYPASS
468 + add %g2, 0x4, %g2 ! s+0x800
469 + set ((7 << 2) | 2), %g3 ! 7 = U: --- S: RWX (main memory)
470 + sta %g3, [%g2] ASI_M_BYPASS
471 + add %g2, 0x200, %g3 ! l3 table for rom at s+0xa00
472 + add %g2, 0x1d0, %g2 ! s+0x9d0
475 + sta %g3, [%g2] ASI_M_BYPASS
476 + add %g2, 0x30, %g2 ! s+0xa00
480 + set (PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages
481 +1: srl %g3, 0x4, %g4
482 + or %g4, ((7 << 2) | 2), %g4 ! 4 = U: --X S: --X (rom, execute only)
483 + sta %g4, [%g2] ASI_M_BYPASS
490 + set (PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages
491 +1: srl %g3, 0x4, %g4
492 + or %g4, ((0 << 2) | 2), %g4 ! 0 = U: R-- S: R-- (rom, read only)
493 + sta %g4, [%g2] ASI_M_BYPASS
500 + set (PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages
504 +1: srl %g3, 0x4, %g4
505 + or %g4, ((7 << 2) | 2), %g4 ! 5 = U: R-- S: RW- (data area, read/write)
506 + sta %g4, [%g2] ASI_M_BYPASS
516 + sta %g7, [%g2] ASI_M_MMUREGS ! set ctx table ptr
518 + sta %g1, [%g0] ASI_M_MMUREGS ! enable mmu
521 + * The code which enables traps is a simplified version of
524 + * We know number of windows as 8 so we do not calculate them.
525 + * The deadwood is here for any case.
528 + /* Turn on Supervisor, EnableFloating, and all the PIL bits.
529 + * Also puts us in register window zero with traps off.
531 + set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
535 + /* I want a kernel stack NOW! */
536 + set C_LABEL(bootup_user_stack), %g1
537 + set (0x2000 - REGWIN_SZ), %g2
539 + mov 0, %fp /* And for good luck */
541 + /* Zero out our BSS section. */
542 + set C_LABEL(bss_start) , %o0 ! First address of BSS
543 + set C_LABEL(end) , %o1 ! Last address of BSS
549 + subcc %o0, %o1, %g0
554 + wr %g1, 0x0, %wim ! make window 1 invalid
563 + and %g3, PSR_CWP, %g3
570 + sethi %hi( C_LABEL(cputyp) ), %o0
571 + st %g7, [%o0 + %lo( C_LABEL(cputyp) )]
573 + sethi %hi( C_LABEL(nwindows) ), %g4
574 + st %g3, [%g4 + %lo( C_LABEL(nwindows) )]
577 + sethi %hi( C_LABEL(nwindowsm1) ), %g4
578 + st %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
581 + /* Here we go, start using Linux's trap table... */
582 + set C_LABEL(trapbase), %g3
586 + /* Finally, turn on traps so that we can call c-code. */
591 + wr %g3, PSR_ET, %psr
595 + call C_LABEL(prolmain)
603 + * Memory access trap handler
604 + * %l0 program %psr from trap table entry
605 + * %l1 program %pc from hardware
606 + * %l2 program %npc from hardware
607 + * %l3 program %wim from trap table entry
611 + * %l7 text flag from trap table entry
616 +C_LABEL(srmmu_fault):
620 + lda [%l6] ASI_M_MMUREGS, %l6
621 + lda [%l5] ASI_M_MMUREGS, %l5
623 + set ignore_fault, %l5
625 + subcc %l5, %g0, %g0 /* NULL pointer trap faults always */
628 + subcc %l5, %l6, %g0
633 + set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
634 + set 0x00ffffff, %g4
635 + sta %g4, [%g5] ASI_M_BYPASS
636 + add %g5, 8, %g5 /* On right side */
637 + sta %g4, [%g5] ASI_M_BYPASS
641 + set C_LABEL(fault_ignored), %l5
646 + * Skip the faulting instruction.
647 + * I think it works when next instruction is a branch even.
658 + * Slow external versions of st_bypass and ld_bypass.
659 + * rconsole.c uses inlines. We call these in places which are not speed
660 + * critical, to avoid compiler bugs.
662 + .globl C_LABEL(st_bypass)
665 + sta %o1, [%o0] ASI_M_BYPASS
666 + .globl C_LABEL(ld_bypass)
669 + lda [%o0] ASI_M_BYPASS, %o0
670 + .globl C_LABEL(sth_bypass)
671 +C_LABEL(sth_bypass):
673 + stha %o1, [%o0] ASI_M_BYPASS
674 + .globl C_LABEL(ldh_bypass)
675 +C_LABEL(ldh_bypass):
677 + lduha [%o0] ASI_M_BYPASS, %o0
678 + .globl C_LABEL(stb_bypass)
679 +C_LABEL(stb_bypass):
681 + stba %o1, [%o0] ASI_M_BYPASS
682 + .globl C_LABEL(ldb_bypass)
683 +C_LABEL(ldb_bypass):
685 + lduba [%o0] ASI_M_BYPASS, %o0
686 diff -ruN proll_18.orig/qemu/main.c proll-patch7/qemu/main.c
687 --- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000
688 +++ proll-patch7/qemu/main.c 2005-03-02 20:08:23.000000000 +0000
691 + ** Proll (PROM replacement)
692 + ** Copyright 1999 Pete Zaitcev
693 + ** This code is licensed under GNU General Public License.
697 +// #include <asm/contregs.h>
699 +#include "pgtsrmmu.h"
700 +#include "iommu.h" /* Typical SBus IOMMU for sun4m */
701 +#include "phys_jj.h"
702 +#include "vconsole.h"
703 +#include "version.h"
704 +#include <general.h> /* __P() */
705 +#include <net.h> /* init_net() */
706 +#include <romlib.h> /* we are a provider for part of this. */
707 +#include <netpriv.h> /* myipaddr */
709 +#include <system.h> /* our own prototypes */
711 +void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic);
712 +int vcon_zs_init(struct vconterm *t, unsigned int a0);
713 +int vcon_zs_write(struct vconterm *t, char *data, int leng);
715 +static void init_idprom(void);
717 +struct vconterm dp0;
718 +struct mem cmem; /* Current memory, virtual */
719 +struct mem cio; /* Current I/O space */
720 +struct phym pmem; /* Current phys. mem. */
721 +struct iommu ciommu; /* Our IOMMU on sun4m */
725 + unsigned int version;
726 + char pad1[0x1c]; // Pad to 0x30
727 + unsigned int ram_size;
729 + unsigned int load_addr, kernel_size;
730 + unsigned int cmdline, cmdline_len;
731 + char pad2[0x0c]; // Pad to 0x54
732 + unsigned short width, height, depth;
735 +int ignore_fault, fault_ignored;
737 +unsigned int q_height, q_width;
743 + static char fname[14];
744 + static struct banks bb;
745 + unsigned int hiphybas;
746 + const void *romvec;
747 + unsigned int ram_size;
750 + nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F);
752 + q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54);
753 + q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56);
754 + vcon_init(&dp0, PHYS_JJ_TCX_FB);
755 + printk_fn = vcon_write;
758 + vcon_zs_init(&dp0, 0x71100000);
759 + printk_fn = vcon_zs_write;
763 + printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);
764 + ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);
765 + printk("%d MB total\n", ram_size/(1024*1024));
768 + bb.bankv[0].start = 0;
769 + bb.bankv[0].length = ram_size;
771 + hiphybas = ram_size - PROLSIZE;
773 + mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));
774 + makepages(&pmem, hiphybas);
775 + init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);
777 + mem_init(&cio, (char *)(PROLBASE+PROLSIZE),
778 + (char *)(PROLBASE+PROLSIZE+IOMAPSIZE));
780 + iommu_init(&ciommu, hiphybas);
785 + printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version);
787 + printk("Prom console: TCX %dx%d\n", q_width, q_height);
789 + printk("Prom console: serial\n");
794 + printk("Boot device: %c\n", hw_idprom->boot_device);
795 + if (hw_idprom->boot_device == 'n') {
796 + if (bootp() != 0) fatal();
798 + * boot_rec.bp_file cannot be used because system PROM
799 + * uses it to locate ourselves. If we load from boot_rec.bp_file,
800 + * we will loop reloading PROLL over and over again.
801 + * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L).
803 + xtoa(myipaddr, fname, 8);
811 + if (load(boot_rec.bp_siaddr, fname) != 0) fatal();
814 + romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas,
815 + (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic);
817 + printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",
818 + PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,
819 + (int)cio.start, (int)cio.curp);
822 + void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr;
823 + printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n",
824 + *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline);
825 + entry(romvec, 0, 0, 0, 0);
833 + * dvma_alloc over iommu_alloc.
835 +void *dvma_alloc(int size, unsigned int *pphys)
837 + return iommu_alloc(&ciommu, size, pphys);
842 +void udelay(unsigned long usecs)
844 + // Qemu hardware is perfect and does not need any delays!
847 +static void init_idprom()
851 + if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {
852 + printk("init_idprom: cannot map eeprom\n");
855 + bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE);
857 + * hw_idprom is not used anywhere.
858 + * It's just as we hate to leave hanging pointers (I/O page here).
860 + hw_idprom = va_prom;
863 diff -ruN proll_18.orig/qemu/openprom.c proll-patch7/qemu/openprom.c
864 --- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000
865 +++ proll-patch7/qemu/openprom.c 2005-03-02 20:09:57.000000000 +0000
868 + * PROM interface support
869 + * Copyright 1996 The Australian National University.
870 + * Copyright 1996 Fujitsu Laboratories Limited
871 + * Copyright 1999 Pete A. Zaitcev
872 + * This software may be distributed under the terms of the Gnu
873 + * Public License version 2 or later
876 +#include <openprom.h>
877 +#include <general.h>
880 +#include <vconsole.h>
881 +#include "phys_jj.h"
892 + const struct property *properties;
893 + /* short */ const int sibling;
894 + /* short */ const int child;
897 +static int obp_nextnode(int node);
898 +static int obp_child(int node);
899 +static int obp_proplen(int node, char *name);
900 +static int obp_getprop(int node, char *name, char *val);
901 +static int obp_setprop(int node, char *name, char *val, int len);
902 +static const char *obp_nextprop(int node, char *name);
904 +static char obp_idprom[IDPROM_SIZE];
905 +static const struct property null_properties = { NULL, NULL, -1 };
906 +static const int prop_true = -1;
908 +static const struct property propv_root[] = {
909 + {"name", "SUNW,JavaStation-1", sizeof("SUNW,JavaStation-1") },
910 + {"idprom", obp_idprom, IDPROM_SIZE},
911 + {"banner-name", "JavaStation", sizeof("JavaStation")},
912 + {"compatible", "sun4m", 6},
916 +static const int prop_iommu_reg[] = {
917 + 0x0, 0x10000000, 0x00000300,
919 +static const struct property propv_iommu[] = {
920 + {"name", "iommu", sizeof("iommu")},
921 + {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) },
925 +static const int prop_sbus_ranges[] = {
926 + 0x0, 0x0, 0x0, 0x30000000, 0x10000000,
927 + 0x1, 0x0, 0x0, 0x40000000, 0x10000000,
928 + 0x2, 0x0, 0x0, 0x50000000, 0x10000000,
929 + 0x3, 0x0, 0x0, 0x60000000, 0x10000000,
930 + 0x4, 0x0, 0x0, 0x70000000, 0x10000000,
932 +static const struct property propv_sbus[] = {
933 + {"name", "sbus", 5},
934 + {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)},
935 + {"device_type", "hierarchical", sizeof("hierarchical") },
939 +static const int prop_tcx_regs[] = {
940 + 0x2, 0x00800000, 0x00100000,
941 + 0x2, 0x02000000, 0x00000001,
942 + 0x2, 0x04000000, 0x00800000,
943 + 0x2, 0x06000000, 0x00800000,
944 + 0x2, 0x0a000000, 0x00000001,
945 + 0x2, 0x0c000000, 0x00000001,
946 + 0x2, 0x0e000000, 0x00000001,
947 + 0x2, 0x00700000, 0x00001000,
948 + 0x2, 0x00200000, 0x00000004,
949 + 0x2, 0x00300000, 0x0000081c,
950 + 0x2, 0x00000000, 0x00010000,
951 + 0x2, 0x00240000, 0x00000004,
952 + 0x2, 0x00280000, 0x00000001,
956 +static const int pixfreq = 0x03dfd240;
957 +static const int hbporch = 0xa0;
958 +static const int vfreq = 0x3c;
960 +#if 0 /* Kevin Boone - 70Hz refresh */
961 +static const int pixfreq = 0x047868C0;
962 +static const int hbporch = 0x90;
963 +static const int vfreq = 0x46;
966 +static const int vbporch = 0x1d;
967 +static const int vsync = 0x6;
968 +static const int hsync = 0x88;
969 +static const int vfporch = 0x3;
970 +static const int hfporch = 0x18;
971 +static const int height = 0x300;
972 +static const int width = 0x400;
973 +static const int linebytes = 0x400;
974 +static const int depth = 8;
975 +static const int tcx_intr[] = { 5, 0 };
976 +static const int tcx_interrupts = 5;
977 +static const struct property propv_sbus_tcx[] = {
978 + {"name", "SUNW,tcx", sizeof("SUNW,tcx")},
979 + {"vbporch", (char*)&vbporch, sizeof(int)},
980 + {"hbporch", (char*)&hbporch, sizeof(int)},
981 + {"vsync", (char*)&vsync, sizeof(int)},
982 + {"hsync", (char*)&hsync, sizeof(int)},
983 + {"vfporch", (char*)&vfporch, sizeof(int)},
984 + {"hfporch", (char*)&hfporch, sizeof(int)},
985 + {"pixfreq", (char*)&pixfreq, sizeof(int)},
986 + {"vfreq", (char*)&vfreq, sizeof(int)},
987 + {"height", (char*)&height, sizeof(int)},
988 + {"width", (char*)&width, sizeof(int)},
989 + {"linebytes", (char*)&linebytes, sizeof(int)},
990 + {"depth", (char*)&depth, sizeof(int)},
991 + {"reg", (char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)},
992 + {"tcx-8-bit", (char*)&prop_true, 0},
993 + {"intr", (char*)&tcx_intr[0], sizeof(tcx_intr)},
994 + {"interrupts", (char*)&tcx_interrupts, sizeof(tcx_interrupts)},
995 + {"device_type", "display", sizeof("display")},
999 +static const int prop_cs4231_reg[] = {
1000 + 0x3, 0x0C000000, 0x00000040
1002 +static const int cs4231_interrupts = 5;
1003 +static const int cs4231_intr[] = { 5, 0 };
1005 +static const struct property propv_sbus_cs4231[] = {
1006 + {"name", "SUNW,CS4231", sizeof("SUNW,CS4231") },
1007 + {"intr", (char*)&cs4231_intr[0], sizeof(cs4231_intr) },
1008 + {"interrupts", (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) },
1009 + {"reg", (char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) },
1010 + {"device_type", "serial", sizeof("serial") },
1011 + {"alias", "audio", sizeof("audio") },
1015 +static const int cpu_nctx = NCTX_SWIFT;
1016 +static const int cpu_cache_line_size = 0x20;
1017 +static const int cpu_cache_nlines = 0x200;
1018 +static const struct property propv_cpu[] = {
1019 + {"name", "STP1012PGA", sizeof("STP1012PGA") },
1020 + {"device_type", "cpu", 4 },
1021 + {"mmu-nctx", (char*)&cpu_nctx, sizeof(int)},
1022 + {"cache-line-size", (char*)&cpu_cache_line_size, sizeof(int)},
1023 + {"cache-nlines", (char*)&cpu_cache_nlines, sizeof(int)},
1027 +static const int prop_obio_ranges[] = {
1028 + 0x0, 0x0, 0x0, 0x71000000, 0x01000000,
1030 +static const struct property propv_obio[] = {
1031 + {"name", "obio", 5 },
1032 + {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },
1033 + {"device_type", "hierarchical", sizeof("hierarchical") },
1037 +static const int prop_auxio_reg[] = {
1038 + 0x0, 0x00900000, 0x00000001,
1040 +static const struct property propv_obio_auxio[] = {
1041 + {"name", "auxio", sizeof("auxio") },
1042 + {"reg", (char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) },
1046 +static const int prop_int_reg[] = {
1047 + 0x0, 0x00e00000, 0x00000010,
1048 + 0x0, 0x00e10000, 0x00000010,
1050 +static const struct property propv_obio_int[] = {
1051 + {"name", "interrupt", sizeof("interrupt")},
1052 + {"reg", (char*)&prop_int_reg[0], sizeof(prop_int_reg) },
1056 +static const int prop_cnt_reg[] = {
1057 + 0x0, 0x00d00000, 0x00000010,
1058 + 0x0, 0x00d10000, 0x00000010,
1060 +static const struct property propv_obio_cnt[] = {
1061 + {"name", "counter", sizeof("counter")},
1062 + {"reg", (char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) },
1066 +static const int prop_eeprom_reg[] = {
1067 + 0x0, 0x00200000, 0x00002000,
1069 +static const struct property propv_obio_eep[] = {
1070 + {"name", "eeprom", sizeof("eeprom")},
1071 + {"reg", (char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) },
1072 + {"model", "mk48t08", sizeof("mk48t08")},
1076 +static const int prop_su_reg[] = {
1077 + 0x0, 0x003002f8, 0x00000008,
1079 +static const struct property propv_obio_su[] = {
1080 + {"name", "su", sizeof("su")},
1081 + {"reg", (char*)&prop_su_reg[0], sizeof(prop_su_reg) },
1085 +static const int prop_zs_intr[] = { 12, 0x0 };
1086 +static const int prop_zs_reg[] = {
1087 + 0x0, 0x00000000, 0x00000008,
1089 +static const int prop_zs_addr = { 0x70000000 };
1090 +static const int prop_zs_slave[] = { 1 };
1091 +static const struct property propv_obio_zs[] = {
1092 + {"name", "zs", sizeof("zs")},
1093 + {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) },
1094 + {"slave", (char*)&prop_zs_slave[0], sizeof(prop_zs_slave) },
1095 + {"device_type", "serial", sizeof("serial") },
1096 + {"intr", (char*)&prop_zs_intr[0], sizeof(prop_zs_intr) },
1097 + // {"address", (char*)&prop_zs_addr, sizeof(prop_zs_addr) },
1101 +static const int prop_zs1_intr[] = { 12, 0x0 };
1102 +static const int prop_zs1_reg[] = {
1103 + 0x0, 0x00100000, 0x00000008,
1105 +static const int prop_zs1_addr = { 0x70100000 };
1106 +static const int prop_zs1_slave[] = { 0 };
1107 +static const struct property propv_obio_zs1[] = {
1108 + {"name", "zs", sizeof("zs")},
1109 + {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) },
1110 + {"slave", (char*)&prop_zs1_slave[0], sizeof(prop_zs1_slave) },
1111 + {"device_type", "serial", sizeof("serial") },
1112 + {"intr", (char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) },
1113 + // {"address", (char*)&prop_zs1_addr, sizeof(prop_zs1_addr) },
1117 +static const int prop_ledma_reg[] = {
1118 + 0x4, 0x08400010, 0x00000020,
1120 +static const int prop_ledma_burst = 0x3f;
1121 +static const struct property propv_sbus_ledma[] = {
1122 + {"name", "ledma", sizeof("ledma")},
1123 + {"reg", (char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) },
1124 + {"burst-sizes", (char*)&prop_ledma_burst, sizeof(int) },
1128 +static const int prop_le_reg[] = {
1129 + 0x4, 0x08c00000, 0x00000004,
1131 +static const int prop_le_busmaster_regval = 0x7;
1132 +static const int prop_le_intr[] = { 0x26, 0x0 };
1133 +static const struct property propv_sbus_ledma_le[] = {
1134 + {"name", "le", sizeof("le")},
1135 + {"reg", (char*)&prop_le_reg[0], sizeof(prop_le_reg) },
1136 + {"busmaster-regval", (char*)&prop_le_busmaster_regval, sizeof(int)},
1137 + {"intr", (char*)&prop_le_intr[0], sizeof(prop_le_intr) },
1141 +static const int prop_espdma_reg[] = {
1142 + 0x4, 0x08400000, 0x00000010,
1144 +// Disabled, not implemented yet
1145 +static const struct property propv_sbus_espdma[] = {
1146 + {"name", "xxxespdma", sizeof("xxxespdma")},
1147 + {"reg", (char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) },
1151 +static const int prop_esp_reg[] = {
1152 + 0x4, 0x08800000, 0x00000040,
1154 +static const int prop_esp_intr[] = { 0x24, 0x0 };
1155 +static const struct property propv_sbus_espdma_esp[] = {
1156 + {"name", "esp", sizeof("esp")},
1157 + {"reg", (char*)&prop_esp_reg[0], sizeof(prop_esp_reg) },
1158 + {"intr", (char*)&prop_esp_intr[0], sizeof(prop_esp_intr) },
1162 +static const int prop_bpp_reg[] = {
1163 + 0x4, 0x0c800000, 0x0000001c,
1165 +static const int prop_bpp_intr[] = { 0x33, 0x0 };
1166 +static const struct property propv_sbus_bpp[] = {
1167 + {"name", "SUNW,bpp", sizeof("SUNW,bpp")},
1168 + {"reg", (char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) },
1169 + {"intr", (char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) },
1173 +static const int prop_fd_intr[] = { 0x2b, 0x0 };
1174 +static const int prop_fd_reg[] = {
1175 + 0x0, 0x00400000, 0x0000000f,
1177 +static const struct property propv_obio_fd[] = {
1178 + {"name", "SUNW,fdtwo", sizeof("SUNW,fdtwo")},
1179 + {"reg", (char*)&prop_fd_reg[0], sizeof(prop_fd_reg) },
1180 + {"device_type", "block", sizeof("block") },
1181 + {"intr", (char*)&prop_fd_intr[0], sizeof(prop_fd_intr) },
1185 +static const int prop_pw_intr[] = { 0x22, 0x0 };
1186 +static const int prop_pw_reg[] = {
1187 + 0x0, 0x00910000, 0x00000001,
1189 +static const struct property propv_obio_pw[] = {
1190 + {"name", "power", sizeof("power")},
1191 + {"reg", (char*)&prop_pw_reg[0], sizeof(prop_pw_reg) },
1192 + {"intr", (char*)&prop_pw_intr[0], sizeof(prop_pw_intr) },
1196 +static const int prop_cf_reg[] = {
1197 + 0x0, 0x00800000, 0x00000001,
1199 +static const struct property propv_obio_cf[] = {
1200 + {"name", "slavioconfig", sizeof("slavioconfig")},
1201 + {"reg", (char*)&prop_cf_reg[0], sizeof(prop_cf_reg) },
1205 +static const struct node nodes[] = {
1206 + { &null_properties, 1, 0 }, /* 0 = big brother of root */
1207 + { propv_root, 0, 2 }, /* 1 "/" */
1208 + { propv_iommu, 11, 3 }, /* 2 "/iommu" */
1209 + { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */
1210 + { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */
1211 + { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */
1212 + { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */
1213 + { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */
1214 + { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */
1215 + { propv_sbus_espdma, 0, 10 }, /* 9 "/iommu/sbus/espdma" */
1216 + { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */
1217 + { propv_cpu, 12, 0 }, /* 11 "/STP1012PGA" */
1218 + { propv_obio, 0, 13 }, /* 12 "/obio" */
1219 + { propv_obio_int, 14, 0 }, /* 13 "/obio/interrupt" */
1220 + { propv_obio_cnt, 15, 0 }, /* 14 "/obio/counter" */
1221 + { propv_obio_eep, 16, 0 }, /* 15 "/obio/eeprom" */
1222 + { propv_obio_auxio, 17, 0 }, /* 16 "/obio/auxio" */
1223 + { propv_obio_zs, 18, 0 }, /* 17 "/obio/zs@0,0" */
1224 + { propv_obio_zs1, 19, 0 }, /* 18 "/obio/zs@0,100000" */
1225 + { propv_obio_fd, 20, 0 }, /* 19 "/obio/SUNW,fdtwo" */
1226 + { propv_obio_pw, 21, 0 }, /* 20 "/obio/power" */
1227 + { propv_obio_cf, 0, 0 }, /* 21 "/obio/slavioconfig@0,800000" */
1229 + { propv_obio_su, 14, 0 }, /* 13 "/obio/su" */
1230 + { propv_cpu, 18, 0 }, /* 17 "/STP1012PGA" */
1231 + { propv_cpu, 19, 0 }, /* 18 "/STP1012PGA" */
1233 + { propv_cpu, 20, 0 }, /* 19 "/STP1012PGA" */
1234 + { propv_cpu, 21, 0 }, /* 20 "/STP1012PGA" */
1235 + { propv_cpu, 22, 0 }, /* 21 "/STP1012PGA" */
1236 + { propv_cpu, 23, 0 }, /* 22 "/STP1012PGA" */
1237 + { propv_cpu, 24, 0 }, /* 23 "/STP1012PGA" */
1238 + { propv_cpu, 25, 0 }, /* 24 "/STP1012PGA" */
1239 + { propv_cpu, 26, 0 }, /* 25 "/STP1012PGA" */
1240 + { propv_cpu, 27, 0 }, /* 26 "/STP1012PGA" */
1241 + { propv_cpu, 28, 0 }, /* 27 "/STP1012PGA" */
1242 + { propv_cpu, 29, 0 }, /* 28 "/STP1012PGA" */
1243 + { propv_cpu, 30, 0 }, /* 29 "/STP1012PGA" */
1247 +static struct linux_mlist_v0 totphys[MAX_BANKS];
1248 +static struct linux_mlist_v0 totmap[1];
1249 +static struct linux_mlist_v0 totavail[MAX_BANKS];
1251 +static struct linux_mlist_v0 *ptphys;
1252 +static struct linux_mlist_v0 *ptmap;
1253 +static struct linux_mlist_v0 *ptavail;
1255 +static const struct linux_nodeops nodeops0 = {
1256 + obp_nextnode, /* int (*no_nextnode)(int node); */
1257 + obp_child, /* int (*no_child)(int node); */
1258 + obp_proplen, /* int (*no_proplen)(int node, char *name); */
1259 + obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */
1260 + obp_setprop, /* int (*no_setprop)(int node, char *name,
1261 + char *val, int len); */
1262 + obp_nextprop /* char * (*no_nextprop)(int node, char *name); */
1265 +static struct linux_arguments_v0 obp_arg;
1266 +static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
1268 +static void (*synch_hook)(void);
1269 +static char obp_stdin, obp_stdout;
1271 +static int obp_nbgetchar(void);
1272 +static int obp_nbputchar(int ch);
1273 +static void obp_reboot(char *);
1274 +static void obp_abort(void);
1275 +static void obp_halt(void);
1276 +static int obp_devopen(char *str);
1277 +static int obp_devclose(int dev_desc);
1278 +static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf);
1280 +static void doublewalk(unsigned ptab1, unsigned va)
1282 +unsigned int proc_tablewalk(int ctx, unsigned int va);
1283 +unsigned int mem_tablewalk(unsigned int pa, unsigned int va);
1285 + proc_tablewalk(0, va);
1286 + if (ptab1 != 0) mem_tablewalk(ptab1, va);
1289 +static struct linux_romvec romvec0;
1292 +init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas,
1293 + const char *cmdline, char boot_device, int nographic)
1298 + * Avoid data segment allocations
1302 + ptavail = totavail;
1304 + * Form memory descriptors.
1306 + for (i = 0; i < bankc; i++) {
1307 + totphys[i].theres_more = &totphys[i+1];
1308 + totphys[i].start_adr = (char*) bankv[i].start;
1309 + totphys[i].num_bytes = bankv[i].length;
1311 + totphys[i-1].theres_more = 0;
1314 + * XXX Merged in normal PROM when full banks touch.
1316 + for (i = 0; i < bankc; i++) {
1317 + unsigned bankbase = bankv[i].start;
1318 + unsigned banksize = bankv[i].length;
1319 + if (hiphybas > bankbase &&
1320 + hiphybas < bankbase + banksize) {
1321 + banksize = hiphybas - bankbase;
1323 + totavail[i].theres_more = &totavail[i+1];
1324 + totavail[i].start_adr = (char*) bankbase;
1325 + totavail[i].num_bytes = banksize;
1327 + totavail[i-1].theres_more = 0;
1329 + totmap[0].theres_more = 0;
1330 + totmap[0].start_adr = (char*) PROLBASE;
1331 + totmap[0].num_bytes = PROLSIZE;
1336 + bcopy(idprom, obp_idprom, IDPROM_SIZE);
1338 + // Linux wants a R/W romvec table
1339 + romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;
1340 + romvec0.pv_plugin_revision = 77;
1341 + romvec0.pv_printrev = 0x10203;
1342 + romvec0.pv_v0mem.v0_totphys = &ptphys;
1343 + romvec0.pv_v0mem.v0_prommap = &ptmap;
1344 + romvec0.pv_v0mem.v0_available = &ptavail;
1345 + romvec0.pv_nodeops = &nodeops0;
1346 + romvec0.pv_bootstr = (void *)doublewalk;
1347 + romvec0.pv_v0devops.v0_devopen = &obp_devopen;
1348 + romvec0.pv_v0devops.v0_devclose = &obp_devclose;
1349 + romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev;
1350 + romvec0.pv_stdin = &obp_stdin;
1351 + romvec0.pv_stdout = &obp_stdout;
1352 + romvec0.pv_getchar = obp_nbgetchar;
1353 + romvec0.pv_putchar = (void (*)(int))obp_nbputchar;
1354 + romvec0.pv_nbgetchar = obp_nbgetchar;
1355 + romvec0.pv_nbputchar = obp_nbputchar;
1356 + romvec0.pv_reboot = obp_reboot;
1357 + romvec0.pv_abort = obp_abort;
1358 + romvec0.pv_halt = obp_halt;
1359 + romvec0.pv_synchook = &synch_hook;
1360 + romvec0.pv_v0bootargs = &obp_argp;
1361 + switch(boot_device) {
1364 + obp_arg.argv[0] = "fd()";
1367 + obp_arg.argv[0] = "sd()";
1370 + obp_arg.argv[0] = "le()";
1373 + obp_arg.argv[1] = cmdline;
1376 + obp_stdin = PROMDEV_TTYA;
1377 + obp_stdout = PROMDEV_TTYA;
1379 + obp_stdin = PROMDEV_KBD;
1380 + obp_stdout = PROMDEV_SCREEN;
1385 +static const struct property *find_property(int node,char *name)
1387 + const struct property *prop = &nodes[node].properties[0];
1388 + while (prop && prop->name) {
1389 + if (bcmp(prop->name, name, 128) == 0) return prop;
1395 +static int obp_nextnode(int node)
1398 + printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling);
1400 + return nodes[node].sibling;
1403 +static int obp_child(int node)
1406 + printk("obp_child(%d) = %d\n", node, nodes[node].child);
1408 + return nodes[node].child;
1411 +static int obp_proplen(int node, char *name)
1413 + const struct property *prop = find_property(node,name);
1416 + printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length);
1418 + return prop->length;
1421 + printk("obp_proplen(%d, %s) (no prop)\n", node, name);
1426 +static int obp_getprop(int node, char *name, char *value)
1428 + const struct property *prop;
1430 + prop = find_property(node,name);
1432 + memcpy(value,prop->value,prop->length);
1434 + printk("obp_getprop(%d, %s) = %s\n", node, name, value);
1436 + return prop->length;
1439 + printk("obp_getprop(%d, %s): not found\n", node, name);
1444 +static int obp_setprop(int node, char *name, char *value, int len)
1447 + printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len);
1452 +static const char *obp_nextprop(int node,char *name)
1454 + const struct property *prop = find_property(node,name);
1457 + printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name);
1459 + return prop[1].name;
1462 + printk("obp_nextprop(%d, %s): not found\n", node, name);
1467 +static int obp_nbgetchar(void) {
1468 + extern struct vconterm dp0;
1469 + return vcon_getch(&dp0);
1472 +static int obp_nbputchar(int ch) {
1477 +static void obp_reboot(char *str) {
1478 + printk("rebooting (%s): not implemented, freezing\n", str);
1482 +static void obp_abort() {
1483 + printk("abort, freezing\n");
1487 +static void obp_halt() {
1488 + printk("halt, freezing\n");
1492 +static int obp_devopen(char *str) {
1494 + printk("open %s\n", str);
1499 +static int obp_devclose(int dev_desc) {
1501 + printk("close %d\n", dev_desc);
1506 +static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf) {
1508 + printk("rdblkdev: fd %d, num_blks %d, blk_st %d, buf 0x%x\n", dev_desc, num_blks, blk_st, buf);
1513 diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch7/qemu/system_qemu.c
1514 --- proll_18.orig/qemu/system_qemu.c 1970-01-01 00:00:00.000000000 +0000
1515 +++ proll-patch7/qemu/system_qemu.c 2005-03-02 16:10:20.000000000 +0000
1518 + ** Proll (PROM replacement)
1519 + ** system.c: shared miscallenea.
1520 + ** Copyright 1999 Pete Zaitcev
1521 + ** This code is licensed under GNU General Public License.
1523 +#include <stdarg.h>
1527 +#define NULL ((void*)0)
1530 +#include "pgtsrmmu.h"
1532 +#include "vconsole.h"
1533 +#include <timer.h> /* Local copy of 2.2 style include */
1534 +#include <general.h> /* __P() */
1535 +#include <net.h> /* init_net() */
1536 +#include <romlib.h> /* we are a provider for part of this. */
1537 +#include <netpriv.h> /* myipaddr */
1539 +#include <system.h> /* our own prototypes */
1544 +char idprom[IDPROM_SIZE];
1548 + * Create an I/O mapping to pa[size].
1549 + * Returns va of the mapping or 0 if unsuccessful.
1552 +map_io(unsigned pa, int size)
1555 + unsigned int npages;
1559 + off = pa & (PAGE_SIZE-1);
1560 + npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
1561 + pa &= ~(PAGE_SIZE-1);
1563 + va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE);
1564 + if (va == 0) return va;
1566 + mva = (unsigned int) va;
1567 + /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */
1568 + while (npages-- != 0) {
1569 + map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
1574 + return (void *)((unsigned int)va + off);
1578 + * Tablewalk routine used for testing.
1579 + * Returns PTP/PTE.
1582 +proc_tablewalk(int ctx, unsigned int va)
1586 + __asm__ __volatile__ ("lda [%1] %2, %0" :
1588 + "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
1589 + /* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */
1591 + pa1 = ld_bypass(pa1 + (ctx << 2));
1592 + if ((pa1 & 0x03) == 0) goto invalid;
1593 + return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va);
1596 + printk(" invalid %x\n", pa1);
1601 + * Walk the tables in memory, starting at physical address pa.
1604 +mem_tablewalk(unsigned int pa, unsigned int va)
1608 + printk("pa %x va %x", pa, va);
1609 + pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2));
1610 + if ((pa1 & 0x03) == 0) goto invalid;
1611 + printk(" l1 %x", pa1);
1612 + pa1 <<= 4; pa1 &= 0xFFFFFF00;
1613 + pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2));
1614 + if ((pa1 & 0x03) == 0) goto invalid;
1615 + printk(" l2 %x", pa1);
1616 + pa1 <<= 4; pa1 &= 0xFFFFFF00;
1617 + pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2));
1618 + if ((pa1 & 0x03) == 0) goto invalid;
1619 + printk(" l3 %x", pa1);
1620 + printk(" off %x\n", va&0x00000FFF);
1623 + printk(" invalid %x\n", pa1);
1628 + * Make CPU page tables.
1629 + * Returns pointer to context table.
1630 + * Here we ignore memory allocation errors which "should not happen"
1631 + * because we cannot print anything anyways if memory initialization fails.
1633 +void makepages(struct phym *t, unsigned int highbase)
1635 + unsigned int *ctp, *l1, pte;
1637 + unsigned int pa, va;
1639 + ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int));
1640 + l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int));
1642 + pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4);
1643 + for (i = 0; i < NCTX_SWIFT; i++) {
1648 + for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) {
1649 + map_page(l1, va, pa, 0, highbase);
1652 + pa = highbase + PROLDATA - PROLBASE;
1653 + for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) {
1654 + map_page(l1, va, pa, 0, highbase);
1658 + /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
1660 + for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
1661 + map_page(l1, va, pa, 0, highbase);
1667 + t->pbas = highbase;
1671 + * Create a memory mapping from va to epa in page table pgd.
1672 + * highbase is used for v2p translation.
1675 +map_page(unsigned int *pgd, unsigned int va,
1676 + unsigned int epa, int type, unsigned int highbase)
1682 + pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)];
1683 + if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
1684 + p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int),
1685 + SRMMU_PTRS_PER_PMD*sizeof(int));
1686 + if (p == 0) goto drop;
1687 + pte = SRMMU_ET_PTD |
1688 + (((unsigned int)p - PROLBASE + highbase) >> 4);
1689 + pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte;
1693 + pa = ((pte & 0xFFFFFFF0) << 4);
1694 + pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2);
1695 + pte = ld_bypass(pa);
1696 + if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
1697 + p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int),
1698 + SRMMU_PTRS_PER_PTE*sizeof(int));
1699 + if (p == 0) goto drop;
1700 + pte = SRMMU_ET_PTD |
1701 + (((unsigned int)p - PROLBASE + highbase) >> 4);
1702 + st_bypass(pa, pte);
1705 + pa = ((pte & 0xFFFFFFF0) << 4);
1706 + pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2);
1708 + pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4);
1709 + if (type) { /* I/O */
1711 + /* SRMMU cannot make Supervisor-only, but not exectutable */
1712 + pte |= SRMMU_PRIV;
1713 + } else { /* memory */
1714 + pte |= SRMMU_REF|SRMMU_CACHE;
1715 + pte |= SRMMU_PRIV; /* Supervisor only access */
1717 + st_bypass(pa, pte);
1725 + * Switch page tables.
1728 +init_mmu_swift(unsigned int ctp_phy)
1730 + unsigned int addr;
1735 + for (addr = 0; addr < 0x2000; addr += 0x10) {
1736 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
1737 + "r" (addr), "i" (ASI_M_DATAC_TAG));
1738 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
1739 + "r" (addr<<1), "i" (ASI_M_TXTC_TAG));
1743 + * Switch ctx table
1746 + /* printk("done flushing, switching to %x\n", ctp_phy); */
1747 + __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
1748 + "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
1751 + * Flush old page table references
1753 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
1754 + "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory");
1758 + * add_timer, del_timer
1759 + * This should go into sched.c, but we have it split for different archs.
1761 +struct timer_list_head {
1762 + struct timer_list *head, *tail;
1765 +static struct timer_list_head timers; /* Anonymous heap of timers */
1767 +void add_timer(struct timer_list *timer) {
1768 + struct timer_list *p;
1769 + if (timer->prev != NULL || timer->next != NULL) {
1770 + printk("bug: kernel timer added twice at 0x%x.\n",
1771 + __builtin_return_address(0));
1774 + if ((p = timers.tail) != NULL) {
1777 + timers.tail = timer;
1779 + timers.head = timer;
1780 + timers.tail = timer;
1785 +int del_timer(struct timer_list *timer) {
1786 + struct timer_list *p;
1789 + if (timers.head == timer) timers.head = timer->next;
1790 + if (timers.tail == timer) timers.tail = timer->prev;
1791 + if ((p = timer->prev) != NULL) p->next = timer->next;
1792 + if ((p = timer->next) != NULL) p->prev = timer->prev;
1793 + ret = timer->next != 0 || timer->prev != 0;
1794 + timer->next = NULL;
1795 + timer->prev = NULL;
1799 +void run_timers() {
1800 + struct timer_list *p;
1803 + while (p != NULL) {
1804 + if (p->expires < jiffies) {
1805 + del_timer(p); /* XXX make nonstatic member */
1806 + (*p->function)(p->data);
1815 + * Allocate memory. This is reusable.
1817 +void mem_init(struct mem *t, char *begin, char *limit)
1824 +void mem_fini(struct mem *t)
1829 +void *mem_alloc(struct mem *t, int size, int align)
1833 + p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));
1834 + if (p >= t->uplim || p + size > t->uplim) return 0;
1835 + t->curp = p + size;
1839 +void *mem_zalloc(struct mem *t, int size, int align)
1843 + if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size);
1848 + * Library functions
1850 +void bzero(void *s, int len) {
1851 + while (len--) *((char *)s)++ = 0;
1854 +void bcopy(const void *f, void *t, int len) {
1855 + while (len--) *((char *)t)++ = *((char *)f)++;
1858 +/* Comparison is 7-bit */
1859 +int bcmp(const void *s1, const void *s2, int len)
1865 + ch = *((char *)s1)++;
1866 + if ((i = ch - *((char *)s2)++) != 0)
1874 +int strlen(const char *s) {
1876 + for (p = s; *p != 0; p++) { }
1880 +extern void *printk_fn;
1882 +void printk(char *fmt, ...)
1886 + void (*write)(void *, char *, int);
1888 + extern void prf(struct prf_fp *, char *fmt, va_list adx);
1891 + va_start(x1, fmt);
1893 + prfa.write = printk_fn;
1894 + prf(&prfa, fmt, x1);
1905 + * Get the highest bit number from the mask.
1907 +int highc(int mask, int size)
1912 + while (size != 0) {
1915 + if (m1 & mask) break;
1922 +unsigned int ld_bp_swap(unsigned int ptr) {
1924 + n = ld_bypass(ptr);
1925 + n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
1929 +void st_bp_swap(unsigned int ptr, unsigned int n) {
1930 + n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
1931 + st_bypass(ptr, n);
1933 diff -ruN proll_18.orig/src/arp.c proll-patch7/src/arp.c
1934 --- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000
1935 +++ proll-patch7/src/arp.c 2004-11-13 15:50:49.000000000 +0000
1938 static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */
1939 static int next_arp; /* next table entry */
1940 -static t_ipaddr def_gw = IP_ANY; /* default routing */
1941 +static t_ipaddr def_gw; /* default routing */
1947 * Resolve IP address and return pointer to hardware address.
1949 -unsigned char *ip_resolve(ip)
1950 +const unsigned char *ip_resolve(ip)
1954 @@ -230,14 +230,11 @@
1958 - /* Set name of module for error messages */
1959 - net_module_name = "arp";
1962 /* Register ARP packet type and set send buffer pointer */
1963 if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL)
1970 diff -ruN proll_18.orig/src/arp.h proll-patch7/src/arp.h
1971 --- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000
1972 +++ proll-patch7/src/arp.h 2004-11-13 15:50:49.000000000 +0000
1974 extern int init_arp __P((void));
1976 /* Resolve IP address and return pointer to hardware address */
1977 -extern unsigned char *ip_resolve __P((t_ipaddr ip));
1978 +extern const unsigned char *ip_resolve __P((t_ipaddr ip));
1980 /* Add a new antry to the ARP cache */
1981 extern void addcache __P((unsigned char *ha, t_ipaddr ip));
1982 diff -ruN proll_18.orig/src/hconsole.c proll-patch7/src/hconsole.c
1983 --- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000
1984 +++ proll-patch7/src/hconsole.c 2005-03-02 17:03:09.000000000 +0000
1986 struct raster r_master; /* For a case of resize, whole fb */
1987 struct raster r_0; /* malloc() erzatz */
1990 +extern unsigned int q_height, q_width;
1993 int hcon_init(struct hconsole *t, unsigned int a0)
1995 struct raster *q, *r;
1997 * No probing sequence or argument passing, hardcode everything. XXX
1999 raster8_cons_a(q, 768, 1024, (char *)a0);
2001 raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80));
2003 + raster_cons_2(r, q, 0, 0, q_height, q_width);
2008 diff -ruN proll_18.orig/src/lat7_2.bm proll-patch7/src/lat7_2.bm
2009 --- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000
2010 +++ proll-patch7/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000
2012 #define lat7_2_width 128
2013 #define lat7_2_height 88
2014 -static unsigned char lat7_2_bits[] = {
2015 +static unsigned const char lat7_2_bits[] = {
2016 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2017 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18,
2018 0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02,
2019 diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch7/src/lat7_2_swapped.bm
2020 --- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000
2021 +++ proll-patch7/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000
2023 +#define lat7_2_width 128
2024 +#define lat7_2_height 88
2025 +static unsigned const char lat7_2_bits[] = {
2026 + 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
2027 + 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48,
2028 + 0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40,
2029 + 0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40,
2030 + 0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
2031 + 0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00,
2032 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00,
2033 + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10,
2034 + 0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04,
2035 + 0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,
2036 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00,
2037 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
2038 + 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
2039 + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00,
2040 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
2041 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2042 + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2043 + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2044 + 0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18,
2045 + 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18,
2046 + 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,
2047 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00,
2048 + 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
2049 + 0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60,
2050 + 0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36,
2051 + 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e,
2052 + 0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78,
2053 + 0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2054 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42,
2055 + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2056 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
2057 + 0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
2058 + 0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00,
2059 + 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
2060 + 0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18,
2061 + 0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2062 + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18,
2063 + 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18,
2064 + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c,
2065 + 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,
2066 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2067 + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
2068 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
2069 + 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00,
2070 + 0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00,
2071 + 0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c,
2072 + 0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2073 + 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
2074 + 0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66,
2075 + 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66,
2076 + 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30,
2077 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c,
2078 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00,
2079 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00,
2080 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00,
2081 + 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
2082 + 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
2083 + 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2084 + 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e,
2085 + 0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66,
2086 + 0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66,
2087 + 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66,
2088 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c,
2089 + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00,
2090 + 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00,
2091 + 0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00,
2092 + 0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
2093 + 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e,
2094 + 0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c,
2095 + 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
2096 + 0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f,
2097 + 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e,
2098 + 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66,
2099 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60,
2100 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02,
2101 + 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00,
2102 + 0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00,
2103 + 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
2104 + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66,
2105 + 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,
2106 + 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c,
2107 + 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c,
2108 + 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30,
2109 + 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
2110 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02,
2111 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00,
2112 + 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2113 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
2114 + 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2115 + 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60,
2116 + 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2117 + 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
2118 + 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2119 + 0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78,
2120 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66,
2121 + 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66,
2122 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00,
2123 + 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38,
2124 + 0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00,
2125 + 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
2126 + 0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,
2127 + 0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2128 + 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
2129 + 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66,
2130 + 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60,
2131 + 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06,
2132 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c,
2133 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00,
2134 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00,
2135 + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00,
2136 + 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
2137 + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00,
2138 + 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18,
2139 + 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18,
2140 + 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c,
2141 + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00,
2142 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00,
2143 + 0x00, 0x00, 0x00, 0x00};
2144 diff -ruN proll_18.orig/src/le.c proll-patch7/src/le.c
2145 --- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000
2146 +++ proll-patch7/src/le.c 2004-11-13 15:50:49.000000000 +0000
2148 unsigned short rap; /* register address port */
2151 -int sparc_lance_debug = 2;
2153 /* The Lance uses 24 bit addresses */
2154 /* On the Sun4c the DVMA will provide the remaining bytes for us */
2155 /* On the Sun4m we have to instruct the ledma to provide them */
2156 diff -ruN proll_18.orig/src/netinit.c proll-patch7/src/netinit.c
2157 --- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000
2158 +++ proll-patch7/src/netinit.c 2004-11-13 15:50:49.000000000 +0000
2160 unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */
2161 t_ipaddr myipaddr; /* my own IP address */
2162 t_ipaddr mynetmask; /* my own netmask */
2163 - char *net_module_name; /* name of init module */
2164 t_ipaddr servaddr; /* IP of RARP&TFTP server */
2166 /* Broadcast hardware address */
2167 -unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
2168 +const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
2173 +/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
2176 + seed = (seed + 23968)*0x015A4E35 >> 1;
2177 + return seed & 0x7FFF;
2181 **************************************************************************
2182 @@ -104,10 +111,17 @@
2186 + /* Avoid data segment allocations */
2189 /* Initialize the different network layer modules */
2191 - if (!init_arp() || !init_udp()) {
2192 - printf("\nERROR: init_%s\n", net_module_name);
2193 + if (!init_arp()) {
2194 + printf("\nERROR: init_arp\n");
2197 + if (!init_udp()) {
2198 + printf("\nERROR: init_udp\n");
2202 diff -ruN proll_18.orig/src/netpriv.h proll-patch7/src/netpriv.h
2203 --- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000
2204 +++ proll-patch7/src/netpriv.h 2004-11-13 15:50:49.000000000 +0000
2205 @@ -130,10 +130,9 @@
2208 extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address */
2209 -extern unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
2210 +extern const unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
2211 extern t_ipaddr myipaddr; /* my own IP address */
2212 extern t_ipaddr mynetmask; /* netmask for my network */
2213 -extern char *net_module_name; /* initialized module's name */
2214 extern t_ipaddr servaddr; /* server IP address */
2218 extern unsigned char *reg_type __P((int typeval, int (* receive)()));
2220 /* Write a packet to the network */
2221 -extern int write_packet __P((int bufsize, int typeval, unsigned char *addr));
2222 +extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr));
2224 /* Empty read buffer */
2225 extern void empty_buf __P((void));
2226 diff -ruN proll_18.orig/src/openprom.h proll-patch7/src/openprom.h
2227 --- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000
2228 +++ proll-patch7/src/openprom.h 2004-11-13 15:50:49.000000000 +0000
2232 struct linux_mem_v0 {
2233 - struct linux_mlist_v0 **v0_totphys;
2234 - struct linux_mlist_v0 **v0_prommap;
2235 - struct linux_mlist_v0 **v0_available; /* What we can use */
2236 + struct linux_mlist_v0 * const *v0_totphys;
2237 + struct linux_mlist_v0 * const *v0_prommap;
2238 + struct linux_mlist_v0 * const *v0_available; /* What we can use */
2241 /* Arguments sent to the kernel from the boot prompt. */
2242 struct linux_arguments_v0 {
2244 + const char *argv[8];
2250 - char *kernel_file_name;
2251 + const char *kernel_file_name;
2252 void *aieee1; /* XXX */
2256 struct linux_mem_v0 pv_v0mem;
2258 /* Node operations. */
2259 - struct linux_nodeops *pv_nodeops;
2260 + const struct linux_nodeops *pv_nodeops;
2263 struct linux_dev_v0_funcs pv_v0devops;
2267 + const char *pv_stdin;
2268 + const char *pv_stdout;
2269 #define PROMDEV_KBD 0 /* input from keyboard */
2270 #define PROMDEV_SCREEN 0 /* output to screen */
2271 #define PROMDEV_TTYA 1 /* in/out to ttya */
2273 void (*v2_eval)(char *str);
2276 - struct linux_arguments_v0 **pv_v0bootargs;
2277 + const struct linux_arguments_v0 * const *pv_v0bootargs;
2279 /* Get ether address. */
2280 unsigned int (*pv_enaddr)(int d, char *enaddr);
2282 int (*no_proplen)(int node, char *name);
2283 int (*no_getprop)(int node, char *name, char *val);
2284 int (*no_setprop)(int node, char *name, char *val, int len);
2285 - char * (*no_nextprop)(int node, char *name);
2286 + const char * (*no_nextprop)(int node, char *name);
2289 /* More fun PROM structures for device probing. */
2290 diff -ruN proll_18.orig/src/packet.c proll-patch7/src/packet.c
2291 --- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000
2292 +++ proll-patch7/src/packet.c 2004-11-13 15:50:49.000000000 +0000
2296 static struct sk_buff *rskb;
2297 -static int nqskb = 0;
2303 for (i = 0; i < MAXSKBS; i++) {
2304 skev[i].skb.allocn = i;
2310 unsigned char *reg_type(int ptype, int (*func)())
2315 -int write_packet(int leng, int type, unsigned char *dst)
2316 +int write_packet(int leng, int type, const unsigned char *dst)
2318 struct sk_buff *skb;
2320 diff -ruN proll_18.orig/src/printf.c proll-patch7/src/printf.c
2321 --- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000
2322 +++ proll-patch7/src/printf.c 2004-11-13 15:50:49.000000000 +0000
2324 static void printn(struct prf_fp *, unsigned long, unsigned int);
2325 static void putchar(char, struct prf_fp *);
2327 -static char hextab[] = "0123456789ABCDEF";
2328 +static const char hextab[] = "0123456789ABCDEF";
2331 * Scaled down version of C Library printf.
2334 prf(struct prf_fp *filog, char *fmt, va_list adx)
2342 putchar(va_arg(adx,unsigned), filog);
2343 } else if(c == 's') {
2344 s = va_arg(adx,char*);
2348 } else if (c == 'l' || c == 'O') {
2349 printn(filog, (long)va_arg(adx,long), c=='l'?10:8);
2350 diff -ruN proll_18.orig/src/rconsole.c proll-patch7/src/rconsole.c
2351 --- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000
2352 +++ proll-patch7/src/rconsole.c 2004-11-13 15:50:49.000000000 +0000
2354 * move to California. Only plain lat7 survived.
2355 * I recreated lat7-1 changes in lat7-2. --zaitcev
2358 #include "lat7_2.bm" /* lat7_1.bm */
2360 +#include "lat7_2_swapped.bm" /* lat7_1.bm */
2362 #define LAT7_NCHARS 128
2363 #define LAT7_HEIGHT 11
2364 #define LAT7_WIDTH 8
2367 static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ];
2377 static inline int swapbits(int w0)
2380 @@ -105,13 +112,16 @@
2386 void font_cons_7(struct rfont *p)
2394 for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) {
2395 lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] =
2396 swapbits(lat7_2_bits[x]) & 0xFF;
2400 p->body_ = lat7_body;
2402 + p->body_ = lat7_2_bits;
2404 p->nchars_ = LAT7_NCHARS;
2405 p->width_ = LAT7_WIDTH;
2406 p->height_ = LAT7_HEIGHT;
2407 diff -ruN proll_18.orig/src/rconsole.h proll-patch7/src/rconsole.h
2408 --- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000
2409 +++ proll-patch7/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000
2413 #define RF_MAXWIDTH 16
2414 -typedef unsigned short Rf_scan; /* __w16 to be used */
2415 +typedef unsigned char Rf_scan; /* __w16 to be used */
2419 + const Rf_scan *body_;
2420 int nchars_; /* 128 for ASCII ... 65536 for Unicode */
2421 int width_; /* [Pixels]. Maximum size is 16. */
2422 int height_; /* [Pixels == scan lines]. */
2423 diff -ruN proll_18.orig/src/romlib.h proll-patch7/src/romlib.h
2424 --- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000
2425 +++ proll-patch7/src/romlib.h 2004-11-13 15:50:49.000000000 +0000
2427 #define memcpy(dst, src, len) bcopy(src, dst, len)
2428 #define memcmp(x1, x2, len) bcmp(x1, x2, len)
2429 #define memset(p, len, zero) bzero(p, len)
2430 -extern void bcopy(void *b1, void *b2, int length);
2431 -extern int bcmp(void *b1, void *b2, int length);
2432 +extern void bcopy(const void *b1, void *b2, int length);
2433 +extern int bcmp(const void *b1, const void *b2, int length);
2434 extern void bzero(void *b, int c);
2435 /* gcc complains about "conflicting types for builtin function strlen". */
2436 #define strlen(s) ssize(s)
2437 -extern int ssize(char *s);
2438 +extern int ssize(const char *s);
2442 diff -ruN proll_18.orig/src/sched_4m.c proll-patch7/src/sched_4m.c
2443 --- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000
2444 +++ proll-patch7/src/sched_4m.c 2004-11-13 15:50:49.000000000 +0000
2446 static int set_bolt; /* Tick counter limit */
2447 static struct handsc hndv[16];
2449 -static unsigned int intr_to_mask[16] = {
2450 +static unsigned const int intr_to_mask[16] = {
2451 0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0,
2452 0, 0, 0, 0, 0, 0, 0, 0,
2454 diff -ruN proll_18.orig/src/swap.c proll-patch7/src/swap.c
2455 --- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000
2456 +++ proll-patch7/src/swap.c 2004-11-13 15:50:49.000000000 +0000
2458 +// Convert the lat7 font so that no conversion is needed at runtime.
2460 +#include "rconsole.c"
2472 + for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) {
2473 + printf("0x%02x, ", p.body_[i]);
2474 + if ((i % 12) == 11)
2479 diff -ruN proll_18.orig/src/system.c proll-patch7/src/system.c
2480 --- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000
2481 +++ proll-patch7/src/system.c 2004-11-13 15:50:49.000000000 +0000
2485 /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
2487 - for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) {
2489 + for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
2490 map_page(l1, va, pa, 0, highbase);
2493 @@ -518,12 +518,12 @@
2494 while (len--) *((char *)s)++ = 0;
2497 -void bcopy(void *f, void *t, int len) {
2498 +void bcopy(const void *f, void *t, int len) {
2499 while (len--) *((char *)t)++ = *((char *)f)++;
2502 /* Comparison is 7-bit */
2503 -int bcmp(void *s1, void *s2, int len)
2504 +int bcmp(const void *s1, const void *s2, int len)
2512 -int strlen(char *s) {
2514 +int strlen(const char *s) {
2516 for (p = s; *p != 0; p++) { }
2519 @@ -560,14 +560,6 @@
2523 -/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
2526 - static unsigned int seed = 151;
2527 - seed = (seed + 23968)*0x015A4E35 >> 1;
2528 - return seed & 0x7FFF;
2534 diff -ruN proll_18.orig/src/system.h proll-patch7/src/system.h
2535 --- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000
2536 +++ proll-patch7/src/system.h 2004-11-13 15:50:49.000000000 +0000
2538 #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */
2539 #define NCTX_SWIFT 0x100
2541 -#define MAX_BANKS 3 /* Allocation for all machines */
2542 +#define MAX_BANKS 8 /* Allocation for all machines */
2544 #ifndef __ASSEMBLY__
2546 diff -ruN proll_18.orig/src/udp.c proll-patch7/src/udp.c
2547 --- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000
2548 +++ proll-patch7/src/udp.c 2004-11-13 15:50:49.000000000 +0000
2553 - register unsigned char *addr;
2554 + const register unsigned char *addr;
2556 /* Set global variables */
2562 - /* Set module name for error handling */
2563 - net_module_name = "udp";
2565 /* Register IP packet type and set write buffer pointer */
2566 if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL)
2568 diff -ruN proll_18.orig/src/vcons_zs.c proll-patch7/src/vcons_zs.c
2569 --- proll_18.orig/src/vcons_zs.c 1970-01-01 00:00:00.000000000 +0000
2570 +++ proll-patch7/src/vcons_zs.c 2005-03-02 12:07:41.000000000 +0000
2573 + ** Console over 'zs' (Zilog serial port)
2574 + ** Copyright 1999 Pete Zaitcev
2575 + ** This code is licensed under GNU General Public License.
2578 +#include "vconsole.h"
2579 +#include <system.h>
2581 +#define ZS_DATA 0x02
2583 +int vcon_zs_init(struct vconterm *t, unsigned int a0)
2586 + t->impl = (void *) a0;
2588 + t->vc_x = 0; t->vc_y = 0;
2589 + t->backp = 0; t->backc = 0;
2591 + stb_bypass(a0, 3); // reg 3
2592 + stb_bypass(a0, 1); // enable rx
2594 + stb_bypass(a0, 5); // reg 5
2595 + stb_bypass(a0, 8); // enable tx
2600 +int vcon_zs_putch(struct vconterm *t, char c)
2602 + unsigned zs_ptr = (unsigned) t->impl;
2604 + //while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { }
2605 + stb_bypass(zs_ptr + ZS_DATA, c);
2609 +int vcon_zs_write(struct vconterm *t, char *data, int leng)
2611 + while (leng != 0) {
2613 + vcon_zs_putch(t, *data++);
2618 +int vcon_zs_read(struct vconterm *t, char *data, int leng)
2620 + unsigned zs_ptr = (unsigned) t->impl;
2622 + while ((ldb_bypass(zs_ptr) & 1) != 1) { }
2623 + *data = ldb_bypass(zs_ptr + ZS_DATA);
2627 +int vcon_zs_getch(struct vconterm *t)
2629 + unsigned zs_ptr = (unsigned) t->impl;
2631 + while ((ldb_bypass(zs_ptr) & 1) != 1) { }
2632 + return ldb_bypass(zs_ptr + ZS_DATA);
2635 +void vcon_zs_fini(struct vconterm *t)
2637 + /* violent crash in the end */
2640 diff -ruN proll_18.orig/src/vconsole.c proll-patch7/src/vconsole.c
2641 --- proll_18.orig/src/vconsole.c 1999-11-08 03:10:28.000000000 +0000
2642 +++ proll-patch7/src/vconsole.c 2005-03-02 14:29:05.000000000 +0000
2645 struct hconsole hcons0;
2647 +enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
2648 + EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
2651 int vcon_init(struct vconterm *t, unsigned int a0)
2653 struct hconsole *hconp;
2656 t->vc_x = 0; t->vc_y = 0;
2657 t->backp = 0; t->backc = 0;
2658 + t->vc_state = ESnormal;
2660 hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_);
2665 + * gotoxy() must verify all boundaries, because the arguments
2666 + * might also be negative. If the given position is out of
2667 + * bounds, the cursor is placed at the nearest margin.
2669 +static void gotoxy(struct vconterm *vc, int new_x, int new_y)
2672 + struct hconsole *hconp = vc->impl;
2674 + max_x = hcon_qxdim(hconp);
2675 + max_y = hcon_qydim(hconp);
2680 + if (new_x >= max_x)
2681 + vc->vc_x = max_x - 1;
2688 + else if (new_y >= max_y)
2689 + vc->vc_y = max_y - 1;
2695 +/* for absolute user moves, when decom is set */
2696 +static void gotoxay(struct vconterm *t, int new_x, int new_y)
2698 + gotoxy(t, new_x, new_y);
2701 int vcon_write(struct vconterm *t, char *data, int leng)
2709 - case 0x07: /* Bell */
2710 - vcon_i_backflush(t);
2712 - case 0x0A: /* Linefeed */
2713 - vcon_i_backflush(t);
2714 - vcon_i_cursfeed(t);
2715 + switch(t->vc_state) {
2717 + t->vc_state = ESnormal;
2720 + t->vc_state = ESsquare;
2723 + hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
2727 - case 0x0D: /* Return */
2728 - vcon_i_backflush(t);
2731 + for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++)
2732 + t->vc_par[t->vc_npar] = 0;
2734 + t->vc_state = ESgetpars;
2736 + if (c==';' && t->vc_npar<NPAR-1) {
2739 + } else if (c>='0' && c<='9') {
2740 + t->vc_par[t->vc_npar] *= 10;
2741 + t->vc_par[t->vc_npar] += c-'0';
2743 + } else t->vc_state=ESgotpars;
2745 + t->vc_state = ESnormal;
2747 + case 'H': case 'f':
2748 + if (t->vc_par[0]) t->vc_par[0]--;
2749 + if (t->vc_par[1]) t->vc_par[1]--;
2750 + gotoxay(t, t->vc_par[1], t->vc_par[0]);
2753 + hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
2758 - if (t->backp == 0) {
2760 - t->backp = data-1;
2764 - if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
2765 + t->vc_state = ESnormal;
2767 + case 0x07: /* Bell */
2768 + vcon_i_backflush(t);
2770 + case 0x08: /* BS */
2771 + vcon_i_backflush(t);
2775 + case 0x0A: /* Linefeed */
2776 vcon_i_backflush(t);
2780 + case 0x0D: /* Return */
2781 + vcon_i_backflush(t);
2785 + vcon_i_backflush(t);
2786 + t->vc_state = ESnormal;
2789 + vcon_i_backflush(t);
2790 + t->vc_state = ESesc;
2793 + if (t->backp == 0) {
2795 + t->backp = data-1;
2799 + if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
2800 + vcon_i_backflush(t);
2802 + vcon_i_cursfeed(t);
2807 diff -ruN proll_18.orig/src/vconsole.h proll-patch7/src/vconsole.h
2808 --- proll_18.orig/src/vconsole.h 1999-11-08 00:58:13.000000000 +0000
2809 +++ proll-patch7/src/vconsole.h 2005-03-02 12:40:12.000000000 +0000
2820 int backc; /* Same, count */
2822 int vc_x, vc_y; /* XXX Make vcon_xxx() to use cellmap->xpos_ */
2824 + unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
2827 int vcon_init(struct vconterm *t, unsigned int a0);