root / pc-bios / proll.patch @ 9d0869b6
History | View | Annotate | Download (122.7 kB)
1 | 9e61bde5 | bellard | diff -ruN proll_18.orig/Makefile proll-patch-15/Makefile
|
---|---|---|---|
2 | e80cfcfc | bellard | --- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000
|
3 | 9e61bde5 | bellard | +++ proll-patch-15/Makefile 2005-11-09 18:14:51.000000000 +0000
|
4 | e80cfcfc | bellard | @@ -4,6 +4,7 @@
|
5 | e80cfcfc | bellard | make -C krups-ser all |
6 | e80cfcfc | bellard | make -C espresso all |
7 | e80cfcfc | bellard | make -C espresso-ser all |
8 | e80cfcfc | bellard | + make -C qemu all
|
9 | 8d5f07fa | bellard | |
10 | e80cfcfc | bellard | clean: |
11 | e80cfcfc | bellard | make -C mrcoffee clean |
12 | e80cfcfc | bellard | @@ -11,3 +12,4 @@
|
13 | e80cfcfc | bellard | make -C krups-ser clean |
14 | e80cfcfc | bellard | make -C espresso clean |
15 | e80cfcfc | bellard | make -C espresso-ser clean |
16 | e80cfcfc | bellard | + make -C qemu clean
|
17 | 9e61bde5 | bellard | diff -ruN proll_18.orig/qemu/Makefile proll-patch-15/qemu/Makefile
|
18 | 6f7e9aec | bellard | --- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000
|
19 | 9e61bde5 | bellard | +++ proll-patch-15/qemu/Makefile 2005-08-14 10:25:06.000000000 +0000
|
20 | 6d82d04a | bellard | @@ -0,0 +1,123 @@
|
21 | 6f7e9aec | bellard | +#
|
22 | 6f7e9aec | bellard | +# proll:
|
23 | 6f7e9aec | bellard | +# qemu/Makefile - make PROLL for QEMU
|
24 | 9e61bde5 | bellard | +# $Id: proll.patch,v 1.6 2005-11-11 00:24:57 bellard Exp $
|
25 | 6f7e9aec | bellard | +#
|
26 | 6f7e9aec | bellard | +# Copyright 1999 Pete Zaitcev
|
27 | 6f7e9aec | bellard | +# This is Free Software is licensed under terms of GNU General Public License.
|
28 | 6f7e9aec | bellard | +#
|
29 | 6f7e9aec | bellard | +
|
30 | 6f7e9aec | bellard | +CC = gcc
|
31 | 6f7e9aec | bellard | +
|
32 | 6f7e9aec | bellard | +#CROSS = /usr/local/sparc/bin/sparc-sun-linux-
|
33 | 6f7e9aec | bellard | +CROSS = sparc-unknown-linux-gnu-
|
34 | 6f7e9aec | bellard | +
|
35 | 6f7e9aec | bellard | +CROSSCC = $(CROSS)gcc
|
36 | 6f7e9aec | bellard | +CROSSLD = $(CROSS)ld
|
37 | 6f7e9aec | bellard | +CROSSNM = $(CROSS)nm
|
38 | 6f7e9aec | bellard | +
|
39 | 6f7e9aec | bellard | +RM = /bin/rm -f
|
40 | 6f7e9aec | bellard | +ELFTOAOUT = elftoaout
|
41 | 6f7e9aec | bellard | +
|
42 | 6f7e9aec | bellard | +#
|
43 | 6f7e9aec | bellard | +SRC = ../src
|
44 | 6f7e9aec | bellard | +
|
45 | 6f7e9aec | bellard | +# Due to remapping algorithm PROLBASE should be algned on PMD.
|
46 | 6f7e9aec | bellard | +# We make PROLBASE a define instead of using _start because we
|
47 | 6f7e9aec | bellard | +# want to shift it to form a PGD entry. A relocatable label will not work.
|
48 | 6f7e9aec | bellard | +# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>.
|
49 | 6f7e9aec | bellard | +PROLBASE = 0xffd00000
|
50 | 6d82d04a | bellard | +PROLRODATA = 0xffd08000
|
51 | 6d82d04a | bellard | +PROLDATA = 0xffd0b000
|
52 | 6f7e9aec | bellard | +PROLSIZE = 240*1024
|
53 | 6f7e9aec | bellard | +
|
54 | 6f7e9aec | bellard | +# Linux
|
55 | 6f7e9aec | bellard | +# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6.
|
56 | 6f7e9aec | bellard | +# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them.
|
57 | 6f7e9aec | bellard | +# __ANSI__ is supposed to be on by default but it is not.
|
58 | 9e61bde5 | bellard | +CFLAGS = -O2 -W -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -Wa,-xarch=v8 -g -DQEMU -m32 -fno-builtin
|
59 | 9e61bde5 | bellard | +ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g -Wa,-xarch=v8 -Wa,-32
|
60 | 6f7e9aec | bellard | +# Solaris or Linux/i386 cross compilation
|
61 | 6f7e9aec | bellard | +#CFLAGS = -Iinclude -O
|
62 | 6f7e9aec | bellard | +
|
63 | 6f7e9aec | bellard | +LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA)
|
64 | 6f7e9aec | bellard | +
|
65 | 6f7e9aec | bellard | +ALL = proll.aout
|
66 | 6f7e9aec | bellard | +PROLLEXE = proll.elf
|
67 | 6f7e9aec | bellard | +
|
68 | 6f7e9aec | bellard | +OBJS = head.o wuf.o wof.o main.o $(CONSOLE) \
|
69 | 6f7e9aec | bellard | + printf.o le.o system_qemu.o iommu.o \
|
70 | 6f7e9aec | bellard | + arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o \
|
71 | 6d82d04a | bellard | + vconsole.o hconsole.o rconsole.o vcons_zs.o esp.o
|
72 | 6f7e9aec | bellard | +
|
73 | 6f7e9aec | bellard | +all: $(ALL)
|
74 | 6f7e9aec | bellard | +
|
75 | 6f7e9aec | bellard | +$(PROLLEXE): $(OBJS)
|
76 | 6f7e9aec | bellard | + $(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS)
|
77 | 6f7e9aec | bellard | +
|
78 | 6f7e9aec | bellard | +head.o: head.S $(SRC)/phys_jj.h \
|
79 | 6f7e9aec | bellard | + $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h
|
80 | 6f7e9aec | bellard | + $(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S
|
81 | 6f7e9aec | bellard | +
|
82 | 6f7e9aec | bellard | +main.o: main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \
|
83 | 6f7e9aec | bellard | + $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \
|
84 | 6f7e9aec | bellard | + $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h
|
85 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $*.c
|
86 | 6f7e9aec | bellard | +openprom.o: openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \
|
87 | 6f7e9aec | bellard | + $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h
|
88 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $*.c
|
89 | 6f7e9aec | bellard | +
|
90 | 6f7e9aec | bellard | +system_qemu.o: system_qemu.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \
|
91 | 6f7e9aec | bellard | + $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \
|
92 | 6f7e9aec | bellard | + $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h
|
93 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $*.c
|
94 | 6f7e9aec | bellard | +iommu.o: $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \
|
95 | 6f7e9aec | bellard | + $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h
|
96 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
97 | 6f7e9aec | bellard | +vconsole.o: $(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h
|
98 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
99 | 6f7e9aec | bellard | +vcons_zs.o: $(SRC)/vcons_zs.c $(SRC)/vconsole.h $(SRC)/system.h
|
100 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
101 | 6f7e9aec | bellard | +hconsole.o: $(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h
|
102 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
103 | 6f7e9aec | bellard | +rconsole.o: $(SRC)/rconsole.c $(SRC)/rconsole.h
|
104 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
105 | 6f7e9aec | bellard | +printf.o: $(SRC)/printf.c
|
106 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
107 | 6f7e9aec | bellard | +le.o: $(SRC)/le.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/netpriv.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/net.h $(SRC)/phys_jj.h
|
108 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
109 | 6d82d04a | bellard | +esp.o: $(SRC)/esp.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/phys_jj.h
|
110 | 6d82d04a | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
111 | 6f7e9aec | bellard | +arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h
|
112 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
113 | 6f7e9aec | bellard | +netinit.o: $(SRC)/netinit.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h
|
114 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
115 | 6f7e9aec | bellard | +tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h
|
116 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
117 | 6f7e9aec | bellard | +udp.o: $(SRC)/udp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h
|
118 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
119 | 6f7e9aec | bellard | +packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h
|
120 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
121 | 6f7e9aec | bellard | +sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h
|
122 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c
|
123 | 6f7e9aec | bellard | +bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \
|
124 | 6f7e9aec | bellard | + $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h
|
125 | 6f7e9aec | bellard | + $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c
|
126 | 6f7e9aec | bellard | +
|
127 | 6f7e9aec | bellard | +wuf.o: $(SRC)/wuf.S
|
128 | 6f7e9aec | bellard | + $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
|
129 | 6f7e9aec | bellard | +wof.o: $(SRC)/wof.S
|
130 | 6f7e9aec | bellard | + $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S
|
131 | 6f7e9aec | bellard | +
|
132 | 6f7e9aec | bellard | +#genlab.o: genlab.c
|
133 | 6f7e9aec | bellard | +# $(CC) -c $*.c
|
134 | 6f7e9aec | bellard | +#
|
135 | 6f7e9aec | bellard | +#genlab: genlab.o
|
136 | 6f7e9aec | bellard | +# $(CC) -o genlab genlab.o
|
137 | 6f7e9aec | bellard | +
|
138 | 6f7e9aec | bellard | +clean:
|
139 | 6f7e9aec | bellard | + $(RM) $(OBJS)
|
140 | 6f7e9aec | bellard | + $(RM) $(PROLLEXE) proll.aout
|
141 | 6f7e9aec | bellard | +
|
142 | 6f7e9aec | bellard | +proll.aout: $(PROLLEXE)
|
143 | 6f7e9aec | bellard | + $(ELFTOAOUT) -o proll.aout $(PROLLEXE)
|
144 | 9e61bde5 | bellard | diff -ruN proll_18.orig/qemu/head.S proll-patch-15/qemu/head.S
|
145 | e80cfcfc | bellard | --- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000
|
146 | 9e61bde5 | bellard | +++ proll-patch-15/qemu/head.S 2005-07-12 22:24:17.000000000 +0000
|
147 | 9e61bde5 | bellard | @@ -0,0 +1,543 @@
|
148 | e80cfcfc | bellard | +/**
|
149 | e80cfcfc | bellard | + ** Standalone startup code for Linux PROM emulator.
|
150 | e80cfcfc | bellard | + ** Copyright 1999 Pete A. Zaitcev
|
151 | e80cfcfc | bellard | + ** This code is licensed under GNU General Public License.
|
152 | e80cfcfc | bellard | + **/
|
153 | e80cfcfc | bellard | +/*
|
154 | 9e61bde5 | bellard | + * $Id: proll.patch,v 1.6 2005-11-11 00:24:57 bellard Exp $
|
155 | e80cfcfc | bellard | + */
|
156 | e80cfcfc | bellard | +
|
157 | e80cfcfc | bellard | +#include <psr.h>
|
158 | e80cfcfc | bellard | +#include <asi.h>
|
159 | e80cfcfc | bellard | +#include <crs.h>
|
160 | e80cfcfc | bellard | +/* #include <asm/head.h> */ /* Trap entries. Do not use. */
|
161 | e80cfcfc | bellard | +#include "phys_jj.h"
|
162 | e80cfcfc | bellard | +
|
163 | e80cfcfc | bellard | +#define C_LABEL(name) name
|
164 | e80cfcfc | bellard | +#define REGWIN_SZ 0x40
|
165 | e80cfcfc | bellard | +
|
166 | e80cfcfc | bellard | +#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */
|
167 | e80cfcfc | bellard | +
|
168 | e80cfcfc | bellard | + /* 22 is 24-2, (va)>>(SRMMU_PGDIR_SHIFT-PTESIZESHFT) */
|
169 | e80cfcfc | bellard | +#define VATOPGDOFF(va) (((va)>>22)&0x3FC)
|
170 | e80cfcfc | bellard | +#define VATOPMDOFF(va) (((va)>>16)&0xFC)
|
171 | e80cfcfc | bellard | +
|
172 | e80cfcfc | bellard | +#define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */
|
173 | e80cfcfc | bellard | +
|
174 | e80cfcfc | bellard | +/* Here are some trap goodies */
|
175 | e80cfcfc | bellard | +
|
176 | e80cfcfc | bellard | +#if 0
|
177 | e80cfcfc | bellard | +/* Generic trap entry. */
|
178 | e80cfcfc | bellard | +#define TRAP_ENTRY(type, label) \
|
179 | e80cfcfc | bellard | + rd %psr, %l0; b label; rd %wim, %l3; nop;
|
180 | e80cfcfc | bellard | +#endif
|
181 | e80cfcfc | bellard | +
|
182 | e80cfcfc | bellard | +/* Data/text faults. */
|
183 | e80cfcfc | bellard | +#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7;
|
184 | e80cfcfc | bellard | +#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7;
|
185 | e80cfcfc | bellard | +
|
186 | e80cfcfc | bellard | +#if 0
|
187 | e80cfcfc | bellard | +/* This is for traps we should NEVER get. */
|
188 | e80cfcfc | bellard | +#define BAD_TRAP(num) \
|
189 | e80cfcfc | bellard | + rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
|
190 | e80cfcfc | bellard | +
|
191 | e80cfcfc | bellard | +/* This is for traps when we want just skip the instruction which caused it */
|
192 | e80cfcfc | bellard | +#define SKIP_TRAP(type, name) \
|
193 | e80cfcfc | bellard | + jmpl %l2, %g0; rett %l2 + 4; nop; nop;
|
194 | e80cfcfc | bellard | +
|
195 | e80cfcfc | bellard | +/* Notice that for the system calls we pull a trick. We load up a
|
196 | e80cfcfc | bellard | + * different pointer to the system call vector table in %l7, but call
|
197 | e80cfcfc | bellard | + * the same generic system call low-level entry point. The trap table
|
198 | e80cfcfc | bellard | + * entry sequences are also HyperSparc pipeline friendly ;-)
|
199 | e80cfcfc | bellard | + */
|
200 | e80cfcfc | bellard | +
|
201 | e80cfcfc | bellard | +/* Software trap for Linux system calls. */
|
202 | e80cfcfc | bellard | +#define LINUX_SYSCALL_TRAP \
|
203 | e80cfcfc | bellard | + sethi %hi(C_LABEL(sys_call_table)), %l7; \
|
204 | e80cfcfc | bellard | + or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
|
205 | e80cfcfc | bellard | + b linux_sparc_syscall; \
|
206 | e80cfcfc | bellard | + rd %psr, %l0;
|
207 | e80cfcfc | bellard | +
|
208 | e80cfcfc | bellard | +/* Software trap for SunOS4.1.x system calls. */
|
209 | e80cfcfc | bellard | +#define SUNOS_SYSCALL_TRAP \
|
210 | e80cfcfc | bellard | + rd %psr, %l0; \
|
211 | e80cfcfc | bellard | + sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
|
212 | e80cfcfc | bellard | + b linux_sparc_syscall; \
|
213 | e80cfcfc | bellard | + or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
|
214 | e80cfcfc | bellard | +
|
215 | e80cfcfc | bellard | +/* Software trap for Slowaris system calls. */
|
216 | e80cfcfc | bellard | +#define SOLARIS_SYSCALL_TRAP \
|
217 | e80cfcfc | bellard | + b solaris_syscall; \
|
218 | e80cfcfc | bellard | + rd %psr, %l0; \
|
219 | e80cfcfc | bellard | + nop; \
|
220 | e80cfcfc | bellard | + nop;
|
221 | e80cfcfc | bellard | +
|
222 | e80cfcfc | bellard | +#define INDIRECT_SOLARIS_SYSCALL(x) \
|
223 | e80cfcfc | bellard | + mov x, %g1; \
|
224 | e80cfcfc | bellard | + b solaris_syscall; \
|
225 | e80cfcfc | bellard | + rd %psr, %l0; \
|
226 | e80cfcfc | bellard | + nop;
|
227 | e80cfcfc | bellard | +
|
228 | e80cfcfc | bellard | +#define BREAKPOINT_TRAP \
|
229 | e80cfcfc | bellard | + b breakpoint_trap; \
|
230 | e80cfcfc | bellard | + rd %psr,%l0; \
|
231 | e80cfcfc | bellard | + nop; \
|
232 | e80cfcfc | bellard | + nop;
|
233 | e80cfcfc | bellard | +
|
234 | e80cfcfc | bellard | +/* Software trap for Sparc-netbsd system calls. */
|
235 | e80cfcfc | bellard | +#define NETBSD_SYSCALL_TRAP \
|
236 | e80cfcfc | bellard | + sethi %hi(C_LABEL(sys_call_table)), %l7; \
|
237 | e80cfcfc | bellard | + or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
|
238 | e80cfcfc | bellard | + b bsd_syscall; \
|
239 | e80cfcfc | bellard | + rd %psr, %l0;
|
240 | e80cfcfc | bellard | +
|
241 | e80cfcfc | bellard | +/* The Get Condition Codes software trap for userland. */
|
242 | e80cfcfc | bellard | +#define GETCC_TRAP \
|
243 | e80cfcfc | bellard | + b getcc_trap_handler; mov %psr, %l0; nop; nop;
|
244 | e80cfcfc | bellard | +
|
245 | e80cfcfc | bellard | +/* The Set Condition Codes software trap for userland. */
|
246 | e80cfcfc | bellard | +#define SETCC_TRAP \
|
247 | e80cfcfc | bellard | + b setcc_trap_handler; mov %psr, %l0; nop; nop;
|
248 | e80cfcfc | bellard | +
|
249 | e80cfcfc | bellard | +/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
|
250 | e80cfcfc | bellard | + * gets handled with another macro.
|
251 | e80cfcfc | bellard | + */
|
252 | e80cfcfc | bellard | +#define TRAP_ENTRY_INTERRUPT(int_level) \
|
253 | e80cfcfc | bellard | + mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
|
254 | e80cfcfc | bellard | +
|
255 | e80cfcfc | bellard | +/* NMI's (Non Maskable Interrupts) are special, you can't keep them
|
256 | e80cfcfc | bellard | + * from coming in, and basically if you get one, the shows over. ;(
|
257 | e80cfcfc | bellard | + * On the sun4c they are usually asynchronous memory errors, on the
|
258 | e80cfcfc | bellard | + * the sun4m they could be either due to mem errors or a software
|
259 | e80cfcfc | bellard | + * initiated interrupt from the prom/kern on an SMP box saying "I
|
260 | e80cfcfc | bellard | + * command you to do CPU tricks, read your mailbox for more info."
|
261 | e80cfcfc | bellard | + */
|
262 | e80cfcfc | bellard | +#define NMI_TRAP \
|
263 | e80cfcfc | bellard | + rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
|
264 | e80cfcfc | bellard | +
|
265 | e80cfcfc | bellard | +#endif
|
266 | e80cfcfc | bellard | +
|
267 | e80cfcfc | bellard | +/* Window overflows/underflows are special and we need to try to be as
|
268 | e80cfcfc | bellard | + * efficient as possible here....
|
269 | e80cfcfc | bellard | + */
|
270 | e80cfcfc | bellard | +#define WINDOW_SPILL \
|
271 | e80cfcfc | bellard | + rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;
|
272 | e80cfcfc | bellard | +
|
273 | e80cfcfc | bellard | +#define WINDOW_FILL \
|
274 | e80cfcfc | bellard | + rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;
|
275 | e80cfcfc | bellard | +
|
276 | e80cfcfc | bellard | +#define STUB_TRAP ba stub_trap; nop; nop; nop;
|
277 | e80cfcfc | bellard | +
|
278 | e80cfcfc | bellard | +#define TRAP_ENTRY(a,b) STUB_TRAP
|
279 | e80cfcfc | bellard | +#define SKIP_TRAP(a,b) STUB_TRAP
|
280 | e80cfcfc | bellard | +#define SUNOS_SYSCALL_TRAP STUB_TRAP
|
281 | e80cfcfc | bellard | +#define SOLARIS_SYSCALL_TRAP STUB_TRAP
|
282 | e80cfcfc | bellard | +#define NETBSD_SYSCALL_TRAP STUB_TRAP
|
283 | e80cfcfc | bellard | +#define LINUX_SYSCALL_TRAP STUB_TRAP
|
284 | e80cfcfc | bellard | +#define BREAKPOINT_TRAP STUB_TRAP
|
285 | e80cfcfc | bellard | +#define NMI_TRAP STUB_TRAP
|
286 | e80cfcfc | bellard | +#define GETCC_TRAP STUB_TRAP
|
287 | e80cfcfc | bellard | +#define SETCC_TRAP STUB_TRAP
|
288 | e80cfcfc | bellard | +#define BAD_TRAP(n) STUB_TRAP
|
289 | e80cfcfc | bellard | +#define TRAP_ENTRY_INTERRUPT(i) STUB_TRAP
|
290 | e80cfcfc | bellard | +#define INDIRECT_SOLARIS_SYSCALL(i) STUB_TRAP
|
291 | e80cfcfc | bellard | +
|
292 | e80cfcfc | bellard | + .section ".text"
|
293 | e80cfcfc | bellard | + .globl start, _start
|
294 | e80cfcfc | bellard | +_start:
|
295 | e80cfcfc | bellard | +start:
|
296 | e80cfcfc | bellard | + .globl spill_window_entry, fill_window_entry
|
297 | 6f7e9aec | bellard | +
|
298 | 6f7e9aec | bellard | +#define EXPORT_TRAP(trap) \
|
299 | 6f7e9aec | bellard | + .globl trap; \
|
300 | 6f7e9aec | bellard | + .type trap,function; \
|
301 | 6f7e9aec | bellard | + .size trap, 16
|
302 | 6f7e9aec | bellard | +
|
303 | 6f7e9aec | bellard | +EXPORT_TRAP(t_zero)
|
304 | 6f7e9aec | bellard | +EXPORT_TRAP(t_wovf)
|
305 | 6f7e9aec | bellard | +EXPORT_TRAP(t_wunf)
|
306 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq1)
|
307 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq2)
|
308 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq3)
|
309 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq4)
|
310 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq5)
|
311 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq6)
|
312 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq7)
|
313 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq8)
|
314 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq9)
|
315 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq10)
|
316 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq11)
|
317 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq12)
|
318 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq13)
|
319 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq14)
|
320 | 6f7e9aec | bellard | +EXPORT_TRAP(t_irq15)
|
321 | 6f7e9aec | bellard | +
|
322 | e80cfcfc | bellard | +C_LABEL(trapbase):
|
323 | e80cfcfc | bellard | +t_zero: b goprol; nop; nop; nop;
|
324 | e80cfcfc | bellard | +t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
|
325 | e80cfcfc | bellard | +t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
|
326 | e80cfcfc | bellard | +t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
|
327 | e80cfcfc | bellard | +t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
|
328 | e80cfcfc | bellard | +t_wovf: WINDOW_SPILL /* Window Overflow */
|
329 | e80cfcfc | bellard | +t_wunf: WINDOW_FILL /* Window Underflow */
|
330 | e80cfcfc | bellard | +t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
|
331 | e80cfcfc | bellard | +t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
|
332 | e80cfcfc | bellard | +t_dflt: SRMMU_DFAULT /* Data Miss Exception */
|
333 | e80cfcfc | bellard | +t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
|
334 | e80cfcfc | bellard | +t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
|
335 | e80cfcfc | bellard | +t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
|
336 | e80cfcfc | bellard | +t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
|
337 | e80cfcfc | bellard | +t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
|
338 | e80cfcfc | bellard | +t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
|
339 | e80cfcfc | bellard | +t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
|
340 | e80cfcfc | bellard | +t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
|
341 | e80cfcfc | bellard | +t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
|
342 | e80cfcfc | bellard | +t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
|
343 | e80cfcfc | bellard | +t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
|
344 | e80cfcfc | bellard | +t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
|
345 | e80cfcfc | bellard | +t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
|
346 | e80cfcfc | bellard | +t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
|
347 | e80cfcfc | bellard | +t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
|
348 | e80cfcfc | bellard | +t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
|
349 | e80cfcfc | bellard | +t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
|
350 | e80cfcfc | bellard | +t_nmi: NMI_TRAP /* Level 15 (NMI) */
|
351 | e80cfcfc | bellard | +t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
|
352 | e80cfcfc | bellard | +t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
|
353 | e80cfcfc | bellard | +t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
|
354 | e80cfcfc | bellard | +t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
|
355 | e80cfcfc | bellard | +t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
|
356 | e80cfcfc | bellard | +t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
|
357 | e80cfcfc | bellard | +t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
|
358 | e80cfcfc | bellard | +t_dacce:SRMMU_DFAULT /* Data Access Error */
|
359 | e80cfcfc | bellard | +t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
|
360 | e80cfcfc | bellard | +t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
|
361 | e80cfcfc | bellard | +t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
|
362 | e80cfcfc | bellard | +t_bad2d: BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f)
|
363 | e80cfcfc | bellard | + BAD_TRAP(0x30) BAD_TRAP(0x31) BAD_TRAP(0x32) BAD_TRAP(0x33)
|
364 | e80cfcfc | bellard | + BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) BAD_TRAP(0x37)
|
365 | e80cfcfc | bellard | + BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
|
366 | e80cfcfc | bellard | +t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
|
367 | e80cfcfc | bellard | + BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f)
|
368 | e80cfcfc | bellard | + BAD_TRAP(0x40) BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43)
|
369 | e80cfcfc | bellard | + BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) BAD_TRAP(0x47)
|
370 | e80cfcfc | bellard | + BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
|
371 | e80cfcfc | bellard | + BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
|
372 | e80cfcfc | bellard | + BAD_TRAP(0x50) BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53)
|
373 | e80cfcfc | bellard | + BAD_TRAP(0x54) BAD_TRAP(0x55) BAD_TRAP(0x56) BAD_TRAP(0x57)
|
374 | e80cfcfc | bellard | + BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) BAD_TRAP(0x5b)
|
375 | e80cfcfc | bellard | + BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
|
376 | e80cfcfc | bellard | + BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63)
|
377 | e80cfcfc | bellard | + BAD_TRAP(0x64) BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67)
|
378 | e80cfcfc | bellard | + BAD_TRAP(0x68) BAD_TRAP(0x69) BAD_TRAP(0x6a) BAD_TRAP(0x6b)
|
379 | e80cfcfc | bellard | + BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) BAD_TRAP(0x6f)
|
380 | e80cfcfc | bellard | + BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
|
381 | e80cfcfc | bellard | + BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77)
|
382 | e80cfcfc | bellard | + BAD_TRAP(0x78) BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b)
|
383 | e80cfcfc | bellard | + BAD_TRAP(0x7c) BAD_TRAP(0x7d) BAD_TRAP(0x7e) BAD_TRAP(0x7f)
|
384 | e80cfcfc | bellard | +t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */
|
385 | e80cfcfc | bellard | +t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
|
386 | e80cfcfc | bellard | +t_divz: BAD_TRAP(0x82) /* Divide by zero trap */
|
387 | e80cfcfc | bellard | +t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
|
388 | e80cfcfc | bellard | +t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
|
389 | e80cfcfc | bellard | +t_rchk: BAD_TRAP(0x85) /* Range Check */
|
390 | e80cfcfc | bellard | +t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
|
391 | e80cfcfc | bellard | +t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
|
392 | e80cfcfc | bellard | +t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */
|
393 | e80cfcfc | bellard | +t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */
|
394 | e80cfcfc | bellard | +t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d)
|
395 | e80cfcfc | bellard | + BAD_TRAP(0x8e) BAD_TRAP(0x8f)
|
396 | e80cfcfc | bellard | +t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
|
397 | e80cfcfc | bellard | +t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93)
|
398 | e80cfcfc | bellard | + BAD_TRAP(0x94) BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97)
|
399 | e80cfcfc | bellard | + BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
|
400 | e80cfcfc | bellard | +t_getcc:GETCC_TRAP /* Get Condition Codes */
|
401 | e80cfcfc | bellard | +t_setcc:SETCC_TRAP /* Set Condition Codes */
|
402 | e80cfcfc | bellard | +t_bada2:BAD_TRAP(0xa2) BAD_TRAP(0xa3)
|
403 | e80cfcfc | bellard | + BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
|
404 | e80cfcfc | bellard | +t_slowi:INDIRECT_SOLARIS_SYSCALL(156)
|
405 | e80cfcfc | bellard | + BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
|
406 | e80cfcfc | bellard | + BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf)
|
407 | e80cfcfc | bellard | + BAD_TRAP(0xb0) BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3)
|
408 | e80cfcfc | bellard | + BAD_TRAP(0xb4) BAD_TRAP(0xb5) BAD_TRAP(0xb6) BAD_TRAP(0xb7)
|
409 | e80cfcfc | bellard | + BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) BAD_TRAP(0xbb)
|
410 | e80cfcfc | bellard | + BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
|
411 | e80cfcfc | bellard | +t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3)
|
412 | e80cfcfc | bellard | + BAD_TRAP(0xc4) BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7)
|
413 | e80cfcfc | bellard | + BAD_TRAP(0xc8) BAD_TRAP(0xc9) BAD_TRAP(0xca) BAD_TRAP(0xcb)
|
414 | e80cfcfc | bellard | + BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) BAD_TRAP(0xcf)
|
415 | e80cfcfc | bellard | + BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
|
416 | e80cfcfc | bellard | +t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7)
|
417 | e80cfcfc | bellard | + BAD_TRAP(0xd8) BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb)
|
418 | e80cfcfc | bellard | + BAD_TRAP(0xdc) BAD_TRAP(0xdd) BAD_TRAP(0xde) BAD_TRAP(0xdf)
|
419 | e80cfcfc | bellard | + BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) BAD_TRAP(0xe3)
|
420 | e80cfcfc | bellard | + BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
|
421 | e80cfcfc | bellard | +t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb)
|
422 | e80cfcfc | bellard | + BAD_TRAP(0xec) BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef)
|
423 | e80cfcfc | bellard | + BAD_TRAP(0xf0) BAD_TRAP(0xf1) BAD_TRAP(0xf2) BAD_TRAP(0xf3)
|
424 | e80cfcfc | bellard | + BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) BAD_TRAP(0xf7)
|
425 | e80cfcfc | bellard | + BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
|
426 | e80cfcfc | bellard | +t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)
|
427 | e80cfcfc | bellard | +dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
|
428 | e80cfcfc | bellard | +dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
|
429 | e80cfcfc | bellard | +
|
430 | e80cfcfc | bellard | +stub_trap:
|
431 | e80cfcfc | bellard | + set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
|
432 | e80cfcfc | bellard | + set 0x00ffffff, %g4
|
433 | e80cfcfc | bellard | + sta %g4, [%g5] ASI_M_BYPASS
|
434 | e80cfcfc | bellard | +1: ba 1b; nop
|
435 | e80cfcfc | bellard | +
|
436 | e80cfcfc | bellard | + .section ".bss"
|
437 | e80cfcfc | bellard | + .align 8
|
438 | e80cfcfc | bellard | +bss_start:
|
439 | e80cfcfc | bellard | + .align 0x1000 ! PAGE_SIZE
|
440 | e80cfcfc | bellard | + .globl C_LABEL(bootup_user_stack)
|
441 | e80cfcfc | bellard | + .type bootup_user_stack,#object
|
442 | e80cfcfc | bellard | + .size bootup_user_stack,0x2000
|
443 | e80cfcfc | bellard | +C_LABEL(bootup_user_stack): .skip 0x2000
|
444 | e80cfcfc | bellard | +
|
445 | e80cfcfc | bellard | + .section ".text"
|
446 | 9e61bde5 | bellard | + .register %g2, #scratch
|
447 | 9e61bde5 | bellard | + .register %g3, #scratch
|
448 | 9e61bde5 | bellard | + .register %g6, #scratch
|
449 | 9e61bde5 | bellard | + .register %g7, #scratch
|
450 | e80cfcfc | bellard | +
|
451 | e80cfcfc | bellard | +goprol:
|
452 | e80cfcfc | bellard | + ! %g1 contains end of memory
|
453 | 6f7e9aec | bellard | + set PHYS_JJ_EEPROM + 0x30, %g1
|
454 | 6f7e9aec | bellard | + lda [%g1] ASI_M_BYPASS, %g1
|
455 | e80cfcfc | bellard | + ! map PROLDATA to PROLBASE+PROLSIZE to end of ram
|
456 | e80cfcfc | bellard | + set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables
|
457 | e80cfcfc | bellard | + sub %g1, %g2, %g2 ! start of private memory
|
458 | e80cfcfc | bellard | + srl %g2, 0x4, %g7 ! ctx table at s+0x0
|
459 | e80cfcfc | bellard | + add %g2, 0x400, %g3 ! l1 table at s+0x400
|
460 | e80cfcfc | bellard | + srl %g3, 0x4, %g3
|
461 | e80cfcfc | bellard | + or %g3, 0x1, %g3
|
462 | e80cfcfc | bellard | + sta %g3, [%g2] ASI_M_BYPASS
|
463 | e80cfcfc | bellard | + add %g2, 0x400, %g2 ! s+0x400
|
464 | e80cfcfc | bellard | + add %g2, 0x800, %g3 ! l2 table for ram (00xxxxxx) at s+0x800
|
465 | e80cfcfc | bellard | + srl %g3, 0x4, %g3
|
466 | e80cfcfc | bellard | + or %g3, 0x1, %g3
|
467 | e80cfcfc | bellard | + sta %g3, [%g2] ASI_M_BYPASS
|
468 | e80cfcfc | bellard | + add %g2, 0x500, %g3 ! l2 table for rom (ffxxxxxx) at s+0x900
|
469 | e80cfcfc | bellard | + add %g2, 0x3fc, %g2 ! s+0x7fc
|
470 | e80cfcfc | bellard | + srl %g3, 0x4, %g3
|
471 | e80cfcfc | bellard | + or %g3, 0x1, %g3
|
472 | e80cfcfc | bellard | + sta %g3, [%g2] ASI_M_BYPASS
|
473 | e80cfcfc | bellard | + add %g2, 0x4, %g2 ! s+0x800
|
474 | e80cfcfc | bellard | + set ((7 << 2) | 2), %g3 ! 7 = U: --- S: RWX (main memory)
|
475 | e80cfcfc | bellard | + sta %g3, [%g2] ASI_M_BYPASS
|
476 | e80cfcfc | bellard | + add %g2, 0x200, %g3 ! l3 table for rom at s+0xa00
|
477 | e80cfcfc | bellard | + add %g2, 0x1d0, %g2 ! s+0x9d0
|
478 | e80cfcfc | bellard | + srl %g3, 0x4, %g3
|
479 | e80cfcfc | bellard | + or %g3, 0x1, %g3
|
480 | e80cfcfc | bellard | + sta %g3, [%g2] ASI_M_BYPASS
|
481 | e80cfcfc | bellard | + add %g2, 0x30, %g2 ! s+0xa00
|
482 | e80cfcfc | bellard | +
|
483 | e80cfcfc | bellard | + set PROLBASE, %g3
|
484 | e80cfcfc | bellard | + set 0x1000, %g5
|
485 | e80cfcfc | bellard | + set (PROLDATA-PROLBASE)/0x1000, %g6 ! # of .text pages
|
486 | e80cfcfc | bellard | +1: srl %g3, 0x4, %g4
|
487 | e80cfcfc | bellard | + or %g4, ((7 << 2) | 2), %g4 ! 4 = U: --X S: --X (rom, execute only)
|
488 | e80cfcfc | bellard | + sta %g4, [%g2] ASI_M_BYPASS
|
489 | e80cfcfc | bellard | + add %g2, 4, %g2
|
490 | e80cfcfc | bellard | + add %g3, %g5, %g3
|
491 | e80cfcfc | bellard | + deccc %g6
|
492 | e80cfcfc | bellard | + bne 1b
|
493 | e80cfcfc | bellard | + nop
|
494 | e80cfcfc | bellard | +#if 0
|
495 | e80cfcfc | bellard | + set (PROLDATA-PROLRODATA)/0x1000, %g6 ! # of .rodata pages
|
496 | e80cfcfc | bellard | +1: srl %g3, 0x4, %g4
|
497 | e80cfcfc | bellard | + or %g4, ((0 << 2) | 2), %g4 ! 0 = U: R-- S: R-- (rom, read only)
|
498 | e80cfcfc | bellard | + sta %g4, [%g2] ASI_M_BYPASS
|
499 | e80cfcfc | bellard | + add %g2, 4, %g2
|
500 | e80cfcfc | bellard | + add %g3, %g5, %g3
|
501 | e80cfcfc | bellard | + deccc %g6
|
502 | e80cfcfc | bellard | + bne 1b
|
503 | e80cfcfc | bellard | + nop
|
504 | e80cfcfc | bellard | +#endif
|
505 | e80cfcfc | bellard | + set (PROLBASE+PROLSIZE-PROLDATA)/0x1000, %g6 ! # of .bss pages
|
506 | e80cfcfc | bellard | + set 0x1000, %g4
|
507 | e80cfcfc | bellard | + sll %g7, 0x4, %g3
|
508 | e80cfcfc | bellard | + add %g4, %g3, %g3
|
509 | e80cfcfc | bellard | +1: srl %g3, 0x4, %g4
|
510 | e80cfcfc | bellard | + or %g4, ((7 << 2) | 2), %g4 ! 5 = U: R-- S: RW- (data area, read/write)
|
511 | e80cfcfc | bellard | + sta %g4, [%g2] ASI_M_BYPASS
|
512 | e80cfcfc | bellard | + add %g2, 4, %g2
|
513 | e80cfcfc | bellard | + add %g3, %g5, %g3
|
514 | e80cfcfc | bellard | + deccc %g6
|
515 | e80cfcfc | bellard | + bne 1b
|
516 | e80cfcfc | bellard | + nop
|
517 | e80cfcfc | bellard | +
|
518 | e80cfcfc | bellard | + mov %g1, %g3
|
519 | e80cfcfc | bellard | +
|
520 | e80cfcfc | bellard | + set AC_M_CTPR, %g2
|
521 | e80cfcfc | bellard | + sta %g7, [%g2] ASI_M_MMUREGS ! set ctx table ptr
|
522 | e80cfcfc | bellard | + set 1, %g1
|
523 | e80cfcfc | bellard | + sta %g1, [%g0] ASI_M_MMUREGS ! enable mmu
|
524 | e80cfcfc | bellard | +
|
525 | e80cfcfc | bellard | + /*
|
526 | e80cfcfc | bellard | + * The code which enables traps is a simplified version of
|
527 | e80cfcfc | bellard | + * kernel head.S.
|
528 | e80cfcfc | bellard | + *
|
529 | e80cfcfc | bellard | + * We know number of windows as 8 so we do not calculate them.
|
530 | e80cfcfc | bellard | + * The deadwood is here for any case.
|
531 | e80cfcfc | bellard | + */
|
532 | e80cfcfc | bellard | +
|
533 | e80cfcfc | bellard | + /* Turn on Supervisor, EnableFloating, and all the PIL bits.
|
534 | e80cfcfc | bellard | + * Also puts us in register window zero with traps off.
|
535 | e80cfcfc | bellard | + */
|
536 | e80cfcfc | bellard | + set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
|
537 | e80cfcfc | bellard | + wr %g2, 0x0, %psr
|
538 | e80cfcfc | bellard | + WRITE_PAUSE
|
539 | e80cfcfc | bellard | +
|
540 | e80cfcfc | bellard | + /* I want a kernel stack NOW! */
|
541 | e80cfcfc | bellard | + set C_LABEL(bootup_user_stack), %g1
|
542 | e80cfcfc | bellard | + set (0x2000 - REGWIN_SZ), %g2
|
543 | e80cfcfc | bellard | + add %g1, %g2, %sp
|
544 | e80cfcfc | bellard | + mov 0, %fp /* And for good luck */
|
545 | e80cfcfc | bellard | +
|
546 | e80cfcfc | bellard | + /* Zero out our BSS section. */
|
547 | e80cfcfc | bellard | + set C_LABEL(bss_start) , %o0 ! First address of BSS
|
548 | e80cfcfc | bellard | + set C_LABEL(end) , %o1 ! Last address of BSS
|
549 | e80cfcfc | bellard | + ba 2f
|
550 | e80cfcfc | bellard | + nop
|
551 | e80cfcfc | bellard | +1:
|
552 | e80cfcfc | bellard | + st %g0, [%o0]
|
553 | e80cfcfc | bellard | +2:
|
554 | e80cfcfc | bellard | + subcc %o0, %o1, %g0
|
555 | e80cfcfc | bellard | + bl 1b
|
556 | e80cfcfc | bellard | + add %o0, 0x4, %o0
|
557 | e80cfcfc | bellard | +
|
558 | e80cfcfc | bellard | + mov 2, %g1
|
559 | e80cfcfc | bellard | + wr %g1, 0x0, %wim ! make window 1 invalid
|
560 | e80cfcfc | bellard | + WRITE_PAUSE
|
561 | e80cfcfc | bellard | +
|
562 | e80cfcfc | bellard | +#if 0
|
563 | e80cfcfc | bellard | + wr %g0, 0x0, %wim
|
564 | e80cfcfc | bellard | + WRITE_PAUSE
|
565 | e80cfcfc | bellard | + save
|
566 | e80cfcfc | bellard | + rd %psr, %g3
|
567 | e80cfcfc | bellard | + restore
|
568 | e80cfcfc | bellard | + and %g3, PSR_CWP, %g3
|
569 | e80cfcfc | bellard | + add %g3, 0x1, %g3
|
570 | e80cfcfc | bellard | +#else
|
571 | e80cfcfc | bellard | + or %g0, 8, %g3
|
572 | e80cfcfc | bellard | +#endif
|
573 | e80cfcfc | bellard | +
|
574 | e80cfcfc | bellard | +#if 0
|
575 | e80cfcfc | bellard | + sethi %hi( C_LABEL(cputyp) ), %o0
|
576 | e80cfcfc | bellard | + st %g7, [%o0 + %lo( C_LABEL(cputyp) )]
|
577 | e80cfcfc | bellard | +
|
578 | e80cfcfc | bellard | + sethi %hi( C_LABEL(nwindows) ), %g4
|
579 | e80cfcfc | bellard | + st %g3, [%g4 + %lo( C_LABEL(nwindows) )]
|
580 | e80cfcfc | bellard | +
|
581 | e80cfcfc | bellard | + sub %g3, 0x1, %g3
|
582 | e80cfcfc | bellard | + sethi %hi( C_LABEL(nwindowsm1) ), %g4
|
583 | e80cfcfc | bellard | + st %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
|
584 | e80cfcfc | bellard | +#endif
|
585 | e80cfcfc | bellard | +
|
586 | e80cfcfc | bellard | + /* Here we go, start using Linux's trap table... */
|
587 | e80cfcfc | bellard | + set C_LABEL(trapbase), %g3
|
588 | e80cfcfc | bellard | + wr %g3, 0x0, %tbr
|
589 | e80cfcfc | bellard | + WRITE_PAUSE
|
590 | e80cfcfc | bellard | +
|
591 | e80cfcfc | bellard | + /* Finally, turn on traps so that we can call c-code. */
|
592 | e80cfcfc | bellard | + rd %psr, %g3
|
593 | e80cfcfc | bellard | + wr %g3, 0x0, %psr
|
594 | e80cfcfc | bellard | + WRITE_PAUSE
|
595 | e80cfcfc | bellard | +
|
596 | e80cfcfc | bellard | + wr %g3, PSR_ET, %psr
|
597 | e80cfcfc | bellard | + WRITE_PAUSE
|
598 | e80cfcfc | bellard | +
|
599 | e80cfcfc | bellard | + .globl prolmain
|
600 | e80cfcfc | bellard | + call C_LABEL(prolmain)
|
601 | e80cfcfc | bellard | + nop
|
602 | e80cfcfc | bellard | +
|
603 | e80cfcfc | bellard | +3:
|
604 | e80cfcfc | bellard | + b 3b
|
605 | e80cfcfc | bellard | + nop
|
606 | e80cfcfc | bellard | +
|
607 | e80cfcfc | bellard | +/*
|
608 | e80cfcfc | bellard | + * Memory access trap handler
|
609 | e80cfcfc | bellard | + * %l0 program %psr from trap table entry
|
610 | e80cfcfc | bellard | + * %l1 program %pc from hardware
|
611 | e80cfcfc | bellard | + * %l2 program %npc from hardware
|
612 | e80cfcfc | bellard | + * %l3 program %wim from trap table entry
|
613 | e80cfcfc | bellard | + * %l4
|
614 | e80cfcfc | bellard | + * %l5
|
615 | e80cfcfc | bellard | + * %l6
|
616 | e80cfcfc | bellard | + * %l7 text flag from trap table entry
|
617 | e80cfcfc | bellard | + */
|
618 | e80cfcfc | bellard | +
|
619 | e80cfcfc | bellard | + .section ".text"
|
620 | e80cfcfc | bellard | + .globl srmmu_fault
|
621 | e80cfcfc | bellard | +C_LABEL(srmmu_fault):
|
622 | e80cfcfc | bellard | +
|
623 | e80cfcfc | bellard | + set AC_M_SFAR, %l6
|
624 | e80cfcfc | bellard | + set AC_M_SFSR, %l5
|
625 | e80cfcfc | bellard | + lda [%l6] ASI_M_MMUREGS, %l6
|
626 | e80cfcfc | bellard | + lda [%l5] ASI_M_MMUREGS, %l5
|
627 | e80cfcfc | bellard | +
|
628 | e80cfcfc | bellard | + set ignore_fault, %l5
|
629 | e80cfcfc | bellard | + ld [%l5], %l5
|
630 | e80cfcfc | bellard | + subcc %l5, %g0, %g0 /* NULL pointer trap faults always */
|
631 | e80cfcfc | bellard | + be 3f
|
632 | e80cfcfc | bellard | + nop
|
633 | e80cfcfc | bellard | + subcc %l5, %l6, %g0
|
634 | e80cfcfc | bellard | + be 2f
|
635 | e80cfcfc | bellard | + nop
|
636 | e80cfcfc | bellard | +3:
|
637 | e80cfcfc | bellard | +
|
638 | e80cfcfc | bellard | + set (PHYS_JJ_TCX_FB + 0xbf0), %g5 /* 2 cells from side */
|
639 | e80cfcfc | bellard | + set 0x00ffffff, %g4
|
640 | e80cfcfc | bellard | + sta %g4, [%g5] ASI_M_BYPASS
|
641 | e80cfcfc | bellard | + add %g5, 8, %g5 /* On right side */
|
642 | e80cfcfc | bellard | + sta %g4, [%g5] ASI_M_BYPASS
|
643 | e80cfcfc | bellard | +1: ba 1b; nop
|
644 | e80cfcfc | bellard | +
|
645 | e80cfcfc | bellard | +2:
|
646 | e80cfcfc | bellard | + set C_LABEL(fault_ignored), %l5
|
647 | e80cfcfc | bellard | + mov 1, %l6
|
648 | e80cfcfc | bellard | + st %l6, [%l5]
|
649 | e80cfcfc | bellard | +
|
650 | e80cfcfc | bellard | + /*
|
651 | e80cfcfc | bellard | + * Skip the faulting instruction.
|
652 | e80cfcfc | bellard | + * I think it works when next instruction is a branch even.
|
653 | e80cfcfc | bellard | + */
|
654 | e80cfcfc | bellard | + or %l2, 0, %l1
|
655 | e80cfcfc | bellard | + add %l2, 4, %l2
|
656 | e80cfcfc | bellard | +
|
657 | e80cfcfc | bellard | + wr %l0, 0, %psr
|
658 | e80cfcfc | bellard | + WRITE_PAUSE
|
659 | e80cfcfc | bellard | + jmp %l1
|
660 | e80cfcfc | bellard | + rett %l2
|
661 | e80cfcfc | bellard | +
|
662 | e80cfcfc | bellard | +/*
|
663 | e80cfcfc | bellard | + * Slow external versions of st_bypass and ld_bypass.
|
664 | e80cfcfc | bellard | + * rconsole.c uses inlines. We call these in places which are not speed
|
665 | e80cfcfc | bellard | + * critical, to avoid compiler bugs.
|
666 | e80cfcfc | bellard | + */
|
667 | e80cfcfc | bellard | + .globl C_LABEL(st_bypass)
|
668 | e80cfcfc | bellard | +C_LABEL(st_bypass):
|
669 | e80cfcfc | bellard | + retl
|
670 | e80cfcfc | bellard | + sta %o1, [%o0] ASI_M_BYPASS
|
671 | e80cfcfc | bellard | + .globl C_LABEL(ld_bypass)
|
672 | e80cfcfc | bellard | +C_LABEL(ld_bypass):
|
673 | e80cfcfc | bellard | + retl
|
674 | e80cfcfc | bellard | + lda [%o0] ASI_M_BYPASS, %o0
|
675 | e80cfcfc | bellard | + .globl C_LABEL(sth_bypass)
|
676 | e80cfcfc | bellard | +C_LABEL(sth_bypass):
|
677 | e80cfcfc | bellard | + retl
|
678 | e80cfcfc | bellard | + stha %o1, [%o0] ASI_M_BYPASS
|
679 | e80cfcfc | bellard | + .globl C_LABEL(ldh_bypass)
|
680 | e80cfcfc | bellard | +C_LABEL(ldh_bypass):
|
681 | e80cfcfc | bellard | + retl
|
682 | e80cfcfc | bellard | + lduha [%o0] ASI_M_BYPASS, %o0
|
683 | e80cfcfc | bellard | + .globl C_LABEL(stb_bypass)
|
684 | e80cfcfc | bellard | +C_LABEL(stb_bypass):
|
685 | e80cfcfc | bellard | + retl
|
686 | e80cfcfc | bellard | + stba %o1, [%o0] ASI_M_BYPASS
|
687 | e80cfcfc | bellard | + .globl C_LABEL(ldb_bypass)
|
688 | e80cfcfc | bellard | +C_LABEL(ldb_bypass):
|
689 | e80cfcfc | bellard | + retl
|
690 | e80cfcfc | bellard | + lduba [%o0] ASI_M_BYPASS, %o0
|
691 | 9e61bde5 | bellard | diff -ruN proll_18.orig/qemu/main.c proll-patch-15/qemu/main.c
|
692 | e80cfcfc | bellard | --- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000
|
693 | 9e61bde5 | bellard | +++ proll-patch-15/qemu/main.c 2005-08-14 10:07:48.000000000 +0000
|
694 | 6d82d04a | bellard | @@ -0,0 +1,185 @@
|
695 | e80cfcfc | bellard | +/**
|
696 | e80cfcfc | bellard | + ** Proll (PROM replacement)
|
697 | e80cfcfc | bellard | + ** Copyright 1999 Pete Zaitcev
|
698 | e80cfcfc | bellard | + ** This code is licensed under GNU General Public License.
|
699 | e80cfcfc | bellard | + **/
|
700 | e80cfcfc | bellard | +#include <stdarg.h>
|
701 | e80cfcfc | bellard | +
|
702 | e80cfcfc | bellard | +// #include <asm/contregs.h>
|
703 | e80cfcfc | bellard | +#include <asi.h>
|
704 | e80cfcfc | bellard | +#include "pgtsrmmu.h"
|
705 | e80cfcfc | bellard | +#include "iommu.h" /* Typical SBus IOMMU for sun4m */
|
706 | e80cfcfc | bellard | +#include "phys_jj.h"
|
707 | e80cfcfc | bellard | +#include "vconsole.h"
|
708 | e80cfcfc | bellard | +#include "version.h"
|
709 | e80cfcfc | bellard | +#include <general.h> /* __P() */
|
710 | e80cfcfc | bellard | +#include <net.h> /* init_net() */
|
711 | e80cfcfc | bellard | +#include <romlib.h> /* we are a provider for part of this. */
|
712 | e80cfcfc | bellard | +#include <netpriv.h> /* myipaddr */
|
713 | e80cfcfc | bellard | +#include <arpa.h>
|
714 | e80cfcfc | bellard | +#include <system.h> /* our own prototypes */
|
715 | e80cfcfc | bellard | +
|
716 | 6f7e9aec | bellard | +void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic);
|
717 | 6f7e9aec | bellard | +int vcon_zs_init(struct vconterm *t, unsigned int a0);
|
718 | 6f7e9aec | bellard | +int vcon_zs_write(struct vconterm *t, char *data, int leng);
|
719 | 6d82d04a | bellard | +int vcon_zs_getch(struct vconterm *t);
|
720 | 6d82d04a | bellard | +void esp_probe();
|
721 | 6d82d04a | bellard | +int esp_boot(int unit);
|
722 | e80cfcfc | bellard | +static void init_idprom(void);
|
723 | e80cfcfc | bellard | +
|
724 | e80cfcfc | bellard | +struct vconterm dp0;
|
725 | e80cfcfc | bellard | +struct mem cmem; /* Current memory, virtual */
|
726 | e80cfcfc | bellard | +struct mem cio; /* Current I/O space */
|
727 | e80cfcfc | bellard | +struct phym pmem; /* Current phys. mem. */
|
728 | e80cfcfc | bellard | +struct iommu ciommu; /* Our IOMMU on sun4m */
|
729 | e80cfcfc | bellard | +
|
730 | 6f7e9aec | bellard | +static struct {
|
731 | 6f7e9aec | bellard | + const char id[16];
|
732 | 6f7e9aec | bellard | + unsigned int version;
|
733 | 6f7e9aec | bellard | + char pad1[0x1c]; // Pad to 0x30
|
734 | 6f7e9aec | bellard | + unsigned int ram_size;
|
735 | 6f7e9aec | bellard | + char boot_device;
|
736 | 6f7e9aec | bellard | + unsigned int load_addr, kernel_size;
|
737 | 6f7e9aec | bellard | + unsigned int cmdline, cmdline_len;
|
738 | 6f7e9aec | bellard | + char pad2[0x0c]; // Pad to 0x54
|
739 | 6f7e9aec | bellard | + unsigned short width, height, depth;
|
740 | 6f7e9aec | bellard | +} *hw_idprom;
|
741 | 6f7e9aec | bellard | +
|
742 | 6f7e9aec | bellard | +int ignore_fault, fault_ignored;
|
743 | 6d82d04a | bellard | +void *printk_fn, *getch_fn;
|
744 | 6f7e9aec | bellard | +unsigned int q_height, q_width;
|
745 | e80cfcfc | bellard | +
|
746 | e80cfcfc | bellard | +/*
|
747 | e80cfcfc | bellard | + */
|
748 | e80cfcfc | bellard | +void prolmain()
|
749 | e80cfcfc | bellard | +{
|
750 | 6f7e9aec | bellard | + static char fname[14];
|
751 | e80cfcfc | bellard | + static struct banks bb;
|
752 | e80cfcfc | bellard | + unsigned int hiphybas;
|
753 | e80cfcfc | bellard | + const void *romvec;
|
754 | 6f7e9aec | bellard | + unsigned int ram_size;
|
755 | 6d82d04a | bellard | + char nographic, bootdev;
|
756 | 6f7e9aec | bellard | +
|
757 | 6f7e9aec | bellard | + nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F);
|
758 | 6f7e9aec | bellard | + if (!nographic) {
|
759 | 6f7e9aec | bellard | + q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54);
|
760 | 6f7e9aec | bellard | + q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56);
|
761 | 6f7e9aec | bellard | + vcon_init(&dp0, PHYS_JJ_TCX_FB);
|
762 | 6f7e9aec | bellard | + printk_fn = vcon_write;
|
763 | 6d82d04a | bellard | + getch_fn = vcon_getch;
|
764 | 6f7e9aec | bellard | + }
|
765 | 6f7e9aec | bellard | + else {
|
766 | c44644bb | bellard | + vcon_zs_init(&dp0, 0x71100004);
|
767 | 6f7e9aec | bellard | + printk_fn = vcon_zs_write;
|
768 | 6d82d04a | bellard | + getch_fn = vcon_zs_getch;
|
769 | 6f7e9aec | bellard | + }
|
770 | 6f7e9aec | bellard | +
|
771 | e80cfcfc | bellard | +
|
772 | e80cfcfc | bellard | + printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);
|
773 | 6f7e9aec | bellard | + ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);
|
774 | e80cfcfc | bellard | + printk("%d MB total\n", ram_size/(1024*1024));
|
775 | e80cfcfc | bellard | +
|
776 | e80cfcfc | bellard | + bb.nbanks = 1;
|
777 | e80cfcfc | bellard | + bb.bankv[0].start = 0;
|
778 | e80cfcfc | bellard | + bb.bankv[0].length = ram_size;
|
779 | e80cfcfc | bellard | +
|
780 | e80cfcfc | bellard | + hiphybas = ram_size - PROLSIZE;
|
781 | e80cfcfc | bellard | +
|
782 | e80cfcfc | bellard | + mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));
|
783 | 6f7e9aec | bellard | + makepages(&pmem, hiphybas);
|
784 | e80cfcfc | bellard | + init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);
|
785 | e80cfcfc | bellard | +
|
786 | e80cfcfc | bellard | + mem_init(&cio, (char *)(PROLBASE+PROLSIZE),
|
787 | e80cfcfc | bellard | + (char *)(PROLBASE+PROLSIZE+IOMAPSIZE));
|
788 | e80cfcfc | bellard | +
|
789 | e80cfcfc | bellard | + iommu_init(&ciommu, hiphybas);
|
790 | e80cfcfc | bellard | +
|
791 | e80cfcfc | bellard | + /*
|
792 | e80cfcfc | bellard | + */
|
793 | e80cfcfc | bellard | + init_idprom();
|
794 | 6f7e9aec | bellard | + printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version);
|
795 | 6f7e9aec | bellard | + if (!nographic)
|
796 | 6f7e9aec | bellard | + printk("Prom console: TCX %dx%d\n", q_width, q_height);
|
797 | 6f7e9aec | bellard | + else
|
798 | 6f7e9aec | bellard | + printk("Prom console: serial\n");
|
799 | e80cfcfc | bellard | + sched_init();
|
800 | e80cfcfc | bellard | + le_probe();
|
801 | e80cfcfc | bellard | + init_net();
|
802 | 6d82d04a | bellard | + esp_probe();
|
803 | e80cfcfc | bellard | +
|
804 | 6d82d04a | bellard | + bootdev = hw_idprom->boot_device;
|
805 | 6d82d04a | bellard | + printk("Boot device: %c\n", bootdev);
|
806 | 6d82d04a | bellard | + if (hw_idprom->kernel_size > 0) {
|
807 | 6d82d04a | bellard | + printk("Kernel already loaded\n");
|
808 | 6d82d04a | bellard | + } else if (bootdev == 'n') {
|
809 | 6f7e9aec | bellard | + if (bootp() != 0) fatal();
|
810 | 6f7e9aec | bellard | + /*
|
811 | 6f7e9aec | bellard | + * boot_rec.bp_file cannot be used because system PROM
|
812 | 6f7e9aec | bellard | + * uses it to locate ourselves. If we load from boot_rec.bp_file,
|
813 | 6f7e9aec | bellard | + * we will loop reloading PROLL over and over again.
|
814 | 6f7e9aec | bellard | + * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L).
|
815 | 6f7e9aec | bellard | + */
|
816 | 6f7e9aec | bellard | + xtoa(myipaddr, fname, 8);
|
817 | 6f7e9aec | bellard | + fname[9] = '.';
|
818 | 6f7e9aec | bellard | + fname[10] = 'P';
|
819 | 6f7e9aec | bellard | + fname[11] = 'R';
|
820 | 6f7e9aec | bellard | + fname[12] = 'O';
|
821 | 6f7e9aec | bellard | + fname[13] = 'L';
|
822 | 6f7e9aec | bellard | + fname[14] = 0;
|
823 | 6f7e9aec | bellard | +
|
824 | 6f7e9aec | bellard | + if (load(boot_rec.bp_siaddr, fname) != 0) fatal();
|
825 | 6d82d04a | bellard | + } else if (bootdev == 'c') {
|
826 | 6d82d04a | bellard | + if (esp_boot(0) != 0) fatal();
|
827 | 6d82d04a | bellard | + } else if (bootdev == 'd') {
|
828 | 6d82d04a | bellard | + if (esp_boot(2) != 0) fatal();
|
829 | 6f7e9aec | bellard | + }
|
830 | e80cfcfc | bellard | +
|
831 | 6f7e9aec | bellard | + romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas,
|
832 | 6f7e9aec | bellard | + (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic);
|
833 | e80cfcfc | bellard | +
|
834 | e80cfcfc | bellard | + printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",
|
835 | e80cfcfc | bellard | + PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,
|
836 | e80cfcfc | bellard | + (int)cio.start, (int)cio.curp);
|
837 | e80cfcfc | bellard | +
|
838 | e80cfcfc | bellard | + {
|
839 | 6f7e9aec | bellard | + void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr;
|
840 | 6f7e9aec | bellard | + printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n",
|
841 | 6f7e9aec | bellard | + *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline);
|
842 | e80cfcfc | bellard | + entry(romvec, 0, 0, 0, 0);
|
843 | e80cfcfc | bellard | + }
|
844 | e80cfcfc | bellard | +
|
845 | e80cfcfc | bellard | + mem_fini(&cmem);
|
846 | e80cfcfc | bellard | + vcon_fini(&dp0);
|
847 | e80cfcfc | bellard | +}
|
848 | e80cfcfc | bellard | +
|
849 | e80cfcfc | bellard | +/*
|
850 | e80cfcfc | bellard | + * dvma_alloc over iommu_alloc.
|
851 | e80cfcfc | bellard | + */
|
852 | e80cfcfc | bellard | +void *dvma_alloc(int size, unsigned int *pphys)
|
853 | e80cfcfc | bellard | +{
|
854 | e80cfcfc | bellard | + return iommu_alloc(&ciommu, size, pphys);
|
855 | e80cfcfc | bellard | +}
|
856 | e80cfcfc | bellard | +
|
857 | e80cfcfc | bellard | +/*
|
858 | e80cfcfc | bellard | + */
|
859 | 9e61bde5 | bellard | +void udelay(__attribute__((unused)) unsigned long usecs)
|
860 | e80cfcfc | bellard | +{
|
861 | 6f7e9aec | bellard | + // Qemu hardware is perfect and does not need any delays!
|
862 | e80cfcfc | bellard | +}
|
863 | e80cfcfc | bellard | +
|
864 | e80cfcfc | bellard | +static void init_idprom()
|
865 | e80cfcfc | bellard | +{
|
866 | 6f7e9aec | bellard | + void *va_prom;
|
867 | e80cfcfc | bellard | +
|
868 | e80cfcfc | bellard | + if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {
|
869 | e80cfcfc | bellard | + printk("init_idprom: cannot map eeprom\n");
|
870 | e80cfcfc | bellard | + fatal();
|
871 | e80cfcfc | bellard | + }
|
872 | e80cfcfc | bellard | + bcopy(va_prom + PHYS_JJ_IDPROM_OFF, idprom, IDPROM_SIZE);
|
873 | e80cfcfc | bellard | + /*
|
874 | e80cfcfc | bellard | + * hw_idprom is not used anywhere.
|
875 | e80cfcfc | bellard | + * It's just as we hate to leave hanging pointers (I/O page here).
|
876 | e80cfcfc | bellard | + */
|
877 | e80cfcfc | bellard | + hw_idprom = va_prom;
|
878 | e80cfcfc | bellard | +}
|
879 | e80cfcfc | bellard | +
|
880 | 9e61bde5 | bellard | diff -ruN proll_18.orig/qemu/openprom.c proll-patch-15/qemu/openprom.c
|
881 | 6f7e9aec | bellard | --- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000
|
882 | 9e61bde5 | bellard | +++ proll-patch-15/qemu/openprom.c 2005-11-07 20:11:04.000000000 +0000
|
883 | 9e61bde5 | bellard | @@ -0,0 +1,910 @@
|
884 | e80cfcfc | bellard | +/*
|
885 | 6f7e9aec | bellard | + * PROM interface support
|
886 | 6f7e9aec | bellard | + * Copyright 1996 The Australian National University.
|
887 | 6f7e9aec | bellard | + * Copyright 1996 Fujitsu Laboratories Limited
|
888 | 6f7e9aec | bellard | + * Copyright 1999 Pete A. Zaitcev
|
889 | 6f7e9aec | bellard | + * This software may be distributed under the terms of the Gnu
|
890 | 6f7e9aec | bellard | + * Public License version 2 or later
|
891 | e80cfcfc | bellard | + */
|
892 | e80cfcfc | bellard | +
|
893 | 6f7e9aec | bellard | +#include <openprom.h>
|
894 | 6f7e9aec | bellard | +#include <general.h>
|
895 | 6f7e9aec | bellard | +#include <romlib.h>
|
896 | 6f7e9aec | bellard | +#include <system.h>
|
897 | 6f7e9aec | bellard | +#include <vconsole.h>
|
898 | 6f7e9aec | bellard | +#include "phys_jj.h"
|
899 | e80cfcfc | bellard | +
|
900 | 6f7e9aec | bellard | +//#define DEBUG_OBP
|
901 | e80cfcfc | bellard | +
|
902 | 6d82d04a | bellard | +#define PAGE_SIZE 4096
|
903 | 6d82d04a | bellard | +
|
904 | 6f7e9aec | bellard | +struct property {
|
905 | 6f7e9aec | bellard | + const char *name;
|
906 | 6f7e9aec | bellard | + const char *value;
|
907 | 9e61bde5 | bellard | + int length;
|
908 | 6f7e9aec | bellard | +};
|
909 | e80cfcfc | bellard | +
|
910 | 6f7e9aec | bellard | +struct node {
|
911 | 6f7e9aec | bellard | + const struct property *properties;
|
912 | 6f7e9aec | bellard | + /* short */ const int sibling;
|
913 | 6f7e9aec | bellard | + /* short */ const int child;
|
914 | 6f7e9aec | bellard | +};
|
915 | e80cfcfc | bellard | +
|
916 | 6f7e9aec | bellard | +static int obp_nextnode(int node);
|
917 | 6f7e9aec | bellard | +static int obp_child(int node);
|
918 | 6f7e9aec | bellard | +static int obp_proplen(int node, char *name);
|
919 | 6f7e9aec | bellard | +static int obp_getprop(int node, char *name, char *val);
|
920 | 6f7e9aec | bellard | +static int obp_setprop(int node, char *name, char *val, int len);
|
921 | 6f7e9aec | bellard | +static const char *obp_nextprop(int node, char *name);
|
922 | e80cfcfc | bellard | +
|
923 | 6f7e9aec | bellard | +static char obp_idprom[IDPROM_SIZE];
|
924 | 6f7e9aec | bellard | +static const struct property null_properties = { NULL, NULL, -1 };
|
925 | 6f7e9aec | bellard | +static const int prop_true = -1;
|
926 | e80cfcfc | bellard | +
|
927 | 9e61bde5 | bellard | +static struct property propv_root[7];
|
928 | 9e61bde5 | bellard | +
|
929 | 9e61bde5 | bellard | +static const struct property propv_root_templ[] = {
|
930 | 9e61bde5 | bellard | + {"name", "SUNW,SparcStation-5", sizeof("SUNW,SparcStation-5") },
|
931 | 6f7e9aec | bellard | + {"idprom", obp_idprom, IDPROM_SIZE},
|
932 | 9e61bde5 | bellard | + {"banner-name", "SparcStation", sizeof("SparcStation")},
|
933 | 6f7e9aec | bellard | + {"compatible", "sun4m", 6},
|
934 | 6f7e9aec | bellard | +};
|
935 | e80cfcfc | bellard | +
|
936 | 6f7e9aec | bellard | +static const int prop_iommu_reg[] = {
|
937 | 6f7e9aec | bellard | + 0x0, 0x10000000, 0x00000300,
|
938 | 6f7e9aec | bellard | +};
|
939 | 6f7e9aec | bellard | +static const struct property propv_iommu[] = {
|
940 | 6f7e9aec | bellard | + {"name", "iommu", sizeof("iommu")},
|
941 | 6f7e9aec | bellard | + {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) },
|
942 | 6f7e9aec | bellard | + {NULL, NULL, -1}
|
943 | 6f7e9aec | bellard | +};
|
944 | e80cfcfc | bellard | +
|
945 | 6f7e9aec | bellard | +static const int prop_sbus_ranges[] = {
|
946 | 6f7e9aec | bellard | + 0x0, 0x0, 0x0, 0x30000000, 0x10000000,
|
947 | 6f7e9aec | bellard | + 0x1, 0x0, 0x0, 0x40000000, 0x10000000,
|
948 | 6f7e9aec | bellard | + 0x2, 0x0, 0x0, 0x50000000, 0x10000000,
|
949 | 6f7e9aec | bellard | + 0x3, 0x0, 0x0, 0x60000000, 0x10000000,
|
950 | 6f7e9aec | bellard | + 0x4, 0x0, 0x0, 0x70000000, 0x10000000,
|
951 | 6f7e9aec | bellard | +};
|
952 | 6f7e9aec | bellard | +static const struct property propv_sbus[] = {
|
953 | 6f7e9aec | bellard | + {"name", "sbus", 5},
|
954 | 6f7e9aec | bellard | + {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)},
|
955 | 6f7e9aec | bellard | + {"device_type", "hierarchical", sizeof("hierarchical") },
|
956 | 6f7e9aec | bellard | + {NULL, NULL, -1}
|
957 | 6f7e9aec | bellard | +};
|
958 | e80cfcfc | bellard | +
|
959 | 6f7e9aec | bellard | +static const int prop_tcx_regs[] = {
|
960 | 6f7e9aec | bellard | + 0x2, 0x00800000, 0x00100000,
|
961 | 6f7e9aec | bellard | + 0x2, 0x02000000, 0x00000001,
|
962 | 6f7e9aec | bellard | + 0x2, 0x04000000, 0x00800000,
|
963 | 6f7e9aec | bellard | + 0x2, 0x06000000, 0x00800000,
|
964 | 6f7e9aec | bellard | + 0x2, 0x0a000000, 0x00000001,
|
965 | 6f7e9aec | bellard | + 0x2, 0x0c000000, 0x00000001,
|
966 | 6f7e9aec | bellard | + 0x2, 0x0e000000, 0x00000001,
|
967 | 6f7e9aec | bellard | + 0x2, 0x00700000, 0x00001000,
|
968 | 6f7e9aec | bellard | + 0x2, 0x00200000, 0x00000004,
|
969 | 6f7e9aec | bellard | + 0x2, 0x00300000, 0x0000081c,
|
970 | 6f7e9aec | bellard | + 0x2, 0x00000000, 0x00010000,
|
971 | 6f7e9aec | bellard | + 0x2, 0x00240000, 0x00000004,
|
972 | 6f7e9aec | bellard | + 0x2, 0x00280000, 0x00000001,
|
973 | 6f7e9aec | bellard | +};
|
974 | e80cfcfc | bellard | +
|
975 | e80cfcfc | bellard | +#if 1 /* Zaitcev */
|
976 | e80cfcfc | bellard | +static const int pixfreq = 0x03dfd240;
|
977 | e80cfcfc | bellard | +static const int hbporch = 0xa0;
|
978 | e80cfcfc | bellard | +static const int vfreq = 0x3c;
|
979 | e80cfcfc | bellard | +#endif
|
980 | e80cfcfc | bellard | +#if 0 /* Kevin Boone - 70Hz refresh */
|
981 | e80cfcfc | bellard | +static const int pixfreq = 0x047868C0;
|
982 | e80cfcfc | bellard | +static const int hbporch = 0x90;
|
983 | e80cfcfc | bellard | +static const int vfreq = 0x46;
|
984 | e80cfcfc | bellard | +#endif
|
985 | e80cfcfc | bellard | +
|
986 | e80cfcfc | bellard | +static const int vbporch = 0x1d;
|
987 | e80cfcfc | bellard | +static const int vsync = 0x6;
|
988 | e80cfcfc | bellard | +static const int hsync = 0x88;
|
989 | e80cfcfc | bellard | +static const int vfporch = 0x3;
|
990 | e80cfcfc | bellard | +static const int hfporch = 0x18;
|
991 | e80cfcfc | bellard | +static const int height = 0x300;
|
992 | e80cfcfc | bellard | +static const int width = 0x400;
|
993 | e80cfcfc | bellard | +static const int linebytes = 0x400;
|
994 | 9e61bde5 | bellard | +static const int depth = 24;
|
995 | e80cfcfc | bellard | +static const int tcx_intr[] = { 5, 0 };
|
996 | e80cfcfc | bellard | +static const int tcx_interrupts = 5;
|
997 | e80cfcfc | bellard | +static const struct property propv_sbus_tcx[] = {
|
998 | e80cfcfc | bellard | + {"name", "SUNW,tcx", sizeof("SUNW,tcx")},
|
999 | e80cfcfc | bellard | + {"vbporch", (char*)&vbporch, sizeof(int)},
|
1000 | e80cfcfc | bellard | + {"hbporch", (char*)&hbporch, sizeof(int)},
|
1001 | e80cfcfc | bellard | + {"vsync", (char*)&vsync, sizeof(int)},
|
1002 | e80cfcfc | bellard | + {"hsync", (char*)&hsync, sizeof(int)},
|
1003 | e80cfcfc | bellard | + {"vfporch", (char*)&vfporch, sizeof(int)},
|
1004 | e80cfcfc | bellard | + {"hfporch", (char*)&hfporch, sizeof(int)},
|
1005 | e80cfcfc | bellard | + {"pixfreq", (char*)&pixfreq, sizeof(int)},
|
1006 | e80cfcfc | bellard | + {"vfreq", (char*)&vfreq, sizeof(int)},
|
1007 | e80cfcfc | bellard | + {"height", (char*)&height, sizeof(int)},
|
1008 | e80cfcfc | bellard | + {"width", (char*)&width, sizeof(int)},
|
1009 | e80cfcfc | bellard | + {"linebytes", (char*)&linebytes, sizeof(int)},
|
1010 | e80cfcfc | bellard | + {"depth", (char*)&depth, sizeof(int)},
|
1011 | e80cfcfc | bellard | + {"reg", (char*)&prop_tcx_regs[0], sizeof(prop_tcx_regs)},
|
1012 | 9e61bde5 | bellard | + {"tcx-8-bit", 0, -1},
|
1013 | e80cfcfc | bellard | + {"intr", (char*)&tcx_intr[0], sizeof(tcx_intr)},
|
1014 | e80cfcfc | bellard | + {"interrupts", (char*)&tcx_interrupts, sizeof(tcx_interrupts)},
|
1015 | e80cfcfc | bellard | + {"device_type", "display", sizeof("display")},
|
1016 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1017 | e80cfcfc | bellard | +};
|
1018 | e80cfcfc | bellard | +
|
1019 | e80cfcfc | bellard | +static const int prop_cs4231_reg[] = {
|
1020 | e80cfcfc | bellard | + 0x3, 0x0C000000, 0x00000040
|
1021 | e80cfcfc | bellard | +};
|
1022 | e80cfcfc | bellard | +static const int cs4231_interrupts = 5;
|
1023 | e80cfcfc | bellard | +static const int cs4231_intr[] = { 5, 0 };
|
1024 | e80cfcfc | bellard | +
|
1025 | e80cfcfc | bellard | +static const struct property propv_sbus_cs4231[] = {
|
1026 | e80cfcfc | bellard | + {"name", "SUNW,CS4231", sizeof("SUNW,CS4231") },
|
1027 | e80cfcfc | bellard | + {"intr", (char*)&cs4231_intr[0], sizeof(cs4231_intr) },
|
1028 | e80cfcfc | bellard | + {"interrupts", (char*)&cs4231_interrupts, sizeof(cs4231_interrupts) },
|
1029 | e80cfcfc | bellard | + {"reg", (char*)&prop_cs4231_reg[0], sizeof(prop_cs4231_reg) },
|
1030 | e80cfcfc | bellard | + {"device_type", "serial", sizeof("serial") },
|
1031 | e80cfcfc | bellard | + {"alias", "audio", sizeof("audio") },
|
1032 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1033 | e80cfcfc | bellard | +};
|
1034 | e80cfcfc | bellard | +
|
1035 | e80cfcfc | bellard | +static const int cpu_nctx = NCTX_SWIFT;
|
1036 | e80cfcfc | bellard | +static const int cpu_cache_line_size = 0x20;
|
1037 | e80cfcfc | bellard | +static const int cpu_cache_nlines = 0x200;
|
1038 | e80cfcfc | bellard | +static const struct property propv_cpu[] = {
|
1039 | e80cfcfc | bellard | + {"name", "STP1012PGA", sizeof("STP1012PGA") },
|
1040 | e80cfcfc | bellard | + {"device_type", "cpu", 4 },
|
1041 | e80cfcfc | bellard | + {"mmu-nctx", (char*)&cpu_nctx, sizeof(int)},
|
1042 | e80cfcfc | bellard | + {"cache-line-size", (char*)&cpu_cache_line_size, sizeof(int)},
|
1043 | e80cfcfc | bellard | + {"cache-nlines", (char*)&cpu_cache_nlines, sizeof(int)},
|
1044 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1045 | e80cfcfc | bellard | +};
|
1046 | e80cfcfc | bellard | +
|
1047 | e80cfcfc | bellard | +static const int prop_obio_ranges[] = {
|
1048 | e80cfcfc | bellard | + 0x0, 0x0, 0x0, 0x71000000, 0x01000000,
|
1049 | e80cfcfc | bellard | +};
|
1050 | e80cfcfc | bellard | +static const struct property propv_obio[] = {
|
1051 | e80cfcfc | bellard | + {"name", "obio", 5 },
|
1052 | e80cfcfc | bellard | + {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },
|
1053 | 6f7e9aec | bellard | + {"device_type", "hierarchical", sizeof("hierarchical") },
|
1054 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1055 | e80cfcfc | bellard | +};
|
1056 | e80cfcfc | bellard | +
|
1057 | e80cfcfc | bellard | +static const int prop_auxio_reg[] = {
|
1058 | e80cfcfc | bellard | + 0x0, 0x00900000, 0x00000001,
|
1059 | e80cfcfc | bellard | +};
|
1060 | e80cfcfc | bellard | +static const struct property propv_obio_auxio[] = {
|
1061 | e80cfcfc | bellard | + {"name", "auxio", sizeof("auxio") },
|
1062 | e80cfcfc | bellard | + {"reg", (char*)&prop_auxio_reg[0], sizeof(prop_auxio_reg) },
|
1063 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1064 | e80cfcfc | bellard | +};
|
1065 | e80cfcfc | bellard | +
|
1066 | e80cfcfc | bellard | +static const int prop_int_reg[] = {
|
1067 | e80cfcfc | bellard | + 0x0, 0x00e00000, 0x00000010,
|
1068 | e80cfcfc | bellard | + 0x0, 0x00e10000, 0x00000010,
|
1069 | e80cfcfc | bellard | +};
|
1070 | e80cfcfc | bellard | +static const struct property propv_obio_int[] = {
|
1071 | e80cfcfc | bellard | + {"name", "interrupt", sizeof("interrupt")},
|
1072 | e80cfcfc | bellard | + {"reg", (char*)&prop_int_reg[0], sizeof(prop_int_reg) },
|
1073 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1074 | e80cfcfc | bellard | +};
|
1075 | e80cfcfc | bellard | +
|
1076 | e80cfcfc | bellard | +static const int prop_cnt_reg[] = {
|
1077 | e80cfcfc | bellard | + 0x0, 0x00d00000, 0x00000010,
|
1078 | e80cfcfc | bellard | + 0x0, 0x00d10000, 0x00000010,
|
1079 | e80cfcfc | bellard | +};
|
1080 | e80cfcfc | bellard | +static const struct property propv_obio_cnt[] = {
|
1081 | e80cfcfc | bellard | + {"name", "counter", sizeof("counter")},
|
1082 | e80cfcfc | bellard | + {"reg", (char*)&prop_cnt_reg[0], sizeof(prop_cnt_reg) },
|
1083 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1084 | e80cfcfc | bellard | +};
|
1085 | e80cfcfc | bellard | +
|
1086 | e80cfcfc | bellard | +static const int prop_eeprom_reg[] = {
|
1087 | e80cfcfc | bellard | + 0x0, 0x00200000, 0x00002000,
|
1088 | e80cfcfc | bellard | +};
|
1089 | e80cfcfc | bellard | +static const struct property propv_obio_eep[] = {
|
1090 | e80cfcfc | bellard | + {"name", "eeprom", sizeof("eeprom")},
|
1091 | e80cfcfc | bellard | + {"reg", (char*)&prop_eeprom_reg[0], sizeof(prop_eeprom_reg) },
|
1092 | e80cfcfc | bellard | + {"model", "mk48t08", sizeof("mk48t08")},
|
1093 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1094 | e80cfcfc | bellard | +};
|
1095 | e80cfcfc | bellard | +
|
1096 | e80cfcfc | bellard | +static const int prop_su_reg[] = {
|
1097 | e80cfcfc | bellard | + 0x0, 0x003002f8, 0x00000008,
|
1098 | e80cfcfc | bellard | +};
|
1099 | e80cfcfc | bellard | +static const struct property propv_obio_su[] = {
|
1100 | e80cfcfc | bellard | + {"name", "su", sizeof("su")},
|
1101 | e80cfcfc | bellard | + {"reg", (char*)&prop_su_reg[0], sizeof(prop_su_reg) },
|
1102 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1103 | e80cfcfc | bellard | +};
|
1104 | e80cfcfc | bellard | +
|
1105 | c44644bb | bellard | +static const int prop_zs_intr[] = { 0x2c, 0x0 };
|
1106 | e80cfcfc | bellard | +static const int prop_zs_reg[] = {
|
1107 | 6f7e9aec | bellard | + 0x0, 0x00000000, 0x00000008,
|
1108 | e80cfcfc | bellard | +};
|
1109 | c44644bb | bellard | +static void *prop_zs_addr;
|
1110 | 9e61bde5 | bellard | +static const int prop_zs_slave = 1;
|
1111 | e80cfcfc | bellard | +static const struct property propv_obio_zs[] = {
|
1112 | e80cfcfc | bellard | + {"name", "zs", sizeof("zs")},
|
1113 | e80cfcfc | bellard | + {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) },
|
1114 | 9e61bde5 | bellard | + {"slave", (char*)&prop_zs_slave, sizeof(prop_zs_slave) },
|
1115 | e80cfcfc | bellard | + {"device_type", "serial", sizeof("serial") },
|
1116 | 6f7e9aec | bellard | + {"intr", (char*)&prop_zs_intr[0], sizeof(prop_zs_intr) },
|
1117 | c44644bb | bellard | + {"address", (char*)&prop_zs_addr, sizeof(prop_zs_addr) },
|
1118 | 9e61bde5 | bellard | + {"keyboard", (char*)&prop_true, 0},
|
1119 | 9e61bde5 | bellard | + {"mouse", (char*)&prop_true, 0},
|
1120 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1121 | e80cfcfc | bellard | +};
|
1122 | e80cfcfc | bellard | +
|
1123 | c44644bb | bellard | +static const int prop_zs1_intr[] = { 0x2c, 0x0 };
|
1124 | e80cfcfc | bellard | +static const int prop_zs1_reg[] = {
|
1125 | 6f7e9aec | bellard | + 0x0, 0x00100000, 0x00000008,
|
1126 | e80cfcfc | bellard | +};
|
1127 | c44644bb | bellard | +static void *prop_zs1_addr;
|
1128 | 9e61bde5 | bellard | +static const int prop_zs1_slave = 0;
|
1129 | e80cfcfc | bellard | +static const struct property propv_obio_zs1[] = {
|
1130 | e80cfcfc | bellard | + {"name", "zs", sizeof("zs")},
|
1131 | e80cfcfc | bellard | + {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) },
|
1132 | 9e61bde5 | bellard | + {"slave", (char*)&prop_zs1_slave, sizeof(prop_zs1_slave) },
|
1133 | e80cfcfc | bellard | + {"device_type", "serial", sizeof("serial") },
|
1134 | 6f7e9aec | bellard | + {"intr", (char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) },
|
1135 | c44644bb | bellard | + {"address", (char*)&prop_zs1_addr, sizeof(prop_zs1_addr) },
|
1136 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1137 | e80cfcfc | bellard | +};
|
1138 | e80cfcfc | bellard | +
|
1139 | e80cfcfc | bellard | +static const int prop_ledma_reg[] = {
|
1140 | e80cfcfc | bellard | + 0x4, 0x08400010, 0x00000020,
|
1141 | e80cfcfc | bellard | +};
|
1142 | e80cfcfc | bellard | +static const int prop_ledma_burst = 0x3f;
|
1143 | e80cfcfc | bellard | +static const struct property propv_sbus_ledma[] = {
|
1144 | e80cfcfc | bellard | + {"name", "ledma", sizeof("ledma")},
|
1145 | e80cfcfc | bellard | + {"reg", (char*)&prop_ledma_reg[0], sizeof(prop_ledma_reg) },
|
1146 | e80cfcfc | bellard | + {"burst-sizes", (char*)&prop_ledma_burst, sizeof(int) },
|
1147 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1148 | e80cfcfc | bellard | +};
|
1149 | e80cfcfc | bellard | +
|
1150 | e80cfcfc | bellard | +static const int prop_le_reg[] = {
|
1151 | e80cfcfc | bellard | + 0x4, 0x08c00000, 0x00000004,
|
1152 | e80cfcfc | bellard | +};
|
1153 | e80cfcfc | bellard | +static const int prop_le_busmaster_regval = 0x7;
|
1154 | e80cfcfc | bellard | +static const int prop_le_intr[] = { 0x26, 0x0 };
|
1155 | e80cfcfc | bellard | +static const struct property propv_sbus_ledma_le[] = {
|
1156 | e80cfcfc | bellard | + {"name", "le", sizeof("le")},
|
1157 | e80cfcfc | bellard | + {"reg", (char*)&prop_le_reg[0], sizeof(prop_le_reg) },
|
1158 | e80cfcfc | bellard | + {"busmaster-regval", (char*)&prop_le_busmaster_regval, sizeof(int)},
|
1159 | e80cfcfc | bellard | + {"intr", (char*)&prop_le_intr[0], sizeof(prop_le_intr) },
|
1160 | e80cfcfc | bellard | + {NULL, NULL, -1}
|
1161 | e80cfcfc | bellard | +};
|
1162 | e80cfcfc | bellard | +
|
1163 | 6f7e9aec | bellard | +static const int prop_espdma_reg[] = {
|
1164 | 6f7e9aec | bellard | + 0x4, 0x08400000, 0x00000010,
|
1165 | 6f7e9aec | bellard | +};
|
1166 | c44644bb | bellard | +
|
1167 | 6f7e9aec | bellard | +static const struct property propv_sbus_espdma[] = {
|
1168 | c44644bb | bellard | + {"name", "espdma", sizeof("espdma")},
|
1169 | 6f7e9aec | bellard | + {"reg", (char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) },
|
1170 | 6f7e9aec | bellard | + {NULL, NULL, -1}
|
1171 | 6f7e9aec | bellard | +};
|
1172 | 6f7e9aec | bellard | +
|
1173 | 6f7e9aec | bellard | +static const int prop_esp_reg[] = {
|
1174 | 6f7e9aec | bellard | + 0x4, 0x08800000, 0x00000040,
|
1175 | 6f7e9aec | bellard | +};
|
1176 | 6f7e9aec | bellard | +static const int prop_esp_intr[] = { 0x24, 0x0 };
|
1177 | 6f7e9aec | bellard | +static const struct property propv_sbus_espdma_esp[] = {
|
1178 | 6f7e9aec | bellard | + {"name", "esp", sizeof("esp")},
|
1179 | 6f7e9aec | bellard | + {"reg", (char*)&prop_esp_reg[0], sizeof(prop_esp_reg) },
|
1180 | 6f7e9aec | bellard | + {"intr", (char*)&prop_esp_intr[0], sizeof(prop_esp_intr) },
|
1181 | 6f7e9aec | bellard | + {NULL, NULL, -1}
|
1182 | 6f7e9aec | bellard | +};
|
1183 | 6f7e9aec | bellard | +
|
1184 | 6f7e9aec | bellard | +static const int prop_bpp_reg[] = {
|
1185 | 6f7e9aec | bellard | + 0x4, 0x0c800000, 0x0000001c,
|
1186 | 6f7e9aec | bellard | +};
|
1187 | 6f7e9aec | bellard | +static const int prop_bpp_intr[] = { 0x33, 0x0 };
|
1188 | 6f7e9aec | bellard | +static const struct property propv_sbus_bpp[] = {
|
1189 | 6f7e9aec | bellard | + {"name", "SUNW,bpp", sizeof("SUNW,bpp")},
|
1190 | 6f7e9aec | bellard | + {"reg", (char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) },
|
1191 | 6f7e9aec | bellard | + {"intr", (char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) },
|
1192 | 6f7e9aec | bellard | + {NULL, NULL, -1}
|
1193 | 6f7e9aec | bellard | +};
|
1194 | 6f7e9aec | bellard | +
|
1195 | 9e61bde5 | bellard | +static const int prop_apc_reg[] = {
|
1196 | 9e61bde5 | bellard | + 0x4, 0x0a000000, 0x00000010,
|
1197 | 9e61bde5 | bellard | +};
|
1198 | 9e61bde5 | bellard | +static const struct property propv_sbus_apc[] = {
|
1199 | 9e61bde5 | bellard | + {"name", "xxxpower-management", sizeof("xxxpower-management")},
|
1200 | 9e61bde5 | bellard | + {"reg", (char*)&prop_apc_reg[0], sizeof(prop_apc_reg) },
|
1201 | 9e61bde5 | bellard | + {NULL, NULL, -1}
|
1202 | 9e61bde5 | bellard | +};
|
1203 | 9e61bde5 | bellard | +
|
1204 | 6f7e9aec | bellard | +static const int prop_fd_intr[] = { 0x2b, 0x0 };
|
1205 | 6f7e9aec | bellard | +static const int prop_fd_reg[] = {
|
1206 | 6f7e9aec | bellard | + 0x0, 0x00400000, 0x0000000f,
|
1207 | 6f7e9aec | bellard | +};
|
1208 | 6f7e9aec | bellard | +static const struct property propv_obio_fd[] = {
|
1209 | 6f7e9aec | bellard | + {"name", "SUNW,fdtwo", sizeof("SUNW,fdtwo")},
|
1210 | 6f7e9aec | bellard | + {"reg", (char*)&prop_fd_reg[0], sizeof(prop_fd_reg) },
|
1211 | 6f7e9aec | bellard | + {"device_type", "block", sizeof("block") },
|
1212 | 6f7e9aec | bellard | + {"intr", (char*)&prop_fd_intr[0], sizeof(prop_fd_intr) },
|
1213 | 6f7e9aec | bellard | + {NULL, NULL, -1}
|
1214 | 6f7e9aec | bellard | +};
|
1215 | 6f7e9aec | bellard | +
|
1216 | 6f7e9aec | bellard | +static const int prop_pw_intr[] = { 0x22, 0x0 };
|
1217 | 6f7e9aec | bellard | +static const int prop_pw_reg[] = {
|
1218 | 6f7e9aec | bellard | + 0x0, 0x00910000, 0x00000001,
|
1219 | 6f7e9aec | bellard | +};
|
1220 | 6f7e9aec | bellard | +static const struct property propv_obio_pw[] = {
|
1221 | 6f7e9aec | bellard | + {"name", "power", sizeof("power")},
|
1222 | 6f7e9aec | bellard | + {"reg", (char*)&prop_pw_reg[0], sizeof(prop_pw_reg) },
|
1223 | 6f7e9aec | bellard | + {"intr", (char*)&prop_pw_intr[0], sizeof(prop_pw_intr) },
|
1224 | 6f7e9aec | bellard | + {NULL, NULL, -1}
|
1225 | 6f7e9aec | bellard | +};
|
1226 | 6f7e9aec | bellard | +
|
1227 | 6f7e9aec | bellard | +static const int prop_cf_reg[] = {
|
1228 | 6f7e9aec | bellard | + 0x0, 0x00800000, 0x00000001,
|
1229 | 6f7e9aec | bellard | +};
|
1230 | 6f7e9aec | bellard | +static const struct property propv_obio_cf[] = {
|
1231 | 6f7e9aec | bellard | + {"name", "slavioconfig", sizeof("slavioconfig")},
|
1232 | 6f7e9aec | bellard | + {"reg", (char*)&prop_cf_reg[0], sizeof(prop_cf_reg) },
|
1233 | 6f7e9aec | bellard | + {NULL, NULL, -1}
|
1234 | 6f7e9aec | bellard | +};
|
1235 | 6f7e9aec | bellard | +
|
1236 | c44644bb | bellard | +static const struct property propv_options[] = {
|
1237 | c44644bb | bellard | + {"name", "options", sizeof("options")},
|
1238 | c44644bb | bellard | + {"screen-#columns", "80", sizeof("80")},
|
1239 | c44644bb | bellard | + {"screen-#rows", "25", sizeof("25")},
|
1240 | 9e61bde5 | bellard | + {"tpe-link-test?", (char *)&prop_true, 0},
|
1241 | c44644bb | bellard | + {"ttya-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")},
|
1242 | 9e61bde5 | bellard | + {"ttya-ignore-cd", (char *)&prop_true, 0},
|
1243 | 9e61bde5 | bellard | + {"ttya-rts-dtr-off", 0, -1},
|
1244 | c44644bb | bellard | + {"ttyb-mode", "9600,8,n,1,-", sizeof("9600,8,n,1,-")},
|
1245 | 9e61bde5 | bellard | + {"ttyb-ignore-cd", (char *)&prop_true, 0},
|
1246 | 9e61bde5 | bellard | + {"ttyb-rts-dtr-off", 0, -1},
|
1247 | 9e61bde5 | bellard | + {NULL, NULL, -1}
|
1248 | 9e61bde5 | bellard | +};
|
1249 | 9e61bde5 | bellard | +
|
1250 | 9e61bde5 | bellard | +static int prop_mem_reg[3];
|
1251 | 9e61bde5 | bellard | +static int prop_mem_avail[3];
|
1252 | 9e61bde5 | bellard | +
|
1253 | 9e61bde5 | bellard | +static const struct property propv_memory[] = {
|
1254 | 9e61bde5 | bellard | + {"name", "memory", sizeof("memory")},
|
1255 | 9e61bde5 | bellard | + {"reg", (char*)&prop_mem_reg[0], sizeof(prop_mem_reg) },
|
1256 | 9e61bde5 | bellard | + {"available", (char*)&prop_mem_avail[0], sizeof(prop_mem_avail) },
|
1257 | 9e61bde5 | bellard | + {NULL, NULL, -1}
|
1258 | 9e61bde5 | bellard | +};
|
1259 | 9e61bde5 | bellard | +
|
1260 | 9e61bde5 | bellard | +static int prop_vmem_avail[6];
|
1261 | 9e61bde5 | bellard | +
|
1262 | 9e61bde5 | bellard | +static const struct property propv_vmemory[] = {
|
1263 | 9e61bde5 | bellard | + {"name", "virtual-memory", sizeof("virtual-memory")},
|
1264 | 9e61bde5 | bellard | + {"available", (char*)&prop_vmem_avail[0], sizeof(prop_vmem_avail) },
|
1265 | c44644bb | bellard | + {NULL, NULL, -1}
|
1266 | c44644bb | bellard | +};
|
1267 | c44644bb | bellard | +
|
1268 | e80cfcfc | bellard | +static const struct node nodes[] = {
|
1269 | e80cfcfc | bellard | + { &null_properties, 1, 0 }, /* 0 = big brother of root */
|
1270 | e80cfcfc | bellard | + { propv_root, 0, 2 }, /* 1 "/" */
|
1271 | 9e61bde5 | bellard | + { propv_iommu, 12, 3 }, /* 2 "/iommu" */
|
1272 | e80cfcfc | bellard | + { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */
|
1273 | e80cfcfc | bellard | + { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */
|
1274 | e80cfcfc | bellard | + { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */
|
1275 | e80cfcfc | bellard | + { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */
|
1276 | 6f7e9aec | bellard | + { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */
|
1277 | 6f7e9aec | bellard | + { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */
|
1278 | 9e61bde5 | bellard | + { propv_sbus_espdma, 11, 10 }, /* 9 "/iommu/sbus/espdma" */
|
1279 | 6f7e9aec | bellard | + { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */
|
1280 | 9e61bde5 | bellard | + { propv_sbus_apc, 0, 0 }, /* 11 "/iommu/sbus/power-management */
|
1281 | 9e61bde5 | bellard | + { propv_cpu, 13, 0 }, /* 12 "/STP1012PGA" */
|
1282 | 9e61bde5 | bellard | + { propv_obio, 23, 14 }, /* 13 "/obio" */
|
1283 | 9e61bde5 | bellard | + { propv_obio_int, 15, 0 }, /* 14 "/obio/interrupt" */
|
1284 | 9e61bde5 | bellard | + { propv_obio_cnt, 16, 0 }, /* 15 "/obio/counter" */
|
1285 | 9e61bde5 | bellard | + { propv_obio_eep, 17, 0 }, /* 16 "/obio/eeprom" */
|
1286 | 9e61bde5 | bellard | + { propv_obio_auxio, 18, 0 }, /* 17 "/obio/auxio" */
|
1287 | 9e61bde5 | bellard | + { propv_obio_zs1, 19, 0 }, /* 18 "/obio/zs@0,100000"
|
1288 | c44644bb | bellard | + Must be before zs@0,0! */
|
1289 | 9e61bde5 | bellard | + { propv_obio_zs, 20, 0 }, /* 19 "/obio/zs@0,0" */
|
1290 | 9e61bde5 | bellard | + { propv_obio_fd, 21, 0 }, /* 20 "/obio/SUNW,fdtwo" */
|
1291 | 9e61bde5 | bellard | + { propv_obio_pw, 22, 0 }, /* 21 "/obio/power" */
|
1292 | 9e61bde5 | bellard | + { propv_obio_cf, 0, 0 }, /* 22 "/obio/slavioconfig@0,800000" */
|
1293 | 9e61bde5 | bellard | + { propv_options, 24, 0 }, /* 23 "/options" */
|
1294 | 9e61bde5 | bellard | + { propv_memory, 25, 0 }, /* 24 "/memory" */
|
1295 | 9e61bde5 | bellard | + { propv_vmemory, 0, 0 }, /* 25 "/virtual-memory" */
|
1296 | e80cfcfc | bellard | +};
|
1297 | e80cfcfc | bellard | +
|
1298 | e80cfcfc | bellard | +static struct linux_mlist_v0 totphys[MAX_BANKS];
|
1299 | e80cfcfc | bellard | +static struct linux_mlist_v0 totmap[1];
|
1300 | e80cfcfc | bellard | +static struct linux_mlist_v0 totavail[MAX_BANKS];
|
1301 | e80cfcfc | bellard | +
|
1302 | e80cfcfc | bellard | +static struct linux_mlist_v0 *ptphys;
|
1303 | e80cfcfc | bellard | +static struct linux_mlist_v0 *ptmap;
|
1304 | e80cfcfc | bellard | +static struct linux_mlist_v0 *ptavail;
|
1305 | e80cfcfc | bellard | +
|
1306 | e80cfcfc | bellard | +static const struct linux_nodeops nodeops0 = {
|
1307 | e80cfcfc | bellard | + obp_nextnode, /* int (*no_nextnode)(int node); */
|
1308 | e80cfcfc | bellard | + obp_child, /* int (*no_child)(int node); */
|
1309 | e80cfcfc | bellard | + obp_proplen, /* int (*no_proplen)(int node, char *name); */
|
1310 | e80cfcfc | bellard | + obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */
|
1311 | e80cfcfc | bellard | + obp_setprop, /* int (*no_setprop)(int node, char *name,
|
1312 | e80cfcfc | bellard | + char *val, int len); */
|
1313 | e80cfcfc | bellard | + obp_nextprop /* char * (*no_nextprop)(int node, char *name); */
|
1314 | e80cfcfc | bellard | +};
|
1315 | e80cfcfc | bellard | +
|
1316 | 6f7e9aec | bellard | +static struct linux_arguments_v0 obp_arg;
|
1317 | e80cfcfc | bellard | +static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
|
1318 | e80cfcfc | bellard | +
|
1319 | 6f7e9aec | bellard | +static void (*synch_hook)(void);
|
1320 | 6f7e9aec | bellard | +static char obp_stdin, obp_stdout;
|
1321 | 9e61bde5 | bellard | +static int obp_fd_stdin, obp_fd_stdout;
|
1322 | 6f7e9aec | bellard | +
|
1323 | 6f7e9aec | bellard | +static int obp_nbgetchar(void);
|
1324 | 6f7e9aec | bellard | +static int obp_nbputchar(int ch);
|
1325 | 6f7e9aec | bellard | +static void obp_reboot(char *);
|
1326 | 6f7e9aec | bellard | +static void obp_abort(void);
|
1327 | 6f7e9aec | bellard | +static void obp_halt(void);
|
1328 | 6f7e9aec | bellard | +static int obp_devopen(char *str);
|
1329 | 6f7e9aec | bellard | +static int obp_devclose(int dev_desc);
|
1330 | 9e61bde5 | bellard | +static int obp_devread(int dev_desc, char *buf, int nbytes);
|
1331 | 9e61bde5 | bellard | +static int obp_devwrite(int dev_desc, char *buf, int nbytes);
|
1332 | 9e61bde5 | bellard | +static int obp_devseek(int dev_desc, int hi, int lo);
|
1333 | 6f7e9aec | bellard | +static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf);
|
1334 | 6d82d04a | bellard | +static char *obp_dumb_mmap(char *va, int which_io, unsigned int pa, unsigned int size);
|
1335 | 6d82d04a | bellard | +static void obp_dumb_munmap(char *va, unsigned int size);
|
1336 | 9e61bde5 | bellard | +static int obp_inst2pkg(int dev_desc);
|
1337 | 6f7e9aec | bellard | +
|
1338 | 6f7e9aec | bellard | +static void doublewalk(unsigned ptab1, unsigned va)
|
1339 | 6f7e9aec | bellard | +{
|
1340 | 6f7e9aec | bellard | +unsigned int proc_tablewalk(int ctx, unsigned int va);
|
1341 | 6f7e9aec | bellard | +unsigned int mem_tablewalk(unsigned int pa, unsigned int va);
|
1342 | 6f7e9aec | bellard | +
|
1343 | 6f7e9aec | bellard | + proc_tablewalk(0, va);
|
1344 | 6f7e9aec | bellard | + if (ptab1 != 0) mem_tablewalk(ptab1, va);
|
1345 | 6f7e9aec | bellard | +}
|
1346 | 6f7e9aec | bellard | +
|
1347 | 6f7e9aec | bellard | +static struct linux_romvec romvec0;
|
1348 | 6f7e9aec | bellard | +
|
1349 | 9e61bde5 | bellard | +struct fd {
|
1350 | 9e61bde5 | bellard | + int unit, part;
|
1351 | 9e61bde5 | bellard | + int offset;
|
1352 | 9e61bde5 | bellard | + int (*pread)(int dev_desc, int offset, char *buf, unsigned int nbytes);
|
1353 | 9e61bde5 | bellard | + int (*pwrite)(int dev_desc, int offset, char *buf, unsigned int nbytes);
|
1354 | 9e61bde5 | bellard | +} fd_table[16];
|
1355 | 9e61bde5 | bellard | +
|
1356 | 9e61bde5 | bellard | +static int fd_index;
|
1357 | 9e61bde5 | bellard | +static int con_pread(int dev_desc, int offset, char *buf, unsigned int nbytes);
|
1358 | 9e61bde5 | bellard | +static int con_pwrite(int dev_desc, int offset, char *buf, unsigned int nbytes);
|
1359 | 9e61bde5 | bellard | +
|
1360 | 6f7e9aec | bellard | +void *
|
1361 | 6f7e9aec | bellard | +init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas,
|
1362 | 6f7e9aec | bellard | + const char *cmdline, char boot_device, int nographic)
|
1363 | 6f7e9aec | bellard | +{
|
1364 | 6f7e9aec | bellard | + int i;
|
1365 | 6f7e9aec | bellard | +
|
1366 | 6f7e9aec | bellard | + /*
|
1367 | 6f7e9aec | bellard | + * Avoid data segment allocations
|
1368 | 6f7e9aec | bellard | + */
|
1369 | 6f7e9aec | bellard | + ptphys = totphys;
|
1370 | 6f7e9aec | bellard | + ptmap = totmap;
|
1371 | 6f7e9aec | bellard | + ptavail = totavail;
|
1372 | 6f7e9aec | bellard | + /*
|
1373 | 6f7e9aec | bellard | + * Form memory descriptors.
|
1374 | 6f7e9aec | bellard | + */
|
1375 | 6f7e9aec | bellard | + for (i = 0; i < bankc; i++) {
|
1376 | 6f7e9aec | bellard | + totphys[i].theres_more = &totphys[i+1];
|
1377 | 6f7e9aec | bellard | + totphys[i].start_adr = (char*) bankv[i].start;
|
1378 | 6f7e9aec | bellard | + totphys[i].num_bytes = bankv[i].length;
|
1379 | 6f7e9aec | bellard | + }
|
1380 | 6f7e9aec | bellard | + totphys[i-1].theres_more = 0;
|
1381 | 6f7e9aec | bellard | +
|
1382 | 6f7e9aec | bellard | + /*
|
1383 | 6f7e9aec | bellard | + * XXX Merged in normal PROM when full banks touch.
|
1384 | 6f7e9aec | bellard | + */
|
1385 | 6f7e9aec | bellard | + for (i = 0; i < bankc; i++) {
|
1386 | 6f7e9aec | bellard | + unsigned bankbase = bankv[i].start;
|
1387 | 6f7e9aec | bellard | + unsigned banksize = bankv[i].length;
|
1388 | 6f7e9aec | bellard | + if (hiphybas > bankbase &&
|
1389 | 6f7e9aec | bellard | + hiphybas < bankbase + banksize) {
|
1390 | 6f7e9aec | bellard | + banksize = hiphybas - bankbase;
|
1391 | 6f7e9aec | bellard | + }
|
1392 | 6f7e9aec | bellard | + totavail[i].theres_more = &totavail[i+1];
|
1393 | 6f7e9aec | bellard | + totavail[i].start_adr = (char*) bankbase;
|
1394 | 6f7e9aec | bellard | + totavail[i].num_bytes = banksize;
|
1395 | 6f7e9aec | bellard | + }
|
1396 | 6f7e9aec | bellard | + totavail[i-1].theres_more = 0;
|
1397 | 6f7e9aec | bellard | +
|
1398 | 6f7e9aec | bellard | + totmap[0].theres_more = 0;
|
1399 | 6f7e9aec | bellard | + totmap[0].start_adr = (char*) PROLBASE;
|
1400 | 6f7e9aec | bellard | + totmap[0].num_bytes = PROLSIZE;
|
1401 | 9e61bde5 | bellard | + prop_mem_reg[0] = 0;
|
1402 | 9e61bde5 | bellard | + prop_mem_reg[1] = 0;
|
1403 | 9e61bde5 | bellard | + prop_mem_reg[2] = bankv[0].length;
|
1404 | 9e61bde5 | bellard | + prop_mem_avail[0] = 0;
|
1405 | 9e61bde5 | bellard | + prop_mem_avail[1] = 0;
|
1406 | 9e61bde5 | bellard | + prop_mem_avail[2] = hiphybas;
|
1407 | 9e61bde5 | bellard | + prop_vmem_avail[0] = 0;
|
1408 | 9e61bde5 | bellard | + prop_vmem_avail[1] = 0;
|
1409 | 9e61bde5 | bellard | + prop_vmem_avail[2] = PROLBASE-1;
|
1410 | 9e61bde5 | bellard | + prop_vmem_avail[3] = 0;
|
1411 | 9e61bde5 | bellard | + prop_vmem_avail[4] = 0xffe00000;
|
1412 | 9e61bde5 | bellard | + prop_vmem_avail[5] = 0x00200000;
|
1413 | 6f7e9aec | bellard | +
|
1414 | 6f7e9aec | bellard | + /*
|
1415 | 6f7e9aec | bellard | + * idprom
|
1416 | 6f7e9aec | bellard | + */
|
1417 | 6f7e9aec | bellard | + bcopy(idprom, obp_idprom, IDPROM_SIZE);
|
1418 | 6f7e9aec | bellard | +
|
1419 | 6f7e9aec | bellard | + // Linux wants a R/W romvec table
|
1420 | 6f7e9aec | bellard | + romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;
|
1421 | 9e61bde5 | bellard | + romvec0.pv_romvers = 3;
|
1422 | 6f7e9aec | bellard | + romvec0.pv_plugin_revision = 77;
|
1423 | 6f7e9aec | bellard | + romvec0.pv_printrev = 0x10203;
|
1424 | 6f7e9aec | bellard | + romvec0.pv_v0mem.v0_totphys = &ptphys;
|
1425 | 6f7e9aec | bellard | + romvec0.pv_v0mem.v0_prommap = &ptmap;
|
1426 | 6f7e9aec | bellard | + romvec0.pv_v0mem.v0_available = &ptavail;
|
1427 | 6f7e9aec | bellard | + romvec0.pv_nodeops = &nodeops0;
|
1428 | 6f7e9aec | bellard | + romvec0.pv_bootstr = (void *)doublewalk;
|
1429 | 6f7e9aec | bellard | + romvec0.pv_v0devops.v0_devopen = &obp_devopen;
|
1430 | 6f7e9aec | bellard | + romvec0.pv_v0devops.v0_devclose = &obp_devclose;
|
1431 | 6f7e9aec | bellard | + romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev;
|
1432 | 6f7e9aec | bellard | + romvec0.pv_stdin = &obp_stdin;
|
1433 | 6f7e9aec | bellard | + romvec0.pv_stdout = &obp_stdout;
|
1434 | 6f7e9aec | bellard | + romvec0.pv_getchar = obp_nbgetchar;
|
1435 | 6f7e9aec | bellard | + romvec0.pv_putchar = (void (*)(int))obp_nbputchar;
|
1436 | 6f7e9aec | bellard | + romvec0.pv_nbgetchar = obp_nbgetchar;
|
1437 | 6f7e9aec | bellard | + romvec0.pv_nbputchar = obp_nbputchar;
|
1438 | 6f7e9aec | bellard | + romvec0.pv_reboot = obp_reboot;
|
1439 | 6d82d04a | bellard | + romvec0.pv_printf = (void (*)(const char *fmt, ...))printk;
|
1440 | 6f7e9aec | bellard | + romvec0.pv_abort = obp_abort;
|
1441 | 6f7e9aec | bellard | + romvec0.pv_halt = obp_halt;
|
1442 | 6f7e9aec | bellard | + romvec0.pv_synchook = &synch_hook;
|
1443 | 6f7e9aec | bellard | + romvec0.pv_v0bootargs = &obp_argp;
|
1444 | 9e61bde5 | bellard | + romvec0.pv_v2devops.v2_inst2pkg = obp_inst2pkg;
|
1445 | 6d82d04a | bellard | + romvec0.pv_v2devops.v2_dumb_mmap = obp_dumb_mmap;
|
1446 | 6d82d04a | bellard | + romvec0.pv_v2devops.v2_dumb_munmap = obp_dumb_munmap;
|
1447 | 9e61bde5 | bellard | + romvec0.pv_v2devops.v2_dev_open = obp_devopen;
|
1448 | 9e61bde5 | bellard | + romvec0.pv_v2devops.v2_dev_close = (void (*)(int))obp_devclose;
|
1449 | 9e61bde5 | bellard | + romvec0.pv_v2devops.v2_dev_read = obp_devread;
|
1450 | 9e61bde5 | bellard | + romvec0.pv_v2devops.v2_dev_write = obp_devwrite;
|
1451 | 9e61bde5 | bellard | + romvec0.pv_v2devops.v2_dev_seek = obp_devseek;
|
1452 | 6d82d04a | bellard | + obp_arg.boot_dev_ctrl = 0;
|
1453 | 6d82d04a | bellard | + obp_arg.boot_dev_unit = '0';
|
1454 | 9e61bde5 | bellard | + obp_arg.argv[0] = "sd(0,0,0):d";
|
1455 | 6f7e9aec | bellard | + switch(boot_device) {
|
1456 | 6f7e9aec | bellard | + default:
|
1457 | 6f7e9aec | bellard | + case 'a':
|
1458 | 6f7e9aec | bellard | + obp_arg.argv[0] = "fd()";
|
1459 | 6d82d04a | bellard | + obp_arg.boot_dev[0] = 'f';
|
1460 | 6d82d04a | bellard | + obp_arg.boot_dev[1] = 'd';
|
1461 | 6f7e9aec | bellard | + break;
|
1462 | 6d82d04a | bellard | + case 'd':
|
1463 | 6d82d04a | bellard | + obp_arg.boot_dev_unit = '2';
|
1464 | 9e61bde5 | bellard | + obp_arg.argv[0] = "sd(0,2,0):d";
|
1465 | 6d82d04a | bellard | + // Fall through
|
1466 | 6f7e9aec | bellard | + case 'c':
|
1467 | 6d82d04a | bellard | + obp_arg.boot_dev[0] = 's';
|
1468 | 6d82d04a | bellard | + obp_arg.boot_dev[1] = 'd';
|
1469 | 6f7e9aec | bellard | + break;
|
1470 | 6f7e9aec | bellard | + case 'n':
|
1471 | 6f7e9aec | bellard | + obp_arg.argv[0] = "le()";
|
1472 | 6d82d04a | bellard | + obp_arg.boot_dev[0] = 'l';
|
1473 | 6d82d04a | bellard | + obp_arg.boot_dev[1] = 'e';
|
1474 | 6f7e9aec | bellard | + break;
|
1475 | 6f7e9aec | bellard | + }
|
1476 | 6f7e9aec | bellard | + obp_arg.argv[1] = cmdline;
|
1477 | 9e61bde5 | bellard | + romvec0.pv_v2bootargs.bootpath = &obp_arg.argv[0];
|
1478 | 9e61bde5 | bellard | + romvec0.pv_v2bootargs.bootargs = &cmdline;
|
1479 | 9e61bde5 | bellard | + romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;
|
1480 | 9e61bde5 | bellard | + romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout;
|
1481 | 9e61bde5 | bellard | +
|
1482 | 9e61bde5 | bellard | + bcopy(propv_root_templ, propv_root, sizeof(propv_root_templ));
|
1483 | 9e61bde5 | bellard | + propv_root[4].name = "stdin-path";
|
1484 | 9e61bde5 | bellard | + propv_root[5].name = "stdout-path";
|
1485 | 9e61bde5 | bellard | + obp_fd_stdin = 0;
|
1486 | 9e61bde5 | bellard | + obp_fd_stdout = 1;
|
1487 | 9e61bde5 | bellard | + fd_table[0].pread = con_pread;
|
1488 | 9e61bde5 | bellard | + fd_table[0].pwrite = con_pwrite;
|
1489 | 9e61bde5 | bellard | + fd_table[1].pread = con_pread;
|
1490 | 9e61bde5 | bellard | + fd_table[1].pwrite = con_pwrite;
|
1491 | 9e61bde5 | bellard | + fd_index = 2;
|
1492 | 6f7e9aec | bellard | + if (nographic) {
|
1493 | 6f7e9aec | bellard | + obp_stdin = PROMDEV_TTYA;
|
1494 | 9e61bde5 | bellard | + propv_root[4].value = "/obio/zs@0,100000:a";
|
1495 | 9e61bde5 | bellard | + propv_root[4].length = sizeof("/obio/zs@0,100000:a");
|
1496 | 9e61bde5 | bellard | + fd_table[0].unit = 18;
|
1497 | 6f7e9aec | bellard | + obp_stdout = PROMDEV_TTYA;
|
1498 | 9e61bde5 | bellard | + propv_root[5].value = "/obio/zs@0,100000:a";
|
1499 | 9e61bde5 | bellard | + propv_root[5].length = sizeof("/obio/zs@0,100000:a");
|
1500 | 9e61bde5 | bellard | + fd_table[1].unit = 18;
|
1501 | 6f7e9aec | bellard | + } else {
|
1502 | 6f7e9aec | bellard | + obp_stdin = PROMDEV_KBD;
|
1503 | 9e61bde5 | bellard | + propv_root[4].value = "/obio/zs@0,0";
|
1504 | 9e61bde5 | bellard | + propv_root[4].length = sizeof("/obio/zs@0,0");
|
1505 | 9e61bde5 | bellard | + fd_table[0].unit = 19;
|
1506 | 6f7e9aec | bellard | + obp_stdout = PROMDEV_SCREEN;
|
1507 | 9e61bde5 | bellard | + propv_root[5].value = "/iommu/sbus/SUNW,tcx";
|
1508 | 9e61bde5 | bellard | + propv_root[5].length = sizeof("/iommu/sbus/SUNW,tcx");
|
1509 | 9e61bde5 | bellard | + fd_table[1].unit = 4;
|
1510 | 6f7e9aec | bellard | + }
|
1511 | c44644bb | bellard | + prop_zs_addr = map_io(0x71000000, 8);
|
1512 | c44644bb | bellard | + prop_zs1_addr = map_io(0x71100000, 8);
|
1513 | 6f7e9aec | bellard | + return &romvec0;
|
1514 | 6f7e9aec | bellard | +}
|
1515 | 6f7e9aec | bellard | +
|
1516 | 6f7e9aec | bellard | +static const struct property *find_property(int node,char *name)
|
1517 | 6f7e9aec | bellard | +{
|
1518 | 6f7e9aec | bellard | + const struct property *prop = &nodes[node].properties[0];
|
1519 | 6f7e9aec | bellard | + while (prop && prop->name) {
|
1520 | 6f7e9aec | bellard | + if (bcmp(prop->name, name, 128) == 0) return prop;
|
1521 | 6f7e9aec | bellard | + prop++;
|
1522 | 6f7e9aec | bellard | + }
|
1523 | 6f7e9aec | bellard | + return NULL;
|
1524 | 6f7e9aec | bellard | +}
|
1525 | 6f7e9aec | bellard | +
|
1526 | 6f7e9aec | bellard | +static int obp_nextnode(int node)
|
1527 | 6f7e9aec | bellard | +{
|
1528 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1529 | 6f7e9aec | bellard | + printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling);
|
1530 | 6f7e9aec | bellard | +#endif
|
1531 | 6f7e9aec | bellard | + return nodes[node].sibling;
|
1532 | 6f7e9aec | bellard | +}
|
1533 | 6f7e9aec | bellard | +
|
1534 | 6f7e9aec | bellard | +static int obp_child(int node)
|
1535 | 6f7e9aec | bellard | +{
|
1536 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1537 | 6f7e9aec | bellard | + printk("obp_child(%d) = %d\n", node, nodes[node].child);
|
1538 | 6f7e9aec | bellard | +#endif
|
1539 | 6f7e9aec | bellard | + return nodes[node].child;
|
1540 | 6f7e9aec | bellard | +}
|
1541 | 6f7e9aec | bellard | +
|
1542 | 6f7e9aec | bellard | +static int obp_proplen(int node, char *name)
|
1543 | 6f7e9aec | bellard | +{
|
1544 | 6f7e9aec | bellard | + const struct property *prop = find_property(node,name);
|
1545 | 6f7e9aec | bellard | + if (prop) {
|
1546 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1547 | 6f7e9aec | bellard | + printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length);
|
1548 | 6f7e9aec | bellard | +#endif
|
1549 | 6f7e9aec | bellard | + return prop->length;
|
1550 | 6f7e9aec | bellard | + }
|
1551 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1552 | 6f7e9aec | bellard | + printk("obp_proplen(%d, %s) (no prop)\n", node, name);
|
1553 | 6f7e9aec | bellard | +#endif
|
1554 | 6f7e9aec | bellard | + return -1;
|
1555 | 6f7e9aec | bellard | +}
|
1556 | 6f7e9aec | bellard | +
|
1557 | 6f7e9aec | bellard | +static int obp_getprop(int node, char *name, char *value)
|
1558 | 6f7e9aec | bellard | +{
|
1559 | 6f7e9aec | bellard | + const struct property *prop;
|
1560 | 6f7e9aec | bellard | +
|
1561 | c44644bb | bellard | + if (!name) {
|
1562 | c44644bb | bellard | + // NULL name means get first property
|
1563 | c44644bb | bellard | +#ifdef DEBUG_OBP
|
1564 | c44644bb | bellard | + printk("obp_getprop(%d, %x (NULL)) = %s\n", node, name,
|
1565 | c44644bb | bellard | + nodes[node].properties[0].name);
|
1566 | c44644bb | bellard | +#endif
|
1567 | c44644bb | bellard | + return (int)nodes[node].properties[0].name;
|
1568 | c44644bb | bellard | + }
|
1569 | 6f7e9aec | bellard | + prop = find_property(node,name);
|
1570 | 6f7e9aec | bellard | + if (prop) {
|
1571 | 6f7e9aec | bellard | + memcpy(value,prop->value,prop->length);
|
1572 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1573 | 6f7e9aec | bellard | + printk("obp_getprop(%d, %s) = %s\n", node, name, value);
|
1574 | 6f7e9aec | bellard | +#endif
|
1575 | 6f7e9aec | bellard | + return prop->length;
|
1576 | 6f7e9aec | bellard | + }
|
1577 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1578 | 6f7e9aec | bellard | + printk("obp_getprop(%d, %s): not found\n", node, name);
|
1579 | 6f7e9aec | bellard | +#endif
|
1580 | 6f7e9aec | bellard | + return -1;
|
1581 | 6f7e9aec | bellard | +}
|
1582 | 6f7e9aec | bellard | +
|
1583 | 9e61bde5 | bellard | +static int obp_setprop(__attribute__((unused)) int node,
|
1584 | 9e61bde5 | bellard | + __attribute__((unused)) char *name,
|
1585 | 9e61bde5 | bellard | + __attribute__((unused)) char *value,
|
1586 | 9e61bde5 | bellard | + __attribute__((unused)) int len)
|
1587 | 6f7e9aec | bellard | +{
|
1588 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1589 | 6f7e9aec | bellard | + printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len);
|
1590 | 6f7e9aec | bellard | +#endif
|
1591 | 6f7e9aec | bellard | + return -1;
|
1592 | 6f7e9aec | bellard | +}
|
1593 | 6f7e9aec | bellard | +
|
1594 | 6f7e9aec | bellard | +static const char *obp_nextprop(int node,char *name)
|
1595 | 6f7e9aec | bellard | +{
|
1596 | c44644bb | bellard | + const struct property *prop;
|
1597 | c44644bb | bellard | +
|
1598 | c44644bb | bellard | + if (!name || *name == '\0') {
|
1599 | c44644bb | bellard | + // NULL name means get first property
|
1600 | c44644bb | bellard | +#ifdef DEBUG_OBP
|
1601 | c44644bb | bellard | + printk("obp_nextprop(%d, NULL) = %s\n", node,
|
1602 | c44644bb | bellard | + nodes[node].properties[0].name);
|
1603 | c44644bb | bellard | +#endif
|
1604 | c44644bb | bellard | + return nodes[node].properties[0].name;
|
1605 | c44644bb | bellard | + }
|
1606 | c44644bb | bellard | + prop = find_property(node,name);
|
1607 | c44644bb | bellard | + if (prop && prop[1].name) {
|
1608 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1609 | 6f7e9aec | bellard | + printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name);
|
1610 | 6f7e9aec | bellard | +#endif
|
1611 | 6f7e9aec | bellard | + return prop[1].name;
|
1612 | 6f7e9aec | bellard | + }
|
1613 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1614 | 6f7e9aec | bellard | + printk("obp_nextprop(%d, %s): not found\n", node, name);
|
1615 | 6f7e9aec | bellard | +#endif
|
1616 | 9e61bde5 | bellard | + return "";
|
1617 | 6f7e9aec | bellard | +}
|
1618 | 6f7e9aec | bellard | +
|
1619 | 6d82d04a | bellard | +extern int (*getch_fn)(struct vconterm *v);
|
1620 | 6d82d04a | bellard | +
|
1621 | 6f7e9aec | bellard | +static int obp_nbgetchar(void) {
|
1622 | 6f7e9aec | bellard | + extern struct vconterm dp0;
|
1623 | 6d82d04a | bellard | + return getch_fn(&dp0);
|
1624 | 6f7e9aec | bellard | +}
|
1625 | 6f7e9aec | bellard | +
|
1626 | 6f7e9aec | bellard | +static int obp_nbputchar(int ch) {
|
1627 | 6f7e9aec | bellard | + printk("%c", ch);
|
1628 | 6f7e9aec | bellard | + return 0;
|
1629 | 6f7e9aec | bellard | +}
|
1630 | 6f7e9aec | bellard | +
|
1631 | 6f7e9aec | bellard | +static void obp_reboot(char *str) {
|
1632 | 9e61bde5 | bellard | + printk("rebooting (%s)\n", str);
|
1633 | 9e61bde5 | bellard | + stb_bypass(0x71f00000, 1);
|
1634 | 6f7e9aec | bellard | + for (;;) {}
|
1635 | 6f7e9aec | bellard | +}
|
1636 | 6f7e9aec | bellard | +
|
1637 | 6f7e9aec | bellard | +static void obp_abort() {
|
1638 | 9e61bde5 | bellard | + printk("abort, power off\n");
|
1639 | 9e61bde5 | bellard | + stb_bypass(0x71910000, 1);
|
1640 | 6f7e9aec | bellard | + for (;;) {}
|
1641 | 6f7e9aec | bellard | +}
|
1642 | 6f7e9aec | bellard | +
|
1643 | 6f7e9aec | bellard | +static void obp_halt() {
|
1644 | 9e61bde5 | bellard | + printk("halt, power off\n");
|
1645 | 9e61bde5 | bellard | + stb_bypass(0x71910000, 1);
|
1646 | 6f7e9aec | bellard | + for (;;) {}
|
1647 | 6f7e9aec | bellard | +}
|
1648 | 9e61bde5 | bellard | +
|
1649 | 9e61bde5 | bellard | +extern void *esp_read(int unit, int part, int offset, short len);
|
1650 | 9e61bde5 | bellard | +
|
1651 | 9e61bde5 | bellard | +static int esp_pread(int dev_desc, int offset, char *buf, unsigned int nbytes)
|
1652 | 9e61bde5 | bellard | +{
|
1653 | 9e61bde5 | bellard | + unsigned int i;
|
1654 | 9e61bde5 | bellard | + void *src;
|
1655 | 9e61bde5 | bellard | +
|
1656 | 9e61bde5 | bellard | + for(i = 0; i < nbytes; i += 512) {
|
1657 | 9e61bde5 | bellard | + src = esp_read(fd_table[dev_desc].unit, fd_table[dev_desc].part, (offset + i) / 512, 512);
|
1658 | 9e61bde5 | bellard | + memcpy(&buf[i], src, 512);
|
1659 | 9e61bde5 | bellard | + }
|
1660 | 9e61bde5 | bellard | + return nbytes;
|
1661 | 9e61bde5 | bellard | +}
|
1662 | 9e61bde5 | bellard | +
|
1663 | 9e61bde5 | bellard | +static int con_pread(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes)
|
1664 | 9e61bde5 | bellard | +{
|
1665 | 9e61bde5 | bellard | + unsigned int i;
|
1666 | 9e61bde5 | bellard | +
|
1667 | 9e61bde5 | bellard | + for(i = 0; i < nbytes; i ++) {
|
1668 | 9e61bde5 | bellard | + buf[i] = obp_nbgetchar();
|
1669 | 9e61bde5 | bellard | + }
|
1670 | 9e61bde5 | bellard | + return nbytes;
|
1671 | 9e61bde5 | bellard | +}
|
1672 | 9e61bde5 | bellard | +
|
1673 | 9e61bde5 | bellard | +static int con_pwrite(__attribute__((unused)) int dev_desc, __attribute__((unused)) int offset, char *buf, unsigned int nbytes)
|
1674 | 9e61bde5 | bellard | +{
|
1675 | 9e61bde5 | bellard | + unsigned int i;
|
1676 | 9e61bde5 | bellard | +
|
1677 | 9e61bde5 | bellard | + for(i = 0; i < nbytes; i ++) {
|
1678 | 9e61bde5 | bellard | + obp_nbputchar(buf[i]);
|
1679 | 9e61bde5 | bellard | + }
|
1680 | 9e61bde5 | bellard | + return nbytes;
|
1681 | 9e61bde5 | bellard | +}
|
1682 | 9e61bde5 | bellard | +
|
1683 | 6d82d04a | bellard | +#define isnum(c) ((c >= '0') && (c < '9'))
|
1684 | 6d82d04a | bellard | +#define ctoi(c) (c - '0')
|
1685 | 9e61bde5 | bellard | +
|
1686 | 6f7e9aec | bellard | +static int obp_devopen(char *str) {
|
1687 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1688 | 6d82d04a | bellard | + printk("obp_devopen(%s)\n", str);
|
1689 | 6f7e9aec | bellard | +#endif
|
1690 | 6d82d04a | bellard | + if (str[0] == 's' && str[1] == 'd' && str[4] == ',') {
|
1691 | 6d82d04a | bellard | + unsigned int target;
|
1692 | 6d82d04a | bellard | +
|
1693 | 6d82d04a | bellard | + if (str[5] < 7)
|
1694 | 6d82d04a | bellard | + target = str[5];
|
1695 | 6d82d04a | bellard | + else if (isnum(str[6]) && isnum(str[5])) {
|
1696 | 6d82d04a | bellard | + target = (ctoi(str[5]) * 10 + ctoi(str[6])) & 7;
|
1697 | 6d82d04a | bellard | + }
|
1698 | 6d82d04a | bellard | + else {
|
1699 | 6d82d04a | bellard | + target = ctoi(str[5]) & 7;
|
1700 | 6d82d04a | bellard | + }
|
1701 | 9e61bde5 | bellard | + fd_table[fd_index].unit = target;
|
1702 | 9e61bde5 | bellard | + fd_table[fd_index].part = str[10] - 'a';
|
1703 | 9e61bde5 | bellard | + fd_table[fd_index].pread = esp_pread;
|
1704 | 9e61bde5 | bellard | + return fd_index++; // XXX
|
1705 | 6d82d04a | bellard | + }
|
1706 | 6f7e9aec | bellard | + return 0;
|
1707 | 6f7e9aec | bellard | +}
|
1708 | 6f7e9aec | bellard | +
|
1709 | 9e61bde5 | bellard | +static int obp_devclose(__attribute__((unused)) int dev_desc) {
|
1710 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1711 | 6d82d04a | bellard | + printk("obp_devclose %d\n", dev_desc);
|
1712 | 6f7e9aec | bellard | +#endif
|
1713 | 9e61bde5 | bellard | + fd_index--; // XXX
|
1714 | 6f7e9aec | bellard | + return 0;
|
1715 | 6f7e9aec | bellard | +}
|
1716 | 6f7e9aec | bellard | +
|
1717 | 6d82d04a | bellard | +static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf)
|
1718 | 6d82d04a | bellard | +{
|
1719 | 6f7e9aec | bellard | +#ifdef DEBUG_OBP
|
1720 | 6d82d04a | bellard | + printk("obp_rdblkdev: fd %d, num_blks %d, offset %d, buf 0x%x\n", dev_desc, num_blks, offset, buf);
|
1721 | 6f7e9aec | bellard | +#endif
|
1722 | 9e61bde5 | bellard | + return fd_table[dev_desc].pread(dev_desc, offset, buf, num_blks * 512);
|
1723 | 6f7e9aec | bellard | +}
|
1724 | 6d82d04a | bellard | +
|
1725 | 9e61bde5 | bellard | +static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io,
|
1726 | 9e61bde5 | bellard | + unsigned int pa, unsigned int size)
|
1727 | 6d82d04a | bellard | +{
|
1728 | 6d82d04a | bellard | + unsigned int npages;
|
1729 | 6d82d04a | bellard | + unsigned int off;
|
1730 | 6d82d04a | bellard | + unsigned int mva;
|
1731 | 6d82d04a | bellard | +
|
1732 | 6d82d04a | bellard | +#ifdef DEBUG_OBP
|
1733 | 6d82d04a | bellard | + printk("obp_dumb_mmap: virta %x, which_io %d, paddr %x, sz %d\n", va, which_io, pa, size);
|
1734 | 6d82d04a | bellard | +#endif
|
1735 | 6d82d04a | bellard | + off = pa & (PAGE_SIZE-1);
|
1736 | 6d82d04a | bellard | + npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
|
1737 | 6d82d04a | bellard | + pa &= ~(PAGE_SIZE-1);
|
1738 | 6d82d04a | bellard | +
|
1739 | 6d82d04a | bellard | + mva = (unsigned int) va;
|
1740 | 6d82d04a | bellard | + while (npages-- != 0) {
|
1741 | 6d82d04a | bellard | + map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
|
1742 | 6d82d04a | bellard | + mva += PAGE_SIZE;
|
1743 | 6d82d04a | bellard | + pa += PAGE_SIZE;
|
1744 | 6d82d04a | bellard | + }
|
1745 | 6d82d04a | bellard | + return va;
|
1746 | 6d82d04a | bellard | +}
|
1747 | 6d82d04a | bellard | +
|
1748 | 9e61bde5 | bellard | +static void obp_dumb_munmap(__attribute__((unused)) char *va,
|
1749 | 9e61bde5 | bellard | + __attribute__((unused)) unsigned int size)
|
1750 | 6d82d04a | bellard | +{
|
1751 | 6d82d04a | bellard | +#ifdef DEBUG_OBP
|
1752 | 6d82d04a | bellard | + printk("obp_dumb_munmap: virta %x, sz %d\n", va, size);
|
1753 | 6d82d04a | bellard | +#endif
|
1754 | 6d82d04a | bellard | +}
|
1755 | 9e61bde5 | bellard | +
|
1756 | 9e61bde5 | bellard | +static int obp_devread(int dev_desc, char *buf, int nbytes)
|
1757 | 9e61bde5 | bellard | +{
|
1758 | 9e61bde5 | bellard | + int ret;
|
1759 | 9e61bde5 | bellard | +#ifdef DEBUG_OBP
|
1760 | 9e61bde5 | bellard | + printk("obp_devread: fd %d, nbytes %d\n", dev_desc, nbytes);
|
1761 | 9e61bde5 | bellard | +#endif
|
1762 | 9e61bde5 | bellard | + ret = fd_table[dev_desc].pread(dev_desc, fd_table[dev_desc].offset, buf, nbytes);
|
1763 | 9e61bde5 | bellard | + fd_table[dev_desc].offset += nbytes;
|
1764 | 9e61bde5 | bellard | + return ret;
|
1765 | 9e61bde5 | bellard | +}
|
1766 | 9e61bde5 | bellard | +
|
1767 | 9e61bde5 | bellard | +static int obp_devwrite(int dev_desc, char *buf, int nbytes)
|
1768 | 9e61bde5 | bellard | +{
|
1769 | 9e61bde5 | bellard | + int ret;
|
1770 | 9e61bde5 | bellard | +#ifdef DEBUG_OBP
|
1771 | 9e61bde5 | bellard | + printk("obp_devwrite: fd %d, buf %s, nbytes %d\n", dev_desc, buf, nbytes);
|
1772 | 9e61bde5 | bellard | +#endif
|
1773 | 9e61bde5 | bellard | + ret = fd_table[dev_desc].pwrite(dev_desc, fd_table[dev_desc].offset, buf, nbytes);
|
1774 | 9e61bde5 | bellard | + fd_table[dev_desc].offset += nbytes;
|
1775 | 9e61bde5 | bellard | + return ret;
|
1776 | 9e61bde5 | bellard | +}
|
1777 | 9e61bde5 | bellard | +
|
1778 | 9e61bde5 | bellard | +static int obp_devseek(int dev_desc, __attribute__((unused)) int hi, int lo)
|
1779 | 9e61bde5 | bellard | +{
|
1780 | 9e61bde5 | bellard | +#ifdef DEBUG_OBP
|
1781 | 9e61bde5 | bellard | + printk("obp_devseek: fd %d, hi %d, lo %d\n", dev_desc, hi, lo);
|
1782 | 9e61bde5 | bellard | +#endif
|
1783 | 9e61bde5 | bellard | + fd_table[dev_desc].offset = lo;
|
1784 | 9e61bde5 | bellard | + return 0;
|
1785 | 9e61bde5 | bellard | +}
|
1786 | 9e61bde5 | bellard | +
|
1787 | 9e61bde5 | bellard | +static int obp_inst2pkg(int dev_desc)
|
1788 | 9e61bde5 | bellard | +{
|
1789 | 9e61bde5 | bellard | +#ifdef DEBUG_OBP
|
1790 | 9e61bde5 | bellard | + printk("obp_inst2pkg: fd %d\n", dev_desc);
|
1791 | 9e61bde5 | bellard | +#endif
|
1792 | 9e61bde5 | bellard | + return fd_table[dev_desc].unit;
|
1793 | 9e61bde5 | bellard | +}
|
1794 | 9e61bde5 | bellard | diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch-15/qemu/system_qemu.c
|
1795 | 6f7e9aec | bellard | --- proll_18.orig/qemu/system_qemu.c 1970-01-01 00:00:00.000000000 +0000
|
1796 | 9e61bde5 | bellard | +++ proll-patch-15/qemu/system_qemu.c 2005-04-16 06:16:20.000000000 +0000
|
1797 | 6d82d04a | bellard | @@ -0,0 +1,430 @@
|
1798 | 6f7e9aec | bellard | +/**
|
1799 | 6f7e9aec | bellard | + ** Proll (PROM replacement)
|
1800 | 6f7e9aec | bellard | + ** system.c: shared miscallenea.
|
1801 | 6f7e9aec | bellard | + ** Copyright 1999 Pete Zaitcev
|
1802 | 6f7e9aec | bellard | + ** This code is licensed under GNU General Public License.
|
1803 | 6f7e9aec | bellard | + **/
|
1804 | 6f7e9aec | bellard | +#include <stdarg.h>
|
1805 | 6f7e9aec | bellard | +#include <asi.h>
|
1806 | 6f7e9aec | bellard | +#include <crs.h>
|
1807 | 6f7e9aec | bellard | +#ifndef NULL
|
1808 | 6f7e9aec | bellard | +#define NULL ((void*)0)
|
1809 | 6f7e9aec | bellard | +#endif
|
1810 | 6f7e9aec | bellard | +
|
1811 | 6f7e9aec | bellard | +#include "pgtsrmmu.h"
|
1812 | 6f7e9aec | bellard | +
|
1813 | 6f7e9aec | bellard | +#include "vconsole.h"
|
1814 | 6f7e9aec | bellard | +#include <timer.h> /* Local copy of 2.2 style include */
|
1815 | 6f7e9aec | bellard | +#include <general.h> /* __P() */
|
1816 | 6f7e9aec | bellard | +#include <net.h> /* init_net() */
|
1817 | 6f7e9aec | bellard | +#include <romlib.h> /* we are a provider for part of this. */
|
1818 | 6f7e9aec | bellard | +#include <netpriv.h> /* myipaddr */
|
1819 | 6f7e9aec | bellard | +#include <arpa.h>
|
1820 | 6f7e9aec | bellard | +#include <system.h> /* our own prototypes */
|
1821 | 6f7e9aec | bellard | +
|
1822 | 6f7e9aec | bellard | +/*
|
1823 | 6f7e9aec | bellard | + * We export this.
|
1824 | 6f7e9aec | bellard | + */
|
1825 | 6f7e9aec | bellard | +char idprom[IDPROM_SIZE];
|
1826 | 6f7e9aec | bellard | +
|
1827 | 6f7e9aec | bellard | +
|
1828 | 6f7e9aec | bellard | +/*
|
1829 | 6f7e9aec | bellard | + * Create an I/O mapping to pa[size].
|
1830 | 6f7e9aec | bellard | + * Returns va of the mapping or 0 if unsuccessful.
|
1831 | 6f7e9aec | bellard | + */
|
1832 | 6f7e9aec | bellard | +void *
|
1833 | 6f7e9aec | bellard | +map_io(unsigned pa, int size)
|
1834 | 6f7e9aec | bellard | +{
|
1835 | 6f7e9aec | bellard | + void *va;
|
1836 | 6f7e9aec | bellard | + unsigned int npages;
|
1837 | 6f7e9aec | bellard | + unsigned int off;
|
1838 | 6f7e9aec | bellard | + unsigned int mva;
|
1839 | 6f7e9aec | bellard | +
|
1840 | 6f7e9aec | bellard | + off = pa & (PAGE_SIZE-1);
|
1841 | 6f7e9aec | bellard | + npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
|
1842 | 6f7e9aec | bellard | + pa &= ~(PAGE_SIZE-1);
|
1843 | 6f7e9aec | bellard | +
|
1844 | 6f7e9aec | bellard | + va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE);
|
1845 | 6f7e9aec | bellard | + if (va == 0) return va;
|
1846 | 6f7e9aec | bellard | +
|
1847 | 6f7e9aec | bellard | + mva = (unsigned int) va;
|
1848 | 6f7e9aec | bellard | + /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */
|
1849 | 6f7e9aec | bellard | + while (npages-- != 0) {
|
1850 | 6f7e9aec | bellard | + map_page(pmem.pl1, mva, pa, 1, pmem.pbas);
|
1851 | 6f7e9aec | bellard | + mva += PAGE_SIZE;
|
1852 | 6f7e9aec | bellard | + pa += PAGE_SIZE;
|
1853 | 6f7e9aec | bellard | + }
|
1854 | 6f7e9aec | bellard | +
|
1855 | 6f7e9aec | bellard | + return (void *)((unsigned int)va + off);
|
1856 | 6f7e9aec | bellard | +}
|
1857 | 6f7e9aec | bellard | +
|
1858 | 6f7e9aec | bellard | +/*
|
1859 | 6f7e9aec | bellard | + * Tablewalk routine used for testing.
|
1860 | 6f7e9aec | bellard | + * Returns PTP/PTE.
|
1861 | 6f7e9aec | bellard | + */
|
1862 | 6f7e9aec | bellard | +unsigned int
|
1863 | 6f7e9aec | bellard | +proc_tablewalk(int ctx, unsigned int va)
|
1864 | 6f7e9aec | bellard | +{
|
1865 | 6f7e9aec | bellard | + unsigned int pa1;
|
1866 | 6f7e9aec | bellard | +
|
1867 | 6f7e9aec | bellard | + __asm__ __volatile__ ("lda [%1] %2, %0" :
|
1868 | 6f7e9aec | bellard | + "=r" (pa1) :
|
1869 | 6f7e9aec | bellard | + "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
|
1870 | 6f7e9aec | bellard | + /* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */
|
1871 | 6f7e9aec | bellard | + pa1 <<= 4;
|
1872 | 6f7e9aec | bellard | + pa1 = ld_bypass(pa1 + (ctx << 2));
|
1873 | 6f7e9aec | bellard | + if ((pa1 & 0x03) == 0) goto invalid;
|
1874 | 6f7e9aec | bellard | + return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va);
|
1875 | 6f7e9aec | bellard | +
|
1876 | 6f7e9aec | bellard | +invalid:
|
1877 | 6f7e9aec | bellard | + printk(" invalid %x\n", pa1);
|
1878 | 6f7e9aec | bellard | + return 0;
|
1879 | 6f7e9aec | bellard | +}
|
1880 | 6f7e9aec | bellard | +
|
1881 | 6f7e9aec | bellard | +/*
|
1882 | 6f7e9aec | bellard | + * Walk the tables in memory, starting at physical address pa.
|
1883 | 6f7e9aec | bellard | + */
|
1884 | 6f7e9aec | bellard | +unsigned int
|
1885 | 6f7e9aec | bellard | +mem_tablewalk(unsigned int pa, unsigned int va)
|
1886 | 6f7e9aec | bellard | +{
|
1887 | 6f7e9aec | bellard | + unsigned int pa1;
|
1888 | 6f7e9aec | bellard | +
|
1889 | 6f7e9aec | bellard | + printk("pa %x va %x", pa, va);
|
1890 | 6f7e9aec | bellard | + pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2));
|
1891 | 6f7e9aec | bellard | + if ((pa1 & 0x03) == 0) goto invalid;
|
1892 | 6f7e9aec | bellard | + printk(" l1 %x", pa1);
|
1893 | 6f7e9aec | bellard | + pa1 <<= 4; pa1 &= 0xFFFFFF00;
|
1894 | 6f7e9aec | bellard | + pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2));
|
1895 | 6f7e9aec | bellard | + if ((pa1 & 0x03) == 0) goto invalid;
|
1896 | 6f7e9aec | bellard | + printk(" l2 %x", pa1);
|
1897 | 6f7e9aec | bellard | + pa1 <<= 4; pa1 &= 0xFFFFFF00;
|
1898 | 6f7e9aec | bellard | + pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2));
|
1899 | 6f7e9aec | bellard | + if ((pa1 & 0x03) == 0) goto invalid;
|
1900 | 6f7e9aec | bellard | + printk(" l3 %x", pa1);
|
1901 | 6f7e9aec | bellard | + printk(" off %x\n", va&0x00000FFF);
|
1902 | 6f7e9aec | bellard | + return pa1;
|
1903 | 6f7e9aec | bellard | +invalid:
|
1904 | 6f7e9aec | bellard | + printk(" invalid %x\n", pa1);
|
1905 | 6f7e9aec | bellard | + return 0;
|
1906 | 6f7e9aec | bellard | +}
|
1907 | 6f7e9aec | bellard | +
|
1908 | 6f7e9aec | bellard | +/*
|
1909 | 6f7e9aec | bellard | + * Make CPU page tables.
|
1910 | 6f7e9aec | bellard | + * Returns pointer to context table.
|
1911 | 6f7e9aec | bellard | + * Here we ignore memory allocation errors which "should not happen"
|
1912 | 6f7e9aec | bellard | + * because we cannot print anything anyways if memory initialization fails.
|
1913 | 6f7e9aec | bellard | + */
|
1914 | 6f7e9aec | bellard | +void makepages(struct phym *t, unsigned int highbase)
|
1915 | 6f7e9aec | bellard | +{
|
1916 | 6f7e9aec | bellard | + unsigned int *ctp, *l1, pte;
|
1917 | 6f7e9aec | bellard | + int i;
|
1918 | 6f7e9aec | bellard | + unsigned int pa, va;
|
1919 | 6f7e9aec | bellard | +
|
1920 | 6f7e9aec | bellard | + ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int));
|
1921 | 6f7e9aec | bellard | + l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int));
|
1922 | 6f7e9aec | bellard | +
|
1923 | 6f7e9aec | bellard | + pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4);
|
1924 | 6f7e9aec | bellard | + for (i = 0; i < NCTX_SWIFT; i++) {
|
1925 | 6f7e9aec | bellard | + ctp[i] = pte;
|
1926 | 6f7e9aec | bellard | + }
|
1927 | 6f7e9aec | bellard | +
|
1928 | 6f7e9aec | bellard | + pa = PROLBASE;
|
1929 | 6f7e9aec | bellard | + for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) {
|
1930 | 6f7e9aec | bellard | + map_page(l1, va, pa, 0, highbase);
|
1931 | 6f7e9aec | bellard | + pa += PAGE_SIZE;
|
1932 | 6f7e9aec | bellard | + }
|
1933 | 6f7e9aec | bellard | + pa = highbase + PROLDATA - PROLBASE;
|
1934 | 6f7e9aec | bellard | + for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) {
|
1935 | 6f7e9aec | bellard | + map_page(l1, va, pa, 0, highbase);
|
1936 | 6f7e9aec | bellard | + pa += PAGE_SIZE;
|
1937 | 6f7e9aec | bellard | + }
|
1938 | 6f7e9aec | bellard | +
|
1939 | 6f7e9aec | bellard | + /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
|
1940 | 6f7e9aec | bellard | + pa = 0;
|
1941 | 6f7e9aec | bellard | + for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
|
1942 | 6f7e9aec | bellard | + map_page(l1, va, pa, 0, highbase);
|
1943 | 6f7e9aec | bellard | + pa += PAGE_SIZE;
|
1944 | 6f7e9aec | bellard | + }
|
1945 | e80cfcfc | bellard | +
|
1946 | 6f7e9aec | bellard | + t->pctp = ctp;
|
1947 | 6f7e9aec | bellard | + t->pl1 = l1;
|
1948 | 6f7e9aec | bellard | + t->pbas = highbase;
|
1949 | 6f7e9aec | bellard | +}
|
1950 | e80cfcfc | bellard | +
|
1951 | 6f7e9aec | bellard | +/*
|
1952 | 6f7e9aec | bellard | + * Create a memory mapping from va to epa in page table pgd.
|
1953 | 6f7e9aec | bellard | + * highbase is used for v2p translation.
|
1954 | 6f7e9aec | bellard | + */
|
1955 | 6f7e9aec | bellard | +int
|
1956 | 6f7e9aec | bellard | +map_page(unsigned int *pgd, unsigned int va,
|
1957 | 6f7e9aec | bellard | + unsigned int epa, int type, unsigned int highbase)
|
1958 | e80cfcfc | bellard | +{
|
1959 | 6f7e9aec | bellard | + unsigned int pte;
|
1960 | 6f7e9aec | bellard | + unsigned int *p;
|
1961 | 6f7e9aec | bellard | + unsigned int pa;
|
1962 | 6f7e9aec | bellard | +
|
1963 | 6f7e9aec | bellard | + pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)];
|
1964 | 6f7e9aec | bellard | + if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
|
1965 | 6f7e9aec | bellard | + p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int),
|
1966 | 6f7e9aec | bellard | + SRMMU_PTRS_PER_PMD*sizeof(int));
|
1967 | 6f7e9aec | bellard | + if (p == 0) goto drop;
|
1968 | 6f7e9aec | bellard | + pte = SRMMU_ET_PTD |
|
1969 | 6f7e9aec | bellard | + (((unsigned int)p - PROLBASE + highbase) >> 4);
|
1970 | 6f7e9aec | bellard | + pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte;
|
1971 | 6f7e9aec | bellard | + /* barrier() */
|
1972 | 6f7e9aec | bellard | + }
|
1973 | e80cfcfc | bellard | +
|
1974 | 6f7e9aec | bellard | + pa = ((pte & 0xFFFFFFF0) << 4);
|
1975 | 6f7e9aec | bellard | + pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2);
|
1976 | 6f7e9aec | bellard | + pte = ld_bypass(pa);
|
1977 | 6f7e9aec | bellard | + if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
|
1978 | 6f7e9aec | bellard | + p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int),
|
1979 | 6f7e9aec | bellard | + SRMMU_PTRS_PER_PTE*sizeof(int));
|
1980 | 6f7e9aec | bellard | + if (p == 0) goto drop;
|
1981 | 6f7e9aec | bellard | + pte = SRMMU_ET_PTD |
|
1982 | 6f7e9aec | bellard | + (((unsigned int)p - PROLBASE + highbase) >> 4);
|
1983 | 6f7e9aec | bellard | + st_bypass(pa, pte);
|
1984 | 6f7e9aec | bellard | + }
|
1985 | e80cfcfc | bellard | +
|
1986 | 6f7e9aec | bellard | + pa = ((pte & 0xFFFFFFF0) << 4);
|
1987 | 6f7e9aec | bellard | + pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2);
|
1988 | 6f7e9aec | bellard | +
|
1989 | 6f7e9aec | bellard | + pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4);
|
1990 | 6f7e9aec | bellard | + if (type) { /* I/O */
|
1991 | 6f7e9aec | bellard | + pte |= SRMMU_REF;
|
1992 | 6f7e9aec | bellard | + /* SRMMU cannot make Supervisor-only, but not exectutable */
|
1993 | 6f7e9aec | bellard | + pte |= SRMMU_PRIV;
|
1994 | 6f7e9aec | bellard | + } else { /* memory */
|
1995 | 6f7e9aec | bellard | + pte |= SRMMU_REF|SRMMU_CACHE;
|
1996 | 6f7e9aec | bellard | + pte |= SRMMU_PRIV; /* Supervisor only access */
|
1997 | 6f7e9aec | bellard | + }
|
1998 | 6f7e9aec | bellard | + st_bypass(pa, pte);
|
1999 | 6f7e9aec | bellard | + return 0;
|
2000 | e80cfcfc | bellard | +
|
2001 | 6f7e9aec | bellard | +drop:
|
2002 | 6f7e9aec | bellard | + return -1;
|
2003 | 6f7e9aec | bellard | +}
|
2004 | e80cfcfc | bellard | +
|
2005 | 6f7e9aec | bellard | +/*
|
2006 | 6f7e9aec | bellard | + * Switch page tables.
|
2007 | 6f7e9aec | bellard | + */
|
2008 | 6f7e9aec | bellard | +void
|
2009 | 6f7e9aec | bellard | +init_mmu_swift(unsigned int ctp_phy)
|
2010 | e80cfcfc | bellard | +{
|
2011 | 6f7e9aec | bellard | + unsigned int addr;
|
2012 | e80cfcfc | bellard | +
|
2013 | e80cfcfc | bellard | + /*
|
2014 | 6f7e9aec | bellard | + * Flush cache
|
2015 | e80cfcfc | bellard | + */
|
2016 | 6f7e9aec | bellard | + for (addr = 0; addr < 0x2000; addr += 0x10) {
|
2017 | 6f7e9aec | bellard | + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
|
2018 | 6f7e9aec | bellard | + "r" (addr), "i" (ASI_M_DATAC_TAG));
|
2019 | 6f7e9aec | bellard | + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
|
2020 | 6f7e9aec | bellard | + "r" (addr<<1), "i" (ASI_M_TXTC_TAG));
|
2021 | e80cfcfc | bellard | + }
|
2022 | e80cfcfc | bellard | +
|
2023 | e80cfcfc | bellard | + /*
|
2024 | 6f7e9aec | bellard | + * Switch ctx table
|
2025 | e80cfcfc | bellard | + */
|
2026 | 6f7e9aec | bellard | + ctp_phy >>= 4;
|
2027 | 6f7e9aec | bellard | + /* printk("done flushing, switching to %x\n", ctp_phy); */
|
2028 | 6f7e9aec | bellard | + __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
|
2029 | 6f7e9aec | bellard | + "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS));
|
2030 | e80cfcfc | bellard | +
|
2031 | e80cfcfc | bellard | + /*
|
2032 | 6f7e9aec | bellard | + * Flush old page table references
|
2033 | e80cfcfc | bellard | + */
|
2034 | 6f7e9aec | bellard | + __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
|
2035 | 6f7e9aec | bellard | + "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory");
|
2036 | e80cfcfc | bellard | +}
|
2037 | e80cfcfc | bellard | +
|
2038 | 6f7e9aec | bellard | +/*
|
2039 | 6f7e9aec | bellard | + * add_timer, del_timer
|
2040 | 6f7e9aec | bellard | + * This should go into sched.c, but we have it split for different archs.
|
2041 | 6f7e9aec | bellard | + */
|
2042 | 6f7e9aec | bellard | +struct timer_list_head {
|
2043 | 6f7e9aec | bellard | + struct timer_list *head, *tail;
|
2044 | 6f7e9aec | bellard | +};
|
2045 | 6f7e9aec | bellard | +
|
2046 | 6f7e9aec | bellard | +static struct timer_list_head timers; /* Anonymous heap of timers */
|
2047 | 6f7e9aec | bellard | +
|
2048 | 6f7e9aec | bellard | +void add_timer(struct timer_list *timer) {
|
2049 | 6f7e9aec | bellard | + struct timer_list *p;
|
2050 | 6f7e9aec | bellard | + if (timer->prev != NULL || timer->next != NULL) {
|
2051 | 6f7e9aec | bellard | + printk("bug: kernel timer added twice at 0x%x.\n",
|
2052 | 6f7e9aec | bellard | + __builtin_return_address(0));
|
2053 | 6f7e9aec | bellard | + return;
|
2054 | e80cfcfc | bellard | + }
|
2055 | 6f7e9aec | bellard | + if ((p = timers.tail) != NULL) {
|
2056 | 6f7e9aec | bellard | + timer->prev = p;
|
2057 | 6f7e9aec | bellard | + p->next = timer;
|
2058 | 6f7e9aec | bellard | + timers.tail = timer;
|
2059 | 6f7e9aec | bellard | + } else {
|
2060 | 6f7e9aec | bellard | + timers.head = timer;
|
2061 | 6f7e9aec | bellard | + timers.tail = timer;
|
2062 | 6f7e9aec | bellard | + }
|
2063 | 6f7e9aec | bellard | + return;
|
2064 | e80cfcfc | bellard | +}
|
2065 | e80cfcfc | bellard | +
|
2066 | 6f7e9aec | bellard | +int del_timer(struct timer_list *timer) {
|
2067 | 6f7e9aec | bellard | + struct timer_list *p;
|
2068 | 6f7e9aec | bellard | + int ret;
|
2069 | 6f7e9aec | bellard | +
|
2070 | 6f7e9aec | bellard | + if (timers.head == timer) timers.head = timer->next;
|
2071 | 6f7e9aec | bellard | + if (timers.tail == timer) timers.tail = timer->prev;
|
2072 | 6f7e9aec | bellard | + if ((p = timer->prev) != NULL) p->next = timer->next;
|
2073 | 6f7e9aec | bellard | + if ((p = timer->next) != NULL) p->prev = timer->prev;
|
2074 | 6f7e9aec | bellard | + ret = timer->next != 0 || timer->prev != 0;
|
2075 | 6f7e9aec | bellard | + timer->next = NULL;
|
2076 | 6f7e9aec | bellard | + timer->prev = NULL;
|
2077 | 6f7e9aec | bellard | + return ret;
|
2078 | e80cfcfc | bellard | +}
|
2079 | e80cfcfc | bellard | +
|
2080 | 6f7e9aec | bellard | +void run_timers() {
|
2081 | 6f7e9aec | bellard | + struct timer_list *p;
|
2082 | 6f7e9aec | bellard | +
|
2083 | 6f7e9aec | bellard | + p = timers.head;
|
2084 | 6f7e9aec | bellard | + while (p != NULL) {
|
2085 | 6f7e9aec | bellard | + if (p->expires < jiffies) {
|
2086 | 6f7e9aec | bellard | + del_timer(p); /* XXX make nonstatic member */
|
2087 | 6f7e9aec | bellard | + (*p->function)(p->data);
|
2088 | 6f7e9aec | bellard | + p = timers.head;
|
2089 | 6f7e9aec | bellard | + } else {
|
2090 | 6f7e9aec | bellard | + p = p->next;
|
2091 | 6f7e9aec | bellard | + }
|
2092 | 6f7e9aec | bellard | + }
|
2093 | e80cfcfc | bellard | +}
|
2094 | e80cfcfc | bellard | +
|
2095 | 6f7e9aec | bellard | +/*
|
2096 | 6f7e9aec | bellard | + * Allocate memory. This is reusable.
|
2097 | 6f7e9aec | bellard | + */
|
2098 | 6f7e9aec | bellard | +void mem_init(struct mem *t, char *begin, char *limit)
|
2099 | e80cfcfc | bellard | +{
|
2100 | 6f7e9aec | bellard | + t->start = begin;
|
2101 | 6f7e9aec | bellard | + t->uplim = limit;
|
2102 | 6f7e9aec | bellard | + t->curp = begin;
|
2103 | e80cfcfc | bellard | +}
|
2104 | e80cfcfc | bellard | +
|
2105 | 6f7e9aec | bellard | +void mem_fini(struct mem *t)
|
2106 | e80cfcfc | bellard | +{
|
2107 | 6f7e9aec | bellard | + t->curp = 0;
|
2108 | e80cfcfc | bellard | +}
|
2109 | e80cfcfc | bellard | +
|
2110 | 6f7e9aec | bellard | +void *mem_alloc(struct mem *t, int size, int align)
|
2111 | e80cfcfc | bellard | +{
|
2112 | 6f7e9aec | bellard | + char *p;
|
2113 | e80cfcfc | bellard | +
|
2114 | 6f7e9aec | bellard | + p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));
|
2115 | 6f7e9aec | bellard | + if (p >= t->uplim || p + size > t->uplim) return 0;
|
2116 | 6f7e9aec | bellard | + t->curp = p + size;
|
2117 | 6f7e9aec | bellard | + return p;
|
2118 | e80cfcfc | bellard | +}
|
2119 | e80cfcfc | bellard | +
|
2120 | 6f7e9aec | bellard | +void *mem_zalloc(struct mem *t, int size, int align)
|
2121 | e80cfcfc | bellard | +{
|
2122 | 6f7e9aec | bellard | + char *p;
|
2123 | e80cfcfc | bellard | +
|
2124 | 6d82d04a | bellard | + if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);
|
2125 | 6f7e9aec | bellard | + return p;
|
2126 | e80cfcfc | bellard | +}
|
2127 | e80cfcfc | bellard | +
|
2128 | 6f7e9aec | bellard | +/*
|
2129 | 6f7e9aec | bellard | + * Library functions
|
2130 | 6f7e9aec | bellard | + */
|
2131 | 6d82d04a | bellard | +void *memset(void *s, int c, size_t len)
|
2132 | 6d82d04a | bellard | +{
|
2133 | 6d82d04a | bellard | + void *p = s;
|
2134 | 6d82d04a | bellard | +
|
2135 | 6d82d04a | bellard | + while (len--) {
|
2136 | 6d82d04a | bellard | + *(char *)s = c;
|
2137 | 6d82d04a | bellard | + s++;
|
2138 | 6d82d04a | bellard | + }
|
2139 | 6d82d04a | bellard | + return p;
|
2140 | e80cfcfc | bellard | +}
|
2141 | e80cfcfc | bellard | +
|
2142 | 6f7e9aec | bellard | +void bcopy(const void *f, void *t, int len) {
|
2143 | 6d82d04a | bellard | + while (len--) {
|
2144 | 6d82d04a | bellard | + *(char *)t = *(char *)f;
|
2145 | 6d82d04a | bellard | + f++;
|
2146 | 6d82d04a | bellard | + t++;
|
2147 | 6d82d04a | bellard | + }
|
2148 | 6f7e9aec | bellard | +}
|
2149 | e80cfcfc | bellard | +
|
2150 | 6f7e9aec | bellard | +/* Comparison is 7-bit */
|
2151 | 6f7e9aec | bellard | +int bcmp(const void *s1, const void *s2, int len)
|
2152 | 6f7e9aec | bellard | +{
|
2153 | 6f7e9aec | bellard | + int i;
|
2154 | 6f7e9aec | bellard | + char ch;
|
2155 | 6f7e9aec | bellard | +
|
2156 | 6f7e9aec | bellard | + while (len--) {
|
2157 | 6d82d04a | bellard | + ch = *(char *)s1;
|
2158 | 6d82d04a | bellard | + i = ch - *(char *)s2;
|
2159 | 6d82d04a | bellard | + s1++;
|
2160 | 6d82d04a | bellard | + s2++;
|
2161 | 6d82d04a | bellard | + if (i != 0)
|
2162 | 6f7e9aec | bellard | + return i;
|
2163 | 6f7e9aec | bellard | + if (ch == 0)
|
2164 | 6f7e9aec | bellard | + return 0;
|
2165 | 6f7e9aec | bellard | + }
|
2166 | e80cfcfc | bellard | + return 0;
|
2167 | e80cfcfc | bellard | +}
|
2168 | e80cfcfc | bellard | +
|
2169 | 6f7e9aec | bellard | +int strlen(const char *s) {
|
2170 | 6f7e9aec | bellard | + const char *p;
|
2171 | 6f7e9aec | bellard | + for (p = s; *p != 0; p++) { }
|
2172 | 6f7e9aec | bellard | + return p - s;
|
2173 | e80cfcfc | bellard | +}
|
2174 | e80cfcfc | bellard | +
|
2175 | 6f7e9aec | bellard | +extern void *printk_fn;
|
2176 | e80cfcfc | bellard | +
|
2177 | 6f7e9aec | bellard | +void printk(char *fmt, ...)
|
2178 | 6f7e9aec | bellard | +{
|
2179 | 6f7e9aec | bellard | + struct prf_fp {
|
2180 | 6f7e9aec | bellard | + void *xfp;
|
2181 | 6f7e9aec | bellard | + void (*write)(void *, char *, int);
|
2182 | 6f7e9aec | bellard | + } prfa;
|
2183 | 6f7e9aec | bellard | + extern void prf(struct prf_fp *, char *fmt, va_list adx);
|
2184 | 6f7e9aec | bellard | + va_list x1;
|
2185 | 6f7e9aec | bellard | +
|
2186 | 6f7e9aec | bellard | + va_start(x1, fmt);
|
2187 | 6f7e9aec | bellard | + prfa.xfp = &dp0;
|
2188 | 6f7e9aec | bellard | + prfa.write = printk_fn;
|
2189 | 6f7e9aec | bellard | + prf(&prfa, fmt, x1);
|
2190 | 6f7e9aec | bellard | + va_end(x1);
|
2191 | e80cfcfc | bellard | +}
|
2192 | e80cfcfc | bellard | +
|
2193 | 6f7e9aec | bellard | +void fatal()
|
2194 | 6f7e9aec | bellard | +{
|
2195 | 6f7e9aec | bellard | + printk("fatal.");
|
2196 | 6f7e9aec | bellard | +loop: goto loop;
|
2197 | e80cfcfc | bellard | +}
|
2198 | e80cfcfc | bellard | +
|
2199 | 6f7e9aec | bellard | +/*
|
2200 | 6f7e9aec | bellard | + * Get the highest bit number from the mask.
|
2201 | 6f7e9aec | bellard | + */
|
2202 | 6f7e9aec | bellard | +int highc(int mask, int size)
|
2203 | 6f7e9aec | bellard | +{
|
2204 | 6f7e9aec | bellard | + int m1;
|
2205 | 6f7e9aec | bellard | +
|
2206 | 6f7e9aec | bellard | + m1 = 1 << size;
|
2207 | 6f7e9aec | bellard | + while (size != 0) {
|
2208 | 6f7e9aec | bellard | + size--;
|
2209 | 6f7e9aec | bellard | + m1 >>= 1;
|
2210 | 6f7e9aec | bellard | + if (m1 & mask) break;
|
2211 | 6f7e9aec | bellard | + }
|
2212 | 6f7e9aec | bellard | + return size;
|
2213 | e80cfcfc | bellard | +}
|
2214 | e80cfcfc | bellard | +
|
2215 | 6f7e9aec | bellard | +/*
|
2216 | 6f7e9aec | bellard | + */
|
2217 | 6f7e9aec | bellard | +unsigned int ld_bp_swap(unsigned int ptr) {
|
2218 | 6f7e9aec | bellard | + unsigned int n;
|
2219 | 6f7e9aec | bellard | + n = ld_bypass(ptr);
|
2220 | 6f7e9aec | bellard | + n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
|
2221 | 6f7e9aec | bellard | + return n;
|
2222 | e80cfcfc | bellard | +}
|
2223 | 6f7e9aec | bellard | +
|
2224 | 6f7e9aec | bellard | +void st_bp_swap(unsigned int ptr, unsigned int n) {
|
2225 | 6f7e9aec | bellard | + n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24);
|
2226 | 6f7e9aec | bellard | + st_bypass(ptr, n);
|
2227 | 6f7e9aec | bellard | +};
|
2228 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/arp.c proll-patch-15/src/arp.c
|
2229 | e80cfcfc | bellard | --- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000
|
2230 | 9e61bde5 | bellard | +++ proll-patch-15/src/arp.c 2005-08-14 10:10:11.000000000 +0000
|
2231 | e80cfcfc | bellard | @@ -45,7 +45,7 @@
|
2232 | e80cfcfc | bellard | #endif
|
2233 | e80cfcfc | bellard | static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */ |
2234 | e80cfcfc | bellard | static int next_arp; /* next table entry */ |
2235 | e80cfcfc | bellard | -static t_ipaddr def_gw = IP_ANY; /* default routing */
|
2236 | e80cfcfc | bellard | +static t_ipaddr def_gw; /* default routing */
|
2237 | e80cfcfc | bellard | |
2238 | e80cfcfc | bellard | |
2239 | e80cfcfc | bellard | |
2240 | 9e61bde5 | bellard | @@ -100,10 +100,7 @@
|
2241 | 9e61bde5 | bellard | * |
2242 | 9e61bde5 | bellard | * ARP receiver routine |
2243 | 9e61bde5 | bellard | */ |
2244 | 9e61bde5 | bellard | -static int arp_recv(buf, bufsize, addr)
|
2245 | 9e61bde5 | bellard | -unsigned char *buf;
|
2246 | 9e61bde5 | bellard | -int bufsize;
|
2247 | 9e61bde5 | bellard | -unsigned char *addr;
|
2248 | 9e61bde5 | bellard | +static int arp_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr)
|
2249 | 9e61bde5 | bellard | { |
2250 | 9e61bde5 | bellard | register struct arphdr *ahp = (struct arphdr *)buf; |
2251 | 9e61bde5 | bellard | |
2252 | 9e61bde5 | bellard | @@ -144,7 +141,7 @@
|
2253 | e80cfcfc | bellard | * |
2254 | e80cfcfc | bellard | * Resolve IP address and return pointer to hardware address.
|
2255 | e80cfcfc | bellard | */ |
2256 | e80cfcfc | bellard | -unsigned char *ip_resolve(ip)
|
2257 | e80cfcfc | bellard | +const unsigned char *ip_resolve(ip)
|
2258 | e80cfcfc | bellard | t_ipaddr ip; |
2259 | e80cfcfc | bellard | { |
2260 | e80cfcfc | bellard | int i;
|
2261 | 9e61bde5 | bellard | @@ -230,14 +227,11 @@
|
2262 | e80cfcfc | bellard | */ |
2263 | e80cfcfc | bellard | int init_arp()
|
2264 | e80cfcfc | bellard | { |
2265 | e80cfcfc | bellard | - /* Set name of module for error messages */
|
2266 | e80cfcfc | bellard | - net_module_name = "arp";
|
2267 | e80cfcfc | bellard | -
|
2268 | e80cfcfc | bellard | #ifndef NOARP
|
2269 | e80cfcfc | bellard | /* Register ARP packet type and set send buffer pointer */
|
2270 | e80cfcfc | bellard | if ((arpbuf = (struct arphdr *)reg_type(htons(ETH_P_ARP), arp_recv)) == NULL) |
2271 | e80cfcfc | bellard | return(FALSE);
|
2272 | 8d5f07fa | bellard | #endif
|
2273 | e80cfcfc | bellard | -
|
2274 | e80cfcfc | bellard | + def_gw = IP_ANY;
|
2275 | e80cfcfc | bellard | return(TRUE);
|
2276 | e80cfcfc | bellard | } |
2277 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/arp.h proll-patch-15/src/arp.h
|
2278 | e80cfcfc | bellard | --- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000
|
2279 | 9e61bde5 | bellard | +++ proll-patch-15/src/arp.h 2004-11-13 15:50:49.000000000 +0000
|
2280 | e80cfcfc | bellard | @@ -104,7 +104,7 @@
|
2281 | e80cfcfc | bellard | extern int init_arp __P((void)); |
2282 | e80cfcfc | bellard | |
2283 | e80cfcfc | bellard | /* Resolve IP address and return pointer to hardware address */
|
2284 | e80cfcfc | bellard | -extern unsigned char *ip_resolve __P((t_ipaddr ip));
|
2285 | e80cfcfc | bellard | +extern const unsigned char *ip_resolve __P((t_ipaddr ip));
|
2286 | e80cfcfc | bellard | |
2287 | e80cfcfc | bellard | /* Add a new antry to the ARP cache */
|
2288 | e80cfcfc | bellard | extern void addcache __P((unsigned char *ha, t_ipaddr ip)); |
2289 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/bootp.c proll-patch-15/src/bootp.c
|
2290 | 9e61bde5 | bellard | --- proll_18.orig/src/bootp.c 1999-12-15 17:20:30.000000000 +0000
|
2291 | 9e61bde5 | bellard | +++ proll-patch-15/src/bootp.c 2005-08-14 10:16:09.000000000 +0000
|
2292 | 9e61bde5 | bellard | @@ -151,7 +151,7 @@
|
2293 | 9e61bde5 | bellard | while (TRUE) {
|
2294 | 9e61bde5 | bellard | boot_xid = get_ticks() + random(); |
2295 | 9e61bde5 | bellard | bootp_send(); |
2296 | 9e61bde5 | bellard | - i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout, CHR_ESC);
|
2297 | 9e61bde5 | bellard | + i = udp_read((char *)(&boot_rec), BOOTP_REC_SIZE, timeout);
|
2298 | 9e61bde5 | bellard | if (i < 0) { /* user pressed ESC */ |
2299 | 9e61bde5 | bellard | printf("\nAborted\n");
|
2300 | 9e61bde5 | bellard | return(1); |
2301 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/esp.c proll-patch-15/src/esp.c
|
2302 | 6d82d04a | bellard | --- proll_18.orig/src/esp.c 1970-01-01 00:00:00.000000000 +0000
|
2303 | 9e61bde5 | bellard | +++ proll-patch-15/src/esp.c 2005-08-15 18:42:46.000000000 +0000
|
2304 | 9e61bde5 | bellard | @@ -0,0 +1,305 @@
|
2305 | 6d82d04a | bellard | +#include <system.h> /* == <asm/system.h> */
|
2306 | 6d82d04a | bellard | +#include <general.h> /* __P for netpriv.h */
|
2307 | 6d82d04a | bellard | +#include <dma.h> /* dmaga */
|
2308 | 6d82d04a | bellard | +#include <romlib.h>
|
2309 | 6d82d04a | bellard | +
|
2310 | 6d82d04a | bellard | +#define PHYS_JJ_ESPDMA 0x78400000 /* ESP DMA controller */
|
2311 | 6d82d04a | bellard | +#define PHYS_JJ_ESP 0x78800000 /* ESP SCSI */
|
2312 | 6d82d04a | bellard | +#define PHYS_JJ_ESP_IRQ 4
|
2313 | 6d82d04a | bellard | +#define BUFSIZE 4096
|
2314 | 6d82d04a | bellard | +/*
|
2315 | 6d82d04a | bellard | + * XXX Crude
|
2316 | 6d82d04a | bellard | + */
|
2317 | 6d82d04a | bellard | +struct esp_dma {
|
2318 | 6d82d04a | bellard | + struct sparc_dma_registers *regs;
|
2319 | 6d82d04a | bellard | + enum dvma_rev revision;
|
2320 | 6d82d04a | bellard | +};
|
2321 | 6d82d04a | bellard | +
|
2322 | 6d82d04a | bellard | +struct esp_regs {
|
2323 | 6d82d04a | bellard | + unsigned int regs[16];
|
2324 | 6d82d04a | bellard | +};
|
2325 | 6d82d04a | bellard | +
|
2326 | 6d82d04a | bellard | +struct esp_private {
|
2327 | 6d82d04a | bellard | + int active; /* initialized */
|
2328 | 6d82d04a | bellard | + int inst; /* iface number */
|
2329 | 6d82d04a | bellard | +
|
2330 | 6d82d04a | bellard | + volatile struct esp_regs *ll;
|
2331 | 6d82d04a | bellard | + __u32 buffer_dvma;
|
2332 | 6d82d04a | bellard | + unsigned int irq; /* device IRQ number */
|
2333 | 6d82d04a | bellard | + int interrupt;
|
2334 | 6d82d04a | bellard | +
|
2335 | 6d82d04a | bellard | + struct esp_dma *espdma; /* If set this points to espdma */
|
2336 | 6d82d04a | bellard | +
|
2337 | 6d82d04a | bellard | + unsigned char *buffer;
|
2338 | 9e61bde5 | bellard | + struct disk_info {
|
2339 | 9e61bde5 | bellard | + unsigned int hw_sector;
|
2340 | 9e61bde5 | bellard | + unsigned int part_offset[8];
|
2341 | 9e61bde5 | bellard | + } disk[8];
|
2342 | 6d82d04a | bellard | +};
|
2343 | 6d82d04a | bellard | +
|
2344 | 6d82d04a | bellard | +static void esp_interrupt(void *dev_id)
|
2345 | 6d82d04a | bellard | +{
|
2346 | 6d82d04a | bellard | + struct esp_private *lp = (struct esp_private *)dev_id;
|
2347 | 6d82d04a | bellard | +
|
2348 | 6d82d04a | bellard | + lp->interrupt = 1;
|
2349 | 6d82d04a | bellard | + /* Acknowledge all the interrupt sources ASAP */
|
2350 | 6d82d04a | bellard | +
|
2351 | 6d82d04a | bellard | + lp->interrupt = 0;
|
2352 | 6d82d04a | bellard | +}
|
2353 | 6d82d04a | bellard | +
|
2354 | 6d82d04a | bellard | +static int esp_open (void *dev)
|
2355 | 6d82d04a | bellard | +{
|
2356 | 6d82d04a | bellard | + struct esp_private *lp = (struct esp_private *)dev;
|
2357 | 6d82d04a | bellard | + int status = 0;
|
2358 | 6d82d04a | bellard | +
|
2359 | 6d82d04a | bellard | + if (request_irq(lp->irq, &esp_interrupt, (void *)dev)) {
|
2360 | 6d82d04a | bellard | + printk ("Esp: Can't get irq %d\n", lp->irq);
|
2361 | 6d82d04a | bellard | + return -1;
|
2362 | 6d82d04a | bellard | + }
|
2363 | 6d82d04a | bellard | +
|
2364 | 6d82d04a | bellard | + /* On the 4m, setup the espdma to provide the upper bits for buffers */
|
2365 | 6d82d04a | bellard | + if (lp->espdma)
|
2366 | 6d82d04a | bellard | + lp->espdma->regs->dma_test = ((__u32) lp->buffer_dvma) & 0xff000000;
|
2367 | 6d82d04a | bellard | +
|
2368 | 6d82d04a | bellard | + return status;
|
2369 | 6d82d04a | bellard | +}
|
2370 | 6d82d04a | bellard | +
|
2371 | 6d82d04a | bellard | +static int esp_close (void *dev)
|
2372 | 6d82d04a | bellard | +{
|
2373 | 6d82d04a | bellard | + struct esp_private *lp = (struct esp_private *)dev;
|
2374 | 6d82d04a | bellard | +
|
2375 | 6d82d04a | bellard | + free_irq (lp->irq, (void *) dev);
|
2376 | 6d82d04a | bellard | + return 0;
|
2377 | 6d82d04a | bellard | +}
|
2378 | 6d82d04a | bellard | +
|
2379 | 6d82d04a | bellard | +static int
|
2380 | 6d82d04a | bellard | +esp_init(struct esp_private *esp, struct esp_dma *espdma, int irq)
|
2381 | 6d82d04a | bellard | +{
|
2382 | 6d82d04a | bellard | + volatile struct esp_regs *ll;
|
2383 | 6d82d04a | bellard | +
|
2384 | 6d82d04a | bellard | + /* Get the IO region */
|
2385 | 6d82d04a | bellard | + ll = map_io(PHYS_JJ_ESP, sizeof (struct esp_regs));
|
2386 | 6d82d04a | bellard | + if (ll == 0) return -1;
|
2387 | 6d82d04a | bellard | +
|
2388 | 6d82d04a | bellard | + esp->buffer = dvma_alloc(BUFSIZE, &esp->buffer_dvma);
|
2389 | 6d82d04a | bellard | + esp->ll = ll;
|
2390 | 6d82d04a | bellard | + esp->espdma = espdma;
|
2391 | 6d82d04a | bellard | + esp->irq = irq;
|
2392 | 6d82d04a | bellard | +
|
2393 | 6d82d04a | bellard | + // Chip reset
|
2394 | 6d82d04a | bellard | + stb_bypass((int)ll + 3*2, 2);
|
2395 | 6d82d04a | bellard | + return 0;
|
2396 | 6d82d04a | bellard | +}
|
2397 | 6d82d04a | bellard | +
|
2398 | 6d82d04a | bellard | +static int espdma_init(struct esp_dma *espdma)
|
2399 | 6d82d04a | bellard | +{
|
2400 | 6d82d04a | bellard | + void *p;
|
2401 | 6d82d04a | bellard | +
|
2402 | 6d82d04a | bellard | + /* Hardcode everything for MrCoffee. */
|
2403 | 6d82d04a | bellard | + if ((p = map_io(PHYS_JJ_ESPDMA, 0x10)) == 0) {
|
2404 | 6d82d04a | bellard | + printk("espdma_init: cannot map registers\n");
|
2405 | 6d82d04a | bellard | + return -1;
|
2406 | 6d82d04a | bellard | + }
|
2407 | 6d82d04a | bellard | + espdma->regs = p;
|
2408 | 6d82d04a | bellard | +
|
2409 | 6d82d04a | bellard | + printk("dma1: ");
|
2410 | 6d82d04a | bellard | +
|
2411 | 6d82d04a | bellard | + switch((espdma->regs->cond_reg)&DMA_DEVICE_ID) {
|
2412 | 6d82d04a | bellard | + case DMA_VERS0:
|
2413 | 6d82d04a | bellard | + espdma->revision=dvmarev0;
|
2414 | 6d82d04a | bellard | + printk("Revision 0 ");
|
2415 | 6d82d04a | bellard | + break;
|
2416 | 6d82d04a | bellard | + case DMA_ESCV1:
|
2417 | 6d82d04a | bellard | + espdma->revision=dvmaesc1;
|
2418 | 6d82d04a | bellard | + printk("ESC Revision 1 ");
|
2419 | 6d82d04a | bellard | + break;
|
2420 | 6d82d04a | bellard | + case DMA_VERS1:
|
2421 | 6d82d04a | bellard | + espdma->revision=dvmarev1;
|
2422 | 6d82d04a | bellard | + printk("Revision 1 ");
|
2423 | 6d82d04a | bellard | + break;
|
2424 | 6d82d04a | bellard | + case DMA_VERS2:
|
2425 | 6d82d04a | bellard | + espdma->revision=dvmarev2;
|
2426 | 6d82d04a | bellard | + printk("Revision 2 ");
|
2427 | 6d82d04a | bellard | + break;
|
2428 | 6d82d04a | bellard | + case DMA_VERHME:
|
2429 | 6d82d04a | bellard | + espdma->revision=dvmahme;
|
2430 | 6d82d04a | bellard | + printk("HME DVMA gate array ");
|
2431 | 6d82d04a | bellard | + break;
|
2432 | 6d82d04a | bellard | + case DMA_VERSPLUS:
|
2433 | 6d82d04a | bellard | + espdma->revision=dvmarevplus;
|
2434 | 6d82d04a | bellard | + printk("Revision 1 PLUS ");
|
2435 | 6d82d04a | bellard | + break;
|
2436 | 6d82d04a | bellard | + default:
|
2437 | 6d82d04a | bellard | + printk("unknown dma version %x",
|
2438 | 6d82d04a | bellard | + (espdma->regs->cond_reg)&DMA_DEVICE_ID);
|
2439 | 6d82d04a | bellard | + /* espdma->allocated = 1; */
|
2440 | 6d82d04a | bellard | + break;
|
2441 | 6d82d04a | bellard | + }
|
2442 | 6d82d04a | bellard | + printk("\n");
|
2443 | 6d82d04a | bellard | + return 0;
|
2444 | 6d82d04a | bellard | +}
|
2445 | 6d82d04a | bellard | +
|
2446 | 6d82d04a | bellard | +static struct esp_dma espdma0;
|
2447 | 6d82d04a | bellard | +static struct esp_private esp;
|
2448 | 6d82d04a | bellard | +/*
|
2449 | 6d82d04a | bellard | + * Find all the esp cards on the system and initialize them
|
2450 | 6d82d04a | bellard | + */
|
2451 | 6d82d04a | bellard | +void esp_probe ()
|
2452 | 6d82d04a | bellard | +{
|
2453 | 6d82d04a | bellard | + if (espdma_init(&espdma0) != 0) {
|
2454 | 6d82d04a | bellard | + return;
|
2455 | 6d82d04a | bellard | + }
|
2456 | 6d82d04a | bellard | +
|
2457 | 6d82d04a | bellard | + if (esp_init(&esp, &espdma0, PHYS_JJ_ESP_IRQ) != 0) {
|
2458 | 6d82d04a | bellard | + printk("esp_probe: esp0 init failed\n");
|
2459 | 6d82d04a | bellard | + return;
|
2460 | 6d82d04a | bellard | + }
|
2461 | 6d82d04a | bellard | + return;
|
2462 | 6d82d04a | bellard | +}
|
2463 | 6d82d04a | bellard | +
|
2464 | 9e61bde5 | bellard | +void esp_read_capacity(int unit)
|
2465 | 6d82d04a | bellard | +{
|
2466 | 6d82d04a | bellard | + // Set SCSI target
|
2467 | 6d82d04a | bellard | + stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);
|
2468 | 6d82d04a | bellard | + // Set DMA address
|
2469 | 6d82d04a | bellard | + st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);
|
2470 | 6d82d04a | bellard | + // Set DMA length
|
2471 | 6d82d04a | bellard | + stb_bypass(PHYS_JJ_ESP + 0*4, 10);
|
2472 | 6d82d04a | bellard | + stb_bypass(PHYS_JJ_ESP + 1*4, 0);
|
2473 | 6d82d04a | bellard | + // Set DMA direction
|
2474 | 6d82d04a | bellard | + st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);
|
2475 | 9e61bde5 | bellard | + // Setup command = Read Capacity
|
2476 | 9e61bde5 | bellard | + esp.buffer[0] = 0x80;
|
2477 | 9e61bde5 | bellard | + esp.buffer[1] = 0x25;
|
2478 | 9e61bde5 | bellard | + esp.buffer[2] = 0x00;
|
2479 | 9e61bde5 | bellard | + esp.buffer[3] = 0x00;
|
2480 | 9e61bde5 | bellard | + esp.buffer[4] = 0x00;
|
2481 | 9e61bde5 | bellard | + esp.buffer[5] = 0x00;
|
2482 | 9e61bde5 | bellard | + esp.buffer[6] = 0x00;
|
2483 | 9e61bde5 | bellard | + esp.buffer[7] = 0x00;
|
2484 | 9e61bde5 | bellard | + esp.buffer[8] = 0x00;
|
2485 | 9e61bde5 | bellard | + esp.buffer[9] = 0x00;
|
2486 | 9e61bde5 | bellard | + esp.buffer[10] = 0x00;
|
2487 | 9e61bde5 | bellard | + // Set ATN, issue command
|
2488 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2);
|
2489 | 9e61bde5 | bellard | +
|
2490 | 9e61bde5 | bellard | + // Set DMA length = 512 * read length
|
2491 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 0*4, 0);
|
2492 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 1*4, 8 & 0xff);
|
2493 | 9e61bde5 | bellard | + // Set DMA direction
|
2494 | 9e61bde5 | bellard | + st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);
|
2495 | 9e61bde5 | bellard | + // Transfer
|
2496 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 3*4, 0x90);
|
2497 | 9e61bde5 | bellard | + esp.disk[unit].hw_sector = (esp.buffer[4] << 24) | (esp.buffer[5] << 16) | (esp.buffer[6] << 8) | esp.buffer[7];
|
2498 | 9e61bde5 | bellard | +}
|
2499 | 9e61bde5 | bellard | +
|
2500 | 9e61bde5 | bellard | +// offset is multiple of 512, len in bytes
|
2501 | 9e61bde5 | bellard | +void *esp_read(int unit, int part, int offset, short len)
|
2502 | 9e61bde5 | bellard | +{
|
2503 | 9e61bde5 | bellard | + int pos, hw_sect, sect_offset, spb;
|
2504 | 9e61bde5 | bellard | +
|
2505 | 9e61bde5 | bellard | + // Set SCSI target
|
2506 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 4*4, unit & 7);
|
2507 | 9e61bde5 | bellard | + // Set DMA address
|
2508 | 9e61bde5 | bellard | + st_bypass(PHYS_JJ_ESPDMA + 4, esp.buffer_dvma);
|
2509 | 9e61bde5 | bellard | + // Set DMA length
|
2510 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 0*4, 10);
|
2511 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 1*4, 0);
|
2512 | 9e61bde5 | bellard | + // Set DMA direction
|
2513 | 9e61bde5 | bellard | + st_bypass(PHYS_JJ_ESPDMA + 0, 0x000);
|
2514 | 9e61bde5 | bellard | + hw_sect = esp.disk[unit].hw_sector;
|
2515 | 9e61bde5 | bellard | + offset += esp.disk[unit].part_offset[part];
|
2516 | 9e61bde5 | bellard | + spb = hw_sect / 512;
|
2517 | 9e61bde5 | bellard | + sect_offset = offset / spb;
|
2518 | 9e61bde5 | bellard | + pos = (offset - sect_offset * spb) * 512;
|
2519 | 9e61bde5 | bellard | + len /= 512;
|
2520 | 9e61bde5 | bellard | + //printk("Read unit %d, offset %d -> offset %d, pos %d, hw_sect %d\n", unit, offset, sect_offset, pos, hw_sect);
|
2521 | 6d82d04a | bellard | + // Setup command = Read(10)
|
2522 | 6d82d04a | bellard | + esp.buffer[0] = 0x80;
|
2523 | 6d82d04a | bellard | + esp.buffer[1] = 0x28;
|
2524 | 6d82d04a | bellard | + esp.buffer[2] = 0x00;
|
2525 | 9e61bde5 | bellard | + esp.buffer[3] = (sect_offset >> 24) & 0xff;
|
2526 | 9e61bde5 | bellard | + esp.buffer[4] = (sect_offset >> 16) & 0xff;
|
2527 | 9e61bde5 | bellard | + esp.buffer[5] = (sect_offset >> 8) & 0xff;
|
2528 | 9e61bde5 | bellard | + esp.buffer[6] = sect_offset & 0xff;
|
2529 | 6d82d04a | bellard | + esp.buffer[7] = 0x00;
|
2530 | 6d82d04a | bellard | + esp.buffer[8] = (len >> 8) & 0xff;
|
2531 | 6d82d04a | bellard | + esp.buffer[9] = len & 0xff;
|
2532 | 6d82d04a | bellard | + // Set ATN, issue command
|
2533 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 3*4, 0xc2);
|
2534 | 6d82d04a | bellard | +
|
2535 | 9e61bde5 | bellard | + // Set DMA length = sector size * read length
|
2536 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 0*4, (len * hw_sect) & 0xff);
|
2537 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 1*4, ((len * hw_sect) >> 8) & 0xff);
|
2538 | 6d82d04a | bellard | + // Set DMA direction
|
2539 | 6d82d04a | bellard | + st_bypass(PHYS_JJ_ESPDMA + 0, 0x100);
|
2540 | 6d82d04a | bellard | + // Transfer
|
2541 | 9e61bde5 | bellard | + stb_bypass(PHYS_JJ_ESP + 3*4, 0x90);
|
2542 | 9e61bde5 | bellard | + return esp.buffer + pos;
|
2543 | 6d82d04a | bellard | +}
|
2544 | 6d82d04a | bellard | +
|
2545 | 6d82d04a | bellard | +// Sparc boot sequence can be found in SILO docs,
|
2546 | 6d82d04a | bellard | +// first-isofs/README.SILO_ISOFS
|
2547 | 6d82d04a | bellard | +int esp_boot(int unit)
|
2548 | 6d82d04a | bellard | +{
|
2549 | 6d82d04a | bellard | + struct sun_disklabel {
|
2550 | 6d82d04a | bellard | + unsigned char info[128]; /* Informative text string */
|
2551 | 6d82d04a | bellard | + unsigned char spare0[14];
|
2552 | 6d82d04a | bellard | + struct sun_info {
|
2553 | 6d82d04a | bellard | + unsigned char spare1;
|
2554 | 6d82d04a | bellard | + unsigned char id;
|
2555 | 6d82d04a | bellard | + unsigned char spare2;
|
2556 | 6d82d04a | bellard | + unsigned char flags;
|
2557 | 6d82d04a | bellard | + } infos[8];
|
2558 | 6d82d04a | bellard | + unsigned char spare[246]; /* Boot information etc. */
|
2559 | 6d82d04a | bellard | + short rspeed; /* Disk rotational speed */
|
2560 | 6d82d04a | bellard | + short pcylcount; /* Physical cylinder count */
|
2561 | 6d82d04a | bellard | + short sparecyl; /* extra sects per cylinder */
|
2562 | 6d82d04a | bellard | + unsigned char spare2[4]; /* More magic... */
|
2563 | 6d82d04a | bellard | + short ilfact; /* Interleave factor */
|
2564 | 6d82d04a | bellard | + short ncyl; /* Data cylinder count */
|
2565 | 6d82d04a | bellard | + short nacyl; /* Alt. cylinder count */
|
2566 | 6d82d04a | bellard | + short ntrks; /* Tracks per cylinder */
|
2567 | 6d82d04a | bellard | + short nsect; /* Sectors per track */
|
2568 | 6d82d04a | bellard | + unsigned char spare3[4]; /* Even more magic... */
|
2569 | 6d82d04a | bellard | + struct sun_partition {
|
2570 | 6d82d04a | bellard | + int start_cylinder;
|
2571 | 6d82d04a | bellard | + int num_sectors;
|
2572 | 6d82d04a | bellard | + } partitions[8];
|
2573 | 6d82d04a | bellard | + short magic; /* Magic number */
|
2574 | 6d82d04a | bellard | + short csum; /* Label xor'd checksum */
|
2575 | 6d82d04a | bellard | + } *label;
|
2576 | 6d82d04a | bellard | + unsigned int i, offset;
|
2577 | 6d82d04a | bellard | + void *src, *dst;
|
2578 | 6d82d04a | bellard | +
|
2579 | 6d82d04a | bellard | + printk("Loading partition table from target %d:\n", unit);
|
2580 | 6d82d04a | bellard | + // Chip reset
|
2581 | 6d82d04a | bellard | + stb_bypass(PHYS_JJ_ESP + 3*4, 2);
|
2582 | 6d82d04a | bellard | +
|
2583 | 6d82d04a | bellard | + esp_open(&esp);
|
2584 | 9e61bde5 | bellard | + esp_read_capacity(unit);
|
2585 | 6d82d04a | bellard | +
|
2586 | 9e61bde5 | bellard | + label = esp_read(unit, 0, 0, 512);
|
2587 | 9e61bde5 | bellard | + printk("hw sector: %d, CHS: %d/%d/%d, partitions:\n", esp.disk[unit].hw_sector,
|
2588 | 9e61bde5 | bellard | + label->ncyl, label->ntrks, label->nsect);
|
2589 | 6d82d04a | bellard | + for (i = 0; i < 8; i++) {
|
2590 | 9e61bde5 | bellard | + printk("%c: %d + %d, id %x, flags %x\n", 'a' + i, label->partitions[i].start_cylinder,
|
2591 | 9e61bde5 | bellard | + label->partitions[i].num_sectors, label->infos[i].id, label->infos[i].flags);
|
2592 | 9e61bde5 | bellard | + esp.disk[unit].part_offset[i] = label->partitions[3].start_cylinder * label->ntrks * label->nsect;
|
2593 | 6d82d04a | bellard | + }
|
2594 | 9e61bde5 | bellard | + offset = 1;
|
2595 | 6d82d04a | bellard | + printk("booting sd(0,%d,0):d (offset %d)\n", unit, offset);
|
2596 | 6d82d04a | bellard | + // Skip a.out header (0x20)
|
2597 | 6d82d04a | bellard | + dst = (void *)0x4000;
|
2598 | 9e61bde5 | bellard | + src = esp_read(unit, 3, offset, 512);
|
2599 | 6d82d04a | bellard | + src = (void *)((unsigned int) src + 0x20);
|
2600 | 6d82d04a | bellard | + memcpy(dst, src, 512 - 0x20);
|
2601 | 6d82d04a | bellard | + dst = (void *)0x4000 + 512 - 0x20;
|
2602 | 6d82d04a | bellard | + for (i = 1; i < 7680/512; i++) {
|
2603 | 9e61bde5 | bellard | + src = esp_read(unit, 3, offset + i, 512);
|
2604 | 6d82d04a | bellard | + memcpy(dst, src, 512);
|
2605 | 6d82d04a | bellard | + dst += 512;
|
2606 | 6d82d04a | bellard | + }
|
2607 | 6d82d04a | bellard | + esp_close(&esp);
|
2608 | 6d82d04a | bellard | + return 0;
|
2609 | 6d82d04a | bellard | +}
|
2610 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/hconsole.c proll-patch-15/src/hconsole.c
|
2611 | e80cfcfc | bellard | --- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000
|
2612 | 9e61bde5 | bellard | +++ proll-patch-15/src/hconsole.c 2005-11-09 18:46:34.000000000 +0000
|
2613 | 6f7e9aec | bellard | @@ -29,6 +29,10 @@
|
2614 | 6f7e9aec | bellard | struct raster r_master; /* For a case of resize, whole fb */ |
2615 | 6f7e9aec | bellard | struct raster r_0; /* malloc() erzatz */ |
2616 | 6f7e9aec | bellard | |
2617 | 6f7e9aec | bellard | +#ifdef QEMU
|
2618 | 6f7e9aec | bellard | +extern unsigned int q_height, q_width;
|
2619 | 6f7e9aec | bellard | +#endif
|
2620 | 6f7e9aec | bellard | +
|
2621 | 6f7e9aec | bellard | int hcon_init(struct hconsole *t, unsigned int a0) |
2622 | 6f7e9aec | bellard | { |
2623 | 6f7e9aec | bellard | struct raster *q, *r;
|
2624 | 6f7e9aec | bellard | @@ -42,7 +46,11 @@
|
2625 | e80cfcfc | bellard | * No probing sequence or argument passing, hardcode everything. XXX |
2626 | e80cfcfc | bellard | */ |
2627 | e80cfcfc | bellard | raster8_cons_a(q, 768, 1024, (char *)a0); |
2628 | 6f7e9aec | bellard | +#ifndef QEMU
|
2629 | e80cfcfc | bellard | raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80)); |
2630 | e80cfcfc | bellard | +#else
|
2631 | 6f7e9aec | bellard | + raster_cons_2(r, q, 0, 0, q_height, q_width);
|
2632 | 8d5f07fa | bellard | +#endif
|
2633 | e80cfcfc | bellard | t->r_ = r; |
2634 | e80cfcfc | bellard | t->r0_ = q; |
2635 | e80cfcfc | bellard | t->f_ = &f_master; |
2636 | 9e61bde5 | bellard | @@ -67,7 +75,7 @@
|
2637 | 9e61bde5 | bellard | return 0; |
2638 | 9e61bde5 | bellard | } |
2639 | 9e61bde5 | bellard | |
2640 | 9e61bde5 | bellard | -void hcon_fini (struct hconsole *t)
|
2641 | 9e61bde5 | bellard | +void hcon_fini (__attribute((unused)) struct hconsole *t)
|
2642 | 9e61bde5 | bellard | { |
2643 | 9e61bde5 | bellard | return;
|
2644 | 9e61bde5 | bellard | } |
2645 | 9e61bde5 | bellard | @@ -77,12 +85,12 @@
|
2646 | 9e61bde5 | bellard | { |
2647 | 9e61bde5 | bellard | struct rfont *f = t->f_;
|
2648 | 9e61bde5 | bellard | |
2649 | 9e61bde5 | bellard | - if (sy < 0 || sy >= t->ydim_) return -1;
|
2650 | 9e61bde5 | bellard | - if (sx < 0 || sx >= t->xdim_) return -1;
|
2651 | 9e61bde5 | bellard | + if (sy < 0 || (unsigned)sy >= t->ydim_) return -1;
|
2652 | 9e61bde5 | bellard | + if (sx < 0 || (unsigned)sx >= t->xdim_) return -1;
|
2653 | 9e61bde5 | bellard | if (height < 0) return -1; |
2654 | 9e61bde5 | bellard | - if (sy + height > t->ydim_) height = t->ydim_ - sy;
|
2655 | 9e61bde5 | bellard | + if ((unsigned)sy + (unsigned)height > t->ydim_) height = t->ydim_ - sy;
|
2656 | 9e61bde5 | bellard | if (width < 0) return -1; |
2657 | 9e61bde5 | bellard | - if (sx + width > t->xdim_) width = t->xdim_ - sx;
|
2658 | 9e61bde5 | bellard | + if ((unsigned)sx + (unsigned)width > t->xdim_) width = t->xdim_ - sx;
|
2659 | 9e61bde5 | bellard | |
2660 | 9e61bde5 | bellard | /* XXX Clear with correct background color */
|
2661 | 9e61bde5 | bellard | (*t->r_->clear_)(t->r_, |
2662 | 9e61bde5 | bellard | @@ -107,10 +115,10 @@
|
2663 | 9e61bde5 | bellard | char c0 = c;
|
2664 | 9e61bde5 | bellard | RC_color rfg, rbg; |
2665 | 9e61bde5 | bellard | |
2666 | 9e61bde5 | bellard | - if (y < 0 || y >= t->ydim_) return -1;
|
2667 | 9e61bde5 | bellard | - if (x < 0 || x >= t->xdim_) return -1;
|
2668 | 9e61bde5 | bellard | + if (y < 0 || (unsigned)y >= t->ydim_) return -1;
|
2669 | 9e61bde5 | bellard | + if (x < 0 || (unsigned)x >= t->xdim_) return -1;
|
2670 | 9e61bde5 | bellard | |
2671 | 9e61bde5 | bellard | - if (t->curson_ && t->ypos_ == y && t->xpos_ == x) {
|
2672 | 9e61bde5 | bellard | + if (t->curson_ && t->ypos_ == (unsigned)y && t->xpos_ == (unsigned)x) {
|
2673 | 9e61bde5 | bellard | rfg = t->bg_; rbg = t->fg_; |
2674 | 9e61bde5 | bellard | } else {
|
2675 | 9e61bde5 | bellard | rfg = t->fg_; rbg = t->bg_; |
2676 | 9e61bde5 | bellard | @@ -126,9 +134,9 @@
|
2677 | 9e61bde5 | bellard | { |
2678 | 9e61bde5 | bellard | struct rfont *f = t->f_;
|
2679 | 9e61bde5 | bellard | |
2680 | 9e61bde5 | bellard | - if (y < 0 || y >= t->ydim_) return -1;
|
2681 | 9e61bde5 | bellard | - if (x < 0 || x >= t->xdim_) return -1;
|
2682 | 9e61bde5 | bellard | - if (x + count >= t->xdim_) count = t->xdim_ - x;
|
2683 | 9e61bde5 | bellard | + if (y < 0 || (unsigned)y >= t->ydim_) return -1;
|
2684 | 9e61bde5 | bellard | + if (x < 0 || (unsigned)x >= t->xdim_) return -1;
|
2685 | 9e61bde5 | bellard | + if ((unsigned)x + (unsigned)count >= t->xdim_) count = t->xdim_ - x;
|
2686 | 9e61bde5 | bellard | |
2687 | 9e61bde5 | bellard | (*t->r_->render_)(t->r_, y*f->height_, x*f->width_, |
2688 | 9e61bde5 | bellard | s, count, t->bg_, t->fg_, f); |
2689 | 9e61bde5 | bellard | @@ -200,8 +208,8 @@
|
2690 | 9e61bde5 | bellard | |
2691 | 9e61bde5 | bellard | rc = 0;
|
2692 | 9e61bde5 | bellard | if (dir == SM_UP) {
|
2693 | 9e61bde5 | bellard | - if (d < 0 || d >= t->ydim_) return -1;
|
2694 | 9e61bde5 | bellard | - if (b <= d || b > t->ydim_) return -1;
|
2695 | 9e61bde5 | bellard | + if (d < 0 || (unsigned)d >= t->ydim_) return -1;
|
2696 | 9e61bde5 | bellard | + if (b <= d || (unsigned)b > t->ydim_) return -1;
|
2697 | 9e61bde5 | bellard | if (d + count >= b) count = b - d;
|
2698 | 9e61bde5 | bellard | if (d + count >= b) count = b - d;
|
2699 | 9e61bde5 | bellard | (*t->r_->yscroll_)(t->r_, |
2700 | 9e61bde5 | bellard | @@ -213,8 +221,8 @@
|
2701 | 9e61bde5 | bellard | count*f->height_, raster_qwidth(t->r_), |
2702 | 9e61bde5 | bellard | t->bg_); |
2703 | 9e61bde5 | bellard | } else if (dir == SM_DOWN) { |
2704 | 9e61bde5 | bellard | - if (d < 0 || d >= t->ydim_) return -1;
|
2705 | 9e61bde5 | bellard | - if (b <= d || b > t->ydim_) return -1;
|
2706 | 9e61bde5 | bellard | + if (d < 0 || (unsigned)d >= t->ydim_) return -1;
|
2707 | 9e61bde5 | bellard | + if (b <= d || (unsigned)b > t->ydim_) return -1;
|
2708 | 9e61bde5 | bellard | if (d + count >= b) count = b - d;
|
2709 | 9e61bde5 | bellard | (*t->r_->yscroll_)(t->r_, |
2710 | 9e61bde5 | bellard | d*f->height_, 0,
|
2711 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/hme.c proll-patch-15/src/hme.c
|
2712 | 6d82d04a | bellard | --- proll_18.orig/src/hme.c 2002-07-23 05:52:52.000000000 +0000
|
2713 | 9e61bde5 | bellard | +++ proll-patch-15/src/hme.c 2005-04-16 06:16:20.000000000 +0000
|
2714 | 6d82d04a | bellard | @@ -655,10 +655,10 @@
|
2715 | 6d82d04a | bellard | unsigned int flags, |
2716 | 6d82d04a | bellard | unsigned int addr) |
2717 | 6d82d04a | bellard | { |
2718 | 6d82d04a | bellard | - __asm__ __volatile__("
|
2719 | 6d82d04a | bellard | - stwa %3, [%0] %2
|
2720 | 6d82d04a | bellard | - stwa %4, [%1] %2
|
2721 | 6d82d04a | bellard | -" : /* no outputs */
|
2722 | 6d82d04a | bellard | + __asm__ __volatile__(
|
2723 | 6d82d04a | bellard | + "stwa %3, [%0] %2\n\t"
|
2724 | 6d82d04a | bellard | + "stwa %4, [%1] %2\n\t"
|
2725 | 6d82d04a | bellard | + : /* no outputs */
|
2726 | 6d82d04a | bellard | : "r" (&rp->rx_addr), "r" (&rp->rx_flags), |
2727 | 6d82d04a | bellard | "i" (ASI_PL), "r" (addr), "r" (flags)); |
2728 | 6d82d04a | bellard | } |
2729 | 6d82d04a | bellard | @@ -667,10 +667,10 @@
|
2730 | 6d82d04a | bellard | unsigned int flags, |
2731 | 6d82d04a | bellard | unsigned int addr) |
2732 | 6d82d04a | bellard | { |
2733 | 6d82d04a | bellard | - __asm__ __volatile__("
|
2734 | 6d82d04a | bellard | - stwa %3, [%0] %2
|
2735 | 6d82d04a | bellard | - stwa %4, [%1] %2
|
2736 | 6d82d04a | bellard | -" : /* no outputs */
|
2737 | 6d82d04a | bellard | + __asm__ __volatile__(
|
2738 | 6d82d04a | bellard | + "stwa %3, [%0] %2\n\t"
|
2739 | 6d82d04a | bellard | + "stwa %4, [%1] %2\n\t"
|
2740 | 6d82d04a | bellard | + : /* no outputs */
|
2741 | 6d82d04a | bellard | : "r" (&tp->tx_addr), "r" (&tp->tx_flags), |
2742 | 6d82d04a | bellard | "i" (ASI_PL), "r" (addr), "r" (flags)); |
2743 | 6d82d04a | bellard | } |
2744 | 6d82d04a | bellard | @@ -2404,7 +2404,7 @@
|
2745 | 6d82d04a | bellard | TXD(("[%d]", elem));
|
2746 | 6d82d04a | bellard | this = &txbase[elem]; |
2747 | 6d82d04a | bellard | #ifdef __sparc_v9__
|
2748 | 6d82d04a | bellard | - __asm__ __volatile__("lduwa [%1] %2, %0"
|
2749 | 6d82d04a | bellard | + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
|
2750 | 6d82d04a | bellard | : "=r" (flags)
|
2751 | 6d82d04a | bellard | : "r" (&this->tx_flags), "i" (ASI_PL)); |
2752 | 6d82d04a | bellard | #else
|
2753 | 6d82d04a | bellard | @@ -2447,7 +2447,7 @@
|
2754 | 6d82d04a | bellard | RXD(("RX<"));
|
2755 | 6d82d04a | bellard | this = &rxbase[elem]; |
2756 | 6d82d04a | bellard | #ifdef __sparc_v9__
|
2757 | 6d82d04a | bellard | - __asm__ __volatile__("lduwa [%1] %2, %0"
|
2758 | 6d82d04a | bellard | + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
|
2759 | 6d82d04a | bellard | : "=r" (flags)
|
2760 | 6d82d04a | bellard | : "r" (&this->rx_flags), "i" (ASI_PL)); |
2761 | 6d82d04a | bellard | #else
|
2762 | 6d82d04a | bellard | @@ -2530,7 +2530,7 @@
|
2763 | 6d82d04a | bellard | elem = NEXT_RX(elem); |
2764 | 6d82d04a | bellard | this = &rxbase[elem]; |
2765 | 6d82d04a | bellard | #ifdef __sparc_v9__
|
2766 | 6d82d04a | bellard | - __asm__ __volatile__("lduwa [%1] %2, %0"
|
2767 | 6d82d04a | bellard | + __asm__ __volatile__("lduwa [%1] %2, %0\n\t"
|
2768 | 6d82d04a | bellard | : "=r" (flags)
|
2769 | 6d82d04a | bellard | : "r" (&this->rx_flags), "i" (ASI_PL)); |
2770 | 6d82d04a | bellard | #else
|
2771 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/iommu.c proll-patch-15/src/iommu.c
|
2772 | 9e61bde5 | bellard | --- proll_18.orig/src/iommu.c 2002-07-23 05:52:49.000000000 +0000
|
2773 | 9e61bde5 | bellard | +++ proll-patch-15/src/iommu.c 2005-08-14 10:08:17.000000000 +0000
|
2774 | 9e61bde5 | bellard | @@ -36,7 +36,7 @@
|
2775 | 9e61bde5 | bellard | unsigned int pa, ba; |
2776 | 9e61bde5 | bellard | unsigned int npages; |
2777 | 9e61bde5 | bellard | unsigned int mva, mpa; |
2778 | 9e61bde5 | bellard | - int i;
|
2779 | 9e61bde5 | bellard | + unsigned int i;
|
2780 | 9e61bde5 | bellard | unsigned int *iopte; |
2781 | 9e61bde5 | bellard | |
2782 | 9e61bde5 | bellard | npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
|
2783 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/lat7_2.bm proll-patch-15/src/lat7_2.bm
|
2784 | e80cfcfc | bellard | --- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000
|
2785 | 9e61bde5 | bellard | +++ proll-patch-15/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000
|
2786 | e80cfcfc | bellard | @@ -1,6 +1,6 @@
|
2787 | e80cfcfc | bellard | #define lat7_2_width 128 |
2788 | e80cfcfc | bellard | #define lat7_2_height 88 |
2789 | e80cfcfc | bellard | -static unsigned char lat7_2_bits[] = {
|
2790 | e80cfcfc | bellard | +static unsigned const char lat7_2_bits[] = {
|
2791 | e80cfcfc | bellard | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
2792 | e80cfcfc | bellard | 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18, |
2793 | e80cfcfc | bellard | 0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02, |
2794 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch-15/src/lat7_2_swapped.bm
|
2795 | e80cfcfc | bellard | --- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000
|
2796 | 9e61bde5 | bellard | +++ proll-patch-15/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000
|
2797 | e80cfcfc | bellard | @@ -0,0 +1,121 @@
|
2798 | e80cfcfc | bellard | +#define lat7_2_width 128
|
2799 | e80cfcfc | bellard | +#define lat7_2_height 88
|
2800 | e80cfcfc | bellard | +static unsigned const char lat7_2_bits[] = {
|
2801 | e80cfcfc | bellard | + 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2802 | e80cfcfc | bellard | + 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x2a, 0x00, 0x55, 0x00, 0x00, 0x48,
|
2803 | e80cfcfc | bellard | + 0x48, 0x78, 0x48, 0x5f, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x78, 0x40,
|
2804 | e80cfcfc | bellard | + 0x70, 0x40, 0x4f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x30, 0x40, 0x40,
|
2805 | e80cfcfc | bellard | + 0x40, 0x3e, 0x09, 0x0e, 0x0a, 0x09, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
|
2806 | e80cfcfc | bellard | + 0x7f, 0x08, 0x0e, 0x08, 0x08, 0x00, 0x00, 0x0e, 0x0a, 0x0e, 0x00, 0x00,
|
2807 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00,
|
2808 | e80cfcfc | bellard | + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x54, 0x10, 0x10,
|
2809 | e80cfcfc | bellard | + 0x10, 0x1f, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x1f, 0x04, 0x04, 0x04,
|
2810 | e80cfcfc | bellard | + 0x04, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
2811 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x00,
|
2812 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
|
2813 | e80cfcfc | bellard | + 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
|
2814 | e80cfcfc | bellard | + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00,
|
2815 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
2816 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2817 | e80cfcfc | bellard | + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2818 | e80cfcfc | bellard | + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2819 | e80cfcfc | bellard | + 0x00, 0x00, 0xff, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18,
|
2820 | e80cfcfc | bellard | + 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18,
|
2821 | e80cfcfc | bellard | + 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,
|
2822 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x00,
|
2823 | e80cfcfc | bellard | + 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
|
2824 | e80cfcfc | bellard | + 0x06, 0x0c, 0x18, 0x30, 0x18, 0x6c, 0x36, 0x18, 0x0c, 0x00, 0x00, 0x60,
|
2825 | e80cfcfc | bellard | + 0x30, 0x18, 0x0c, 0x18, 0x36, 0x6c, 0x18, 0x30, 0x00, 0x00, 0x7f, 0x36,
|
2826 | e80cfcfc | bellard | + 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7e,
|
2827 | e80cfcfc | bellard | + 0x18, 0x7e, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x78,
|
2828 | e80cfcfc | bellard | + 0x30, 0x72, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
|
2829 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42,
|
2830 | e80cfcfc | bellard | + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2831 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
|
2832 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x66, 0x66, 0x22, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2833 | e80cfcfc | bellard | + 0x00, 0x00, 0x36, 0x7f, 0x36, 0x36, 0x36, 0x7f, 0x36, 0x00, 0x00, 0x00,
|
2834 | e80cfcfc | bellard | + 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
|
2835 | e80cfcfc | bellard | + 0x72, 0x56, 0x6c, 0x18, 0x36, 0x6a, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x18,
|
2836 | e80cfcfc | bellard | + 0x24, 0x28, 0x30, 0x4a, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
|
2837 | e80cfcfc | bellard | + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18,
|
2838 | e80cfcfc | bellard | + 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x18,
|
2839 | e80cfcfc | bellard | + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x7e, 0x3c,
|
2840 | e80cfcfc | bellard | + 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,
|
2841 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
|
2842 | e80cfcfc | bellard | + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
2843 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
|
2844 | e80cfcfc | bellard | + 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x00,
|
2845 | e80cfcfc | bellard | + 0x00, 0x3c, 0x46, 0x4e, 0x5a, 0x72, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
2846 | e80cfcfc | bellard | + 0x18, 0x38, 0x58, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c,
|
2847 | e80cfcfc | bellard | + 0x66, 0x06, 0x0c, 0x18, 0x32, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
|
2848 | e80cfcfc | bellard | + 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
|
2849 | e80cfcfc | bellard | + 0x66, 0x7e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x7c, 0x66,
|
2850 | e80cfcfc | bellard | + 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66,
|
2851 | e80cfcfc | bellard | + 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x06, 0x0c, 0x18, 0x30,
|
2852 | e80cfcfc | bellard | + 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c,
|
2853 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00,
|
2854 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00,
|
2855 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00,
|
2856 | e80cfcfc | bellard | + 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
|
2857 | e80cfcfc | bellard | + 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
|
2858 | e80cfcfc | bellard | + 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
|
2859 | e80cfcfc | bellard | + 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x5e,
|
2860 | e80cfcfc | bellard | + 0x56, 0x5e, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66,
|
2861 | e80cfcfc | bellard | + 0x7e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x66,
|
2862 | e80cfcfc | bellard | + 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66,
|
2863 | e80cfcfc | bellard | + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c,
|
2864 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x62, 0x7e, 0x00,
|
2865 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00, 0x00,
|
2866 | e80cfcfc | bellard | + 0x00, 0x00, 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00,
|
2867 | e80cfcfc | bellard | + 0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
|
2868 | e80cfcfc | bellard | + 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e,
|
2869 | e80cfcfc | bellard | + 0x46, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6c,
|
2870 | e80cfcfc | bellard | + 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
|
2871 | e80cfcfc | bellard | + 0x60, 0x60, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x41, 0x63, 0x77, 0x7f,
|
2872 | e80cfcfc | bellard | + 0x6b, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x6e,
|
2873 | e80cfcfc | bellard | + 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66,
|
2874 | e80cfcfc | bellard | + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60,
|
2875 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x3c, 0x02,
|
2876 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, 0x00,
|
2877 | e80cfcfc | bellard | + 0x00, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00,
|
2878 | e80cfcfc | bellard | + 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
2879 | e80cfcfc | bellard | + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x66,
|
2880 | e80cfcfc | bellard | + 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63,
|
2881 | e80cfcfc | bellard | + 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c,
|
2882 | e80cfcfc | bellard | + 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c,
|
2883 | e80cfcfc | bellard | + 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x46, 0x0c, 0x18, 0x30,
|
2884 | e80cfcfc | bellard | + 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
|
2885 | e80cfcfc | bellard | + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02,
|
2886 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00,
|
2887 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2888 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
|
2889 | e80cfcfc | bellard | + 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2890 | e80cfcfc | bellard | + 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x60,
|
2891 | e80cfcfc | bellard | + 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2892 | e80cfcfc | bellard | + 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
|
2893 | e80cfcfc | bellard | + 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
|
2894 | e80cfcfc | bellard | + 0x7e, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x78,
|
2895 | e80cfcfc | bellard | + 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66,
|
2896 | e80cfcfc | bellard | + 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66,
|
2897 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x1c, 0x00,
|
2898 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38,
|
2899 | e80cfcfc | bellard | + 0x00, 0x00, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x7c, 0x66, 0x00, 0x00, 0x00,
|
2900 | e80cfcfc | bellard | + 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
|
2901 | e80cfcfc | bellard | + 0x00, 0x00, 0x76, 0x7f, 0x6b, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2902 | e80cfcfc | bellard | + 0x00, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
2903 | e80cfcfc | bellard | + 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
|
2904 | e80cfcfc | bellard | + 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66,
|
2905 | e80cfcfc | bellard | + 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x72, 0x60,
|
2906 | e80cfcfc | bellard | + 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06,
|
2907 | e80cfcfc | bellard | + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x78, 0x30, 0x30, 0x36, 0x1c,
|
2908 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3a, 0x00,
|
2909 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00,
|
2910 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6b, 0x6b, 0x6b, 0x36, 0x00, 0x00, 0x00,
|
2911 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
|
2912 | e80cfcfc | bellard | + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, 0x00, 0x00, 0x00,
|
2913 | e80cfcfc | bellard | + 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18,
|
2914 | e80cfcfc | bellard | + 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18,
|
2915 | e80cfcfc | bellard | + 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x30, 0x18, 0x18, 0x0c,
|
2916 | e80cfcfc | bellard | + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00,
|
2917 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00,
|
2918 | e80cfcfc | bellard | + 0x00, 0x00, 0x00, 0x00};
|
2919 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/le.c proll-patch-15/src/le.c
|
2920 | e80cfcfc | bellard | --- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000
|
2921 | 9e61bde5 | bellard | +++ proll-patch-15/src/le.c 2005-04-16 06:16:20.000000000 +0000
|
2922 | e80cfcfc | bellard | @@ -185,8 +185,6 @@
|
2923 | e80cfcfc | bellard | unsigned short rap; /* register address port */ |
2924 | e80cfcfc | bellard | }; |
2925 | e80cfcfc | bellard | |
2926 | e80cfcfc | bellard | -int sparc_lance_debug = 2;
|
2927 | e80cfcfc | bellard | -
|
2928 | e80cfcfc | bellard | /* The Lance uses 24 bit addresses */
|
2929 | e80cfcfc | bellard | /* On the Sun4c the DVMA will provide the remaining bytes for us */
|
2930 | e80cfcfc | bellard | /* On the Sun4m we have to instruct the ledma to provide them */
|
2931 | 6d82d04a | bellard | @@ -771,7 +769,7 @@
|
2932 | 6d82d04a | bellard | /* Clear the slack of the packet, do I need this? */
|
2933 | 6d82d04a | bellard | /* For a firewall its a good idea - AC */
|
2934 | 6d82d04a | bellard | if (len != skblen)
|
2935 | 6d82d04a | bellard | - bzero((char *) &ib->tx_buf [entry][skblen], len - skblen);
|
2936 | 6d82d04a | bellard | + memset((char *) &ib->tx_buf [entry][skblen], 0, len - skblen);
|
2937 | 6d82d04a | bellard | |
2938 | 6d82d04a | bellard | /* Now, give the packet to the lance */
|
2939 | 6d82d04a | bellard | ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); |
2940 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/net.h proll-patch-15/src/net.h
|
2941 | 9e61bde5 | bellard | --- proll_18.orig/src/net.h 1999-12-15 17:20:17.000000000 +0000
|
2942 | 9e61bde5 | bellard | +++ proll-patch-15/src/net.h 2005-08-14 10:17:02.000000000 +0000
|
2943 | 9e61bde5 | bellard | @@ -124,7 +124,7 @@
|
2944 | 9e61bde5 | bellard | extern int udp_open __P((t_ipaddr daddr, int source, int dest)); |
2945 | 9e61bde5 | bellard | |
2946 | 9e61bde5 | bellard | /* Read from a UDP socket */
|
2947 | 9e61bde5 | bellard | -extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch));
|
2948 | 9e61bde5 | bellard | +extern int udp_read(char *buf, unsigned int bufsize, int timeout);
|
2949 | 9e61bde5 | bellard | |
2950 | 9e61bde5 | bellard | /* Write to a UDP socket */
|
2951 | 9e61bde5 | bellard | extern int udp_write __P((char *buf, int writelen)); |
2952 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/netinit.c proll-patch-15/src/netinit.c
|
2953 | e80cfcfc | bellard | --- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000
|
2954 | 9e61bde5 | bellard | +++ proll-patch-15/src/netinit.c 2004-11-13 15:50:49.000000000 +0000
|
2955 | e80cfcfc | bellard | @@ -49,13 +49,20 @@
|
2956 | e80cfcfc | bellard | unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */ |
2957 | e80cfcfc | bellard | t_ipaddr myipaddr; /* my own IP address */
|
2958 | e80cfcfc | bellard | t_ipaddr mynetmask; /* my own netmask */
|
2959 | e80cfcfc | bellard | - char *net_module_name; /* name of init module */
|
2960 | e80cfcfc | bellard | t_ipaddr servaddr; /* IP of RARP&TFTP server */
|
2961 | e80cfcfc | bellard | |
2962 | e80cfcfc | bellard | /* Broadcast hardware address */
|
2963 | e80cfcfc | bellard | -unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
2964 | e80cfcfc | bellard | +const unsigned char bcasthw[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
2965 | e80cfcfc | bellard | |
2966 | e80cfcfc | bellard | |
2967 | e80cfcfc | bellard | +unsigned int seed;
|
2968 | e80cfcfc | bellard | +
|
2969 | e80cfcfc | bellard | +/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
|
2970 | e80cfcfc | bellard | +short int random()
|
2971 | e80cfcfc | bellard | +{
|
2972 | e80cfcfc | bellard | + seed = (seed + 23968)*0x015A4E35 >> 1;
|
2973 | e80cfcfc | bellard | + return seed & 0x7FFF;
|
2974 | e80cfcfc | bellard | +}
|
2975 | e80cfcfc | bellard | |
2976 | e80cfcfc | bellard | /*
|
2977 | e80cfcfc | bellard | ************************************************************************** |
2978 | e80cfcfc | bellard | @@ -104,10 +111,17 @@
|
2979 | e80cfcfc | bellard | */ |
2980 | e80cfcfc | bellard | void init_net()
|
2981 | e80cfcfc | bellard | { |
2982 | e80cfcfc | bellard | + /* Avoid data segment allocations */
|
2983 | e80cfcfc | bellard | + seed = 151;
|
2984 | e80cfcfc | bellard | +
|
2985 | e80cfcfc | bellard | /* Initialize the different network layer modules */
|
2986 | e80cfcfc | bellard | init_packet(); |
2987 | e80cfcfc | bellard | - if (!init_arp() || !init_udp()) {
|
2988 | e80cfcfc | bellard | - printf("\nERROR: init_%s\n", net_module_name);
|
2989 | e80cfcfc | bellard | + if (!init_arp()) {
|
2990 | e80cfcfc | bellard | + printf("\nERROR: init_arp\n");
|
2991 | e80cfcfc | bellard | + fatal();
|
2992 | e80cfcfc | bellard | + }
|
2993 | e80cfcfc | bellard | + if (!init_udp()) {
|
2994 | e80cfcfc | bellard | + printf("\nERROR: init_udp\n");
|
2995 | e80cfcfc | bellard | fatal(); |
2996 | e80cfcfc | bellard | } |
2997 | e80cfcfc | bellard | } |
2998 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/netpriv.h proll-patch-15/src/netpriv.h
|
2999 | e80cfcfc | bellard | --- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000
|
3000 | 9e61bde5 | bellard | +++ proll-patch-15/src/netpriv.h 2005-08-14 10:12:20.000000000 +0000
|
3001 | 9e61bde5 | bellard | @@ -83,7 +83,7 @@
|
3002 | 9e61bde5 | bellard | */ |
3003 | 9e61bde5 | bellard | struct device *dev;
|
3004 | 9e61bde5 | bellard | char *data;
|
3005 | 9e61bde5 | bellard | - int len;
|
3006 | 9e61bde5 | bellard | + unsigned int len;
|
3007 | 9e61bde5 | bellard | int protocol;
|
3008 | 9e61bde5 | bellard | unsigned char ip_summed; |
3009 | 9e61bde5 | bellard | }; |
3010 | e80cfcfc | bellard | @@ -130,10 +130,9 @@
|
3011 | e80cfcfc | bellard | * |
3012 | e80cfcfc | bellard | */ |
3013 | e80cfcfc | bellard | extern unsigned char myhwaddr[ETH_ALEN]; /* my own hardware address */ |
3014 | e80cfcfc | bellard | -extern unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
|
3015 | e80cfcfc | bellard | +extern const unsigned char bcasthw[ETH_ALEN]; /* broadcast hardware addr */
|
3016 | e80cfcfc | bellard | extern t_ipaddr myipaddr; /* my own IP address */ |
3017 | e80cfcfc | bellard | extern t_ipaddr mynetmask; /* netmask for my network */ |
3018 | e80cfcfc | bellard | -extern char *net_module_name; /* initialized module's name */
|
3019 | e80cfcfc | bellard | extern t_ipaddr servaddr; /* server IP address */ |
3020 | e80cfcfc | bellard | |
3021 | e80cfcfc | bellard | |
3022 | e80cfcfc | bellard | @@ -150,7 +149,7 @@
|
3023 | e80cfcfc | bellard | extern unsigned char *reg_type __P((int typeval, int (* receive)())); |
3024 | e80cfcfc | bellard | |
3025 | e80cfcfc | bellard | /* Write a packet to the network */
|
3026 | e80cfcfc | bellard | -extern int write_packet __P((int bufsize, int typeval, unsigned char *addr));
|
3027 | e80cfcfc | bellard | +extern int write_packet __P((int bufsize, int typeval, const unsigned char *addr));
|
3028 | e80cfcfc | bellard | |
3029 | e80cfcfc | bellard | /* Empty read buffer */
|
3030 | e80cfcfc | bellard | extern void empty_buf __P((void)); |
3031 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/openprom.h proll-patch-15/src/openprom.h
|
3032 | e80cfcfc | bellard | --- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000
|
3033 | 9e61bde5 | bellard | +++ proll-patch-15/src/openprom.h 2005-05-13 16:23:14.000000000 +0000
|
3034 | 9e61bde5 | bellard | @@ -54,29 +54,29 @@
|
3035 | e80cfcfc | bellard | }; |
3036 | e80cfcfc | bellard | |
3037 | e80cfcfc | bellard | struct linux_mem_v0 {
|
3038 | e80cfcfc | bellard | - struct linux_mlist_v0 **v0_totphys;
|
3039 | e80cfcfc | bellard | - struct linux_mlist_v0 **v0_prommap;
|
3040 | e80cfcfc | bellard | - struct linux_mlist_v0 **v0_available; /* What we can use */
|
3041 | e80cfcfc | bellard | + struct linux_mlist_v0 * const *v0_totphys;
|
3042 | e80cfcfc | bellard | + struct linux_mlist_v0 * const *v0_prommap;
|
3043 | e80cfcfc | bellard | + struct linux_mlist_v0 * const *v0_available; /* What we can use */
|
3044 | e80cfcfc | bellard | }; |
3045 | e80cfcfc | bellard | |
3046 | e80cfcfc | bellard | /* Arguments sent to the kernel from the boot prompt. */
|
3047 | e80cfcfc | bellard | struct linux_arguments_v0 {
|
3048 | e80cfcfc | bellard | - char *argv[8];
|
3049 | e80cfcfc | bellard | + const char *argv[8];
|
3050 | e80cfcfc | bellard | char args[100]; |
3051 | e80cfcfc | bellard | char boot_dev[2]; |
3052 | e80cfcfc | bellard | int boot_dev_ctrl;
|
3053 | e80cfcfc | bellard | int boot_dev_unit;
|
3054 | e80cfcfc | bellard | int dev_partition;
|
3055 | e80cfcfc | bellard | - char *kernel_file_name;
|
3056 | e80cfcfc | bellard | + const char *kernel_file_name;
|
3057 | e80cfcfc | bellard | void *aieee1; /* XXX */ |
3058 | e80cfcfc | bellard | }; |
3059 | 8d5f07fa | bellard | |
3060 | 9e61bde5 | bellard | /* V2 and up boot things. */
|
3061 | 9e61bde5 | bellard | struct linux_bootargs_v2 {
|
3062 | 9e61bde5 | bellard | - char **bootpath;
|
3063 | 9e61bde5 | bellard | - char **bootargs;
|
3064 | 9e61bde5 | bellard | - int *fd_stdin;
|
3065 | 9e61bde5 | bellard | - int *fd_stdout;
|
3066 | 9e61bde5 | bellard | + const char **bootpath;
|
3067 | 9e61bde5 | bellard | + const char **bootargs;
|
3068 | 9e61bde5 | bellard | + const int *fd_stdin;
|
3069 | 9e61bde5 | bellard | + const int *fd_stdout;
|
3070 | 9e61bde5 | bellard | }; |
3071 | 9e61bde5 | bellard | |
3072 | 9e61bde5 | bellard | /* The top level PROM vector. */
|
3073 | e80cfcfc | bellard | @@ -91,13 +91,13 @@
|
3074 | e80cfcfc | bellard | struct linux_mem_v0 pv_v0mem;
|
3075 | 8d5f07fa | bellard | |
3076 | e80cfcfc | bellard | /* Node operations. */
|
3077 | e80cfcfc | bellard | - struct linux_nodeops *pv_nodeops;
|
3078 | e80cfcfc | bellard | + const struct linux_nodeops *pv_nodeops;
|
3079 | e80cfcfc | bellard | |
3080 | e80cfcfc | bellard | char **pv_bootstr;
|
3081 | e80cfcfc | bellard | struct linux_dev_v0_funcs pv_v0devops;
|
3082 | e80cfcfc | bellard | |
3083 | e80cfcfc | bellard | - char *pv_stdin;
|
3084 | e80cfcfc | bellard | - char *pv_stdout;
|
3085 | e80cfcfc | bellard | + const char *pv_stdin;
|
3086 | e80cfcfc | bellard | + const char *pv_stdout;
|
3087 | e80cfcfc | bellard | #define PROMDEV_KBD 0 /* input from keyboard */ |
3088 | e80cfcfc | bellard | #define PROMDEV_SCREEN 0 /* output to screen */ |
3089 | e80cfcfc | bellard | #define PROMDEV_TTYA 1 /* in/out to ttya */ |
3090 | e80cfcfc | bellard | @@ -127,7 +127,7 @@
|
3091 | e80cfcfc | bellard | void (*v2_eval)(char *str); |
3092 | e80cfcfc | bellard | } pv_fortheval; |
3093 | e80cfcfc | bellard | |
3094 | e80cfcfc | bellard | - struct linux_arguments_v0 **pv_v0bootargs;
|
3095 | e80cfcfc | bellard | + const struct linux_arguments_v0 * const *pv_v0bootargs;
|
3096 | e80cfcfc | bellard | |
3097 | e80cfcfc | bellard | /* Get ether address. */
|
3098 | e80cfcfc | bellard | unsigned int (*pv_enaddr)(int d, char *enaddr); |
3099 | e80cfcfc | bellard | @@ -175,7 +175,7 @@
|
3100 | e80cfcfc | bellard | int (*no_proplen)(int node, char *name); |
3101 | e80cfcfc | bellard | int (*no_getprop)(int node, char *name, char *val); |
3102 | e80cfcfc | bellard | int (*no_setprop)(int node, char *name, char *val, int len); |
3103 | e80cfcfc | bellard | - char * (*no_nextprop)(int node, char *name);
|
3104 | e80cfcfc | bellard | + const char * (*no_nextprop)(int node, char *name);
|
3105 | e80cfcfc | bellard | }; |
3106 | e80cfcfc | bellard | |
3107 | e80cfcfc | bellard | /* More fun PROM structures for device probing. */
|
3108 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/packet.c proll-patch-15/src/packet.c
|
3109 | e80cfcfc | bellard | --- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000
|
3110 | 9e61bde5 | bellard | +++ proll-patch-15/src/packet.c 2005-08-14 10:12:49.000000000 +0000
|
3111 | e80cfcfc | bellard | @@ -41,7 +41,7 @@
|
3112 | e80cfcfc | bellard | int aligner;
|
3113 | e80cfcfc | bellard | } wbuf; |
3114 | e80cfcfc | bellard | static struct sk_buff *rskb; |
3115 | e80cfcfc | bellard | -static int nqskb = 0;
|
3116 | e80cfcfc | bellard | +static int nqskb;
|
3117 | e80cfcfc | bellard | |
3118 | e80cfcfc | bellard | |
3119 | e80cfcfc | bellard | void init_packet()
|
3120 | e80cfcfc | bellard | @@ -62,6 +62,8 @@
|
3121 | e80cfcfc | bellard | for (i = 0; i < MAXSKBS; i++) { |
3122 | e80cfcfc | bellard | skev[i].skb.allocn = i; |
3123 | e80cfcfc | bellard | } |
3124 | e80cfcfc | bellard | +
|
3125 | e80cfcfc | bellard | + nqskb = 0;
|
3126 | e80cfcfc | bellard | } |
3127 | e80cfcfc | bellard | |
3128 | e80cfcfc | bellard | unsigned char *reg_type(int ptype, int (*func)()) |
3129 | e80cfcfc | bellard | @@ -81,7 +83,7 @@
|
3130 | e80cfcfc | bellard | return wbuf.s;
|
3131 | e80cfcfc | bellard | } |
3132 | e80cfcfc | bellard | |
3133 | e80cfcfc | bellard | -int write_packet(int leng, int type, unsigned char *dst)
|
3134 | e80cfcfc | bellard | +int write_packet(int leng, int type, const unsigned char *dst)
|
3135 | e80cfcfc | bellard | { |
3136 | e80cfcfc | bellard | struct sk_buff *skb;
|
3137 | e80cfcfc | bellard | unsigned char *s; |
3138 | 9e61bde5 | bellard | @@ -209,12 +211,12 @@
|
3139 | 9e61bde5 | bellard | /*
|
3140 | 9e61bde5 | bellard | */ |
3141 | 9e61bde5 | bellard | void
|
3142 | 9e61bde5 | bellard | -eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, int base)
|
3143 | 9e61bde5 | bellard | +eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int len, __attribute__((unused)) int base)
|
3144 | 9e61bde5 | bellard | { |
3145 | 9e61bde5 | bellard | bcopy(src, dest->data, len); |
3146 | 9e61bde5 | bellard | } |
3147 | 9e61bde5 | bellard | |
3148 | 9e61bde5 | bellard | -unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev)
|
3149 | 9e61bde5 | bellard | +unsigned short eth_type_trans(struct sk_buff *skb, __attribute__((unused)) struct device *dev)
|
3150 | 9e61bde5 | bellard | { |
3151 | 9e61bde5 | bellard | unsigned char *s = skb->data + 12; |
3152 | 9e61bde5 | bellard | return s[0] << 8 | s[1]; /* Network order word */ |
3153 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/printf.c proll-patch-15/src/printf.c
|
3154 | e80cfcfc | bellard | --- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000
|
3155 | 9e61bde5 | bellard | +++ proll-patch-15/src/printf.c 2005-08-14 10:07:26.000000000 +0000
|
3156 | e80cfcfc | bellard | @@ -19,7 +19,7 @@
|
3157 | e80cfcfc | bellard | static void printn(struct prf_fp *, unsigned long, unsigned int); |
3158 | e80cfcfc | bellard | static void putchar(char, struct prf_fp *); |
3159 | e80cfcfc | bellard | |
3160 | e80cfcfc | bellard | -static char hextab[] = "0123456789ABCDEF";
|
3161 | e80cfcfc | bellard | +static const char hextab[] = "0123456789ABCDEF";
|
3162 | e80cfcfc | bellard | |
3163 | e80cfcfc | bellard | /*
|
3164 | e80cfcfc | bellard | * Scaled down version of C Library printf. |
3165 | e80cfcfc | bellard | @@ -41,7 +41,7 @@
|
3166 | e80cfcfc | bellard | void
|
3167 | e80cfcfc | bellard | prf(struct prf_fp *filog, char *fmt, va_list adx) |
3168 | e80cfcfc | bellard | { |
3169 | e80cfcfc | bellard | - register c;
|
3170 | e80cfcfc | bellard | + register int c;
|
3171 | e80cfcfc | bellard | char *s;
|
3172 | e80cfcfc | bellard | |
3173 | e80cfcfc | bellard | for(;;) {
|
3174 | e80cfcfc | bellard | @@ -60,7 +60,7 @@
|
3175 | e80cfcfc | bellard | putchar(va_arg(adx,unsigned), filog);
|
3176 | e80cfcfc | bellard | } else if(c == 's') { |
3177 | e80cfcfc | bellard | s = va_arg(adx,char*);
|
3178 | e80cfcfc | bellard | - while(c = *s++)
|
3179 | e80cfcfc | bellard | + while((c = *s++))
|
3180 | e80cfcfc | bellard | putchar(c,filog); |
3181 | e80cfcfc | bellard | } else if (c == 'l' || c == 'O') { |
3182 | e80cfcfc | bellard | printn(filog, (long)va_arg(adx,long), c=='l'?10:8); |
3183 | 9e61bde5 | bellard | @@ -77,10 +77,6 @@
|
3184 | 9e61bde5 | bellard | char prbuf[24]; |
3185 | 9e61bde5 | bellard | register char *cp; |
3186 | 9e61bde5 | bellard | |
3187 | 9e61bde5 | bellard | - if (b == 10 && n < 0) {
|
3188 | 9e61bde5 | bellard | - putchar('-',filog);
|
3189 | 9e61bde5 | bellard | - n = (~n) + 1; /* n = -n */
|
3190 | 9e61bde5 | bellard | - }
|
3191 | 9e61bde5 | bellard | cp = prbuf; |
3192 | 9e61bde5 | bellard | do
|
3193 | 9e61bde5 | bellard | *cp++ = hextab[(unsigned int)(n%b)]; |
3194 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/rconsole.c proll-patch-15/src/rconsole.c
|
3195 | e80cfcfc | bellard | --- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000
|
3196 | 9e61bde5 | bellard | +++ proll-patch-15/src/rconsole.c 2005-08-14 10:25:53.000000000 +0000
|
3197 | e80cfcfc | bellard | @@ -28,12 +28,18 @@
|
3198 | e80cfcfc | bellard | * move to California. Only plain lat7 survived. |
3199 | e80cfcfc | bellard | * I recreated lat7-1 changes in lat7-2. --zaitcev |
3200 | e80cfcfc | bellard | */ |
3201 | 8d5f07fa | bellard | +#ifdef ORIG
|
3202 | e80cfcfc | bellard | #include "lat7_2.bm" /* lat7_1.bm */ |
3203 | 8d5f07fa | bellard | +#else
|
3204 | e80cfcfc | bellard | +#include "lat7_2_swapped.bm" /* lat7_1.bm */
|
3205 | 8d5f07fa | bellard | +#endif
|
3206 | e80cfcfc | bellard | #define LAT7_NCHARS 128 |
3207 | e80cfcfc | bellard | #define LAT7_HEIGHT 11 |
3208 | e80cfcfc | bellard | #define LAT7_WIDTH 8 |
3209 | 8d5f07fa | bellard | |
3210 | e80cfcfc | bellard | +#ifdef ORIG
|
3211 | e80cfcfc | bellard | static Rf_scan lat7_body[ LAT7_NCHARS*LAT7_HEIGHT ];
|
3212 | e80cfcfc | bellard | +#endif
|
3213 | 8d5f07fa | bellard | |
3214 | e80cfcfc | bellard | #if 1 |
3215 | e80cfcfc | bellard | /*
|
3216 | 6d82d04a | bellard | @@ -46,18 +52,18 @@
|
3217 | 6d82d04a | bellard | #endif
|
3218 | 6d82d04a | bellard | |
3219 | 6d82d04a | bellard | static __inline__ void stfb_w(void *ptr, unsigned int data) { |
3220 | 6d82d04a | bellard | - __asm__ __volatile__ ("sta %0, [%1] %2" : :
|
3221 | 6d82d04a | bellard | + __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : :
|
3222 | 6d82d04a | bellard | "r" (data), "r" (ptr), "i" (ASI_M_BYPASS)); |
3223 | 6d82d04a | bellard | } |
3224 | 6d82d04a | bellard | |
3225 | 6d82d04a | bellard | static __inline__ void stfb_b(void *ptr, unsigned int data) { |
3226 | 6d82d04a | bellard | - __asm__ __volatile__ ("stba %0, [%1] %2" : :
|
3227 | 6d82d04a | bellard | + __asm__ __volatile__ ("stba %0, [%1] %2\n\t" : :
|
3228 | 6d82d04a | bellard | "r" (data), "r" (ptr), "i" (ASI_M_BYPASS)); |
3229 | 6d82d04a | bellard | } |
3230 | 6d82d04a | bellard | |
3231 | 6d82d04a | bellard | static __inline__ unsigned int ldfb_w(void *ptr) { |
3232 | 6d82d04a | bellard | unsigned int data; |
3233 | 6d82d04a | bellard | - __asm__ __volatile__ ("lda [%1] %2, %0" :
|
3234 | 6d82d04a | bellard | + __asm__ __volatile__ ("lda [%1] %2, %0\n\t" :
|
3235 | 6d82d04a | bellard | "=r" (data) :
|
3236 | 6d82d04a | bellard | "r" (ptr), "i" (ASI_M_BYPASS)); |
3237 | 6d82d04a | bellard | return data;
|
3238 | 6d82d04a | bellard | @@ -65,7 +71,7 @@
|
3239 | 6d82d04a | bellard | |
3240 | 6d82d04a | bellard | static __inline__ unsigned int ldfb_b(void *ptr) { |
3241 | 6d82d04a | bellard | unsigned int data; |
3242 | 6d82d04a | bellard | - __asm__ __volatile__ ("lduba [%1] %2, %0" :
|
3243 | 6d82d04a | bellard | + __asm__ __volatile__ ("lduba [%1] %2, %0\n\t" :
|
3244 | 6d82d04a | bellard | "=r" (data) :
|
3245 | 6d82d04a | bellard | "r" (ptr), "i" (ASI_M_BYPASS)); |
3246 | 6d82d04a | bellard | return data;
|
3247 | e80cfcfc | bellard | @@ -94,6 +100,7 @@
|
3248 | e80cfcfc | bellard | |
3249 | e80cfcfc | bellard | #endif
|
3250 | e80cfcfc | bellard | |
3251 | e80cfcfc | bellard | +#ifdef ORIG
|
3252 | e80cfcfc | bellard | static inline int swapbits(int w0) |
3253 | e80cfcfc | bellard | { |
3254 | e80cfcfc | bellard | int w1 = 0; |
3255 | e80cfcfc | bellard | @@ -105,13 +112,16 @@
|
3256 | e80cfcfc | bellard | } |
3257 | e80cfcfc | bellard | return w1;
|
3258 | e80cfcfc | bellard | } |
3259 | e80cfcfc | bellard | +#endif
|
3260 | e80cfcfc | bellard | |
3261 | e80cfcfc | bellard | void font_cons_7(struct rfont *p) |
3262 | e80cfcfc | bellard | { |
3263 | e80cfcfc | bellard | +#ifdef ORIG
|
3264 | e80cfcfc | bellard | int x;
|
3265 | e80cfcfc | bellard | int col = 0; |
3266 | e80cfcfc | bellard | int row = 0; |
3267 | e80cfcfc | bellard | int erow = 0; |
3268 | e80cfcfc | bellard | +
|
3269 | e80cfcfc | bellard | for (x = 0; x < LAT7_NCHARS*LAT7_HEIGHT; x++ ) { |
3270 | e80cfcfc | bellard | lat7_body[ (erow * lat7_2_width/8 + col) * LAT7_HEIGHT + row ] =
|
3271 | e80cfcfc | bellard | swapbits(lat7_2_bits[x]) & 0xFF;
|
3272 | e80cfcfc | bellard | @@ -124,6 +134,9 @@
|
3273 | e80cfcfc | bellard | } |
3274 | e80cfcfc | bellard | } |
3275 | e80cfcfc | bellard | p->body_ = lat7_body; |
3276 | e80cfcfc | bellard | +#else
|
3277 | e80cfcfc | bellard | + p->body_ = lat7_2_bits;
|
3278 | e80cfcfc | bellard | +#endif
|
3279 | e80cfcfc | bellard | p->nchars_ = LAT7_NCHARS; |
3280 | e80cfcfc | bellard | p->width_ = LAT7_WIDTH; |
3281 | e80cfcfc | bellard | p->height_ = LAT7_HEIGHT; |
3282 | 9e61bde5 | bellard | @@ -175,7 +188,7 @@
|
3283 | 9e61bde5 | bellard | r->render_ = p->render_; |
3284 | 9e61bde5 | bellard | } |
3285 | 9e61bde5 | bellard | |
3286 | 9e61bde5 | bellard | -void raster_dest(struct raster *r)
|
3287 | 9e61bde5 | bellard | +void raster_dest(__attribute((unused)) struct raster *r)
|
3288 | 9e61bde5 | bellard | { |
3289 | 9e61bde5 | bellard | } |
3290 | 9e61bde5 | bellard | |
3291 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/rconsole.h proll-patch-15/src/rconsole.h
|
3292 | e80cfcfc | bellard | --- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000
|
3293 | 9e61bde5 | bellard | +++ proll-patch-15/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000
|
3294 | e80cfcfc | bellard | @@ -13,10 +13,10 @@
|
3295 | e80cfcfc | bellard | */ |
3296 | e80cfcfc | bellard | |
3297 | e80cfcfc | bellard | #define RF_MAXWIDTH 16 |
3298 | e80cfcfc | bellard | -typedef unsigned short Rf_scan; /* __w16 to be used */
|
3299 | e80cfcfc | bellard | +typedef unsigned char Rf_scan; /* __w16 to be used */
|
3300 | e80cfcfc | bellard | |
3301 | e80cfcfc | bellard | struct rfont {
|
3302 | e80cfcfc | bellard | - Rf_scan *body_;
|
3303 | e80cfcfc | bellard | + const Rf_scan *body_;
|
3304 | e80cfcfc | bellard | int nchars_; /* 128 for ASCII ... 65536 for Unicode */ |
3305 | e80cfcfc | bellard | int width_; /* [Pixels]. Maximum size is 16. */ |
3306 | e80cfcfc | bellard | int height_; /* [Pixels == scan lines]. */ |
3307 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/romlib.h proll-patch-15/src/romlib.h
|
3308 | e80cfcfc | bellard | --- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000
|
3309 | 9e61bde5 | bellard | +++ proll-patch-15/src/romlib.h 2005-04-16 20:32:49.000000000 +0000
|
3310 | 6d82d04a | bellard | @@ -72,13 +72,13 @@
|
3311 | 6d82d04a | bellard | */ |
3312 | e80cfcfc | bellard | #define memcpy(dst, src, len) bcopy(src, dst, len)
|
3313 | e80cfcfc | bellard | #define memcmp(x1, x2, len) bcmp(x1, x2, len)
|
3314 | 6d82d04a | bellard | -#define memset(p, len, zero) bzero(p, len)
|
3315 | e80cfcfc | bellard | -extern void bcopy(void *b1, void *b2, int length);
|
3316 | e80cfcfc | bellard | -extern int bcmp(void *b1, void *b2, int length);
|
3317 | 6d82d04a | bellard | -extern void bzero(void *b, int c);
|
3318 | e80cfcfc | bellard | +extern void bcopy(const void *b1, void *b2, int length);
|
3319 | e80cfcfc | bellard | +extern int bcmp(const void *b1, const void *b2, int length);
|
3320 | 6d82d04a | bellard | +typedef unsigned int size_t;
|
3321 | 6d82d04a | bellard | +extern void *memset(void *p, int c, size_t len);
|
3322 | e80cfcfc | bellard | /* gcc complains about "conflicting types for builtin function strlen". */
|
3323 | e80cfcfc | bellard | #define strlen(s) ssize(s)
|
3324 | e80cfcfc | bellard | -extern int ssize(char *s);
|
3325 | e80cfcfc | bellard | +extern int ssize(const char *s);
|
3326 | e80cfcfc | bellard | |
3327 | e80cfcfc | bellard | |
3328 | e80cfcfc | bellard | /*
|
3329 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/sched_4m.c proll-patch-15/src/sched_4m.c
|
3330 | e80cfcfc | bellard | --- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000
|
3331 | 9e61bde5 | bellard | +++ proll-patch-15/src/sched_4m.c 2005-08-14 10:18:14.000000000 +0000
|
3332 | e80cfcfc | bellard | @@ -108,7 +108,7 @@
|
3333 | e80cfcfc | bellard | static int set_bolt; /* Tick counter limit */ |
3334 | e80cfcfc | bellard | static struct handsc hndv[16]; |
3335 | e80cfcfc | bellard | |
3336 | e80cfcfc | bellard | -static unsigned int intr_to_mask[16] = {
|
3337 | e80cfcfc | bellard | +static unsigned const int intr_to_mask[16] = {
|
3338 | e80cfcfc | bellard | 0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0, |
3339 | e80cfcfc | bellard | 0, 0, 0, 0, 0, 0, 0, 0, |
3340 | 8d5f07fa | bellard | }; |
3341 | 9e61bde5 | bellard | @@ -130,7 +130,7 @@
|
3342 | 9e61bde5 | bellard | int /* 0 - not expired yet; <>0 - timer expired */ |
3343 | 9e61bde5 | bellard | chk_timeout() |
3344 | 9e61bde5 | bellard | { |
3345 | 9e61bde5 | bellard | - int lim = (((1000000/HZ) + 1) << 10);
|
3346 | 9e61bde5 | bellard | + unsigned int lim = (((1000000/HZ) + 1) << 10);
|
3347 | 9e61bde5 | bellard | unsigned int clear; |
3348 | 9e61bde5 | bellard | unsigned int intc; |
3349 | 9e61bde5 | bellard | int n;
|
3350 | 9e61bde5 | bellard | @@ -182,7 +182,7 @@
|
3351 | 9e61bde5 | bellard | struct handsc *hndp;
|
3352 | 9e61bde5 | bellard | unsigned int mask; |
3353 | 9e61bde5 | bellard | |
3354 | 9e61bde5 | bellard | - if (irq < 0 || irq >= 16) {
|
3355 | 9e61bde5 | bellard | + if (irq == 0 || irq >= 16) {
|
3356 | 9e61bde5 | bellard | printk("request_irq: bad irq %d\n", irq);
|
3357 | 9e61bde5 | bellard | return -1; |
3358 | 9e61bde5 | bellard | } |
3359 | 9e61bde5 | bellard | @@ -207,7 +207,7 @@
|
3360 | 9e61bde5 | bellard | { |
3361 | 9e61bde5 | bellard | struct handsc *hndp;
|
3362 | 9e61bde5 | bellard | |
3363 | 9e61bde5 | bellard | - if (irq < 0 || irq >= 16) {
|
3364 | 9e61bde5 | bellard | + if (irq == 0 || irq >= 16) {
|
3365 | 9e61bde5 | bellard | printk("free_irq: bad irq %d\n", irq);
|
3366 | 9e61bde5 | bellard | return;
|
3367 | 9e61bde5 | bellard | } |
3368 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/swap.c proll-patch-15/src/swap.c
|
3369 | e80cfcfc | bellard | --- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000
|
3370 | 9e61bde5 | bellard | +++ proll-patch-15/src/swap.c 2004-11-13 15:50:49.000000000 +0000
|
3371 | e80cfcfc | bellard | @@ -0,0 +1,21 @@
|
3372 | e80cfcfc | bellard | +// Convert the lat7 font so that no conversion is needed at runtime.
|
3373 | e80cfcfc | bellard | +#define ORIG
|
3374 | e80cfcfc | bellard | +#include "rconsole.c"
|
3375 | e80cfcfc | bellard | +
|
3376 | e80cfcfc | bellard | +#include <stdio.h>
|
3377 | e80cfcfc | bellard | +
|
3378 | e80cfcfc | bellard | +int main()
|
3379 | e80cfcfc | bellard | +{
|
3380 | e80cfcfc | bellard | + struct rfont p;
|
3381 | e80cfcfc | bellard | + int i;
|
3382 | e80cfcfc | bellard | +
|
3383 | e80cfcfc | bellard | + font_cons_7(&p);
|
3384 | e80cfcfc | bellard | +
|
3385 | e80cfcfc | bellard | + printf(" ");
|
3386 | e80cfcfc | bellard | + for (i = 0; i < LAT7_NCHARS*LAT7_HEIGHT; i++) {
|
3387 | e80cfcfc | bellard | + printf("0x%02x, ", p.body_[i]);
|
3388 | e80cfcfc | bellard | + if ((i % 12) == 11)
|
3389 | e80cfcfc | bellard | + printf("\n ");
|
3390 | e80cfcfc | bellard | + }
|
3391 | e80cfcfc | bellard | + printf("\n");
|
3392 | e80cfcfc | bellard | +}
|
3393 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/system.c proll-patch-15/src/system.c
|
3394 | e80cfcfc | bellard | --- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000
|
3395 | 9e61bde5 | bellard | +++ proll-patch-15/src/system.c 2005-04-16 06:16:20.000000000 +0000
|
3396 | e80cfcfc | bellard | @@ -298,8 +298,8 @@
|
3397 | e80cfcfc | bellard | } |
3398 | e80cfcfc | bellard | |
3399 | e80cfcfc | bellard | /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */
|
3400 | e80cfcfc | bellard | - pa = PAGE_SIZE;
|
3401 | e80cfcfc | bellard | - for (va = PAGE_SIZE; va < LOWMEMSZ; va += PAGE_SIZE) {
|
3402 | e80cfcfc | bellard | + pa = 0;
|
3403 | e80cfcfc | bellard | + for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) {
|
3404 | e80cfcfc | bellard | map_page(l1, va, pa, 0, highbase);
|
3405 | e80cfcfc | bellard | pa += PAGE_SIZE; |
3406 | e80cfcfc | bellard | } |
3407 | 6d82d04a | bellard | @@ -507,30 +507,44 @@
|
3408 | 6d82d04a | bellard | { |
3409 | 6d82d04a | bellard | char *p;
|
3410 | 6d82d04a | bellard | |
3411 | 6d82d04a | bellard | - if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size);
|
3412 | 6d82d04a | bellard | + if ((p = mem_alloc(t, size, align)) != 0) memset(p, 0, size);
|
3413 | 6d82d04a | bellard | return p;
|
3414 | 6d82d04a | bellard | } |
3415 | 6d82d04a | bellard | |
3416 | 6d82d04a | bellard | /*
|
3417 | 6d82d04a | bellard | * Library functions |
3418 | 6d82d04a | bellard | */ |
3419 | 6d82d04a | bellard | -void bzero(void *s, int len) {
|
3420 | 6d82d04a | bellard | - while (len--) *((char *)s)++ = 0;
|
3421 | 6d82d04a | bellard | +void *memset(void *s, int c, size_t len)
|
3422 | 6d82d04a | bellard | +{
|
3423 | 6d82d04a | bellard | + void *p = s;
|
3424 | 6d82d04a | bellard | +
|
3425 | 6d82d04a | bellard | + while (len--) {
|
3426 | 6d82d04a | bellard | + *(char *)s = c;
|
3427 | 6d82d04a | bellard | + s++;
|
3428 | 6d82d04a | bellard | + }
|
3429 | 6d82d04a | bellard | + return p;
|
3430 | e80cfcfc | bellard | } |
3431 | e80cfcfc | bellard | |
3432 | e80cfcfc | bellard | -void bcopy(void *f, void *t, int len) {
|
3433 | 6d82d04a | bellard | - while (len--) *((char *)t)++ = *((char *)f)++;
|
3434 | e80cfcfc | bellard | +void bcopy(const void *f, void *t, int len) {
|
3435 | 6d82d04a | bellard | + while (len--) {
|
3436 | 6d82d04a | bellard | + *(char *)t = *(char *)f;
|
3437 | 6d82d04a | bellard | + f++;
|
3438 | 6d82d04a | bellard | + t++;
|
3439 | 6d82d04a | bellard | + }
|
3440 | e80cfcfc | bellard | } |
3441 | e80cfcfc | bellard | |
3442 | e80cfcfc | bellard | /* Comparison is 7-bit */
|
3443 | e80cfcfc | bellard | -int bcmp(void *s1, void *s2, int len)
|
3444 | e80cfcfc | bellard | +int bcmp(const void *s1, const void *s2, int len)
|
3445 | e80cfcfc | bellard | { |
3446 | e80cfcfc | bellard | int i;
|
3447 | e80cfcfc | bellard | char ch;
|
3448 | 6d82d04a | bellard | |
3449 | 6d82d04a | bellard | while (len--) {
|
3450 | 6d82d04a | bellard | - ch = *((char *)s1)++;
|
3451 | 6d82d04a | bellard | - if ((i = ch - *((char *)s2)++) != 0)
|
3452 | 6d82d04a | bellard | + ch = *(char *)s1;
|
3453 | 6d82d04a | bellard | + i = ch - *(char *)s2;
|
3454 | 6d82d04a | bellard | + s1++;
|
3455 | 6d82d04a | bellard | + s2++;
|
3456 | 6d82d04a | bellard | + if (i != 0)
|
3457 | 6d82d04a | bellard | return i;
|
3458 | 6d82d04a | bellard | if (ch == 0) |
3459 | 6d82d04a | bellard | return 0; |
3460 | 6d82d04a | bellard | @@ -538,8 +552,8 @@
|
3461 | e80cfcfc | bellard | return 0; |
3462 | e80cfcfc | bellard | } |
3463 | e80cfcfc | bellard | |
3464 | e80cfcfc | bellard | -int strlen(char *s) {
|
3465 | e80cfcfc | bellard | - char *p;
|
3466 | e80cfcfc | bellard | +int strlen(const char *s) {
|
3467 | e80cfcfc | bellard | + const char *p;
|
3468 | e80cfcfc | bellard | for (p = s; *p != 0; p++) { } |
3469 | e80cfcfc | bellard | return p - s;
|
3470 | e80cfcfc | bellard | } |
3471 | 6d82d04a | bellard | @@ -560,14 +574,6 @@
|
3472 | e80cfcfc | bellard | va_end(x1); |
3473 | e80cfcfc | bellard | } |
3474 | e80cfcfc | bellard | |
3475 | e80cfcfc | bellard | -/* This is taken from x86 to be used in network kernel. Returns 15 bits. */
|
3476 | e80cfcfc | bellard | -short int random()
|
3477 | e80cfcfc | bellard | -{
|
3478 | e80cfcfc | bellard | - static unsigned int seed = 151;
|
3479 | e80cfcfc | bellard | - seed = (seed + 23968)*0x015A4E35 >> 1;
|
3480 | e80cfcfc | bellard | - return seed & 0x7FFF;
|
3481 | e80cfcfc | bellard | -}
|
3482 | e80cfcfc | bellard | -
|
3483 | e80cfcfc | bellard | void fatal()
|
3484 | e80cfcfc | bellard | { |
3485 | e80cfcfc | bellard | printk("fatal.");
|
3486 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/system.h proll-patch-15/src/system.h
|
3487 | e80cfcfc | bellard | --- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000
|
3488 | 9e61bde5 | bellard | +++ proll-patch-15/src/system.h 2005-04-16 06:16:20.000000000 +0000
|
3489 | e80cfcfc | bellard | @@ -16,7 +16,7 @@
|
3490 | e80cfcfc | bellard | #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */ |
3491 | e80cfcfc | bellard | #define NCTX_SWIFT 0x100 |
3492 | e80cfcfc | bellard | |
3493 | e80cfcfc | bellard | -#define MAX_BANKS 3 /* Allocation for all machines */
|
3494 | e80cfcfc | bellard | +#define MAX_BANKS 8 /* Allocation for all machines */
|
3495 | e80cfcfc | bellard | |
3496 | e80cfcfc | bellard | #ifndef __ASSEMBLY__
|
3497 | e80cfcfc | bellard | struct bank {
|
3498 | 6d82d04a | bellard | @@ -164,10 +164,10 @@
|
3499 | 6d82d04a | bellard | |
3500 | 6d82d04a | bellard | extern __inline__ void setipl(unsigned long __orig_psr) |
3501 | 6d82d04a | bellard | { |
3502 | 6d82d04a | bellard | - __asm__ __volatile__("
|
3503 | 6d82d04a | bellard | - wr %0, 0x0, %%psr
|
3504 | 6d82d04a | bellard | - nop; nop; nop
|
3505 | 6d82d04a | bellard | -" : /* no outputs */
|
3506 | 6d82d04a | bellard | + __asm__ __volatile__(
|
3507 | 6d82d04a | bellard | + "wr %0, 0x0, %%psr\n\t"
|
3508 | 6d82d04a | bellard | + "nop; nop; nop\n\t"
|
3509 | 6d82d04a | bellard | + : /* no outputs */
|
3510 | 6d82d04a | bellard | : "r" (__orig_psr)
|
3511 | 6d82d04a | bellard | : "memory", "cc"); |
3512 | 6d82d04a | bellard | } |
3513 | 6d82d04a | bellard | @@ -176,13 +176,13 @@
|
3514 | 6d82d04a | bellard | { |
3515 | 6d82d04a | bellard | unsigned long tmp; |
3516 | 6d82d04a | bellard | |
3517 | 6d82d04a | bellard | - __asm__ __volatile__("
|
3518 | 6d82d04a | bellard | - rd %%psr, %0
|
3519 | 6d82d04a | bellard | - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
|
3520 | 6d82d04a | bellard | - or %0, %1, %0
|
3521 | 6d82d04a | bellard | - wr %0, 0x0, %%psr
|
3522 | 6d82d04a | bellard | - nop; nop; nop
|
3523 | 6d82d04a | bellard | -" : "=r" (tmp)
|
3524 | 6d82d04a | bellard | + __asm__ __volatile__(
|
3525 | 6d82d04a | bellard | + "rd %%psr, %0\n\t"
|
3526 | 6d82d04a | bellard | + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
|
3527 | 6d82d04a | bellard | + "or %0, %1, %0\n\t"
|
3528 | 6d82d04a | bellard | + "wr %0, 0x0, %%psr\n\t"
|
3529 | 6d82d04a | bellard | + "nop; nop; nop\n\t"
|
3530 | 6d82d04a | bellard | + : "=r" (tmp)
|
3531 | 6d82d04a | bellard | : "i" (PSR_PIL)
|
3532 | 6d82d04a | bellard | : "memory");
|
3533 | 6d82d04a | bellard | } |
3534 | 6d82d04a | bellard | @@ -191,13 +191,13 @@
|
3535 | 6d82d04a | bellard | { |
3536 | 6d82d04a | bellard | unsigned long tmp; |
3537 | 6d82d04a | bellard | |
3538 | 6d82d04a | bellard | - __asm__ __volatile__("
|
3539 | 6d82d04a | bellard | - rd %%psr, %0
|
3540 | 6d82d04a | bellard | - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
|
3541 | 6d82d04a | bellard | - andn %0, %1, %0
|
3542 | 6d82d04a | bellard | - wr %0, 0x0, %%psr
|
3543 | 6d82d04a | bellard | - nop; nop; nop
|
3544 | 6d82d04a | bellard | -" : "=r" (tmp)
|
3545 | 6d82d04a | bellard | + __asm__ __volatile__(
|
3546 | 6d82d04a | bellard | + "rd %%psr, %0\n\t"
|
3547 | 6d82d04a | bellard | + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
|
3548 | 6d82d04a | bellard | + "andn %0, %1, %0\n\t"
|
3549 | 6d82d04a | bellard | + "wr %0, 0x0, %%psr\n\t"
|
3550 | 6d82d04a | bellard | + "nop; nop; nop\n\t"
|
3551 | 6d82d04a | bellard | + : "=r" (tmp)
|
3552 | 6d82d04a | bellard | : "i" (PSR_PIL)
|
3553 | 6d82d04a | bellard | : "memory");
|
3554 | 6d82d04a | bellard | } |
3555 | 6d82d04a | bellard | @@ -214,18 +214,18 @@
|
3556 | 6d82d04a | bellard | { |
3557 | 6d82d04a | bellard | unsigned long retval; |
3558 | 6d82d04a | bellard | |
3559 | 6d82d04a | bellard | - __asm__ __volatile__("
|
3560 | 6d82d04a | bellard | - rd %%psr, %0
|
3561 | 6d82d04a | bellard | - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
|
3562 | 6d82d04a | bellard | - and %0, %2, %%g1
|
3563 | 6d82d04a | bellard | - and %1, %2, %%g2
|
3564 | 6d82d04a | bellard | - xorcc %%g1, %%g2, %%g0
|
3565 | 6d82d04a | bellard | - be 1f
|
3566 | 6d82d04a | bellard | - nop
|
3567 | 6d82d04a | bellard | - wr %0, %2, %%psr
|
3568 | 6d82d04a | bellard | - nop; nop; nop;
|
3569 | 6d82d04a | bellard | -1:
|
3570 | 6d82d04a | bellard | -" : "=r" (retval)
|
3571 | 6d82d04a | bellard | + __asm__ __volatile__(
|
3572 | 6d82d04a | bellard | + "rd %%psr, %0\n\t"
|
3573 | 6d82d04a | bellard | + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
|
3574 | 6d82d04a | bellard | + "and %0, %2, %%g1\n\t"
|
3575 | 6d82d04a | bellard | + "and %1, %2, %%g2\n\t"
|
3576 | 6d82d04a | bellard | + "xorcc %%g1, %%g2, %%g0\n\t"
|
3577 | 6d82d04a | bellard | + "be 1f\n\t"
|
3578 | 6d82d04a | bellard | + "nop\n\t"
|
3579 | 6d82d04a | bellard | + "wr %0, %2, %%psr\n\t"
|
3580 | 6d82d04a | bellard | + "nop; nop; nop;\n\t"
|
3581 | 6d82d04a | bellard | + "1:\n\t"
|
3582 | 6d82d04a | bellard | + : "=r" (retval)
|
3583 | 6d82d04a | bellard | : "r" (__new_psr), "i" (PSR_PIL) |
3584 | 6d82d04a | bellard | : "g1", "g2", "memory", "cc"); |
3585 | 6d82d04a | bellard | |
3586 | 6d82d04a | bellard | @@ -236,13 +236,13 @@
|
3587 | 6d82d04a | bellard | { |
3588 | 6d82d04a | bellard | unsigned long retval; |
3589 | 6d82d04a | bellard | |
3590 | 6d82d04a | bellard | - __asm__ __volatile__("
|
3591 | 6d82d04a | bellard | - rd %%psr, %0
|
3592 | 6d82d04a | bellard | - nop; nop; nop; /* Sun4m + Cypress + SMP bug */
|
3593 | 6d82d04a | bellard | - or %0, %1, %%g1
|
3594 | 6d82d04a | bellard | - wr %%g1, 0x0, %%psr
|
3595 | 6d82d04a | bellard | - nop; nop; nop
|
3596 | 6d82d04a | bellard | -" : "=r" (retval)
|
3597 | 6d82d04a | bellard | + __asm__ __volatile__(
|
3598 | 6d82d04a | bellard | + "rd %%psr, %0\n\t"
|
3599 | 6d82d04a | bellard | + "nop; nop; nop;\n\t" /* Sun4m + Cypress + SMP bug */
|
3600 | 6d82d04a | bellard | + "or %0, %1, %%g1\n\t"
|
3601 | 6d82d04a | bellard | + "wr %%g1, 0x0, %%psr\n\t"
|
3602 | 6d82d04a | bellard | + "nop; nop; nop\n\t"
|
3603 | 6d82d04a | bellard | + : "=r" (retval)
|
3604 | 6d82d04a | bellard | : "i" (PSR_PIL)
|
3605 | 6d82d04a | bellard | : "g1", "memory"); |
3606 | 6d82d04a | bellard | |
3607 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/tftp.c proll-patch-15/src/tftp.c
|
3608 | 9e61bde5 | bellard | --- proll_18.orig/src/tftp.c 2002-09-13 21:53:34.000000000 +0000
|
3609 | 9e61bde5 | bellard | +++ proll-patch-15/src/tftp.c 2005-08-14 10:16:15.000000000 +0000
|
3610 | 9e61bde5 | bellard | @@ -127,7 +127,7 @@
|
3611 | 9e61bde5 | bellard | int len;
|
3612 | 9e61bde5 | bellard | |
3613 | 9e61bde5 | bellard | /* Read packet with timeout */
|
3614 | 9e61bde5 | bellard | - len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT, CHR_ESC);
|
3615 | 9e61bde5 | bellard | + len = udp_read((char *)(&inpbuf), sizeof(inpbuf), TFTP_TIMEOUT);
|
3616 | 9e61bde5 | bellard | if (len == 0) { |
3617 | 9e61bde5 | bellard | printf("TFTP: Timeout\n");
|
3618 | 9e61bde5 | bellard | return(ERR_TIMEOUT);
|
3619 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/udp.c proll-patch-15/src/udp.c
|
3620 | e80cfcfc | bellard | --- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000
|
3621 | 9e61bde5 | bellard | +++ proll-patch-15/src/udp.c 2005-08-14 10:17:19.000000000 +0000
|
3622 | 9e61bde5 | bellard | @@ -76,12 +76,9 @@
|
3623 | 9e61bde5 | bellard | * |
3624 | 9e61bde5 | bellard | * Open a new UDP socket. |
3625 | 9e61bde5 | bellard | */ |
3626 | 9e61bde5 | bellard | -int udp_open(daddr, source, dest)
|
3627 | 9e61bde5 | bellard | -t_ipaddr daddr;
|
3628 | 9e61bde5 | bellard | -int source;
|
3629 | 9e61bde5 | bellard | -int dest;
|
3630 | 9e61bde5 | bellard | +int udp_open(t_ipaddr daddr, int source, int dest)
|
3631 | e80cfcfc | bellard | { |
3632 | e80cfcfc | bellard | - register unsigned char *addr;
|
3633 | 9e61bde5 | bellard | + const unsigned char *addr;
|
3634 | 8d5f07fa | bellard | |
3635 | e80cfcfc | bellard | /* Set global variables */
|
3636 | e80cfcfc | bellard | usource = source; |
3637 | 9e61bde5 | bellard | @@ -101,16 +98,13 @@
|
3638 | 9e61bde5 | bellard | * |
3639 | 9e61bde5 | bellard | * IP receiver routine |
3640 | 9e61bde5 | bellard | */ |
3641 | 9e61bde5 | bellard | -static int ip_recv(buf, bufsize, addr)
|
3642 | 9e61bde5 | bellard | -unsigned char *buf;
|
3643 | 9e61bde5 | bellard | -int bufsize;
|
3644 | 9e61bde5 | bellard | -unsigned char *addr;
|
3645 | 9e61bde5 | bellard | +static int ip_recv(unsigned char *buf, unsigned int bufsize, unsigned char *addr)
|
3646 | 9e61bde5 | bellard | { |
3647 | 9e61bde5 | bellard | struct iphdr *ipp = ((struct iphdr *)buf); |
3648 | 9e61bde5 | bellard | struct udphdr *udpp = ((struct udphdr *)(buf + IP_MIN_HSIZE)); |
3649 | 9e61bde5 | bellard | struct udp_pseudo psehdr;
|
3650 | 9e61bde5 | bellard | |
3651 | 9e61bde5 | bellard | - int size;
|
3652 | 9e61bde5 | bellard | + unsigned int size;
|
3653 | 9e61bde5 | bellard | t_ipaddr dadr; |
3654 | 9e61bde5 | bellard | |
3655 | 9e61bde5 | bellard | #ifdef DEBUG
|
3656 | 9e61bde5 | bellard | @@ -194,13 +188,9 @@
|
3657 | 9e61bde5 | bellard | * |
3658 | 9e61bde5 | bellard | * Read one packet from a UDP socket |
3659 | 9e61bde5 | bellard | */ |
3660 | 9e61bde5 | bellard | -int udp_read(buf, bufsize, timeout, abortch)
|
3661 | 9e61bde5 | bellard | -char *buf;
|
3662 | 9e61bde5 | bellard | -int bufsize;
|
3663 | 9e61bde5 | bellard | -int timeout;
|
3664 | 9e61bde5 | bellard | -char abortch;
|
3665 | 9e61bde5 | bellard | +int udp_read(char *buf, unsigned int bufsize, int timeout)
|
3666 | 9e61bde5 | bellard | { |
3667 | 9e61bde5 | bellard | - int len;
|
3668 | 9e61bde5 | bellard | + unsigned int len;
|
3669 | 9e61bde5 | bellard | |
3670 | 9e61bde5 | bellard | /* Wait until we get something */
|
3671 | 9e61bde5 | bellard | set_timeout(timeout); |
3672 | 9e61bde5 | bellard | @@ -299,9 +289,6 @@
|
3673 | e80cfcfc | bellard | */ |
3674 | e80cfcfc | bellard | int init_udp()
|
3675 | e80cfcfc | bellard | { |
3676 | e80cfcfc | bellard | - /* Set module name for error handling */
|
3677 | e80cfcfc | bellard | - net_module_name = "udp";
|
3678 | e80cfcfc | bellard | -
|
3679 | e80cfcfc | bellard | /* Register IP packet type and set write buffer pointer */
|
3680 | e80cfcfc | bellard | if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL) |
3681 | e80cfcfc | bellard | return(FALSE);
|
3682 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/udp.h proll-patch-15/src/udp.h
|
3683 | 9e61bde5 | bellard | --- proll_18.orig/src/udp.h 2001-12-24 05:12:34.000000000 +0000
|
3684 | 9e61bde5 | bellard | +++ proll-patch-15/src/udp.h 2005-08-14 10:16:40.000000000 +0000
|
3685 | 9e61bde5 | bellard | @@ -53,7 +53,7 @@
|
3686 | 9e61bde5 | bellard | extern int udp_open __P((t_ipaddr daddr, int source, int dest)); |
3687 | 9e61bde5 | bellard | |
3688 | 9e61bde5 | bellard | /* Read from a UDP socket */
|
3689 | 9e61bde5 | bellard | -extern int udp_read __P((char *buf, int bufsize, int timeout, char abortch));
|
3690 | 9e61bde5 | bellard | +extern int udp_read(char *buf, unsigned int bufsize, int timeout);
|
3691 | 9e61bde5 | bellard | |
3692 | 9e61bde5 | bellard | /* Write to a UDP socket */
|
3693 | 9e61bde5 | bellard | extern int udp_write __P((char *buf, int writelen)); |
3694 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/vcons_zs.c proll-patch-15/src/vcons_zs.c
|
3695 | 6f7e9aec | bellard | --- proll_18.orig/src/vcons_zs.c 1970-01-01 00:00:00.000000000 +0000
|
3696 | 9e61bde5 | bellard | +++ proll-patch-15/src/vcons_zs.c 2005-08-14 10:25:51.000000000 +0000
|
3697 | 6f7e9aec | bellard | @@ -0,0 +1,68 @@
|
3698 | 6f7e9aec | bellard | +/**
|
3699 | 6f7e9aec | bellard | + ** Console over 'zs' (Zilog serial port)
|
3700 | 6f7e9aec | bellard | + ** Copyright 1999 Pete Zaitcev
|
3701 | 6f7e9aec | bellard | + ** This code is licensed under GNU General Public License.
|
3702 | 6f7e9aec | bellard | + **/
|
3703 | 6f7e9aec | bellard | +
|
3704 | 6f7e9aec | bellard | +#include "vconsole.h"
|
3705 | 6f7e9aec | bellard | +#include <system.h>
|
3706 | 6f7e9aec | bellard | +
|
3707 | 6f7e9aec | bellard | +#define ZS_DATA 0x02
|
3708 | 6f7e9aec | bellard | +
|
3709 | 6f7e9aec | bellard | +int vcon_zs_init(struct vconterm *t, unsigned int a0)
|
3710 | 6f7e9aec | bellard | +{
|
3711 | 6f7e9aec | bellard | +
|
3712 | 6f7e9aec | bellard | + t->impl = (void *) a0;
|
3713 | 6f7e9aec | bellard | +
|
3714 | 6f7e9aec | bellard | + t->vc_x = 0; t->vc_y = 0;
|
3715 | 6f7e9aec | bellard | + t->backp = 0; t->backc = 0;
|
3716 | 6f7e9aec | bellard | +
|
3717 | 6f7e9aec | bellard | + stb_bypass(a0, 3); // reg 3
|
3718 | 6f7e9aec | bellard | + stb_bypass(a0, 1); // enable rx
|
3719 | 6f7e9aec | bellard | +
|
3720 | 6f7e9aec | bellard | + stb_bypass(a0, 5); // reg 5
|
3721 | 6f7e9aec | bellard | + stb_bypass(a0, 8); // enable tx
|
3722 | 6f7e9aec | bellard | +
|
3723 | 6f7e9aec | bellard | + return 0;
|
3724 | 6f7e9aec | bellard | +}
|
3725 | 6f7e9aec | bellard | +
|
3726 | 6f7e9aec | bellard | +int vcon_zs_putch(struct vconterm *t, char c)
|
3727 | 6f7e9aec | bellard | +{
|
3728 | 6f7e9aec | bellard | + unsigned zs_ptr = (unsigned) t->impl;
|
3729 | 6f7e9aec | bellard | +
|
3730 | 6f7e9aec | bellard | + //while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { }
|
3731 | 6f7e9aec | bellard | + stb_bypass(zs_ptr + ZS_DATA, c);
|
3732 | 6f7e9aec | bellard | + return 0;
|
3733 | 6f7e9aec | bellard | +}
|
3734 | 6f7e9aec | bellard | +
|
3735 | 6f7e9aec | bellard | +int vcon_zs_write(struct vconterm *t, char *data, int leng)
|
3736 | 6f7e9aec | bellard | +{
|
3737 | 6f7e9aec | bellard | + while (leng != 0) {
|
3738 | 6f7e9aec | bellard | + leng--;
|
3739 | 6f7e9aec | bellard | + vcon_zs_putch(t, *data++);
|
3740 | 6f7e9aec | bellard | + }
|
3741 | 6f7e9aec | bellard | + return leng;
|
3742 | 6f7e9aec | bellard | +}
|
3743 | 6f7e9aec | bellard | +
|
3744 | 9e61bde5 | bellard | +int vcon_zs_read(struct vconterm *t, char *data, __attribute((unused)) int leng)
|
3745 | 6f7e9aec | bellard | +{
|
3746 | 6f7e9aec | bellard | + unsigned zs_ptr = (unsigned) t->impl;
|
3747 | 6f7e9aec | bellard | +
|
3748 | 6f7e9aec | bellard | + while ((ldb_bypass(zs_ptr) & 1) != 1) { }
|
3749 | 6f7e9aec | bellard | + *data = ldb_bypass(zs_ptr + ZS_DATA);
|
3750 | 6f7e9aec | bellard | + return 0;
|
3751 | 6f7e9aec | bellard | +}
|
3752 | 6f7e9aec | bellard | +
|
3753 | 6f7e9aec | bellard | +int vcon_zs_getch(struct vconterm *t)
|
3754 | 6f7e9aec | bellard | +{
|
3755 | 6f7e9aec | bellard | + unsigned zs_ptr = (unsigned) t->impl;
|
3756 | 6f7e9aec | bellard | +
|
3757 | 6f7e9aec | bellard | + while ((ldb_bypass(zs_ptr) & 1) != 1) { }
|
3758 | 6d82d04a | bellard | + return ldb_bypass(zs_ptr + ZS_DATA) & 0xff;
|
3759 | 6f7e9aec | bellard | +}
|
3760 | 6f7e9aec | bellard | +
|
3761 | 9e61bde5 | bellard | +void vcon_zs_fini(__attribute((unused)) struct vconterm *t)
|
3762 | 6f7e9aec | bellard | +{
|
3763 | 6f7e9aec | bellard | + /* violent crash in the end */
|
3764 | 6f7e9aec | bellard | + ;
|
3765 | 6f7e9aec | bellard | +}
|
3766 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/vconsole.c proll-patch-15/src/vconsole.c
|
3767 | 6f7e9aec | bellard | --- proll_18.orig/src/vconsole.c 1999-11-08 03:10:28.000000000 +0000
|
3768 | 9e61bde5 | bellard | +++ proll-patch-15/src/vconsole.c 2005-08-14 10:24:49.000000000 +0000
|
3769 | 6d82d04a | bellard | @@ -7,12 +7,17 @@
|
3770 | 6d82d04a | bellard | #include "vconsole.h" |
3771 | 6d82d04a | bellard | |
3772 | 6d82d04a | bellard | #include "hconsole.h" |
3773 | 6d82d04a | bellard | +#include <system.h>
|
3774 | 6d82d04a | bellard | |
3775 | 6d82d04a | bellard | static void vcon_i_cursfeed(struct vconterm *t); |
3776 | 6d82d04a | bellard | static void vcon_i_backflush(struct vconterm *t); |
3777 | 6f7e9aec | bellard | |
3778 | 6f7e9aec | bellard | struct hconsole hcons0;
|
3779 | 6f7e9aec | bellard | |
3780 | 6f7e9aec | bellard | +enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
|
3781 | 6f7e9aec | bellard | + EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
|
3782 | 6f7e9aec | bellard | + ESpalette };
|
3783 | 6f7e9aec | bellard | +
|
3784 | 6f7e9aec | bellard | int vcon_init(struct vconterm *t, unsigned int a0) |
3785 | 6f7e9aec | bellard | { |
3786 | 6f7e9aec | bellard | struct hconsole *hconp;
|
3787 | 6d82d04a | bellard | @@ -25,11 +30,49 @@
|
3788 | 6f7e9aec | bellard | |
3789 | 6f7e9aec | bellard | t->vc_x = 0; t->vc_y = 0; |
3790 | 6f7e9aec | bellard | t->backp = 0; t->backc = 0; |
3791 | 6f7e9aec | bellard | + t->vc_state = ESnormal;
|
3792 | 6f7e9aec | bellard | |
3793 | 6f7e9aec | bellard | hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_); |
3794 | 6f7e9aec | bellard | return 0; |
3795 | 6f7e9aec | bellard | } |
3796 | 6f7e9aec | bellard | |
3797 | 6f7e9aec | bellard | +/*
|
3798 | 6f7e9aec | bellard | + * gotoxy() must verify all boundaries, because the arguments
|
3799 | 6f7e9aec | bellard | + * might also be negative. If the given position is out of
|
3800 | 6f7e9aec | bellard | + * bounds, the cursor is placed at the nearest margin.
|
3801 | 6f7e9aec | bellard | + */
|
3802 | 6f7e9aec | bellard | +static void gotoxy(struct vconterm *vc, int new_x, int new_y)
|
3803 | 6f7e9aec | bellard | +{
|
3804 | 6f7e9aec | bellard | + int max_x, max_y;
|
3805 | 6f7e9aec | bellard | + struct hconsole *hconp = vc->impl;
|
3806 | 6f7e9aec | bellard | +
|
3807 | 6f7e9aec | bellard | + max_x = hcon_qxdim(hconp);
|
3808 | 6f7e9aec | bellard | + max_y = hcon_qydim(hconp);
|
3809 | 6f7e9aec | bellard | +
|
3810 | 6f7e9aec | bellard | + if (new_x < 0)
|
3811 | 6f7e9aec | bellard | + vc->vc_x = 0;
|
3812 | 6f7e9aec | bellard | + else {
|
3813 | 6f7e9aec | bellard | + if (new_x >= max_x)
|
3814 | 6f7e9aec | bellard | + vc->vc_x = max_x - 1;
|
3815 | 6f7e9aec | bellard | + else
|
3816 | 6f7e9aec | bellard | + vc->vc_x = new_x;
|
3817 | 6f7e9aec | bellard | + }
|
3818 | 6f7e9aec | bellard | +
|
3819 | 6f7e9aec | bellard | + if (new_y < 0)
|
3820 | 6f7e9aec | bellard | + vc->vc_y = 0;
|
3821 | 6f7e9aec | bellard | + else if (new_y >= max_y)
|
3822 | 6f7e9aec | bellard | + vc->vc_y = max_y - 1;
|
3823 | 6f7e9aec | bellard | + else
|
3824 | 6f7e9aec | bellard | + vc->vc_y = new_y;
|
3825 | 6f7e9aec | bellard | +
|
3826 | 6f7e9aec | bellard | +}
|
3827 | 6f7e9aec | bellard | +
|
3828 | 6f7e9aec | bellard | +/* for absolute user moves, when decom is set */
|
3829 | 6f7e9aec | bellard | +static void gotoxay(struct vconterm *t, int new_x, int new_y)
|
3830 | 6f7e9aec | bellard | +{
|
3831 | 6f7e9aec | bellard | + gotoxy(t, new_x, new_y);
|
3832 | 6f7e9aec | bellard | +}
|
3833 | 6f7e9aec | bellard | +
|
3834 | 6f7e9aec | bellard | int vcon_write(struct vconterm *t, char *data, int leng) |
3835 | 6f7e9aec | bellard | { |
3836 | 6f7e9aec | bellard | int l = leng;
|
3837 | 9e61bde5 | bellard | @@ -40,29 +83,101 @@
|
3838 | 6f7e9aec | bellard | if (l <= 0) break; |
3839 | 6f7e9aec | bellard | c = *data++; --l; |
3840 | 6f7e9aec | bellard | |
3841 | 6f7e9aec | bellard | - switch (c) {
|
3842 | 6f7e9aec | bellard | - case 0x07: /* Bell */
|
3843 | 6f7e9aec | bellard | - vcon_i_backflush(t);
|
3844 | 6f7e9aec | bellard | - break;
|
3845 | 6f7e9aec | bellard | - case 0x0A: /* Linefeed */
|
3846 | 6f7e9aec | bellard | - vcon_i_backflush(t);
|
3847 | 6f7e9aec | bellard | - vcon_i_cursfeed(t);
|
3848 | 6f7e9aec | bellard | + switch(t->vc_state) {
|
3849 | 6f7e9aec | bellard | + case ESesc:
|
3850 | 6f7e9aec | bellard | + t->vc_state = ESnormal;
|
3851 | 6f7e9aec | bellard | + switch (c) {
|
3852 | 6f7e9aec | bellard | + case '[':
|
3853 | 6f7e9aec | bellard | + t->vc_state = ESsquare;
|
3854 | 6f7e9aec | bellard | + break;
|
3855 | 6f7e9aec | bellard | + case 'M':
|
3856 | 6f7e9aec | bellard | + hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
|
3857 | 6f7e9aec | bellard | + break;
|
3858 | 6d82d04a | bellard | + default:
|
3859 | 9e61bde5 | bellard | + //printk("Unhandled escape code '%c'\n", c);
|
3860 | 6d82d04a | bellard | + break;
|
3861 | 6f7e9aec | bellard | + }
|
3862 | 6f7e9aec | bellard | break;
|
3863 | 6f7e9aec | bellard | - case 0x0D: /* Return */
|
3864 | 6f7e9aec | bellard | - vcon_i_backflush(t);
|
3865 | 6f7e9aec | bellard | - t->vc_x = 0;
|
3866 | 6f7e9aec | bellard | + case ESsquare:
|
3867 | 6f7e9aec | bellard | + for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++)
|
3868 | 6f7e9aec | bellard | + t->vc_par[t->vc_npar] = 0;
|
3869 | 6f7e9aec | bellard | + t->vc_npar = 0;
|
3870 | 6f7e9aec | bellard | + t->vc_state = ESgetpars;
|
3871 | 6f7e9aec | bellard | + case ESgetpars:
|
3872 | 6f7e9aec | bellard | + if (c==';' && t->vc_npar<NPAR-1) {
|
3873 | 6f7e9aec | bellard | + t->vc_npar++;
|
3874 | 6f7e9aec | bellard | + break;
|
3875 | 6f7e9aec | bellard | + } else if (c>='0' && c<='9') {
|
3876 | 6f7e9aec | bellard | + t->vc_par[t->vc_npar] *= 10;
|
3877 | 6f7e9aec | bellard | + t->vc_par[t->vc_npar] += c-'0';
|
3878 | 6f7e9aec | bellard | + break;
|
3879 | 6f7e9aec | bellard | + } else t->vc_state=ESgotpars;
|
3880 | 6f7e9aec | bellard | + case ESgotpars:
|
3881 | 6f7e9aec | bellard | + t->vc_state = ESnormal;
|
3882 | 6f7e9aec | bellard | + switch(c) {
|
3883 | 6f7e9aec | bellard | + case 'H': case 'f':
|
3884 | 6f7e9aec | bellard | + if (t->vc_par[0]) t->vc_par[0]--;
|
3885 | 6f7e9aec | bellard | + if (t->vc_par[1]) t->vc_par[1]--;
|
3886 | 6f7e9aec | bellard | + gotoxay(t, t->vc_par[1], t->vc_par[0]);
|
3887 | 6f7e9aec | bellard | + break;
|
3888 | 6d82d04a | bellard | + case 'J':
|
3889 | 6d82d04a | bellard | + if (t->vc_par[0] == 0) {
|
3890 | 6d82d04a | bellard | + //erase from cursor to end of display
|
3891 | 6d82d04a | bellard | + hcon_clear(hconp, t->vc_y, t->vc_x, hconp->ydim_, hconp->xdim_);
|
3892 | 6d82d04a | bellard | + }
|
3893 | 6d82d04a | bellard | + break;
|
3894 | 6f7e9aec | bellard | + case 'M':
|
3895 | 6f7e9aec | bellard | + hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1);
|
3896 | 6f7e9aec | bellard | + break;
|
3897 | 6d82d04a | bellard | + case 'm':
|
3898 | 6d82d04a | bellard | + break;
|
3899 | 6d82d04a | bellard | + default:
|
3900 | 9e61bde5 | bellard | +#if 0
|
3901 | 9e61bde5 | bellard | + printk("Unhandled escape code '%c', par[%d, %d, %d, %d, %d]\n",
|
3902 | 6d82d04a | bellard | + c, t->vc_par[0], t->vc_par[1], t->vc_par[2], t->vc_par[3], t->vc_par[4]);
|
3903 | 9e61bde5 | bellard | +#endif
|
3904 | 6d82d04a | bellard | + break;
|
3905 | 6f7e9aec | bellard | + }
|
3906 | 6f7e9aec | bellard | break;
|
3907 | 6f7e9aec | bellard | default:
|
3908 | 6f7e9aec | bellard | - if (t->backp == 0) {
|
3909 | 6f7e9aec | bellard | - t->backc = 1;
|
3910 | 6f7e9aec | bellard | - t->backp = data-1;
|
3911 | 6f7e9aec | bellard | - } else {
|
3912 | 6f7e9aec | bellard | - t->backc++;
|
3913 | 6f7e9aec | bellard | - }
|
3914 | 6f7e9aec | bellard | - if (t->vc_x + t->backc >= hcon_qxdim(hconp)) {
|
3915 | 6f7e9aec | bellard | + t->vc_state = ESnormal;
|
3916 | 6f7e9aec | bellard | + switch (c) {
|
3917 | 6f7e9aec | bellard | + case 0x07: /* Bell */
|
3918 | 6f7e9aec | bellard | + vcon_i_backflush(t);
|
3919 | 6f7e9aec | bellard | + break;
|
3920 | 6f7e9aec | bellard | + case 0x08: /* BS */
|
3921 | 6f7e9aec | bellard | + vcon_i_backflush(t);
|
3922 | 6f7e9aec | bellard | + if (t->vc_x > 0)
|
3923 | 6f7e9aec | bellard | + t->vc_x--;
|
3924 | 6f7e9aec | bellard | + break;
|
3925 | 6f7e9aec | bellard | + case 0x0A: /* Linefeed */
|
3926 | 6f7e9aec | bellard | vcon_i_backflush(t); |
3927 | 6f7e9aec | bellard | - t->vc_x = 0;
|
3928 | 6f7e9aec | bellard | vcon_i_cursfeed(t); |
3929 | 6f7e9aec | bellard | + break;
|
3930 | 6f7e9aec | bellard | + case 0x0D: /* Return */
|
3931 | 6f7e9aec | bellard | + vcon_i_backflush(t);
|
3932 | 6f7e9aec | bellard | + t->vc_x = 0;
|
3933 | 6f7e9aec | bellard | + break;
|
3934 | 6f7e9aec | bellard | + case 24: case 26:
|
3935 | 6f7e9aec | bellard | + vcon_i_backflush(t);
|
3936 | 6f7e9aec | bellard | + t->vc_state = ESnormal;
|
3937 | 6f7e9aec | bellard | + break;
|
3938 | 6f7e9aec | bellard | + case 27:
|
3939 | 6f7e9aec | bellard | + vcon_i_backflush(t);
|
3940 | 6f7e9aec | bellard | + t->vc_state = ESesc;
|
3941 | 6f7e9aec | bellard | + break;
|
3942 | 6f7e9aec | bellard | + default:
|
3943 | 6f7e9aec | bellard | + if (t->backp == 0) {
|
3944 | 6f7e9aec | bellard | + t->backc = 1;
|
3945 | 6f7e9aec | bellard | + t->backp = data-1;
|
3946 | 6f7e9aec | bellard | + } else {
|
3947 | 6f7e9aec | bellard | + t->backc++;
|
3948 | 6f7e9aec | bellard | + }
|
3949 | 9e61bde5 | bellard | + if ((unsigned int)t->vc_x + t->backc >= hcon_qxdim(hconp)) {
|
3950 | 6f7e9aec | bellard | + vcon_i_backflush(t);
|
3951 | 6f7e9aec | bellard | + t->vc_x = 0;
|
3952 | 6f7e9aec | bellard | + vcon_i_cursfeed(t);
|
3953 | 6f7e9aec | bellard | + }
|
3954 | 6f7e9aec | bellard | } |
3955 | 6f7e9aec | bellard | } |
3956 | 6f7e9aec | bellard | } |
3957 | 9e61bde5 | bellard | @@ -73,7 +188,7 @@
|
3958 | 9e61bde5 | bellard | static void vcon_i_cursfeed(struct vconterm *t) { |
3959 | 9e61bde5 | bellard | struct hconsole *hconp = t->impl;
|
3960 | 9e61bde5 | bellard | |
3961 | 9e61bde5 | bellard | - if (++t->vc_y >= hcon_qydim(hconp)) {
|
3962 | 9e61bde5 | bellard | + if ((unsigned int)++t->vc_y >= hcon_qydim(hconp)) {
|
3963 | 9e61bde5 | bellard | t->vc_y = hcon_qydim(hconp)-1;
|
3964 | 9e61bde5 | bellard | hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1); |
3965 | 9e61bde5 | bellard | } |
3966 | 9e61bde5 | bellard | @@ -90,22 +205,75 @@
|
3967 | 9e61bde5 | bellard | t->backp = 0; t->backc = 0; |
3968 | 9e61bde5 | bellard | } |
3969 | 9e61bde5 | bellard | |
3970 | 9e61bde5 | bellard | -int vcon_putch(struct vconterm *t, char c)
|
3971 | 9e61bde5 | bellard | +int vcon_putch(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char c)
|
3972 | 9e61bde5 | bellard | { |
3973 | 9e61bde5 | bellard | return -1; |
3974 | 9e61bde5 | bellard | } |
3975 | 9e61bde5 | bellard | |
3976 | 9e61bde5 | bellard | -int vcon_read(struct vconterm *t, char *data, int leng)
|
3977 | 9e61bde5 | bellard | +int vcon_read(__attribute__((unused)) struct vconterm *t, __attribute__((unused)) char *data, __attribute__((unused)) int leng)
|
3978 | 9e61bde5 | bellard | { |
3979 | 6d82d04a | bellard | return 0; |
3980 | 6d82d04a | bellard | } |
3981 | 6d82d04a | bellard | |
3982 | 9e61bde5 | bellard | -int vcon_getch(struct vconterm *t)
|
3983 | 6d82d04a | bellard | +static const unsigned char sunkbd_keycode[128] = {
|
3984 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
3985 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
3986 | 6d82d04a | bellard | + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 8,
|
3987 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
|
3988 | 6d82d04a | bellard | + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
|
3989 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
3990 | 6d82d04a | bellard | + 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '\\', 13,
|
3991 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
3992 | 6d82d04a | bellard | + 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
|
3993 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
3994 | 6d82d04a | bellard | + ' ',
|
3995 | 6d82d04a | bellard | +};
|
3996 | 6d82d04a | bellard | +
|
3997 | 6d82d04a | bellard | +static const unsigned char sunkbd_keycode_shifted[128] = {
|
3998 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
3999 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
4000 | 6d82d04a | bellard | + '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 8,
|
4001 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
|
4002 | 6d82d04a | bellard | + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
|
4003 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
4004 | 6d82d04a | bellard | + 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '|', 13,
|
4005 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
4006 | 6d82d04a | bellard | + 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
|
4007 | 6d82d04a | bellard | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
4008 | 6d82d04a | bellard | + ' ',
|
4009 | 6d82d04a | bellard | +};
|
4010 | 6d82d04a | bellard | +
|
4011 | 6d82d04a | bellard | +static int shiftstate;
|
4012 | 6d82d04a | bellard | +
|
4013 | 9e61bde5 | bellard | +int vcon_getch(__attribute__((unused)) struct vconterm *t)
|
4014 | 6d82d04a | bellard | { |
4015 | 6d82d04a | bellard | - return -1;
|
4016 | 6d82d04a | bellard | + int ch;
|
4017 | 6d82d04a | bellard | +
|
4018 | 6d82d04a | bellard | + while ((ldb_bypass(0x71000004) & 1) != 1) { }
|
4019 | 6d82d04a | bellard | + do {
|
4020 | 6d82d04a | bellard | + ch = ldb_bypass(0x71000006) & 0xff;
|
4021 | 6d82d04a | bellard | + if (ch == 99)
|
4022 | 6d82d04a | bellard | + shiftstate |= 1;
|
4023 | 6d82d04a | bellard | + else if (ch == 110)
|
4024 | 6d82d04a | bellard | + shiftstate |= 2;
|
4025 | 6d82d04a | bellard | + else if (ch == 227)
|
4026 | 6d82d04a | bellard | + shiftstate &= ~1;
|
4027 | 6d82d04a | bellard | + else if (ch == 238)
|
4028 | 6d82d04a | bellard | + shiftstate &= ~2;
|
4029 | 6d82d04a | bellard | + //printk("getch: %d\n", ch);
|
4030 | 6d82d04a | bellard | + }
|
4031 | 6d82d04a | bellard | + while ((ch & 0x80) == 0 || ch == 238 || ch == 227); // Wait for key release
|
4032 | 6d82d04a | bellard | + //printk("getch rel: %d\n", ch);
|
4033 | 6d82d04a | bellard | + ch &= 0x7f;
|
4034 | 6d82d04a | bellard | + if (shiftstate)
|
4035 | 6d82d04a | bellard | + ch = sunkbd_keycode_shifted[ch];
|
4036 | 6d82d04a | bellard | + else
|
4037 | 6d82d04a | bellard | + ch = sunkbd_keycode[ch];
|
4038 | 6d82d04a | bellard | + //printk("getch xlate: %d\n", ch);
|
4039 | 6d82d04a | bellard | + return ch;
|
4040 | 6d82d04a | bellard | } |
4041 | 6d82d04a | bellard | |
4042 | 9e61bde5 | bellard | -void vcon_fini(struct vconterm *t)
|
4043 | 9e61bde5 | bellard | +void vcon_fini(__attribute__((unused)) struct vconterm *t)
|
4044 | 9e61bde5 | bellard | { |
4045 | 9e61bde5 | bellard | /* violent crash in the end */
|
4046 | 9e61bde5 | bellard | ; |
4047 | 9e61bde5 | bellard | diff -ruN proll_18.orig/src/vconsole.h proll-patch-15/src/vconsole.h
|
4048 | 6f7e9aec | bellard | --- proll_18.orig/src/vconsole.h 1999-11-08 00:58:13.000000000 +0000
|
4049 | 9e61bde5 | bellard | +++ proll-patch-15/src/vconsole.h 2005-03-02 12:40:12.000000000 +0000
|
4050 | 6f7e9aec | bellard | @@ -6,6 +6,8 @@
|
4051 | 6f7e9aec | bellard | #ifndef VCONSOLE_H
|
4052 | 6f7e9aec | bellard | #define VCONSOLE_H
|
4053 | 6f7e9aec | bellard | |
4054 | 6f7e9aec | bellard | +#define NPAR 16
|
4055 | 6f7e9aec | bellard | +
|
4056 | 6f7e9aec | bellard | struct vconterm {
|
4057 | 6f7e9aec | bellard | void *impl;
|
4058 | 6f7e9aec | bellard | |
4059 | 6f7e9aec | bellard | @@ -13,6 +15,8 @@
|
4060 | 6f7e9aec | bellard | int backc; /* Same, count */ |
4061 | 6f7e9aec | bellard | |
4062 | 6f7e9aec | bellard | int vc_x, vc_y; /* XXX Make vcon_xxx() to use cellmap->xpos_ */ |
4063 | 6f7e9aec | bellard | + int vc_state;
|
4064 | 6f7e9aec | bellard | + unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
|
4065 | 6f7e9aec | bellard | }; |
4066 | 6f7e9aec | bellard | |
4067 | 6f7e9aec | bellard | int vcon_init(struct vconterm *t, unsigned int a0); |