debuggers.hg
changeset 10997:06e2a95d3395
[qemu] Update ioemu to qemu 0.8.2.
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author | chris@kneesaa.uk.xensource.com |
---|---|
date | Mon Aug 07 18:27:27 2006 +0100 (2006-08-07) |
parents | 98fc8b05193c |
children | ec8dd0528fc6 |
files | tools/ioemu/pc-bios/proll.patch |
line diff
1.1 --- a/tools/ioemu/pc-bios/proll.patch Mon Aug 07 18:26:20 2006 +0100 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,4067 +0,0 @@ 1.4 -diff -ruN proll_18.orig/Makefile proll-patch-15/Makefile 1.5 ---- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000 1.6 -+++ proll-patch-15/Makefile 2005-11-09 18:14:51.000000000 +0000 1.7 -@@ -4,6 +4,7 @@ 1.8 - make -C krups-ser all 1.9 - make -C espresso all 1.10 - make -C espresso-ser all 1.11 -+ make -C qemu all 1.12 - 1.13 - clean: 1.14 - make -C mrcoffee clean 1.15 -@@ -11,3 +12,4 @@ 1.16 - make -C krups-ser clean 1.17 - make -C espresso clean 1.18 - make -C espresso-ser clean 1.19 -+ make -C qemu clean 1.20 -diff -ruN proll_18.orig/qemu/Makefile proll-patch-15/qemu/Makefile 1.21 ---- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000 1.22 -+++ proll-patch-15/qemu/Makefile 2005-08-14 10:25:06.000000000 +0000 1.23 -@@ -0,0 +1,123 @@ 1.24 -+# 1.25 -+# proll: 1.26 -+# qemu/Makefile - make PROLL for QEMU 1.27 -+# $Id: proll.patch,v 1.6 2005/11/11 00:24:57 bellard Exp $ 1.28 -+# 1.29 -+# Copyright 1999 Pete Zaitcev 1.30 -+# This is Free Software is licensed under terms of GNU General Public License. 1.31 -+# 1.32 -+ 1.33 -+CC = gcc 1.34 -+ 1.35 -+#CROSS = /usr/local/sparc/bin/sparc-sun-linux- 1.36 -+CROSS = sparc-unknown-linux-gnu- 1.37 -+ 1.38 -+CROSSCC = $(CROSS)gcc 1.39 -+CROSSLD = $(CROSS)ld 1.40 -+CROSSNM = $(CROSS)nm 1.41 -+ 1.42 -+RM = /bin/rm -f 1.43 -+ELFTOAOUT = elftoaout 1.44 -+ 1.45 -+# 1.46 -+SRC = ../src 1.47 -+ 1.48 -+# Due to remapping algorithm PROLBASE should be algned on PMD. 1.49 -+# We make PROLBASE a define instead of using _start because we 1.50 -+# want to shift it to form a PGD entry. A relocatable label will not work. 1.51 -+# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>. 1.52 -+PROLBASE = 0xffd00000 1.53 -+PROLRODATA = 0xffd08000 1.54 -+PROLDATA = 0xffd0b000 1.55 -+PROLSIZE = 240*1024 1.56 -+ 1.57 -+# Linux 1.58 -+# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6. 1.59 -+# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them. 1.60 -+# __ANSI__ is supposed to be on by default but it is not. 1.61 -+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 1.62 -+ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g -Wa,-xarch=v8 -Wa,-32 1.63 -+# Solaris or Linux/i386 cross compilation 1.64 -+#CFLAGS = -Iinclude -O 1.65 -+ 1.66 -+LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA) 1.67 -+ 1.68 -+ALL = proll.aout 1.69 -+PROLLEXE = proll.elf 1.70 -+ 1.71 -+OBJS = head.o wuf.o wof.o main.o $(CONSOLE) \ 1.72 -+ printf.o le.o system_qemu.o iommu.o \ 1.73 -+ arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o \ 1.74 -+ vconsole.o hconsole.o rconsole.o vcons_zs.o esp.o 1.75 -+ 1.76 -+all: $(ALL) 1.77 -+ 1.78 -+$(PROLLEXE): $(OBJS) 1.79 -+ $(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS) 1.80 -+ 1.81 -+head.o: head.S $(SRC)/phys_jj.h \ 1.82 -+ $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h 1.83 -+ $(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S 1.84 -+ 1.85 -+main.o: main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \ 1.86 -+ $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \ 1.87 -+ $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h 1.88 -+ $(CROSSCC) $(CFLAGS) -c $*.c 1.89 -+openprom.o: openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \ 1.90 -+ $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h 1.91 -+ $(CROSSCC) $(CFLAGS) -c $*.c 1.92 -+ 1.93 -+system_qemu.o: system_qemu.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \ 1.94 -+ $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \ 1.95 -+ $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h 1.96 -+ $(CROSSCC) $(CFLAGS) -c $*.c 1.97 -+iommu.o: $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \ 1.98 -+ $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h 1.99 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.100 -+vconsole.o: $(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h 1.101 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.102 -+vcons_zs.o: $(SRC)/vcons_zs.c $(SRC)/vconsole.h $(SRC)/system.h 1.103 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.104 -+hconsole.o: $(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h 1.105 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.106 -+rconsole.o: $(SRC)/rconsole.c $(SRC)/rconsole.h 1.107 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.108 -+printf.o: $(SRC)/printf.c 1.109 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.110 -+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 1.111 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.112 -+esp.o: $(SRC)/esp.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/phys_jj.h 1.113 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.114 -+arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h 1.115 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.116 -+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 1.117 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.118 -+tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h 1.119 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.120 -+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 1.121 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.122 -+packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h 1.123 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.124 -+sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h 1.125 -+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c 1.126 -+bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \ 1.127 -+ $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h 1.128 -+ $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c 1.129 -+ 1.130 -+wuf.o: $(SRC)/wuf.S 1.131 -+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S 1.132 -+wof.o: $(SRC)/wof.S 1.133 -+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S 1.134 -+ 1.135 -+#genlab.o: genlab.c 1.136 -+# $(CC) -c $*.c 1.137 -+# 1.138 -+#genlab: genlab.o 1.139 -+# $(CC) -o genlab genlab.o 1.140 -+ 1.141 -+clean: 1.142 -+ $(RM) $(OBJS) 1.143 -+ $(RM) $(PROLLEXE) proll.aout 1.144 -+ 1.145 -+proll.aout: $(PROLLEXE) 1.146 -+ $(ELFTOAOUT) -o proll.aout $(PROLLEXE) 1.147 -diff -ruN proll_18.orig/qemu/head.S proll-patch-15/qemu/head.S 1.148 ---- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000 1.149 -+++ proll-patch-15/qemu/head.S 2005-07-12 22:24:17.000000000 +0000 1.150 -@@ -0,0 +1,543 @@ 1.151 -+/** 1.152 -+ ** Standalone startup code for Linux PROM emulator. 1.153 -+ ** Copyright 1999 Pete A. Zaitcev 1.154 -+ ** This code is licensed under GNU General Public License. 1.155 -+ **/ 1.156 -+/* 1.157 -+ * $Id: proll.patch,v 1.6 2005/11/11 00:24:57 bellard Exp $ 1.158 -+ */ 1.159 -+ 1.160 -+#include <psr.h> 1.161 -+#include <asi.h> 1.162 -+#include <crs.h> 1.163 -+/* #include <asm/head.h> */ /* Trap entries. Do not use. */ 1.164 -+#include "phys_jj.h" 1.165 -+ 1.166 -+#define C_LABEL(name) name 1.167 -+#define REGWIN_SZ 0x40 1.168 -+ 1.169 -+#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */ 1.170 -+ 1.171 -+ /* 22 is 24-2, (va)>>(SRMMU_PGDIR_SHIFT-PTESIZESHFT) */ 1.172 -+#define VATOPGDOFF(va) (((va)>>22)&0x3FC) 1.173 -+#define VATOPMDOFF(va) (((va)>>16)&0xFC) 1.174 -+ 1.175 -+#define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */ 1.176 -+ 1.177 -+/* Here are some trap goodies */ 1.178 -+ 1.179 -+#if 0 1.180 -+/* Generic trap entry. */ 1.181 -+#define TRAP_ENTRY(type, label) \ 1.182 -+ rd %psr, %l0; b label; rd %wim, %l3; nop; 1.183 -+#endif 1.184 -+ 1.185 -+/* Data/text faults. */ 1.186 -+#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7; 1.187 -+#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7; 1.188 -+ 1.189 -+#if 0 1.190 -+/* This is for traps we should NEVER get. */ 1.191 -+#define BAD_TRAP(num) \ 1.192 -+ rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3; 1.193 -+ 1.194 -+/* This is for traps when we want just skip the instruction which caused it */ 1.195 -+#define SKIP_TRAP(type, name) \ 1.196 -+ jmpl %l2, %g0; rett %l2 + 4; nop; nop; 1.197 -+ 1.198 -+/* Notice that for the system calls we pull a trick. We load up a 1.199 -+ * different pointer to the system call vector table in %l7, but call 1.200 -+ * the same generic system call low-level entry point. The trap table 1.201 -+ * entry sequences are also HyperSparc pipeline friendly ;-) 1.202 -+ */ 1.203 -+ 1.204 -+/* Software trap for Linux system calls. */ 1.205 -+#define LINUX_SYSCALL_TRAP \ 1.206 -+ sethi %hi(C_LABEL(sys_call_table)), %l7; \ 1.207 -+ or %l7, %lo(C_LABEL(sys_call_table)), %l7; \ 1.208 -+ b linux_sparc_syscall; \ 1.209 -+ rd %psr, %l0; 1.210 -+ 1.211 -+/* Software trap for SunOS4.1.x system calls. */ 1.212 -+#define SUNOS_SYSCALL_TRAP \ 1.213 -+ rd %psr, %l0; \ 1.214 -+ sethi %hi(C_LABEL(sunos_sys_table)), %l7; \ 1.215 -+ b linux_sparc_syscall; \ 1.216 -+ or %l7, %lo(C_LABEL(sunos_sys_table)), %l7; 1.217 -+ 1.218 -+/* Software trap for Slowaris system calls. */ 1.219 -+#define SOLARIS_SYSCALL_TRAP \ 1.220 -+ b solaris_syscall; \ 1.221 -+ rd %psr, %l0; \ 1.222 -+ nop; \ 1.223 -+ nop; 1.224 -+ 1.225 -+#define INDIRECT_SOLARIS_SYSCALL(x) \ 1.226 -+ mov x, %g1; \ 1.227 -+ b solaris_syscall; \ 1.228 -+ rd %psr, %l0; \ 1.229 -+ nop; 1.230 -+ 1.231 -+#define BREAKPOINT_TRAP \ 1.232 -+ b breakpoint_trap; \ 1.233 -+ rd %psr,%l0; \ 1.234 -+ nop; \ 1.235 -+ nop; 1.236 -+ 1.237 -+/* Software trap for Sparc-netbsd system calls. */ 1.238 -+#define NETBSD_SYSCALL_TRAP \ 1.239 -+ sethi %hi(C_LABEL(sys_call_table)), %l7; \ 1.240 -+ or %l7, %lo(C_LABEL(sys_call_table)), %l7; \ 1.241 -+ b bsd_syscall; \ 1.242 -+ rd %psr, %l0; 1.243 -+ 1.244 -+/* The Get Condition Codes software trap for userland. */ 1.245 -+#define GETCC_TRAP \ 1.246 -+ b getcc_trap_handler; mov %psr, %l0; nop; nop; 1.247 -+ 1.248 -+/* The Set Condition Codes software trap for userland. */ 1.249 -+#define SETCC_TRAP \ 1.250 -+ b setcc_trap_handler; mov %psr, %l0; nop; nop; 1.251 -+ 1.252 -+/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and 1.253 -+ * gets handled with another macro. 1.254 -+ */ 1.255 -+#define TRAP_ENTRY_INTERRUPT(int_level) \ 1.256 -+ mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3; 1.257 -+ 1.258 -+/* NMI's (Non Maskable Interrupts) are special, you can't keep them 1.259 -+ * from coming in, and basically if you get one, the shows over. ;( 1.260 -+ * On the sun4c they are usually asynchronous memory errors, on the 1.261 -+ * the sun4m they could be either due to mem errors or a software 1.262 -+ * initiated interrupt from the prom/kern on an SMP box saying "I 1.263 -+ * command you to do CPU tricks, read your mailbox for more info." 1.264 -+ */ 1.265 -+#define NMI_TRAP \ 1.266 -+ rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop; 1.267 -+ 1.268 -+#endif 1.269 -+ 1.270 -+/* Window overflows/underflows are special and we need to try to be as 1.271 -+ * efficient as possible here.... 1.272 -+ */ 1.273 -+#define WINDOW_SPILL \ 1.274 -+ rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop; 1.275 -+ 1.276 -+#define WINDOW_FILL \ 1.277 -+ rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop; 1.278 -+ 1.279 -+#define STUB_TRAP ba stub_trap; nop; nop; nop; 1.280 -+ 1.281 -+#define TRAP_ENTRY(a,b) STUB_TRAP 1.282 -+#define SKIP_TRAP(a,b) STUB_TRAP 1.283 -+#define SUNOS_SYSCALL_TRAP STUB_TRAP 1.284 -+#define SOLARIS_SYSCALL_TRAP STUB_TRAP 1.285 -+#define NETBSD_SYSCALL_TRAP STUB_TRAP 1.286 -+#define LINUX_SYSCALL_TRAP STUB_TRAP 1.287 -+#define BREAKPOINT_TRAP STUB_TRAP 1.288 -+#define NMI_TRAP STUB_TRAP 1.289 -+#define GETCC_TRAP STUB_TRAP 1.290 -+#define SETCC_TRAP STUB_TRAP 1.291 -+#define BAD_TRAP(n) STUB_TRAP 1.292 -+#define TRAP_ENTRY_INTERRUPT(i) STUB_TRAP 1.293 -+#define INDIRECT_SOLARIS_SYSCALL(i) STUB_TRAP 1.294 -+ 1.295 -+ .section ".text" 1.296 -+ .globl start, _start 1.297 -+_start: 1.298 -+start: 1.299 -+ .globl spill_window_entry, fill_window_entry 1.300 -+ 1.301 -+#define EXPORT_TRAP(trap) \ 1.302 -+ .globl trap; \ 1.303 -+ .type trap,function; \ 1.304 -+ .size trap, 16 1.305 -+ 1.306 -+EXPORT_TRAP(t_zero) 1.307 -+EXPORT_TRAP(t_wovf) 1.308 -+EXPORT_TRAP(t_wunf) 1.309 -+EXPORT_TRAP(t_irq1) 1.310 -+EXPORT_TRAP(t_irq2) 1.311 -+EXPORT_TRAP(t_irq3) 1.312 -+EXPORT_TRAP(t_irq4) 1.313 -+EXPORT_TRAP(t_irq5) 1.314 -+EXPORT_TRAP(t_irq6) 1.315 -+EXPORT_TRAP(t_irq7) 1.316 -+EXPORT_TRAP(t_irq8) 1.317 -+EXPORT_TRAP(t_irq9) 1.318 -+EXPORT_TRAP(t_irq10) 1.319 -+EXPORT_TRAP(t_irq11) 1.320 -+EXPORT_TRAP(t_irq12) 1.321 -+EXPORT_TRAP(t_irq13) 1.322 -+EXPORT_TRAP(t_irq14) 1.323 -+EXPORT_TRAP(t_irq15) 1.324 -+ 1.325 -+C_LABEL(trapbase): 1.326 -+t_zero: b goprol; nop; nop; nop; 1.327 -+t_tflt: SRMMU_TFAULT /* Inst. Access Exception */ 1.328 -+t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */ 1.329 -+t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */ 1.330 -+t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */ 1.331 -+t_wovf: WINDOW_SPILL /* Window Overflow */ 1.332 -+t_wunf: WINDOW_FILL /* Window Underflow */ 1.333 -+t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */ 1.334 -+t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */ 1.335 -+t_dflt: SRMMU_DFAULT /* Data Miss Exception */ 1.336 -+t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */ 1.337 -+t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */ 1.338 -+t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10) 1.339 -+t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */ 1.340 -+t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */ 1.341 -+t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */ 1.342 -+t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */ 1.343 -+t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */ 1.344 -+t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */ 1.345 -+t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */ 1.346 -+t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */ 1.347 -+t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */ 1.348 -+t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */ 1.349 -+t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */ 1.350 -+t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */ 1.351 -+t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */ 1.352 -+t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */ 1.353 -+t_nmi: NMI_TRAP /* Level 15 (NMI) */ 1.354 -+t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */ 1.355 -+t_iacce:BAD_TRAP(0x21) /* Instr Access Error */ 1.356 -+t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23) 1.357 -+t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */ 1.358 -+t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */ 1.359 -+t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27) 1.360 -+t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */ 1.361 -+t_dacce:SRMMU_DFAULT /* Data Access Error */ 1.362 -+t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */ 1.363 -+t_dserr:BAD_TRAP(0x2b) /* Data Store Error */ 1.364 -+t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */ 1.365 -+t_bad2d: BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) 1.366 -+ BAD_TRAP(0x30) BAD_TRAP(0x31) BAD_TRAP(0x32) BAD_TRAP(0x33) 1.367 -+ BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) BAD_TRAP(0x37) 1.368 -+ BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b) 1.369 -+t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */ 1.370 -+ BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) 1.371 -+ BAD_TRAP(0x40) BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) 1.372 -+ BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) BAD_TRAP(0x47) 1.373 -+ BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b) 1.374 -+ BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) 1.375 -+ BAD_TRAP(0x50) BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) 1.376 -+ BAD_TRAP(0x54) BAD_TRAP(0x55) BAD_TRAP(0x56) BAD_TRAP(0x57) 1.377 -+ BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) BAD_TRAP(0x5b) 1.378 -+ BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f) 1.379 -+ BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) 1.380 -+ BAD_TRAP(0x64) BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) 1.381 -+ BAD_TRAP(0x68) BAD_TRAP(0x69) BAD_TRAP(0x6a) BAD_TRAP(0x6b) 1.382 -+ BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) BAD_TRAP(0x6f) 1.383 -+ BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73) 1.384 -+ BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) 1.385 -+ BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) 1.386 -+ BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f) 1.387 -+t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */ 1.388 -+t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */ 1.389 -+t_divz: BAD_TRAP(0x82) /* Divide by zero trap */ 1.390 -+t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */ 1.391 -+t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */ 1.392 -+t_rchk: BAD_TRAP(0x85) /* Range Check */ 1.393 -+t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */ 1.394 -+t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */ 1.395 -+t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */ 1.396 -+t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */ 1.397 -+t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) 1.398 -+ BAD_TRAP(0x8e) BAD_TRAP(0x8f) 1.399 -+t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */ 1.400 -+t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) 1.401 -+ BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) 1.402 -+ BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f) 1.403 -+t_getcc:GETCC_TRAP /* Get Condition Codes */ 1.404 -+t_setcc:SETCC_TRAP /* Set Condition Codes */ 1.405 -+t_bada2:BAD_TRAP(0xa2) BAD_TRAP(0xa3) 1.406 -+ BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) 1.407 -+t_slowi:INDIRECT_SOLARIS_SYSCALL(156) 1.408 -+ BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) 1.409 -+ BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) 1.410 -+ BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) 1.411 -+ BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7) 1.412 -+ BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) BAD_TRAP(0xbb) 1.413 -+ BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf) 1.414 -+t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) 1.415 -+ BAD_TRAP(0xc4) BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) 1.416 -+ BAD_TRAP(0xc8) BAD_TRAP(0xc9) BAD_TRAP(0xca) BAD_TRAP(0xcb) 1.417 -+ BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) BAD_TRAP(0xcf) 1.418 -+ BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3) 1.419 -+t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) 1.420 -+ BAD_TRAP(0xd8) BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) 1.421 -+ BAD_TRAP(0xdc) BAD_TRAP(0xdd) BAD_TRAP(0xde) BAD_TRAP(0xdf) 1.422 -+ BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) BAD_TRAP(0xe3) 1.423 -+ BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7) 1.424 -+t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) 1.425 -+ BAD_TRAP(0xec) BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) 1.426 -+ BAD_TRAP(0xf0) BAD_TRAP(0xf1) BAD_TRAP(0xf2) BAD_TRAP(0xf3) 1.427 -+ BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) BAD_TRAP(0xf7) 1.428 -+ BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) 1.429 -+t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd) 1.430 -+dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */ 1.431 -+dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */ 1.432 -+ 1.433 -+stub_trap: 1.434 -+ set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */ 1.435 -+ set 0x00ffffff, %g4 1.436 -+ sta %g4, [%g5] ASI_M_BYPASS 1.437 -+1: ba 1b; nop 1.438 -+ 1.439 -+ .section ".bss" 1.440 -+ .align 8 1.441 -+bss_start: 1.442 -+ .align 0x1000 ! PAGE_SIZE 1.443 -+ .globl C_LABEL(bootup_user_stack) 1.444 -+ .type bootup_user_stack,#object 1.445 -+ .size bootup_user_stack,0x2000 1.446 -+C_LABEL(bootup_user_stack): .skip 0x2000 1.447 -+ 1.448 -+ .section ".text" 1.449 -+ .register %g2, #scratch 1.450 -+ .register %g3, #scratch 1.451 -+ .register %g6, #scratch 1.452 -+ .register %g7, #scratch 1.453 -+ 1.454 -+goprol: 1.455 -+ ! %g1 contains end of memory 1.456 -+ set PHYS_JJ_EEPROM + 0x30, %g1 1.457 -+ lda [%g1] ASI_M_BYPASS, %g1 1.458 -+ ! map PROLDATA to PROLBASE+PROLSIZE to end of ram 1.459 -+ set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables 1.460 -+ sub %g1, %g2, %g2 ! start of private memory 1.461 -+ srl %g2, 0x4, %g7 ! ctx table at s+0x0 1.462 -+ add %g2, 0x400, %g3 ! l1 table at s+0x400 1.463 -+ srl %g3, 0x4, %g3 1.464 -+ or %g3, 0x1, %g3 1.465 -+ sta %g3, [%g2] ASI_M_BYPASS 1.466 -+ add %g2, 0x400, %g2 ! s+0x400 1.467 -+ add %g2, 0x800, %g3 ! l2 table for ram (00xxxxxx) at s+0x800 1.468 -+ srl %g3, 0x4, %g3 1.469 -+ or %g3, 0x1, %g3 1.470 -+ sta %g3, [%g2] ASI_M_BYPASS 1.471 -+ add %g2, 0x500, %g3 ! l2 table for rom (ffxxxxxx) at s+0x900 1.472 -+ add %g2, 0x3fc, %g2 ! s+0x7fc 1.473 -+ srl %g3, 0x4, %g3 1.474 -+ or %g3, 0x1, %g3 1.475 -+ sta %g3, [%g2] ASI_M_BYPASS 1.476 -+ add %g2, 0x4, %g2 ! s+0x800 1.477 -+ set ((7 << 2) | 2), %g3 ! 7 = U: --- S: RWX (main memory) 1.478 -+ sta %g3, [%g2] ASI_M_BYPASS 1.479 -+ add %g2, 0x200, %g3 ! l3 table for rom at s+0xa00 1.480 -+ add %g2, 0x1d0, %g2 ! s+0x9d0 1.481 -+ srl %g3, 0x4, %g3 1.482 -+ or %g3, 0x1, %g3 1.483 -+ sta %g3, [%g2] ASI_M_BYPASS 1.484 -+ add %g2, 0x30, %g2 ! s+0xa00 1.485 -+ 1.486 -+ set PROLBASE, %g3 1.487 -+ set 0x1000, %g5 1.488 -+ set (PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages 1.489 -+1: srl %g3, 0x4, %g4 1.490 -+ or %g4, ((7 << 2) | 2), %g4 ! 4 = U: --X S: --X (rom, execute only) 1.491 -+ sta %g4, [%g2] ASI_M_BYPASS 1.492 -+ add %g2, 4, %g2 1.493 -+ add %g3, %g5, %g3 1.494 -+ deccc %g6 1.495 -+ bne 1b 1.496 -+ nop 1.497 -+#if 0 1.498 -+ set (PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages 1.499 -+1: srl %g3, 0x4, %g4 1.500 -+ or %g4, ((0 << 2) | 2), %g4 ! 0 = U: R-- S: R-- (rom, read only) 1.501 -+ sta %g4, [%g2] ASI_M_BYPASS 1.502 -+ add %g2, 4, %g2 1.503 -+ add %g3, %g5, %g3 1.504 -+ deccc %g6 1.505 -+ bne 1b 1.506 -+ nop 1.507 -+#endif 1.508 -+ set (PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages 1.509 -+ set 0x1000, %g4 1.510 -+ sll %g7, 0x4, %g3 1.511 -+ add %g4, %g3, %g3 1.512 -+1: srl %g3, 0x4, %g4 1.513 -+ or %g4, ((7 << 2) | 2), %g4 ! 5 = U: R-- S: RW- (data area, read/write) 1.514 -+ sta %g4, [%g2] ASI_M_BYPASS 1.515 -+ add %g2, 4, %g2 1.516 -+ add %g3, %g5, %g3 1.517 -+ deccc %g6 1.518 -+ bne 1b 1.519 -+ nop 1.520 -+ 1.521 -+ mov %g1, %g3 1.522 -+ 1.523 -+ set AC_M_CTPR, %g2 1.524 -+ sta %g7, [%g2] ASI_M_MMUREGS ! set ctx table ptr 1.525 -+ set 1, %g1 1.526 -+ sta %g1, [%g0] ASI_M_MMUREGS ! enable mmu 1.527 -+ 1.528 -+ /* 1.529 -+ * The code which enables traps is a simplified version of 1.530 -+ * kernel head.S. 1.531 -+ * 1.532 -+ * We know number of windows as 8 so we do not calculate them. 1.533 -+ * The deadwood is here for any case. 1.534 -+ */ 1.535 -+ 1.536 -+ /* Turn on Supervisor, EnableFloating, and all the PIL bits. 1.537 -+ * Also puts us in register window zero with traps off. 1.538 -+ */ 1.539 -+ set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2 1.540 -+ wr %g2, 0x0, %psr 1.541 -+ WRITE_PAUSE 1.542 -+ 1.543 -+ /* I want a kernel stack NOW! */ 1.544 -+ set C_LABEL(bootup_user_stack), %g1 1.545 -+ set (0x2000 - REGWIN_SZ), %g2 1.546 -+ add %g1, %g2, %sp 1.547 -+ mov 0, %fp /* And for good luck */ 1.548 -+ 1.549 -+ /* Zero out our BSS section. */ 1.550 -+ set C_LABEL(bss_start) , %o0 ! First address of BSS 1.551 -+ set C_LABEL(end) , %o1 ! Last address of BSS 1.552 -+ ba 2f 1.553 -+ nop 1.554 -+1: 1.555 -+ st %g0, [%o0] 1.556 -+2: 1.557 -+ subcc %o0, %o1, %g0 1.558 -+ bl 1b 1.559 -+ add %o0, 0x4, %o0 1.560 -+ 1.561 -+ mov 2, %g1 1.562 -+ wr %g1, 0x0, %wim ! make window 1 invalid 1.563 -+ WRITE_PAUSE 1.564 -+ 1.565 -+#if 0 1.566 -+ wr %g0, 0x0, %wim 1.567 -+ WRITE_PAUSE 1.568 -+ save 1.569 -+ rd %psr, %g3 1.570 -+ restore 1.571 -+ and %g3, PSR_CWP, %g3 1.572 -+ add %g3, 0x1, %g3 1.573 -+#else 1.574 -+ or %g0, 8, %g3 1.575 -+#endif 1.576 -+ 1.577 -+#if 0 1.578 -+ sethi %hi( C_LABEL(cputyp) ), %o0 1.579 -+ st %g7, [%o0 + %lo( C_LABEL(cputyp) )] 1.580 -+ 1.581 -+ sethi %hi( C_LABEL(nwindows) ), %g4 1.582 -+ st %g3, [%g4 + %lo( C_LABEL(nwindows) )] 1.583 -+ 1.584 -+ sub %g3, 0x1, %g3 1.585 -+ sethi %hi( C_LABEL(nwindowsm1) ), %g4 1.586 -+ st %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )] 1.587 -+#endif 1.588 -+ 1.589 -+ /* Here we go, start using Linux's trap table... */ 1.590 -+ set C_LABEL(trapbase), %g3 1.591 -+ wr %g3, 0x0, %tbr 1.592 -+ WRITE_PAUSE 1.593 -+ 1.594 -+ /* Finally, turn on traps so that we can call c-code. */ 1.595 -+ rd %psr, %g3 1.596 -+ wr %g3, 0x0, %psr 1.597 -+ WRITE_PAUSE 1.598 -+ 1.599 -+ wr %g3, PSR_ET, %psr 1.600 -+ WRITE_PAUSE 1.601 -+ 1.602 -+ .globl prolmain 1.603 -+ call C_LABEL(prolmain) 1.604 -+ nop 1.605 -+ 1.606 -+3: 1.607 -+ b 3b 1.608 -+ nop 1.609 -+ 1.610 -+/* 1.611 -+ * Memory access trap handler 1.612 -+ * %l0 program %psr from trap table entry 1.613 -+ * %l1 program %pc from hardware 1.614 -+ * %l2 program %npc from hardware 1.615 -+ * %l3 program %wim from trap table entry 1.616 -+ * %l4 1.617 -+ * %l5 1.618 -+ * %l6 1.619 -+ * %l7 text flag from trap table entry 1.620 -+ */ 1.621 -+ 1.622 -+ .section ".text" 1.623 -+ .globl srmmu_fault 1.624 -+C_LABEL(srmmu_fault): 1.625 -+ 1.626 -+ set AC_M_SFAR, %l6 1.627 -+ set AC_M_SFSR, %l5 1.628 -+ lda [%l6] ASI_M_MMUREGS, %l6 1.629 -+ lda [%l5] ASI_M_MMUREGS, %l5 1.630 -+ 1.631 -+ set ignore_fault, %l5 1.632 -+ ld [%l5], %l5 1.633 -+ subcc %l5, %g0, %g0 /* NULL pointer trap faults always */ 1.634 -+ be 3f 1.635 -+ nop 1.636 -+ subcc %l5, %l6, %g0 1.637 -+ be 2f 1.638 -+ nop 1.639 -+3: 1.640 -+ 1.641 -+ set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */ 1.642 -+ set 0x00ffffff, %g4 1.643 -+ sta %g4, [%g5] ASI_M_BYPASS 1.644 -+ add %g5, 8, %g5 /* On right side */ 1.645 -+ sta %g4, [%g5] ASI_M_BYPASS 1.646 -+1: ba 1b; nop 1.647 -+ 1.648 -+2: 1.649 -+ set C_LABEL(fault_ignored), %l5 1.650 -+ mov 1, %l6 1.651 -+ st %l6, [%l5] 1.652 -+ 1.653 -+ /* 1.654 -+ * Skip the faulting instruction. 1.655 -+ * I think it works when next instruction is a branch even. 1.656 -+ */ 1.657 -+ or %l2, 0, %l1 1.658 -+ add %l2, 4, %l2 1.659 -+ 1.660 -+ wr %l0, 0, %psr 1.661 -+ WRITE_PAUSE 1.662 -+ jmp %l1 1.663 -+ rett %l2 1.664 -+ 1.665 -+/* 1.666 -+ * Slow external versions of st_bypass and ld_bypass. 1.667 -+ * rconsole.c uses inlines. We call these in places which are not speed 1.668 -+ * critical, to avoid compiler bugs. 1.669 -+ */ 1.670 -+ .globl C_LABEL(st_bypass) 1.671 -+C_LABEL(st_bypass): 1.672 -+ retl 1.673 -+ sta %o1, [%o0] ASI_M_BYPASS 1.674 -+ .globl C_LABEL(ld_bypass) 1.675 -+C_LABEL(ld_bypass): 1.676 -+ retl 1.677 -+ lda [%o0] ASI_M_BYPASS, %o0 1.678 -+ .globl C_LABEL(sth_bypass) 1.679 -+C_LABEL(sth_bypass): 1.680 -+ retl 1.681 -+ stha %o1, [%o0] ASI_M_BYPASS 1.682 -+ .globl C_LABEL(ldh_bypass) 1.683 -+C_LABEL(ldh_bypass): 1.684 -+ retl 1.685 -+ lduha [%o0] ASI_M_BYPASS, %o0 1.686 -+ .globl C_LABEL(stb_bypass) 1.687 -+C_LABEL(stb_bypass): 1.688 -+ retl 1.689 -+ stba %o1, [%o0] ASI_M_BYPASS 1.690 -+ .globl C_LABEL(ldb_bypass) 1.691 -+C_LABEL(ldb_bypass): 1.692 -+ retl 1.693 -+ lduba [%o0] ASI_M_BYPASS, %o0 1.694 -diff -ruN proll_18.orig/qemu/main.c proll-patch-15/qemu/main.c 1.695 ---- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000 1.696 -+++ proll-patch-15/qemu/main.c 2005-08-14 10:07:48.000000000 +0000 1.697 -@@ -0,0 +1,185 @@ 1.698 -+/** 1.699 -+ ** Proll (PROM replacement) 1.700 -+ ** Copyright 1999 Pete Zaitcev 1.701 -+ ** This code is licensed under GNU General Public License. 1.702 -+ **/ 1.703 -+#include <stdarg.h> 1.704 -+ 1.705 -+// #include <asm/contregs.h> 1.706 -+#include <asi.h> 1.707 -+#include "pgtsrmmu.h" 1.708 -+#include "iommu.h" /* Typical SBus IOMMU for sun4m */ 1.709 -+#include "phys_jj.h" 1.710 -+#include "vconsole.h" 1.711 -+#include "version.h" 1.712 -+#include <general.h> /* __P() */ 1.713 -+#include <net.h> /* init_net() */ 1.714 -+#include <romlib.h> /* we are a provider for part of this. */ 1.715 -+#include <netpriv.h> /* myipaddr */ 1.716 -+#include <arpa.h> 1.717 -+#include <system.h> /* our own prototypes */ 1.718 -+ 1.719 -+void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic); 1.720 -+int vcon_zs_init(struct vconterm *t, unsigned int a0); 1.721 -+int vcon_zs_write(struct vconterm *t, char *data, int leng); 1.722 -+int vcon_zs_getch(struct vconterm *t); 1.723 -+void esp_probe(); 1.724 -+int esp_boot(int unit); 1.725 -+static void init_idprom(void); 1.726 -+ 1.727 -+struct vconterm dp0; 1.728 -+struct mem cmem; /* Current memory, virtual */ 1.729 -+struct mem cio; /* Current I/O space */ 1.730 -+struct phym pmem; /* Current phys. mem. */ 1.731 -+struct iommu ciommu; /* Our IOMMU on sun4m */ 1.732 -+ 1.733 -+static struct { 1.734 -+ const char id[16]; 1.735 -+ unsigned int version; 1.736 -+ char pad1[0x1c]; // Pad to 0x30 1.737 -+ unsigned int ram_size; 1.738 -+ char boot_device; 1.739 -+ unsigned int load_addr, kernel_size; 1.740 -+ unsigned int cmdline, cmdline_len; 1.741 -+ char pad2[0x0c]; // Pad to 0x54 1.742 -+ unsigned short width, height, depth; 1.743 -+} *hw_idprom; 1.744 -+ 1.745 -+int ignore_fault, fault_ignored; 1.746 -+void *printk_fn, *getch_fn; 1.747 -+unsigned int q_height, q_width; 1.748 -+ 1.749 -+/* 1.750 -+ */ 1.751 -+void prolmain() 1.752 -+{ 1.753 -+ static char fname[14]; 1.754 -+ static struct banks bb; 1.755 -+ unsigned int hiphybas; 1.756 -+ const void *romvec; 1.757 -+ unsigned int ram_size; 1.758 -+ char nographic, bootdev; 1.759 -+ 1.760 -+ nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F); 1.761 -+ if (!nographic) { 1.762 -+ q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54); 1.763 -+ q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56); 1.764 -+ vcon_init(&dp0, PHYS_JJ_TCX_FB); 1.765 -+ printk_fn = vcon_write; 1.766 -+ getch_fn = vcon_getch; 1.767 -+ } 1.768 -+ else { 1.769 -+ vcon_zs_init(&dp0, 0x71100004); 1.770 -+ printk_fn = vcon_zs_write; 1.771 -+ getch_fn = vcon_zs_getch; 1.772 -+ } 1.773 -+ 1.774 -+ 1.775 -+ printk("PROLL %s QEMU\n", PROLL_VERSION_STRING); 1.776 -+ ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30); 1.777 -+ printk("%d MB total\n", ram_size/(1024*1024)); 1.778 -+ 1.779 -+ bb.nbanks = 1; 1.780 -+ bb.bankv[0].start = 0; 1.781 -+ bb.bankv[0].length = ram_size; 1.782 -+ 1.783 -+ hiphybas = ram_size - PROLSIZE; 1.784 -+ 1.785 -+ mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE)); 1.786 -+ makepages(&pmem, hiphybas); 1.787 -+ init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas); 1.788 -+ 1.789 -+ mem_init(&cio, (char *)(PROLBASE+PROLSIZE), 1.790 -+ (char *)(PROLBASE+PROLSIZE+IOMAPSIZE)); 1.791 -+ 1.792 -+ iommu_init(&ciommu, hiphybas); 1.793 -+ 1.794 -+ /* 1.795 -+ */ 1.796 -+ init_idprom(); 1.797 -+ printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version); 1.798 -+ if (!nographic) 1.799 -+ printk("Prom console: TCX %dx%d\n", q_width, q_height); 1.800 -+ else 1.801 -+ printk("Prom console: serial\n"); 1.802 -+ sched_init(); 1.803 -+ le_probe(); 1.804 -+ init_net(); 1.805 -+ esp_probe(); 1.806 -+ 1.807 -+ bootdev = hw_idprom->boot_device; 1.808 -+ printk("Boot device: %c\n", bootdev); 1.809 -+ if (hw_idprom->kernel_size > 0) { 1.810 -+ printk("Kernel already loaded\n"); 1.811 -+ } else if (bootdev == 'n') { 1.812 -+ if (bootp() != 0) fatal(); 1.813 -+ /* 1.814 -+ * boot_rec.bp_file cannot be used because system PROM 1.815 -+ * uses it to locate ourselves. If we load from boot_rec.bp_file, 1.816 -+ * we will loop reloading PROLL over and over again. 1.817 -+ * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L). 1.818 -+ */ 1.819 -+ xtoa(myipaddr, fname, 8); 1.820 -+ fname[9] = '.'; 1.821 -+ fname[10] = 'P'; 1.822 -+ fname[11] = 'R'; 1.823 -+ fname[12] = 'O'; 1.824 -+ fname[13] = 'L'; 1.825 -+ fname[14] = 0; 1.826 -+ 1.827 -+ if (load(boot_rec.bp_siaddr, fname) != 0) fatal(); 1.828 -+ } else if (bootdev == 'c') { 1.829 -+ if (esp_boot(0) != 0) fatal(); 1.830 -+ } else if (bootdev == 'd') { 1.831 -+ if (esp_boot(2) != 0) fatal(); 1.832 -+ } 1.833 -+ 1.834 -+ romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas, 1.835 -+ (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic); 1.836 -+ 1.837 -+ printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n", 1.838 -+ PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024, 1.839 -+ (int)cio.start, (int)cio.curp); 1.840 -+ 1.841 -+ { 1.842 -+ void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr; 1.843 -+ printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n", 1.844 -+ *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline); 1.845 -+ entry(romvec, 0, 0, 0, 0); 1.846 -+ } 1.847 -+ 1.848 -+ mem_fini(&cmem); 1.849 -+ vcon_fini(&dp0); 1.850 -+} 1.851 -+ 1.852 -+/* 1.853 -+ * dvma_alloc over iommu_alloc. 1.854 -+ */ 1.855 -+void *dvma_alloc(int size, unsigned int *pphys) 1.856 -+{ 1.857 -+ return iommu_alloc(&ciommu, size, pphys); 1.858 -+} 1.859 -+ 1.860 -+/* 1.861 -+ */ 1.862 -+void udelay(__attribute__((unused)) unsigned long usecs) 1.863 -+{ 1.864 -+ // Qemu hardware is perfect and does not need any delays! 1.865 -+} 1.866 -+ 1.867 -+static void init_idprom() 1.868 -+{ 1.869 -+ void *va_prom; 1.870 -+ 1.871 -+ if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) { 1.872 -+ printk("init_idprom: cannot map eeprom\n"); 1.873 -+ fatal(); 1.874 -+ } 1.875 -+ bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE); 1.876 -+ /* 1.877 -+ * hw_idprom is not used anywhere. 1.878 -+ * It's just as we hate to leave hanging pointers (I/O page here). 1.879 -+ */ 1.880 -+ hw_idprom = va_prom; 1.881 -+} 1.882 -+ 1.883 -diff -ruN proll_18.orig/qemu/openprom.c proll-patch-15/qemu/openprom.c 1.884 ---- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000 1.885 -+++ proll-patch-15/qemu/openprom.c 2005-11-07 20:11:04.000000000 +0000 1.886 -@@ -0,0 +1,910 @@ 1.887 -+/* 1.888 -+ * PROM interface support 1.889 -+ * Copyright 1996 The Australian National University. 1.890 -+ * Copyright 1996 Fujitsu Laboratories Limited 1.891 -+ * Copyright 1999 Pete A. Zaitcev 1.892 -+ * This software may be distributed under the terms of the Gnu 1.893 -+ * Public License version 2 or later 1.894 -+ */ 1.895 -+ 1.896 -+#include <openprom.h> 1.897 -+#include <general.h> 1.898 -+#include <romlib.h> 1.899 -+#include <system.h> 1.900 -+#include <vconsole.h> 1.901 -+#include "phys_jj.h" 1.902 -+ 1.903 -+//#define DEBUG_OBP 1.904 -+ 1.905 -+#define PAGE_SIZE 4096 1.906 -+ 1.907 -+struct property { 1.908 -+ const char *name; 1.909 -+ const char *value; 1.910 -+ int length; 1.911 -+}; 1.912 -+ 1.913 -+struct node { 1.914 -+ const struct property *properties; 1.915 -+ /* short */ const int sibling; 1.916 -+ /* short */ const int child; 1.917 -+}; 1.918 -+ 1.919 -+static int obp_nextnode(int node); 1.920 -+static int obp_child(int node); 1.921 -+static int obp_proplen(int node, char *name); 1.922 -+static int obp_getprop(int node, char *name, char *val); 1.923 -+static int obp_setprop(int node, char *name, char *val, int len); 1.924 -+static const char *obp_nextprop(int node, char *name); 1.925 -+ 1.926 -+static char obp_idprom[IDPROM_SIZE]; 1.927 -+static const struct property null_properties = { NULL, NULL, -1 }; 1.928 -+static const int prop_true = -1; 1.929 -+ 1.930 -+static struct property propv_root[7]; 1.931 -+ 1.932 -+static const struct property propv_root_templ[] = { 1.933 -+ {"name", "SUNW,SparcStation-5", sizeof("SUNW,SparcStation-5") }, 1.934 -+ {"idprom", obp_idprom, IDPROM_SIZE}, 1.935 -+ {"banner-name", "SparcStation", sizeof("SparcStation")}, 1.936 -+ {"compatible", "sun4m", 6}, 1.937 -+}; 1.938 -+ 1.939 -+static const int prop_iommu_reg[] = { 1.940 -+ 0x0, 0x10000000, 0x00000300, 1.941 -+}; 1.942 -+static const struct property propv_iommu[] = { 1.943 -+ {"name", "iommu", sizeof("iommu")}, 1.944 -+ {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) }, 1.945 -+ {NULL, NULL, -1} 1.946 -+}; 1.947 -+ 1.948 -+static const int prop_sbus_ranges[] = { 1.949 -+ 0x0, 0x0, 0x0, 0x30000000, 0x10000000, 1.950 -+ 0x1, 0x0, 0x0, 0x40000000, 0x10000000, 1.951 -+ 0x2, 0x0, 0x0, 0x50000000, 0x10000000, 1.952 -+ 0x3, 0x0, 0x0, 0x60000000, 0x10000000, 1.953 -+ 0x4, 0x0, 0x0, 0x70000000, 0x10000000, 1.954 -+}; 1.955 -+static const struct property propv_sbus[] = { 1.956 -+ {"name", "sbus", 5}, 1.957 -+ {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)}, 1.958 -+ {"device_type", "hierarchical", sizeof("hierarchical") }, 1.959 -+ {NULL, NULL, -1} 1.960 -+}; 1.961 -+ 1.962 -+static const int prop_tcx_regs[] = { 1.963 -+ 0x2, 0x00800000, 0x00100000, 1.964 -+ 0x2, 0x02000000, 0x00000001, 1.965 -+ 0x2, 0x04000000, 0x00800000, 1.966 -+ 0x2, 0x06000000, 0x00800000, 1.967 -+ 0x2, 0x0a000000, 0x00000001, 1.968 -+ 0x2, 0x0c000000, 0x00000001, 1.969 -+ 0x2, 0x0e000000, 0x00000001, 1.970 -+ 0x2, 0x00700000, 0x00001000, 1.971 -+ 0x2, 0x00200000, 0x00000004, 1.972 -+ 0x2, 0x00300000, 0x0000081c, 1.973 -+ 0x2, 0x00000000, 0x00010000, 1.974 -+ 0x2, 0x00240000, 0x00000004, 1.975 -+ 0x2, 0x00280000, 0x00000001, 1.976 -+}; 1.977 -+ 1.978 -+#if 1 /* Zaitcev */ 1.979 -+static const int pixfreq = 0x03dfd240; 1.980 -+static const int hbporch = 0xa0; 1.981 -+static const int vfreq = 0x3c; 1.982 -+#endif 1.983 -+#if 0 /* Kevin Boone - 70Hz refresh */ 1.984 -+static const int pixfreq = 0x047868C0; 1.985 -+static const int hbporch = 0x90; 1.986 -+static const int vfreq = 0x46; 1.987 -+#endif 1.988 -+ 1.989 -+static const int vbporch = 0x1d; 1.990 -+static const int vsync = 0x6; 1.991 -+static const int hsync = 0x88; 1.992 -+static const int vfporch = 0x3; 1.993 -+static const int hfporch = 0x18; 1.994 -+static const int height = 0x300; 1.995 -+static const int width = 0x400; 1.996 -+static const int linebytes = 0x400; 1.997 -+static const int depth = 24; 1.998 -+static const int tcx_intr[] = { 5, 0 }; 1.999 -+static const int tcx_interrupts = 5; 1.1000 -+static const struct property propv_sbus_tcx[] = { 1.1001 -+ {"name", "SUNW,tcx", sizeof("SUNW,tcx")}, 1.1002 -+ {"vbporch", (char*)&vbporch, sizeof(int)}, 1.1003 -+ {"hbporch", (char*)&hbporch, sizeof(int)}, 1.1004 -+ {"vsync", (char*)&vsync, sizeof(int)}, 1.1005 -+ {"hsync", (char*)&hsync, sizeof(int)}, 1.1006 -+ {"vfporch", (char*)&vfporch, sizeof(int)}, 1.1007 -+ {"hfporch", (char*)&hfporch, sizeof(int)}, 1.1008 -+ {"pixfreq", (char*)&pixfreq, sizeof(int)}, 1.1009 -+ {"vfreq", (char*)&vfreq, sizeof(int)}, 1.1010 -+ {"height", (char*)&height, sizeof(int)}, 1.1011 -+ {"width", (char*)&width, sizeof(int)}, 1.1012 -+ {"linebytes", (char*)&linebytes, sizeof(int)}, 1.1013 -+ {"depth", (char*)&depth, sizeof(int)}, 1.1014 -+ {"reg", (char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)}, 1.1015 -+ {"tcx-8-bit", 0, -1}, 1.1016 -+ {"intr", (char*)&tcx_intr[0], sizeof(tcx_intr)}, 1.1017 -+ {"interrupts", (char*)&tcx_interrupts, sizeof(tcx_interrupts)}, 1.1018 -+ {"device_type", "display", sizeof("display")}, 1.1019 -+ {NULL, NULL, -1} 1.1020 -+}; 1.1021 -+ 1.1022 -+static const int prop_cs4231_reg[] = { 1.1023 -+ 0x3, 0x0C000000, 0x00000040 1.1024 -+}; 1.1025 -+static const int cs4231_interrupts = 5; 1.1026 -+static const int cs4231_intr[] = { 5, 0 }; 1.1027 -+ 1.1028 -+static const struct property propv_sbus_cs4231[] = { 1.1029 -+ {"name", "SUNW,CS4231", sizeof("SUNW,CS4231") }, 1.1030 -+ {"intr", (char*)&cs4231_intr[0], sizeof(cs4231_intr) }, 1.1031 -+ {"interrupts", (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) }, 1.1032 -+ {"reg", (char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) }, 1.1033 -+ {"device_type", "serial", sizeof("serial") }, 1.1034 -+ {"alias", "audio", sizeof("audio") }, 1.1035 -+ {NULL, NULL, -1} 1.1036 -+}; 1.1037 -+ 1.1038 -+static const int cpu_nctx = NCTX_SWIFT; 1.1039 -+static const int cpu_cache_line_size = 0x20; 1.1040 -+static const int cpu_cache_nlines = 0x200; 1.1041 -+static const struct property propv_cpu[] = { 1.1042 -+ {"name", "STP1012PGA", sizeof("STP1012PGA") }, 1.1043 -+ {"device_type", "cpu", 4 }, 1.1044 -+ {"mmu-nctx", (char*)&cpu_nctx, sizeof(int)}, 1.1045 -+ {"cache-line-size", (char*)&cpu_cache_line_size, sizeof(int)}, 1.1046 -+ {"cache-nlines", (char*)&cpu_cache_nlines, sizeof(int)}, 1.1047 -+ {NULL, NULL, -1} 1.1048 -+}; 1.1049 -+ 1.1050 -+static const int prop_obio_ranges[] = { 1.1051 -+ 0x0, 0x0, 0x0, 0x71000000, 0x01000000, 1.1052 -+}; 1.1053 -+static const struct property propv_obio[] = { 1.1054 -+ {"name", "obio", 5 }, 1.1055 -+ {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) }, 1.1056 -+ {"device_type", "hierarchical", sizeof("hierarchical") }, 1.1057 -+ {NULL, NULL, -1} 1.1058 -+}; 1.1059 -+ 1.1060 -+static const int prop_auxio_reg[] = { 1.1061 -+ 0x0, 0x00900000, 0x00000001, 1.1062 -+}; 1.1063 -+static const struct property propv_obio_auxio[] = { 1.1064 -+ {"name", "auxio", sizeof("auxio") }, 1.1065 -+ {"reg", (char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) }, 1.1066 -+ {NULL, NULL, -1} 1.1067 -+}; 1.1068 -+ 1.1069 -+static const int prop_int_reg[] = { 1.1070 -+ 0x0, 0x00e00000, 0x00000010, 1.1071 -+ 0x0, 0x00e10000, 0x00000010, 1.1072 -+}; 1.1073 -+static const struct property propv_obio_int[] = { 1.1074 -+ {"name", "interrupt", sizeof("interrupt")}, 1.1075 -+ {"reg", (char*)&prop_int_reg[0], sizeof(prop_int_reg) }, 1.1076 -+ {NULL, NULL, -1} 1.1077 -+}; 1.1078 -+ 1.1079 -+static const int prop_cnt_reg[] = { 1.1080 -+ 0x0, 0x00d00000, 0x00000010, 1.1081 -+ 0x0, 0x00d10000, 0x00000010, 1.1082 -+}; 1.1083 -+static const struct property propv_obio_cnt[] = { 1.1084 -+ {"name", "counter", sizeof("counter")}, 1.1085 -+ {"reg", (char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) }, 1.1086 -+ {NULL, NULL, -1} 1.1087 -+}; 1.1088 -+ 1.1089 -+static const int prop_eeprom_reg[] = { 1.1090 -+ 0x0, 0x00200000, 0x00002000, 1.1091 -+}; 1.1092 -+static const struct property propv_obio_eep[] = { 1.1093 -+ {"name", "eeprom", sizeof("eeprom")}, 1.1094 -+ {"reg", (char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) }, 1.1095 -+ {"model", "mk48t08", sizeof("mk48t08")}, 1.1096 -+ {NULL, NULL, -1} 1.1097 -+}; 1.1098 -+ 1.1099 -+static const int prop_su_reg[] = { 1.1100 -+ 0x0, 0x003002f8, 0x00000008, 1.1101 -+}; 1.1102 -+static const struct property propv_obio_su[] = { 1.1103 -+ {"name", "su", sizeof("su")}, 1.1104 -+ {"reg", (char*)&prop_su_reg[0], sizeof(prop_su_reg) }, 1.1105 -+ {NULL, NULL, -1} 1.1106 -+}; 1.1107 -+ 1.1108 -+static const int prop_zs_intr[] = { 0x2c, 0x0 }; 1.1109 -+static const int prop_zs_reg[] = { 1.1110 -+ 0x0, 0x00000000, 0x00000008, 1.1111 -+}; 1.1112 -+static void *prop_zs_addr; 1.1113 -+static const int prop_zs_slave = 1; 1.1114 -+static const struct property propv_obio_zs[] = { 1.1115 -+ {"name", "zs", sizeof("zs")}, 1.1116 -+ {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) }, 1.1117 -+ {"slave", (char*)&prop_zs_slave, sizeof(prop_zs_slave) }, 1.1118 -+ {"device_type", "serial", sizeof("serial") }, 1.1119 -+ {"intr", (char*)&prop_zs_intr[0], sizeof(prop_zs_intr) }, 1.1120 -+ {"address", (char*)&prop_zs_addr, sizeof(prop_zs_addr) }, 1.1121 -+ {"keyboard", (char*)&prop_true, 0}, 1.1122 -+ {"mouse", (char*)&prop_true, 0}, 1.1123 -+ {NULL, NULL, -1} 1.1124 -+}; 1.1125 -+ 1.1126 -+static const int prop_zs1_intr[] = { 0x2c, 0x0 }; 1.1127 -+static const int prop_zs1_reg[] = { 1.1128 -+ 0x0, 0x00100000, 0x00000008, 1.1129 -+}; 1.1130 -+static void *prop_zs1_addr; 1.1131 -+static const int prop_zs1_slave = 0; 1.1132 -+static const struct property propv_obio_zs1[] = { 1.1133 -+ {"name", "zs", sizeof("zs")}, 1.1134 -+ {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) }, 1.1135 -+ {"slave", (char*)&prop_zs1_slave, sizeof(prop_zs1_slave) }, 1.1136 -+ {"device_type", "serial", sizeof("serial") }, 1.1137 -+ {"intr", (char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) }, 1.1138 -+ {"address", (char*)&prop_zs1_addr, sizeof(prop_zs1_addr) }, 1.1139 -+ {NULL, NULL, -1} 1.1140 -+}; 1.1141 -+ 1.1142 -+static const int prop_ledma_reg[] = { 1.1143 -+ 0x4, 0x08400010, 0x00000020, 1.1144 -+}; 1.1145 -+static const int prop_ledma_burst = 0x3f; 1.1146 -+static const struct property propv_sbus_ledma[] = { 1.1147 -+ {"name", "ledma", sizeof("ledma")}, 1.1148 -+ {"reg", (char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) }, 1.1149 -+ {"burst-sizes", (char*)&prop_ledma_burst, sizeof(int) }, 1.1150 -+ {NULL, NULL, -1} 1.1151 -+}; 1.1152 -+ 1.1153 -+static const int prop_le_reg[] = { 1.1154 -+ 0x4, 0x08c00000, 0x00000004, 1.1155 -+}; 1.1156 -+static const int prop_le_busmaster_regval = 0x7; 1.1157 -+static const int prop_le_intr[] = { 0x26, 0x0 }; 1.1158 -+static const struct property propv_sbus_ledma_le[] = { 1.1159 -+ {"name", "le", sizeof("le")}, 1.1160 -+ {"reg", (char*)&prop_le_reg[0], sizeof(prop_le_reg) }, 1.1161 -+ {"busmaster-regval", (char*)&prop_le_busmaster_regval, sizeof(int)}, 1.1162 -+ {"intr", (char*)&prop_le_intr[0], sizeof(prop_le_intr) }, 1.1163 -+ {NULL, NULL, -1} 1.1164 -+}; 1.1165 -+ 1.1166 -+static const int prop_espdma_reg[] = { 1.1167 -+ 0x4, 0x08400000, 0x00000010, 1.1168 -+}; 1.1169 -+ 1.1170 -+static const struct property propv_sbus_espdma[] = { 1.1171 -+ {"name", "espdma", sizeof("espdma")}, 1.1172 -+ {"reg", (char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) }, 1.1173 -+ {NULL, NULL, -1} 1.1174 -+}; 1.1175 -+ 1.1176 -+static const int prop_esp_reg[] = { 1.1177 -+ 0x4, 0x08800000, 0x00000040, 1.1178 -+}; 1.1179 -+static const int prop_esp_intr[] = { 0x24, 0x0 }; 1.1180 -+static const struct property propv_sbus_espdma_esp[] = { 1.1181 -+ {"name", "esp", sizeof("esp")}, 1.1182 -+ {"reg", (char*)&prop_esp_reg[0], sizeof(prop_esp_reg) }, 1.1183 -+ {"intr", (char*)&prop_esp_intr[0], sizeof(prop_esp_intr) }, 1.1184 -+ {NULL, NULL, -1} 1.1185 -+}; 1.1186 -+ 1.1187 -+static const int prop_bpp_reg[] = { 1.1188 -+ 0x4, 0x0c800000, 0x0000001c, 1.1189 -+}; 1.1190 -+static const int prop_bpp_intr[] = { 0x33, 0x0 }; 1.1191 -+static const struct property propv_sbus_bpp[] = { 1.1192 -+ {"name", "SUNW,bpp", sizeof("SUNW,bpp")}, 1.1193 -+ {"reg", (char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) }, 1.1194 -+ {"intr", (char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) }, 1.1195 -+ {NULL, NULL, -1} 1.1196 -+}; 1.1197 -+ 1.1198 -+static const int prop_apc_reg[] = { 1.1199 -+ 0x4, 0x0a000000, 0x00000010, 1.1200 -+}; 1.1201 -+static const struct property propv_sbus_apc[] = { 1.1202 -+ {"name", "xxxpower-management", sizeof("xxxpower-management")}, 1.1203 -+ {"reg", (char*)&prop_apc_reg[0], sizeof(prop_apc_reg) }, 1.1204 -+ {NULL, NULL, -1} 1.1205 -+}; 1.1206 -+ 1.1207 -+static const int prop_fd_intr[] = { 0x2b, 0x0 }; 1.1208 -+static const int prop_fd_reg[] = { 1.1209 -+ 0x0, 0x00400000, 0x0000000f, 1.1210 -+}; 1.1211 -+static const struct property propv_obio_fd[] = { 1.1212 -+ {"name", "SUNW,fdtwo", sizeof("SUNW,fdtwo")}, 1.1213 -+ {"reg", (char*)&prop_fd_reg[0], sizeof(prop_fd_reg) }, 1.1214 -+ {"device_type", "block", sizeof("block") }, 1.1215 -+ {"intr", (char*)&prop_fd_intr[0], sizeof(prop_fd_intr) }, 1.1216 -+ {NULL, NULL, -1} 1.1217 -+}; 1.1218 -+ 1.1219 -+static const int prop_pw_intr[] = { 0x22, 0x0 }; 1.1220 -+static const int prop_pw_reg[] = { 1.1221 -+ 0x0, 0x00910000, 0x00000001, 1.1222 -+}; 1.1223 -+static const struct property propv_obio_pw[] = { 1.1224 -+ {"name", "power", sizeof("power")}, 1.1225 -+ {"reg", (char*)&prop_pw_reg[0], sizeof(prop_pw_reg) }, 1.1226 -+ {"intr", (char*)&prop_pw_intr[0], sizeof(prop_pw_intr) }, 1.1227 -+ {NULL, NULL, -1} 1.1228 -+}; 1.1229 -+ 1.1230 -+static const int prop_cf_reg[] = { 1.1231 -+ 0x0, 0x00800000, 0x00000001, 1.1232 -+}; 1.1233 -+static const struct property propv_obio_cf[] = { 1.1234 -+ {"name", "slavioconfig", sizeof("slavioconfig")}, 1.1235 -+ {"reg", (char*)&prop_cf_reg[0], sizeof(prop_cf_reg) }, 1.1236 -+ {NULL, NULL, -1} 1.1237 -+}; 1.1238 -+ 1.1239 -+static const struct property propv_options[] = { 1.1240 -+ {"name", "options", sizeof("options")}, 1.1241 -+ {"screen-#columns", "80", sizeof("80")}, 1.1242 -+ {"screen-#rows", "25", sizeof("25")}, 1.1243 -+ {"tpe-link-test?", (char *)&prop_true, 0}, 1.1244 -+ {"ttya-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")}, 1.1245 -+ {"ttya-ignore-cd", (char *)&prop_true, 0}, 1.1246 -+ {"ttya-rts-dtr-off", 0, -1}, 1.1247 -+ {"ttyb-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")}, 1.1248 -+ {"ttyb-ignore-cd", (char *)&prop_true, 0}, 1.1249 -+ {"ttyb-rts-dtr-off", 0, -1}, 1.1250 -+ {NULL, NULL, -1} 1.1251 -+}; 1.1252 -+ 1.1253 -+static int prop_mem_reg[3]; 1.1254 -+static int prop_mem_avail[3]; 1.1255 -+ 1.1256 -+static const struct property propv_memory[] = { 1.1257 -+ {"name", "memory", sizeof("memory")}, 1.1258 -+ {"reg", (char*)&prop_mem_reg[0], sizeof(prop_mem_reg) }, 1.1259 -+ {"available", (char*)&prop_mem_avail[0], sizeof(prop_mem_avail) }, 1.1260 -+ {NULL, NULL, -1} 1.1261 -+}; 1.1262 -+ 1.1263 -+static int prop_vmem_avail[6]; 1.1264 -+ 1.1265 -+static const struct property propv_vmemory[] = { 1.1266 -+ {"name", "virtual-memory", sizeof("virtual-memory")}, 1.1267 -+ {"available", (char*)&prop_vmem_avail[0], sizeof(prop_vmem_avail) }, 1.1268 -+ {NULL, NULL, -1} 1.1269 -+}; 1.1270 -+ 1.1271 -+static const struct node nodes[] = { 1.1272 -+ { &null_properties, 1, 0 }, /* 0 = big brother of root */ 1.1273 -+ { propv_root, 0, 2 }, /* 1 "/" */ 1.1274 -+ { propv_iommu, 12, 3 }, /* 2 "/iommu" */ 1.1275 -+ { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */ 1.1276 -+ { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */ 1.1277 -+ { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */ 1.1278 -+ { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */ 1.1279 -+ { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */ 1.1280 -+ { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */ 1.1281 -+ { propv_sbus_espdma, 11, 10 }, /* 9 "/iommu/sbus/espdma" */ 1.1282 -+ { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */ 1.1283 -+ { propv_sbus_apc, 0, 0 }, /* 11 "/iommu/sbus/power-management */ 1.1284 -+ { propv_cpu, 13, 0 }, /* 12 "/STP1012PGA" */ 1.1285 -+ { propv_obio, 23, 14 }, /* 13 "/obio" */ 1.1286 -+ { propv_obio_int, 15, 0 }, /* 14 "/obio/interrupt" */ 1.1287 -+ { propv_obio_cnt, 16, 0 }, /* 15 "/obio/counter" */ 1.1288 -+ { propv_obio_eep, 17, 0 }, /* 16 "/obio/eeprom" */ 1.1289 -+ { propv_obio_auxio, 18, 0 }, /* 17 "/obio/auxio" */ 1.1290 -+ { propv_obio_zs1, 19, 0 }, /* 18 "/obio/zs@0,100000" 1.1291 -+ Must be before zs@0,0! */ 1.1292 -+ { propv_obio_zs, 20, 0 }, /* 19 "/obio/zs@0,0" */ 1.1293 -+ { propv_obio_fd, 21, 0 }, /* 20 "/obio/SUNW,fdtwo" */ 1.1294 -+ { propv_obio_pw, 22, 0 }, /* 21 "/obio/power" */ 1.1295 -+ { propv_obio_cf, 0, 0 }, /* 22 "/obio/slavioconfig@0,800000" */ 1.1296 -+ { propv_options, 24, 0 }, /* 23 "/options" */ 1.1297 -+ { propv_memory, 25, 0 }, /* 24 "/memory" */ 1.1298 -+ { propv_vmemory, 0, 0 }, /* 25 "/virtual-memory" */ 1.1299 -+}; 1.1300 -+ 1.1301 -+static struct linux_mlist_v0 totphys[MAX_BANKS]; 1.1302 -+static struct linux_mlist_v0 totmap[1]; 1.1303 -+static struct linux_mlist_v0 totavail[MAX_BANKS]; 1.1304 -+ 1.1305 -+static struct linux_mlist_v0 *ptphys; 1.1306 -+static struct linux_mlist_v0 *ptmap; 1.1307 -+static struct linux_mlist_v0 *ptavail; 1.1308 -+ 1.1309 -+static const struct linux_nodeops nodeops0 = { 1.1310 -+ obp_nextnode, /* int (*no_nextnode)(int node); */ 1.1311 -+ obp_child, /* int (*no_child)(int node); */ 1.1312 -+ obp_proplen, /* int (*no_proplen)(int node, char *name); */ 1.1313 -+ obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */ 1.1314 -+ obp_setprop, /* int (*no_setprop)(int node, char *name, 1.1315 -+ char *val, int len); */ 1.1316 -+ obp_nextprop /* char * (*no_nextprop)(int node, char *name); */ 1.1317 -+}; 1.1318 -+ 1.1319 -+static struct linux_arguments_v0 obp_arg; 1.1320 -+static const struct linux_arguments_v0 * const obp_argp = &obp_arg; 1.1321 -+ 1.1322 -+static void (*synch_hook)(void); 1.1323 -+static char obp_stdin, obp_stdout; 1.1324 -+static int obp_fd_stdin, obp_fd_stdout; 1.1325 -+ 1.1326 -+static int obp_nbgetchar(void); 1.1327 -+static int obp_nbputchar(int ch); 1.1328 -+static void obp_reboot(char *); 1.1329 -+static void obp_abort(void); 1.1330 -+static void obp_halt(void); 1.1331 -+static int obp_devopen(char *str); 1.1332 -+static int obp_devclose(int dev_desc); 1.1333 -+static int obp_devread(int dev_desc, char *buf, int nbytes); 1.1334 -+static int obp_devwrite(int dev_desc, char *buf, int nbytes); 1.1335 -+static int obp_devseek(int dev_desc, int hi, int lo); 1.1336 -+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf); 1.1337 -+static char *obp_dumb_mmap(char *va, int which_io, unsigned int pa, unsigned int size); 1.1338 -+static void obp_dumb_munmap(char *va, unsigned int size); 1.1339 -+static int obp_inst2pkg(int dev_desc); 1.1340 -+ 1.1341 -+static void doublewalk(unsigned ptab1, unsigned va) 1.1342 -+{ 1.1343 -+unsigned int proc_tablewalk(int ctx, unsigned int va); 1.1344 -+unsigned int mem_tablewalk(unsigned int pa, unsigned int va); 1.1345 -+ 1.1346 -+ proc_tablewalk(0, va); 1.1347 -+ if (ptab1 != 0) mem_tablewalk(ptab1, va); 1.1348 -+} 1.1349 -+ 1.1350 -+static struct linux_romvec romvec0; 1.1351 -+ 1.1352 -+struct fd { 1.1353 -+ int unit, part; 1.1354 -+ int offset; 1.1355 -+ int (*pread)(int dev_desc, int offset, char *buf, unsigned int nbytes); 1.1356 -+ int (*pwrite)(int dev_desc, int offset, char *buf, unsigned int nbytes); 1.1357 -+} fd_table[16]; 1.1358 -+ 1.1359 -+static int fd_index; 1.1360 -+static int con_pread(int dev_desc, int offset, char *buf, unsigned int nbytes); 1.1361 -+static int con_pwrite(int dev_desc, int offset, char *buf, unsigned int nbytes); 1.1362 -+ 1.1363 -+void * 1.1364 -+init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, 1.1365 -+ const char *cmdline, char boot_device, int nographic) 1.1366 -+{ 1.1367 -+ int i; 1.1368 -+ 1.1369 -+ /* 1.1370 -+ * Avoid data segment allocations 1.1371 -+ */ 1.1372 -+ ptphys = totphys; 1.1373 -+ ptmap = totmap; 1.1374 -+ ptavail = totavail; 1.1375 -+ /* 1.1376 -+ * Form memory descriptors. 1.1377 -+ */ 1.1378 -+ for (i = 0; i < bankc; i++) { 1.1379 -+ totphys[i].theres_more = &totphys[i+1]; 1.1380 -+ totphys[i].start_adr = (char*) bankv[i].start; 1.1381 -+ totphys[i].num_bytes = bankv[i].length; 1.1382 -+ } 1.1383 -+ totphys[i-1].theres_more = 0; 1.1384 -+ 1.1385 -+ /* 1.1386 -+ * XXX Merged in normal PROM when full banks touch. 1.1387 -+ */ 1.1388 -+ for (i = 0; i < bankc; i++) { 1.1389 -+ unsigned bankbase = bankv[i].start; 1.1390 -+ unsigned banksize = bankv[i].length; 1.1391 -+ if (hiphybas > bankbase && 1.1392 -+ hiphybas < bankbase + banksize) { 1.1393 -+ banksize = hiphybas - bankbase; 1.1394 -+ } 1.1395 -+ totavail[i].theres_more = &totavail[i+1]; 1.1396 -+ totavail[i].start_adr = (char*) bankbase; 1.1397 -+ totavail[i].num_bytes = banksize; 1.1398 -+ } 1.1399 -+ totavail[i-1].theres_more = 0; 1.1400 -+ 1.1401 -+ totmap[0].theres_more = 0; 1.1402 -+ totmap[0].start_adr = (char*) PROLBASE; 1.1403 -+ totmap[0].num_bytes = PROLSIZE; 1.1404 -+ prop_mem_reg[0] = 0; 1.1405 -+ prop_mem_reg[1] = 0; 1.1406 -+ prop_mem_reg[2] = bankv[0].length; 1.1407 -+ prop_mem_avail[0] = 0; 1.1408 -+ prop_mem_avail[1] = 0; 1.1409 -+ prop_mem_avail[2] = hiphybas; 1.1410 -+ prop_vmem_avail[0] = 0; 1.1411 -+ prop_vmem_avail[1] = 0; 1.1412 -+ prop_vmem_avail[2] = PROLBASE-1; 1.1413 -+ prop_vmem_avail[3] = 0; 1.1414 -+ prop_vmem_avail[4] = 0xffe00000; 1.1415 -+ prop_vmem_avail[5] = 0x00200000; 1.1416 -+ 1.1417 -+ /* 1.1418 -+ * idprom 1.1419 -+ */ 1.1420 -+ bcopy(idprom, obp_idprom, IDPROM_SIZE); 1.1421 -+ 1.1422 -+ // Linux wants a R/W romvec table 1.1423 -+ romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC; 1.1424 -+ romvec0.pv_romvers = 3; 1.1425 -+ romvec0.pv_plugin_revision = 77; 1.1426 -+ romvec0.pv_printrev = 0x10203; 1.1427 -+ romvec0.pv_v0mem.v0_totphys = &ptphys; 1.1428 -+ romvec0.pv_v0mem.v0_prommap = &ptmap; 1.1429 -+ romvec0.pv_v0mem.v0_available = &ptavail; 1.1430 -+ romvec0.pv_nodeops = &nodeops0; 1.1431 -+ romvec0.pv_bootstr = (void *)doublewalk; 1.1432 -+ romvec0.pv_v0devops.v0_devopen = &obp_devopen; 1.1433 -+ romvec0.pv_v0devops.v0_devclose = &obp_devclose; 1.1434 -+ romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev; 1.1435 -+ romvec0.pv_stdin = &obp_stdin; 1.1436 -+ romvec0.pv_stdout = &obp_stdout; 1.1437 -+ romvec0.pv_getchar = obp_nbgetchar; 1.1438 -+ romvec0.pv_putchar = (void (*)(int))obp_nbputchar; 1.1439 -+ romvec0.pv_nbgetchar = obp_nbgetchar; 1.1440 -+ romvec0.pv_nbputchar = obp_nbputchar; 1.1441 -+ romvec0.pv_reboot = obp_reboot; 1.1442 -+ romvec0.pv_printf = (void (*)(const char *fmt, ...))printk; 1.1443 -+ romvec0.pv_abort = obp_abort; 1.1444 -+ romvec0.pv_halt = obp_halt; 1.1445 -+ romvec0.pv_synchook = &synch_hook; 1.1446 -+ romvec0.pv_v0bootargs = &obp_argp; 1.1447 -+ romvec0.pv_v2devops.v2_inst2pkg = obp_inst2pkg; 1.1448 -+ romvec0.pv_v2devops.v2_dumb_mmap = obp_dumb_mmap; 1.1449 -+ romvec0.pv_v2devops.v2_dumb_munmap = obp_dumb_munmap; 1.1450 -+ romvec0.pv_v2devops.v2_dev_open = obp_devopen; 1.1451 -+ romvec0.pv_v2devops.v2_dev_close = (void (*)(int))obp_devclose; 1.1452 -+ romvec0.pv_v2devops.v2_dev_read = obp_devread; 1.1453 -+ romvec0.pv_v2devops.v2_dev_write = obp_devwrite; 1.1454 -+ romvec0.pv_v2devops.v2_dev_seek = obp_devseek; 1.1455 -+ obp_arg.boot_dev_ctrl = 0; 1.1456 -+ obp_arg.boot_dev_unit = '0'; 1.1457 -+ obp_arg.argv[0] = "sd(0,0,0):d"; 1.1458 -+ switch(boot_device) { 1.1459 -+ default: 1.1460 -+ case 'a': 1.1461 -+ obp_arg.argv[0] = "fd()"; 1.1462 -+ obp_arg.boot_dev[0] = 'f'; 1.1463 -+ obp_arg.boot_dev[1] = 'd'; 1.1464 -+ break; 1.1465 -+ case 'd': 1.1466 -+ obp_arg.boot_dev_unit = '2'; 1.1467 -+ obp_arg.argv[0] = "sd(0,2,0):d"; 1.1468 -+ // Fall through 1.1469 -+ case 'c': 1.1470 -+ obp_arg.boot_dev[0] = 's'; 1.1471 -+ obp_arg.boot_dev[1] = 'd'; 1.1472 -+ break; 1.1473 -+ case 'n': 1.1474 -+ obp_arg.argv[0] = "le()"; 1.1475 -+ obp_arg.boot_dev[0] = 'l'; 1.1476 -+ obp_arg.boot_dev[1] = 'e'; 1.1477 -+ break; 1.1478 -+ } 1.1479 -+ obp_arg.argv[1] = cmdline; 1.1480 -+ romvec0.pv_v2bootargs.bootpath = &obp_arg.argv[0]; 1.1481 -+ romvec0.pv_v2bootargs.bootargs = &cmdline; 1.1482 -+ romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin; 1.1483 -+ romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout; 1.1484 -+ 1.1485 -+ bcopy(propv_root_templ, propv_root, sizeof(propv_root_templ)); 1.1486 -+ propv_root[4].name = "stdin-path"; 1.1487 -+ propv_root[5].name = "stdout-path"; 1.1488 -+ obp_fd_stdin = 0; 1.1489 -+ obp_fd_stdout = 1; 1.1490 -+ fd_table[0].pread = con_pread; 1.1491 -+ fd_table[0].pwrite = con_pwrite; 1.1492 -+ fd_table[1].pread = con_pread; 1.1493 -+ fd_table[1].pwrite = con_pwrite; 1.1494 -+ fd_index = 2; 1.1495 -+ if (nographic) { 1.1496 -+ obp_stdin = PROMDEV_TTYA; 1.1497 -+ propv_root[4].value = "/obio/zs@0,100000:a"; 1.1498 -+ propv_root[4].length = sizeof("/obio/zs@0,100000:a"); 1.1499 -+ fd_table[0].unit = 18; 1.1500 -+ obp_stdout = PROMDEV_TTYA; 1.1501 -+ propv_root[5].value = "/obio/zs@0,100000:a"; 1.1502 -+ propv_root[5].length = sizeof("/obio/zs@0,100000:a"); 1.1503 -+ fd_table[1].unit = 18; 1.1504 -+ } else { 1.1505 -+ obp_stdin = PROMDEV_KBD; 1.1506 -+ propv_root[4].value = "/obio/zs@0,0"; 1.1507 -+ propv_root[4].length = sizeof("/obio/zs@0,0"); 1.1508 -+ fd_table[0].unit = 19; 1.1509 -+ obp_stdout = PROMDEV_SCREEN; 1.1510 -+ propv_root[5].value = "/iommu/sbus/SUNW,tcx"; 1.1511 -+ propv_root[5].length = sizeof("/iommu/sbus/SUNW,tcx"); 1.1512 -+ fd_table[1].unit = 4; 1.1513 -+ } 1.1514 -+ prop_zs_addr = map_io(0x71000000, 8); 1.1515 -+ prop_zs1_addr = map_io(0x71100000, 8); 1.1516 -+ return &romvec0; 1.1517 -+} 1.1518 -+ 1.1519 -+static const struct property *find_property(int node,char *name) 1.1520 -+{ 1.1521 -+ const struct property *prop = &nodes[node].properties[0]; 1.1522 -+ while (prop && prop->name) { 1.1523 -+ if (bcmp(prop->name, name, 128) == 0) return prop; 1.1524 -+ prop++; 1.1525 -+ } 1.1526 -+ return NULL; 1.1527 -+} 1.1528 -+ 1.1529 -+static int obp_nextnode(int node) 1.1530 -+{ 1.1531 -+#ifdef DEBUG_OBP 1.1532 -+ printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling); 1.1533 -+#endif 1.1534 -+ return nodes[node].sibling; 1.1535 -+} 1.1536 -+ 1.1537 -+static int obp_child(int node) 1.1538 -+{ 1.1539 -+#ifdef DEBUG_OBP 1.1540 -+ printk("obp_child(%d) = %d\n", node, nodes[node].child); 1.1541 -+#endif 1.1542 -+ return nodes[node].child; 1.1543 -+} 1.1544 -+ 1.1545 -+static int obp_proplen(int node, char *name) 1.1546 -+{ 1.1547 -+ const struct property *prop = find_property(node,name); 1.1548 -+ if (prop) { 1.1549 -+#ifdef DEBUG_OBP 1.1550 -+ printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length); 1.1551 -+#endif 1.1552 -+ return prop->length; 1.1553 -+ } 1.1554 -+#ifdef DEBUG_OBP 1.1555 -+ printk("obp_proplen(%d, %s) (no prop)\n", node, name); 1.1556 -+#endif 1.1557 -+ return -1; 1.1558 -+} 1.1559 -+ 1.1560 -+static int obp_getprop(int node, char *name, char *value) 1.1561 -+{ 1.1562 -+ const struct property *prop; 1.1563 -+ 1.1564 -+ if (!name) { 1.1565 -+ // NULL name means get first property 1.1566 -+#ifdef DEBUG_OBP 1.1567 -+ printk("obp_getprop(%d, %x (NULL)) = %s\n", node, name, 1.1568 -+ nodes[node].properties[0].name); 1.1569 -+#endif 1.1570 -+ return (int)nodes[node].properties[0].name; 1.1571 -+ } 1.1572 -+ prop = find_property(node,name); 1.1573 -+ if (prop) { 1.1574 -+ memcpy(value,prop->value,prop->length); 1.1575 -+#ifdef DEBUG_OBP 1.1576 -+ printk("obp_getprop(%d, %s) = %s\n", node, name, value); 1.1577 -+#endif 1.1578 -+ return prop->length; 1.1579 -+ } 1.1580 -+#ifdef DEBUG_OBP 1.1581 -+ printk("obp_getprop(%d, %s): not found\n", node, name); 1.1582 -+#endif 1.1583 -+ return -1; 1.1584 -+} 1.1585 -+ 1.1586 -+static int obp_setprop(__attribute__((unused)) int node, 1.1587 -+ __attribute__((unused)) char *name, 1.1588 -+ __attribute__((unused)) char *value, 1.1589 -+ __attribute__((unused)) int len) 1.1590 -+{ 1.1591 -+#ifdef DEBUG_OBP 1.1592 -+ printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len); 1.1593 -+#endif 1.1594 -+ return -1; 1.1595 -+} 1.1596 -+ 1.1597 -+static const char *obp_nextprop(int node,char *name) 1.1598 -+{ 1.1599 -+ const struct property *prop; 1.1600 -+ 1.1601 -+ if (!name || *name == '\0') { 1.1602 -+ // NULL name means get first property 1.1603 -+#ifdef DEBUG_OBP 1.1604 -+ printk("obp_nextprop(%d, NULL) = %s\n", node, 1.1605 -+ nodes[node].properties[0].name); 1.1606 -+#endif 1.1607 -+ return nodes[node].properties[0].name; 1.1608 -+ } 1.1609 -+ prop = find_property(node,name); 1.1610 -+ if (prop && prop[1].name) { 1.1611 -+#ifdef DEBUG_OBP 1.1612 -+ printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name); 1.1613 -+#endif 1.1614 -+ return prop[1].name; 1.1615 -+ } 1.1616 -+#ifdef DEBUG_OBP 1.1617 -+ printk("obp_nextprop(%d, %s): not found\n", node, name); 1.1618 -+#endif 1.1619 -+ return ""; 1.1620 -+} 1.1621 -+ 1.1622 -+extern int (*getch_fn)(struct vconterm *v); 1.1623 -+ 1.1624 -+static int obp_nbgetchar(void) { 1.1625 -+ extern struct vconterm dp0; 1.1626 -+ return getch_fn(&dp0); 1.1627 -+} 1.1628 -+ 1.1629 -+static int obp_nbputchar(int ch) { 1.1630 -+ printk("%c", ch); 1.1631 -+ return 0; 1.1632 -+} 1.1633 -+ 1.1634 -+static void obp_reboot(char *str) { 1.1635 -+ printk("rebooting (%s)\n", str); 1.1636 -+ stb_bypass(0x71f00000, 1); 1.1637 -+ for (;;) {} 1.1638 -+} 1.1639 -+ 1.1640 -+static void obp_abort() { 1.1641 -+ printk("abort, power off\n"); 1.1642 -+ stb_bypass(0x71910000, 1); 1.1643 -+ for (;;) {} 1.1644 -+} 1.1645 -+ 1.1646 -+static void obp_halt() { 1.1647 -+ printk("halt, power off\n"); 1.1648 -+ stb_bypass(0x71910000, 1); 1.1649 -+ for (;;) {} 1.1650 -+} 1.1651 -+ 1.1652 -+extern void *esp_read(int unit, int part, int offset, short len); 1.1653 -+ 1.1654 -+static int esp_pread(int dev_desc, int offset, char *buf, unsigned int nbytes) 1.1655 -+{ 1.1656 -+ unsigned int i; 1.1657 -+ void *src; 1.1658 -+ 1.1659 -+ for(i = 0; i < nbytes; i += 512) { 1.1660 -+ src = esp_read(fd_table[dev_desc].unit, fd_table[dev_desc].part, (offset + i) / 512, 512); 1.1661 -+ memcpy(&buf[i], src, 512); 1.1662 -+ } 1.1663 -+ return nbytes; 1.1664 -+} 1.1665 -+ 1.1666 -+static int con_pread(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes) 1.1667 -+{ 1.1668 -+ unsigned int i; 1.1669 -+ 1.1670 -+ for(i = 0; i < nbytes; i ++) { 1.1671 -+ buf[i] = obp_nbgetchar(); 1.1672 -+ } 1.1673 -+ return nbytes; 1.1674 -+} 1.1675 -+ 1.1676 -+static int con_pwrite(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes) 1.1677 -+{ 1.1678 -+ unsigned int i; 1.1679 -+ 1.1680 -+ for(i = 0; i < nbytes; i ++) { 1.1681 -+ obp_nbputchar(buf[i]); 1.1682 -+ } 1.1683 -+ return nbytes; 1.1684 -+} 1.1685 -+ 1.1686 -+#define isnum(c) ((c >= '0') && (c < '9')) 1.1687 -+#define ctoi(c) (c - '0') 1.1688 -+ 1.1689 -+static int obp_devopen(char *str) { 1.1690 -+#ifdef DEBUG_OBP 1.1691 -+ printk("obp_devopen(%s)\n", str); 1.1692 -+#endif 1.1693 -+ if (str[0] == 's' && str[1] == 'd' && str[4] == ',') { 1.1694 -+ unsigned int target; 1.1695 -+ 1.1696 -+ if (str[5] < 7) 1.1697 -+ target = str[5]; 1.1698 -+ else if (isnum(str[6]) && isnum(str[5])) { 1.1699 -+ target = (ctoi(str[5]) * 10 + ctoi(str[6])) & 7; 1.1700 -+ } 1.1701 -+ else { 1.1702 -+ target = ctoi(str[5]) & 7; 1.1703 -+ } 1.1704 -+ fd_table[fd_index].unit = target; 1.1705 -+ fd_table[fd_index].part = str[10] - 'a'; 1.1706 -+ fd_table[fd_index].pread = esp_pread; 1.1707 -+ return fd_index++; // XXX 1.1708 -+ } 1.1709 -+ return 0; 1.1710 -+} 1.1711 -+ 1.1712 -+static int obp_devclose(__attribute__((unused)) int dev_desc) { 1.1713 -+#ifdef DEBUG_OBP 1.1714 -+ printk("obp_devclose %d\n", dev_desc); 1.1715 -+#endif 1.1716 -+ fd_index--; // XXX 1.1717 -+ return 0; 1.1718 -+} 1.1719 -+ 1.1720 -+static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf) 1.1721 -+{ 1.1722 -+#ifdef DEBUG_OBP 1.1723 -+ printk("obp_rdblkdev: fd %d, num_blks %d, offset %d, buf 0x%x\n", dev_desc, num_blks, offset, buf); 1.1724 -+#endif 1.1725 -+ return fd_table[dev_desc].pread(dev_desc, offset, buf, num_blks * 512); 1.1726 -+} 1.1727 -+ 1.1728 -+static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io, 1.1729 -+ unsigned int pa, unsigned int size) 1.1730 -+{ 1.1731 -+ unsigned int npages; 1.1732 -+ unsigned int off; 1.1733 -+ unsigned int mva; 1.1734 -+ 1.1735 -+#ifdef DEBUG_OBP 1.1736 -+ printk("obp_dumb_mmap: virta %x, which_io %d, paddr %x, sz %d\n", va, which_io, pa, size); 1.1737 -+#endif 1.1738 -+ off = pa & (PAGE_SIZE-1); 1.1739 -+ npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE; 1.1740 -+ pa &= ~(PAGE_SIZE-1); 1.1741 -+ 1.1742 -+ mva = (unsigned int) va; 1.1743 -+ while (npages-- != 0) { 1.1744 -+ map_page(pmem.pl1, mva, pa, 1, pmem.pbas); 1.1745 -+ mva += PAGE_SIZE; 1.1746 -+ pa += PAGE_SIZE; 1.1747 -+ } 1.1748 -+ return va; 1.1749 -+} 1.1750 -+ 1.1751 -+static void obp_dumb_munmap(__attribute__((unused)) char *va, 1.1752 -+ __attribute__((unused)) unsigned int size) 1.1753 -+{ 1.1754 -+#ifdef DEBUG_OBP 1.1755 -+ printk("obp_dumb_munmap: virta %x, sz %d\n", va, size); 1.1756 -+#endif 1.1757 -+} 1.1758 -+ 1.1759 -+static int obp_devread(int dev_desc, char *buf, int nbytes) 1.1760 -+{ 1.1761 -+ int ret; 1.1762 -+#ifdef DEBUG_OBP 1.1763 -+ printk("obp_devread: fd %d, nbytes %d\n", dev_desc, nbytes); 1.1764 -+#endif 1.1765 -+ ret = fd_table[dev_desc].pread(dev_desc, fd_table[dev_desc].offset, buf, nbytes); 1.1766 -+ fd_table[dev_desc].offset += nbytes; 1.1767 -+ return ret; 1.1768 -+} 1.1769 -+ 1.1770 -+static int obp_devwrite(int dev_desc, char *buf, int nbytes) 1.1771 -+{ 1.1772 -+ int ret; 1.1773 -+#ifdef DEBUG_OBP 1.1774 -+ printk("obp_devwrite: fd %d, buf %s, nbytes %d\n", dev_desc, buf, nbytes); 1.1775 -+#endif 1.1776 -+ ret = fd_table[dev_desc].pwrite(dev_desc, fd_table[dev_desc].offset, buf, nbytes); 1.1777 -+ fd_table[dev_desc].offset += nbytes; 1.1778 -+ return ret; 1.1779 -+} 1.1780 -+ 1.1781 -+static int obp_devseek(int dev_desc, __attribute__((unused)) int hi, int lo) 1.1782 -+{ 1.1783 -+#ifdef DEBUG_OBP 1.1784 -+ printk("obp_devseek: fd %d, hi %d, lo %d\n", dev_desc, hi, lo); 1.1785 -+#endif 1.1786 -+ fd_table[dev_desc].offset = lo; 1.1787 -+ return 0; 1.1788 -+} 1.1789 -+ 1.1790 -+static int obp_inst2pkg(int dev_desc) 1.1791 -+{ 1.1792 -+#ifdef DEBUG_OBP 1.1793 -+ printk("obp_inst2pkg: fd %d\n", dev_desc); 1.1794 -+#endif 1.1795 -+ return fd_table[dev_desc].unit; 1.1796 -+} 1.1797 -diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch-15/qemu/system_qemu.c 1.1798 ---- proll_18.orig/qemu/system_qemu.c 1970-01-01 00:00:00.000000000 +0000 1.1799 -+++ proll-patch-15/qemu/system_qemu.c 2005-04-16 06:16:20.000000000 +0000 1.1800 -@@ -0,0 +1,430 @@ 1.1801 -+/** 1.1802 -+ ** Proll (PROM replacement) 1.1803 -+ ** system.c: shared miscallenea. 1.1804 -+ ** Copyright 1999 Pete Zaitcev 1.1805 -+ ** This code is licensed under GNU General Public License. 1.1806 -+ **/ 1.1807 -+#include <stdarg.h> 1.1808 -+#include <asi.h> 1.1809 -+#include <crs.h> 1.1810 -+#ifndef NULL 1.1811 -+#define NULL ((void*)0) 1.1812 -+#endif 1.1813 -+ 1.1814 -+#include "pgtsrmmu.h" 1.1815 -+ 1.1816 -+#include "vconsole.h" 1.1817 -+#include <timer.h> /* Local copy of 2.2 style include */ 1.1818 -+#include <general.h> /* __P() */ 1.1819 -+#include <net.h> /* init_net() */ 1.1820 -+#include <romlib.h> /* we are a provider for part of this. */ 1.1821 -+#include <netpriv.h> /* myipaddr */ 1.1822 -+#include <arpa.h> 1.1823 -+#include <system.h> /* our own prototypes */ 1.1824 -+ 1.1825 -+/* 1.1826 -+ * We export this. 1.1827 -+ */ 1.1828 -+char idprom[IDPROM_SIZE]; 1.1829 -+ 1.1830 -+ 1.1831 -+/* 1.1832 -+ * Create an I/O mapping to pa[size]. 1.1833 -+ * Returns va of the mapping or 0 if unsuccessful. 1.1834 -+ */ 1.1835 -+void * 1.1836 -+map_io(unsigned pa, int size) 1.1837 -+{ 1.1838 -+ void *va; 1.1839 -+ unsigned int npages; 1.1840 -+ unsigned int off; 1.1841 -+ unsigned int mva; 1.1842 -+ 1.1843 -+ off = pa & (PAGE_SIZE-1); 1.1844 -+ npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE; 1.1845 -+ pa &= ~(PAGE_SIZE-1); 1.1846 -+ 1.1847 -+ va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE); 1.1848 -+ if (va == 0) return va; 1.1849 -+ 1.1850 -+ mva = (unsigned int) va; 1.1851 -+ /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */ 1.1852 -+ while (npages-- != 0) { 1.1853 -+ map_page(pmem.pl1, mva, pa, 1, pmem.pbas); 1.1854 -+ mva += PAGE_SIZE; 1.1855 -+ pa += PAGE_SIZE; 1.1856 -+ } 1.1857 -+ 1.1858 -+ return (void *)((unsigned int)va + off); 1.1859 -+} 1.1860 -+ 1.1861 -+/* 1.1862 -+ * Tablewalk routine used for testing. 1.1863 -+ * Returns PTP/PTE. 1.1864 -+ */ 1.1865 -+unsigned int 1.1866 -+proc_tablewalk(int ctx, unsigned int va) 1.1867 -+{ 1.1868 -+ unsigned int pa1; 1.1869 -+ 1.1870 -+ __asm__ __volatile__ ("lda [%1] %2, %0" : 1.1871 -+ "=r" (pa1) : 1.1872 -+ "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS)); 1.1873 -+ /* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */ 1.1874 -+ pa1 <<= 4; 1.1875 -+ pa1 = ld_bypass(pa1 + (ctx << 2)); 1.1876 -+ if ((pa1 & 0x03) == 0) goto invalid; 1.1877 -+ return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va); 1.1878 -+ 1.1879 -+invalid: 1.1880 -+ printk(" invalid %x\n", pa1); 1.1881 -+ return 0; 1.1882 -+} 1.1883 -+ 1.1884 -+/* 1.1885 -+ * Walk the tables in memory, starting at physical address pa. 1.1886 -+ */ 1.1887 -+unsigned int 1.1888 -+mem_tablewalk(unsigned int pa, unsigned int va) 1.1889 -+{ 1.1890 -+ unsigned int pa1; 1.1891 -+ 1.1892 -+ printk("pa %x va %x", pa, va); 1.1893 -+ pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2)); 1.1894 -+ if ((pa1 & 0x03) == 0) goto invalid; 1.1895 -+ printk(" l1 %x", pa1); 1.1896 -+ pa1 <<= 4; pa1 &= 0xFFFFFF00; 1.1897 -+ pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2)); 1.1898 -+ if ((pa1 & 0x03) == 0) goto invalid; 1.1899 -+ printk(" l2 %x", pa1); 1.1900 -+ pa1 <<= 4; pa1 &= 0xFFFFFF00; 1.1901 -+ pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2)); 1.1902 -+ if ((pa1 & 0x03) == 0) goto invalid; 1.1903 -+ printk(" l3 %x", pa1); 1.1904 -+ printk(" off %x\n", va&0x00000FFF); 1.1905 -+ return pa1; 1.1906 -+invalid: 1.1907 -+ printk(" invalid %x\n", pa1); 1.1908 -+ return 0; 1.1909 -+} 1.1910 -+ 1.1911 -+/* 1.1912 -+ * Make CPU page tables. 1.1913 -+ * Returns pointer to context table. 1.1914 -+ * Here we ignore memory allocation errors which "should not happen" 1.1915 -+ * because we cannot print anything anyways if memory initialization fails. 1.1916 -+ */ 1.1917 -+void makepages(struct phym *t, unsigned int highbase) 1.1918 -+{ 1.1919 -+ unsigned int *ctp, *l1, pte; 1.1920 -+ int i; 1.1921 -+ unsigned int pa, va; 1.1922 -+ 1.1923 -+ ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int)); 1.1924 -+ l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int)); 1.1925 -+ 1.1926 -+ pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4); 1.1927 -+ for (i = 0; i < NCTX_SWIFT; i++) { 1.1928 -+ ctp[i] = pte; 1.1929 -+ } 1.1930 -+ 1.1931 -+ pa = PROLBASE; 1.1932 -+ for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) { 1.1933 -+ map_page(l1, va, pa, 0, highbase); 1.1934 -+ pa += PAGE_SIZE; 1.1935 -+ } 1.1936 -+ pa = highbase + PROLDATA - PROLBASE; 1.1937 -+ for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) { 1.1938 -+ map_page(l1, va, pa, 0, highbase); 1.1939 -+ pa += PAGE_SIZE; 1.1940 -+ } 1.1941 -+ 1.1942 -+ /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */ 1.1943 -+ pa = 0; 1.1944 -+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) { 1.1945 -+ map_page(l1, va, pa, 0, highbase); 1.1946 -+ pa += PAGE_SIZE; 1.1947 -+ } 1.1948 -+ 1.1949 -+ t->pctp = ctp; 1.1950 -+ t->pl1 = l1; 1.1951 -+ t->pbas = highbase; 1.1952 -+} 1.1953 -+ 1.1954 -+/* 1.1955 -+ * Create a memory mapping from va to epa in page table pgd. 1.1956 -+ * highbase is used for v2p translation. 1.1957 -+ */ 1.1958 -+int 1.1959 -+map_page(unsigned int *pgd, unsigned int va, 1.1960 -+ unsigned int epa, int type, unsigned int highbase) 1.1961 -+{ 1.1962 -+ unsigned int pte; 1.1963 -+ unsigned int *p; 1.1964 -+ unsigned int pa; 1.1965 -+ 1.1966 -+ pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)]; 1.1967 -+ if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) { 1.1968 -+ p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int), 1.1969 -+ SRMMU_PTRS_PER_PMD*sizeof(int)); 1.1970 -+ if (p == 0) goto drop; 1.1971 -+ pte = SRMMU_ET_PTD | 1.1972 -+ (((unsigned int)p - PROLBASE + highbase) >> 4); 1.1973 -+ pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte; 1.1974 -+ /* barrier() */ 1.1975 -+ } 1.1976 -+ 1.1977 -+ pa = ((pte & 0xFFFFFFF0) << 4); 1.1978 -+ pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2); 1.1979 -+ pte = ld_bypass(pa); 1.1980 -+ if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) { 1.1981 -+ p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int), 1.1982 -+ SRMMU_PTRS_PER_PTE*sizeof(int)); 1.1983 -+ if (p == 0) goto drop; 1.1984 -+ pte = SRMMU_ET_PTD | 1.1985 -+ (((unsigned int)p - PROLBASE + highbase) >> 4); 1.1986 -+ st_bypass(pa, pte); 1.1987 -+ } 1.1988 -+ 1.1989 -+ pa = ((pte & 0xFFFFFFF0) << 4); 1.1990 -+ pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2); 1.1991 -+ 1.1992 -+ pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4); 1.1993 -+ if (type) { /* I/O */ 1.1994 -+ pte |= SRMMU_REF; 1.1995 -+ /* SRMMU cannot make Supervisor-only, but not exectutable */ 1.1996 -+ pte |= SRMMU_PRIV; 1.1997 -+ } else { /* memory */ 1.1998 -+ pte |= SRMMU_REF|SRMMU_CACHE; 1.1999 -+ pte |= SRMMU_PRIV; /* Supervisor only access */ 1.2000 -+ } 1.2001 -+ st_bypass(pa, pte); 1.2002 -+ return 0; 1.2003 -+ 1.2004 -+drop: 1.2005 -+ return -1; 1.2006 -+} 1.2007 -+ 1.2008 -+/* 1.2009 -+ * Switch page tables. 1.2010 -+ */ 1.2011 -+void 1.2012 -+init_mmu_swift(unsigned int ctp_phy) 1.2013 -+{ 1.2014 -+ unsigned int addr; 1.2015 -+ 1.2016 -+ /* 1.2017 -+ * Flush cache 1.2018 -+ */ 1.2019 -+ for (addr = 0; addr < 0x2000; addr += 0x10) { 1.2020 -+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : : 1.2021 -+ "r" (addr), "i" (ASI_M_DATAC_TAG)); 1.2022 -+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : : 1.2023 -+ "r" (addr<<1), "i" (ASI_M_TXTC_TAG)); 1.2024 -+ } 1.2025 -+ 1.2026 -+ /* 1.2027 -+ * Switch ctx table 1.2028 -+ */ 1.2029 -+ ctp_phy >>= 4; 1.2030 -+ /* printk("done flushing, switching to %x\n", ctp_phy); */ 1.2031 -+ __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : : 1.2032 -+ "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS)); 1.2033 -+ 1.2034 -+ /* 1.2035 -+ * Flush old page table references 1.2036 -+ */ 1.2037 -+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : : 1.2038 -+ "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory"); 1.2039 -+} 1.2040 -+ 1.2041 -+/* 1.2042 -+ * add_timer, del_timer 1.2043 -+ * This should go into sched.c, but we have it split for different archs. 1.2044 -+ */ 1.2045 -+struct timer_list_head { 1.2046 -+ struct timer_list *head, *tail; 1.2047 -+}; 1.2048 -+ 1.2049 -+static struct timer_list_head timers; /* Anonymous heap of timers */ 1.2050 -+ 1.2051 -+void add_timer(struct timer_list *timer) { 1.2052 -+ struct timer_list *p; 1.2053 -+ if (timer->prev != NULL || timer->next != NULL) { 1.2054 -+ printk("bug: kernel timer added twice at 0x%x.\n", 1.2055 -+ __builtin_return_address(0)); 1.2056 -+ return; 1.2057 -+ } 1.2058 -+ if ((p = timers.tail) != NULL) { 1.2059 -+ timer->prev = p; 1.2060 -+ p->next = timer; 1.2061 -+ timers.tail = timer; 1.2062 -+ } else { 1.2063 -+ timers.head = timer; 1.2064 -+ timers.tail = timer; 1.2065 -+ } 1.2066 -+ return; 1.2067 -+} 1.2068 -+ 1.2069 -+int del_timer(struct timer_list *timer) { 1.2070 -+ struct timer_list *p; 1.2071 -+ int ret; 1.2072 -+ 1.2073 -+ if (timers.head == timer) timers.head = timer->next; 1.2074 -+ if (timers.tail == timer) timers.tail = timer->prev; 1.2075 -+ if ((p = timer->prev) != NULL) p->next = timer->next; 1.2076 -+ if ((p = timer->next) != NULL) p->prev = timer->prev; 1.2077 -+ ret = timer->next != 0 || timer->prev != 0; 1.2078 -+ timer->next = NULL; 1.2079 -+ timer->prev = NULL; 1.2080 -+ return ret; 1.2081 -+} 1.2082 -+ 1.2083 -+void run_timers() { 1.2084 -+ struct timer_list *p; 1.2085 -+ 1.2086 -+ p = timers.head; 1.2087 -+ while (p != NULL) { 1.2088 -+ if (p->expires < jiffies) { 1.2089 -+ del_timer(p); /* XXX make nonstatic member */ 1.2090 -+ (*p->function)(p->data); 1.2091 -+ p = timers.head; 1.2092 -+ } else { 1.2093 -+ p = p->next; 1.2094 -+ } 1.2095 -+ } 1.2096 -+} 1.2097 -+ 1.2098 -+/* 1.2099 -+ * Allocate memory. This is reusable. 1.2100 -+ */ 1.2101 -+void mem_init(struct mem *t, char *begin, char *limit) 1.2102 -+{ 1.2103 -+ t->start = begin; 1.2104 -+ t->uplim = limit; 1.2105 -+ t->curp = begin; 1.2106 -+} 1.2107 -+ 1.2108 -+void mem_fini(struct mem *t) 1.2109 -+{ 1.2110 -+ t->curp = 0; 1.2111 -+} 1.2112 -+ 1.2113 -+void *mem_alloc(struct mem *t, int size, int align) 1.2114 -+{ 1.2115 -+ char *p; 1.2116 -+ 1.2117 -+ p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1)); 1.2118 -+ if (p >= t->uplim || p + size > t->uplim) return 0; 1.2119 -+ t->curp = p + size; 1.2120 -+ return p; 1.2121 -+} 1.2122 -+ 1.2123 -+void *mem_zalloc(struct mem *t, int size, int align) 1.2124 -+{ 1.2125 -+ char *p; 1.2126 -+ 1.2127 -+ if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size); 1.2128 -+ return p; 1.2129 -+} 1.2130 -+ 1.2131 -+/* 1.2132 -+ * Library functions 1.2133 -+ */ 1.2134 -+void *memset(void *s, int c, size_t len) 1.2135 -+{ 1.2136 -+ void *p = s; 1.2137 -+ 1.2138 -+ while (len--) { 1.2139 -+ *(char *)s = c; 1.2140 -+ s++; 1.2141 -+ } 1.2142 -+ return p; 1.2143 -+} 1.2144 -+ 1.2145 -+void bcopy(const void *f, void *t, int len) { 1.2146 -+ while (len--) { 1.2147 -+ *(char *)t = *(char *)f; 1.2148 -+ f++; 1.2149 -+ t++; 1.2150 -+ } 1.2151 -+} 1.2152 -+ 1.2153 -+/* Comparison is 7-bit */ 1.2154 -+int bcmp(const void *s1, const void *s2, int len) 1.2155 -+{ 1.2156 -+ int i; 1.2157 -+ char ch; 1.2158 -+ 1.2159 -+ while (len--) { 1.2160 -+ ch = *(char *)s1; 1.2161 -+ i = ch - *(char *)s2; 1.2162 -+ s1++; 1.2163 -+ s2++; 1.2164 -+ if (i != 0) 1.2165 -+ return i; 1.2166 -+ if (ch == 0) 1.2167 -+ return 0; 1.2168 -+ } 1.2169 -+ return 0; 1.2170 -+} 1.2171 -+ 1.2172 -+int strlen(const char *s) { 1.2173 -+ const char *p; 1.2174 -+ for (p = s; *p != 0; p++) { } 1.2175 -+ return p - s; 1.2176 -+} 1.2177 -+ 1.2178 -+extern void *printk_fn; 1.2179 -+ 1.2180 -+void printk(char *fmt, ...) 1.2181 -+{ 1.2182 -+ struct prf_fp { 1.2183 -+ void *xfp; 1.2184 -+ void (*write)(void *, char *, int); 1.2185 -+ } prfa; 1.2186 -+ extern void prf(struct prf_fp *, char *fmt, va_list adx); 1.2187 -+ va_list x1; 1.2188 -+ 1.2189 -+ va_start(x1, fmt); 1.2190 -+ prfa.xfp = &dp0; 1.2191 -+ prfa.write = printk_fn; 1.2192 -+ prf(&prfa, fmt, x1); 1.2193 -+ va_end(x1); 1.2194 -+} 1.2195 -+ 1.2196 -+void fatal() 1.2197 -+{ 1.2198 -+ printk("fatal."); 1.2199 -+loop: goto loop; 1.2200 -+} 1.2201 -+ 1.2202 -+/* 1.2203 -+ * Get the highest bit number from the mask. 1.2204 -+ */ 1.2205 -+int highc(int mask, int size) 1.2206 -+{ 1.2207 -+ int m1; 1.2208 -+ 1.2209 -+ m1 = 1 << size; 1.2210 -+ while (size != 0) { 1.2211 -+ size--; 1.2212 -+ m1 >>= 1; 1.2213 -+ if (m1 & mask) break; 1.2214 -+ } 1.2215 -+ return size; 1.2216 -+} 1.2217 -+ 1.2218 -+/* 1.2219 -+ */ 1.2220 -+unsigned int ld_bp_swap(unsigned int ptr) { 1.2221 -+ unsigned int n; 1.2222 -+ n = ld_bypass(ptr); 1.2223 -+ n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24); 1.2224 -+ return n; 1.2225 -+} 1.2226 -+ 1.2227 -+void st_bp_swap(unsigned int ptr, unsigned int n) { 1.2228 -+ n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24); 1.2229 -+ st_bypass(ptr, n); 1.2230 -+}; 1.2231 -diff -ruN proll_18.orig/src/arp.c proll-patch-15/src/arp.c 1.2232 ---- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000 1.2233 -+++ proll-patch-15/src/arp.c 2005-08-14 10:10:11.000000000 +0000 1.2234 -@@ -45,7 +45,7 @@ 1.2235 - #endif 1.2236 - static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */ 1.2237 - static int next_arp; /* next table entry */ 1.2238 --static t_ipaddr def_gw = IP_ANY; /* default routing */ 1.2239 -+static t_ipaddr def_gw; /* default routing */ 1.2240 - 1.2241 - 1.2242 - 1.2243 -@@ -100,10 +100,7 @@ 1.2244 - * 1.2245 - * ARP receiver routine 1.2246 - */ 1.2247 --static int arp_recv(buf, bufsize, addr) 1.2248 --unsigned char *buf; 1.2249 --int bufsize; 1.2250 --unsigned char *addr; 1.2251 -+static int arp_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr) 1.2252 - { 1.2253 - register struct arphdr *ahp = (struct arphdr *)buf; 1.2254 - 1.2255 -@@ -144,7 +141,7 @@ 1.2256 - * 1.2257 - * Resolve IP address and return pointer to hardware address. 1.2258 - */ 1.2259 --unsigned char *ip_resolve(ip) 1.2260 -+const unsigned char *ip_resolve(ip) 1.2261 - t_ipaddr ip; 1.2262 - { 1.2263 - int i; 1.2264 -@@ -230,14 +227,11 @@ 1.2265 - */ 1.2266 - int init_arp() 1.2267 - { 1.2268 -- /* Set name of module for error messages */ 1.2269 -- net_module_name = "arp"; 1.2270 -- 1.2271 - #ifndef NOARP 1.2272 - /* Register ARP packet type and set send buffer pointer */ 1.2273 - if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL) 1.2274 - return(FALSE); 1.2275 - #endif 1.2276 -- 1.2277 -+ def_gw = IP_ANY; 1.2278 - return(TRUE); 1.2279 - } 1.2280 -diff -ruN proll_18.orig/src/arp.h proll-patch-15/src/arp.h 1.2281 ---- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000 1.2282 -+++ proll-patch-15/src/arp.h 2004-11-13 15:50:49.000000000 +0000 1.2283 -@@ -104,7 +104,7 @@ 1.2284 - extern int init_arp __P((void)); 1.2285 - 1.2286 - /* Resolve IP address and return pointer to hardware address */ 1.2287 --extern unsigned char *ip_resolve __P((t_ipaddr ip)); 1.2288 -+extern const unsigned char *ip_resolve __P((t_ipaddr ip)); 1.2289 - 1.2290 - /* Add a new antry to the ARP cache */ 1.2291 - extern void addcache __P((unsigned char *ha, t_ipaddr ip)); 1.2292 -diff -ruN proll_18.orig/src/bootp.c proll-patch-15/src/bootp.c 1.2293 ---- proll_18.orig/src/bootp.c 1999-12-15 17:20:30.000000000 +0000 1.2294 -+++ proll-patch-15/src/bootp.c 2005-08-14 10:16:09.000000000 +0000 1.2295 -@@ -151,7 +151,7 @@ 1.2296 - while (TRUE) { 1.2297 - boot_xid = get_ticks() + random(); 1.2298 - bootp_send(); 1.2299 -- i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout, CHR_ESC); 1.2300 -+ i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout); 1.2301 - if (i < 0) { /* user pressed ESC */ 1.2302 - printf("\nAborted\n"); 1.2303 - return(1); 1.2304 -diff -ruN proll_18.orig/src/esp.c proll-patch-15/src/esp.c 1.2305 ---- proll_18.orig/src/esp.c 1970-01-01 00:00:00.000000000 +0000 1.2306 -+++ proll-patch-15/src/esp.c 2005-08-15 18:42:46.000000000 +0000 1.2307 -@@ -0,0 +1,305 @@ 1.2308 -+#include <system.h> /* == <asm/system.h> */ 1.2309 -+#include <general.h> /* __P for netpriv.h */ 1.2310 -+#include <dma.h> /* dmaga */ 1.2311 -+#include <romlib.h> 1.2312 -+ 1.2313 -+#define PHYS_JJ_ESPDMA 0x78400000 /* ESP DMA controller */ 1.2314 -+#define PHYS_JJ_ESP 0x78800000 /* ESP SCSI */ 1.2315 -+#define PHYS_JJ_ESP_IRQ 4 1.2316 -+#define BUFSIZE 4096 1.2317 -+/* 1.2318 -+ * XXX Crude 1.2319 -+ */ 1.2320 -+struct esp_dma { 1.2321 -+ struct sparc_dma_registers *regs; 1.2322 -+ enum dvma_rev revision; 1.2323 -+}; 1.2324 -+ 1.2325 -+struct esp_regs { 1.2326 -+ unsigned int regs[16]; 1.2327 -+}; 1.2328 -+ 1.2329 -+struct esp_private { 1.2330 -+ int active; /* initialized */ 1.2331 -+ int inst; /* iface number */ 1.2332 -+ 1.2333 -+ volatile struct esp_regs *ll; 1.2334 -+ __u32 buffer_dvma; 1.2335 -+ unsigned int irq; /* device IRQ number */ 1.2336 -+ int interrupt; 1.2337 -+ 1.2338 -+ struct esp_dma *espdma; /* If set this points to espdma */ 1.2339 -+ 1.2340 -+ unsigned char *buffer; 1.2341 -+ struct disk_info { 1.2342 -+ unsigned int hw_sector; 1.2343 -+ unsigned int part_offset[8]; 1.2344 -+ } disk[8]; 1.2345 -+}; 1.2346 -+ 1.2347 -+static void esp_interrupt(void *dev_id) 1.2348 -+{ 1.2349 -+ struct esp_private *lp = (struct esp_private *)dev_id; 1.2350 -+ 1.2351 -+ lp->interrupt = 1; 1.2352 -+ /* Acknowledge all the interrupt sources ASAP */ 1.2353 -+ 1.2354 -+ lp->interrupt = 0; 1.2355 -+} 1.2356 -+ 1.2357 -+static int esp_open (void *dev) 1.2358 -+{ 1.2359 -+ struct esp_private *lp = (struct esp_private *)dev; 1.2360 -+ int status = 0; 1.2361 -+ 1.2362 -+ if (request_irq(lp->irq, &esp_interrupt, (void *)dev)) { 1.2363 -+ printk ("Esp: Can't get irq %d\n", lp->irq); 1.2364 -+ return -1; 1.2365 -+ } 1.2366 -+ 1.2367 -+ /* On the 4m, setup the espdma to provide the upper bits for buffers */ 1.2368 -+ if (lp->espdma) 1.2369 -+ lp->espdma->regs->dma_test = ((__u32) lp->buffer_dvma) & 0xff000000; 1.2370 -+ 1.2371 -+ return status; 1.2372 -+} 1.2373 -+ 1.2374 -+static int esp_close (void *dev) 1.2375 -+{ 1.2376 -+ struct esp_private *lp = (struct esp_private *)dev; 1.2377 -+ 1.2378 -+ free_irq (lp->irq, (void *) dev); 1.2379 -+ return 0; 1.2380 -+} 1.2381 -+ 1.2382 -+static int 1.2383 -+esp_init(struct esp_private *esp, struct esp_dma *espdma, int irq) 1.2384 -+{ 1.2385 -+ volatile struct esp_regs *ll; 1.2386 -+ 1.2387 -+ /* Get the IO region */ 1.2388 -+ ll = map_io(PHYS_JJ_ESP, sizeof (struct esp_regs)); 1.2389 -+ if (ll == 0) return -1; 1.2390 -+ 1.2391 -+ esp->buffer = dvma_alloc(BUFSIZE, &esp->buffer_dvma); 1.2392 -+ esp->ll = ll; 1.2393 -+ esp->espdma = espdma; 1.2394 -+ esp->irq = irq; 1.2395 -+ 1.2396 -+ // Chip reset 1.2397 -+ stb_bypass((int)ll + 3*2, 2); 1.2398 -+ return 0; 1.2399 -+} 1.2400 -+ 1.2401 -+static int espdma_init(struct esp_dma *espdma) 1.2402 -+{ 1.2403 -+ void *p; 1.2404 -+ 1.2405 -+ /* Hardcode everything for MrCoffee. */ 1.2406 -+ if ((p = map_io(PHYS_JJ_ESPDMA, 0x10)) == 0) { 1.2407 -+ printk("espdma_init: cannot map registers\n"); 1.2408 -+ return -1; 1.2409 -+ } 1.2410 -+ espdma->regs = p; 1.2411 -+ 1.2412 -+ printk("dma1: "); 1.2413 -+ 1.2414 -+ switch((espdma->regs->cond_reg)&DMA_DEVICE_ID) { 1.2415 -+ case DMA_VERS0: 1.2416 -+ espdma->revision=dvmarev0; 1.2417 -+ printk("Revision 0 "); 1.2418 -+ break; 1.2419 -+ case DMA_ESCV1: 1.2420 -+ espdma->revision=dvmaesc1; 1.2421 -+ printk("ESC Revision 1 "); 1.2422 -+ break; 1.2423 -+ case DMA_VERS1: 1.2424 -+ espdma->revision=dvmarev1; 1.2425 -+ printk("Revision 1 "); 1.2426 -+ break; 1.2427 -+ case DMA_VERS2: 1.2428 -+ espdma->revision=dvmarev2; 1.2429 -+ printk("Revision 2 "); 1.2430 -+ break; 1.2431 -+ case DMA_VERHME: 1.2432 -+ espdma->revision=dvmahme; 1.2433 -+ printk("HME DVMA gate array "); 1.2434 -+ break; 1.2435 -+ case DMA_VERSPLUS: 1.2436 -+ espdma->revision=dvmarevplus; 1.2437 -+ printk("Revision 1 PLUS "); 1.2438 -+ break; 1.2439 -+ default: 1.2440 -+ printk("unknown dma version %x", 1.2441 -+ (espdma->regs->cond_reg)&DMA_DEVICE_ID); 1.2442 -+ /* espdma->allocated = 1; */ 1.2443 -+ break; 1.2444 -+ } 1.2445 -+ printk("\n"); 1.2446 -+ return 0; 1.2447 -+} 1.2448 -+ 1.2449 -+static struct esp_dma espdma0; 1.2450 -+static struct esp_private esp; 1.2451 -+/* 1.2452 -+ * Find all the esp cards on the system and initialize them 1.2453 -+ */ 1.2454 -+void esp_probe () 1.2455 -+{ 1.2456 -+ if (espdma_init(&espdma0) != 0) { 1.2457 -+ return; 1.2458 -+ } 1.2459 -+ 1.2460 -+ if (esp_init(&esp, &espdma0, PHYS_JJ_ESP_IRQ) != 0) { 1.2461 -+ printk("esp_probe: esp0 init failed\n"); 1.2462 -+ return; 1.2463 -+ } 1.2464 -+ return; 1.2465 -+} 1.2466 -+ 1.2467 -+void esp_read_capacity(int unit) 1.2468 -+{ 1.2469 -+ // Set SCSI target 1.2470 -+ stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7); 1.2471 -+ // Set DMA address 1.2472 -+ st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma); 1.2473 -+ // Set DMA length 1.2474 -+ stb_bypass(PHYS_JJ_ESP + 0*4, 10); 1.2475 -+ stb_bypass(PHYS_JJ_ESP + 1*4, 0); 1.2476 -+ // Set DMA direction 1.2477 -+ st_bypass(PHYS_JJ_ESPDMA + 0, 0x000); 1.2478 -+ // Setup command = Read Capacity 1.2479 -+ esp.buffer[0] = 0x80; 1.2480 -+ esp.buffer[1] = 0x25; 1.2481 -+ esp.buffer[2] = 0x00; 1.2482 -+ esp.buffer[3] = 0x00; 1.2483 -+ esp.buffer[4] = 0x00; 1.2484 -+ esp.buffer[5] = 0x00; 1.2485 -+ esp.buffer[6] = 0x00; 1.2486 -+ esp.buffer[7] = 0x00; 1.2487 -+ esp.buffer[8] = 0x00; 1.2488 -+ esp.buffer[9] = 0x00; 1.2489 -+ esp.buffer[10] = 0x00; 1.2490 -+ // Set ATN, issue command 1.2491 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2); 1.2492 -+ 1.2493 -+ // Set DMA length = 512 * read length 1.2494 -+ stb_bypass(PHYS_JJ_ESP + 0*4, 0); 1.2495 -+ stb_bypass(PHYS_JJ_ESP + 1*4, 8 & 0xff); 1.2496 -+ // Set DMA direction 1.2497 -+ st_bypass(PHYS_JJ_ESPDMA + 0, 0x100); 1.2498 -+ // Transfer 1.2499 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 0x90); 1.2500 -+ esp.disk[unit].hw_sector = (esp.buffer[4] << 24) | (esp.buffer[5] << 16) | (esp.buffer[6] << 8) | esp.buffer[7]; 1.2501 -+} 1.2502 -+ 1.2503 -+// offset is multiple of 512, len in bytes 1.2504 -+void *esp_read(int unit, int part, int offset, short len) 1.2505 -+{ 1.2506 -+ int pos, hw_sect, sect_offset, spb; 1.2507 -+ 1.2508 -+ // Set SCSI target 1.2509 -+ stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7); 1.2510 -+ // Set DMA address 1.2511 -+ st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma); 1.2512 -+ // Set DMA length 1.2513 -+ stb_bypass(PHYS_JJ_ESP + 0*4, 10); 1.2514 -+ stb_bypass(PHYS_JJ_ESP + 1*4, 0); 1.2515 -+ // Set DMA direction 1.2516 -+ st_bypass(PHYS_JJ_ESPDMA + 0, 0x000); 1.2517 -+ hw_sect = esp.disk[unit].hw_sector; 1.2518 -+ offset += esp.disk[unit].part_offset[part]; 1.2519 -+ spb = hw_sect / 512; 1.2520 -+ sect_offset = offset / spb; 1.2521 -+ pos = (offset - sect_offset * spb) * 512; 1.2522 -+ len /= 512; 1.2523 -+ //printk("Read unit %d, offset %d -> offset %d, pos %d, hw_sect %d\n", unit, offset, sect_offset, pos, hw_sect); 1.2524 -+ // Setup command = Read(10) 1.2525 -+ esp.buffer[0] = 0x80; 1.2526 -+ esp.buffer[1] = 0x28; 1.2527 -+ esp.buffer[2] = 0x00; 1.2528 -+ esp.buffer[3] = (sect_offset >> 24) & 0xff; 1.2529 -+ esp.buffer[4] = (sect_offset >> 16) & 0xff; 1.2530 -+ esp.buffer[5] = (sect_offset >> 8) & 0xff; 1.2531 -+ esp.buffer[6] = sect_offset & 0xff; 1.2532 -+ esp.buffer[7] = 0x00; 1.2533 -+ esp.buffer[8] = (len >> 8) & 0xff; 1.2534 -+ esp.buffer[9] = len & 0xff; 1.2535 -+ // Set ATN, issue command 1.2536 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2); 1.2537 -+ 1.2538 -+ // Set DMA length = sector size * read length 1.2539 -+ stb_bypass(PHYS_JJ_ESP + 0*4, (len * hw_sect) & 0xff); 1.2540 -+ stb_bypass(PHYS_JJ_ESP + 1*4, ((len * hw_sect) >> 8) & 0xff); 1.2541 -+ // Set DMA direction 1.2542 -+ st_bypass(PHYS_JJ_ESPDMA + 0, 0x100); 1.2543 -+ // Transfer 1.2544 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 0x90); 1.2545 -+ return esp.buffer + pos; 1.2546 -+} 1.2547 -+ 1.2548 -+// Sparc boot sequence can be found in SILO docs, 1.2549 -+// first-isofs/README.SILO_ISOFS 1.2550 -+int esp_boot(int unit) 1.2551 -+{ 1.2552 -+ struct sun_disklabel { 1.2553 -+ unsigned char info[128]; /* Informative text string */ 1.2554 -+ unsigned char spare0[14]; 1.2555 -+ struct sun_info { 1.2556 -+ unsigned char spare1; 1.2557 -+ unsigned char id; 1.2558 -+ unsigned char spare2; 1.2559 -+ unsigned char flags; 1.2560 -+ } infos[8]; 1.2561 -+ unsigned char spare[246]; /* Boot information etc. */ 1.2562 -+ short rspeed; /* Disk rotational speed */ 1.2563 -+ short pcylcount; /* Physical cylinder count */ 1.2564 -+ short sparecyl; /* extra sects per cylinder */ 1.2565 -+ unsigned char spare2[4]; /* More magic... */ 1.2566 -+ short ilfact; /* Interleave factor */ 1.2567 -+ short ncyl; /* Data cylinder count */ 1.2568 -+ short nacyl; /* Alt. cylinder count */ 1.2569 -+ short ntrks; /* Tracks per cylinder */ 1.2570 -+ short nsect; /* Sectors per track */ 1.2571 -+ unsigned char spare3[4]; /* Even more magic... */ 1.2572 -+ struct sun_partition { 1.2573 -+ int start_cylinder; 1.2574 -+ int num_sectors; 1.2575 -+ } partitions[8]; 1.2576 -+ short magic; /* Magic number */ 1.2577 -+ short csum; /* Label xor'd checksum */ 1.2578 -+ } *label; 1.2579 -+ unsigned int i, offset; 1.2580 -+ void *src, *dst; 1.2581 -+ 1.2582 -+ printk("Loading partition table from target %d:\n", unit); 1.2583 -+ // Chip reset 1.2584 -+ stb_bypass(PHYS_JJ_ESP + 3*4, 2); 1.2585 -+ 1.2586 -+ esp_open(&esp); 1.2587 -+ esp_read_capacity(unit); 1.2588 -+ 1.2589 -+ label = esp_read(unit, 0, 0, 512); 1.2590 -+ printk("hw sector: %d, CHS: %d/%d/%d, partitions:\n", esp.disk[unit].hw_sector, 1.2591 -+ label->ncyl, label->ntrks, label->nsect); 1.2592 -+ for (i = 0; i < 8; i++) { 1.2593 -+ printk("%c: %d + %d, id %x, flags %x\n", 'a' + i, label->partitions[i].start_cylinder, 1.2594 -+ label->partitions[i].num_sectors, label->infos[i].id, label->infos[i].flags); 1.2595 -+ esp.disk[unit].part_offset[i] = label->partitions[3].start_cylinder * label->ntrks * label->nsect; 1.2596 -+ } 1.2597 -+ offset = 1; 1.2598 -+ printk("booting sd(0,%d,0):d (offset %d)\n", unit, offset); 1.2599 -+ // Skip a.out header (0x20) 1.2600 -+ dst = (void *)0x4000; 1.2601 -+ src = esp_read(unit, 3, offset, 512); 1.2602 -+ src = (void *)((unsigned int) src + 0x20); 1.2603 -+ memcpy(dst, src, 512 - 0x20); 1.2604 -+ dst = (void *)0x4000 + 512 - 0x20; 1.2605 -+ for (i = 1; i < 7680/512; i++) { 1.2606 -+ src = esp_read(unit, 3, offset + i, 512); 1.2607 -+ memcpy(dst, src, 512); 1.2608 -+ dst += 512; 1.2609 -+ } 1.2610 -+ esp_close(&esp); 1.2611 -+ return 0; 1.2612 -+} 1.2613 -diff -ruN proll_18.orig/src/hconsole.c proll-patch-15/src/hconsole.c 1.2614 ---- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000 1.2615 -+++ proll-patch-15/src/hconsole.c 2005-11-09 18:46:34.000000000 +0000 1.2616 -@@ -29,6 +29,10 @@ 1.2617 - struct raster r_master; /* For a case of resize, whole fb */ 1.2618 - struct raster r_0; /* malloc() erzatz */ 1.2619 - 1.2620 -+#ifdef QEMU 1.2621 -+extern unsigned int q_height, q_width; 1.2622 -+#endif 1.2623 -+ 1.2624 - int hcon_init(struct hconsole *t, unsigned int a0) 1.2625 - { 1.2626 - struct raster *q, *r; 1.2627 -@@ -42,7 +46,11 @@ 1.2628 - * No probing sequence or argument passing, hardcode everything. XXX 1.2629 - */ 1.2630 - raster8_cons_a(q, 768, 1024, (char *)a0); 1.2631 -+#ifndef QEMU 1.2632 - raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80)); 1.2633 -+#else 1.2634 -+ raster_cons_2(r, q, 0, 0, q_height, q_width); 1.2635 -+#endif 1.2636 - t->r_ = r; 1.2637 - t->r0_ = q; 1.2638 - t->f_ = &f_master; 1.2639 -@@ -67,7 +75,7 @@ 1.2640 - return 0; 1.2641 - } 1.2642 - 1.2643 --void hcon_fini (struct hconsole *t) 1.2644 -+void hcon_fini (__attribute((unused)) struct hconsole *t) 1.2645 - { 1.2646 - return; 1.2647 - } 1.2648 -@@ -77,12 +85,12 @@ 1.2649 - { 1.2650 - struct rfont *f = t->f_; 1.2651 - 1.2652 -- if (sy < 0 || sy >= t->ydim_) return -1; 1.2653 -- if (sx < 0 || sx >= t->xdim_) return -1; 1.2654 -+ if (sy < 0 || (unsigned)sy >= t->ydim_) return -1; 1.2655 -+ if (sx < 0 || (unsigned)sx >= t->xdim_) return -1; 1.2656 - if (height < 0) return -1; 1.2657 -- if (sy + height > t->ydim_) height = t->ydim_ - sy; 1.2658 -+ if ((unsigned)sy + (unsigned)height > t->ydim_) height = t->ydim_ - sy; 1.2659 - if (width < 0) return -1; 1.2660 -- if (sx + width > t->xdim_) width = t->xdim_ - sx; 1.2661 -+ if ((unsigned)sx + (unsigned)width > t->xdim_) width = t->xdim_ - sx; 1.2662 - 1.2663 - /* XXX Clear with correct background color */ 1.2664 - (*t->r_->clear_)(t->r_, 1.2665 -@@ -107,10 +115,10 @@ 1.2666 - char c0 = c; 1.2667 - RC_color rfg, rbg; 1.2668 - 1.2669 -- if (y < 0 || y >= t->ydim_) return -1; 1.2670 -- if (x < 0 || x >= t->xdim_) return -1; 1.2671 -+ if (y < 0 || (unsigned)y >= t->ydim_) return -1; 1.2672 -+ if (x < 0 || (unsigned)x >= t->xdim_) return -1; 1.2673 - 1.2674 -- if (t->curson_ && t->ypos_ == y && t->xpos_ == x) { 1.2675 -+ if (t->curson_ && t->ypos_ == (unsigned)y && t->xpos_ == (unsigned)x) { 1.2676 - rfg = t->bg_; rbg = t->fg_; 1.2677 - } else { 1.2678 - rfg = t->fg_; rbg = t->bg_; 1.2679 -@@ -126,9 +134,9 @@ 1.2680 - { 1.2681 - struct rfont *f = t->f_; 1.2682 - 1.2683 -- if (y < 0 || y >= t->ydim_) return -1; 1.2684 -- if (x < 0 || x >= t->xdim_) return -1; 1.2685 -- if (x + count >= t->xdim_) count = t->xdim_ - x; 1.2686 -+ if (y < 0 || (unsigned)y >= t->ydim_) return -1; 1.2687 -+ if (x < 0 || (unsigned)x >= t->xdim_) return -1; 1.2688 -+ if ((unsigned)x + (unsigned)count >= t->xdim_) count = t->xdim_ - x; 1.2689 - 1.2690 - (*t->r_->render_)(t->r_, y*f->height_, x*f->width_, 1.2691 - s, count, t->bg_, t->fg_, f); 1.2692 -@@ -200,8 +208,8 @@ 1.2693 - 1.2694 - rc = 0; 1.2695 - if (dir == SM_UP) { 1.2696 -- if (d < 0 || d >= t->ydim_) return -1; 1.2697 -- if (b <= d || b > t->ydim_) return -1; 1.2698 -+ if (d < 0 || (unsigned)d >= t->ydim_) return -1; 1.2699 -+ if (b <= d || (unsigned)b > t->ydim_) return -1; 1.2700 - if (d + count >= b) count = b - d; 1.2701 - if (d + count >= b) count = b - d; 1.2702 - (*t->r_->yscroll_)(t->r_, 1.2703 -@@ -213,8 +221,8 @@ 1.2704 - count*f->height_, raster_qwidth(t->r_), 1.2705 - t->bg_); 1.2706 - } else if (dir == SM_DOWN) { 1.2707 -- if (d < 0 || d >= t->ydim_) return -1; 1.2708 -- if (b <= d || b > t->ydim_) return -1; 1.2709 -+ if (d < 0 || (unsigned)d >= t->ydim_) return -1; 1.2710 -+ if (b <= d || (unsigned)b > t->ydim_) return -1; 1.2711 - if (d + count >= b) count = b - d; 1.2712 - (*t->r_->yscroll_)(t->r_, 1.2713 - d*f->height_, 0, 1.2714 -diff -ruN proll_18.orig/src/hme.c proll-patch-15/src/hme.c 1.2715 ---- proll_18.orig/src/hme.c 2002-07-23 05:52:52.000000000 +0000 1.2716 -+++ proll-patch-15/src/hme.c 2005-04-16 06:16:20.000000000 +0000 1.2717 -@@ -655,10 +655,10 @@ 1.2718 - unsigned int flags, 1.2719 - unsigned int addr) 1.2720 - { 1.2721 -- __asm__ __volatile__(" 1.2722 -- stwa %3, [%0] %2 1.2723 -- stwa %4, [%1] %2 1.2724 --" : /* no outputs */ 1.2725 -+ __asm__ __volatile__( 1.2726 -+ "stwa %3, [%0] %2\n\t" 1.2727 -+ "stwa %4, [%1] %2\n\t" 1.2728 -+ : /* no outputs */ 1.2729 - : "r" (&rp->rx_addr), "r" (&rp->rx_flags), 1.2730 - "i" (ASI_PL), "r" (addr), "r" (flags)); 1.2731 - } 1.2732 -@@ -667,10 +667,10 @@ 1.2733 - unsigned int flags, 1.2734 - unsigned int addr) 1.2735 - { 1.2736 -- __asm__ __volatile__(" 1.2737 -- stwa %3, [%0] %2 1.2738 -- stwa %4, [%1] %2 1.2739 --" : /* no outputs */ 1.2740 -+ __asm__ __volatile__( 1.2741 -+ "stwa %3, [%0] %2\n\t" 1.2742 -+ "stwa %4, [%1] %2\n\t" 1.2743 -+ : /* no outputs */ 1.2744 - : "r" (&tp->tx_addr), "r" (&tp->tx_flags), 1.2745 - "i" (ASI_PL), "r" (addr), "r" (flags)); 1.2746 - } 1.2747 -@@ -2404,7 +2404,7 @@ 1.2748 - TXD(("[%d]", elem)); 1.2749 - this = &txbase[elem]; 1.2750 - #ifdef __sparc_v9__ 1.2751 -- __asm__ __volatile__("lduwa [%1] %2, %0" 1.2752 -+ __asm__ __volatile__("lduwa [%1] %2, %0\n\t" 1.2753 - : "=r" (flags) 1.2754 - : "r" (&this->tx_flags), "i" (ASI_PL)); 1.2755 - #else 1.2756 -@@ -2447,7 +2447,7 @@ 1.2757 - RXD(("RX<")); 1.2758 - this = &rxbase[elem]; 1.2759 - #ifdef __sparc_v9__ 1.2760 -- __asm__ __volatile__("lduwa [%1] %2, %0" 1.2761 -+ __asm__ __volatile__("lduwa [%1] %2, %0\n\t" 1.2762 - : "=r" (flags) 1.2763 - : "r" (&this->rx_flags), "i" (ASI_PL)); 1.2764 - #else 1.2765 -@@ -2530,7 +2530,7 @@ 1.2766 - elem = NEXT_RX(elem); 1.2767 - this = &rxbase[elem]; 1.2768 - #ifdef __sparc_v9__ 1.2769 -- __asm__ __volatile__("lduwa [%1] %2, %0" 1.2770 -+ __asm__ __volatile__("lduwa [%1] %2, %0\n\t" 1.2771 - : "=r" (flags) 1.2772 - : "r" (&this->rx_flags), "i" (ASI_PL)); 1.2773 - #else 1.2774 -diff -ruN proll_18.orig/src/iommu.c proll-patch-15/src/iommu.c 1.2775 ---- proll_18.orig/src/iommu.c 2002-07-23 05:52:49.000000000 +0000 1.2776 -+++ proll-patch-15/src/iommu.c 2005-08-14 10:08:17.000000000 +0000 1.2777 -@@ -36,7 +36,7 @@ 1.2778 - unsigned int pa, ba; 1.2779 - unsigned int npages; 1.2780 - unsigned int mva, mpa; 1.2781 -- int i; 1.2782 -+ unsigned int i; 1.2783 - unsigned int *iopte; 1.2784 - 1.2785 - npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE; 1.2786 -diff -ruN proll_18.orig/src/lat7_2.bm proll-patch-15/src/lat7_2.bm 1.2787 ---- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000 1.2788 -+++ proll-patch-15/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000 1.2789 -@@ -1,6 +1,6 @@ 1.2790 - #define lat7_2_width 128 1.2791 - #define lat7_2_height 88 1.2792 --static unsigned char lat7_2_bits[] = { 1.2793 -+static unsigned const char lat7_2_bits[] = { 1.2794 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2795 - 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18, 1.2796 - 0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02, 1.2797 -diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch-15/src/lat7_2_swapped.bm 1.2798 ---- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000 1.2799 -+++ proll-patch-15/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000 1.2800 -@@ -0,0 +1,121 @@ 1.2801 -+#define lat7_2_width 128 1.2802 -+#define lat7_2_height 88 1.2803 -+static unsigned const char lat7_2_bits[] = { 1.2804 -+ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2805 -+ 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48, 1.2806 -+ 0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40, 1.2807 -+ 0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40, 1.2808 -+ 0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 1.2809 -+ 0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00, 1.2810 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 1.2811 -+ 0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10, 1.2812 -+ 0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04, 1.2813 -+ 0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 1.2814 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00, 1.2815 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 1.2816 -+ 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 1.2817 -+ 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 1.2818 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 1.2819 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2820 -+ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2821 -+ 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2822 -+ 0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 1.2823 -+ 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 1.2824 -+ 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 1.2825 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 1.2826 -+ 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 1.2827 -+ 0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60, 1.2828 -+ 0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36, 1.2829 -+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e, 1.2830 -+ 0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78, 1.2831 -+ 0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 1.2832 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 1.2833 -+ 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2834 -+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 1.2835 -+ 0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2836 -+ 0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00, 1.2837 -+ 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 1.2838 -+ 0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18, 1.2839 -+ 0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 1.2840 -+ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18, 1.2841 -+ 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18, 1.2842 -+ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c, 1.2843 -+ 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 1.2844 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 1.2845 -+ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 1.2846 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 1.2847 -+ 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00, 1.2848 -+ 0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00, 1.2849 -+ 0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 1.2850 -+ 0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 1.2851 -+ 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 1.2852 -+ 0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66, 1.2853 -+ 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 1.2854 -+ 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30, 1.2855 -+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 1.2856 -+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 1.2857 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 1.2858 -+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 1.2859 -+ 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 1.2860 -+ 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 1.2861 -+ 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 1.2862 -+ 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e, 1.2863 -+ 0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66, 1.2864 -+ 0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66, 1.2865 -+ 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 1.2866 -+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 1.2867 -+ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00, 1.2868 -+ 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00, 1.2869 -+ 0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 1.2870 -+ 0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 1.2871 -+ 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 1.2872 -+ 0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c, 1.2873 -+ 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 1.2874 -+ 0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f, 1.2875 -+ 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e, 1.2876 -+ 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 1.2877 -+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 1.2878 -+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02, 1.2879 -+ 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00, 1.2880 -+ 0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 1.2881 -+ 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 1.2882 -+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 1.2883 -+ 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 1.2884 -+ 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 1.2885 -+ 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 1.2886 -+ 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30, 1.2887 -+ 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 1.2888 -+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 1.2889 -+ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 1.2890 -+ 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2891 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 1.2892 -+ 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2893 -+ 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60, 1.2894 -+ 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2895 -+ 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 1.2896 -+ 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 1.2897 -+ 0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78, 1.2898 -+ 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 1.2899 -+ 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 1.2900 -+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00, 1.2901 -+ 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 1.2902 -+ 0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00, 1.2903 -+ 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 1.2904 -+ 0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2905 -+ 0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1.2906 -+ 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 1.2907 -+ 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 1.2908 -+ 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60, 1.2909 -+ 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06, 1.2910 -+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c, 1.2911 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00, 1.2912 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 1.2913 -+ 0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00, 1.2914 -+ 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 1.2915 -+ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00, 1.2916 -+ 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 1.2917 -+ 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 1.2918 -+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c, 1.2919 -+ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00, 1.2920 -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00, 1.2921 -+ 0x00, 0x00, 0x00, 0x00}; 1.2922 -diff -ruN proll_18.orig/src/le.c proll-patch-15/src/le.c 1.2923 ---- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000 1.2924 -+++ proll-patch-15/src/le.c 2005-04-16 06:16:20.000000000 +0000 1.2925 -@@ -185,8 +185,6 @@ 1.2926 - unsigned short rap; /* register address port */ 1.2927 - }; 1.2928 - 1.2929 --int sparc_lance_debug = 2; 1.2930 -- 1.2931 - /* The Lance uses 24 bit addresses */ 1.2932 - /* On the Sun4c the DVMA will provide the remaining bytes for us */ 1.2933 - /* On the Sun4m we have to instruct the ledma to provide them */ 1.2934 -@@ -771,7 +769,7 @@ 1.2935 - /* Clear the slack of the packet, do I need this? */ 1.2936 - /* For a firewall its a good idea - AC */ 1.2937 - if (len != skblen) 1.2938 -- bzero((char *) &ib->tx_buf [entry][skblen], len - skblen); 1.2939 -+ memset((char *) &ib->tx_buf [entry][skblen], 0, len - skblen); 1.2940 - 1.2941 - /* Now, give the packet to the lance */ 1.2942 - ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); 1.2943 -diff -ruN proll_18.orig/src/net.h proll-patch-15/src/net.h 1.2944 ---- proll_18.orig/src/net.h 1999-12-15 17:20:17.000000000 +0000 1.2945 -+++ proll-patch-15/src/net.h 2005-08-14 10:17:02.000000000 +0000 1.2946 -@@ -124,7 +124,7 @@ 1.2947 - extern int udp_open __P((t_ipaddr daddr, int source, int dest)); 1.2948 - 1.2949 - /* Read from a UDP socket */ 1.2950 --extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch)); 1.2951 -+extern int udp_read(char *buf, unsigned int bufsize, int timeout); 1.2952 - 1.2953 - /* Write to a UDP socket */ 1.2954 - extern int udp_write __P((char *buf, int writelen)); 1.2955 -diff -ruN proll_18.orig/src/netinit.c proll-patch-15/src/netinit.c 1.2956 ---- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000 1.2957 -+++ proll-patch-15/src/netinit.c 2004-11-13 15:50:49.000000000 +0000 1.2958 -@@ -49,13 +49,20 @@ 1.2959 - unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */ 1.2960 - t_ipaddr myipaddr; /* my own IP address */ 1.2961 - t_ipaddr mynetmask; /* my own netmask */ 1.2962 -- char *net_module_name; /* name of init module */ 1.2963 - t_ipaddr servaddr; /* IP of RARP&TFTP server */ 1.2964 - 1.2965 - /* Broadcast hardware address */ 1.2966 --unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 1.2967 -+const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 1.2968 - 1.2969 - 1.2970 -+unsigned int seed; 1.2971 -+ 1.2972 -+/* This is taken from x86 to be used in network kernel. Returns 15 bits. */ 1.2973 -+short int random() 1.2974 -+{ 1.2975 -+ seed = (seed + 23968)*0x015A4E35 >> 1; 1.2976 -+ return seed & 0x7FFF; 1.2977 -+} 1.2978 - 1.2979 - /* 1.2980 - ************************************************************************** 1.2981 -@@ -104,10 +111,17 @@ 1.2982 - */ 1.2983 - void init_net() 1.2984 - { 1.2985 -+ /* Avoid data segment allocations */ 1.2986 -+ seed = 151; 1.2987 -+ 1.2988 - /* Initialize the different network layer modules */ 1.2989 - init_packet(); 1.2990 -- if (!init_arp() || !init_udp()) { 1.2991 -- printf("\nERROR: init_%s\n", net_module_name); 1.2992 -+ if (!init_arp()) { 1.2993 -+ printf("\nERROR: init_arp\n"); 1.2994 -+ fatal(); 1.2995 -+ } 1.2996 -+ if (!init_udp()) { 1.2997 -+ printf("\nERROR: init_udp\n"); 1.2998 - fatal(); 1.2999 - } 1.3000 - } 1.3001 -diff -ruN proll_18.orig/src/netpriv.h proll-patch-15/src/netpriv.h 1.3002 ---- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000 1.3003 -+++ proll-patch-15/src/netpriv.h 2005-08-14 10:12:20.000000000 +0000 1.3004 -@@ -83,7 +83,7 @@ 1.3005 - */ 1.3006 - struct device *dev; 1.3007 - char *data; 1.3008 -- int len; 1.3009 -+ unsigned int len; 1.3010 - int protocol; 1.3011 - unsigned char ip_summed; 1.3012 - }; 1.3013 -@@ -130,10 +130,9 @@ 1.3014 - * 1.3015 - */ 1.3016 - extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address */ 1.3017 --extern unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */ 1.3018 -+extern const unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */ 1.3019 - extern t_ipaddr myipaddr; /* my own IP address */ 1.3020 - extern t_ipaddr mynetmask; /* netmask for my network */ 1.3021 --extern char *net_module_name; /* initialized module's name */ 1.3022 - extern t_ipaddr servaddr; /* server IP address */ 1.3023 - 1.3024 - 1.3025 -@@ -150,7 +149,7 @@ 1.3026 - extern unsigned char *reg_type __P((int typeval, int (* receive)())); 1.3027 - 1.3028 - /* Write a packet to the network */ 1.3029 --extern int write_packet __P((int bufsize, int typeval, unsigned char *addr)); 1.3030 -+extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr)); 1.3031 - 1.3032 - /* Empty read buffer */ 1.3033 - extern void empty_buf __P((void)); 1.3034 -diff -ruN proll_18.orig/src/openprom.h proll-patch-15/src/openprom.h 1.3035 ---- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000 1.3036 -+++ proll-patch-15/src/openprom.h 2005-05-13 16:23:14.000000000 +0000 1.3037 -@@ -54,29 +54,29 @@ 1.3038 - }; 1.3039 - 1.3040 - struct linux_mem_v0 { 1.3041 -- struct linux_mlist_v0 **v0_totphys; 1.3042 -- struct linux_mlist_v0 **v0_prommap; 1.3043 -- struct linux_mlist_v0 **v0_available; /* What we can use */ 1.3044 -+ struct linux_mlist_v0 * const *v0_totphys; 1.3045 -+ struct linux_mlist_v0 * const *v0_prommap; 1.3046 -+ struct linux_mlist_v0 * const *v0_available; /* What we can use */ 1.3047 - }; 1.3048 - 1.3049 - /* Arguments sent to the kernel from the boot prompt. */ 1.3050 - struct linux_arguments_v0 { 1.3051 -- char *argv[8]; 1.3052 -+ const char *argv[8]; 1.3053 - char args[100]; 1.3054 - char boot_dev[2]; 1.3055 - int boot_dev_ctrl; 1.3056 - int boot_dev_unit; 1.3057 - int dev_partition; 1.3058 -- char *kernel_file_name; 1.3059 -+ const char *kernel_file_name; 1.3060 - void *aieee1; /* XXX */ 1.3061 - }; 1.3062 - 1.3063 - /* V2 and up boot things. */ 1.3064 - struct linux_bootargs_v2 { 1.3065 -- char **bootpath; 1.3066 -- char **bootargs; 1.3067 -- int *fd_stdin; 1.3068 -- int *fd_stdout; 1.3069 -+ const char **bootpath; 1.3070 -+ const char **bootargs; 1.3071 -+ const int *fd_stdin; 1.3072 -+ const int *fd_stdout; 1.3073 - }; 1.3074 - 1.3075 - /* The top level PROM vector. */ 1.3076 -@@ -91,13 +91,13 @@ 1.3077 - struct linux_mem_v0 pv_v0mem; 1.3078 - 1.3079 - /* Node operations. */ 1.3080 -- struct linux_nodeops *pv_nodeops; 1.3081 -+ const struct linux_nodeops *pv_nodeops; 1.3082 - 1.3083 - char **pv_bootstr; 1.3084 - struct linux_dev_v0_funcs pv_v0devops; 1.3085 - 1.3086 -- char *pv_stdin; 1.3087 -- char *pv_stdout; 1.3088 -+ const char *pv_stdin; 1.3089 -+ const char *pv_stdout; 1.3090 - #define PROMDEV_KBD 0 /* input from keyboard */ 1.3091 - #define PROMDEV_SCREEN 0 /* output to screen */ 1.3092 - #define PROMDEV_TTYA 1 /* in/out to ttya */ 1.3093 -@@ -127,7 +127,7 @@ 1.3094 - void (*v2_eval)(char *str); 1.3095 - } pv_fortheval; 1.3096 - 1.3097 -- struct linux_arguments_v0 **pv_v0bootargs; 1.3098 -+ const struct linux_arguments_v0 * const *pv_v0bootargs; 1.3099 - 1.3100 - /* Get ether address. */ 1.3101 - unsigned int (*pv_enaddr)(int d, char *enaddr); 1.3102 -@@ -175,7 +175,7 @@ 1.3103 - int (*no_proplen)(int node, char *name); 1.3104 - int (*no_getprop)(int node, char *name, char *val); 1.3105 - int (*no_setprop)(int node, char *name, char *val, int len); 1.3106 -- char * (*no_nextprop)(int node, char *name); 1.3107 -+ const char * (*no_nextprop)(int node, char *name); 1.3108 - }; 1.3109 - 1.3110 - /* More fun PROM structures for device probing. */ 1.3111 -diff -ruN proll_18.orig/src/packet.c proll-patch-15/src/packet.c 1.3112 ---- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000 1.3113 -+++ proll-patch-15/src/packet.c 2005-08-14 10:12:49.000000000 +0000 1.3114 -@@ -41,7 +41,7 @@ 1.3115 - int aligner; 1.3116 - } wbuf; 1.3117 - static struct sk_buff *rskb; 1.3118 --static int nqskb = 0; 1.3119 -+static int nqskb; 1.3120 - 1.3121 - 1.3122 - void init_packet() 1.3123 -@@ -62,6 +62,8 @@ 1.3124 - for (i = 0; i < MAXSKBS; i++) { 1.3125 - skev[i].skb.allocn = i; 1.3126 - } 1.3127 -+ 1.3128 -+ nqskb = 0; 1.3129 - } 1.3130 - 1.3131 - unsigned char *reg_type(int ptype, int (*func)()) 1.3132 -@@ -81,7 +83,7 @@ 1.3133 - return wbuf.s; 1.3134 - } 1.3135 - 1.3136 --int write_packet(int leng, int type, unsigned char *dst) 1.3137 -+int write_packet(int leng, int type, const unsigned char *dst) 1.3138 - { 1.3139 - struct sk_buff *skb; 1.3140 - unsigned char *s; 1.3141 -@@ -209,12 +211,12 @@ 1.3142 - /* 1.3143 - */ 1.3144 - void 1.3145 --eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, int base) 1.3146 -+eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, __attribute__((unused)) int base) 1.3147 - { 1.3148 - bcopy(src, dest->data, len); 1.3149 - } 1.3150 - 1.3151 --unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev) 1.3152 -+unsigned short eth_type_trans(struct sk_buff *skb, __attribute__((unused)) struct device *dev) 1.3153 - { 1.3154 - unsigned char *s = skb->data + 12; 1.3155 - return s[0] << 8 | s[1]; /* Network order word */ 1.3156 -diff -ruN proll_18.orig/src/printf.c proll-patch-15/src/printf.c 1.3157 ---- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000 1.3158 -+++ proll-patch-15/src/printf.c 2005-08-14 10:07:26.000000000 +0000 1.3159 -@@ -19,7 +19,7 @@ 1.3160 - static void printn(struct prf_fp *, unsigned long, unsigned int); 1.3161 - static void putchar(char, struct prf_fp *); 1.3162 - 1.3163 --static char hextab[] = "0123456789ABCDEF"; 1.3164 -+static const char hextab[] = "0123456789ABCDEF"; 1.3165 - 1.3166 - /* 1.3167 - * Scaled down version of C Library printf. 1.3168 -@@ -41,7 +41,7 @@ 1.3169 - void 1.3170 - prf(struct prf_fp *filog, char *fmt, va_list adx) 1.3171 - { 1.3172 -- register c; 1.3173 -+ register int c; 1.3174 - char *s; 1.3175 - 1.3176 - for(;;) { 1.3177 -@@ -60,7 +60,7 @@ 1.3178 - putchar(va_arg(adx,unsigned), filog); 1.3179 - } else if(c == 's') { 1.3180 - s = va_arg(adx,char*); 1.3181 -- while(c = *s++) 1.3182 -+ while((c = *s++)) 1.3183 - putchar(c,filog); 1.3184 - } else if (c == 'l' || c == 'O') { 1.3185 - printn(filog, (long)va_arg(adx,long), c=='l'?10:8); 1.3186 -@@ -77,10 +77,6 @@ 1.3187 - char prbuf[24]; 1.3188 - register char *cp; 1.3189 - 1.3190 -- if (b == 10 && n < 0) { 1.3191 -- putchar('-',filog); 1.3192 -- n = (~n) + 1; /* n = -n */ 1.3193 -- } 1.3194 - cp = prbuf; 1.3195 - do 1.3196 - *cp++ = hextab[(unsigned int)(n%b)]; 1.3197 -diff -ruN proll_18.orig/src/rconsole.c proll-patch-15/src/rconsole.c 1.3198 ---- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000 1.3199 -+++ proll-patch-15/src/rconsole.c 2005-08-14 10:25:53.000000000 +0000 1.3200 -@@ -28,12 +28,18 @@ 1.3201 - * move to California. Only plain lat7 survived. 1.3202 - * I recreated lat7-1 changes in lat7-2. --zaitcev 1.3203 - */ 1.3204 -+#ifdef ORIG 1.3205 - #include "lat7_2.bm" /* lat7_1.bm */ 1.3206 -+#else 1.3207 -+#include "lat7_2_swapped.bm" /* lat7_1.bm */ 1.3208 -+#endif 1.3209 - #define LAT7_NCHARS 128 1.3210 - #define LAT7_HEIGHT 11 1.3211 - #define LAT7_WIDTH 8 1.3212 - 1.3213 -+#ifdef ORIG 1.3214 - static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ]; 1.3215 -+#endif 1.3216 - 1.3217 - #if 1 1.3218 - /* 1.3219 -@@ -46,18 +52,18 @@ 1.3220 - #endif 1.3221 - 1.3222 - static __inline__ void stfb_w(void *ptr, unsigned int data) { 1.3223 -- __asm__ __volatile__ ("sta %0, [%1] %2" : : 1.3224 -+ __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : : 1.3225 - "r" (data), "r" (ptr), "i" (ASI_M_BYPASS)); 1.3226 - } 1.3227 - 1.3228 - static __inline__ void stfb_b(void *ptr, unsigned int data) { 1.3229 -- __asm__ __volatile__ ("stba %0, [%1] %2" : : 1.3230 -+ __asm__ __volatile__ ("stba %0, [%1] %2\n\t" : : 1.3231 - "r" (data), "r" (ptr), "i" (ASI_M_BYPASS)); 1.3232 - } 1.3233 - 1.3234 - static __inline__ unsigned int ldfb_w(void *ptr) { 1.3235 - unsigned int data; 1.3236 -- __asm__ __volatile__ ("lda [%1] %2, %0" : 1.3237 -+ __asm__ __volatile__ ("lda [%1] %2, %0\n\t" : 1.3238 - "=r" (data) : 1.3239 - "r" (ptr), "i" (ASI_M_BYPASS)); 1.3240 - return data; 1.3241 -@@ -65,7 +71,7 @@ 1.3242 - 1.3243 - static __inline__ unsigned int ldfb_b(void *ptr) { 1.3244 - unsigned int data; 1.3245 -- __asm__ __volatile__ ("lduba [%1] %2, %0" : 1.3246 -+ __asm__ __volatile__ ("lduba [%1] %2, %0\n\t" : 1.3247 - "=r" (data) : 1.3248 - "r" (ptr), "i" (ASI_M_BYPASS)); 1.3249 - return data; 1.3250 -@@ -94,6 +100,7 @@ 1.3251 - 1.3252 - #endif 1.3253 - 1.3254 -+#ifdef ORIG 1.3255 - static inline int swapbits(int w0) 1.3256 - { 1.3257 - int w1 = 0; 1.3258 -@@ -105,13 +112,16 @@ 1.3259 - } 1.3260 - return w1; 1.3261 - } 1.3262 -+#endif 1.3263 - 1.3264 - void font_cons_7(struct rfont *p) 1.3265 - { 1.3266 -+#ifdef ORIG 1.3267 - int x; 1.3268 - int col = 0; 1.3269 - int row = 0; 1.3270 - int erow = 0; 1.3271 -+ 1.3272 - for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) { 1.3273 - lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] = 1.3274 - swapbits(lat7_2_bits[x]) & 0xFF; 1.3275 -@@ -124,6 +134,9 @@ 1.3276 - } 1.3277 - } 1.3278 - p->body_ = lat7_body; 1.3279 -+#else 1.3280 -+ p->body_ = lat7_2_bits; 1.3281 -+#endif 1.3282 - p->nchars_ = LAT7_NCHARS; 1.3283 - p->width_ = LAT7_WIDTH; 1.3284 - p->height_ = LAT7_HEIGHT; 1.3285 -@@ -175,7 +188,7 @@ 1.3286 - r->render_ = p->render_; 1.3287 - } 1.3288 - 1.3289 --void raster_dest(struct raster *r) 1.3290 -+void raster_dest(__attribute((unused)) struct raster *r) 1.3291 - { 1.3292 - } 1.3293 - 1.3294 -diff -ruN proll_18.orig/src/rconsole.h proll-patch-15/src/rconsole.h 1.3295 ---- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000 1.3296 -+++ proll-patch-15/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000 1.3297 -@@ -13,10 +13,10 @@ 1.3298 - */ 1.3299 - 1.3300 - #define RF_MAXWIDTH 16 1.3301 --typedef unsigned short Rf_scan; /* __w16 to be used */ 1.3302 -+typedef unsigned char Rf_scan; /* __w16 to be used */ 1.3303 - 1.3304 - struct rfont { 1.3305 -- Rf_scan *body_; 1.3306 -+ const Rf_scan *body_; 1.3307 - int nchars_; /* 128 for ASCII ... 65536 for Unicode */ 1.3308 - int width_; /* [Pixels]. Maximum size is 16. */ 1.3309 - int height_; /* [Pixels == scan lines]. */ 1.3310 -diff -ruN proll_18.orig/src/romlib.h proll-patch-15/src/romlib.h 1.3311 ---- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000 1.3312 -+++ proll-patch-15/src/romlib.h 2005-04-16 20:32:49.000000000 +0000 1.3313 -@@ -72,13 +72,13 @@ 1.3314 - */ 1.3315 - #define memcpy(dst, src, len) bcopy(src, dst, len) 1.3316 - #define memcmp(x1, x2, len) bcmp(x1, x2, len) 1.3317 --#define memset(p, len, zero) bzero(p, len) 1.3318 --extern void bcopy(void *b1, void *b2, int length); 1.3319 --extern int bcmp(void *b1, void *b2, int length); 1.3320 --extern void bzero(void *b, int c); 1.3321 -+extern void bcopy(const void *b1, void *b2, int length); 1.3322 -+extern int bcmp(const void *b1, const void *b2, int length); 1.3323 -+typedef unsigned int size_t; 1.3324 -+extern void *memset(void *p, int c, size_t len); 1.3325 - /* gcc complains about "conflicting types for builtin function strlen". */ 1.3326 - #define strlen(s) ssize(s) 1.3327 --extern int ssize(char *s); 1.3328 -+extern int ssize(const char *s); 1.3329 - 1.3330 - 1.3331 - /* 1.3332 -diff -ruN proll_18.orig/src/sched_4m.c proll-patch-15/src/sched_4m.c 1.3333 ---- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000 1.3334 -+++ proll-patch-15/src/sched_4m.c 2005-08-14 10:18:14.000000000 +0000 1.3335 -@@ -108,7 +108,7 @@ 1.3336 - static int set_bolt; /* Tick counter limit */ 1.3337 - static struct handsc hndv[16]; 1.3338 - 1.3339 --static unsigned int intr_to_mask[16] = { 1.3340 -+static unsigned const int intr_to_mask[16] = { 1.3341 - 0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0, 1.3342 - 0, 0, 0, 0, 0, 0, 0, 0, 1.3343 - }; 1.3344 -@@ -130,7 +130,7 @@ 1.3345 - int /* 0 - not expired yet; <>0 - timer expired */ 1.3346 - chk_timeout() 1.3347 - { 1.3348 -- int lim = (((1000000/HZ) + 1) << 10); 1.3349 -+ unsigned int lim = (((1000000/HZ) + 1) << 10); 1.3350 - unsigned int clear; 1.3351 - unsigned int intc; 1.3352 - int n; 1.3353 -@@ -182,7 +182,7 @@ 1.3354 - struct handsc *hndp; 1.3355 - unsigned int mask; 1.3356 - 1.3357 -- if (irq < 0 || irq >= 16) { 1.3358 -+ if (irq == 0 || irq >= 16) { 1.3359 - printk("request_irq: bad irq %d\n", irq); 1.3360 - return -1; 1.3361 - } 1.3362 -@@ -207,7 +207,7 @@ 1.3363 - { 1.3364 - struct handsc *hndp; 1.3365 - 1.3366 -- if (irq < 0 || irq >= 16) { 1.3367 -+ if (irq == 0 || irq >= 16) { 1.3368 - printk("free_irq: bad irq %d\n", irq); 1.3369 - return; 1.3370 - } 1.3371 -diff -ruN proll_18.orig/src/swap.c proll-patch-15/src/swap.c 1.3372 ---- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000 1.3373 -+++ proll-patch-15/src/swap.c 2004-11-13 15:50:49.000000000 +0000 1.3374 -@@ -0,0 +1,21 @@ 1.3375 -+// Convert the lat7 font so that no conversion is needed at runtime. 1.3376 -+#define ORIG 1.3377 -+#include "rconsole.c" 1.3378 -+ 1.3379 -+#include <stdio.h> 1.3380 -+ 1.3381 -+int main() 1.3382 -+{ 1.3383 -+ struct rfont p; 1.3384 -+ int i; 1.3385 -+ 1.3386 -+ font_cons_7(&p); 1.3387 -+ 1.3388 -+ printf(" "); 1.3389 -+ for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) { 1.3390 -+ printf("0x%02x, ", p.body_[i]); 1.3391 -+ if ((i % 12) == 11) 1.3392 -+ printf("\n "); 1.3393 -+ } 1.3394 -+ printf("\n"); 1.3395 -+} 1.3396 -diff -ruN proll_18.orig/src/system.c proll-patch-15/src/system.c 1.3397 ---- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000 1.3398 -+++ proll-patch-15/src/system.c 2005-04-16 06:16:20.000000000 +0000 1.3399 -@@ -298,8 +298,8 @@ 1.3400 - } 1.3401 - 1.3402 - /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */ 1.3403 -- pa = PAGE_SIZE; 1.3404 -- for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) { 1.3405 -+ pa = 0; 1.3406 -+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) { 1.3407 - map_page(l1, va, pa, 0, highbase); 1.3408 - pa += PAGE_SIZE; 1.3409 - } 1.3410 -@@ -507,30 +507,44 @@ 1.3411 - { 1.3412 - char *p; 1.3413 - 1.3414 -- if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size); 1.3415 -+ if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size); 1.3416 - return p; 1.3417 - } 1.3418 - 1.3419 - /* 1.3420 - * Library functions 1.3421 - */ 1.3422 --void bzero(void *s, int len) { 1.3423 -- while (len--) *((char *)s)++ = 0; 1.3424 -+void *memset(void *s, int c, size_t len) 1.3425 -+{ 1.3426 -+ void *p = s; 1.3427 -+ 1.3428 -+ while (len--) { 1.3429 -+ *(char *)s = c; 1.3430 -+ s++; 1.3431 -+ } 1.3432 -+ return p; 1.3433 - } 1.3434 - 1.3435 --void bcopy(void *f, void *t, int len) { 1.3436 -- while (len--) *((char *)t)++ = *((char *)f)++; 1.3437 -+void bcopy(const void *f, void *t, int len) { 1.3438 -+ while (len--) { 1.3439 -+ *(char *)t = *(char *)f; 1.3440 -+ f++; 1.3441 -+ t++; 1.3442 -+ } 1.3443 - } 1.3444 - 1.3445 - /* Comparison is 7-bit */ 1.3446 --int bcmp(void *s1, void *s2, int len) 1.3447 -+int bcmp(const void *s1, const void *s2, int len) 1.3448 - { 1.3449 - int i; 1.3450 - char ch; 1.3451 - 1.3452 - while (len--) { 1.3453 -- ch = *((char *)s1)++; 1.3454 -- if ((i = ch - *((char *)s2)++) != 0) 1.3455 -+ ch = *(char *)s1; 1.3456 -+ i = ch - *(char *)s2; 1.3457 -+ s1++; 1.3458 -+ s2++; 1.3459 -+ if (i != 0) 1.3460 - return i; 1.3461 - if (ch == 0) 1.3462 - return 0; 1.3463 -@@ -538,8 +552,8 @@ 1.3464 - return 0; 1.3465 - } 1.3466 - 1.3467 --int strlen(char *s) { 1.3468 -- char *p; 1.3469 -+int strlen(const char *s) { 1.3470 -+ const char *p; 1.3471 - for (p = s; *p != 0; p++) { } 1.3472 - return p - s; 1.3473 - } 1.3474 -@@ -560,14 +574,6 @@ 1.3475 - va_end(x1); 1.3476 - } 1.3477 - 1.3478 --/* This is taken from x86 to be used in network kernel. Returns 15 bits. */ 1.3479 --short int random() 1.3480 --{ 1.3481 -- static unsigned int seed = 151; 1.3482 -- seed = (seed + 23968)*0x015A4E35 >> 1; 1.3483 -- return seed & 0x7FFF; 1.3484 --} 1.3485 -- 1.3486 - void fatal() 1.3487 - { 1.3488 - printk("fatal."); 1.3489 -diff -ruN proll_18.orig/src/system.h proll-patch-15/src/system.h 1.3490 ---- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000 1.3491 -+++ proll-patch-15/src/system.h 2005-04-16 06:16:20.000000000 +0000 1.3492 -@@ -16,7 +16,7 @@ 1.3493 - #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */ 1.3494 - #define NCTX_SWIFT 0x100 1.3495 - 1.3496 --#define MAX_BANKS 3 /* Allocation for all machines */ 1.3497 -+#define MAX_BANKS 8 /* Allocation for all machines */ 1.3498 - 1.3499 - #ifndef __ASSEMBLY__ 1.3500 - struct bank { 1.3501 -@@ -164,10 +164,10 @@ 1.3502 - 1.3503 - extern __inline__ void setipl(unsigned long __orig_psr) 1.3504 - { 1.3505 -- __asm__ __volatile__(" 1.3506 -- wr %0, 0x0, %%psr 1.3507 -- nop; nop; nop 1.3508 --" : /* no outputs */ 1.3509 -+ __asm__ __volatile__( 1.3510 -+ "wr %0, 0x0, %%psr\n\t" 1.3511 -+ "nop; nop; nop\n\t" 1.3512 -+ : /* no outputs */ 1.3513 - : "r" (__orig_psr) 1.3514 - : "memory", "cc"); 1.3515 - } 1.3516 -@@ -176,13 +176,13 @@ 1.3517 - { 1.3518 - unsigned long tmp; 1.3519 - 1.3520 -- __asm__ __volatile__(" 1.3521 -- rd %%psr, %0 1.3522 -- nop; nop; nop; /* Sun4m + Cypress + SMP bug */ 1.3523 -- or %0, %1, %0 1.3524 -- wr %0, 0x0, %%psr 1.3525 -- nop; nop; nop 1.3526 --" : "=r" (tmp) 1.3527 -+ __asm__ __volatile__( 1.3528 -+ "rd %%psr, %0\n\t" 1.3529 -+ "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */ 1.3530 -+ "or %0, %1, %0\n\t" 1.3531 -+ "wr %0, 0x0, %%psr\n\t" 1.3532 -+ "nop; nop; nop\n\t" 1.3533 -+ : "=r" (tmp) 1.3534 - : "i" (PSR_PIL) 1.3535 - : "memory"); 1.3536 - } 1.3537 -@@ -191,13 +191,13 @@ 1.3538 - { 1.3539 - unsigned long tmp; 1.3540 - 1.3541 -- __asm__ __volatile__(" 1.3542 -- rd %%psr, %0 1.3543 -- nop; nop; nop; /* Sun4m + Cypress + SMP bug */ 1.3544 -- andn %0, %1, %0 1.3545 -- wr %0, 0x0, %%psr 1.3546 -- nop; nop; nop 1.3547 --" : "=r" (tmp) 1.3548 -+ __asm__ __volatile__( 1.3549 -+ "rd %%psr, %0\n\t" 1.3550 -+ "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */ 1.3551 -+ "andn %0, %1, %0\n\t" 1.3552 -+ "wr %0, 0x0, %%psr\n\t" 1.3553 -+ "nop; nop; nop\n\t" 1.3554 -+ : "=r" (tmp) 1.3555 - : "i" (PSR_PIL) 1.3556 - : "memory"); 1.3557 - } 1.3558 -@@ -214,18 +214,18 @@ 1.3559 - { 1.3560 - unsigned long retval; 1.3561 - 1.3562 -- __asm__ __volatile__(" 1.3563 -- rd %%psr, %0 1.3564 -- nop; nop; nop; /* Sun4m + Cypress + SMP bug */ 1.3565 -- and %0, %2, %%g1 1.3566 -- and %1, %2, %%g2 1.3567 -- xorcc %%g1, %%g2, %%g0 1.3568 -- be 1f 1.3569 -- nop 1.3570 -- wr %0, %2, %%psr 1.3571 -- nop; nop; nop; 1.3572 --1: 1.3573 --" : "=r" (retval) 1.3574 -+ __asm__ __volatile__( 1.3575 -+ "rd %%psr, %0\n\t" 1.3576 -+ "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */ 1.3577 -+ "and %0, %2, %%g1\n\t" 1.3578 -+ "and %1, %2, %%g2\n\t" 1.3579 -+ "xorcc %%g1, %%g2, %%g0\n\t" 1.3580 -+ "be 1f\n\t" 1.3581 -+ "nop\n\t" 1.3582 -+ "wr %0, %2, %%psr\n\t" 1.3583 -+ "nop; nop; nop;\n\t" 1.3584 -+ "1:\n\t" 1.3585 -+ : "=r" (retval) 1.3586 - : "r" (__new_psr), "i" (PSR_PIL) 1.3587 - : "g1", "g2", "memory", "cc"); 1.3588 - 1.3589 -@@ -236,13 +236,13 @@ 1.3590 - { 1.3591 - unsigned long retval; 1.3592 - 1.3593 -- __asm__ __volatile__(" 1.3594 -- rd %%psr, %0 1.3595 -- nop; nop; nop; /* Sun4m + Cypress + SMP bug */ 1.3596 -- or %0, %1, %%g1 1.3597 -- wr %%g1, 0x0, %%psr 1.3598 -- nop; nop; nop 1.3599 --" : "=r" (retval) 1.3600 -+ __asm__ __volatile__( 1.3601 -+ "rd %%psr, %0\n\t" 1.3602 -+ "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */ 1.3603 -+ "or %0, %1, %%g1\n\t" 1.3604 -+ "wr %%g1, 0x0, %%psr\n\t" 1.3605 -+ "nop; nop; nop\n\t" 1.3606 -+ : "=r" (retval) 1.3607 - : "i" (PSR_PIL) 1.3608 - : "g1", "memory"); 1.3609 - 1.3610 -diff -ruN proll_18.orig/src/tftp.c proll-patch-15/src/tftp.c 1.3611 ---- proll_18.orig/src/tftp.c 2002-09-13 21:53:34.000000000 +0000 1.3612 -+++ proll-patch-15/src/tftp.c 2005-08-14 10:16:15.000000000 +0000 1.3613 -@@ -127,7 +127,7 @@ 1.3614 - int len; 1.3615 - 1.3616 - /* Read packet with timeout */ 1.3617 -- len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT, CHR_ESC); 1.3618 -+ len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT); 1.3619 - if (len == 0) { 1.3620 - printf("TFTP: Timeout\n"); 1.3621 - return(ERR_TIMEOUT); 1.3622 -diff -ruN proll_18.orig/src/udp.c proll-patch-15/src/udp.c 1.3623 ---- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000 1.3624 -+++ proll-patch-15/src/udp.c 2005-08-14 10:17:19.000000000 +0000 1.3625 -@@ -76,12 +76,9 @@ 1.3626 - * 1.3627 - * Open a new UDP socket. 1.3628 - */ 1.3629 --int udp_open(daddr, source, dest) 1.3630 --t_ipaddr daddr; 1.3631 --int source; 1.3632 --int dest; 1.3633 -+int udp_open(t_ipaddr daddr, int source, int dest) 1.3634 - { 1.3635 -- register unsigned char *addr; 1.3636 -+ const unsigned char *addr; 1.3637 - 1.3638 - /* Set global variables */ 1.3639 - usource = source; 1.3640 -@@ -101,16 +98,13 @@ 1.3641 - * 1.3642 - * IP receiver routine 1.3643 - */ 1.3644 --static int ip_recv(buf, bufsize, addr) 1.3645 --unsigned char *buf; 1.3646 --int bufsize; 1.3647 --unsigned char *addr; 1.3648 -+static int ip_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr) 1.3649 - { 1.3650 - struct iphdr *ipp = ((struct iphdr *)buf); 1.3651 - struct udphdr *udpp = ((struct udphdr *)(buf + IP_MIN_HSIZE)); 1.3652 - struct udp_pseudo psehdr; 1.3653 - 1.3654 -- int size; 1.3655 -+ unsigned int size; 1.3656 - t_ipaddr dadr; 1.3657 - 1.3658 - #ifdef DEBUG 1.3659 -@@ -194,13 +188,9 @@ 1.3660 - * 1.3661 - * Read one packet from a UDP socket 1.3662 - */ 1.3663 --int udp_read(buf, bufsize, timeout, abortch) 1.3664 --char *buf; 1.3665 --int bufsize; 1.3666 --int timeout; 1.3667 --char abortch; 1.3668 -+int udp_read(char *buf, unsigned int bufsize, int timeout) 1.3669 - { 1.3670 -- int len; 1.3671 -+ unsigned int len; 1.3672 - 1.3673 - /* Wait until we get something */ 1.3674 - set_timeout(timeout); 1.3675 -@@ -299,9 +289,6 @@ 1.3676 - */ 1.3677 - int init_udp() 1.3678 - { 1.3679 -- /* Set module name for error handling */ 1.3680 -- net_module_name = "udp"; 1.3681 -- 1.3682 - /* Register IP packet type and set write buffer pointer */ 1.3683 - if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL) 1.3684 - return(FALSE); 1.3685 -diff -ruN proll_18.orig/src/udp.h proll-patch-15/src/udp.h 1.3686 ---- proll_18.orig/src/udp.h 2001-12-24 05:12:34.000000000 +0000 1.3687 -+++ proll-patch-15/src/udp.h 2005-08-14 10:16:40.000000000 +0000 1.3688 -@@ -53,7 +53,7 @@ 1.3689 - extern int udp_open __P((t_ipaddr daddr, int source, int dest)); 1.3690 - 1.3691 - /* Read from a UDP socket */ 1.3692 --extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch)); 1.3693 -+extern int udp_read(char *buf, unsigned int bufsize, int timeout); 1.3694 - 1.3695 - /* Write to a UDP socket */ 1.3696 - extern int udp_write __P((char *buf, int writelen)); 1.3697 -diff -ruN proll_18.orig/src/vcons_zs.c proll-patch-15/src/vcons_zs.c 1.3698 ---- proll_18.orig/src/vcons_zs.c 1970-01-01 00:00:00.000000000 +0000 1.3699 -+++ proll-patch-15/src/vcons_zs.c 2005-08-14 10:25:51.000000000 +0000 1.3700 -@@ -0,0 +1,68 @@ 1.3701 -+/** 1.3702 -+ ** Console over 'zs' (Zilog serial port) 1.3703 -+ ** Copyright 1999 Pete Zaitcev 1.3704 -+ ** This code is licensed under GNU General Public License. 1.3705 -+ **/ 1.3706 -+ 1.3707 -+#include "vconsole.h" 1.3708 -+#include <system.h> 1.3709 -+ 1.3710 -+#define ZS_DATA 0x02 1.3711 -+ 1.3712 -+int vcon_zs_init(struct vconterm *t, unsigned int a0) 1.3713 -+{ 1.3714 -+ 1.3715 -+ t->impl = (void *) a0; 1.3716 -+ 1.3717 -+ t->vc_x = 0; t->vc_y = 0; 1.3718 -+ t->backp = 0; t->backc = 0; 1.3719 -+ 1.3720 -+ stb_bypass(a0, 3); // reg 3 1.3721 -+ stb_bypass(a0, 1); // enable rx 1.3722 -+ 1.3723 -+ stb_bypass(a0, 5); // reg 5 1.3724 -+ stb_bypass(a0, 8); // enable tx 1.3725 -+ 1.3726 -+ return 0; 1.3727 -+} 1.3728 -+ 1.3729 -+int vcon_zs_putch(struct vconterm *t, char c) 1.3730 -+{ 1.3731 -+ unsigned zs_ptr = (unsigned) t->impl; 1.3732 -+ 1.3733 -+ //while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { } 1.3734 -+ stb_bypass(zs_ptr + ZS_DATA, c); 1.3735 -+ return 0; 1.3736 -+} 1.3737 -+ 1.3738 -+int vcon_zs_write(struct vconterm *t, char *data, int leng) 1.3739 -+{ 1.3740 -+ while (leng != 0) { 1.3741 -+ leng--; 1.3742 -+ vcon_zs_putch(t, *data++); 1.3743 -+ } 1.3744 -+ return leng; 1.3745 -+} 1.3746 -+ 1.3747 -+int vcon_zs_read(struct vconterm *t, char *data, __attribute((unused)) int leng) 1.3748 -+{ 1.3749 -+ unsigned zs_ptr = (unsigned) t->impl; 1.3750 -+ 1.3751 -+ while ((ldb_bypass(zs_ptr) & 1) != 1) { } 1.3752 -+ *data = ldb_bypass(zs_ptr + ZS_DATA); 1.3753 -+ return 0; 1.3754 -+} 1.3755 -+ 1.3756 -+int vcon_zs_getch(struct vconterm *t) 1.3757 -+{ 1.3758 -+ unsigned zs_ptr = (unsigned) t->impl; 1.3759 -+ 1.3760 -+ while ((ldb_bypass(zs_ptr) & 1) != 1) { } 1.3761 -+ return ldb_bypass(zs_ptr + ZS_DATA) & 0xff; 1.3762 -+} 1.3763 -+ 1.3764 -+void vcon_zs_fini(__attribute((unused)) struct vconterm *t) 1.3765 -+{ 1.3766 -+ /* violent crash in the end */ 1.3767 -+ ; 1.3768 -+} 1.3769 -diff -ruN proll_18.orig/src/vconsole.c proll-patch-15/src/vconsole.c 1.3770 ---- proll_18.orig/src/vconsole.c 1999-11-08 03:10:28.000000000 +0000 1.3771 -+++ proll-patch-15/src/vconsole.c 2005-08-14 10:24:49.000000000 +0000 1.3772 -@@ -7,12 +7,17 @@ 1.3773 - #include "vconsole.h" 1.3774 - 1.3775 - #include "hconsole.h" 1.3776 -+#include <system.h> 1.3777 - 1.3778 - static void vcon_i_cursfeed(struct vconterm *t); 1.3779 - static void vcon_i_backflush(struct vconterm *t); 1.3780 - 1.3781 - struct hconsole hcons0; 1.3782 - 1.3783 -+enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey, 1.3784 -+ EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, 1.3785 -+ ESpalette }; 1.3786 -+ 1.3787 - int vcon_init(struct vconterm *t, unsigned int a0) 1.3788 - { 1.3789 - struct hconsole *hconp; 1.3790 -@@ -25,11 +30,49 @@ 1.3791 - 1.3792 - t->vc_x = 0; t->vc_y = 0; 1.3793 - t->backp = 0; t->backc = 0; 1.3794 -+ t->vc_state = ESnormal; 1.3795 - 1.3796 - hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_); 1.3797 - return 0; 1.3798 - } 1.3799 - 1.3800 -+/* 1.3801 -+ * gotoxy() must verify all boundaries, because the arguments 1.3802 -+ * might also be negative. If the given position is out of 1.3803 -+ * bounds, the cursor is placed at the nearest margin. 1.3804 -+ */ 1.3805 -+static void gotoxy(struct vconterm *vc, int new_x, int new_y) 1.3806 -+{ 1.3807 -+ int max_x, max_y; 1.3808 -+ struct hconsole *hconp = vc->impl; 1.3809 -+ 1.3810 -+ max_x = hcon_qxdim(hconp); 1.3811 -+ max_y = hcon_qydim(hconp); 1.3812 -+ 1.3813 -+ if (new_x < 0) 1.3814 -+ vc->vc_x = 0; 1.3815 -+ else { 1.3816 -+ if (new_x >= max_x) 1.3817 -+ vc->vc_x = max_x - 1; 1.3818 -+ else 1.3819 -+ vc->vc_x = new_x; 1.3820 -+ } 1.3821 -+ 1.3822 -+ if (new_y < 0) 1.3823 -+ vc->vc_y = 0; 1.3824 -+ else if (new_y >= max_y) 1.3825 -+ vc->vc_y = max_y - 1; 1.3826 -+ else 1.3827 -+ vc->vc_y = new_y; 1.3828 -+ 1.3829 -+} 1.3830 -+ 1.3831 -+/* for absolute user moves, when decom is set */ 1.3832 -+static void gotoxay(struct vconterm *t, int new_x, int new_y) 1.3833 -+{ 1.3834 -+ gotoxy(t, new_x, new_y); 1.3835 -+} 1.3836 -+ 1.3837 - int vcon_write(struct vconterm *t, char *data, int leng) 1.3838 - { 1.3839 - int l = leng; 1.3840 -@@ -40,29 +83,101 @@ 1.3841 - if (l <= 0) break; 1.3842 - c = *data++; --l; 1.3843 - 1.3844 -- switch (c) { 1.3845 -- case 0x07: /* Bell */ 1.3846 -- vcon_i_backflush(t); 1.3847 -- break; 1.3848 -- case 0x0A: /* Linefeed */ 1.3849 -- vcon_i_backflush(t); 1.3850 -- vcon_i_cursfeed(t); 1.3851 -+ switch(t->vc_state) { 1.3852 -+ case ESesc: 1.3853 -+ t->vc_state = ESnormal; 1.3854 -+ switch (c) { 1.3855 -+ case '[': 1.3856 -+ t->vc_state = ESsquare; 1.3857 -+ break; 1.3858 -+ case 'M': 1.3859 -+ hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1); 1.3860 -+ break; 1.3861 -+ default: 1.3862 -+ //printk("Unhandled escape code '%c'\n", c); 1.3863 -+ break; 1.3864 -+ } 1.3865 - break; 1.3866 -- case 0x0D: /* Return */ 1.3867 -- vcon_i_backflush(t); 1.3868 -- t->vc_x = 0; 1.3869 -+ case ESsquare: 1.3870 -+ for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++) 1.3871 -+ t->vc_par[t->vc_npar] = 0; 1.3872 -+ t->vc_npar = 0; 1.3873 -+ t->vc_state = ESgetpars; 1.3874 -+ case ESgetpars: 1.3875 -+ if (c==';' && t->vc_npar<NPAR-1) { 1.3876 -+ t->vc_npar++; 1.3877 -+ break; 1.3878 -+ } else if (c>='0' && c<='9') { 1.3879 -+ t->vc_par[t->vc_npar] *= 10; 1.3880 -+ t->vc_par[t->vc_npar] += c-'0'; 1.3881 -+ break; 1.3882 -+ } else t->vc_state=ESgotpars; 1.3883 -+ case ESgotpars: 1.3884 -+ t->vc_state = ESnormal; 1.3885 -+ switch(c) { 1.3886 -+ case 'H': case 'f': 1.3887 -+ if (t->vc_par[0]) t->vc_par[0]--; 1.3888 -+ if (t->vc_par[1]) t->vc_par[1]--; 1.3889 -+ gotoxay(t, t->vc_par[1], t->vc_par[0]); 1.3890 -+ break; 1.3891 -+ case 'J': 1.3892 -+ if (t->vc_par[0] == 0) { 1.3893 -+ //erase from cursor to end of display 1.3894 -+ hcon_clear(hconp, t->vc_y, t->vc_x, hconp->ydim_, hconp->xdim_); 1.3895 -+ } 1.3896 -+ break; 1.3897 -+ case 'M': 1.3898 -+ hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1); 1.3899 -+ break; 1.3900 -+ case 'm': 1.3901 -+ break; 1.3902 -+ default: 1.3903 -+#if 0 1.3904 -+ printk("Unhandled escape code '%c', par[%d, %d, %d, %d, %d]\n", 1.3905 -+ c, t->vc_par[0], t->vc_par[1], t->vc_par[2], t->vc_par[3], t->vc_par[4]); 1.3906 -+#endif 1.3907 -+ break; 1.3908 -+ } 1.3909 - break; 1.3910 - default: 1.3911 -- if (t->backp == 0) { 1.3912 -- t->backc = 1; 1.3913 -- t->backp = data-1; 1.3914 -- } else { 1.3915 -- t->backc++; 1.3916 -- } 1.3917 -- if (t->vc_x + t->backc >= hcon_qxdim(hconp)) { 1.3918 -+ t->vc_state = ESnormal; 1.3919 -+ switch (c) { 1.3920 -+ case 0x07: /* Bell */ 1.3921 -+ vcon_i_backflush(t); 1.3922 -+ break; 1.3923 -+ case 0x08: /* BS */ 1.3924 -+ vcon_i_backflush(t); 1.3925 -+ if (t->vc_x > 0) 1.3926 -+ t->vc_x--; 1.3927 -+ break; 1.3928 -+ case 0x0A: /* Linefeed */ 1.3929 - vcon_i_backflush(t); 1.3930 -- t->vc_x = 0; 1.3931 - vcon_i_cursfeed(t); 1.3932 -+ break; 1.3933 -+ case 0x0D: /* Return */ 1.3934 -+ vcon_i_backflush(t); 1.3935 -+ t->vc_x = 0; 1.3936 -+ break; 1.3937 -+ case 24: case 26: 1.3938 -+ vcon_i_backflush(t); 1.3939 -+ t->vc_state = ESnormal; 1.3940 -+ break; 1.3941 -+ case 27: 1.3942 -+ vcon_i_backflush(t); 1.3943 -+ t->vc_state = ESesc; 1.3944 -+ break; 1.3945 -+ default: 1.3946 -+ if (t->backp == 0) { 1.3947 -+ t->backc = 1; 1.3948 -+ t->backp = data-1; 1.3949 -+ } else { 1.3950 -+ t->backc++; 1.3951 -+ } 1.3952 -+ if ((unsigned int)t->vc_x + t->backc >= hcon_qxdim(hconp)) { 1.3953 -+ vcon_i_backflush(t); 1.3954 -+ t->vc_x = 0; 1.3955 -+ vcon_i_cursfeed(t); 1.3956 -+ } 1.3957 - } 1.3958 - } 1.3959 - } 1.3960 -@@ -73,7 +188,7 @@ 1.3961 - static void vcon_i_cursfeed(struct vconterm *t) { 1.3962 - struct hconsole *hconp = t->impl; 1.3963 - 1.3964 -- if (++t->vc_y >= hcon_qydim(hconp)) { 1.3965 -+ if ((unsigned int)++t->vc_y >= hcon_qydim(hconp)) { 1.3966 - t->vc_y = hcon_qydim(hconp)-1; 1.3967 - hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1); 1.3968 - } 1.3969 -@@ -90,22 +205,75 @@ 1.3970 - t->backp = 0; t->backc = 0; 1.3971 - } 1.3972 - 1.3973 --int vcon_putch(struct vconterm *t, char c) 1.3974 -+int vcon_putch(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char c) 1.3975 - { 1.3976 - return -1; 1.3977 - } 1.3978 - 1.3979 --int vcon_read(struct vconterm *t, char *data, int leng) 1.3980 -+int vcon_read(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char *data, __attribute__((unused)) int leng) 1.3981 - { 1.3982 - return 0; 1.3983 - } 1.3984 - 1.3985 --int vcon_getch(struct vconterm *t) 1.3986 -+static const unsigned char sunkbd_keycode[128] = { 1.3987 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.3988 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.3989 -+ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 8, 1.3990 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1.3991 -+ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 1.3992 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.3993 -+ 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '\\', 13, 1.3994 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.3995 -+ 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 1.3996 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.3997 -+ ' ', 1.3998 -+}; 1.3999 -+ 1.4000 -+static const unsigned char sunkbd_keycode_shifted[128] = { 1.4001 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.4002 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.4003 -+ '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 8, 1.4004 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1.4005 -+ 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 1.4006 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.4007 -+ 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '|', 13, 1.4008 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.4009 -+ 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 1.4010 -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.4011 -+ ' ', 1.4012 -+}; 1.4013 -+ 1.4014 -+static int shiftstate; 1.4015 -+ 1.4016 -+int vcon_getch(__attribute__((unused)) struct vconterm *t) 1.4017 - { 1.4018 -- return -1; 1.4019 -+ int ch; 1.4020 -+ 1.4021 -+ while ((ldb_bypass(0x71000004) & 1) != 1) { } 1.4022 -+ do { 1.4023 -+ ch = ldb_bypass(0x71000006) & 0xff; 1.4024 -+ if (ch == 99) 1.4025 -+ shiftstate |= 1; 1.4026 -+ else if (ch == 110) 1.4027 -+ shiftstate |= 2; 1.4028 -+ else if (ch == 227) 1.4029 -+ shiftstate &= ~1; 1.4030 -+ else if (ch == 238) 1.4031 -+ shiftstate &= ~2; 1.4032 -+ //printk("getch: %d\n", ch); 1.4033 -+ } 1.4034 -+ while ((ch & 0x80) == 0 || ch == 238 || ch == 227); // Wait for key release 1.4035 -+ //printk("getch rel: %d\n", ch); 1.4036 -+ ch &= 0x7f; 1.4037 -+ if (shiftstate) 1.4038 -+ ch = sunkbd_keycode_shifted[ch]; 1.4039 -+ else 1.4040 -+ ch = sunkbd_keycode[ch]; 1.4041 -+ //printk("getch xlate: %d\n", ch); 1.4042 -+ return ch; 1.4043 - } 1.4044 - 1.4045 --void vcon_fini(struct vconterm *t) 1.4046 -+void vcon_fini(__attribute__((unused)) struct vconterm *t) 1.4047 - { 1.4048 - /* violent crash in the end */ 1.4049 - ; 1.4050 -diff -ruN proll_18.orig/src/vconsole.h proll-patch-15/src/vconsole.h 1.4051 ---- proll_18.orig/src/vconsole.h 1999-11-08 00:58:13.000000000 +0000 1.4052 -+++ proll-patch-15/src/vconsole.h 2005-03-02 12:40:12.000000000 +0000 1.4053 -@@ -6,6 +6,8 @@ 1.4054 - #ifndef VCONSOLE_H 1.4055 - #define VCONSOLE_H 1.4056 - 1.4057 -+#define NPAR 16 1.4058 -+ 1.4059 - struct vconterm { 1.4060 - void *impl; 1.4061 - 1.4062 -@@ -13,6 +15,8 @@ 1.4063 - int backc; /* Same, count */ 1.4064 - 1.4065 - int vc_x, vc_y; /* XXX Make vcon_xxx() to use cellmap->xpos_ */ 1.4066 -+ int vc_state; 1.4067 -+ unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 1.4068 - }; 1.4069 - 1.4070 - int vcon_init(struct vconterm *t, unsigned int a0);