1 diff -ruN proll_18.orig/Makefile proll-patch-15/Makefile
2 --- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000
3 +++ proll-patch-15/Makefile 2005-11-09 18:14:51.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-patch-15/qemu/Makefile
18 --- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000
19 +++ proll-patch-15/qemu/Makefile 2005-08-14 10:25:06.000000000 +0000
23 +# qemu/Makefile - make PROLL for QEMU
24 +# $Id: proll.patch,v 1.6 2005-11-11 00:24:57 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 -W -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -Wa,-xarch=v8 -g -DQEMU -m32 -fno-builtin
59 +ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g -Wa,-xarch=v8 -Wa,-32
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-patch-15/qemu/head.S
145 --- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000
146 +++ proll-patch-15/qemu/head.S 2005-07-12 22:24:17.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.6 2005-11-11 00:24:57 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
446 + .register %g2, #scratch
447 + .register %g3, #scratch
448 + .register %g6, #scratch
449 + .register %g7, #scratch
452 + ! %g1 contains end of memory
453 + set PHYS_JJ_EEPROM + 0x30, %g1
454 + lda [%g1] ASI_M_BYPASS, %g1
455 + ! map PROLDATA to PROLBASE+PROLSIZE to end of ram
456 + set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables
457 + sub %g1, %g2, %g2 ! start of private memory
458 + srl %g2, 0x4, %g7 ! ctx table at s+0x0
459 + add %g2, 0x400, %g3 ! l1 table at s+0x400
462 + sta %g3, [%g2] ASI_M_BYPASS
463 + add %g2, 0x400, %g2 ! s+0x400
464 + add %g2, 0x800, %g3 ! l2 table for ram (00xxxxxx) at s+0x800
467 + sta %g3, [%g2] ASI_M_BYPASS
468 + add %g2, 0x500, %g3 ! l2 table for rom (ffxxxxxx) at s+0x900
469 + add %g2, 0x3fc, %g2 ! s+0x7fc
472 + sta %g3, [%g2] ASI_M_BYPASS
473 + add %g2, 0x4, %g2 ! s+0x800
474 + set ((7 << 2) | 2), %g3 ! 7 = U: --- S: RWX (main memory)
475 + sta %g3, [%g2] ASI_M_BYPASS
476 + add %g2, 0x200, %g3 ! l3 table for rom at s+0xa00
477 + add %g2, 0x1d0, %g2 ! s+0x9d0
480 + sta %g3, [%g2] ASI_M_BYPASS
481 + add %g2, 0x30, %g2 ! s+0xa00
485 + set (PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages
486 +1: srl %g3, 0x4, %g4
487 + or %g4, ((7 << 2) | 2), %g4 ! 4 = U: --X S: --X (rom, execute only)
488 + sta %g4, [%g2] ASI_M_BYPASS
495 + set (PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages
496 +1: srl %g3, 0x4, %g4
497 + or %g4, ((0 << 2) | 2), %g4 ! 0 = U: R-- S: R-- (rom, read only)
498 + sta %g4, [%g2] ASI_M_BYPASS
505 + set (PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages
509 +1: srl %g3, 0x4, %g4
510 + or %g4, ((7 << 2) | 2), %g4 ! 5 = U: R-- S: RW- (data area, read/write)
511 + sta %g4, [%g2] ASI_M_BYPASS
521 + sta %g7, [%g2] ASI_M_MMUREGS ! set ctx table ptr
523 + sta %g1, [%g0] ASI_M_MMUREGS ! enable mmu
526 + * The code which enables traps is a simplified version of
529 + * We know number of windows as 8 so we do not calculate them.
530 + * The deadwood is here for any case.
533 + /* Turn on Supervisor, EnableFloating, and all the PIL bits.
534 + * Also puts us in register window zero with traps off.
536 + set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
540 + /* I want a kernel stack NOW! */
541 + set C_LABEL(bootup_user_stack), %g1
542 + set (0x2000 - REGWIN_SZ), %g2
544 + mov 0, %fp /* And for good luck */
546 + /* Zero out our BSS section. */
547 + set C_LABEL(bss_start) , %o0 ! First address of BSS
548 + set C_LABEL(end) , %o1 ! Last address of BSS
554 + subcc %o0, %o1, %g0
559 + wr %g1, 0x0, %wim ! make window 1 invalid
568 + and %g3, PSR_CWP, %g3
575 + sethi %hi( C_LABEL(cputyp) ), %o0
576 + st %g7, [%o0 + %lo( C_LABEL(cputyp) )]
578 + sethi %hi( C_LABEL(nwindows) ), %g4
579 + st %g3, [%g4 + %lo( C_LABEL(nwindows) )]
582 + sethi %hi( C_LABEL(nwindowsm1) ), %g4
583 + st %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
586 + /* Here we go, start using Linux's trap table... */
587 + set C_LABEL(trapbase), %g3
591 + /* Finally, turn on traps so that we can call c-code. */
596 + wr %g3, PSR_ET, %psr
600 + call C_LABEL(prolmain)
608 + * Memory access trap handler
609 + * %l0 program %psr from trap table entry
610 + * %l1 program %pc from hardware
611 + * %l2 program %npc from hardware
612 + * %l3 program %wim from trap table entry
616 + * %l7 text flag from trap table entry
621 +C_LABEL(srmmu_fault):
625 + lda [%l6] ASI_M_MMUREGS, %l6
626 + lda [%l5] ASI_M_MMUREGS, %l5
628 + set ignore_fault, %l5
630 + subcc %l5, %g0, %g0 /* NULL pointer trap faults always */
633 + subcc %l5, %l6, %g0
638 + set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
639 + set 0x00ffffff, %g4
640 + sta %g4, [%g5] ASI_M_BYPASS
641 + add %g5, 8, %g5 /* On right side */
642 + sta %g4, [%g5] ASI_M_BYPASS
646 + set C_LABEL(fault_ignored), %l5
651 + * Skip the faulting instruction.
652 + * I think it works when next instruction is a branch even.
663 + * Slow external versions of st_bypass and ld_bypass.
664 + * rconsole.c uses inlines. We call these in places which are not speed
665 + * critical, to avoid compiler bugs.
667 + .globl C_LABEL(st_bypass)
670 + sta %o1, [%o0] ASI_M_BYPASS
671 + .globl C_LABEL(ld_bypass)
674 + lda [%o0] ASI_M_BYPASS, %o0
675 + .globl C_LABEL(sth_bypass)
676 +C_LABEL(sth_bypass):
678 + stha %o1, [%o0] ASI_M_BYPASS
679 + .globl C_LABEL(ldh_bypass)
680 +C_LABEL(ldh_bypass):
682 + lduha [%o0] ASI_M_BYPASS, %o0
683 + .globl C_LABEL(stb_bypass)
684 +C_LABEL(stb_bypass):
686 + stba %o1, [%o0] ASI_M_BYPASS
687 + .globl C_LABEL(ldb_bypass)
688 +C_LABEL(ldb_bypass):
690 + lduba [%o0] ASI_M_BYPASS, %o0
691 diff -ruN proll_18.orig/qemu/main.c proll-patch-15/qemu/main.c
692 --- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000
693 +++ proll-patch-15/qemu/main.c 2005-08-14 10:07:48.000000000 +0000
696 + ** Proll (PROM replacement)
697 + ** Copyright 1999 Pete Zaitcev
698 + ** This code is licensed under GNU General Public License.
702 +// #include <asm/contregs.h>
704 +#include "pgtsrmmu.h"
705 +#include "iommu.h" /* Typical SBus IOMMU for sun4m */
706 +#include "phys_jj.h"
707 +#include "vconsole.h"
708 +#include "version.h"
709 +#include <general.h> /* __P() */
710 +#include <net.h> /* init_net() */
711 +#include <romlib.h> /* we are a provider for part of this. */
712 +#include <netpriv.h> /* myipaddr */
714 +#include <system.h> /* our own prototypes */
716 +void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic);
717 +int vcon_zs_init(struct vconterm *t, unsigned int a0);
718 +int vcon_zs_write(struct vconterm *t, char *data, int leng);
719 +int vcon_zs_getch(struct vconterm *t);
721 +int esp_boot(int unit);
722 +static void init_idprom(void);
724 +struct vconterm dp0;
725 +struct mem cmem; /* Current memory, virtual */
726 +struct mem cio; /* Current I/O space */
727 +struct phym pmem; /* Current phys. mem. */
728 +struct iommu ciommu; /* Our IOMMU on sun4m */
732 + unsigned int version;
733 + char pad1[0x1c]; // Pad to 0x30
734 + unsigned int ram_size;
736 + unsigned int load_addr, kernel_size;
737 + unsigned int cmdline, cmdline_len;
738 + char pad2[0x0c]; // Pad to 0x54
739 + unsigned short width, height, depth;
742 +int ignore_fault, fault_ignored;
743 +void *printk_fn, *getch_fn;
744 +unsigned int q_height, q_width;
750 + static char fname[14];
751 + static struct banks bb;
752 + unsigned int hiphybas;
753 + const void *romvec;
754 + unsigned int ram_size;
755 + char nographic, bootdev;
757 + nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F);
759 + q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54);
760 + q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56);
761 + vcon_init(&dp0, PHYS_JJ_TCX_FB);
762 + printk_fn = vcon_write;
763 + getch_fn = vcon_getch;
766 + vcon_zs_init(&dp0, 0x71100004);
767 + printk_fn = vcon_zs_write;
768 + getch_fn = vcon_zs_getch;
772 + printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);
773 + ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);
774 + printk("%d MB total\n", ram_size/(1024*1024));
777 + bb.bankv[0].start = 0;
778 + bb.bankv[0].length = ram_size;
780 + hiphybas = ram_size - PROLSIZE;
782 + mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));
783 + makepages(&pmem, hiphybas);
784 + init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);
786 + mem_init(&cio, (char *)(PROLBASE+PROLSIZE),
787 + (char *)(PROLBASE+PROLSIZE+IOMAPSIZE));
789 + iommu_init(&ciommu, hiphybas);
794 + printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version);
796 + printk("Prom console: TCX %dx%d\n", q_width, q_height);
798 + printk("Prom console: serial\n");
804 + bootdev = hw_idprom->boot_device;
805 + printk("Boot device: %c\n", bootdev);
806 + if (hw_idprom->kernel_size > 0) {
807 + printk("Kernel already loaded\n");
808 + } else if (bootdev == 'n') {
809 + if (bootp() != 0) fatal();
811 + * boot_rec.bp_file cannot be used because system PROM
812 + * uses it to locate ourselves. If we load from boot_rec.bp_file,
813 + * we will loop reloading PROLL over and over again.
814 + * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L).
816 + xtoa(myipaddr, fname, 8);
824 + if (load(boot_rec.bp_siaddr, fname) != 0) fatal();
825 + } else if (bootdev == 'c') {
826 + if (esp_boot(0) != 0) fatal();
827 + } else if (bootdev == 'd') {
828 + if (esp_boot(2) != 0) fatal();
831 + romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas,
832 + (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic);
834 + printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",
835 + PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,
836 + (int)cio.start, (int)cio.curp);
839 + void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr;
840 + printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n",
841 + *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline);
842 + entry(romvec, 0, 0, 0, 0);
850 + * dvma_alloc over iommu_alloc.
852 +void *dvma_alloc(int size, unsigned int *pphys)
854 + return iommu_alloc(&ciommu, size, pphys);
859 +void udelay(__attribute__((unused)) unsigned long usecs)
861 + // Qemu hardware is perfect and does not need any delays!
864 +static void init_idprom()
868 + if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {
869 + printk("init_idprom: cannot map eeprom\n");
872 + bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE);
874 + * hw_idprom is not used anywhere.
875 + * It's just as we hate to leave hanging pointers (I/O page here).
877 + hw_idprom = va_prom;
880 diff -ruN proll_18.orig/qemu/openprom.c proll-patch-15/qemu/openprom.c
881 --- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000
882 +++ proll-patch-15/qemu/openprom.c 2005-11-07 20:11:04.000000000 +0000
885 + * PROM interface support
886 + * Copyright 1996 The Australian National University.
887 + * Copyright 1996 Fujitsu Laboratories Limited
888 + * Copyright 1999 Pete A. Zaitcev
889 + * This software may be distributed under the terms of the Gnu
890 + * Public License version 2 or later
893 +#include <openprom.h>
894 +#include <general.h>
897 +#include <vconsole.h>
898 +#include "phys_jj.h"
902 +#define PAGE_SIZE 4096
911 + const struct property *properties;
912 + /* short */ const int sibling;
913 + /* short */ const int child;
916 +static int obp_nextnode(int node);
917 +static int obp_child(int node);
918 +static int obp_proplen(int node, char *name);
919 +static int obp_getprop(int node, char *name, char *val);
920 +static int obp_setprop(int node, char *name, char *val, int len);
921 +static const char *obp_nextprop(int node, char *name);
923 +static char obp_idprom[IDPROM_SIZE];
924 +static const struct property null_properties = { NULL, NULL, -1 };
925 +static const int prop_true = -1;
927 +static struct property propv_root[7];
929 +static const struct property propv_root_templ[] = {
930 + {"name", "SUNW,SparcStation-5", sizeof("SUNW,SparcStation-5") },
931 + {"idprom", obp_idprom, IDPROM_SIZE},
932 + {"banner-name", "SparcStation", sizeof("SparcStation")},
933 + {"compatible", "sun4m", 6},
936 +static const int prop_iommu_reg[] = {
937 + 0x0, 0x10000000, 0x00000300,
939 +static const struct property propv_iommu[] = {
940 + {"name", "iommu", sizeof("iommu")},
941 + {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) },
945 +static const int prop_sbus_ranges[] = {
946 + 0x0, 0x0, 0x0, 0x30000000, 0x10000000,
947 + 0x1, 0x0, 0x0, 0x40000000, 0x10000000,
948 + 0x2, 0x0, 0x0, 0x50000000, 0x10000000,
949 + 0x3, 0x0, 0x0, 0x60000000, 0x10000000,
950 + 0x4, 0x0, 0x0, 0x70000000, 0x10000000,
952 +static const struct property propv_sbus[] = {
953 + {"name", "sbus", 5},
954 + {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)},
955 + {"device_type", "hierarchical", sizeof("hierarchical") },
959 +static const int prop_tcx_regs[] = {
960 + 0x2, 0x00800000, 0x00100000,
961 + 0x2, 0x02000000, 0x00000001,
962 + 0x2, 0x04000000, 0x00800000,
963 + 0x2, 0x06000000, 0x00800000,
964 + 0x2, 0x0a000000, 0x00000001,
965 + 0x2, 0x0c000000, 0x00000001,
966 + 0x2, 0x0e000000, 0x00000001,
967 + 0x2, 0x00700000, 0x00001000,
968 + 0x2, 0x00200000, 0x00000004,
969 + 0x2, 0x00300000, 0x0000081c,
970 + 0x2, 0x00000000, 0x00010000,
971 + 0x2, 0x00240000, 0x00000004,
972 + 0x2, 0x00280000, 0x00000001,
976 +static const int pixfreq = 0x03dfd240;
977 +static const int hbporch = 0xa0;
978 +static const int vfreq = 0x3c;
980 +#if 0 /* Kevin Boone - 70Hz refresh */
981 +static const int pixfreq = 0x047868C0;
982 +static const int hbporch = 0x90;
983 +static const int vfreq = 0x46;
986 +static const int vbporch = 0x1d;
987 +static const int vsync = 0x6;
988 +static const int hsync = 0x88;
989 +static const int vfporch = 0x3;
990 +static const int hfporch = 0x18;
991 +static const int height = 0x300;
992 +static const int width = 0x400;
993 +static const int linebytes = 0x400;
994 +static const int depth = 24;
995 +static const int tcx_intr[] = { 5, 0 };
996 +static const int tcx_interrupts = 5;
997 +static const struct property propv_sbus_tcx[] = {
998 + {"name", "SUNW,tcx", sizeof("SUNW,tcx")},
999 + {"vbporch", (char*)&vbporch, sizeof(int)},
1000 + {"hbporch", (char*)&hbporch, sizeof(int)},
1001 + {"vsync", (char*)&vsync, sizeof(int)},
1002 + {"hsync", (char*)&hsync, sizeof(int)},
1003 + {"vfporch", (char*)&vfporch, sizeof(int)},
1004 + {"hfporch", (char*)&hfporch, sizeof(int)},
1005 + {"pixfreq", (char*)&pixfreq, sizeof(int)},
1006 + {"vfreq", (char*)&vfreq, sizeof(int)},
1007 + {"height", (char*)&height, sizeof(int)},
1008 + {"width", (char*)&width, sizeof(int)},
1009 + {"linebytes", (char*)&linebytes, sizeof(int)},
1010 + {"depth", (char*)&depth, sizeof(int)},
1011 + {"reg", (char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)},
1012 + {"tcx-8-bit", 0, -1},
1013 + {"intr", (char*)&tcx_intr[0], sizeof(tcx_intr)},
1014 + {"interrupts", (char*)&tcx_interrupts, sizeof(tcx_interrupts)},
1015 + {"device_type", "display", sizeof("display")},
1019 +static const int prop_cs4231_reg[] = {
1020 + 0x3, 0x0C000000, 0x00000040
1022 +static const int cs4231_interrupts = 5;
1023 +static const int cs4231_intr[] = { 5, 0 };
1025 +static const struct property propv_sbus_cs4231[] = {
1026 + {"name", "SUNW,CS4231", sizeof("SUNW,CS4231") },
1027 + {"intr", (char*)&cs4231_intr[0], sizeof(cs4231_intr) },
1028 + {"interrupts", (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) },
1029 + {"reg", (char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) },
1030 + {"device_type", "serial", sizeof("serial") },
1031 + {"alias", "audio", sizeof("audio") },
1035 +static const int cpu_nctx = NCTX_SWIFT;
1036 +static const int cpu_cache_line_size = 0x20;
1037 +static const int cpu_cache_nlines = 0x200;
1038 +static const struct property propv_cpu[] = {
1039 + {"name", "STP1012PGA", sizeof("STP1012PGA") },
1040 + {"device_type", "cpu", 4 },
1041 + {"mmu-nctx", (char*)&cpu_nctx, sizeof(int)},
1042 + {"cache-line-size", (char*)&cpu_cache_line_size, sizeof(int)},
1043 + {"cache-nlines", (char*)&cpu_cache_nlines, sizeof(int)},
1047 +static const int prop_obio_ranges[] = {
1048 + 0x0, 0x0, 0x0, 0x71000000, 0x01000000,
1050 +static const struct property propv_obio[] = {
1051 + {"name", "obio", 5 },
1052 + {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },
1053 + {"device_type", "hierarchical", sizeof("hierarchical") },
1057 +static const int prop_auxio_reg[] = {
1058 + 0x0, 0x00900000, 0x00000001,
1060 +static const struct property propv_obio_auxio[] = {
1061 + {"name", "auxio", sizeof("auxio") },
1062 + {"reg", (char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) },
1066 +static const int prop_int_reg[] = {
1067 + 0x0, 0x00e00000, 0x00000010,
1068 + 0x0, 0x00e10000, 0x00000010,
1070 +static const struct property propv_obio_int[] = {
1071 + {"name", "interrupt", sizeof("interrupt")},
1072 + {"reg", (char*)&prop_int_reg[0], sizeof(prop_int_reg) },
1076 +static const int prop_cnt_reg[] = {
1077 + 0x0, 0x00d00000, 0x00000010,
1078 + 0x0, 0x00d10000, 0x00000010,
1080 +static const struct property propv_obio_cnt[] = {
1081 + {"name", "counter", sizeof("counter")},
1082 + {"reg", (char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) },
1086 +static const int prop_eeprom_reg[] = {
1087 + 0x0, 0x00200000, 0x00002000,
1089 +static const struct property propv_obio_eep[] = {
1090 + {"name", "eeprom", sizeof("eeprom")},
1091 + {"reg", (char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) },
1092 + {"model", "mk48t08", sizeof("mk48t08")},
1096 +static const int prop_su_reg[] = {
1097 + 0x0, 0x003002f8, 0x00000008,
1099 +static const struct property propv_obio_su[] = {
1100 + {"name", "su", sizeof("su")},
1101 + {"reg", (char*)&prop_su_reg[0], sizeof(prop_su_reg) },
1105 +static const int prop_zs_intr[] = { 0x2c, 0x0 };
1106 +static const int prop_zs_reg[] = {
1107 + 0x0, 0x00000000, 0x00000008,
1109 +static void *prop_zs_addr;
1110 +static const int prop_zs_slave = 1;
1111 +static const struct property propv_obio_zs[] = {
1112 + {"name", "zs", sizeof("zs")},
1113 + {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) },
1114 + {"slave", (char*)&prop_zs_slave, sizeof(prop_zs_slave) },
1115 + {"device_type", "serial", sizeof("serial") },
1116 + {"intr", (char*)&prop_zs_intr[0], sizeof(prop_zs_intr) },
1117 + {"address", (char*)&prop_zs_addr, sizeof(prop_zs_addr) },
1118 + {"keyboard", (char*)&prop_true, 0},
1119 + {"mouse", (char*)&prop_true, 0},
1123 +static const int prop_zs1_intr[] = { 0x2c, 0x0 };
1124 +static const int prop_zs1_reg[] = {
1125 + 0x0, 0x00100000, 0x00000008,
1127 +static void *prop_zs1_addr;
1128 +static const int prop_zs1_slave = 0;
1129 +static const struct property propv_obio_zs1[] = {
1130 + {"name", "zs", sizeof("zs")},
1131 + {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) },
1132 + {"slave", (char*)&prop_zs1_slave, sizeof(prop_zs1_slave) },
1133 + {"device_type", "serial", sizeof("serial") },
1134 + {"intr", (char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) },
1135 + {"address", (char*)&prop_zs1_addr, sizeof(prop_zs1_addr) },
1139 +static const int prop_ledma_reg[] = {
1140 + 0x4, 0x08400010, 0x00000020,
1142 +static const int prop_ledma_burst = 0x3f;
1143 +static const struct property propv_sbus_ledma[] = {
1144 + {"name", "ledma", sizeof("ledma")},
1145 + {"reg", (char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) },
1146 + {"burst-sizes", (char*)&prop_ledma_burst, sizeof(int) },
1150 +static const int prop_le_reg[] = {
1151 + 0x4, 0x08c00000, 0x00000004,
1153 +static const int prop_le_busmaster_regval = 0x7;
1154 +static const int prop_le_intr[] = { 0x26, 0x0 };
1155 +static const struct property propv_sbus_ledma_le[] = {
1156 + {"name", "le", sizeof("le")},
1157 + {"reg", (char*)&prop_le_reg[0], sizeof(prop_le_reg) },
1158 + {"busmaster-regval", (char*)&prop_le_busmaster_regval, sizeof(int)},
1159 + {"intr", (char*)&prop_le_intr[0], sizeof(prop_le_intr) },
1163 +static const int prop_espdma_reg[] = {
1164 + 0x4, 0x08400000, 0x00000010,
1167 +static const struct property propv_sbus_espdma[] = {
1168 + {"name", "espdma", sizeof("espdma")},
1169 + {"reg", (char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) },
1173 +static const int prop_esp_reg[] = {
1174 + 0x4, 0x08800000, 0x00000040,
1176 +static const int prop_esp_intr[] = { 0x24, 0x0 };
1177 +static const struct property propv_sbus_espdma_esp[] = {
1178 + {"name", "esp", sizeof("esp")},
1179 + {"reg", (char*)&prop_esp_reg[0], sizeof(prop_esp_reg) },
1180 + {"intr", (char*)&prop_esp_intr[0], sizeof(prop_esp_intr) },
1184 +static const int prop_bpp_reg[] = {
1185 + 0x4, 0x0c800000, 0x0000001c,
1187 +static const int prop_bpp_intr[] = { 0x33, 0x0 };
1188 +static const struct property propv_sbus_bpp[] = {
1189 + {"name", "SUNW,bpp", sizeof("SUNW,bpp")},
1190 + {"reg", (char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) },
1191 + {"intr", (char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) },
1195 +static const int prop_apc_reg[] = {
1196 + 0x4, 0x0a000000, 0x00000010,
1198 +static const struct property propv_sbus_apc[] = {
1199 + {"name", "xxxpower-management", sizeof("xxxpower-management")},
1200 + {"reg", (char*)&prop_apc_reg[0], sizeof(prop_apc_reg) },
1204 +static const int prop_fd_intr[] = { 0x2b, 0x0 };
1205 +static const int prop_fd_reg[] = {
1206 + 0x0, 0x00400000, 0x0000000f,
1208 +static const struct property propv_obio_fd[] = {
1209 + {"name", "SUNW,fdtwo", sizeof("SUNW,fdtwo")},
1210 + {"reg", (char*)&prop_fd_reg[0], sizeof(prop_fd_reg) },
1211 + {"device_type", "block", sizeof("block") },
1212 + {"intr", (char*)&prop_fd_intr[0], sizeof(prop_fd_intr) },
1216 +static const int prop_pw_intr[] = { 0x22, 0x0 };
1217 +static const int prop_pw_reg[] = {
1218 + 0x0, 0x00910000, 0x00000001,
1220 +static const struct property propv_obio_pw[] = {
1221 + {"name", "power", sizeof("power")},
1222 + {"reg", (char*)&prop_pw_reg[0], sizeof(prop_pw_reg) },
1223 + {"intr", (char*)&prop_pw_intr[0], sizeof(prop_pw_intr) },
1227 +static const int prop_cf_reg[] = {
1228 + 0x0, 0x00800000, 0x00000001,
1230 +static const struct property propv_obio_cf[] = {
1231 + {"name", "slavioconfig", sizeof("slavioconfig")},
1232 + {"reg", (char*)&prop_cf_reg[0], sizeof(prop_cf_reg) },
1236 +static const struct property propv_options[] = {
1237 + {"name", "options", sizeof("options")},
1238 + {"screen-#columns", "80", sizeof("80")},
1239 + {"screen-#rows", "25", sizeof("25")},
1240 + {"tpe-link-test?", (char *)&prop_true, 0},
1241 + {"ttya-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")},
1242 + {"ttya-ignore-cd", (char *)&prop_true, 0},
1243 + {"ttya-rts-dtr-off", 0, -1},
1244 + {"ttyb-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")},
1245 + {"ttyb-ignore-cd", (char *)&prop_true, 0},
1246 + {"ttyb-rts-dtr-off", 0, -1},
1250 +static int prop_mem_reg[3];
1251 +static int prop_mem_avail[3];
1253 +static const struct property propv_memory[] = {
1254 + {"name", "memory", sizeof("memory")},
1255 + {"reg", (char*)&prop_mem_reg[0], sizeof(prop_mem_reg) },
1256 + {"available", (char*)&prop_mem_avail[0], sizeof(prop_mem_avail) },
1260 +static int prop_vmem_avail[6];
1262 +static const struct property propv_vmemory[] = {
1263 + {"name", "virtual-memory", sizeof("virtual-memory")},
1264 + {"available", (char*)&prop_vmem_avail[0], sizeof(prop_vmem_avail) },
1268 +static const struct node nodes[] = {
1269 + { &null_properties, 1, 0 }, /* 0 = big brother of root */
1270 + { propv_root, 0, 2 }, /* 1 "/" */
1271 + { propv_iommu, 12, 3 }, /* 2 "/iommu" */
1272 + { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */
1273 + { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */
1274 + { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */
1275 + { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */
1276 + { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */
1277 + { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */
1278 + { propv_sbus_espdma, 11, 10 }, /* 9 "/iommu/sbus/espdma" */
1279 + { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */
1280 + { propv_sbus_apc, 0, 0 }, /* 11 "/iommu/sbus/power-management */
1281 + { propv_cpu, 13, 0 }, /* 12 "/STP1012PGA" */
1282 + { propv_obio, 23, 14 }, /* 13 "/obio" */
1283 + { propv_obio_int, 15, 0 }, /* 14 "/obio/interrupt" */
1284 + { propv_obio_cnt, 16, 0 }, /* 15 "/obio/counter" */
1285 + { propv_obio_eep, 17, 0 }, /* 16 "/obio/eeprom" */
1286 + { propv_obio_auxio, 18, 0 }, /* 17 "/obio/auxio" */
1287 + { propv_obio_zs1, 19, 0 }, /* 18 "/obio/zs@0,100000"
1288 + Must be before zs@0,0! */
1289 + { propv_obio_zs, 20, 0 }, /* 19 "/obio/zs@0,0" */
1290 + { propv_obio_fd, 21, 0 }, /* 20 "/obio/SUNW,fdtwo" */
1291 + { propv_obio_pw, 22, 0 }, /* 21 "/obio/power" */
1292 + { propv_obio_cf, 0, 0 }, /* 22 "/obio/slavioconfig@0,800000" */
1293 + { propv_options, 24, 0 }, /* 23 "/options" */
1294 + { propv_memory, 25, 0 }, /* 24 "/memory" */
1295 + { propv_vmemory, 0, 0 }, /* 25 "/virtual-memory" */
1298 +static struct linux_mlist_v0 totphys[MAX_BANKS];
1299 +static struct linux_mlist_v0 totmap[1];
1300 +static struct linux_mlist_v0 totavail[MAX_BANKS];
1302 +static struct linux_mlist_v0 *ptphys;
1303 +static struct linux_mlist_v0 *ptmap;
1304 +static struct linux_mlist_v0 *ptavail;
1306 +static const struct linux_nodeops nodeops0 = {
1307 + obp_nextnode, /* int (*no_nextnode)(int node); */
1308 + obp_child, /* int (*no_child)(int node); */
1309 + obp_proplen, /* int (*no_proplen)(int node, char *name); */
1310 + obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */
1311 + obp_setprop, /* int (*no_setprop)(int node, char *name,
1312 + char *val, int len); */
1313 + obp_nextprop /* char * (*no_nextprop)(int node, char *name); */
1316 +static struct linux_arguments_v0 obp_arg;
1317 +static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
1319 +static void (*synch_hook)(void);
1320 +static char obp_stdin, obp_stdout;
1321 +static int obp_fd_stdin, obp_fd_stdout;
1323 +static int obp_nbgetchar(void);
1324 +static int obp_nbputchar(int ch);
1325 +static void obp_reboot(char *);
1326 +static void obp_abort(void);
1327 +static void obp_halt(void);
1328 +static int obp_devopen(char *str);
1329 +static int obp_devclose(int dev_desc);
1330 +static int obp_devread(int dev_desc, char *buf, int nbytes);
1331 +static int obp_devwrite(int dev_desc, char *buf, int nbytes);
1332 +static int obp_devseek(int dev_desc, int hi, int lo);
1333 +static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf);
1334 +static char *obp_dumb_mmap(char *va, int which_io, unsigned int pa, unsigned int size);
1335 +static void obp_dumb_munmap(char *va, unsigned int size);
1336 +static int obp_inst2pkg(int dev_desc);
1338 +static void doublewalk(unsigned ptab1, unsigned va)
1340 +unsigned int proc_tablewalk(int ctx, unsigned int va);
1341 +unsigned int mem_tablewalk(unsigned int pa, unsigned int va);
1343 + proc_tablewalk(0, va);
1344 + if (ptab1 != 0) mem_tablewalk(ptab1, va);
1347 +static struct linux_romvec romvec0;
1352 + int (*pread)(int dev_desc, int offset, char *buf, unsigned int nbytes);
1353 + int (*pwrite)(int dev_desc, int offset, char *buf, unsigned int nbytes);
1356 +static int fd_index;
1357 +static int con_pread(int dev_desc, int offset, char *buf, unsigned int nbytes);
1358 +static int con_pwrite(int dev_desc, int offset, char *buf, unsigned int nbytes);
1361 +init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas,
1362 + const char *cmdline, char boot_device, int nographic)
1367 + * Avoid data segment allocations
1371 + ptavail = totavail;
1373 + * Form memory descriptors.
1375 + for (i = 0; i < bankc; i++) {
1376 + totphys[i].theres_more = &totphys[i+1];
1377 + totphys[i].start_adr = (char*) bankv[i].start;
1378 + totphys[i].num_bytes = bankv[i].length;
1380 + totphys[i-1].theres_more = 0;
1383 + * XXX Merged in normal PROM when full banks touch.
1385 + for (i = 0; i < bankc; i++) {
1386 + unsigned bankbase = bankv[i].start;
1387 + unsigned banksize = bankv[i].length;
1388 + if (hiphybas > bankbase &&
1389 + hiphybas < bankbase + banksize) {
1390 + banksize = hiphybas - bankbase;
1392 + totavail[i].theres_more = &totavail[i+1];
1393 + totavail[i].start_adr = (char*) bankbase;
1394 + totavail[i].num_bytes = banksize;
1396 + totavail[i-1].theres_more = 0;
1398 + totmap[0].theres_more = 0;
1399 + totmap[0].start_adr = (char*) PROLBASE;
1400 + totmap[0].num_bytes = PROLSIZE;
1401 + prop_mem_reg[0] = 0;
1402 + prop_mem_reg[1] = 0;
1403 + prop_mem_reg[2] = bankv[0].length;
1404 + prop_mem_avail[0] = 0;
1405 + prop_mem_avail[1] = 0;
1406 + prop_mem_avail[2] = hiphybas;
1407 + prop_vmem_avail[0] = 0;
1408 + prop_vmem_avail[1] = 0;
1409 + prop_vmem_avail[2] = PROLBASE-1;
1410 + prop_vmem_avail[3] = 0;
1411 + prop_vmem_avail[4] = 0xffe00000;
1412 + prop_vmem_avail[5] = 0x00200000;
1417 + bcopy(idprom, obp_idprom, IDPROM_SIZE);
1419 + // Linux wants a R/W romvec table
1420 + romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;
1421 + romvec0.pv_romvers = 3;
1422 + romvec0.pv_plugin_revision = 77;
1423 + romvec0.pv_printrev = 0x10203;
1424 + romvec0.pv_v0mem.v0_totphys = &ptphys;
1425 + romvec0.pv_v0mem.v0_prommap = &ptmap;
1426 + romvec0.pv_v0mem.v0_available = &ptavail;
1427 + romvec0.pv_nodeops = &nodeops0;
1428 + romvec0.pv_bootstr = (void *)doublewalk;
1429 + romvec0.pv_v0devops.v0_devopen = &obp_devopen;
1430 + romvec0.pv_v0devops.v0_devclose = &obp_devclose;
1431 + romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev;
1432 + romvec0.pv_stdin = &obp_stdin;
1433 + romvec0.pv_stdout = &obp_stdout;
1434 + romvec0.pv_getchar = obp_nbgetchar;
1435 + romvec0.pv_putchar = (void (*)(int))obp_nbputchar;
1436 + romvec0.pv_nbgetchar = obp_nbgetchar;
1437 + romvec0.pv_nbputchar = obp_nbputchar;
1438 + romvec0.pv_reboot = obp_reboot;
1439 + romvec0.pv_printf = (void (*)(const char *fmt, ...))printk;
1440 + romvec0.pv_abort = obp_abort;
1441 + romvec0.pv_halt = obp_halt;
1442 + romvec0.pv_synchook = &synch_hook;
1443 + romvec0.pv_v0bootargs = &obp_argp;
1444 + romvec0.pv_v2devops.v2_inst2pkg = obp_inst2pkg;
1445 + romvec0.pv_v2devops.v2_dumb_mmap = obp_dumb_mmap;
1446 + romvec0.pv_v2devops.v2_dumb_munmap = obp_dumb_munmap;
1447 + romvec0.pv_v2devops.v2_dev_open = obp_devopen;
1448 + romvec0.pv_v2devops.v2_dev_close = (void (*)(int))obp_devclose;
1449 + romvec0.pv_v2devops.v2_dev_read = obp_devread;
1450 + romvec0.pv_v2devops.v2_dev_write = obp_devwrite;
1451 + romvec0.pv_v2devops.v2_dev_seek = obp_devseek;
1452 + obp_arg.boot_dev_ctrl = 0;
1453 + obp_arg.boot_dev_unit = '0';
1454 + obp_arg.argv[0] = "sd(0,0,0):d";
1455 + switch(boot_device) {
1458 + obp_arg.argv[0] = "fd()";
1459 + obp_arg.boot_dev[0] = 'f';
1460 + obp_arg.boot_dev[1] = 'd';
1463 + obp_arg.boot_dev_unit = '2';
1464 + obp_arg.argv[0] = "sd(0,2,0):d";
1467 + obp_arg.boot_dev[0] = 's';
1468 + obp_arg.boot_dev[1] = 'd';
1471 + obp_arg.argv[0] = "le()";
1472 + obp_arg.boot_dev[0] = 'l';
1473 + obp_arg.boot_dev[1] = 'e';
1476 + obp_arg.argv[1] = cmdline;
1477 + romvec0.pv_v2bootargs.bootpath = &obp_arg.argv[0];
1478 + romvec0.pv_v2bootargs.bootargs = &cmdline;
1479 + romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;
1480 + romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout;
1482 + bcopy(propv_root_templ, propv_root, sizeof(propv_root_templ));
1483 + propv_root[4].name = "stdin-path";
1484 + propv_root[5].name = "stdout-path";
1486 + obp_fd_stdout = 1;
1487 + fd_table[0].pread = con_pread;
1488 + fd_table[0].pwrite = con_pwrite;
1489 + fd_table[1].pread = con_pread;
1490 + fd_table[1].pwrite = con_pwrite;
1493 + obp_stdin = PROMDEV_TTYA;
1494 + propv_root[4].value = "/obio/zs@0,100000:a";
1495 + propv_root[4].length = sizeof("/obio/zs@0,100000:a");
1496 + fd_table[0].unit = 18;
1497 + obp_stdout = PROMDEV_TTYA;
1498 + propv_root[5].value = "/obio/zs@0,100000:a";
1499 + propv_root[5].length = sizeof("/obio/zs@0,100000:a");
1500 + fd_table[1].unit = 18;
1502 + obp_stdin = PROMDEV_KBD;
1503 + propv_root[4].value = "/obio/zs@0,0";
1504 + propv_root[4].length = sizeof("/obio/zs@0,0");
1505 + fd_table[0].unit = 19;
1506 + obp_stdout = PROMDEV_SCREEN;
1507 + propv_root[5].value = "/iommu/sbus/SUNW,tcx";
1508 + propv_root[5].length = sizeof("/iommu/sbus/SUNW,tcx");
1509 + fd_table[1].unit = 4;
1511 + prop_zs_addr = map_io(0x71000000, 8);
1512 + prop_zs1_addr = map_io(0x71100000, 8);
1516 +static const struct property *find_property(int node,char *name)
1518 + const struct property *prop = &nodes[node].properties[0];
1519 + while (prop && prop->name) {
1520 + if (bcmp(prop->name, name, 128) == 0) return prop;
1526 +static int obp_nextnode(int node)
1529 + printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling);
1531 + return nodes[node].sibling;
1534 +static int obp_child(int node)
1537 + printk("obp_child(%d) = %d\n", node, nodes[node].child);
1539 + return nodes[node].child;
1542 +static int obp_proplen(int node, char *name)
1544 + const struct property *prop = find_property(node,name);
1547 + printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length);
1549 + return prop->length;
1552 + printk("obp_proplen(%d, %s) (no prop)\n", node, name);
1557 +static int obp_getprop(int node, char *name, char *value)
1559 + const struct property *prop;
1562 + // NULL name means get first property
1564 + printk("obp_getprop(%d, %x (NULL)) = %s\n", node, name,
1565 + nodes[node].properties[0].name);
1567 + return (int)nodes[node].properties[0].name;
1569 + prop = find_property(node,name);
1571 + memcpy(value,prop->value,prop->length);
1573 + printk("obp_getprop(%d, %s) = %s\n", node, name, value);
1575 + return prop->length;
1578 + printk("obp_getprop(%d, %s): not found\n", node, name);
1583 +static int obp_setprop(__attribute__((unused)) int node,
1584 + __attribute__((unused)) char *name,
1585 + __attribute__((unused)) char *value,
1586 + __attribute__((unused)) int len)
1589 + printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len);
1594 +static const char *obp_nextprop(int node,char *name)
1596 + const struct property *prop;
1598 + if (!name || *name == '\0') {
1599 + // NULL name means get first property
1601 + printk("obp_nextprop(%d, NULL) = %s\n", node,
1602 + nodes[node].properties[0].name);
1604 + return nodes[node].properties[0].name;
1606 + prop = find_property(node,name);
1607 + if (prop && prop[1].name) {
1609 + printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name);
1611 + return prop[1].name;
1614 + printk("obp_nextprop(%d, %s): not found\n", node, name);
1619 +extern int (*getch_fn)(struct vconterm *v);
1621 +static int obp_nbgetchar(void) {
1622 + extern struct vconterm dp0;
1623 + return getch_fn(&dp0);
1626 +static int obp_nbputchar(int ch) {
1631 +static void obp_reboot(char *str) {
1632 + printk("rebooting (%s)\n", str);
1633 + stb_bypass(0x71f00000, 1);
1637 +static void obp_abort() {
1638 + printk("abort, power off\n");
1639 + stb_bypass(0x71910000, 1);
1643 +static void obp_halt() {
1644 + printk("halt, power off\n");
1645 + stb_bypass(0x71910000, 1);
1649 +extern void *esp_read(int unit, int part, int offset, short len);
1651 +static int esp_pread(int dev_desc, int offset, char *buf, unsigned int nbytes)
1656 + for(i = 0; i < nbytes; i += 512) {
1657 + src = esp_read(fd_table[dev_desc].unit, fd_table[dev_desc].part, (offset + i) / 512, 512);
1658 + memcpy(&buf[i], src, 512);
1663 +static int con_pread(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes)
1667 + for(i = 0; i < nbytes; i ++) {
1668 + buf[i] = obp_nbgetchar();
1673 +static int con_pwrite(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes)
1677 + for(i = 0; i < nbytes; i ++) {
1678 + obp_nbputchar(buf[i]);
1683 +#define isnum(c) ((c >= '0') && (c < '9'))
1684 +#define ctoi(c) (c - '0')
1686 +static int obp_devopen(char *str) {
1688 + printk("obp_devopen(%s)\n", str);
1690 + if (str[0] == 's' && str[1] == 'd' && str[4] == ',') {
1691 + unsigned int target;
1695 + else if (isnum(str[6]) && isnum(str[5])) {
1696 + target = (ctoi(str[5]) * 10 + ctoi(str[6])) & 7;
1699 + target = ctoi(str[5]) & 7;
1701 + fd_table[fd_index].unit = target;
1702 + fd_table[fd_index].part = str[10] - 'a';
1703 + fd_table[fd_index].pread = esp_pread;
1704 + return fd_index++; // XXX
1709 +static int obp_devclose(__attribute__((unused)) int dev_desc) {
1711 + printk("obp_devclose %d\n", dev_desc);
1713 + fd_index--; // XXX
1717 +static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf)
1720 + printk("obp_rdblkdev: fd %d, num_blks %d, offset %d, buf 0x%x\n", dev_desc, num_blks, offset, buf);
1722 + return fd_table[dev_desc].pread(dev_desc, offset, buf, num_blks * 512);
1725 +static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io,
1726 + unsigned int pa, unsigned int size)
1728 + unsigned int npages;
1733 + printk("obp_dumb_mmap: virta %x, which_io %d, paddr %x, sz %d\n", va, which_io, pa, size);
1735 + off = pa & (PAGE_SIZE-1);
1736 + npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
1737 + pa &= ~(PAGE_SIZE-1);
1739 + mva = (unsigned int) va;
1740 + while (npages-- != 0) {
1741 + map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
1748 +static void obp_dumb_munmap(__attribute__((unused)) char *va,
1749 + __attribute__((unused)) unsigned int size)
1752 + printk("obp_dumb_munmap: virta %x, sz %d\n", va, size);
1756 +static int obp_devread(int dev_desc, char *buf, int nbytes)
1760 + printk("obp_devread: fd %d, nbytes %d\n", dev_desc, nbytes);
1762 + ret = fd_table[dev_desc].pread(dev_desc, fd_table[dev_desc].offset, buf, nbytes);
1763 + fd_table[dev_desc].offset += nbytes;
1767 +static int obp_devwrite(int dev_desc, char *buf, int nbytes)
1771 + printk("obp_devwrite: fd %d, buf %s, nbytes %d\n", dev_desc, buf, nbytes);
1773 + ret = fd_table[dev_desc].pwrite(dev_desc, fd_table[dev_desc].offset, buf, nbytes);
1774 + fd_table[dev_desc].offset += nbytes;
1778 +static int obp_devseek(int dev_desc, __attribute__((unused)) int hi, int lo)
1781 + printk("obp_devseek: fd %d, hi %d, lo %d\n", dev_desc, hi, lo);
1783 + fd_table[dev_desc].offset = lo;
1787 +static int obp_inst2pkg(int dev_desc)
1790 + printk("obp_inst2pkg: fd %d\n", dev_desc);
1792 + return fd_table[dev_desc].unit;
1794 diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch-15/qemu/system_qemu.c
1795 --- proll_18.orig/qemu/system_qemu.c 1970-01-01 00:00:00.000000000 +0000
1796 +++ proll-patch-15/qemu/system_qemu.c 2005-04-16 06:16:20.000000000 +0000
1799 + ** Proll (PROM replacement)
1800 + ** system.c: shared miscallenea.
1801 + ** Copyright 1999 Pete Zaitcev
1802 + ** This code is licensed under GNU General Public License.
1804 +#include <stdarg.h>
1808 +#define NULL ((void*)0)
1811 +#include "pgtsrmmu.h"
1813 +#include "vconsole.h"
1814 +#include <timer.h> /* Local copy of 2.2 style include */
1815 +#include <general.h> /* __P() */
1816 +#include <net.h> /* init_net() */
1817 +#include <romlib.h> /* we are a provider for part of this. */
1818 +#include <netpriv.h> /* myipaddr */
1820 +#include <system.h> /* our own prototypes */
1825 +char idprom[IDPROM_SIZE];
1829 + * Create an I/O mapping to pa[size].
1830 + * Returns va of the mapping or 0 if unsuccessful.
1833 +map_io(unsigned pa, int size)
1836 + unsigned int npages;
1840 + off = pa & (PAGE_SIZE-1);
1841 + npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
1842 + pa &= ~(PAGE_SIZE-1);
1844 + va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE);
1845 + if (va == 0) return va;
1847 + mva = (unsigned int) va;
1848 + /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */
1849 + while (npages-- != 0) {
1850 + map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
1855 + return (void *)((unsigned int)va + off);
1859 + * Tablewalk routine used for testing.
1860 + * Returns PTP/PTE.
1863 +proc_tablewalk(int ctx, unsigned int va)
1867 + __asm__ __volatile__ ("lda [%1] %2, %0" :
1869 + "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
1870 + /* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */
1872 + pa1 = ld_bypass(pa1 + (ctx << 2));
1873 + if ((pa1 & 0x03) == 0) goto invalid;
1874 + return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va);
1877 + printk(" invalid %x\n", pa1);
1882 + * Walk the tables in memory, starting at physical address pa.
1885 +mem_tablewalk(unsigned int pa, unsigned int va)
1889 + printk("pa %x va %x", pa, va);
1890 + pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2));
1891 + if ((pa1 & 0x03) == 0) goto invalid;
1892 + printk(" l1 %x", pa1);
1893 + pa1 <<= 4; pa1 &= 0xFFFFFF00;
1894 + pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2));
1895 + if ((pa1 & 0x03) == 0) goto invalid;
1896 + printk(" l2 %x", pa1);
1897 + pa1 <<= 4; pa1 &= 0xFFFFFF00;
1898 + pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2));
1899 + if ((pa1 & 0x03) == 0) goto invalid;
1900 + printk(" l3 %x", pa1);
1901 + printk(" off %x\n", va&0x00000FFF);
1904 + printk(" invalid %x\n", pa1);
1909 + * Make CPU page tables.
1910 + * Returns pointer to context table.
1911 + * Here we ignore memory allocation errors which "should not happen"
1912 + * because we cannot print anything anyways if memory initialization fails.
1914 +void makepages(struct phym *t, unsigned int highbase)
1916 + unsigned int *ctp, *l1, pte;
1918 + unsigned int pa, va;
1920 + ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int));
1921 + l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int));
1923 + pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4);
1924 + for (i = 0; i < NCTX_SWIFT; i++) {
1929 + for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) {
1930 + map_page(l1, va, pa, 0, highbase);
1933 + pa = highbase + PROLDATA - PROLBASE;
1934 + for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) {
1935 + map_page(l1, va, pa, 0, highbase);
1939 + /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
1941 + for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
1942 + map_page(l1, va, pa, 0, highbase);
1948 + t->pbas = highbase;
1952 + * Create a memory mapping from va to epa in page table pgd.
1953 + * highbase is used for v2p translation.
1956 +map_page(unsigned int *pgd, unsigned int va,
1957 + unsigned int epa, int type, unsigned int highbase)
1963 + pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)];
1964 + if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
1965 + p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int),
1966 + SRMMU_PTRS_PER_PMD*sizeof(int));
1967 + if (p == 0) goto drop;
1968 + pte = SRMMU_ET_PTD |
1969 + (((unsigned int)p - PROLBASE + highbase) >> 4);
1970 + pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte;
1974 + pa = ((pte & 0xFFFFFFF0) << 4);
1975 + pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2);
1976 + pte = ld_bypass(pa);
1977 + if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
1978 + p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int),
1979 + SRMMU_PTRS_PER_PTE*sizeof(int));
1980 + if (p == 0) goto drop;
1981 + pte = SRMMU_ET_PTD |
1982 + (((unsigned int)p - PROLBASE + highbase) >> 4);
1983 + st_bypass(pa, pte);
1986 + pa = ((pte & 0xFFFFFFF0) << 4);
1987 + pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2);
1989 + pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4);
1990 + if (type) { /* I/O */
1992 + /* SRMMU cannot make Supervisor-only, but not exectutable */
1993 + pte |= SRMMU_PRIV;
1994 + } else { /* memory */
1995 + pte |= SRMMU_REF|SRMMU_CACHE;
1996 + pte |= SRMMU_PRIV; /* Supervisor only access */
1998 + st_bypass(pa, pte);
2006 + * Switch page tables.
2009 +init_mmu_swift(unsigned int ctp_phy)
2011 + unsigned int addr;
2016 + for (addr = 0; addr < 0x2000; addr += 0x10) {
2017 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
2018 + "r" (addr), "i" (ASI_M_DATAC_TAG));
2019 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
2020 + "r" (addr<<1), "i" (ASI_M_TXTC_TAG));
2024 + * Switch ctx table
2027 + /* printk("done flushing, switching to %x\n", ctp_phy); */
2028 + __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
2029 + "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
2032 + * Flush old page table references
2034 + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
2035 + "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory");
2039 + * add_timer, del_timer
2040 + * This should go into sched.c, but we have it split for different archs.
2042 +struct timer_list_head {
2043 + struct timer_list *head, *tail;
2046 +static struct timer_list_head timers; /* Anonymous heap of timers */
2048 +void add_timer(struct timer_list *timer) {
2049 + struct timer_list *p;
2050 + if (timer->prev != NULL || timer->next != NULL) {
2051 + printk("bug: kernel timer added twice at 0x%x.\n",
2052 + __builtin_return_address(0));
2055 + if ((p = timers.tail) != NULL) {
2058 + timers.tail = timer;
2060 + timers.head = timer;
2061 + timers.tail = timer;
2066 +int del_timer(struct timer_list *timer) {
2067 + struct timer_list *p;
2070 + if (timers.head == timer) timers.head = timer->next;
2071 + if (timers.tail == timer) timers.tail = timer->prev;
2072 + if ((p = timer->prev) != NULL) p->next = timer->next;
2073 + if ((p = timer->next) != NULL) p->prev = timer->prev;
2074 + ret = timer->next != 0 || timer->prev != 0;
2075 + timer->next = NULL;
2076 + timer->prev = NULL;
2080 +void run_timers() {
2081 + struct timer_list *p;
2084 + while (p != NULL) {
2085 + if (p->expires < jiffies) {
2086 + del_timer(p); /* XXX make nonstatic member */
2087 + (*p->function)(p->data);
2096 + * Allocate memory. This is reusable.
2098 +void mem_init(struct mem *t, char *begin, char *limit)
2105 +void mem_fini(struct mem *t)
2110 +void *mem_alloc(struct mem *t, int size, int align)
2114 + p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));
2115 + if (p >= t->uplim || p + size > t->uplim) return 0;
2116 + t->curp = p + size;
2120 +void *mem_zalloc(struct mem *t, int size, int align)
2124 + if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);
2129 + * Library functions
2131 +void *memset(void *s, int c, size_t len)
2142 +void bcopy(const void *f, void *t, int len) {
2144 + *(char *)t = *(char *)f;
2150 +/* Comparison is 7-bit */
2151 +int bcmp(const void *s1, const void *s2, int len)
2158 + i = ch - *(char *)s2;
2169 +int strlen(const char *s) {
2171 + for (p = s; *p != 0; p++) { }
2175 +extern void *printk_fn;
2177 +void printk(char *fmt, ...)
2181 + void (*write)(void *, char *, int);
2183 + extern void prf(struct prf_fp *, char *fmt, va_list adx);
2186 + va_start(x1, fmt);
2188 + prfa.write = printk_fn;
2189 + prf(&prfa, fmt, x1);
2200 + * Get the highest bit number from the mask.
2202 +int highc(int mask, int size)
2207 + while (size != 0) {
2210 + if (m1 & mask) break;
2217 +unsigned int ld_bp_swap(unsigned int ptr) {
2219 + n = ld_bypass(ptr);
2220 + n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
2224 +void st_bp_swap(unsigned int ptr, unsigned int n) {
2225 + n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
2226 + st_bypass(ptr, n);
2228 diff -ruN proll_18.orig/src/arp.c proll-patch-15/src/arp.c
2229 --- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000
2230 +++ proll-patch-15/src/arp.c 2005-08-14 10:10:11.000000000 +0000
2233 static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */
2234 static int next_arp; /* next table entry */
2235 -static t_ipaddr def_gw = IP_ANY; /* default routing */
2236 +static t_ipaddr def_gw; /* default routing */
2240 @@ -100,10 +100,7 @@
2242 * ARP receiver routine
2244 -static int arp_recv(buf, bufsize, addr)
2245 -unsigned char *buf;
2247 -unsigned char *addr;
2248 +static int arp_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr)
2250 register struct arphdr *ahp = (struct arphdr *)buf;
2254 * Resolve IP address and return pointer to hardware address.
2256 -unsigned char *ip_resolve(ip)
2257 +const unsigned char *ip_resolve(ip)
2261 @@ -230,14 +227,11 @@
2265 - /* Set name of module for error messages */
2266 - net_module_name = "arp";
2269 /* Register ARP packet type and set send buffer pointer */
2270 if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL)
2277 diff -ruN proll_18.orig/src/arp.h proll-patch-15/src/arp.h
2278 --- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000
2279 +++ proll-patch-15/src/arp.h 2004-11-13 15:50:49.000000000 +0000
2281 extern int init_arp __P((void));
2283 /* Resolve IP address and return pointer to hardware address */
2284 -extern unsigned char *ip_resolve __P((t_ipaddr ip));
2285 +extern const unsigned char *ip_resolve __P((t_ipaddr ip));
2287 /* Add a new antry to the ARP cache */
2288 extern void addcache __P((unsigned char *ha, t_ipaddr ip));
2289 diff -ruN proll_18.orig/src/bootp.c proll-patch-15/src/bootp.c
2290 --- proll_18.orig/src/bootp.c 1999-12-15 17:20:30.000000000 +0000
2291 +++ proll-patch-15/src/bootp.c 2005-08-14 10:16:09.000000000 +0000
2294 boot_xid = get_ticks() + random();
2296 - i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout, CHR_ESC);
2297 + i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout);
2298 if (i < 0) { /* user pressed ESC */
2299 printf("\nAborted\n");
2301 diff -ruN proll_18.orig/src/esp.c proll-patch-15/src/esp.c
2302 --- proll_18.orig/src/esp.c 1970-01-01 00:00:00.000000000 +0000
2303 +++ proll-patch-15/src/esp.c 2005-08-15 18:42:46.000000000 +0000
2305 +#include <system.h> /* == <asm/system.h> */
2306 +#include <general.h> /* __P for netpriv.h */
2307 +#include <dma.h> /* dmaga */
2308 +#include <romlib.h>
2310 +#define PHYS_JJ_ESPDMA 0x78400000 /* ESP DMA controller */
2311 +#define PHYS_JJ_ESP 0x78800000 /* ESP SCSI */
2312 +#define PHYS_JJ_ESP_IRQ 4
2313 +#define BUFSIZE 4096
2318 + struct sparc_dma_registers *regs;
2319 + enum dvma_rev revision;
2323 + unsigned int regs[16];
2326 +struct esp_private {
2327 + int active; /* initialized */
2328 + int inst; /* iface number */
2330 + volatile struct esp_regs *ll;
2331 + __u32 buffer_dvma;
2332 + unsigned int irq; /* device IRQ number */
2335 + struct esp_dma *espdma; /* If set this points to espdma */
2337 + unsigned char *buffer;
2338 + struct disk_info {
2339 + unsigned int hw_sector;
2340 + unsigned int part_offset[8];
2344 +static void esp_interrupt(void *dev_id)
2346 + struct esp_private *lp = (struct esp_private *)dev_id;
2348 + lp->interrupt = 1;
2349 + /* Acknowledge all the interrupt sources ASAP */
2351 + lp->interrupt = 0;
2354 +static int esp_open (void *dev)
2356 + struct esp_private *lp = (struct esp_private *)dev;
2359 + if (request_irq(lp->irq, &esp_interrupt, (void *)dev)) {
2360 + printk ("Esp: Can't get irq %d\n", lp->irq);
2364 + /* On the 4m, setup the espdma to provide the upper bits for buffers */
2366 + lp->espdma->regs->dma_test = ((__u32) lp->buffer_dvma) & 0xff000000;
2371 +static int esp_close (void *dev)
2373 + struct esp_private *lp = (struct esp_private *)dev;
2375 + free_irq (lp->irq, (void *) dev);
2380 +esp_init(struct esp_private *esp, struct esp_dma *espdma, int irq)
2382 + volatile struct esp_regs *ll;
2384 + /* Get the IO region */
2385 + ll = map_io(PHYS_JJ_ESP, sizeof (struct esp_regs));
2386 + if (ll == 0) return -1;
2388 + esp->buffer = dvma_alloc(BUFSIZE, &esp->buffer_dvma);
2390 + esp->espdma = espdma;
2394 + stb_bypass((int)ll + 3*2, 2);
2398 +static int espdma_init(struct esp_dma *espdma)
2402 + /* Hardcode everything for MrCoffee. */
2403 + if ((p = map_io(PHYS_JJ_ESPDMA, 0x10)) == 0) {
2404 + printk("espdma_init: cannot map registers\n");
2411 + switch((espdma->regs->cond_reg)&DMA_DEVICE_ID) {
2413 + espdma->revision=dvmarev0;
2414 + printk("Revision 0 ");
2417 + espdma->revision=dvmaesc1;
2418 + printk("ESC Revision 1 ");
2421 + espdma->revision=dvmarev1;
2422 + printk("Revision 1 ");
2425 + espdma->revision=dvmarev2;
2426 + printk("Revision 2 ");
2429 + espdma->revision=dvmahme;
2430 + printk("HME DVMA gate array ");
2432 + case DMA_VERSPLUS:
2433 + espdma->revision=dvmarevplus;
2434 + printk("Revision 1 PLUS ");
2437 + printk("unknown dma version %x",
2438 + (espdma->regs->cond_reg)&DMA_DEVICE_ID);
2439 + /* espdma->allocated = 1; */
2446 +static struct esp_dma espdma0;
2447 +static struct esp_private esp;
2449 + * Find all the esp cards on the system and initialize them
2453 + if (espdma_init(&espdma0) != 0) {
2457 + if (esp_init(&esp, &espdma0, PHYS_JJ_ESP_IRQ) != 0) {
2458 + printk("esp_probe: esp0 init failed\n");
2464 +void esp_read_capacity(int unit)
2466 + // Set SCSI target
2467 + stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);
2468 + // Set DMA address
2469 + st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);
2471 + stb_bypass(PHYS_JJ_ESP + 0*4, 10);
2472 + stb_bypass(PHYS_JJ_ESP + 1*4, 0);
2473 + // Set DMA direction
2474 + st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);
2475 + // Setup command = Read Capacity
2476 + esp.buffer[0] = 0x80;
2477 + esp.buffer[1] = 0x25;
2478 + esp.buffer[2] = 0x00;
2479 + esp.buffer[3] = 0x00;
2480 + esp.buffer[4] = 0x00;
2481 + esp.buffer[5] = 0x00;
2482 + esp.buffer[6] = 0x00;
2483 + esp.buffer[7] = 0x00;
2484 + esp.buffer[8] = 0x00;
2485 + esp.buffer[9] = 0x00;
2486 + esp.buffer[10] = 0x00;
2487 + // Set ATN, issue command
2488 + stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2);
2490 + // Set DMA length = 512 * read length
2491 + stb_bypass(PHYS_JJ_ESP + 0*4, 0);
2492 + stb_bypass(PHYS_JJ_ESP + 1*4, 8 & 0xff);
2493 + // Set DMA direction
2494 + st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);
2496 + stb_bypass(PHYS_JJ_ESP + 3*4, 0x90);
2497 + esp.disk[unit].hw_sector = (esp.buffer[4] << 24) | (esp.buffer[5] << 16) | (esp.buffer[6] << 8) | esp.buffer[7];
2500 +// offset is multiple of 512, len in bytes
2501 +void *esp_read(int unit, int part, int offset, short len)
2503 + int pos, hw_sect, sect_offset, spb;
2505 + // Set SCSI target
2506 + stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);
2507 + // Set DMA address
2508 + st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);
2510 + stb_bypass(PHYS_JJ_ESP + 0*4, 10);
2511 + stb_bypass(PHYS_JJ_ESP + 1*4, 0);
2512 + // Set DMA direction
2513 + st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);
2514 + hw_sect = esp.disk[unit].hw_sector;
2515 + offset += esp.disk[unit].part_offset[part];
2516 + spb = hw_sect / 512;
2517 + sect_offset = offset / spb;
2518 + pos = (offset - sect_offset * spb) * 512;
2520 + //printk("Read unit %d, offset %d -> offset %d, pos %d, hw_sect %d\n", unit, offset, sect_offset, pos, hw_sect);
2521 + // Setup command = Read(10)
2522 + esp.buffer[0] = 0x80;
2523 + esp.buffer[1] = 0x28;
2524 + esp.buffer[2] = 0x00;
2525 + esp.buffer[3] = (sect_offset >> 24) & 0xff;
2526 + esp.buffer[4] = (sect_offset >> 16) & 0xff;
2527 + esp.buffer[5] = (sect_offset >> 8) & 0xff;
2528 + esp.buffer[6] = sect_offset & 0xff;
2529 + esp.buffer[7] = 0x00;
2530 + esp.buffer[8] = (len >> 8) & 0xff;
2531 + esp.buffer[9] = len & 0xff;
2532 + // Set ATN, issue command
2533 + stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2);
2535 + // Set DMA length = sector size * read length
2536 + stb_bypass(PHYS_JJ_ESP + 0*4, (len * hw_sect) & 0xff);
2537 + stb_bypass(PHYS_JJ_ESP + 1*4, ((len * hw_sect) >> 8) & 0xff);
2538 + // Set DMA direction
2539 + st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);
2541 + stb_bypass(PHYS_JJ_ESP + 3*4, 0x90);
2542 + return esp.buffer + pos;
2545 +// Sparc boot sequence can be found in SILO docs,
2546 +// first-isofs/README.SILO_ISOFS
2547 +int esp_boot(int unit)
2549 + struct sun_disklabel {
2550 + unsigned char info[128]; /* Informative text string */
2551 + unsigned char spare0[14];
2553 + unsigned char spare1;
2555 + unsigned char spare2;
2556 + unsigned char flags;
2558 + unsigned char spare[246]; /* Boot information etc. */
2559 + short rspeed; /* Disk rotational speed */
2560 + short pcylcount; /* Physical cylinder count */
2561 + short sparecyl; /* extra sects per cylinder */
2562 + unsigned char spare2[4]; /* More magic... */
2563 + short ilfact; /* Interleave factor */
2564 + short ncyl; /* Data cylinder count */
2565 + short nacyl; /* Alt. cylinder count */
2566 + short ntrks; /* Tracks per cylinder */
2567 + short nsect; /* Sectors per track */
2568 + unsigned char spare3[4]; /* Even more magic... */
2569 + struct sun_partition {
2570 + int start_cylinder;
2573 + short magic; /* Magic number */
2574 + short csum; /* Label xor'd checksum */
2576 + unsigned int i, offset;
2579 + printk("Loading partition table from target %d:\n", unit);
2581 + stb_bypass(PHYS_JJ_ESP + 3*4, 2);
2584 + esp_read_capacity(unit);
2586 + label = esp_read(unit, 0, 0, 512);
2587 + printk("hw sector: %d, CHS: %d/%d/%d, partitions:\n", esp.disk[unit].hw_sector,
2588 + label->ncyl, label->ntrks, label->nsect);
2589 + for (i = 0; i < 8; i++) {
2590 + printk("%c: %d + %d, id %x, flags %x\n", 'a' + i, label->partitions[i].start_cylinder,
2591 + label->partitions[i].num_sectors, label->infos[i].id, label->infos[i].flags);
2592 + esp.disk[unit].part_offset[i] = label->partitions[3].start_cylinder * label->ntrks * label->nsect;
2595 + printk("booting sd(0,%d,0):d (offset %d)\n", unit, offset);
2596 + // Skip a.out header (0x20)
2597 + dst = (void *)0x4000;
2598 + src = esp_read(unit, 3, offset, 512);
2599 + src = (void *)((unsigned int) src + 0x20);
2600 + memcpy(dst, src, 512 - 0x20);
2601 + dst = (void *)0x4000 + 512 - 0x20;
2602 + for (i = 1; i < 7680/512; i++) {
2603 + src = esp_read(unit, 3, offset + i, 512);
2604 + memcpy(dst, src, 512);
2610 diff -ruN proll_18.orig/src/hconsole.c proll-patch-15/src/hconsole.c
2611 --- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000
2612 +++ proll-patch-15/src/hconsole.c 2005-11-09 18:46:34.000000000 +0000
2614 struct raster r_master; /* For a case of resize, whole fb */
2615 struct raster r_0; /* malloc() erzatz */
2618 +extern unsigned int q_height, q_width;
2621 int hcon_init(struct hconsole *t, unsigned int a0)
2623 struct raster *q, *r;
2625 * No probing sequence or argument passing, hardcode everything. XXX
2627 raster8_cons_a(q, 768, 1024, (char *)a0);
2629 raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80));
2631 + raster_cons_2(r, q, 0, 0, q_height, q_width);
2640 -void hcon_fini (struct hconsole *t)
2641 +void hcon_fini (__attribute((unused)) struct hconsole *t)
2647 struct rfont *f = t->f_;
2649 - if (sy < 0 || sy >= t->ydim_) return -1;
2650 - if (sx < 0 || sx >= t->xdim_) return -1;
2651 + if (sy < 0 || (unsigned)sy >= t->ydim_) return -1;
2652 + if (sx < 0 || (unsigned)sx >= t->xdim_) return -1;
2653 if (height < 0) return -1;
2654 - if (sy + height > t->ydim_) height = t->ydim_ - sy;
2655 + if ((unsigned)sy + (unsigned)height > t->ydim_) height = t->ydim_ - sy;
2656 if (width < 0) return -1;
2657 - if (sx + width > t->xdim_) width = t->xdim_ - sx;
2658 + if ((unsigned)sx + (unsigned)width > t->xdim_) width = t->xdim_ - sx;
2660 /* XXX Clear with correct background color */
2661 (*t->r_->clear_)(t->r_,
2662 @@ -107,10 +115,10 @@
2666 - if (y < 0 || y >= t->ydim_) return -1;
2667 - if (x < 0 || x >= t->xdim_) return -1;
2668 + if (y < 0 || (unsigned)y >= t->ydim_) return -1;
2669 + if (x < 0 || (unsigned)x >= t->xdim_) return -1;
2671 - if (t->curson_ && t->ypos_ == y && t->xpos_ == x) {
2672 + if (t->curson_ && t->ypos_ == (unsigned)y && t->xpos_ == (unsigned)x) {
2673 rfg = t->bg_; rbg = t->fg_;
2675 rfg = t->fg_; rbg = t->bg_;
2678 struct rfont *f = t->f_;
2680 - if (y < 0 || y >= t->ydim_) return -1;
2681 - if (x < 0 || x >= t->xdim_) return -1;
2682 - if (x + count >= t->xdim_) count = t->xdim_ - x;
2683 + if (y < 0 || (unsigned)y >= t->ydim_) return -1;
2684 + if (x < 0 || (unsigned)x >= t->xdim_) return -1;
2685 + if ((unsigned)x + (unsigned)count >= t->xdim_) count = t->xdim_ - x;
2687 (*t->r_->render_)(t->r_, y*f->height_, x*f->width_,
2688 s, count, t->bg_, t->fg_, f);
2693 - if (d < 0 || d >= t->ydim_) return -1;
2694 - if (b <= d || b > t->ydim_) return -1;
2695 + if (d < 0 || (unsigned)d >= t->ydim_) return -1;
2696 + if (b <= d || (unsigned)b > t->ydim_) return -1;
2697 if (d + count >= b) count = b - d;
2698 if (d + count >= b) count = b - d;
2699 (*t->r_->yscroll_)(t->r_,
2701 count*f->height_, raster_qwidth(t->r_),
2703 } else if (dir == SM_DOWN) {
2704 - if (d < 0 || d >= t->ydim_) return -1;
2705 - if (b <= d || b > t->ydim_) return -1;
2706 + if (d < 0 || (unsigned)d >= t->ydim_) return -1;
2707 + if (b <= d || (unsigned)b > t->ydim_) return -1;
2708 if (d + count >= b) count = b - d;
2709 (*t->r_->yscroll_)(t->r_,
2711 diff -ruN proll_18.orig/src/hme.c proll-patch-15/src/hme.c
2712 --- proll_18.orig/src/hme.c 2002-07-23 05:52:52.000000000 +0000
2713 +++ proll-patch-15/src/hme.c 2005-04-16 06:16:20.000000000 +0000
2714 @@ -655,10 +655,10 @@
2718 - __asm__ __volatile__("
2721 -" : /* no outputs */
2722 + __asm__ __volatile__(
2723 + "stwa %3, [%0] %2\n\t"
2724 + "stwa %4, [%1] %2\n\t"
2725 + : /* no outputs */
2726 : "r" (&rp->rx_addr), "r" (&rp->rx_flags),
2727 "i" (ASI_PL), "r" (addr), "r" (flags));
2729 @@ -667,10 +667,10 @@
2733 - __asm__ __volatile__("
2736 -" : /* no outputs */
2737 + __asm__ __volatile__(
2738 + "stwa %3, [%0] %2\n\t"
2739 + "stwa %4, [%1] %2\n\t"
2740 + : /* no outputs */
2741 : "r" (&tp->tx_addr), "r" (&tp->tx_flags),
2742 "i" (ASI_PL), "r" (addr), "r" (flags));
2744 @@ -2404,7 +2404,7 @@
2745 TXD(("[%d]", elem));
2746 this = &txbase[elem];
2748 - __asm__ __volatile__("lduwa [%1] %2, %0"
2749 + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
2751 : "r" (&this->tx_flags), "i" (ASI_PL));
2753 @@ -2447,7 +2447,7 @@
2755 this = &rxbase[elem];
2757 - __asm__ __volatile__("lduwa [%1] %2, %0"
2758 + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
2760 : "r" (&this->rx_flags), "i" (ASI_PL));
2762 @@ -2530,7 +2530,7 @@
2763 elem = NEXT_RX(elem);
2764 this = &rxbase[elem];
2766 - __asm__ __volatile__("lduwa [%1] %2, %0"
2767 + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
2769 : "r" (&this->rx_flags), "i" (ASI_PL));
2771 diff -ruN proll_18.orig/src/iommu.c proll-patch-15/src/iommu.c
2772 --- proll_18.orig/src/iommu.c 2002-07-23 05:52:49.000000000 +0000
2773 +++ proll-patch-15/src/iommu.c 2005-08-14 10:08:17.000000000 +0000
2775 unsigned int pa, ba;
2776 unsigned int npages;
2777 unsigned int mva, mpa;
2780 unsigned int *iopte;
2782 npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
2783 diff -ruN proll_18.orig/src/lat7_2.bm proll-patch-15/src/lat7_2.bm
2784 --- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000
2785 +++ proll-patch-15/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000
2787 #define lat7_2_width 128
2788 #define lat7_2_height 88
2789 -static unsigned char lat7_2_bits[] = {
2790 +static unsigned const char lat7_2_bits[] = {
2791 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2792 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18,
2793 0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02,
2794 diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch-15/src/lat7_2_swapped.bm
2795 --- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000
2796 +++ proll-patch-15/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000
2798 +#define lat7_2_width 128
2799 +#define lat7_2_height 88
2800 +static unsigned const char lat7_2_bits[] = {
2801 + 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
2802 + 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48,
2803 + 0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40,
2804 + 0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40,
2805 + 0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
2806 + 0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00,
2807 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00,
2808 + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10,
2809 + 0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04,
2810 + 0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,
2811 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00,
2812 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
2813 + 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
2814 + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00,
2815 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
2816 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2817 + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2818 + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2819 + 0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18,
2820 + 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18,
2821 + 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,
2822 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00,
2823 + 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
2824 + 0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60,
2825 + 0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36,
2826 + 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e,
2827 + 0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78,
2828 + 0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2829 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42,
2830 + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2831 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
2832 + 0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
2833 + 0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00,
2834 + 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
2835 + 0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18,
2836 + 0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2837 + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18,
2838 + 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18,
2839 + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c,
2840 + 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,
2841 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
2842 + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
2843 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
2844 + 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00,
2845 + 0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00,
2846 + 0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c,
2847 + 0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2848 + 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
2849 + 0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66,
2850 + 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66,
2851 + 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30,
2852 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c,
2853 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00,
2854 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00,
2855 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00,
2856 + 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
2857 + 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
2858 + 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2859 + 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e,
2860 + 0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66,
2861 + 0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66,
2862 + 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66,
2863 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c,
2864 + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00,
2865 + 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00,
2866 + 0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00,
2867 + 0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
2868 + 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e,
2869 + 0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c,
2870 + 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
2871 + 0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f,
2872 + 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e,
2873 + 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66,
2874 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60,
2875 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02,
2876 + 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00,
2877 + 0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00,
2878 + 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
2879 + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66,
2880 + 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,
2881 + 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c,
2882 + 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c,
2883 + 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30,
2884 + 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
2885 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02,
2886 + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00,
2887 + 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2888 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
2889 + 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2890 + 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60,
2891 + 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2892 + 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
2893 + 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
2894 + 0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78,
2895 + 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66,
2896 + 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66,
2897 + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00,
2898 + 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38,
2899 + 0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00,
2900 + 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
2901 + 0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,
2902 + 0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2903 + 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
2904 + 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66,
2905 + 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60,
2906 + 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06,
2907 + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c,
2908 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00,
2909 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00,
2910 + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00,
2911 + 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
2912 + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00,
2913 + 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18,
2914 + 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18,
2915 + 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c,
2916 + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00,
2917 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00,
2918 + 0x00, 0x00, 0x00, 0x00};
2919 diff -ruN proll_18.orig/src/le.c proll-patch-15/src/le.c
2920 --- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000
2921 +++ proll-patch-15/src/le.c 2005-04-16 06:16:20.000000000 +0000
2923 unsigned short rap; /* register address port */
2926 -int sparc_lance_debug = 2;
2928 /* The Lance uses 24 bit addresses */
2929 /* On the Sun4c the DVMA will provide the remaining bytes for us */
2930 /* On the Sun4m we have to instruct the ledma to provide them */
2932 /* Clear the slack of the packet, do I need this? */
2933 /* For a firewall its a good idea - AC */
2935 - bzero((char *) &ib->tx_buf [entry][skblen], len - skblen);
2936 + memset((char *) &ib->tx_buf [entry][skblen], 0, len - skblen);
2938 /* Now, give the packet to the lance */
2939 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);
2940 diff -ruN proll_18.orig/src/net.h proll-patch-15/src/net.h
2941 --- proll_18.orig/src/net.h 1999-12-15 17:20:17.000000000 +0000
2942 +++ proll-patch-15/src/net.h 2005-08-14 10:17:02.000000000 +0000
2944 extern int udp_open __P((t_ipaddr daddr, int source, int dest));
2946 /* Read from a UDP socket */
2947 -extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch));
2948 +extern int udp_read(char *buf, unsigned int bufsize, int timeout);
2950 /* Write to a UDP socket */
2951 extern int udp_write __P((char *buf, int writelen));
2952 diff -ruN proll_18.orig/src/netinit.c proll-patch-15/src/netinit.c
2953 --- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000
2954 +++ proll-patch-15/src/netinit.c 2004-11-13 15:50:49.000000000 +0000
2956 unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */
2957 t_ipaddr myipaddr; /* my own IP address */
2958 t_ipaddr mynetmask; /* my own netmask */
2959 - char *net_module_name; /* name of init module */
2960 t_ipaddr servaddr; /* IP of RARP&TFTP server */
2962 /* Broadcast hardware address */
2963 -unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
2964 +const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
2969 +/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
2972 + seed = (seed + 23968)*0x015A4E35 >> 1;
2973 + return seed & 0x7FFF;
2977 **************************************************************************
2978 @@ -104,10 +111,17 @@
2982 + /* Avoid data segment allocations */
2985 /* Initialize the different network layer modules */
2987 - if (!init_arp() || !init_udp()) {
2988 - printf("\nERROR: init_%s\n", net_module_name);
2989 + if (!init_arp()) {
2990 + printf("\nERROR: init_arp\n");
2993 + if (!init_udp()) {
2994 + printf("\nERROR: init_udp\n");
2998 diff -ruN proll_18.orig/src/netpriv.h proll-patch-15/src/netpriv.h
2999 --- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000
3000 +++ proll-patch-15/src/netpriv.h 2005-08-14 10:12:20.000000000 +0000
3008 unsigned char ip_summed;
3010 @@ -130,10 +130,9 @@
3013 extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address */
3014 -extern unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
3015 +extern const unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
3016 extern t_ipaddr myipaddr; /* my own IP address */
3017 extern t_ipaddr mynetmask; /* netmask for my network */
3018 -extern char *net_module_name; /* initialized module's name */
3019 extern t_ipaddr servaddr; /* server IP address */
3023 extern unsigned char *reg_type __P((int typeval, int (* receive)()));
3025 /* Write a packet to the network */
3026 -extern int write_packet __P((int bufsize, int typeval, unsigned char *addr));
3027 +extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr));
3029 /* Empty read buffer */
3030 extern void empty_buf __P((void));
3031 diff -ruN proll_18.orig/src/openprom.h proll-patch-15/src/openprom.h
3032 --- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000
3033 +++ proll-patch-15/src/openprom.h 2005-05-13 16:23:14.000000000 +0000
3037 struct linux_mem_v0 {
3038 - struct linux_mlist_v0 **v0_totphys;
3039 - struct linux_mlist_v0 **v0_prommap;
3040 - struct linux_mlist_v0 **v0_available; /* What we can use */
3041 + struct linux_mlist_v0 * const *v0_totphys;
3042 + struct linux_mlist_v0 * const *v0_prommap;
3043 + struct linux_mlist_v0 * const *v0_available; /* What we can use */
3046 /* Arguments sent to the kernel from the boot prompt. */
3047 struct linux_arguments_v0 {
3049 + const char *argv[8];
3055 - char *kernel_file_name;
3056 + const char *kernel_file_name;
3057 void *aieee1; /* XXX */
3060 /* V2 and up boot things. */
3061 struct linux_bootargs_v2 {
3066 + const char **bootpath;
3067 + const char **bootargs;
3068 + const int *fd_stdin;
3069 + const int *fd_stdout;
3072 /* The top level PROM vector. */
3074 struct linux_mem_v0 pv_v0mem;
3076 /* Node operations. */
3077 - struct linux_nodeops *pv_nodeops;
3078 + const struct linux_nodeops *pv_nodeops;
3081 struct linux_dev_v0_funcs pv_v0devops;
3085 + const char *pv_stdin;
3086 + const char *pv_stdout;
3087 #define PROMDEV_KBD 0 /* input from keyboard */
3088 #define PROMDEV_SCREEN 0 /* output to screen */
3089 #define PROMDEV_TTYA 1 /* in/out to ttya */
3091 void (*v2_eval)(char *str);
3094 - struct linux_arguments_v0 **pv_v0bootargs;
3095 + const struct linux_arguments_v0 * const *pv_v0bootargs;
3097 /* Get ether address. */
3098 unsigned int (*pv_enaddr)(int d, char *enaddr);
3100 int (*no_proplen)(int node, char *name);
3101 int (*no_getprop)(int node, char *name, char *val);
3102 int (*no_setprop)(int node, char *name, char *val, int len);
3103 - char * (*no_nextprop)(int node, char *name);
3104 + const char * (*no_nextprop)(int node, char *name);
3107 /* More fun PROM structures for device probing. */
3108 diff -ruN proll_18.orig/src/packet.c proll-patch-15/src/packet.c
3109 --- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000
3110 +++ proll-patch-15/src/packet.c 2005-08-14 10:12:49.000000000 +0000
3114 static struct sk_buff *rskb;
3115 -static int nqskb = 0;
3121 for (i = 0; i < MAXSKBS; i++) {
3122 skev[i].skb.allocn = i;
3128 unsigned char *reg_type(int ptype, int (*func)())
3133 -int write_packet(int leng, int type, unsigned char *dst)
3134 +int write_packet(int leng, int type, const unsigned char *dst)
3136 struct sk_buff *skb;
3138 @@ -209,12 +211,12 @@
3142 -eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, int base)
3143 +eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, __attribute__((unused)) int base)
3145 bcopy(src, dest->data, len);
3148 -unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev)
3149 +unsigned short eth_type_trans(struct sk_buff *skb, __attribute__((unused)) struct device *dev)
3151 unsigned char *s = skb->data + 12;
3152 return s[0] << 8 | s[1]; /* Network order word */
3153 diff -ruN proll_18.orig/src/printf.c proll-patch-15/src/printf.c
3154 --- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000
3155 +++ proll-patch-15/src/printf.c 2005-08-14 10:07:26.000000000 +0000
3157 static void printn(struct prf_fp *, unsigned long, unsigned int);
3158 static void putchar(char, struct prf_fp *);
3160 -static char hextab[] = "0123456789ABCDEF";
3161 +static const char hextab[] = "0123456789ABCDEF";
3164 * Scaled down version of C Library printf.
3167 prf(struct prf_fp *filog, char *fmt, va_list adx)
3175 putchar(va_arg(adx,unsigned), filog);
3176 } else if(c == 's') {
3177 s = va_arg(adx,char*);
3181 } else if (c == 'l' || c == 'O') {
3182 printn(filog, (long)va_arg(adx,long), c=='l'?10:8);
3187 - if (b == 10 && n < 0) {
3188 - putchar('-',filog);
3189 - n = (~n) + 1; /* n = -n */
3193 *cp++ = hextab[(unsigned int)(n%b)];
3194 diff -ruN proll_18.orig/src/rconsole.c proll-patch-15/src/rconsole.c
3195 --- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000
3196 +++ proll-patch-15/src/rconsole.c 2005-08-14 10:25:53.000000000 +0000
3198 * move to California. Only plain lat7 survived.
3199 * I recreated lat7-1 changes in lat7-2. --zaitcev
3202 #include "lat7_2.bm" /* lat7_1.bm */
3204 +#include "lat7_2_swapped.bm" /* lat7_1.bm */
3206 #define LAT7_NCHARS 128
3207 #define LAT7_HEIGHT 11
3208 #define LAT7_WIDTH 8
3211 static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ];
3219 static __inline__ void stfb_w(void *ptr, unsigned int data) {
3220 - __asm__ __volatile__ ("sta %0, [%1] %2" : :
3221 + __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
3222 "r" (data), "r" (ptr), "i" (ASI_M_BYPASS));
3225 static __inline__ void stfb_b(void *ptr, unsigned int data) {
3226 - __asm__ __volatile__ ("stba %0, [%1] %2" : :
3227 + __asm__ __volatile__ ("stba %0, [%1] %2\n\t" : :
3228 "r" (data), "r" (ptr), "i" (ASI_M_BYPASS));
3231 static __inline__ unsigned int ldfb_w(void *ptr) {
3233 - __asm__ __volatile__ ("lda [%1] %2, %0" :
3234 + __asm__ __volatile__ ("lda [%1] %2, %0\n\t" :
3236 "r" (ptr), "i" (ASI_M_BYPASS));
3240 static __inline__ unsigned int ldfb_b(void *ptr) {
3242 - __asm__ __volatile__ ("lduba [%1] %2, %0" :
3243 + __asm__ __volatile__ ("lduba [%1] %2, %0\n\t" :
3245 "r" (ptr), "i" (ASI_M_BYPASS));
3252 static inline int swapbits(int w0)
3255 @@ -105,13 +112,16 @@
3261 void font_cons_7(struct rfont *p)
3269 for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) {
3270 lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] =
3271 swapbits(lat7_2_bits[x]) & 0xFF;
3275 p->body_ = lat7_body;
3277 + p->body_ = lat7_2_bits;
3279 p->nchars_ = LAT7_NCHARS;
3280 p->width_ = LAT7_WIDTH;
3281 p->height_ = LAT7_HEIGHT;
3283 r->render_ = p->render_;
3286 -void raster_dest(struct raster *r)
3287 +void raster_dest(__attribute((unused)) struct raster *r)
3291 diff -ruN proll_18.orig/src/rconsole.h proll-patch-15/src/rconsole.h
3292 --- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000
3293 +++ proll-patch-15/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000
3297 #define RF_MAXWIDTH 16
3298 -typedef unsigned short Rf_scan; /* __w16 to be used */
3299 +typedef unsigned char Rf_scan; /* __w16 to be used */
3303 + const Rf_scan *body_;
3304 int nchars_; /* 128 for ASCII ... 65536 for Unicode */
3305 int width_; /* [Pixels]. Maximum size is 16. */
3306 int height_; /* [Pixels == scan lines]. */
3307 diff -ruN proll_18.orig/src/romlib.h proll-patch-15/src/romlib.h
3308 --- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000
3309 +++ proll-patch-15/src/romlib.h 2005-04-16 20:32:49.000000000 +0000
3312 #define memcpy(dst, src, len) bcopy(src, dst, len)
3313 #define memcmp(x1, x2, len) bcmp(x1, x2, len)
3314 -#define memset(p, len, zero) bzero(p, len)
3315 -extern void bcopy(void *b1, void *b2, int length);
3316 -extern int bcmp(void *b1, void *b2, int length);
3317 -extern void bzero(void *b, int c);
3318 +extern void bcopy(const void *b1, void *b2, int length);
3319 +extern int bcmp(const void *b1, const void *b2, int length);
3320 +typedef unsigned int size_t;
3321 +extern void *memset(void *p, int c, size_t len);
3322 /* gcc complains about "conflicting types for builtin function strlen". */
3323 #define strlen(s) ssize(s)
3324 -extern int ssize(char *s);
3325 +extern int ssize(const char *s);
3329 diff -ruN proll_18.orig/src/sched_4m.c proll-patch-15/src/sched_4m.c
3330 --- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000
3331 +++ proll-patch-15/src/sched_4m.c 2005-08-14 10:18:14.000000000 +0000
3333 static int set_bolt; /* Tick counter limit */
3334 static struct handsc hndv[16];
3336 -static unsigned int intr_to_mask[16] = {
3337 +static unsigned const int intr_to_mask[16] = {
3338 0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0,
3339 0, 0, 0, 0, 0, 0, 0, 0,
3342 int /* 0 - not expired yet; <>0 - timer expired */
3345 - int lim = (((1000000/HZ) + 1) << 10);
3346 + unsigned int lim = (((1000000/HZ) + 1) << 10);
3351 struct handsc *hndp;
3354 - if (irq < 0 || irq >= 16) {
3355 + if (irq == 0 || irq >= 16) {
3356 printk("request_irq: bad irq %d\n", irq);
3361 struct handsc *hndp;
3363 - if (irq < 0 || irq >= 16) {
3364 + if (irq == 0 || irq >= 16) {
3365 printk("free_irq: bad irq %d\n", irq);
3368 diff -ruN proll_18.orig/src/swap.c proll-patch-15/src/swap.c
3369 --- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000
3370 +++ proll-patch-15/src/swap.c 2004-11-13 15:50:49.000000000 +0000
3372 +// Convert the lat7 font so that no conversion is needed at runtime.
3374 +#include "rconsole.c"
3386 + for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) {
3387 + printf("0x%02x, ", p.body_[i]);
3388 + if ((i % 12) == 11)
3393 diff -ruN proll_18.orig/src/system.c proll-patch-15/src/system.c
3394 --- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000
3395 +++ proll-patch-15/src/system.c 2005-04-16 06:16:20.000000000 +0000
3399 /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
3401 - for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) {
3403 + for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
3404 map_page(l1, va, pa, 0, highbase);
3407 @@ -507,30 +507,44 @@
3411 - if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size);
3412 + if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);
3419 -void bzero(void *s, int len) {
3420 - while (len--) *((char *)s)++ = 0;
3421 +void *memset(void *s, int c, size_t len)
3432 -void bcopy(void *f, void *t, int len) {
3433 - while (len--) *((char *)t)++ = *((char *)f)++;
3434 +void bcopy(const void *f, void *t, int len) {
3436 + *(char *)t = *(char *)f;
3442 /* Comparison is 7-bit */
3443 -int bcmp(void *s1, void *s2, int len)
3444 +int bcmp(const void *s1, const void *s2, int len)
3450 - ch = *((char *)s1)++;
3451 - if ((i = ch - *((char *)s2)++) != 0)
3453 + i = ch - *(char *)s2;
3464 -int strlen(char *s) {
3466 +int strlen(const char *s) {
3468 for (p = s; *p != 0; p++) { }
3471 @@ -560,14 +574,6 @@
3475 -/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
3478 - static unsigned int seed = 151;
3479 - seed = (seed + 23968)*0x015A4E35 >> 1;
3480 - return seed & 0x7FFF;
3486 diff -ruN proll_18.orig/src/system.h proll-patch-15/src/system.h
3487 --- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000
3488 +++ proll-patch-15/src/system.h 2005-04-16 06:16:20.000000000 +0000
3490 #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */
3491 #define NCTX_SWIFT 0x100
3493 -#define MAX_BANKS 3 /* Allocation for all machines */
3494 +#define MAX_BANKS 8 /* Allocation for all machines */
3496 #ifndef __ASSEMBLY__
3498 @@ -164,10 +164,10 @@
3500 extern __inline__ void setipl(unsigned long __orig_psr)
3502 - __asm__ __volatile__("
3505 -" : /* no outputs */
3506 + __asm__ __volatile__(
3507 + "wr %0, 0x0, %%psr\n\t"
3508 + "nop; nop; nop\n\t"
3509 + : /* no outputs */
3513 @@ -176,13 +176,13 @@
3517 - __asm__ __volatile__("
3519 - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
3524 + __asm__ __volatile__(
3525 + "rd %%psr, %0\n\t"
3526 + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
3527 + "or %0, %1, %0\n\t"
3528 + "wr %0, 0x0, %%psr\n\t"
3529 + "nop; nop; nop\n\t"
3534 @@ -191,13 +191,13 @@
3538 - __asm__ __volatile__("
3540 - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
3545 + __asm__ __volatile__(
3546 + "rd %%psr, %0\n\t"
3547 + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
3548 + "andn %0, %1, %0\n\t"
3549 + "wr %0, 0x0, %%psr\n\t"
3550 + "nop; nop; nop\n\t"
3555 @@ -214,18 +214,18 @@
3557 unsigned long retval;
3559 - __asm__ __volatile__("
3561 - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
3564 - xorcc %%g1, %%g2, %%g0
3571 + __asm__ __volatile__(
3572 + "rd %%psr, %0\n\t"
3573 + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
3574 + "and %0, %2, %%g1\n\t"
3575 + "and %1, %2, %%g2\n\t"
3576 + "xorcc %%g1, %%g2, %%g0\n\t"
3579 + "wr %0, %2, %%psr\n\t"
3580 + "nop; nop; nop;\n\t"
3583 : "r" (__new_psr), "i" (PSR_PIL)
3584 : "g1", "g2", "memory", "cc");
3586 @@ -236,13 +236,13 @@
3588 unsigned long retval;
3590 - __asm__ __volatile__("
3592 - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
3594 - wr %%g1, 0x0, %%psr
3597 + __asm__ __volatile__(
3598 + "rd %%psr, %0\n\t"
3599 + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
3600 + "or %0, %1, %%g1\n\t"
3601 + "wr %%g1, 0x0, %%psr\n\t"
3602 + "nop; nop; nop\n\t"
3607 diff -ruN proll_18.orig/src/tftp.c proll-patch-15/src/tftp.c
3608 --- proll_18.orig/src/tftp.c 2002-09-13 21:53:34.000000000 +0000
3609 +++ proll-patch-15/src/tftp.c 2005-08-14 10:16:15.000000000 +0000
3613 /* Read packet with timeout */
3614 - len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT, CHR_ESC);
3615 + len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT);
3617 printf("TFTP: Timeout\n");
3618 return(ERR_TIMEOUT);
3619 diff -ruN proll_18.orig/src/udp.c proll-patch-15/src/udp.c
3620 --- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000
3621 +++ proll-patch-15/src/udp.c 2005-08-14 10:17:19.000000000 +0000
3624 * Open a new UDP socket.
3626 -int udp_open(daddr, source, dest)
3630 +int udp_open(t_ipaddr daddr, int source, int dest)
3632 - register unsigned char *addr;
3633 + const unsigned char *addr;
3635 /* Set global variables */
3637 @@ -101,16 +98,13 @@
3639 * IP receiver routine
3641 -static int ip_recv(buf, bufsize, addr)
3642 -unsigned char *buf;
3644 -unsigned char *addr;
3645 +static int ip_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr)
3647 struct iphdr *ipp = ((struct iphdr *)buf);
3648 struct udphdr *udpp = ((struct udphdr *)(buf + IP_MIN_HSIZE));
3649 struct udp_pseudo psehdr;
3652 + unsigned int size;
3656 @@ -194,13 +188,9 @@
3658 * Read one packet from a UDP socket
3660 -int udp_read(buf, bufsize, timeout, abortch)
3665 +int udp_read(char *buf, unsigned int bufsize, int timeout)
3670 /* Wait until we get something */
3671 set_timeout(timeout);
3676 - /* Set module name for error handling */
3677 - net_module_name = "udp";
3679 /* Register IP packet type and set write buffer pointer */
3680 if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL)
3682 diff -ruN proll_18.orig/src/udp.h proll-patch-15/src/udp.h
3683 --- proll_18.orig/src/udp.h 2001-12-24 05:12:34.000000000 +0000
3684 +++ proll-patch-15/src/udp.h 2005-08-14 10:16:40.000000000 +0000
3686 extern int udp_open __P((t_ipaddr daddr, int source, int dest));
3688 /* Read from a UDP socket */
3689 -extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch));
3690 +extern int udp_read(char *buf, unsigned int bufsize, int timeout);
3692 /* Write to a UDP socket */
3693 extern int udp_write __P((char *buf, int writelen));
3694 diff -ruN proll_18.orig/src/vcons_zs.c proll-patch-15/src/vcons_zs.c
3695 --- proll_18.orig/src/vcons_zs.c 1970-01-01 00:00:00.000000000 +0000
3696 +++ proll-patch-15/src/vcons_zs.c 2005-08-14 10:25:51.000000000 +0000
3699 + ** Console over 'zs' (Zilog serial port)
3700 + ** Copyright 1999 Pete Zaitcev
3701 + ** This code is licensed under GNU General Public License.
3704 +#include "vconsole.h"
3705 +#include <system.h>
3707 +#define ZS_DATA 0x02
3709 +int vcon_zs_init(struct vconterm *t, unsigned int a0)
3712 + t->impl = (void *) a0;
3714 + t->vc_x = 0; t->vc_y = 0;
3715 + t->backp = 0; t->backc = 0;
3717 + stb_bypass(a0, 3); // reg 3
3718 + stb_bypass(a0, 1); // enable rx
3720 + stb_bypass(a0, 5); // reg 5
3721 + stb_bypass(a0, 8); // enable tx
3726 +int vcon_zs_putch(struct vconterm *t, char c)
3728 + unsigned zs_ptr = (unsigned) t->impl;
3730 + //while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { }
3731 + stb_bypass(zs_ptr + ZS_DATA, c);
3735 +int vcon_zs_write(struct vconterm *t, char *data, int leng)
3737 + while (leng != 0) {
3739 + vcon_zs_putch(t, *data++);
3744 +int vcon_zs_read(struct vconterm *t, char *data, __attribute((unused)) int leng)
3746 + unsigned zs_ptr = (unsigned) t->impl;
3748 + while ((ldb_bypass(zs_ptr) & 1) != 1) { }
3749 + *data = ldb_bypass(zs_ptr + ZS_DATA);
3753 +int vcon_zs_getch(struct vconterm *t)
3755 + unsigned zs_ptr = (unsigned) t->impl;
3757 + while ((ldb_bypass(zs_ptr) & 1) != 1) { }
3758 + return ldb_bypass(zs_ptr + ZS_DATA) & 0xff;
3761 +void vcon_zs_fini(__attribute((unused)) struct vconterm *t)
3763 + /* violent crash in the end */
3766 diff -ruN proll_18.orig/src/vconsole.c proll-patch-15/src/vconsole.c
3767 --- proll_18.orig/src/vconsole.c 1999-11-08 03:10:28.000000000 +0000
3768 +++ proll-patch-15/src/vconsole.c 2005-08-14 10:24:49.000000000 +0000
3770 #include "vconsole.h"
3772 #include "hconsole.h"
3773 +#include <system.h>
3775 static void vcon_i_cursfeed(struct vconterm *t);
3776 static void vcon_i_backflush(struct vconterm *t);
3778 struct hconsole hcons0;
3780 +enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
3781 + EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
3784 int vcon_init(struct vconterm *t, unsigned int a0)
3786 struct hconsole *hconp;
3789 t->vc_x = 0; t->vc_y = 0;
3790 t->backp = 0; t->backc = 0;
3791 + t->vc_state = ESnormal;
3793 hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_);
3798 + * gotoxy() must verify all boundaries, because the arguments
3799 + * might also be negative. If the given position is out of
3800 + * bounds, the cursor is placed at the nearest margin.
3802 +static void gotoxy(struct vconterm *vc, int new_x, int new_y)
3805 + struct hconsole *hconp = vc->impl;
3807 + max_x = hcon_qxdim(hconp);
3808 + max_y = hcon_qydim(hconp);
3813 + if (new_x >= max_x)
3814 + vc->vc_x = max_x - 1;
3821 + else if (new_y >= max_y)
3822 + vc->vc_y = max_y - 1;
3828 +/* for absolute user moves, when decom is set */
3829 +static void gotoxay(struct vconterm *t, int new_x, int new_y)
3831 + gotoxy(t, new_x, new_y);
3834 int vcon_write(struct vconterm *t, char *data, int leng)
3837 @@ -40,29 +83,101 @@
3842 - case 0x07: /* Bell */
3843 - vcon_i_backflush(t);
3845 - case 0x0A: /* Linefeed */
3846 - vcon_i_backflush(t);
3847 - vcon_i_cursfeed(t);
3848 + switch(t->vc_state) {
3850 + t->vc_state = ESnormal;
3853 + t->vc_state = ESsquare;
3856 + hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
3859 + //printk("Unhandled escape code '%c'\n", c);
3863 - case 0x0D: /* Return */
3864 - vcon_i_backflush(t);
3867 + for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++)
3868 + t->vc_par[t->vc_npar] = 0;
3870 + t->vc_state = ESgetpars;
3872 + if (c==';' && t->vc_npar<NPAR-1) {
3875 + } else if (c>='0' && c<='9') {
3876 + t->vc_par[t->vc_npar] *= 10;
3877 + t->vc_par[t->vc_npar] += c-'0';
3879 + } else t->vc_state=ESgotpars;
3881 + t->vc_state = ESnormal;
3883 + case 'H': case 'f':
3884 + if (t->vc_par[0]) t->vc_par[0]--;
3885 + if (t->vc_par[1]) t->vc_par[1]--;
3886 + gotoxay(t, t->vc_par[1], t->vc_par[0]);
3889 + if (t->vc_par[0] == 0) {
3890 + //erase from cursor to end of display
3891 + hcon_clear(hconp, t->vc_y, t->vc_x, hconp->ydim_, hconp->xdim_);
3895 + hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
3901 + printk("Unhandled escape code '%c', par[%d, %d, %d, %d, %d]\n",
3902 + c, t->vc_par[0], t->vc_par[1], t->vc_par[2], t->vc_par[3], t->vc_par[4]);
3908 - if (t->backp == 0) {
3910 - t->backp = data-1;
3914 - if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
3915 + t->vc_state = ESnormal;
3917 + case 0x07: /* Bell */
3918 + vcon_i_backflush(t);
3920 + case 0x08: /* BS */
3921 + vcon_i_backflush(t);
3925 + case 0x0A: /* Linefeed */
3926 vcon_i_backflush(t);
3930 + case 0x0D: /* Return */
3931 + vcon_i_backflush(t);
3935 + vcon_i_backflush(t);
3936 + t->vc_state = ESnormal;
3939 + vcon_i_backflush(t);
3940 + t->vc_state = ESesc;
3943 + if (t->backp == 0) {
3945 + t->backp = data-1;
3949 + if ((unsigned int)t->vc_x + t->backc >= hcon_qxdim(hconp)) {
3950 + vcon_i_backflush(t);
3952 + vcon_i_cursfeed(t);
3958 static void vcon_i_cursfeed(struct vconterm *t) {
3959 struct hconsole *hconp = t->impl;
3961 - if (++t->vc_y >= hcon_qydim(hconp)) {
3962 + if ((unsigned int)++t->vc_y >= hcon_qydim(hconp)) {
3963 t->vc_y = hcon_qydim(hconp)-1;
3964 hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
3966 @@ -90,22 +205,75 @@
3967 t->backp = 0; t->backc = 0;
3970 -int vcon_putch(struct vconterm *t, char c)
3971 +int vcon_putch(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char c)
3976 -int vcon_read(struct vconterm *t, char *data, int leng)
3977 +int vcon_read(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char *data, __attribute__((unused)) int leng)
3982 -int vcon_getch(struct vconterm *t)
3983 +static const unsigned char sunkbd_keycode[128] = {
3984 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3985 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3986 + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 8,
3987 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
3988 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
3989 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3990 + 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '\\', 13,
3991 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3992 + 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
3993 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3997 +static const unsigned char sunkbd_keycode_shifted[128] = {
3998 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3999 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4000 + '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 8,
4001 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
4002 + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
4003 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4004 + 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '|', 13,
4005 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4006 + 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
4007 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4011 +static int shiftstate;
4013 +int vcon_getch(__attribute__((unused)) struct vconterm *t)
4018 + while ((ldb_bypass(0x71000004) & 1) != 1) { }
4020 + ch = ldb_bypass(0x71000006) & 0xff;
4023 + else if (ch == 110)
4025 + else if (ch == 227)
4027 + else if (ch == 238)
4029 + //printk("getch: %d\n", ch);
4031 + while ((ch & 0x80) == 0 || ch == 238 || ch == 227); // Wait for key release
4032 + //printk("getch rel: %d\n", ch);
4035 + ch = sunkbd_keycode_shifted[ch];
4037 + ch = sunkbd_keycode[ch];
4038 + //printk("getch xlate: %d\n", ch);
4042 -void vcon_fini(struct vconterm *t)
4043 +void vcon_fini(__attribute__((unused)) struct vconterm *t)
4045 /* violent crash in the end */
4047 diff -ruN proll_18.orig/src/vconsole.h proll-patch-15/src/vconsole.h
4048 --- proll_18.orig/src/vconsole.h 1999-11-08 00:58:13.000000000 +0000
4049 +++ proll-patch-15/src/vconsole.h 2005-03-02 12:40:12.000000000 +0000
4060 int backc; /* Same, count */
4062 int vc_x, vc_y; /* XXX Make vcon_xxx() to use cellmap->xpos_ */
4064 + unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
4067 int vcon_init(struct vconterm *t, unsigned int a0);