1 diff -ruN proll_18.orig/Makefile proll-patch10/Makefile
2 --- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000
3 +++ proll-patch10/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-patch10/qemu/Makefile
18 --- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000
19 +++ proll-patch10/qemu/Makefile 2005-04-12 14:42:23.000000000 +0000
23 +# qemu/Makefile - make PROLL for QEMU
24 +# $Id: proll.patch,v 1.5 2005-04-26 21:02:48 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 = 0xffd08000
51 +PROLDATA = 0xffd0b000
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 esp.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
109 +esp.o: $(SRC)/esp.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/phys_jj.h
110 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
111 +arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h
112 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
113 +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
114 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
115 +tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h
116 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
117 +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
118 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
119 +packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h
120 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
121 +sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h
122 + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
123 +bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \
124 + $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h
125 + $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c
128 + $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
130 + $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
136 +# $(CC) -o genlab genlab.o
140 + $(RM) $(PROLLEXE) proll.aout
142 +proll.aout: $(PROLLEXE)
143 + $(ELFTOAOUT) -o proll.aout $(PROLLEXE)
144 diff -ruN proll_18.orig/qemu/head.S proll-patch10/qemu/head.S
145 --- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000
146 +++ proll-patch10/qemu/head.S 2005-03-02 15:30:47.000000000 +0000
149 + ** Standalone startup code for Linux PROM emulator.
150 + ** Copyright 1999 Pete A. Zaitcev
151 + ** This code is licensed under GNU General Public License.
154 + * $Id: proll.patch,v 1.5 2005-04-26 21:02:48 bellard Exp $
160 +/* #include <asm/head.h> */ /* Trap entries. Do not use. */
161 +#include "phys_jj.h"
163 +#define C_LABEL(name) name
164 +#define REGWIN_SZ 0x40
166 +#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */
168 + /* 22 is 24-2, (va)>>(SRMMU_PGDIR_SHIFT-PTESIZESHFT) */
169 +#define VATOPGDOFF(va) (((va)>>22)&0x3FC)
170 +#define VATOPMDOFF(va) (((va)>>16)&0xFC)
172 +#define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */
174 +/* Here are some trap goodies */
177 +/* Generic trap entry. */
178 +#define TRAP_ENTRY(type, label) \
179 + rd %psr, %l0; b label; rd %wim, %l3; nop;
182 +/* Data/text faults. */
183 +#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7;
184 +#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7;
187 +/* This is for traps we should NEVER get. */
188 +#define BAD_TRAP(num) \
189 + rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
191 +/* This is for traps when we want just skip the instruction which caused it */
192 +#define SKIP_TRAP(type, name) \
193 + jmpl %l2, %g0; rett %l2 + 4; nop; nop;
195 +/* Notice that for the system calls we pull a trick. We load up a
196 + * different pointer to the system call vector table in %l7, but call
197 + * the same generic system call low-level entry point. The trap table
198 + * entry sequences are also HyperSparc pipeline friendly ;-)
201 +/* Software trap for Linux system calls. */
202 +#define LINUX_SYSCALL_TRAP \
203 + sethi %hi(C_LABEL(sys_call_table)), %l7; \
204 + or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
205 + b linux_sparc_syscall; \
208 +/* Software trap for SunOS4.1.x system calls. */
209 +#define SUNOS_SYSCALL_TRAP \
211 + sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
212 + b linux_sparc_syscall; \
213 + or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
215 +/* Software trap for Slowaris system calls. */
216 +#define SOLARIS_SYSCALL_TRAP \
217 + b solaris_syscall; \
222 +#define INDIRECT_SOLARIS_SYSCALL(x) \
224 + b solaris_syscall; \
228 +#define BREAKPOINT_TRAP \
229 + b breakpoint_trap; \
234 +/* Software trap for Sparc-netbsd system calls. */
235 +#define NETBSD_SYSCALL_TRAP \
236 + sethi %hi(C_LABEL(sys_call_table)), %l7; \
237 + or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
241 +/* The Get Condition Codes software trap for userland. */
242 +#define GETCC_TRAP \
243 + b getcc_trap_handler; mov %psr, %l0; nop; nop;
245 +/* The Set Condition Codes software trap for userland. */
246 +#define SETCC_TRAP \
247 + b setcc_trap_handler; mov %psr, %l0; nop; nop;
249 +/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
250 + * gets handled with another macro.
252 +#define TRAP_ENTRY_INTERRUPT(int_level) \
253 + mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
255 +/* NMI's (Non Maskable Interrupts) are special, you can't keep them
256 + * from coming in, and basically if you get one, the shows over. ;(
257 + * On the sun4c they are usually asynchronous memory errors, on the
258 + * the sun4m they could be either due to mem errors or a software
259 + * initiated interrupt from the prom/kern on an SMP box saying "I
260 + * command you to do CPU tricks, read your mailbox for more info."
263 + rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
267 +/* Window overflows/underflows are special and we need to try to be as
268 + * efficient as possible here....
270 +#define WINDOW_SPILL \
271 + rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;
273 +#define WINDOW_FILL \
274 + rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;
276 +#define STUB_TRAP ba stub_trap; nop; nop; nop;
278 +#define TRAP_ENTRY(a,b) STUB_TRAP
279 +#define SKIP_TRAP(a,b) STUB_TRAP
280 +#define SUNOS_SYSCALL_TRAP STUB_TRAP
281 +#define SOLARIS_SYSCALL_TRAP STUB_TRAP
282 +#define NETBSD_SYSCALL_TRAP STUB_TRAP
283 +#define LINUX_SYSCALL_TRAP STUB_TRAP
284 +#define BREAKPOINT_TRAP STUB_TRAP
285 +#define NMI_TRAP STUB_TRAP
286 +#define GETCC_TRAP STUB_TRAP
287 +#define SETCC_TRAP STUB_TRAP
288 +#define BAD_TRAP(n) STUB_TRAP
289 +#define TRAP_ENTRY_INTERRUPT(i) STUB_TRAP
290 +#define INDIRECT_SOLARIS_SYSCALL(i) STUB_TRAP
293 + .globl start, _start
296 + .globl spill_window_entry, fill_window_entry
298 +#define EXPORT_TRAP(trap) \
300 + .type trap,function; \
315 +EXPORT_TRAP(t_irq10)
316 +EXPORT_TRAP(t_irq11)
317 +EXPORT_TRAP(t_irq12)
318 +EXPORT_TRAP(t_irq13)
319 +EXPORT_TRAP(t_irq14)
320 +EXPORT_TRAP(t_irq15)
323 +t_zero: b goprol; nop; nop; nop;
324 +t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
325 +t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
326 +t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
327 +t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
328 +t_wovf: WINDOW_SPILL /* Window Overflow */
329 +t_wunf: WINDOW_FILL /* Window Underflow */
330 +t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
331 +t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
332 +t_dflt: SRMMU_DFAULT /* Data Miss Exception */
333 +t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
334 +t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
335 +t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
336 +t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
337 +t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
338 +t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
339 +t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
340 +t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
341 +t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
342 +t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
343 +t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
344 +t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
345 +t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
346 +t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
347 +t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
348 +t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
349 +t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
350 +t_nmi: NMI_TRAP /* Level 15 (NMI) */
351 +t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
352 +t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
353 +t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
354 +t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
355 +t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
356 +t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
357 +t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
358 +t_dacce:SRMMU_DFAULT /* Data Access Error */
359 +t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
360 +t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
361 +t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
362 +t_bad2d: BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f)
363 + BAD_TRAP(0x30) BAD_TRAP(0x31) BAD_TRAP(0x32) BAD_TRAP(0x33)
364 + BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) BAD_TRAP(0x37)
365 + BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
366 +t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
367 + BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f)
368 + BAD_TRAP(0x40) BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43)
369 + BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) BAD_TRAP(0x47)
370 + BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
371 + BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
372 + BAD_TRAP(0x50) BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53)
373 + BAD_TRAP(0x54) BAD_TRAP(0x55) BAD_TRAP(0x56) BAD_TRAP(0x57)
374 + BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) BAD_TRAP(0x5b)
375 + BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
376 + BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63)
377 + BAD_TRAP(0x64) BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67)
378 + BAD_TRAP(0x68) BAD_TRAP(0x69) BAD_TRAP(0x6a) BAD_TRAP(0x6b)
379 + BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) BAD_TRAP(0x6f)
380 + BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
381 + BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77)
382 + BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b)
383 + BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f)
384 +t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */
385 +t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
386 +t_divz: BAD_TRAP(0x82) /* Divide by zero trap */
387 +t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
388 +t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
389 +t_rchk: BAD_TRAP(0x85) /* Range Check */
390 +t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
391 +t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
392 +t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */
393 +t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */
394 +t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d)
395 + BAD_TRAP(0x8e) BAD_TRAP(0x8f)
396 +t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
397 +t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93)
398 + BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97)
399 + BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
400 +t_getcc:GETCC_TRAP /* Get Condition Codes */
401 +t_setcc:SETCC_TRAP /* Set Condition Codes */
402 +t_bada2:BAD_TRAP(0xa2) BAD_TRAP(0xa3)
403 + BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
404 +t_slowi:INDIRECT_SOLARIS_SYSCALL(156)
405 + BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
406 + BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf)
407 + BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3)
408 + BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7)
409 + BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) BAD_TRAP(0xbb)
410 + BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
411 +t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3)
412 + BAD_TRAP(0xc4) BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7)
413 + BAD_TRAP(0xc8) BAD_TRAP(0xc9) BAD_TRAP(0xca) BAD_TRAP(0xcb)
414 + BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) BAD_TRAP(0xcf)
415 + BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
416 +t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7)
417 + BAD_TRAP(0xd8) BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb)
418 + BAD_TRAP(0xdc) BAD_TRAP(0xdd) BAD_TRAP(0xde) BAD_TRAP(0xdf)
419 + BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) BAD_TRAP(0xe3)
420 + BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
421 +t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb)
422 + BAD_TRAP(0xec) BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef)
423 + BAD_TRAP(0xf0) BAD_TRAP(0xf1) BAD_TRAP(0xf2) BAD_TRAP(0xf3)
424 + BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) BAD_TRAP(0xf7)
425 + BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
426 +t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)
427 +dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
428 +dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
431 + set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
432 + set 0x00ffffff, %g4
433 + sta %g4, [%g5] ASI_M_BYPASS
439 + .align 0x1000 ! PAGE_SIZE
440 + .globl C_LABEL(bootup_user_stack)
441 + .type bootup_user_stack,#object
442 + .size bootup_user_stack,0x2000
443 +C_LABEL(bootup_user_stack): .skip 0x2000
448 + ! %g1 contains end of memory
449 + set PHYS_JJ_EEPROM + 0x30, %g1
450 + lda [%g1] ASI_M_BYPASS, %g1
451 + ! map PROLDATA to PROLBASE+PROLSIZE to end of ram
452 + set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables
453 + sub %g1, %g2, %g2 ! start of private memory
454 + srl %g2, 0x4, %g7 ! ctx table at s+0x0
455 + add %g2, 0x400, %g3 ! l1 table at s+0x400
458 + sta %g3, [%g2] ASI_M_BYPASS
459 + add %g2, 0x400, %g2 ! s+0x400
460 + add %g2, 0x800, %g3 ! l2 table for ram (00xxxxxx) at s+0x800
463 + sta %g3, [%g2] ASI_M_BYPASS
464 + add %g2, 0x500, %g3 ! l2 table for rom (ffxxxxxx) at s+0x900
465 + add %g2, 0x3fc, %g2 ! s+0x7fc
468 + sta %g3, [%g2] ASI_M_BYPASS
469 + add %g2, 0x4, %g2 ! s+0x800
470 + set ((7 << 2) | 2), %g3 ! 7 = U: --- S: RWX (main memory)
471 + sta %g3, [%g2] ASI_M_BYPASS
472 + add %g2, 0x200, %g3 ! l3 table for rom at s+0xa00
473 + add %g2, 0x1d0, %g2 ! s+0x9d0
476 + sta %g3, [%g2] ASI_M_BYPASS
477 + add %g2, 0x30, %g2 ! s+0xa00
481 + set (PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages
482 +1: srl %g3, 0x4, %g4
483 + or %g4, ((7 << 2) | 2), %g4 ! 4 = U: --X S: --X (rom, execute only)
484 + sta %g4, [%g2] ASI_M_BYPASS
491 + set (PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages
492 +1: srl %g3, 0x4, %g4
493 + or %g4, ((0 << 2) | 2), %g4 ! 0 = U: R-- S: R-- (rom, read only)
494 + sta %g4, [%g2] ASI_M_BYPASS
501 + set (PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages
505 +1: srl %g3, 0x4, %g4
506 + or %g4, ((7 << 2) | 2), %g4 ! 5 = U: R-- S: RW- (data area, read/write)
507 + sta %g4, [%g2] ASI_M_BYPASS
517 + sta %g7, [%g2] ASI_M_MMUREGS ! set ctx table ptr
519 + sta %g1, [%g0] ASI_M_MMUREGS ! enable mmu
522 + * The code which enables traps is a simplified version of
525 + * We know number of windows as 8 so we do not calculate them.
526 + * The deadwood is here for any case.
529 + /* Turn on Supervisor, EnableFloating, and all the PIL bits.
530 + * Also puts us in register window zero with traps off.
532 + set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
536 + /* I want a kernel stack NOW! */
537 + set C_LABEL(bootup_user_stack), %g1
538 + set (0x2000 - REGWIN_SZ), %g2
540 + mov 0, %fp /* And for good luck */
542 + /* Zero out our BSS section. */
543 + set C_LABEL(bss_start) , %o0 ! First address of BSS
544 + set C_LABEL(end) , %o1 ! Last address of BSS
550 + subcc %o0, %o1, %g0
555 + wr %g1, 0x0, %wim ! make window 1 invalid
564 + and %g3, PSR_CWP, %g3
571 + sethi %hi( C_LABEL(cputyp) ), %o0
572 + st %g7, [%o0 + %lo( C_LABEL(cputyp) )]
574 + sethi %hi( C_LABEL(nwindows) ), %g4
575 + st %g3, [%g4 + %lo( C_LABEL(nwindows) )]
578 + sethi %hi( C_LABEL(nwindowsm1) ), %g4
579 + st %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
582 + /* Here we go, start using Linux's trap table... */
583 + set C_LABEL(trapbase), %g3
587 + /* Finally, turn on traps so that we can call c-code. */
592 + wr %g3, PSR_ET, %psr
596 + call C_LABEL(prolmain)
604 + * Memory access trap handler
605 + * %l0 program %psr from trap table entry
606 + * %l1 program %pc from hardware
607 + * %l2 program %npc from hardware
608 + * %l3 program %wim from trap table entry
612 + * %l7 text flag from trap table entry
617 +C_LABEL(srmmu_fault):
621 + lda [%l6] ASI_M_MMUREGS, %l6
622 + lda [%l5] ASI_M_MMUREGS, %l5
624 + set ignore_fault, %l5
626 + subcc %l5, %g0, %g0 /* NULL pointer trap faults always */
629 + subcc %l5, %l6, %g0
634 + set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
635 + set 0x00ffffff, %g4
636 + sta %g4, [%g5] ASI_M_BYPASS
637 + add %g5, 8, %g5 /* On right side */
638 + sta %g4, [%g5] ASI_M_BYPASS
642 + set C_LABEL(fault_ignored), %l5
647 + * Skip the faulting instruction.
648 + * I think it works when next instruction is a branch even.
659 + * Slow external versions of st_bypass and ld_bypass.
660 + * rconsole.c uses inlines. We call these in places which are not speed
661 + * critical, to avoid compiler bugs.
663 + .globl C_LABEL(st_bypass)
666 + sta %o1, [%o0] ASI_M_BYPASS
667 + .globl C_LABEL(ld_bypass)
670 + lda [%o0] ASI_M_BYPASS, %o0
671 + .globl C_LABEL(sth_bypass)
672 +C_LABEL(sth_bypass):
674 + stha %o1, [%o0] ASI_M_BYPASS
675 + .globl C_LABEL(ldh_bypass)
676 +C_LABEL(ldh_bypass):
678 + lduha [%o0] ASI_M_BYPASS, %o0
679 + .globl C_LABEL(stb_bypass)
680 +C_LABEL(stb_bypass):
682 + stba %o1, [%o0] ASI_M_BYPASS
683 + .globl C_LABEL(ldb_bypass)
684 +C_LABEL(ldb_bypass):
686 + lduba [%o0] ASI_M_BYPASS, %o0
687 diff -ruN proll_18.orig/qemu/main.c proll-patch10/qemu/main.c
688 --- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000
689 +++ proll-patch10/qemu/main.c 2005-04-16 18:03:23.000000000 +0000
692 + ** Proll (PROM replacement)
693 + ** Copyright 1999 Pete Zaitcev
694 + ** This code is licensed under GNU General Public License.
698 +// #include <asm/contregs.h>
700 +#include "pgtsrmmu.h"
701 +#include "iommu.h" /* Typical SBus IOMMU for sun4m */
702 +#include "phys_jj.h"
703 +#include "vconsole.h"
704 +#include "version.h"
705 +#include <general.h> /* __P() */
706 +#include <net.h> /* init_net() */
707 +#include <romlib.h> /* we are a provider for part of this. */
708 +#include <netpriv.h> /* myipaddr */
710 +#include <system.h> /* our own prototypes */
712 +void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic);
713 +int vcon_zs_init(struct vconterm *t, unsigned int a0);
714 +int vcon_zs_write(struct vconterm *t, char *data, int leng);
715 +int vcon_zs_getch(struct vconterm *t);
717 +int esp_boot(int unit);
718 +static void init_idprom(void);
720 +struct vconterm dp0;
721 +struct mem cmem; /* Current memory, virtual */
722 +struct mem cio; /* Current I/O space */
723 +struct phym pmem; /* Current phys. mem. */
724 +struct iommu ciommu; /* Our IOMMU on sun4m */
728 + unsigned int version;
729 + char pad1[0x1c]; // Pad to 0x30
730 + unsigned int ram_size;
732 + unsigned int load_addr, kernel_size;
733 + unsigned int cmdline, cmdline_len;
734 + char pad2[0x0c]; // Pad to 0x54
735 + unsigned short width, height, depth;
738 +int ignore_fault, fault_ignored;
739 +void *printk_fn, *getch_fn;
740 +unsigned int q_height, q_width;
746 + static char fname[14];
747 + static struct banks bb;
748 + unsigned int hiphybas;
749 + const void *romvec;
750 + unsigned int ram_size;
751 + char nographic, bootdev;
753 + nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F);
755 + q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54);
756 + q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56);
757 + vcon_init(&dp0, PHYS_JJ_TCX_FB);
758 + printk_fn = vcon_write;
759 + getch_fn = vcon_getch;
762 + vcon_zs_init(&dp0, 0x71100004);
763 + printk_fn = vcon_zs_write;
764 + getch_fn = vcon_zs_getch;
768 + printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);
769 + ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);
770 + printk("%d MB total\n", ram_size/(1024*1024));
773 + bb.bankv[0].start = 0;
774 + bb.bankv[0].length = ram_size;
776 + hiphybas = ram_size - PROLSIZE;
778 + mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));
779 + makepages(&pmem, hiphybas);
780 + init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);
782 + mem_init(&cio, (char *)(PROLBASE+PROLSIZE),
783 + (char *)(PROLBASE+PROLSIZE+IOMAPSIZE));
785 + iommu_init(&ciommu, hiphybas);
790 + printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version);
792 + printk("Prom console: TCX %dx%d\n", q_width, q_height);
794 + printk("Prom console: serial\n");
800 + bootdev = hw_idprom->boot_device;
801 + printk("Boot device: %c\n", bootdev);
802 + if (hw_idprom->kernel_size > 0) {
803 + printk("Kernel already loaded\n");
804 + } else if (bootdev == 'n') {
805 + if (bootp() != 0) fatal();
807 + * boot_rec.bp_file cannot be used because system PROM
808 + * uses it to locate ourselves. If we load from boot_rec.bp_file,
809 + * we will loop reloading PROLL over and over again.
810 + * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L).
812 + xtoa(myipaddr, fname, 8);
820 + if (load(boot_rec.bp_siaddr, fname) != 0) fatal();
821 + } else if (bootdev == 'c') {
822 + if (esp_boot(0) != 0) fatal();
823 + } else if (bootdev == 'd') {
824 + if (esp_boot(2) != 0) fatal();
827 + romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas,
828 + (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic);
830 + printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",
831 + PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,
832 + (int)cio.start, (int)cio.curp);
835 + void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr;
836 + printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n",
837 + *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline);
838 + entry(romvec, 0, 0, 0, 0);
846 + * dvma_alloc over iommu_alloc.
848 +void *dvma_alloc(int size, unsigned int *pphys)
850 + return iommu_alloc(&ciommu, size, pphys);
855 +void udelay(unsigned long usecs)
857 + // Qemu hardware is perfect and does not need any delays!
860 +static void init_idprom()
864 + if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {
865 + printk("init_idprom: cannot map eeprom\n");
868 + bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE);
870 + * hw_idprom is not used anywhere.
871 + * It's just as we hate to leave hanging pointers (I/O page here).
873 + hw_idprom = va_prom;
876 diff -ruN proll_18.orig/qemu/openprom.c proll-patch10/qemu/openprom.c
877 --- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000
878 +++ proll-patch10/qemu/openprom.c 2005-04-16 17:30:19.000000000 +0000
881 + * PROM interface support
882 + * Copyright 1996 The Australian National University.
883 + * Copyright 1996 Fujitsu Laboratories Limited
884 + * Copyright 1999 Pete A. Zaitcev
885 + * This software may be distributed under the terms of the Gnu
886 + * Public License version 2 or later
889 +#include <openprom.h>
890 +#include <general.h>
893 +#include <vconsole.h>
894 +#include "phys_jj.h"
898 +#define PAGE_SIZE 4096
907 + const struct property *properties;
908 + /* short */ const int sibling;
909 + /* short */ const int child;
912 +static int obp_nextnode(int node);
913 +static int obp_child(int node);
914 +static int obp_proplen(int node, char *name);
915 +static int obp_getprop(int node, char *name, char *val);
916 +static int obp_setprop(int node, char *name, char *val, int len);
917 +static const char *obp_nextprop(int node, char *name);
919 +static char obp_idprom[IDPROM_SIZE];
920 +static const struct property null_properties = { NULL, NULL, -1 };
921 +static const int prop_true = -1;
923 +static const struct property propv_root[] = {
924 + {"name", "SUNW,JavaStation-1", sizeof("SUNW,JavaStation-1") },
925 + {"idprom", obp_idprom, IDPROM_SIZE},
926 + {"banner-name", "JavaStation", sizeof("JavaStation")},
927 + {"compatible", "sun4m", 6},
931 +static const int prop_iommu_reg[] = {
932 + 0x0, 0x10000000, 0x00000300,
934 +static const struct property propv_iommu[] = {
935 + {"name", "iommu", sizeof("iommu")},
936 + {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) },
940 +static const int prop_sbus_ranges[] = {
941 + 0x0, 0x0, 0x0, 0x30000000, 0x10000000,
942 + 0x1, 0x0, 0x0, 0x40000000, 0x10000000,
943 + 0x2, 0x0, 0x0, 0x50000000, 0x10000000,
944 + 0x3, 0x0, 0x0, 0x60000000, 0x10000000,
945 + 0x4, 0x0, 0x0, 0x70000000, 0x10000000,
947 +static const struct property propv_sbus[] = {
948 + {"name", "sbus", 5},
949 + {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)},
950 + {"device_type", "hierarchical", sizeof("hierarchical") },
954 +static const int prop_tcx_regs[] = {
955 + 0x2, 0x00800000, 0x00100000,
956 + 0x2, 0x02000000, 0x00000001,
957 + 0x2, 0x04000000, 0x00800000,
958 + 0x2, 0x06000000, 0x00800000,
959 + 0x2, 0x0a000000, 0x00000001,
960 + 0x2, 0x0c000000, 0x00000001,
961 + 0x2, 0x0e000000, 0x00000001,
962 + 0x2, 0x00700000, 0x00001000,
963 + 0x2, 0x00200000, 0x00000004,
964 + 0x2, 0x00300000, 0x0000081c,
965 + 0x2, 0x00000000, 0x00010000,
966 + 0x2, 0x00240000, 0x00000004,
967 + 0x2, 0x00280000, 0x00000001,
971 +static const int pixfreq = 0x03dfd240;
972 +static const int hbporch = 0xa0;
973 +static const int vfreq = 0x3c;
975 +#if 0 /* Kevin Boone - 70Hz refresh */
976 +static const int pixfreq = 0x047868C0;
977 +static const int hbporch = 0x90;
978 +static const int vfreq = 0x46;
981 +static const int vbporch = 0x1d;
982 +static const int vsync = 0x6;
983 +static const int hsync = 0x88;
984 +static const int vfporch = 0x3;
985 +static const int hfporch = 0x18;
986 +static const int height = 0x300;
987 +static const int width = 0x400;
988 +static const int linebytes = 0x400;
989 +static const int depth = 8;
990 +static const int tcx_intr[] = { 5, 0 };
991 +static const int tcx_interrupts = 5;
992 +static const struct property propv_sbus_tcx[] = {
993 + {"name", "SUNW,tcx", sizeof("SUNW,tcx")},
994 + {"vbporch", (char*)&vbporch, sizeof(int)},
995 + {"hbporch", (char*)&hbporch, sizeof(int)},
996 + {"vsync", (char*)&vsync, sizeof(int)},
997 + {"hsync", (char*)&hsync, sizeof(int)},
998 + {"vfporch", (char*)&vfporch, sizeof(int)},
999 + {"hfporch", (char*)&hfporch, sizeof(int)},
1000 + {"pixfreq", (char*)&pixfreq, sizeof(int)},
1001 + {"vfreq", (char*)&vfreq, sizeof(int)},
1002 + {"height", (char*)&height, sizeof(int)},
1003 + {"width", (char*)&width, sizeof(int)},
1004 + {"linebytes", (char*)&linebytes, sizeof(int)},
1005 + {"depth", (char*)&depth, sizeof(int)},
1006 + {"reg", (char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)},
1007 + {"tcx-8-bit", (char*)&prop_true, 0},
1008 + {"intr", (char*)&tcx_intr[0], sizeof(tcx_intr)},
1009 + {"interrupts", (char*)&tcx_interrupts, sizeof(tcx_interrupts)},
1010 + {"device_type", "display", sizeof("display")},
1014 +static const int prop_cs4231_reg[] = {
1015 + 0x3, 0x0C000000, 0x00000040
1017 +static const int cs4231_interrupts = 5;
1018 +static const int cs4231_intr[] = { 5, 0 };
1020 +static const struct property propv_sbus_cs4231[] = {
1021 + {"name", "SUNW,CS4231", sizeof("SUNW,CS4231") },
1022 + {"intr", (char*)&cs4231_intr[0], sizeof(cs4231_intr) },
1023 + {"interrupts", (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) },
1024 + {"reg", (char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) },
1025 + {"device_type", "serial", sizeof("serial") },
1026 + {"alias", "audio", sizeof("audio") },
1030 +static const int cpu_nctx = NCTX_SWIFT;
1031 +static const int cpu_cache_line_size = 0x20;
1032 +static const int cpu_cache_nlines = 0x200;
1033 +static const struct property propv_cpu[] = {
1034 + {"name", "STP1012PGA", sizeof("STP1012PGA") },
1035 + {"device_type", "cpu", 4 },
1036 + {"mmu-nctx", (char*)&cpu_nctx, sizeof(int)},
1037 + {"cache-line-size", (char*)&cpu_cache_line_size, sizeof(int)},
1038 + {"cache-nlines", (char*)&cpu_cache_nlines, sizeof(int)},
1042 +static const int prop_obio_ranges[] = {
1043 + 0x0, 0x0, 0x0, 0x71000000, 0x01000000,
1045 +static const struct property propv_obio[] = {
1046 + {"name", "obio", 5 },
1047 + {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },
1048 + {"device_type", "hierarchical", sizeof("hierarchical") },
1052 +static const int prop_auxio_reg[] = {
1053 + 0x0, 0x00900000, 0x00000001,
1055 +static const struct property propv_obio_auxio[] = {
1056 + {"name", "auxio", sizeof("auxio") },
1057 + {"reg", (char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) },
1061 +static const int prop_int_reg[] = {
1062 + 0x0, 0x00e00000, 0x00000010,
1063 + 0x0, 0x00e10000, 0x00000010,
1065 +static const struct property propv_obio_int[] = {
1066 + {"name", "interrupt", sizeof("interrupt")},
1067 + {"reg", (char*)&prop_int_reg[0], sizeof(prop_int_reg) },
1071 +static const int prop_cnt_reg[] = {
1072 + 0x0, 0x00d00000, 0x00000010,
1073 + 0x0, 0x00d10000, 0x00000010,
1075 +static const struct property propv_obio_cnt[] = {
1076 + {"name", "counter", sizeof("counter")},
1077 + {"reg", (char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) },
1081 +static const int prop_eeprom_reg[] = {
1082 + 0x0, 0x00200000, 0x00002000,
1084 +static const struct property propv_obio_eep[] = {
1085 + {"name", "eeprom", sizeof("eeprom")},
1086 + {"reg", (char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) },
1087 + {"model", "mk48t08", sizeof("mk48t08")},
1091 +static const int prop_su_reg[] = {
1092 + 0x0, 0x003002f8, 0x00000008,
1094 +static const struct property propv_obio_su[] = {
1095 + {"name", "su", sizeof("su")},
1096 + {"reg", (char*)&prop_su_reg[0], sizeof(prop_su_reg) },
1100 +static const int prop_zs_intr[] = { 0x2c, 0x0 };
1101 +static const int prop_zs_reg[] = {
1102 + 0x0, 0x00000000, 0x00000008,
1104 +static const int prop_zs_slave[] = { 1 };
1105 +static void *prop_zs_addr;
1106 +static const struct property propv_obio_zs[] = {
1107 + {"name", "zs", sizeof("zs")},
1108 + {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) },
1109 + {"slave", (char*)&prop_zs_slave[0], sizeof(prop_zs_slave) },
1110 + {"device_type", "serial", sizeof("serial") },
1111 + {"intr", (char*)&prop_zs_intr[0], sizeof(prop_zs_intr) },
1112 + {"address", (char*)&prop_zs_addr, sizeof(prop_zs_addr) },
1116 +static const int prop_zs1_intr[] = { 0x2c, 0x0 };
1117 +static const int prop_zs1_reg[] = {
1118 + 0x0, 0x00100000, 0x00000008,
1120 +static void *prop_zs1_addr;
1121 +static const int prop_zs1_slave[] = { 0 };
1122 +static const struct property propv_obio_zs1[] = {
1123 + {"name", "zs", sizeof("zs")},
1124 + {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) },
1125 + {"slave", (char*)&prop_zs1_slave[0], sizeof(prop_zs1_slave) },
1126 + {"device_type", "serial", sizeof("serial") },
1127 + {"intr", (char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) },
1128 + {"address", (char*)&prop_zs1_addr, sizeof(prop_zs1_addr) },
1132 +static const int prop_ledma_reg[] = {
1133 + 0x4, 0x08400010, 0x00000020,
1135 +static const int prop_ledma_burst = 0x3f;
1136 +static const struct property propv_sbus_ledma[] = {
1137 + {"name", "ledma", sizeof("ledma")},
1138 + {"reg", (char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) },
1139 + {"burst-sizes", (char*)&prop_ledma_burst, sizeof(int) },
1143 +static const int prop_le_reg[] = {
1144 + 0x4, 0x08c00000, 0x00000004,
1146 +static const int prop_le_busmaster_regval = 0x7;
1147 +static const int prop_le_intr[] = { 0x26, 0x0 };
1148 +static const struct property propv_sbus_ledma_le[] = {
1149 + {"name", "le", sizeof("le")},
1150 + {"reg", (char*)&prop_le_reg[0], sizeof(prop_le_reg) },
1151 + {"busmaster-regval", (char*)&prop_le_busmaster_regval, sizeof(int)},
1152 + {"intr", (char*)&prop_le_intr[0], sizeof(prop_le_intr) },
1156 +static const int prop_espdma_reg[] = {
1157 + 0x4, 0x08400000, 0x00000010,
1160 +static const struct property propv_sbus_espdma[] = {
1161 + {"name", "espdma", sizeof("espdma")},
1162 + {"reg", (char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) },
1166 +static const int prop_esp_reg[] = {
1167 + 0x4, 0x08800000, 0x00000040,
1169 +static const int prop_esp_intr[] = { 0x24, 0x0 };
1170 +static const struct property propv_sbus_espdma_esp[] = {
1171 + {"name", "esp", sizeof("esp")},
1172 + {"reg", (char*)&prop_esp_reg[0], sizeof(prop_esp_reg) },
1173 + {"intr", (char*)&prop_esp_intr[0], sizeof(prop_esp_intr) },
1177 +static const int prop_bpp_reg[] = {
1178 + 0x4, 0x0c800000, 0x0000001c,
1180 +static const int prop_bpp_intr[] = { 0x33, 0x0 };
1181 +static const struct property propv_sbus_bpp[] = {
1182 + {"name", "SUNW,bpp", sizeof("SUNW,bpp")},
1183 + {"reg", (char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) },
1184 + {"intr", (char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) },
1188 +static const int prop_fd_intr[] = { 0x2b, 0x0 };
1189 +static const int prop_fd_reg[] = {
1190 + 0x0, 0x00400000, 0x0000000f,
1192 +static const struct property propv_obio_fd[] = {
1193 + {"name", "SUNW,fdtwo", sizeof("SUNW,fdtwo")},
1194 + {"reg", (char*)&prop_fd_reg[0], sizeof(prop_fd_reg) },
1195 + {"device_type", "block", sizeof("block") },
1196 + {"intr", (char*)&prop_fd_intr[0], sizeof(prop_fd_intr) },
1200 +static const int prop_pw_intr[] = { 0x22, 0x0 };
1201 +static const int prop_pw_reg[] = {
1202 + 0x0, 0x00910000, 0x00000001,
1204 +static const struct property propv_obio_pw[] = {
1205 + {"name", "power", sizeof("power")},
1206 + {"reg", (char*)&prop_pw_reg[0], sizeof(prop_pw_reg) },
1207 + {"intr", (char*)&prop_pw_intr[0], sizeof(prop_pw_intr) },
1211 +static const int prop_cf_reg[] = {
1212 + 0x0, 0x00800000, 0x00000001,
1214 +static const struct property propv_obio_cf[] = {
1215 + {"name", "slavioconfig", sizeof("slavioconfig")},
1216 + {"reg", (char*)&prop_cf_reg[0], sizeof(prop_cf_reg) },
1220 +static const struct property propv_options[] = {
1221 + {"name", "options", sizeof("options")},
1222 + {"screen-#columns", "80", sizeof("80")},
1223 + {"screen-#rows", "25", sizeof("25")},
1224 + {"tpe-link-test?", "true", sizeof("true")},
1225 + {"ttya-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")},
1226 + {"ttya-ignore-cd", "true", sizeof("true")},
1227 + {"ttya-rts-dtr-off", "false", sizeof("false")},
1228 + {"ttyb-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")},
1229 + {"ttyb-ignore-cd", "true", sizeof("true")},
1230 + {"ttyb-rts-dtr-off", "false", sizeof("false")},
1234 +static const struct node nodes[] = {
1235 + { &null_properties, 1, 0 }, /* 0 = big brother of root */
1236 + { propv_root, 0, 2 }, /* 1 "/" */
1237 + { propv_iommu, 11, 3 }, /* 2 "/iommu" */
1238 + { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */
1239 + { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */
1240 + { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */
1241 + { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */
1242 + { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */
1243 + { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */
1244 + { propv_sbus_espdma, 0, 10 }, /* 9 "/iommu/sbus/espdma" */
1245 + { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */
1246 + { propv_cpu, 12, 0 }, /* 11 "/STP1012PGA" */
1247 + { propv_obio, 22, 13 }, /* 12 "/obio" */
1248 + { propv_obio_int, 14, 0 }, /* 13 "/obio/interrupt" */
1249 + { propv_obio_cnt, 15, 0 }, /* 14 "/obio/counter" */
1250 + { propv_obio_eep, 16, 0 }, /* 15 "/obio/eeprom" */
1251 + { propv_obio_auxio, 17, 0 }, /* 16 "/obio/auxio" */
1252 + { propv_obio_zs1, 18, 0 }, /* 17 "/obio/zs@0,100000"
1253 + Must be before zs@0,0! */
1254 + { propv_obio_zs, 19, 0 }, /* 18 "/obio/zs@0,0" */
1255 + { propv_obio_fd, 20, 0 }, /* 19 "/obio/SUNW,fdtwo" */
1256 + { propv_obio_pw, 21, 0 }, /* 20 "/obio/power" */
1257 + { propv_obio_cf, 0, 0 }, /* 21 "/obio/slavioconfig@0,800000" */
1258 + { propv_options, 0, 0 }, /* 22 "/options" */
1261 +static struct linux_mlist_v0 totphys[MAX_BANKS];
1262 +static struct linux_mlist_v0 totmap[1];
1263 +static struct linux_mlist_v0 totavail[MAX_BANKS];
1265 +static struct linux_mlist_v0 *ptphys;
1266 +static struct linux_mlist_v0 *ptmap;
1267 +static struct linux_mlist_v0 *ptavail;
1269 +static const struct linux_nodeops nodeops0 = {
1270 + obp_nextnode, /* int (*no_nextnode)(int node); */
1271 + obp_child, /* int (*no_child)(int node); */
1272 + obp_proplen, /* int (*no_proplen)(int node, char *name); */
1273 + obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */
1274 + obp_setprop, /* int (*no_setprop)(int node, char *name,
1275 + char *val, int len); */
1276 + obp_nextprop /* char * (*no_nextprop)(int node, char *name); */
1279 +static struct linux_arguments_v0 obp_arg;
1280 +static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
1282 +static void (*synch_hook)(void);
1283 +static char obp_stdin, obp_stdout;
1285 +static int obp_nbgetchar(void);
1286 +static int obp_nbputchar(int ch);
1287 +static void obp_reboot(char *);
1288 +static void obp_abort(void);
1289 +static void obp_halt(void);
1290 +static int obp_devopen(char *str);
1291 +static int obp_devclose(int dev_desc);
1292 +static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf);
1293 +static char *obp_dumb_mmap(char *va, int which_io, unsigned int pa, unsigned int size);
1294 +static void obp_dumb_munmap(char *va, unsigned int size);
1296 +static void doublewalk(unsigned ptab1, unsigned va)
1298 +unsigned int proc_tablewalk(int ctx, unsigned int va);
1299 +unsigned int mem_tablewalk(unsigned int pa, unsigned int va);
1301 + proc_tablewalk(0, va);
1302 + if (ptab1 != 0) mem_tablewalk(ptab1, va);
1305 +static struct linux_romvec romvec0;
1308 +init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas,
1309 + const char *cmdline, char boot_device, int nographic)
1314 + * Avoid data segment allocations
1318 + ptavail = totavail;
1320 + * Form memory descriptors.
1322 + for (i = 0; i < bankc; i++) {
1323 + totphys[i].theres_more = &totphys[i+1];
1324 + totphys[i].start_adr = (char*) bankv[i].start;
1325 + totphys[i].num_bytes = bankv[i].length;
1327 + totphys[i-1].theres_more = 0;
1330 + * XXX Merged in normal PROM when full banks touch.
1332 + for (i = 0; i < bankc; i++) {
1333 + unsigned bankbase = bankv[i].start;
1334 + unsigned banksize = bankv[i].length;
1335 + if (hiphybas > bankbase &&
1336 + hiphybas < bankbase + banksize) {
1337 + banksize = hiphybas - bankbase;
1339 + totavail[i].theres_more = &totavail[i+1];
1340 + totavail[i].start_adr = (char*) bankbase;
1341 + totavail[i].num_bytes = banksize;
1343 + totavail[i-1].theres_more = 0;
1345 + totmap[0].theres_more = 0;
1346 + totmap[0].start_adr = (char*) PROLBASE;
1347 + totmap[0].num_bytes = PROLSIZE;
1352 + bcopy(idprom, obp_idprom, IDPROM_SIZE);
1354 + // Linux wants a R/W romvec table
1355 + romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;
1356 + romvec0.pv_plugin_revision = 77;
1357 + romvec0.pv_printrev = 0x10203;
1358 + romvec0.pv_v0mem.v0_totphys = &ptphys;
1359 + romvec0.pv_v0mem.v0_prommap = &ptmap;
1360 + romvec0.pv_v0mem.v0_available = &ptavail;
1361 + romvec0.pv_nodeops = &nodeops0;
1362 + romvec0.pv_bootstr = (void *)doublewalk;
1363 + romvec0.pv_v0devops.v0_devopen = &obp_devopen;
1364 + romvec0.pv_v0devops.v0_devclose = &obp_devclose;
1365 + romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev;
1366 + romvec0.pv_stdin = &obp_stdin;
1367 + romvec0.pv_stdout = &obp_stdout;
1368 + romvec0.pv_getchar = obp_nbgetchar;
1369 + romvec0.pv_putchar = (void (*)(int))obp_nbputchar;
1370 + romvec0.pv_nbgetchar = obp_nbgetchar;
1371 + romvec0.pv_nbputchar = obp_nbputchar;
1372 + romvec0.pv_reboot = obp_reboot;
1373 + romvec0.pv_printf = (void (*)(const char *fmt, ...))printk;
1374 + romvec0.pv_abort = obp_abort;
1375 + romvec0.pv_halt = obp_halt;
1376 + romvec0.pv_synchook = &synch_hook;
1377 + romvec0.pv_v0bootargs = &obp_argp;
1378 + romvec0.pv_v2devops.v2_dumb_mmap = obp_dumb_mmap;
1379 + romvec0.pv_v2devops.v2_dumb_munmap = obp_dumb_munmap;
1380 + obp_arg.boot_dev_ctrl = 0;
1381 + obp_arg.boot_dev_unit = '0';
1382 + switch(boot_device) {
1385 + obp_arg.argv[0] = "fd()";
1386 + obp_arg.boot_dev[0] = 'f';
1387 + obp_arg.boot_dev[1] = 'd';
1390 + obp_arg.boot_dev_unit = '2';
1393 + obp_arg.argv[0] = "sd()";
1394 + obp_arg.boot_dev[0] = 's';
1395 + obp_arg.boot_dev[1] = 'd';
1398 + obp_arg.argv[0] = "le()";
1399 + obp_arg.boot_dev[0] = 'l';
1400 + obp_arg.boot_dev[1] = 'e';
1403 + obp_arg.argv[1] = cmdline;
1406 + obp_stdin = PROMDEV_TTYA;
1407 + obp_stdout = PROMDEV_TTYA;
1409 + obp_stdin = PROMDEV_KBD;
1410 + obp_stdout = PROMDEV_SCREEN;
1412 + prop_zs_addr = map_io(0x71000000, 8);
1413 + prop_zs1_addr = map_io(0x71100000, 8);
1417 +static const struct property *find_property(int node,char *name)
1419 + const struct property *prop = &nodes[node].properties[0];
1420 + while (prop && prop->name) {
1421 + if (bcmp(prop->name, name, 128) == 0) return prop;
1427 +static int obp_nextnode(int node)
1430 + printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling);
1432 + return nodes[node].sibling;
1435 +static int obp_child(int node)
1438 + printk("obp_child(%d) = %d\n", node, nodes[node].child);
1440 + return nodes[node].child;
1443 +static int obp_proplen(int node, char *name)
1445 + const struct property *prop = find_property(node,name);
1448 + printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length);
1450 + return prop->length;
1453 + printk("obp_proplen(%d, %s) (no prop)\n", node, name);
1458 +static int obp_getprop(int node, char *name, char *value)
1460 + const struct property *prop;
1463 + // NULL name means get first property
1465 + printk("obp_getprop(%d, %x (NULL)) = %s\n", node, name,
1466 + nodes[node].properties[0].name);
1468 + return (int)nodes[node].properties[0].name;
1470 + prop = find_property(node,name);
1472 + memcpy(value,prop->value,prop->length);
1474 + printk("obp_getprop(%d, %s) = %s\n", node, name, value);
1476 + return prop->length;
1479 + printk("obp_getprop(%d, %s): not found\n", node, name);
1484 +static int obp_setprop(int node, char *name, char *value, int len)
1487 + printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len);
1492 +static const char *obp_nextprop(int node,char *name)
1494 + const struct property *prop;
1496 + if (!name || *name == '\0') {
1497 + // NULL name means get first property
1499 + printk("obp_nextprop(%d, NULL) = %s\n", node,
1500 + nodes[node].properties[0].name);
1502 + return nodes[node].properties[0].name;
1504 + prop = find_property(node,name);
1505 + if (prop && prop[1].name) {
1507 + printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name);
1509 + return prop[1].name;
1512 + printk("obp_nextprop(%d, %s): not found\n", node, name);
1514 + return (const char *)-1;
1517 +extern int (*getch_fn)(struct vconterm *v);
1519 +static int obp_nbgetchar(void) {
1520 + extern struct vconterm dp0;
1521 + return getch_fn(&dp0);
1524 +static int obp_nbputchar(int ch) {
1529 +static void obp_reboot(char *str) {
1530 + printk("rebooting (%s): not implemented, freezing\n", str);
1534 +static void obp_abort() {
1535 + printk("abort, freezing\n");
1539 +static void obp_halt() {
1540 + printk("halt, freezing\n");
1543 +#define isnum(c) ((c >= '0') && (c < '9'))
1544 +#define ctoi(c) (c - '0')
1545 +static int obp_devopen(char *str) {
1547 + printk("obp_devopen(%s)\n", str);
1549 + if (str[0] == 's' && str[1] == 'd' && str[4] == ',') {
1550 + unsigned int target;
1554 + else if (isnum(str[6]) && isnum(str[5])) {
1555 + target = (ctoi(str[5]) * 10 + ctoi(str[6])) & 7;
1558 + target = ctoi(str[5]) & 7;
1560 + return 's' + target;
1565 +static int obp_devclose(int dev_desc) {
1567 + printk("obp_devclose %d\n", dev_desc);
1572 +extern void *esp_read(int unit, int offset, short len);
1574 +static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf)
1580 + printk("obp_rdblkdev: fd %d, num_blks %d, offset %d, buf 0x%x\n", dev_desc, num_blks, offset, buf);
1582 + if (dev_desc >= 's' && dev_desc < 'v') {
1583 + for(i = 0; i < num_blks; i++) {
1584 + src = esp_read(dev_desc - 's', offset + i, 1);
1585 + memcpy(&buf[i << 9], src, 512);
1592 +static char *obp_dumb_mmap(char *va, int which_io, unsigned int pa, unsigned int size)
1594 + unsigned int npages;
1599 + printk("obp_dumb_mmap: virta %x, which_io %d, paddr %x, sz %d\n", va, which_io, pa, size);
1601 + off = pa & (PAGE_SIZE-1);
1602 + npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
1603 + pa &= ~(PAGE_SIZE-1);
1605 + mva = (unsigned int) va;
1606 + while (npages-- != 0) {
1607 + map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
1614 +static void obp_dumb_munmap(char *va, unsigned int size)
1617 + printk("obp_dumb_munmap: virta %x, sz %d\n", va, size);
1621 diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch10/qemu/system_qemu.c
1622 --- proll_18.orig/qemu/system_qemu.c 1970-01-01 00:00:00.000000000 +0000
1623 +++ proll-patch10/qemu/system_qemu.c 2005-04-16 06:16:20.000000000 +0000
1626 + ** Proll (PROM replacement)
1627 + ** system.c: shared miscallenea.
1628 + ** Copyright 1999 Pete Zaitcev
1629 + ** This code is licensed under GNU General Public License.
1631 +#include <stdarg.h>
1635 +#define NULL ((void*)0)
1638 +#include "pgtsrmmu.h"
1640 +#include "vconsole.h"
1641 +#include <timer.h> /* Local copy of 2.2 style include */
1642 +#include <general.h> /* __P() */
1643 +#include <net.h> /* init_net() */
1644 +#include <romlib.h> /* we are a provider for part of this. */
1645 +#include <netpriv.h> /* myipaddr */
1647 +#include <system.h> /* our own prototypes */
1652 +char idprom[IDPROM_SIZE];
1656 + * Create an I/O mapping to pa[size].
1657 + * Returns va of the mapping or 0 if unsuccessful.
1660 +map_io(unsigned pa, int size)
1663 + unsigned int npages;
1667 + off = pa & (PAGE_SIZE-1);
1668 + npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
1669 + pa &= ~(PAGE_SIZE-1);
1671 + va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE);
1672 + if (va == 0) return va;
1674 + mva = (unsigned int) va;
1675 + /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */
1676 + while (npages-- != 0) {
1677 + map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
1682 + return (void *)((unsigned int)va + off);
1686 + * Tablewalk routine used for testing.
1687 + * Returns PTP/PTE.
1690 +proc_tablewalk(int ctx, unsigned int va)
1694 + __asm__ __volatile__ ("lda [%1] %2, %0" :
1696 + "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
1697 + /* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */
1699 + pa1 = ld_bypass(pa1 + (ctx << 2));
1700 + if ((pa1 & 0x03) == 0) goto invalid;
1701 + return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va);
1704 + printk(" invalid %x\n", pa1);
1709 + * Walk the tables in memory, starting at physical address pa.
1712 +mem_tablewalk(unsigned int pa, unsigned int va)
1716 + printk("pa %x va %x", pa, va);
1717 + pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2));
1718 + if ((pa1 & 0x03) == 0) goto invalid;
1719 + printk(" l1 %x", pa1);
1720 + pa1 <<= 4; pa1 &= 0xFFFFFF00;
1721 + pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2));
1722 + if ((pa1 & 0x03) == 0) goto invalid;
1723 + printk(" l2 %x", pa1);
1724 + pa1 <<= 4; pa1 &= 0xFFFFFF00;
1725 + pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2));
1726 + if ((pa1 & 0x03) == 0) goto invalid;
1727 + printk(" l3 %x", pa1);
1728 + printk(" off %x\n", va&0x00000FFF);
1731 + printk(" invalid %x\n", pa1);
1736 + * Make CPU page tables.
1737 + * Returns pointer to context table.
1738 + * Here we ignore memory allocation errors which "should not happen"
1739 + * because we cannot print anything anyways if memory initialization fails.
1741 +void makepages(struct phym *t, unsigned int highbase)
1743 + unsigned int *ctp, *l1, pte;
1745 + unsigned int pa, va;
1747 + ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int));
1748 + l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int));
1750 + pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4);
1751 + for (i = 0; i < NCTX_SWIFT; i++) {
1756 + for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) {
1757 + map_page(l1, va, pa, 0, highbase);
1760 + pa = highbase + PROLDATA - PROLBASE;
1761 + for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) {
1762 + map_page(l1, va, pa, 0, highbase);
1766 + /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
1768 + for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
1769 + map_page(l1, va, pa, 0, highbase);
1775 + t->pbas = highbase;
1779 + * Create a memory mapping from va to epa in page table pgd.
1780 + * highbase is used for v2p translation.
1783 +map_page(unsigned int *pgd, unsigned int va,
1784 + unsigned int epa, int type, unsigned int highbase)
1790 + pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)];
1791 + if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
1792 + p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int),
1793 + SRMMU_PTRS_PER_PMD*sizeof(int));
1794 + if (p == 0) goto drop;
1795 + pte = SRMMU_ET_PTD |
1796 + (((unsigned int)p - PROLBASE + highbase) >> 4);
1797 + pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte;
1801 + pa = ((pte & 0xFFFFFFF0) << 4);
1802 + pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2);
1803 + pte = ld_bypass(pa);
1804 + if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
1805 + p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int),
1806 + SRMMU_PTRS_PER_PTE*sizeof(int));
1807 + if (p == 0) goto drop;
1808 + pte = SRMMU_ET_PTD |
1809 + (((unsigned int)p - PROLBASE + highbase) >> 4);
1810 + st_bypass(pa, pte);
1813 + pa = ((pte & 0xFFFFFFF0) << 4);
1814 + pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2);
1816 + pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4);
1817 + if (type) { /* I/O */
1819 + /* SRMMU cannot make Supervisor-only, but not exectutable */
1820 + pte |= SRMMU_PRIV;
1821 + } else { /* memory */
1822 + pte |= SRMMU_REF|SRMMU_CACHE;
1823 + pte |= SRMMU_PRIV; /* Supervisor only access */
1825 + st_bypass(pa, pte);
1833 + * Switch page tables.
1836 +init_mmu_swift(unsigned int ctp_phy)
1838 + unsigned int addr;
1843 + for (addr = 0; addr < 0x2000; addr += 0x10) {
1844 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
1845 + "r" (addr), "i" (ASI_M_DATAC_TAG));
1846 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
1847 + "r" (addr<<1), "i" (ASI_M_TXTC_TAG));
1851 + * Switch ctx table
1854 + /* printk("done flushing, switching to %x\n", ctp_phy); */
1855 + __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
1856 + "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
1859 + * Flush old page table references
1861 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
1862 + "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory");
1866 + * add_timer, del_timer
1867 + * This should go into sched.c, but we have it split for different archs.
1869 +struct timer_list_head {
1870 + struct timer_list *head, *tail;
1873 +static struct timer_list_head timers; /* Anonymous heap of timers */
1875 +void add_timer(struct timer_list *timer) {
1876 + struct timer_list *p;
1877 + if (timer->prev != NULL || timer->next != NULL) {
1878 + printk("bug: kernel timer added twice at 0x%x.\n",
1879 + __builtin_return_address(0));
1882 + if ((p = timers.tail) != NULL) {
1885 + timers.tail = timer;
1887 + timers.head = timer;
1888 + timers.tail = timer;
1893 +int del_timer(struct timer_list *timer) {
1894 + struct timer_list *p;
1897 + if (timers.head == timer) timers.head = timer->next;
1898 + if (timers.tail == timer) timers.tail = timer->prev;
1899 + if ((p = timer->prev) != NULL) p->next = timer->next;
1900 + if ((p = timer->next) != NULL) p->prev = timer->prev;
1901 + ret = timer->next != 0 || timer->prev != 0;
1902 + timer->next = NULL;
1903 + timer->prev = NULL;
1907 +void run_timers() {
1908 + struct timer_list *p;
1911 + while (p != NULL) {
1912 + if (p->expires < jiffies) {
1913 + del_timer(p); /* XXX make nonstatic member */
1914 + (*p->function)(p->data);
1923 + * Allocate memory. This is reusable.
1925 +void mem_init(struct mem *t, char *begin, char *limit)
1932 +void mem_fini(struct mem *t)
1937 +void *mem_alloc(struct mem *t, int size, int align)
1941 + p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));
1942 + if (p >= t->uplim || p + size > t->uplim) return 0;
1943 + t->curp = p + size;
1947 +void *mem_zalloc(struct mem *t, int size, int align)
1951 + if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);
1956 + * Library functions
1958 +void *memset(void *s, int c, size_t len)
1969 +void bcopy(const void *f, void *t, int len) {
1971 + *(char *)t = *(char *)f;
1977 +/* Comparison is 7-bit */
1978 +int bcmp(const void *s1, const void *s2, int len)
1985 + i = ch - *(char *)s2;
1996 +int strlen(const char *s) {
1998 + for (p = s; *p != 0; p++) { }
2002 +extern void *printk_fn;
2004 +void printk(char *fmt, ...)
2008 + void (*write)(void *, char *, int);
2010 + extern void prf(struct prf_fp *, char *fmt, va_list adx);
2013 + va_start(x1, fmt);
2015 + prfa.write = printk_fn;
2016 + prf(&prfa, fmt, x1);
2027 + * Get the highest bit number from the mask.
2029 +int highc(int mask, int size)
2034 + while (size != 0) {
2037 + if (m1 & mask) break;
2044 +unsigned int ld_bp_swap(unsigned int ptr) {
2046 + n = ld_bypass(ptr);
2047 + n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
2051 +void st_bp_swap(unsigned int ptr, unsigned int n) {
2052 + n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
2053 + st_bypass(ptr, n);
2055 diff -ruN proll_18.orig/src/arp.c proll-patch10/src/arp.c
2056 --- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000
2057 +++ proll-patch10/src/arp.c 2004-11-13 15:50:49.000000000 +0000
2060 static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */
2061 static int next_arp; /* next table entry */
2062 -static t_ipaddr def_gw = IP_ANY; /* default routing */
2063 +static t_ipaddr def_gw; /* default routing */
2069 * Resolve IP address and return pointer to hardware address.
2071 -unsigned char *ip_resolve(ip)
2072 +const unsigned char *ip_resolve(ip)
2076 @@ -230,14 +230,11 @@
2080 - /* Set name of module for error messages */
2081 - net_module_name = "arp";
2084 /* Register ARP packet type and set send buffer pointer */
2085 if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL)
2092 diff -ruN proll_18.orig/src/arp.h proll-patch10/src/arp.h
2093 --- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000
2094 +++ proll-patch10/src/arp.h 2004-11-13 15:50:49.000000000 +0000
2096 extern int init_arp __P((void));
2098 /* Resolve IP address and return pointer to hardware address */
2099 -extern unsigned char *ip_resolve __P((t_ipaddr ip));
2100 +extern const unsigned char *ip_resolve __P((t_ipaddr ip));
2102 /* Add a new antry to the ARP cache */
2103 extern void addcache __P((unsigned char *ha, t_ipaddr ip));
2104 diff -ruN proll_18.orig/src/esp.c proll-patch10/src/esp.c
2105 --- proll_18.orig/src/esp.c 1970-01-01 00:00:00.000000000 +0000
2106 +++ proll-patch10/src/esp.c 2005-04-16 06:24:23.000000000 +0000
2108 +#include <system.h> /* == <asm/system.h> */
2109 +#include <general.h> /* __P for netpriv.h */
2110 +#include <dma.h> /* dmaga */
2111 +#include <romlib.h>
2113 +#define PHYS_JJ_ESPDMA 0x78400000 /* ESP DMA controller */
2114 +#define PHYS_JJ_ESP 0x78800000 /* ESP SCSI */
2115 +#define PHYS_JJ_ESP_IRQ 4
2116 +#define BUFSIZE 4096
2121 + struct sparc_dma_registers *regs;
2122 + enum dvma_rev revision;
2126 + unsigned int regs[16];
2129 +struct esp_private {
2130 + int active; /* initialized */
2131 + int inst; /* iface number */
2133 + volatile struct esp_regs *ll;
2134 + __u32 buffer_dvma;
2135 + unsigned int irq; /* device IRQ number */
2138 + struct esp_dma *espdma; /* If set this points to espdma */
2140 + unsigned char *buffer;
2143 +static void esp_interrupt(void *dev_id)
2145 + struct esp_private *lp = (struct esp_private *)dev_id;
2147 + lp->interrupt = 1;
2148 + /* Acknowledge all the interrupt sources ASAP */
2150 + lp->interrupt = 0;
2153 +static int esp_open (void *dev)
2155 + struct esp_private *lp = (struct esp_private *)dev;
2158 + if (request_irq(lp->irq, &esp_interrupt, (void *)dev)) {
2159 + printk ("Esp: Can't get irq %d\n", lp->irq);
2163 + /* On the 4m, setup the espdma to provide the upper bits for buffers */
2165 + lp->espdma->regs->dma_test = ((__u32) lp->buffer_dvma) & 0xff000000;
2170 +static int esp_close (void *dev)
2172 + struct esp_private *lp = (struct esp_private *)dev;
2174 + free_irq (lp->irq, (void *) dev);
2179 +esp_init(struct esp_private *esp, struct esp_dma *espdma, int irq)
2181 + volatile struct esp_regs *ll;
2183 + /* Get the IO region */
2184 + ll = map_io(PHYS_JJ_ESP, sizeof (struct esp_regs));
2185 + if (ll == 0) return -1;
2187 + esp->buffer = dvma_alloc(BUFSIZE, &esp->buffer_dvma);
2189 + esp->espdma = espdma;
2193 + stb_bypass((int)ll + 3*2, 2);
2197 +static int espdma_init(struct esp_dma *espdma)
2201 + /* Hardcode everything for MrCoffee. */
2202 + if ((p = map_io(PHYS_JJ_ESPDMA, 0x10)) == 0) {
2203 + printk("espdma_init: cannot map registers\n");
2210 + switch((espdma->regs->cond_reg)&DMA_DEVICE_ID) {
2212 + espdma->revision=dvmarev0;
2213 + printk("Revision 0 ");
2216 + espdma->revision=dvmaesc1;
2217 + printk("ESC Revision 1 ");
2220 + espdma->revision=dvmarev1;
2221 + printk("Revision 1 ");
2224 + espdma->revision=dvmarev2;
2225 + printk("Revision 2 ");
2228 + espdma->revision=dvmahme;
2229 + printk("HME DVMA gate array ");
2231 + case DMA_VERSPLUS:
2232 + espdma->revision=dvmarevplus;
2233 + printk("Revision 1 PLUS ");
2236 + printk("unknown dma version %x",
2237 + (espdma->regs->cond_reg)&DMA_DEVICE_ID);
2238 + /* espdma->allocated = 1; */
2245 +static struct esp_dma espdma0;
2246 +static struct esp_private esp;
2248 + * Find all the esp cards on the system and initialize them
2252 + if (espdma_init(&espdma0) != 0) {
2256 + if (esp_init(&esp, &espdma0, PHYS_JJ_ESP_IRQ) != 0) {
2257 + printk("esp_probe: esp0 init failed\n");
2263 +void *esp_read(int unit, int offset, short len)
2265 + // Set SCSI target
2266 + stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);
2267 + // Set DMA address
2268 + st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);
2270 + stb_bypass(PHYS_JJ_ESP + 0*4, 10);
2271 + stb_bypass(PHYS_JJ_ESP + 1*4, 0);
2272 + // Set DMA direction
2273 + st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);
2274 + // Setup command = Read(10)
2275 + esp.buffer[0] = 0x80;
2276 + esp.buffer[1] = 0x28;
2277 + esp.buffer[2] = 0x00;
2278 + esp.buffer[3] = (offset >> 24) & 0xff;
2279 + esp.buffer[4] = (offset >> 16) & 0xff;
2280 + esp.buffer[5] = (offset >> 8) & 0xff;
2281 + esp.buffer[6] = offset & 0xff;
2282 + esp.buffer[7] = 0x00;
2283 + esp.buffer[8] = (len >> 8) & 0xff;
2284 + esp.buffer[9] = len & 0xff;
2285 + // Set ATN, issue command
2286 + stb_bypass(PHYS_JJ_ESP + 3*4, 0x42);
2288 + // Set DMA length = 512 * read length
2289 + stb_bypass(PHYS_JJ_ESP + 0*4, 0);
2290 + stb_bypass(PHYS_JJ_ESP + 1*4, (len << 1) & 0xff);
2291 + // Set DMA direction
2292 + st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);
2294 + stb_bypass(PHYS_JJ_ESP + 3*4, 0x10);
2295 + return esp.buffer;
2298 +// Sparc boot sequence can be found in SILO docs,
2299 +// first-isofs/README.SILO_ISOFS
2300 +int esp_boot(int unit)
2302 + struct sun_disklabel {
2303 + unsigned char info[128]; /* Informative text string */
2304 + unsigned char spare0[14];
2306 + unsigned char spare1;
2308 + unsigned char spare2;
2309 + unsigned char flags;
2311 + unsigned char spare[246]; /* Boot information etc. */
2312 + short rspeed; /* Disk rotational speed */
2313 + short pcylcount; /* Physical cylinder count */
2314 + short sparecyl; /* extra sects per cylinder */
2315 + unsigned char spare2[4]; /* More magic... */
2316 + short ilfact; /* Interleave factor */
2317 + short ncyl; /* Data cylinder count */
2318 + short nacyl; /* Alt. cylinder count */
2319 + short ntrks; /* Tracks per cylinder */
2320 + short nsect; /* Sectors per track */
2321 + unsigned char spare3[4]; /* Even more magic... */
2322 + struct sun_partition {
2323 + int start_cylinder;
2326 + short magic; /* Magic number */
2327 + short csum; /* Label xor'd checksum */
2329 + unsigned int i, offset;
2332 + printk("Loading partition table from target %d:\n", unit);
2334 + stb_bypass(PHYS_JJ_ESP + 3*4, 2);
2338 + label = esp_read(unit, 0, 1);
2339 + printk("CHS: %d/%d/%d, partitions:\n", label->ncyl, label->ntrks, label->nsect);
2340 + for (i = 0; i < 8; i++) {
2341 + printk("%c: %d + %d\n", 'a' + i, label->partitions[i].start_cylinder,
2342 + label->partitions[i].num_sectors);
2344 + offset = label->partitions[4].start_cylinder * label->ntrks * label->nsect + 1;
2345 + printk("booting sd(0,%d,0):d (offset %d)\n", unit, offset);
2346 + // Skip a.out header (0x20)
2347 + dst = (void *)0x4000;
2348 + src = esp_read(unit, offset, 1);
2349 + src = (void *)((unsigned int) src + 0x20);
2350 + memcpy(dst, src, 512 - 0x20);
2351 + dst = (void *)0x4000 + 512 - 0x20;
2352 + for (i = 1; i < 7680/512; i++) {
2353 + src = esp_read(unit, offset + i, 1);
2354 + memcpy(dst, src, 512);
2360 diff -ruN proll_18.orig/src/hconsole.c proll-patch10/src/hconsole.c
2361 --- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000
2362 +++ proll-patch10/src/hconsole.c 2005-03-02 17:03:09.000000000 +0000
2364 struct raster r_master; /* For a case of resize, whole fb */
2365 struct raster r_0; /* malloc() erzatz */
2368 +extern unsigned int q_height, q_width;
2371 int hcon_init(struct hconsole *t, unsigned int a0)
2373 struct raster *q, *r;
2375 * No probing sequence or argument passing, hardcode everything. XXX
2377 raster8_cons_a(q, 768, 1024, (char *)a0);
2379 raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80));
2381 + raster_cons_2(r, q, 0, 0, q_height, q_width);
2386 diff -ruN proll_18.orig/src/hme.c proll-patch10/src/hme.c
2387 --- proll_18.orig/src/hme.c 2002-07-23 05:52:52.000000000 +0000
2388 +++ proll-patch10/src/hme.c 2005-04-16 06:16:20.000000000 +0000
2389 @@ -655,10 +655,10 @@
2393 - __asm__ __volatile__("
2396 -" : /* no outputs */
2397 + __asm__ __volatile__(
2398 + "stwa %3, [%0] %2\n\t"
2399 + "stwa %4, [%1] %2\n\t"
2400 + : /* no outputs */
2401 : "r" (&rp->rx_addr), "r" (&rp->rx_flags),
2402 "i" (ASI_PL), "r" (addr), "r" (flags));
2404 @@ -667,10 +667,10 @@
2408 - __asm__ __volatile__("
2411 -" : /* no outputs */
2412 + __asm__ __volatile__(
2413 + "stwa %3, [%0] %2\n\t"
2414 + "stwa %4, [%1] %2\n\t"
2415 + : /* no outputs */
2416 : "r" (&tp->tx_addr), "r" (&tp->tx_flags),
2417 "i" (ASI_PL), "r" (addr), "r" (flags));
2419 @@ -2404,7 +2404,7 @@
2420 TXD(("[%d]", elem));
2421 this = &txbase[elem];
2423 - __asm__ __volatile__("lduwa [%1] %2, %0"
2424 + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
2426 : "r" (&this->tx_flags), "i" (ASI_PL));
2428 @@ -2447,7 +2447,7 @@
2430 this = &rxbase[elem];
2432 - __asm__ __volatile__("lduwa [%1] %2, %0"
2433 + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
2435 : "r" (&this->rx_flags), "i" (ASI_PL));
2437 @@ -2530,7 +2530,7 @@
2438 elem = NEXT_RX(elem);
2439 this = &rxbase[elem];
2441 - __asm__ __volatile__("lduwa [%1] %2, %0"
2442 + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
2444 : "r" (&this->rx_flags), "i" (ASI_PL));
2446 diff -ruN proll_18.orig/src/lat7_2.bm proll-patch10/src/lat7_2.bm
2447 --- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000
2448 +++ proll-patch10/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000
2450 #define lat7_2_width 128
2451 #define lat7_2_height 88
2452 -static unsigned char lat7_2_bits[] = {
2453 +static unsigned const char lat7_2_bits[] = {
2454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2455 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18,
2456 0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02,
2457 diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch10/src/lat7_2_swapped.bm
2458 --- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000
2459 +++ proll-patch10/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000
2461 +#define lat7_2_width 128
2462 +#define lat7_2_height 88
2463 +static unsigned const char lat7_2_bits[] = {
2464 + 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
2465 + 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48,
2466 + 0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40,
2467 + 0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40,
2468 + 0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
2469 + 0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00,
2470 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00,
2471 + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10,
2472 + 0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04,
2473 + 0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,
2474 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00,
2475 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
2476 + 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
2477 + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00,
2478 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
2479 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2480 + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2481 + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2482 + 0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18,
2483 + 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18,
2484 + 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,
2485 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00,
2486 + 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
2487 + 0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60,
2488 + 0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36,
2489 + 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e,
2490 + 0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78,
2491 + 0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2492 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42,
2493 + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2494 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
2495 + 0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
2496 + 0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00,
2497 + 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
2498 + 0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18,
2499 + 0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2500 + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18,
2501 + 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18,
2502 + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c,
2503 + 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,
2504 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2505 + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
2506 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
2507 + 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00,
2508 + 0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00,
2509 + 0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c,
2510 + 0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2511 + 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
2512 + 0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66,
2513 + 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66,
2514 + 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30,
2515 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c,
2516 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00,
2517 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00,
2518 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00,
2519 + 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
2520 + 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
2521 + 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2522 + 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e,
2523 + 0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66,
2524 + 0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66,
2525 + 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66,
2526 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c,
2527 + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00,
2528 + 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00,
2529 + 0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00,
2530 + 0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
2531 + 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e,
2532 + 0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c,
2533 + 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
2534 + 0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f,
2535 + 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e,
2536 + 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66,
2537 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60,
2538 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02,
2539 + 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00,
2540 + 0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00,
2541 + 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
2542 + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66,
2543 + 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,
2544 + 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c,
2545 + 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c,
2546 + 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30,
2547 + 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
2548 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02,
2549 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00,
2550 + 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2551 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
2552 + 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2553 + 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60,
2554 + 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2555 + 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
2556 + 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2557 + 0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78,
2558 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66,
2559 + 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66,
2560 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00,
2561 + 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38,
2562 + 0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00,
2563 + 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
2564 + 0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,
2565 + 0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2566 + 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
2567 + 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66,
2568 + 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60,
2569 + 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06,
2570 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c,
2571 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00,
2572 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00,
2573 + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00,
2574 + 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
2575 + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00,
2576 + 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18,
2577 + 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18,
2578 + 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c,
2579 + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00,
2580 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00,
2581 + 0x00, 0x00, 0x00, 0x00};
2582 diff -ruN proll_18.orig/src/le.c proll-patch10/src/le.c
2583 --- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000
2584 +++ proll-patch10/src/le.c 2005-04-16 06:16:20.000000000 +0000
2586 unsigned short rap; /* register address port */
2589 -int sparc_lance_debug = 2;
2591 /* The Lance uses 24 bit addresses */
2592 /* On the Sun4c the DVMA will provide the remaining bytes for us */
2593 /* On the Sun4m we have to instruct the ledma to provide them */
2595 /* Clear the slack of the packet, do I need this? */
2596 /* For a firewall its a good idea - AC */
2598 - bzero((char *) &ib->tx_buf [entry][skblen], len - skblen);
2599 + memset((char *) &ib->tx_buf [entry][skblen], 0, len - skblen);
2601 /* Now, give the packet to the lance */
2602 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);
2603 diff -ruN proll_18.orig/src/netinit.c proll-patch10/src/netinit.c
2604 --- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000
2605 +++ proll-patch10/src/netinit.c 2004-11-13 15:50:49.000000000 +0000
2607 unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */
2608 t_ipaddr myipaddr; /* my own IP address */
2609 t_ipaddr mynetmask; /* my own netmask */
2610 - char *net_module_name; /* name of init module */
2611 t_ipaddr servaddr; /* IP of RARP&TFTP server */
2613 /* Broadcast hardware address */
2614 -unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
2615 +const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
2620 +/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
2623 + seed = (seed + 23968)*0x015A4E35 >> 1;
2624 + return seed & 0x7FFF;
2628 **************************************************************************
2629 @@ -104,10 +111,17 @@
2633 + /* Avoid data segment allocations */
2636 /* Initialize the different network layer modules */
2638 - if (!init_arp() || !init_udp()) {
2639 - printf("\nERROR: init_%s\n", net_module_name);
2640 + if (!init_arp()) {
2641 + printf("\nERROR: init_arp\n");
2644 + if (!init_udp()) {
2645 + printf("\nERROR: init_udp\n");
2649 diff -ruN proll_18.orig/src/netpriv.h proll-patch10/src/netpriv.h
2650 --- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000
2651 +++ proll-patch10/src/netpriv.h 2004-11-13 15:50:49.000000000 +0000
2652 @@ -130,10 +130,9 @@
2655 extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address */
2656 -extern unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
2657 +extern const unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
2658 extern t_ipaddr myipaddr; /* my own IP address */
2659 extern t_ipaddr mynetmask; /* netmask for my network */
2660 -extern char *net_module_name; /* initialized module's name */
2661 extern t_ipaddr servaddr; /* server IP address */
2665 extern unsigned char *reg_type __P((int typeval, int (* receive)()));
2667 /* Write a packet to the network */
2668 -extern int write_packet __P((int bufsize, int typeval, unsigned char *addr));
2669 +extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr));
2671 /* Empty read buffer */
2672 extern void empty_buf __P((void));
2673 diff -ruN proll_18.orig/src/openprom.h proll-patch10/src/openprom.h
2674 --- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000
2675 +++ proll-patch10/src/openprom.h 2004-11-13 15:50:49.000000000 +0000
2679 struct linux_mem_v0 {
2680 - struct linux_mlist_v0 **v0_totphys;
2681 - struct linux_mlist_v0 **v0_prommap;
2682 - struct linux_mlist_v0 **v0_available; /* What we can use */
2683 + struct linux_mlist_v0 * const *v0_totphys;
2684 + struct linux_mlist_v0 * const *v0_prommap;
2685 + struct linux_mlist_v0 * const *v0_available; /* What we can use */
2688 /* Arguments sent to the kernel from the boot prompt. */
2689 struct linux_arguments_v0 {
2691 + const char *argv[8];
2697 - char *kernel_file_name;
2698 + const char *kernel_file_name;
2699 void *aieee1; /* XXX */
2703 struct linux_mem_v0 pv_v0mem;
2705 /* Node operations. */
2706 - struct linux_nodeops *pv_nodeops;
2707 + const struct linux_nodeops *pv_nodeops;
2710 struct linux_dev_v0_funcs pv_v0devops;
2714 + const char *pv_stdin;
2715 + const char *pv_stdout;
2716 #define PROMDEV_KBD 0 /* input from keyboard */
2717 #define PROMDEV_SCREEN 0 /* output to screen */
2718 #define PROMDEV_TTYA 1 /* in/out to ttya */
2720 void (*v2_eval)(char *str);
2723 - struct linux_arguments_v0 **pv_v0bootargs;
2724 + const struct linux_arguments_v0 * const *pv_v0bootargs;
2726 /* Get ether address. */
2727 unsigned int (*pv_enaddr)(int d, char *enaddr);
2729 int (*no_proplen)(int node, char *name);
2730 int (*no_getprop)(int node, char *name, char *val);
2731 int (*no_setprop)(int node, char *name, char *val, int len);
2732 - char * (*no_nextprop)(int node, char *name);
2733 + const char * (*no_nextprop)(int node, char *name);
2736 /* More fun PROM structures for device probing. */
2737 diff -ruN proll_18.orig/src/packet.c proll-patch10/src/packet.c
2738 --- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000
2739 +++ proll-patch10/src/packet.c 2004-11-13 15:50:49.000000000 +0000
2743 static struct sk_buff *rskb;
2744 -static int nqskb = 0;
2750 for (i = 0; i < MAXSKBS; i++) {
2751 skev[i].skb.allocn = i;
2757 unsigned char *reg_type(int ptype, int (*func)())
2762 -int write_packet(int leng, int type, unsigned char *dst)
2763 +int write_packet(int leng, int type, const unsigned char *dst)
2765 struct sk_buff *skb;
2767 diff -ruN proll_18.orig/src/printf.c proll-patch10/src/printf.c
2768 --- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000
2769 +++ proll-patch10/src/printf.c 2004-11-13 15:50:49.000000000 +0000
2771 static void printn(struct prf_fp *, unsigned long, unsigned int);
2772 static void putchar(char, struct prf_fp *);
2774 -static char hextab[] = "0123456789ABCDEF";
2775 +static const char hextab[] = "0123456789ABCDEF";
2778 * Scaled down version of C Library printf.
2781 prf(struct prf_fp *filog, char *fmt, va_list adx)
2789 putchar(va_arg(adx,unsigned), filog);
2790 } else if(c == 's') {
2791 s = va_arg(adx,char*);
2795 } else if (c == 'l' || c == 'O') {
2796 printn(filog, (long)va_arg(adx,long), c=='l'?10:8);
2797 diff -ruN proll_18.orig/src/rconsole.c proll-patch10/src/rconsole.c
2798 --- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000
2799 +++ proll-patch10/src/rconsole.c 2005-04-16 06:16:20.000000000 +0000
2801 * move to California. Only plain lat7 survived.
2802 * I recreated lat7-1 changes in lat7-2. --zaitcev
2805 #include "lat7_2.bm" /* lat7_1.bm */
2807 +#include "lat7_2_swapped.bm" /* lat7_1.bm */
2809 #define LAT7_NCHARS 128
2810 #define LAT7_HEIGHT 11
2811 #define LAT7_WIDTH 8
2814 static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ];
2822 static __inline__ void stfb_w(void *ptr, unsigned int data) {
2823 - __asm__ __volatile__ ("sta %0, [%1] %2" : :
2824 + __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
2825 "r" (data), "r" (ptr), "i" (ASI_M_BYPASS));
2828 static __inline__ void stfb_b(void *ptr, unsigned int data) {
2829 - __asm__ __volatile__ ("stba %0, [%1] %2" : :
2830 + __asm__ __volatile__ ("stba %0, [%1] %2\n\t" : :
2831 "r" (data), "r" (ptr), "i" (ASI_M_BYPASS));
2834 static __inline__ unsigned int ldfb_w(void *ptr) {
2836 - __asm__ __volatile__ ("lda [%1] %2, %0" :
2837 + __asm__ __volatile__ ("lda [%1] %2, %0\n\t" :
2839 "r" (ptr), "i" (ASI_M_BYPASS));
2843 static __inline__ unsigned int ldfb_b(void *ptr) {
2845 - __asm__ __volatile__ ("lduba [%1] %2, %0" :
2846 + __asm__ __volatile__ ("lduba [%1] %2, %0\n\t" :
2848 "r" (ptr), "i" (ASI_M_BYPASS));
2855 static inline int swapbits(int w0)
2858 @@ -105,13 +112,16 @@
2864 void font_cons_7(struct rfont *p)
2872 for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) {
2873 lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] =
2874 swapbits(lat7_2_bits[x]) & 0xFF;
2878 p->body_ = lat7_body;
2880 + p->body_ = lat7_2_bits;
2882 p->nchars_ = LAT7_NCHARS;
2883 p->width_ = LAT7_WIDTH;
2884 p->height_ = LAT7_HEIGHT;
2885 diff -ruN proll_18.orig/src/rconsole.h proll-patch10/src/rconsole.h
2886 --- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000
2887 +++ proll-patch10/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000
2891 #define RF_MAXWIDTH 16
2892 -typedef unsigned short Rf_scan; /* __w16 to be used */
2893 +typedef unsigned char Rf_scan; /* __w16 to be used */
2897 + const Rf_scan *body_;
2898 int nchars_; /* 128 for ASCII ... 65536 for Unicode */
2899 int width_; /* [Pixels]. Maximum size is 16. */
2900 int height_; /* [Pixels == scan lines]. */
2901 diff -ruN proll_18.orig/src/romlib.h proll-patch10/src/romlib.h
2902 --- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000
2903 +++ proll-patch10/src/romlib.h 2005-04-16 20:32:49.000000000 +0000
2906 #define memcpy(dst, src, len) bcopy(src, dst, len)
2907 #define memcmp(x1, x2, len) bcmp(x1, x2, len)
2908 -#define memset(p, len, zero) bzero(p, len)
2909 -extern void bcopy(void *b1, void *b2, int length);
2910 -extern int bcmp(void *b1, void *b2, int length);
2911 -extern void bzero(void *b, int c);
2912 +extern void bcopy(const void *b1, void *b2, int length);
2913 +extern int bcmp(const void *b1, const void *b2, int length);
2914 +typedef unsigned int size_t;
2915 +extern void *memset(void *p, int c, size_t len);
2916 /* gcc complains about "conflicting types for builtin function strlen". */
2917 #define strlen(s) ssize(s)
2918 -extern int ssize(char *s);
2919 +extern int ssize(const char *s);
2923 diff -ruN proll_18.orig/src/sched_4m.c proll-patch10/src/sched_4m.c
2924 --- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000
2925 +++ proll-patch10/src/sched_4m.c 2004-11-13 15:50:49.000000000 +0000
2927 static int set_bolt; /* Tick counter limit */
2928 static struct handsc hndv[16];
2930 -static unsigned int intr_to_mask[16] = {
2931 +static unsigned const int intr_to_mask[16] = {
2932 0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0,
2933 0, 0, 0, 0, 0, 0, 0, 0,
2935 diff -ruN proll_18.orig/src/swap.c proll-patch10/src/swap.c
2936 --- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000
2937 +++ proll-patch10/src/swap.c 2004-11-13 15:50:49.000000000 +0000
2939 +// Convert the lat7 font so that no conversion is needed at runtime.
2941 +#include "rconsole.c"
2953 + for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) {
2954 + printf("0x%02x, ", p.body_[i]);
2955 + if ((i % 12) == 11)
2960 diff -ruN proll_18.orig/src/system.c proll-patch10/src/system.c
2961 --- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000
2962 +++ proll-patch10/src/system.c 2005-04-16 06:16:20.000000000 +0000
2966 /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
2968 - for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) {
2970 + for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
2971 map_page(l1, va, pa, 0, highbase);
2974 @@ -507,30 +507,44 @@
2978 - if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size);
2979 + if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);
2986 -void bzero(void *s, int len) {
2987 - while (len--) *((char *)s)++ = 0;
2988 +void *memset(void *s, int c, size_t len)
2999 -void bcopy(void *f, void *t, int len) {
3000 - while (len--) *((char *)t)++ = *((char *)f)++;
3001 +void bcopy(const void *f, void *t, int len) {
3003 + *(char *)t = *(char *)f;
3009 /* Comparison is 7-bit */
3010 -int bcmp(void *s1, void *s2, int len)
3011 +int bcmp(const void *s1, const void *s2, int len)
3017 - ch = *((char *)s1)++;
3018 - if ((i = ch - *((char *)s2)++) != 0)
3020 + i = ch - *(char *)s2;
3031 -int strlen(char *s) {
3033 +int strlen(const char *s) {
3035 for (p = s; *p != 0; p++) { }
3038 @@ -560,14 +574,6 @@
3042 -/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
3045 - static unsigned int seed = 151;
3046 - seed = (seed + 23968)*0x015A4E35 >> 1;
3047 - return seed & 0x7FFF;
3053 diff -ruN proll_18.orig/src/system.h proll-patch10/src/system.h
3054 --- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000
3055 +++ proll-patch10/src/system.h 2005-04-16 06:16:20.000000000 +0000
3057 #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */
3058 #define NCTX_SWIFT 0x100
3060 -#define MAX_BANKS 3 /* Allocation for all machines */
3061 +#define MAX_BANKS 8 /* Allocation for all machines */
3063 #ifndef __ASSEMBLY__
3065 @@ -164,10 +164,10 @@
3067 extern __inline__ void setipl(unsigned long __orig_psr)
3069 - __asm__ __volatile__("
3072 -" : /* no outputs */
3073 + __asm__ __volatile__(
3074 + "wr %0, 0x0, %%psr\n\t"
3075 + "nop; nop; nop\n\t"
3076 + : /* no outputs */
3080 @@ -176,13 +176,13 @@
3084 - __asm__ __volatile__("
3086 - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
3091 + __asm__ __volatile__(
3092 + "rd %%psr, %0\n\t"
3093 + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
3094 + "or %0, %1, %0\n\t"
3095 + "wr %0, 0x0, %%psr\n\t"
3096 + "nop; nop; nop\n\t"
3101 @@ -191,13 +191,13 @@
3105 - __asm__ __volatile__("
3107 - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
3112 + __asm__ __volatile__(
3113 + "rd %%psr, %0\n\t"
3114 + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
3115 + "andn %0, %1, %0\n\t"
3116 + "wr %0, 0x0, %%psr\n\t"
3117 + "nop; nop; nop\n\t"
3122 @@ -214,18 +214,18 @@
3124 unsigned long retval;
3126 - __asm__ __volatile__("
3128 - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
3131 - xorcc %%g1, %%g2, %%g0
3138 + __asm__ __volatile__(
3139 + "rd %%psr, %0\n\t"
3140 + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
3141 + "and %0, %2, %%g1\n\t"
3142 + "and %1, %2, %%g2\n\t"
3143 + "xorcc %%g1, %%g2, %%g0\n\t"
3146 + "wr %0, %2, %%psr\n\t"
3147 + "nop; nop; nop;\n\t"
3150 : "r" (__new_psr), "i" (PSR_PIL)
3151 : "g1", "g2", "memory", "cc");
3153 @@ -236,13 +236,13 @@
3155 unsigned long retval;
3157 - __asm__ __volatile__("
3159 - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
3161 - wr %%g1, 0x0, %%psr
3164 + __asm__ __volatile__(
3165 + "rd %%psr, %0\n\t"
3166 + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
3167 + "or %0, %1, %%g1\n\t"
3168 + "wr %%g1, 0x0, %%psr\n\t"
3169 + "nop; nop; nop\n\t"
3174 diff -ruN proll_18.orig/src/udp.c proll-patch10/src/udp.c
3175 --- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000
3176 +++ proll-patch10/src/udp.c 2004-11-13 15:50:49.000000000 +0000
3181 - register unsigned char *addr;
3182 + const register unsigned char *addr;
3184 /* Set global variables */
3190 - /* Set module name for error handling */
3191 - net_module_name = "udp";
3193 /* Register IP packet type and set write buffer pointer */
3194 if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL)
3196 diff -ruN proll_18.orig/src/vcons_zs.c proll-patch10/src/vcons_zs.c
3197 --- proll_18.orig/src/vcons_zs.c 1970-01-01 00:00:00.000000000 +0000
3198 +++ proll-patch10/src/vcons_zs.c 2005-04-10 07:01:03.000000000 +0000
3201 + ** Console over 'zs' (Zilog serial port)
3202 + ** Copyright 1999 Pete Zaitcev
3203 + ** This code is licensed under GNU General Public License.
3206 +#include "vconsole.h"
3207 +#include <system.h>
3209 +#define ZS_DATA 0x02
3211 +int vcon_zs_init(struct vconterm *t, unsigned int a0)
3214 + t->impl = (void *) a0;
3216 + t->vc_x = 0; t->vc_y = 0;
3217 + t->backp = 0; t->backc = 0;
3219 + stb_bypass(a0, 3); // reg 3
3220 + stb_bypass(a0, 1); // enable rx
3222 + stb_bypass(a0, 5); // reg 5
3223 + stb_bypass(a0, 8); // enable tx
3228 +int vcon_zs_putch(struct vconterm *t, char c)
3230 + unsigned zs_ptr = (unsigned) t->impl;
3232 + //while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { }
3233 + stb_bypass(zs_ptr + ZS_DATA, c);
3237 +int vcon_zs_write(struct vconterm *t, char *data, int leng)
3239 + while (leng != 0) {
3241 + vcon_zs_putch(t, *data++);
3246 +int vcon_zs_read(struct vconterm *t, char *data, int leng)
3248 + unsigned zs_ptr = (unsigned) t->impl;
3250 + while ((ldb_bypass(zs_ptr) & 1) != 1) { }
3251 + *data = ldb_bypass(zs_ptr + ZS_DATA);
3255 +int vcon_zs_getch(struct vconterm *t)
3257 + unsigned zs_ptr = (unsigned) t->impl;
3259 + while ((ldb_bypass(zs_ptr) & 1) != 1) { }
3260 + return ldb_bypass(zs_ptr + ZS_DATA) & 0xff;
3263 +void vcon_zs_fini(struct vconterm *t)
3265 + /* violent crash in the end */
3268 diff -ruN proll_18.orig/src/vconsole.c proll-patch10/src/vconsole.c
3269 --- proll_18.orig/src/vconsole.c 1999-11-08 03:10:28.000000000 +0000
3270 +++ proll-patch10/src/vconsole.c 2005-04-17 19:23:21.000000000 +0000
3272 #include "vconsole.h"
3274 #include "hconsole.h"
3275 +#include <system.h>
3277 static void vcon_i_cursfeed(struct vconterm *t);
3278 static void vcon_i_backflush(struct vconterm *t);
3280 struct hconsole hcons0;
3282 +enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
3283 + EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
3286 int vcon_init(struct vconterm *t, unsigned int a0)
3288 struct hconsole *hconp;
3291 t->vc_x = 0; t->vc_y = 0;
3292 t->backp = 0; t->backc = 0;
3293 + t->vc_state = ESnormal;
3295 hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_);
3300 + * gotoxy() must verify all boundaries, because the arguments
3301 + * might also be negative. If the given position is out of
3302 + * bounds, the cursor is placed at the nearest margin.
3304 +static void gotoxy(struct vconterm *vc, int new_x, int new_y)
3307 + struct hconsole *hconp = vc->impl;
3309 + max_x = hcon_qxdim(hconp);
3310 + max_y = hcon_qydim(hconp);
3315 + if (new_x >= max_x)
3316 + vc->vc_x = max_x - 1;
3323 + else if (new_y >= max_y)
3324 + vc->vc_y = max_y - 1;
3330 +/* for absolute user moves, when decom is set */
3331 +static void gotoxay(struct vconterm *t, int new_x, int new_y)
3333 + gotoxy(t, new_x, new_y);
3336 int vcon_write(struct vconterm *t, char *data, int leng)
3344 - case 0x07: /* Bell */
3345 - vcon_i_backflush(t);
3347 - case 0x0A: /* Linefeed */
3348 - vcon_i_backflush(t);
3349 - vcon_i_cursfeed(t);
3350 + switch(t->vc_state) {
3352 + t->vc_state = ESnormal;
3355 + t->vc_state = ESsquare;
3358 + hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
3361 + printk("Unhandled escape code '%c'\n", c);
3365 - case 0x0D: /* Return */
3366 - vcon_i_backflush(t);
3369 + for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++)
3370 + t->vc_par[t->vc_npar] = 0;
3372 + t->vc_state = ESgetpars;
3374 + if (c==';' && t->vc_npar<NPAR-1) {
3377 + } else if (c>='0' && c<='9') {
3378 + t->vc_par[t->vc_npar] *= 10;
3379 + t->vc_par[t->vc_npar] += c-'0';
3381 + } else t->vc_state=ESgotpars;
3383 + t->vc_state = ESnormal;
3385 + case 'H': case 'f':
3386 + if (t->vc_par[0]) t->vc_par[0]--;
3387 + if (t->vc_par[1]) t->vc_par[1]--;
3388 + gotoxay(t, t->vc_par[1], t->vc_par[0]);
3391 + if (t->vc_par[0] == 0) {
3392 + //erase from cursor to end of display
3393 + hcon_clear(hconp, t->vc_y, t->vc_x, hconp->ydim_, hconp->xdim_);
3397 + hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
3402 + printk("Unhandled escape code '%c', par[%d, %d, %d, %d, %d]\n",
3403 + c, t->vc_par[0], t->vc_par[1], t->vc_par[2], t->vc_par[3], t->vc_par[4]);
3408 - if (t->backp == 0) {
3410 - t->backp = data-1;
3414 - if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
3415 + t->vc_state = ESnormal;
3417 + case 0x07: /* Bell */
3418 + vcon_i_backflush(t);
3420 + case 0x08: /* BS */
3421 + vcon_i_backflush(t);
3425 + case 0x0A: /* Linefeed */
3426 vcon_i_backflush(t);
3430 + case 0x0D: /* Return */
3431 + vcon_i_backflush(t);
3435 + vcon_i_backflush(t);
3436 + t->vc_state = ESnormal;
3439 + vcon_i_backflush(t);
3440 + t->vc_state = ESesc;
3443 + if (t->backp == 0) {
3445 + t->backp = data-1;
3449 + if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
3450 + vcon_i_backflush(t);
3452 + vcon_i_cursfeed(t);
3457 @@ -100,9 +213,62 @@
3461 +static const unsigned char sunkbd_keycode[128] = {
3462 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3463 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3464 + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 8,
3465 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
3466 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
3467 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3468 + 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '\\', 13,
3469 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3470 + 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
3471 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3475 +static const unsigned char sunkbd_keycode_shifted[128] = {
3476 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3477 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3478 + '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 8,
3479 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
3480 + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
3481 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3482 + 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '|', 13,
3483 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3484 + 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
3485 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3489 +static int shiftstate;
3491 int vcon_getch(struct vconterm *t)
3496 + while ((ldb_bypass(0x71000004) & 1) != 1) { }
3498 + ch = ldb_bypass(0x71000006) & 0xff;
3501 + else if (ch == 110)
3503 + else if (ch == 227)
3505 + else if (ch == 238)
3507 + //printk("getch: %d\n", ch);
3509 + while ((ch & 0x80) == 0 || ch == 238 || ch == 227); // Wait for key release
3510 + //printk("getch rel: %d\n", ch);
3513 + ch = sunkbd_keycode_shifted[ch];
3515 + ch = sunkbd_keycode[ch];
3516 + //printk("getch xlate: %d\n", ch);
3520 void vcon_fini(struct vconterm *t)
3521 diff -ruN proll_18.orig/src/vconsole.h proll-patch10/src/vconsole.h
3522 --- proll_18.orig/src/vconsole.h 1999-11-08 00:58:13.000000000 +0000
3523 +++ proll-patch10/src/vconsole.h 2005-03-02 12:40:12.000000000 +0000
3534 int backc; /* Same, count */
3536 int vc_x, vc_y; /* XXX Make vcon_xxx() to use cellmap->xpos_ */
3538 + unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
3541 int vcon_init(struct vconterm *t, unsigned int a0);