1 |
diff -ruN proll_18.orig/Makefile proll-patch4/Makefile |
diff -ruN proll_18.orig/Makefile proll-patch7/Makefile |
2 |
--- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000 |
--- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000 |
3 |
+++ proll-patch4/Makefile 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/Makefile 2004-11-13 15:50:49.000000000 +0000 |
4 |
@@ -4,6 +4,7 @@ |
@@ -4,6 +4,7 @@ |
5 |
make -C krups-ser all |
make -C krups-ser all |
6 |
make -C espresso all |
make -C espresso all |
14 |
make -C espresso clean |
make -C espresso clean |
15 |
make -C espresso-ser clean |
make -C espresso-ser clean |
16 |
+ make -C qemu clean |
+ make -C qemu clean |
17 |
diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S |
diff -ruN proll_18.orig/qemu/Makefile proll-patch7/qemu/Makefile |
18 |
|
--- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000 |
19 |
|
+++ proll-patch7/qemu/Makefile 2005-03-02 16:41:50.000000000 +0000 |
20 |
|
@@ -0,0 +1,122 @@ |
21 |
|
+# |
22 |
|
+# proll: |
23 |
|
+# qemu/Makefile - make PROLL for QEMU |
24 |
|
+# $Id$ |
25 |
|
+# |
26 |
|
+# Copyright 1999 Pete Zaitcev |
27 |
|
+# This is Free Software is licensed under terms of GNU General Public License. |
28 |
|
+# |
29 |
|
+ |
30 |
|
+CC = gcc |
31 |
|
+ |
32 |
|
+#CROSS = /usr/local/sparc/bin/sparc-sun-linux- |
33 |
|
+CROSS = sparc-unknown-linux-gnu- |
34 |
|
+ |
35 |
|
+CROSSCC = $(CROSS)gcc |
36 |
|
+CROSSLD = $(CROSS)ld |
37 |
|
+CROSSNM = $(CROSS)nm |
38 |
|
+ |
39 |
|
+RM = /bin/rm -f |
40 |
|
+ELFTOAOUT = elftoaout |
41 |
|
+ |
42 |
|
+# |
43 |
|
+SRC = ../src |
44 |
|
+ |
45 |
|
+# Due to remapping algorithm PROLBASE should be algned on PMD. |
46 |
|
+# We make PROLBASE a define instead of using _start because we |
47 |
|
+# want to shift it to form a PGD entry. A relocatable label will not work. |
48 |
|
+# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>. |
49 |
|
+PROLBASE = 0xffd00000 |
50 |
|
+PROLRODATA = 0xffd07000 |
51 |
|
+PROLDATA = 0xffd09000 |
52 |
|
+PROLSIZE = 240*1024 |
53 |
|
+ |
54 |
|
+# Linux |
55 |
|
+# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6. |
56 |
|
+# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them. |
57 |
|
+# __ANSI__ is supposed to be on by default but it is not. |
58 |
|
+CFLAGS = -O2 -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -g -DQEMU |
59 |
|
+ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g |
60 |
|
+# Solaris or Linux/i386 cross compilation |
61 |
|
+#CFLAGS = -Iinclude -O |
62 |
|
+ |
63 |
|
+LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA) |
64 |
|
+ |
65 |
|
+ALL = proll.aout |
66 |
|
+PROLLEXE = proll.elf |
67 |
|
+ |
68 |
|
+OBJS = head.o wuf.o wof.o main.o $(CONSOLE) \ |
69 |
|
+ printf.o le.o system_qemu.o iommu.o \ |
70 |
|
+ arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o \ |
71 |
|
+ vconsole.o hconsole.o rconsole.o vcons_zs.o |
72 |
|
+ |
73 |
|
+all: $(ALL) |
74 |
|
+ |
75 |
|
+$(PROLLEXE): $(OBJS) |
76 |
|
+ $(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS) |
77 |
|
+ |
78 |
|
+head.o: head.S $(SRC)/phys_jj.h \ |
79 |
|
+ $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h |
80 |
|
+ $(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S |
81 |
|
+ |
82 |
|
+main.o: main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \ |
83 |
|
+ $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \ |
84 |
|
+ $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h |
85 |
|
+ $(CROSSCC) $(CFLAGS) -c $*.c |
86 |
|
+openprom.o: openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \ |
87 |
|
+ $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h |
88 |
|
+ $(CROSSCC) $(CFLAGS) -c $*.c |
89 |
|
+ |
90 |
|
+system_qemu.o: system_qemu.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \ |
91 |
|
+ $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \ |
92 |
|
+ $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h |
93 |
|
+ $(CROSSCC) $(CFLAGS) -c $*.c |
94 |
|
+iommu.o: $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \ |
95 |
|
+ $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h |
96 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
97 |
|
+vconsole.o: $(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h |
98 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
99 |
|
+vcons_zs.o: $(SRC)/vcons_zs.c $(SRC)/vconsole.h $(SRC)/system.h |
100 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
101 |
|
+hconsole.o: $(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h |
102 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
103 |
|
+rconsole.o: $(SRC)/rconsole.c $(SRC)/rconsole.h |
104 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
105 |
|
+printf.o: $(SRC)/printf.c |
106 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
107 |
|
+le.o: $(SRC)/le.c $(SRC)/dma.h $(SRC)/system.h $(SRC)/netpriv.h $(SRC)/romlib.h $(SRC)/general.h $(SRC)/net.h $(SRC)/phys_jj.h |
108 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
109 |
|
+ |
110 |
|
+arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h |
111 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
112 |
|
+netinit.o: $(SRC)/netinit.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h |
113 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
114 |
|
+tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h |
115 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
116 |
|
+udp.o: $(SRC)/udp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h $(SRC)/ip.h $(SRC)/udp.h |
117 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
118 |
|
+packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h |
119 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
120 |
|
+sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h |
121 |
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
122 |
|
+bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \ |
123 |
|
+ $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h |
124 |
|
+ $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c |
125 |
|
+ |
126 |
|
+wuf.o: $(SRC)/wuf.S |
127 |
|
+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S |
128 |
|
+wof.o: $(SRC)/wof.S |
129 |
|
+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S |
130 |
|
+ |
131 |
|
+#genlab.o: genlab.c |
132 |
|
+# $(CC) -c $*.c |
133 |
|
+# |
134 |
|
+#genlab: genlab.o |
135 |
|
+# $(CC) -o genlab genlab.o |
136 |
|
+ |
137 |
|
+clean: |
138 |
|
+ $(RM) $(OBJS) |
139 |
|
+ $(RM) $(PROLLEXE) proll.aout |
140 |
|
+ |
141 |
|
+proll.aout: $(PROLLEXE) |
142 |
|
+ $(ELFTOAOUT) -o proll.aout $(PROLLEXE) |
143 |
|
diff -ruN proll_18.orig/qemu/head.S proll-patch7/qemu/head.S |
144 |
--- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000 |
--- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000 |
145 |
+++ proll-patch4/qemu/head.S 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/qemu/head.S 2005-03-02 15:30:47.000000000 +0000 |
146 |
@@ -0,0 +1,515 @@ |
@@ -0,0 +1,539 @@ |
147 |
+/** |
+/** |
148 |
+ ** Standalone startup code for Linux PROM emulator. |
+ ** Standalone startup code for Linux PROM emulator. |
149 |
+ ** Copyright 1999 Pete A. Zaitcev |
+ ** Copyright 1999 Pete A. Zaitcev |
293 |
+_start: |
+_start: |
294 |
+start: |
+start: |
295 |
+ .globl spill_window_entry, fill_window_entry |
+ .globl spill_window_entry, fill_window_entry |
296 |
|
+ |
297 |
|
+#define EXPORT_TRAP(trap) \ |
298 |
|
+ .globl trap; \ |
299 |
|
+ .type trap,function; \ |
300 |
|
+ .size trap, 16 |
301 |
|
+ |
302 |
|
+EXPORT_TRAP(t_zero) |
303 |
|
+EXPORT_TRAP(t_wovf) |
304 |
|
+EXPORT_TRAP(t_wunf) |
305 |
|
+EXPORT_TRAP(t_irq1) |
306 |
|
+EXPORT_TRAP(t_irq2) |
307 |
|
+EXPORT_TRAP(t_irq3) |
308 |
|
+EXPORT_TRAP(t_irq4) |
309 |
|
+EXPORT_TRAP(t_irq5) |
310 |
|
+EXPORT_TRAP(t_irq6) |
311 |
|
+EXPORT_TRAP(t_irq7) |
312 |
|
+EXPORT_TRAP(t_irq8) |
313 |
|
+EXPORT_TRAP(t_irq9) |
314 |
|
+EXPORT_TRAP(t_irq10) |
315 |
|
+EXPORT_TRAP(t_irq11) |
316 |
|
+EXPORT_TRAP(t_irq12) |
317 |
|
+EXPORT_TRAP(t_irq13) |
318 |
|
+EXPORT_TRAP(t_irq14) |
319 |
|
+EXPORT_TRAP(t_irq15) |
320 |
|
+ |
321 |
+C_LABEL(trapbase): |
+C_LABEL(trapbase): |
322 |
+t_zero: b goprol; nop; nop; nop; |
+t_zero: b goprol; nop; nop; nop; |
323 |
+t_tflt: SRMMU_TFAULT /* Inst. Access Exception */ |
+t_tflt: SRMMU_TFAULT /* Inst. Access Exception */ |
445 |
+ |
+ |
446 |
+goprol: |
+goprol: |
447 |
+ ! %g1 contains end of memory |
+ ! %g1 contains end of memory |
448 |
|
+ set PHYS_JJ_EEPROM + 0x30, %g1 |
449 |
|
+ lda [%g1] ASI_M_BYPASS, %g1 |
450 |
+ ! map PROLDATA to PROLBASE+PROLSIZE to end of ram |
+ ! map PROLDATA to PROLBASE+PROLSIZE to end of ram |
451 |
+ set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables |
+ set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables |
452 |
+ sub %g1, %g2, %g2 ! start of private memory |
+ sub %g1, %g2, %g2 ! start of private memory |
550 |
+ bl 1b |
+ bl 1b |
551 |
+ add %o0, 0x4, %o0 |
+ add %o0, 0x4, %o0 |
552 |
+ |
+ |
|
+ sethi %hi( C_LABEL(ram_size) ), %o0 |
|
|
+ st %g3, [%o0 + %lo( C_LABEL(ram_size) )] |
|
|
+ |
|
553 |
+ mov 2, %g1 |
+ mov 2, %g1 |
554 |
+ wr %g1, 0x0, %wim ! make window 1 invalid |
+ wr %g1, 0x0, %wim ! make window 1 invalid |
555 |
+ WRITE_PAUSE |
+ WRITE_PAUSE |
683 |
+C_LABEL(ldb_bypass): |
+C_LABEL(ldb_bypass): |
684 |
+ retl |
+ retl |
685 |
+ lduba [%o0] ASI_M_BYPASS, %o0 |
+ lduba [%o0] ASI_M_BYPASS, %o0 |
686 |
diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c |
diff -ruN proll_18.orig/qemu/main.c proll-patch7/qemu/main.c |
687 |
--- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000 |
--- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000 |
688 |
+++ proll-patch4/qemu/main.c 2004-11-23 19:05:34.000000000 +0000 |
+++ proll-patch7/qemu/main.c 2005-03-02 20:08:23.000000000 +0000 |
689 |
@@ -0,0 +1,178 @@ |
@@ -0,0 +1,173 @@ |
690 |
+/** |
+/** |
691 |
+ ** Proll (PROM replacement) |
+ ** Proll (PROM replacement) |
692 |
+ ** Copyright 1999 Pete Zaitcev |
+ ** Copyright 1999 Pete Zaitcev |
708 |
+#include <arpa.h> |
+#include <arpa.h> |
709 |
+#include <system.h> /* our own prototypes */ |
+#include <system.h> /* our own prototypes */ |
710 |
+ |
+ |
711 |
|
+void *init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, const char *cmdline, char boot_device, int nographic); |
712 |
|
+int vcon_zs_init(struct vconterm *t, unsigned int a0); |
713 |
|
+int vcon_zs_write(struct vconterm *t, char *data, int leng); |
714 |
|
+ |
715 |
+static void init_idprom(void); |
+static void init_idprom(void); |
|
+static void makepages_q(struct phym *t, unsigned int highbase); |
|
716 |
+ |
+ |
717 |
+struct vconterm dp0; |
+struct vconterm dp0; |
718 |
+struct mem cmem; /* Current memory, virtual */ |
+struct mem cmem; /* Current memory, virtual */ |
720 |
+struct phym pmem; /* Current phys. mem. */ |
+struct phym pmem; /* Current phys. mem. */ |
721 |
+struct iommu ciommu; /* Our IOMMU on sun4m */ |
+struct iommu ciommu; /* Our IOMMU on sun4m */ |
722 |
+ |
+ |
723 |
+static char *hw_idprom; |
+static struct { |
724 |
+int ignore_fault, fault_ignored, ram_size; |
+ const char id[16]; |
725 |
|
+ unsigned int version; |
726 |
|
+ char pad1[0x1c]; // Pad to 0x30 |
727 |
|
+ unsigned int ram_size; |
728 |
|
+ char boot_device; |
729 |
|
+ unsigned int load_addr, kernel_size; |
730 |
|
+ unsigned int cmdline, cmdline_len; |
731 |
|
+ char pad2[0x0c]; // Pad to 0x54 |
732 |
|
+ unsigned short width, height, depth; |
733 |
|
+} *hw_idprom; |
734 |
|
+ |
735 |
|
+int ignore_fault, fault_ignored; |
736 |
|
+void *printk_fn; |
737 |
|
+unsigned int q_height, q_width; |
738 |
+ |
+ |
739 |
+/* |
+/* |
740 |
+ */ |
+ */ |
741 |
+void prolmain() |
+void prolmain() |
742 |
+{ |
+{ |
743 |
+ //static const char fname[14] = "00000000.PROL"; |
+ static char fname[14]; |
744 |
+ static struct banks bb; |
+ static struct banks bb; |
745 |
+ unsigned int hiphybas; |
+ unsigned int hiphybas; |
746 |
+ const void *romvec; |
+ const void *romvec; |
747 |
|
+ unsigned int ram_size; |
748 |
|
+ char nographic; |
749 |
|
+ |
750 |
|
+ nographic = ldb_bypass(PHYS_JJ_EEPROM + 0x2F); |
751 |
|
+ if (!nographic) { |
752 |
|
+ q_width = ldh_bypass(PHYS_JJ_EEPROM + 0x54); |
753 |
|
+ q_height = ldh_bypass(PHYS_JJ_EEPROM + 0x56); |
754 |
|
+ vcon_init(&dp0, PHYS_JJ_TCX_FB); |
755 |
|
+ printk_fn = vcon_write; |
756 |
|
+ } |
757 |
|
+ else { |
758 |
|
+ vcon_zs_init(&dp0, 0x71100000); |
759 |
|
+ printk_fn = vcon_zs_write; |
760 |
|
+ } |
761 |
|
+ |
762 |
+ |
+ |
|
+ vcon_init(&dp0, PHYS_JJ_TCX_FB); |
|
763 |
+ printk("PROLL %s QEMU\n", PROLL_VERSION_STRING); |
+ printk("PROLL %s QEMU\n", PROLL_VERSION_STRING); |
764 |
|
+ ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30); |
765 |
+ printk("%d MB total\n", ram_size/(1024*1024)); |
+ printk("%d MB total\n", ram_size/(1024*1024)); |
766 |
+ |
+ |
767 |
+ bb.nbanks = 1; |
+ bb.nbanks = 1; |
771 |
+ hiphybas = ram_size - PROLSIZE; |
+ hiphybas = ram_size - PROLSIZE; |
772 |
+ |
+ |
773 |
+ mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE)); |
+ mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE)); |
774 |
+ makepages_q(&pmem, hiphybas); |
+ makepages(&pmem, hiphybas); |
775 |
+ init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas); |
+ init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas); |
776 |
+ |
+ |
777 |
+ mem_init(&cio, (char *)(PROLBASE+PROLSIZE), |
+ mem_init(&cio, (char *)(PROLBASE+PROLSIZE), |
782 |
+ /* |
+ /* |
783 |
+ */ |
+ */ |
784 |
+ init_idprom(); |
+ init_idprom(); |
785 |
|
+ printk("NVRAM: id %s version %d\n", hw_idprom->id, hw_idprom->version); |
786 |
|
+ if (!nographic) |
787 |
|
+ printk("Prom console: TCX %dx%d\n", q_width, q_height); |
788 |
|
+ else |
789 |
|
+ printk("Prom console: serial\n"); |
790 |
+ sched_init(); |
+ sched_init(); |
791 |
+ le_probe(); |
+ le_probe(); |
792 |
+ init_net(); |
+ init_net(); |
793 |
+ |
+ |
794 |
+#if 0 |
+ printk("Boot device: %c\n", hw_idprom->boot_device); |
795 |
+#if 0 /* RARP */ |
+ if (hw_idprom->boot_device == 'n') { |
796 |
+ if (rarp() != 0) fatal(); |
+ if (bootp() != 0) fatal(); |
797 |
+ /* printrarp(); */ |
+ /* |
798 |
+ xtoa(myipaddr, fname, 8); |
+ * boot_rec.bp_file cannot be used because system PROM |
799 |
+ if (load(servaddr, fname) != 0) fatal(); |
+ * uses it to locate ourselves. If we load from boot_rec.bp_file, |
800 |
+#else |
+ * we will loop reloading PROLL over and over again. |
801 |
+ if (bootp() != 0) fatal(); |
+ * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L). |
802 |
+ /* |
+ */ |
803 |
+ * boot_rec.bp_file cannot be used because system PROM |
+ xtoa(myipaddr, fname, 8); |
804 |
+ * uses it to locate ourselves. If we load from boot_rec.bp_file, |
+ fname[9] = '.'; |
805 |
+ * we will loop reloading PROLL over and over again. |
+ fname[10] = 'P'; |
806 |
+ * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L). |
+ fname[11] = 'R'; |
807 |
+ */ |
+ fname[12] = 'O'; |
808 |
+ xtoa(myipaddr, fname, 8); |
+ fname[13] = 'L'; |
809 |
+ if (load(boot_rec.bp_siaddr, fname) != 0) fatal(); |
+ fname[14] = 0; |
810 |
+#endif |
+ |
811 |
+#endif |
+ if (load(boot_rec.bp_siaddr, fname) != 0) fatal(); |
812 |
|
+ } |
813 |
+ |
+ |
814 |
+ romvec = init_openprom(bb.nbanks, bb.bankv, hiphybas); |
+ romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas, |
815 |
|
+ (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic); |
816 |
+ |
+ |
817 |
+ printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n", |
+ printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n", |
818 |
+ PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024, |
+ PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024, |
819 |
+ (int)cio.start, (int)cio.curp); |
+ (int)cio.start, (int)cio.curp); |
|
+ //set_timeout(5); while (!chk_timeout()) { } /* P3: let me read */ |
|
820 |
+ |
+ |
821 |
+ { |
+ { |
822 |
+ void (*entry)(const void *, int, int, int, int) = (void (*)(const void*, int, int, int, int)) LOADBASE; |
+ void (*entry)(const void *, int, int, int, int) = (void *) hw_idprom->load_addr; |
823 |
|
+ printk("Kernel loaded at 0x%x, size %dK, command line = '%s'\n", |
824 |
|
+ *entry, hw_idprom->kernel_size/1024, hw_idprom->cmdline); |
825 |
+ entry(romvec, 0, 0, 0, 0); |
+ entry(romvec, 0, 0, 0, 0); |
826 |
+ } |
+ } |
827 |
+ |
+ |
841 |
+ */ |
+ */ |
842 |
+void udelay(unsigned long usecs) |
+void udelay(unsigned long usecs) |
843 |
+{ |
+{ |
844 |
+ int i, n; |
+ // Qemu hardware is perfect and does not need any delays! |
|
+ n = usecs*50; |
|
|
+ for (i = 0; i < n; i++) { } |
|
845 |
+} |
+} |
846 |
+ |
+ |
847 |
+static void init_idprom() |
+static void init_idprom() |
848 |
+{ |
+{ |
849 |
+ char *va_prom; |
+ void *va_prom; |
850 |
+ |
+ |
851 |
+ if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) { |
+ if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) { |
852 |
+ printk("init_idprom: cannot map eeprom\n"); |
+ printk("init_idprom: cannot map eeprom\n"); |
860 |
+ hw_idprom = va_prom; |
+ hw_idprom = va_prom; |
861 |
+} |
+} |
862 |
+ |
+ |
863 |
+/* |
diff -ruN proll_18.orig/qemu/openprom.c proll-patch7/qemu/openprom.c |
|
+ * Make CPU page tables. |
|
|
+ * Returns pointer to context table. |
|
|
+ * Here we ignore memory allocation errors which "should not happen" |
|
|
+ * because we cannot print anything anyways if memory initialization fails. |
|
|
+ */ |
|
|
+void makepages_q(struct phym *t, unsigned int highbase) |
|
|
+{ |
|
|
+ unsigned int *ctp, *l1, pte; |
|
|
+ int i; |
|
|
+ unsigned int pa, va; |
|
|
+ |
|
|
+ ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int)); |
|
|
+ l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int)); |
|
|
+ |
|
|
+ pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4); |
|
|
+ for (i = 0; i < NCTX_SWIFT; i++) { |
|
|
+ ctp[i] = pte; |
|
|
+ } |
|
|
+ |
|
|
+ pa = PROLBASE; |
|
|
+ for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) { |
|
|
+ map_page(l1, va, pa, 0, highbase); |
|
|
+ pa += PAGE_SIZE; |
|
|
+ } |
|
|
+ pa = highbase + PROLDATA - PROLBASE; |
|
|
+ for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) { |
|
|
+ map_page(l1, va, pa, 0, highbase); |
|
|
+ pa += PAGE_SIZE; |
|
|
+ } |
|
|
+ |
|
|
+ /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */ |
|
|
+ pa = 0; |
|
|
+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) { |
|
|
+ map_page(l1, va, pa, 0, highbase); |
|
|
+ pa += PAGE_SIZE; |
|
|
+ } |
|
|
+ |
|
|
+ t->pctp = ctp; |
|
|
+ t->pl1 = l1; |
|
|
+ t->pbas = highbase; |
|
|
+} |
|
|
diff -ruN proll_18.orig/qemu/Makefile proll-patch4/qemu/Makefile |
|
|
--- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000 |
|
|
+++ proll-patch4/qemu/Makefile 2004-11-13 15:50:49.000000000 +0000 |
|
|
@@ -0,0 +1,119 @@ |
|
|
+# |
|
|
+# proll: |
|
|
+# qemu/Makefile - make PROLL for QEMU |
|
|
+# $Id$ |
|
|
+# |
|
|
+# Copyright 1999 Pete Zaitcev |
|
|
+# This is Free Software is licensed under terms of GNU General Public License. |
|
|
+# |
|
|
+ |
|
|
+CC = gcc |
|
|
+ |
|
|
+#CROSS = /usr/local/sparc/bin/sparc-sun-linux- |
|
|
+CROSS = sparc-unknown-linux-gnu- |
|
|
+ |
|
|
+CROSSCC = $(CROSS)gcc |
|
|
+CROSSLD = $(CROSS)ld |
|
|
+CROSSNM = $(CROSS)nm |
|
|
+ |
|
|
+RM = /bin/rm -f |
|
|
+ELFTOAOUT = elftoaout |
|
|
+ |
|
|
+# |
|
|
+SRC = ../src |
|
|
+ |
|
|
+# Due to remapping algorithm PROLBASE should be algned on PMD. |
|
|
+# We make PROLBASE a define instead of using _start because we |
|
|
+# want to shift it to form a PGD entry. A relocatable label will not work. |
|
|
+# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>. |
|
|
+PROLBASE = 0xffd00000 |
|
|
+PROLRODATA = 0xffd07000 |
|
|
+PROLDATA = 0xffd09000 |
|
|
+PROLSIZE = (240*1024) |
|
|
+ |
|
|
+# Linux |
|
|
+# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6. |
|
|
+# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them. |
|
|
+# __ANSI__ is supposed to be on by default but it is not. |
|
|
+CFLAGS = -O2 -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -g |
|
|
+ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g |
|
|
+# Solaris or Linux/i386 cross compilation |
|
|
+#CFLAGS = -Iinclude -O |
|
|
+ |
|
|
+LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA) |
|
|
+ |
|
|
+ALL = proll.aout |
|
|
+PROLLEXE = proll.elf |
|
|
+ |
|
|
+OBJS = head.o wuf.o wof.o main.o vconsole.o hconsole.o rconsole.o \ |
|
|
+ printf.o le.o system.o iommu.o \ |
|
|
+ arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o |
|
|
+ |
|
|
+all: $(ALL) |
|
|
+ |
|
|
+$(PROLLEXE): $(OBJS) |
|
|
+ $(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS) |
|
|
+ |
|
|
+head.o: head.S $(SRC)/phys_jj.h \ |
|
|
+ $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h |
|
|
+ $(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S |
|
|
+ |
|
|
+main.o: main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \ |
|
|
+ $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \ |
|
|
+ $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $*.c |
|
|
+openprom.o: openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \ |
|
|
+ $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $*.c |
|
|
+ |
|
|
+system.o: $(SRC)/system.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \ |
|
|
+ $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \ |
|
|
+ $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+iommu.o: $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \ |
|
|
+ $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+vconsole.o: $(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+hconsole.o: $(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+rconsole.o: $(SRC)/rconsole.c $(SRC)/rconsole.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+printf.o: $(SRC)/printf.c |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+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 |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+ |
|
|
+arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+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 |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+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 |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h |
|
|
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
|
+bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \ |
|
|
+ $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h |
|
|
+ $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c |
|
|
+ |
|
|
+wuf.o: $(SRC)/wuf.S |
|
|
+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S |
|
|
+wof.o: $(SRC)/wof.S |
|
|
+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S |
|
|
+ |
|
|
+#genlab.o: genlab.c |
|
|
+# $(CC) -c $*.c |
|
|
+# |
|
|
+#genlab: genlab.o |
|
|
+# $(CC) -o genlab genlab.o |
|
|
+ |
|
|
+clean: |
|
|
+ $(RM) $(OBJS) |
|
|
+ $(RM) $(PROLLEXE) proll.aout |
|
|
+ |
|
|
+proll.aout: $(PROLLEXE) |
|
|
+ $(ELFTOAOUT) -o proll.aout $(PROLLEXE) |
|
|
diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c |
|
864 |
--- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000 |
--- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000 |
865 |
+++ proll-patch4/qemu/openprom.c 2004-11-23 19:14:05.000000000 +0000 |
+++ proll-patch7/qemu/openprom.c 2005-03-02 20:09:57.000000000 +0000 |
866 |
@@ -0,0 +1,596 @@ |
@@ -0,0 +1,646 @@ |
867 |
+/* |
+/* |
868 |
+ * PROM interface support |
+ * PROM interface support |
869 |
+ * Copyright 1996 The Australian National University. |
+ * Copyright 1996 The Australian National University. |
880 |
+#include <vconsole.h> |
+#include <vconsole.h> |
881 |
+#include "phys_jj.h" |
+#include "phys_jj.h" |
882 |
+ |
+ |
883 |
|
+//#define DEBUG_OBP |
884 |
|
+ |
885 |
+struct property { |
+struct property { |
886 |
+ const char *name; |
+ const char *name; |
887 |
+ const char *value; |
+ const char *value; |
932 |
+static const struct property propv_sbus[] = { |
+static const struct property propv_sbus[] = { |
933 |
+ {"name", "sbus", 5}, |
+ {"name", "sbus", 5}, |
934 |
+ {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)}, |
+ {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)}, |
935 |
|
+ {"device_type", "hierarchical", sizeof("hierarchical") }, |
936 |
+ {NULL, NULL, -1} |
+ {NULL, NULL, -1} |
937 |
+}; |
+}; |
938 |
+ |
+ |
1030 |
+static const struct property propv_obio[] = { |
+static const struct property propv_obio[] = { |
1031 |
+ {"name", "obio", 5 }, |
+ {"name", "obio", 5 }, |
1032 |
+ {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) }, |
+ {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) }, |
1033 |
|
+ {"device_type", "hierarchical", sizeof("hierarchical") }, |
1034 |
+ {NULL, NULL, -1} |
+ {NULL, NULL, -1} |
1035 |
+}; |
+}; |
1036 |
+ |
+ |
1082 |
+ {NULL, NULL, -1} |
+ {NULL, NULL, -1} |
1083 |
+}; |
+}; |
1084 |
+ |
+ |
1085 |
+static const int prop_zs_intr[] = { 0x26, 0x0 }; |
+static const int prop_zs_intr[] = { 12, 0x0 }; |
1086 |
+static const int prop_zs_reg[] = { |
+static const int prop_zs_reg[] = { |
1087 |
+ 0x4, 0x00000000, 0x0000000f, |
+ 0x0, 0x00000000, 0x00000008, |
1088 |
+}; |
+}; |
1089 |
+static const int prop_zs_slave[] = { 0x1 }; |
+static const int prop_zs_addr = { 0x70000000 }; |
1090 |
|
+static const int prop_zs_slave[] = { 1 }; |
1091 |
+static const struct property propv_obio_zs[] = { |
+static const struct property propv_obio_zs[] = { |
1092 |
+ {"name", "zs", sizeof("zs")}, |
+ {"name", "zs", sizeof("zs")}, |
1093 |
+ {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) }, |
+ {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) }, |
1094 |
+ {"reg", (char*)&prop_zs_slave[0], sizeof(prop_zs_slave) }, |
+ {"slave", (char*)&prop_zs_slave[0], sizeof(prop_zs_slave) }, |
1095 |
+ {"device_type", "serial", sizeof("serial") }, |
+ {"device_type", "serial", sizeof("serial") }, |
1096 |
|
+ {"intr", (char*)&prop_zs_intr[0], sizeof(prop_zs_intr) }, |
1097 |
|
+ // {"address", (char*)&prop_zs_addr, sizeof(prop_zs_addr) }, |
1098 |
+ {NULL, NULL, -1} |
+ {NULL, NULL, -1} |
1099 |
+}; |
+}; |
1100 |
+ |
+ |
1101 |
+static const int prop_zs1_intr[] = { 0x26, 0x0 }; |
+static const int prop_zs1_intr[] = { 12, 0x0 }; |
1102 |
+static const int prop_zs1_reg[] = { |
+static const int prop_zs1_reg[] = { |
1103 |
+ 0x4, 0x00100000, 0x0000000f, |
+ 0x0, 0x00100000, 0x00000008, |
1104 |
+}; |
+}; |
1105 |
+static const int prop_zs1_slave[] = { 0x0 }; |
+static const int prop_zs1_addr = { 0x70100000 }; |
1106 |
|
+static const int prop_zs1_slave[] = { 0 }; |
1107 |
+static const struct property propv_obio_zs1[] = { |
+static const struct property propv_obio_zs1[] = { |
1108 |
+ {"name", "zs", sizeof("zs")}, |
+ {"name", "zs", sizeof("zs")}, |
1109 |
+ {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) }, |
+ {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) }, |
1110 |
+ {"reg", (char*)&prop_zs1_slave[0], sizeof(prop_zs1_slave) }, |
+ {"slave", (char*)&prop_zs1_slave[0], sizeof(prop_zs1_slave) }, |
1111 |
+ {"device_type", "serial", sizeof("serial") }, |
+ {"device_type", "serial", sizeof("serial") }, |
1112 |
|
+ {"intr", (char*)&prop_zs1_intr[0], sizeof(prop_zs1_intr) }, |
1113 |
|
+ // {"address", (char*)&prop_zs1_addr, sizeof(prop_zs1_addr) }, |
1114 |
+ {NULL, NULL, -1} |
+ {NULL, NULL, -1} |
1115 |
+}; |
+}; |
1116 |
+ |
+ |
1138 |
+ {NULL, NULL, -1} |
+ {NULL, NULL, -1} |
1139 |
+}; |
+}; |
1140 |
+ |
+ |
1141 |
|
+static const int prop_espdma_reg[] = { |
1142 |
|
+ 0x4, 0x08400000, 0x00000010, |
1143 |
|
+}; |
1144 |
|
+// Disabled, not implemented yet |
1145 |
|
+static const struct property propv_sbus_espdma[] = { |
1146 |
|
+ {"name", "xxxespdma", sizeof("xxxespdma")}, |
1147 |
|
+ {"reg", (char*)&prop_espdma_reg[0], sizeof(prop_espdma_reg) }, |
1148 |
|
+ {NULL, NULL, -1} |
1149 |
|
+}; |
1150 |
|
+ |
1151 |
|
+static const int prop_esp_reg[] = { |
1152 |
|
+ 0x4, 0x08800000, 0x00000040, |
1153 |
|
+}; |
1154 |
|
+static const int prop_esp_intr[] = { 0x24, 0x0 }; |
1155 |
|
+static const struct property propv_sbus_espdma_esp[] = { |
1156 |
|
+ {"name", "esp", sizeof("esp")}, |
1157 |
|
+ {"reg", (char*)&prop_esp_reg[0], sizeof(prop_esp_reg) }, |
1158 |
|
+ {"intr", (char*)&prop_esp_intr[0], sizeof(prop_esp_intr) }, |
1159 |
|
+ {NULL, NULL, -1} |
1160 |
|
+}; |
1161 |
|
+ |
1162 |
|
+static const int prop_bpp_reg[] = { |
1163 |
|
+ 0x4, 0x0c800000, 0x0000001c, |
1164 |
|
+}; |
1165 |
|
+static const int prop_bpp_intr[] = { 0x33, 0x0 }; |
1166 |
|
+static const struct property propv_sbus_bpp[] = { |
1167 |
|
+ {"name", "SUNW,bpp", sizeof("SUNW,bpp")}, |
1168 |
|
+ {"reg", (char*)&prop_bpp_reg[0], sizeof(prop_bpp_reg) }, |
1169 |
|
+ {"intr", (char*)&prop_bpp_intr[0], sizeof(prop_bpp_intr) }, |
1170 |
|
+ {NULL, NULL, -1} |
1171 |
|
+}; |
1172 |
|
+ |
1173 |
|
+static const int prop_fd_intr[] = { 0x2b, 0x0 }; |
1174 |
|
+static const int prop_fd_reg[] = { |
1175 |
|
+ 0x0, 0x00400000, 0x0000000f, |
1176 |
|
+}; |
1177 |
|
+static const struct property propv_obio_fd[] = { |
1178 |
|
+ {"name", "SUNW,fdtwo", sizeof("SUNW,fdtwo")}, |
1179 |
|
+ {"reg", (char*)&prop_fd_reg[0], sizeof(prop_fd_reg) }, |
1180 |
|
+ {"device_type", "block", sizeof("block") }, |
1181 |
|
+ {"intr", (char*)&prop_fd_intr[0], sizeof(prop_fd_intr) }, |
1182 |
|
+ {NULL, NULL, -1} |
1183 |
|
+}; |
1184 |
|
+ |
1185 |
|
+static const int prop_pw_intr[] = { 0x22, 0x0 }; |
1186 |
|
+static const int prop_pw_reg[] = { |
1187 |
|
+ 0x0, 0x00910000, 0x00000001, |
1188 |
|
+}; |
1189 |
|
+static const struct property propv_obio_pw[] = { |
1190 |
|
+ {"name", "power", sizeof("power")}, |
1191 |
|
+ {"reg", (char*)&prop_pw_reg[0], sizeof(prop_pw_reg) }, |
1192 |
|
+ {"intr", (char*)&prop_pw_intr[0], sizeof(prop_pw_intr) }, |
1193 |
|
+ {NULL, NULL, -1} |
1194 |
|
+}; |
1195 |
|
+ |
1196 |
|
+static const int prop_cf_reg[] = { |
1197 |
|
+ 0x0, 0x00800000, 0x00000001, |
1198 |
|
+}; |
1199 |
|
+static const struct property propv_obio_cf[] = { |
1200 |
|
+ {"name", "slavioconfig", sizeof("slavioconfig")}, |
1201 |
|
+ {"reg", (char*)&prop_cf_reg[0], sizeof(prop_cf_reg) }, |
1202 |
|
+ {NULL, NULL, -1} |
1203 |
|
+}; |
1204 |
|
+ |
1205 |
+static const struct node nodes[] = { |
+static const struct node nodes[] = { |
1206 |
+ { &null_properties, 1, 0 }, /* 0 = big brother of root */ |
+ { &null_properties, 1, 0 }, /* 0 = big brother of root */ |
1207 |
+ { propv_root, 0, 2 }, /* 1 "/" */ |
+ { propv_root, 0, 2 }, /* 1 "/" */ |
1208 |
+ { propv_iommu, 8, 3 }, /* 2 "/iommu" */ |
+ { propv_iommu, 11, 3 }, /* 2 "/iommu" */ |
1209 |
+ { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */ |
+ { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */ |
1210 |
+ { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */ |
+ { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */ |
1211 |
+ { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */ |
+ { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */ |
1212 |
+ { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */ |
+ { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */ |
1213 |
+ { propv_sbus_cs4231, 0, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */ |
+ { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */ |
1214 |
+ { propv_cpu, 9, 0 }, /* 8 "/STP1012PGA" */ |
+ { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */ |
1215 |
+ { propv_obio, 0, 10 }, /* 9 "/obio" */ |
+ { propv_sbus_espdma, 0, 10 }, /* 9 "/iommu/sbus/espdma" */ |
1216 |
+ { propv_obio_int, 11, 0 }, /* 10 "/obio/interrupt" */ |
+ { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */ |
1217 |
+ { propv_obio_cnt, 12, 0 }, /* 11 "/obio/counter" */ |
+ { propv_cpu, 12, 0 }, /* 11 "/STP1012PGA" */ |
1218 |
+ { propv_obio_eep, 13, 0 }, /* 12 "/obio/eeprom" */ |
+ { propv_obio, 0, 13 }, /* 12 "/obio" */ |
1219 |
|
+ { propv_obio_int, 14, 0 }, /* 13 "/obio/interrupt" */ |
1220 |
|
+ { propv_obio_cnt, 15, 0 }, /* 14 "/obio/counter" */ |
1221 |
|
+ { propv_obio_eep, 16, 0 }, /* 15 "/obio/eeprom" */ |
1222 |
|
+ { propv_obio_auxio, 17, 0 }, /* 16 "/obio/auxio" */ |
1223 |
|
+ { propv_obio_zs, 18, 0 }, /* 17 "/obio/zs@0,0" */ |
1224 |
|
+ { propv_obio_zs1, 19, 0 }, /* 18 "/obio/zs@0,100000" */ |
1225 |
|
+ { propv_obio_fd, 20, 0 }, /* 19 "/obio/SUNW,fdtwo" */ |
1226 |
|
+ { propv_obio_pw, 21, 0 }, /* 20 "/obio/power" */ |
1227 |
|
+ { propv_obio_cf, 0, 0 }, /* 21 "/obio/slavioconfig@0,800000" */ |
1228 |
|
+#if 0 |
1229 |
+ { propv_obio_su, 14, 0 }, /* 13 "/obio/su" */ |
+ { propv_obio_su, 14, 0 }, /* 13 "/obio/su" */ |
1230 |
+ { propv_obio_auxio, 0, 0 }, /* 14 "/obio/auxio" */ |
+ { propv_cpu, 18, 0 }, /* 17 "/STP1012PGA" */ |
1231 |
+ { propv_obio_zs, 0, 0 }, /* 14 "/obio/zs@0,0" */ |
+ { propv_cpu, 19, 0 }, /* 18 "/STP1012PGA" */ |
1232 |
+ { propv_obio_zs1, 0, 0 }, /* 14 "/obio/zs@0,100000" */ |
+ |
1233 |
|
+ { propv_cpu, 20, 0 }, /* 19 "/STP1012PGA" */ |
1234 |
|
+ { propv_cpu, 21, 0 }, /* 20 "/STP1012PGA" */ |
1235 |
|
+ { propv_cpu, 22, 0 }, /* 21 "/STP1012PGA" */ |
1236 |
|
+ { propv_cpu, 23, 0 }, /* 22 "/STP1012PGA" */ |
1237 |
|
+ { propv_cpu, 24, 0 }, /* 23 "/STP1012PGA" */ |
1238 |
|
+ { propv_cpu, 25, 0 }, /* 24 "/STP1012PGA" */ |
1239 |
|
+ { propv_cpu, 26, 0 }, /* 25 "/STP1012PGA" */ |
1240 |
|
+ { propv_cpu, 27, 0 }, /* 26 "/STP1012PGA" */ |
1241 |
|
+ { propv_cpu, 28, 0 }, /* 27 "/STP1012PGA" */ |
1242 |
|
+ { propv_cpu, 29, 0 }, /* 28 "/STP1012PGA" */ |
1243 |
|
+ { propv_cpu, 30, 0 }, /* 29 "/STP1012PGA" */ |
1244 |
|
+#endif |
1245 |
+}; |
+}; |
1246 |
+ |
+ |
1247 |
+static struct linux_mlist_v0 totphys[MAX_BANKS]; |
+static struct linux_mlist_v0 totphys[MAX_BANKS]; |
1262 |
+ obp_nextprop /* char * (*no_nextprop)(int node, char *name); */ |
+ obp_nextprop /* char * (*no_nextprop)(int node, char *name); */ |
1263 |
+}; |
+}; |
1264 |
+ |
+ |
1265 |
+static const char arg_nfsroot[] = "console=ttyS0 ip=bootp root=nfs"; |
+static struct linux_arguments_v0 obp_arg; |
|
+ |
|
|
+static const struct linux_arguments_v0 obp_arg = { |
|
|
+ { "le()", arg_nfsroot, NULL, NULL, NULL, NULL, NULL, NULL }, |
|
|
+ { "" }, |
|
|
+ { 'l', 'e' }, 0, 0, 0, NULL, |
|
|
+ NULL |
|
|
+}; |
|
1266 |
+static const struct linux_arguments_v0 * const obp_argp = &obp_arg; |
+static const struct linux_arguments_v0 * const obp_argp = &obp_arg; |
1267 |
+ |
+ |
1268 |
+static const void * const synch_hook = NULL; |
+static void (*synch_hook)(void); |
1269 |
+#if 0 |
+static char obp_stdin, obp_stdout; |
|
+static const char obp_stdin = PROMDEV_KBD; |
|
|
+static const char obp_stdout = PROMDEV_SCREEN; |
|
|
+#else |
|
|
+static const char obp_stdin = PROMDEV_TTYA; |
|
|
+static const char obp_stdout = PROMDEV_TTYA; |
|
|
+#endif |
|
1270 |
+ |
+ |
1271 |
+static int obp_nbgetchar(void); |
+static int obp_nbgetchar(void); |
1272 |
+static int obp_nbputchar(int ch); |
+static int obp_nbputchar(int ch); |
1286 |
+ if (ptab1 != 0) mem_tablewalk(ptab1, va); |
+ if (ptab1 != 0) mem_tablewalk(ptab1, va); |
1287 |
+} |
+} |
1288 |
+ |
+ |
|
+#ifdef ORIG |
|
|
+static const struct linux_romvec romvec0 = { |
|
|
+ LINUX_OPPROM_MAGIC, /* pv_magic_cookie */ |
|
|
+ 0, /* pv_romvers - Format selector! */ |
|
|
+ 77, /* pv_plugin_revision */ |
|
|
+ 0x10203, /* pv_printrev */ |
|
|
+ { /* pv_v0mem */ |
|
|
+ &ptphys, /* v0_totphys */ |
|
|
+ &ptmap, /* v0_prommap */ |
|
|
+ &ptavail /* v0_available */ |
|
|
+ }, |
|
|
+ &nodeops0, /* struct linux_nodeops *pv_nodeops; */ |
|
|
+ (void*)doublewalk, /* P3 */ /* char **pv_bootstr; */ |
|
|
+ { /* struct linux_dev_v0_funcs pv_v0devops; */ |
|
|
+ &obp_devopen, /* v0_devopen */ |
|
|
+ &obp_devclose, /* v0_devclose */ |
|
|
+ &obp_rdblkdev, /* v0_rdblkdev */ |
|
|
+ NULL, /* v0_wrblkdev */ |
|
|
+ NULL, /* v0_wrnetdev */ |
|
|
+ NULL, /* v0_rdnetdev */ |
|
|
+ NULL, /* v0_rdchardev */ |
|
|
+ NULL, /* v0_wrchardev */ |
|
|
+ NULL /* v0_seekdev */ |
|
|
+ }, |
|
|
+ &obp_stdin, /* char *pv_stdin */ |
|
|
+ &obp_stdout, /* char *pv_stdout; */ |
|
|
+ obp_nbgetchar, /* int (*pv_getchar)(void); */ |
|
|
+ obp_nbputchar, /* void (*pv_putchar)(int ch); */ |
|
|
+ obp_nbgetchar, /* int (*pv_nbgetchar)(void); */ |
|
|
+ obp_nbputchar, /* int (*pv_nbputchar)(int ch); */ |
|
|
+ NULL, /* void (*pv_putstr)(char *str, int len); */ |
|
|
+ obp_reboot, /* void (*pv_reboot)(char *bootstr); */ |
|
|
+ NULL, /* void (*pv_printf)(__const__ char *fmt, ...); */ |
|
|
+ obp_abort, /* void (*pv_abort)(void); */ |
|
|
+ NULL, /* __volatile__ int *pv_ticks; */ |
|
|
+ obp_halt, /* void (*pv_halt)(void); */ |
|
|
+ (void *)&synch_hook, /* void (**pv_synchook)(void); */ |
|
|
+ |
|
|
+#if 0 |
|
|
+ /* Evaluate a forth string, not different proto for V0 and V2->up. */ |
|
|
+ union { |
|
|
+ void (*v0_eval)(int len, char *str); |
|
|
+ void (*v2_eval)(char *str); |
|
|
+ } pv_fortheval; |
|
|
+#endif |
|
|
+ { 0 }, /* pv_fortheval */ |
|
|
+ |
|
|
+ &obp_argp, /* struct linux_arguments_v0 **pv_v0bootargs; */ |
|
|
+ NULL, /* pv_enaddr */ |
|
|
+ { /* pv_v2bootargs */ |
|
|
+ NULL, /* char **bootpath; */ |
|
|
+ NULL, /* char **bootargs; */ |
|
|
+ NULL, /* fd_stdin; */ |
|
|
+ NULL, /* fd_stdout */ |
|
|
+ }, |
|
|
+ { /* pv_v2devops */ |
|
|
+ NULL, /* v2_inst2pkg */ |
|
|
+ NULL, /* v2_dumb_mem_alloc */ |
|
|
+ NULL, /* v2_dumb_mem_free */ |
|
|
+ NULL, /* v2_dumb_mmap */ |
|
|
+ NULL, /* v2_dumb_munmap */ |
|
|
+ NULL, /* v2_dev_open */ |
|
|
+ NULL, /* v2_dev_close */ |
|
|
+ NULL, /* v2_dev_read */ |
|
|
+ NULL, /* v2_dev_write */ |
|
|
+ NULL, /* v2_dev_seek */ |
|
|
+ NULL, /* v2_wheee2 */ |
|
|
+ NULL, /* v2_wheee3 */ |
|
|
+ }, |
|
|
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* filler[15] */ |
|
|
+ NULL, /* pv_setctxt */ |
|
|
+ NULL, /* v3_cpustart */ |
|
|
+ NULL, /* v3_cpustop */ |
|
|
+ NULL, /* v3_cpuidle */ |
|
|
+ NULL /* v3_cpuresume */ |
|
|
+}; |
|
|
+#endif |
|
|
+ |
|
1289 |
+static struct linux_romvec romvec0; |
+static struct linux_romvec romvec0; |
1290 |
+ |
+ |
1291 |
+void * |
+void * |
1292 |
+init_openprom(int bankc, struct bank *bankv, unsigned hiphybas) |
+init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, |
1293 |
|
+ const char *cmdline, char boot_device, int nographic) |
1294 |
+{ |
+{ |
1295 |
+ int i; |
+ int i; |
1296 |
+ |
+ |
1344 |
+ romvec0.pv_v0mem.v0_available = &ptavail; |
+ romvec0.pv_v0mem.v0_available = &ptavail; |
1345 |
+ romvec0.pv_nodeops = &nodeops0; |
+ romvec0.pv_nodeops = &nodeops0; |
1346 |
+ romvec0.pv_bootstr = (void *)doublewalk; |
+ romvec0.pv_bootstr = (void *)doublewalk; |
1347 |
|
+ romvec0.pv_v0devops.v0_devopen = &obp_devopen; |
1348 |
|
+ romvec0.pv_v0devops.v0_devclose = &obp_devclose; |
1349 |
|
+ romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev; |
1350 |
+ romvec0.pv_stdin = &obp_stdin; |
+ romvec0.pv_stdin = &obp_stdin; |
1351 |
+ romvec0.pv_stdout = &obp_stdout; |
+ romvec0.pv_stdout = &obp_stdout; |
1352 |
+ romvec0.pv_getchar = obp_nbgetchar; |
+ romvec0.pv_getchar = obp_nbgetchar; |
1353 |
+ romvec0.pv_putchar = obp_nbputchar; |
+ romvec0.pv_putchar = (void (*)(int))obp_nbputchar; |
1354 |
+ romvec0.pv_nbgetchar = obp_nbgetchar; |
+ romvec0.pv_nbgetchar = obp_nbgetchar; |
1355 |
+ romvec0.pv_nbputchar = obp_nbputchar; |
+ romvec0.pv_nbputchar = obp_nbputchar; |
1356 |
+ romvec0.pv_reboot = obp_reboot; |
+ romvec0.pv_reboot = obp_reboot; |
1358 |
+ romvec0.pv_halt = obp_halt; |
+ romvec0.pv_halt = obp_halt; |
1359 |
+ romvec0.pv_synchook = &synch_hook; |
+ romvec0.pv_synchook = &synch_hook; |
1360 |
+ romvec0.pv_v0bootargs = &obp_argp; |
+ romvec0.pv_v0bootargs = &obp_argp; |
1361 |
|
+ switch(boot_device) { |
1362 |
|
+ default: |
1363 |
|
+ case 'a': |
1364 |
|
+ obp_arg.argv[0] = "fd()"; |
1365 |
|
+ break; |
1366 |
|
+ case 'c': |
1367 |
|
+ obp_arg.argv[0] = "sd()"; |
1368 |
|
+ break; |
1369 |
|
+ case 'n': |
1370 |
|
+ obp_arg.argv[0] = "le()"; |
1371 |
|
+ break; |
1372 |
|
+ } |
1373 |
|
+ obp_arg.argv[1] = cmdline; |
1374 |
|
+ |
1375 |
|
+ if (nographic) { |
1376 |
|
+ obp_stdin = PROMDEV_TTYA; |
1377 |
|
+ obp_stdout = PROMDEV_TTYA; |
1378 |
|
+ } else { |
1379 |
|
+ obp_stdin = PROMDEV_KBD; |
1380 |
|
+ obp_stdout = PROMDEV_SCREEN; |
1381 |
|
+ } |
1382 |
+ return &romvec0; |
+ return &romvec0; |
1383 |
+} |
+} |
1384 |
+ |
+ |
1394 |
+ |
+ |
1395 |
+static int obp_nextnode(int node) |
+static int obp_nextnode(int node) |
1396 |
+{ |
+{ |
1397 |
|
+#ifdef DEBUG_OBP |
1398 |
|
+ printk("obp_nextnode(%d) = %d\n", node, nodes[node].sibling); |
1399 |
|
+#endif |
1400 |
+ return nodes[node].sibling; |
+ return nodes[node].sibling; |
1401 |
+} |
+} |
1402 |
+ |
+ |
1403 |
+static int obp_child(int node) |
+static int obp_child(int node) |
1404 |
+{ |
+{ |
1405 |
|
+#ifdef DEBUG_OBP |
1406 |
|
+ printk("obp_child(%d) = %d\n", node, nodes[node].child); |
1407 |
|
+#endif |
1408 |
+ return nodes[node].child; |
+ return nodes[node].child; |
1409 |
+} |
+} |
1410 |
+ |
+ |
1411 |
+static int obp_proplen(int node, char *name) |
+static int obp_proplen(int node, char *name) |
1412 |
+{ |
+{ |
1413 |
+ const struct property *prop = find_property(node,name); |
+ const struct property *prop = find_property(node,name); |
1414 |
+ if (prop) return prop->length; |
+ if (prop) { |
1415 |
|
+#ifdef DEBUG_OBP |
1416 |
|
+ printk("obp_proplen(%d, %s) = %d\n", node, name, prop->length); |
1417 |
|
+#endif |
1418 |
|
+ return prop->length; |
1419 |
|
+ } |
1420 |
|
+#ifdef DEBUG_OBP |
1421 |
|
+ printk("obp_proplen(%d, %s) (no prop)\n", node, name); |
1422 |
|
+#endif |
1423 |
+ return -1; |
+ return -1; |
1424 |
+} |
+} |
1425 |
+ |
+ |
1430 |
+ prop = find_property(node,name); |
+ prop = find_property(node,name); |
1431 |
+ if (prop) { |
+ if (prop) { |
1432 |
+ memcpy(value,prop->value,prop->length); |
+ memcpy(value,prop->value,prop->length); |
1433 |
+ //printk("obp_getprop '%s'= %s\n", name, value); |
+#ifdef DEBUG_OBP |
1434 |
|
+ printk("obp_getprop(%d, %s) = %s\n", node, name, value); |
1435 |
|
+#endif |
1436 |
+ return prop->length; |
+ return prop->length; |
1437 |
+ } |
+ } |
1438 |
+ //printk("obp_getprop: not found\n"); |
+#ifdef DEBUG_OBP |
1439 |
|
+ printk("obp_getprop(%d, %s): not found\n", node, name); |
1440 |
|
+#endif |
1441 |
+ return -1; |
+ return -1; |
1442 |
+} |
+} |
1443 |
+ |
+ |
1444 |
+static int obp_setprop(int node, char *name, char *value, int len) |
+static int obp_setprop(int node, char *name, char *value, int len) |
1445 |
+{ |
+{ |
1446 |
|
+#ifdef DEBUG_OBP |
1447 |
|
+ printk("obp_setprop(%d, %s) = %s (%d)\n", node, name, value, len); |
1448 |
|
+#endif |
1449 |
+ return -1; |
+ return -1; |
1450 |
+} |
+} |
1451 |
+ |
+ |
1452 |
+static const char *obp_nextprop(int node,char *name) |
+static const char *obp_nextprop(int node,char *name) |
1453 |
+{ |
+{ |
1454 |
+ const struct property *prop = find_property(node,name); |
+ const struct property *prop = find_property(node,name); |
1455 |
+ if (prop) return prop[1].name; |
+ if (prop) { |
1456 |
|
+#ifdef DEBUG_OBP |
1457 |
|
+ printk("obp_nextprop(%d, %s) = %s\n", node, name, prop[1].name); |
1458 |
|
+#endif |
1459 |
|
+ return prop[1].name; |
1460 |
|
+ } |
1461 |
|
+#ifdef DEBUG_OBP |
1462 |
|
+ printk("obp_nextprop(%d, %s): not found\n", node, name); |
1463 |
|
+#endif |
1464 |
+ return NULL; |
+ return NULL; |
1465 |
+} |
+} |
1466 |
+ |
+ |
|
+#if 0 |
|
|
+static unsigned char calc_idprom_cksum(struct idprom *idprom) |
|
|
+{ |
|
|
+ unsigned char cksum, i, *ptr = (unsigned char *)idprom; |
|
|
+ |
|
|
+ for (i = cksum = 0; i <= 0x0E; i++) |
|
|
+ cksum ^= *ptr++; |
|
|
+ |
|
|
+ return cksum; |
|
|
+} |
|
|
+#endif |
|
|
+ |
|
1467 |
+static int obp_nbgetchar(void) { |
+static int obp_nbgetchar(void) { |
1468 |
+ return -1; |
+ extern struct vconterm dp0; |
1469 |
|
+ return vcon_getch(&dp0); |
1470 |
+} |
+} |
1471 |
+ |
+ |
1472 |
+static int obp_nbputchar(int ch) { |
+static int obp_nbputchar(int ch) { |
1473 |
+ extern struct vconterm dp0; |
+ printk("%c", ch); |
|
+ char buf = ch; |
|
|
+ |
|
|
+ /* We do not use printk() in order to reduce stack depth. */ |
|
|
+ vcon_write(&dp0, &buf, 1); |
|
1474 |
+ return 0; |
+ return 0; |
1475 |
+} |
+} |
1476 |
+ |
+ |
1490 |
+} |
+} |
1491 |
+ |
+ |
1492 |
+static int obp_devopen(char *str) { |
+static int obp_devopen(char *str) { |
1493 |
+ //printk("open %s\n", str); |
+#ifdef DEBUG_OBP |
1494 |
|
+ printk("open %s\n", str); |
1495 |
|
+#endif |
1496 |
+ return 0; |
+ return 0; |
1497 |
+} |
+} |
1498 |
+ |
+ |
1499 |
+static int obp_devclose(int dev_desc) { |
+static int obp_devclose(int dev_desc) { |
1500 |
+ //printk("close %d\n", dev_desc); |
+#ifdef DEBUG_OBP |
1501 |
|
+ printk("close %d\n", dev_desc); |
1502 |
|
+#endif |
1503 |
+ return 0; |
+ return 0; |
1504 |
+} |
+} |
1505 |
+ |
+ |
1506 |
+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf) { |
+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf) { |
1507 |
+ //printk("rdblkdev: fd %d, num_blks %d, blk_st %d, buf 0x%x\n", dev_desc, num_blks, blk_st, buf); |
+#ifdef DEBUG_OBP |
1508 |
|
+ printk("rdblkdev: fd %d, num_blks %d, blk_st %d, buf 0x%x\n", dev_desc, num_blks, blk_st, buf); |
1509 |
|
+#endif |
1510 |
+ //buf[8] = 'L'; |
+ //buf[8] = 'L'; |
1511 |
+ return num_blks; |
+ return num_blks; |
1512 |
+} |
+} |
1513 |
diff -ruN proll_18.orig/src/arp.c proll-patch4/src/arp.c |
diff -ruN proll_18.orig/qemu/system_qemu.c proll-patch7/qemu/system_qemu.c |
1514 |
|
--- proll_18.orig/qemu/system_qemu.c 1970-01-01 00:00:00.000000000 +0000 |
1515 |
|
+++ proll-patch7/qemu/system_qemu.c 2005-03-02 16:10:20.000000000 +0000 |
1516 |
|
@@ -0,0 +1,416 @@ |
1517 |
|
+/** |
1518 |
|
+ ** Proll (PROM replacement) |
1519 |
|
+ ** system.c: shared miscallenea. |
1520 |
|
+ ** Copyright 1999 Pete Zaitcev |
1521 |
|
+ ** This code is licensed under GNU General Public License. |
1522 |
|
+ **/ |
1523 |
|
+#include <stdarg.h> |
1524 |
|
+#include <asi.h> |
1525 |
|
+#include <crs.h> |
1526 |
|
+#ifndef NULL |
1527 |
|
+#define NULL ((void*)0) |
1528 |
|
+#endif |
1529 |
|
+ |
1530 |
|
+#include "pgtsrmmu.h" |
1531 |
|
+ |
1532 |
|
+#include "vconsole.h" |
1533 |
|
+#include <timer.h> /* Local copy of 2.2 style include */ |
1534 |
|
+#include <general.h> /* __P() */ |
1535 |
|
+#include <net.h> /* init_net() */ |
1536 |
|
+#include <romlib.h> /* we are a provider for part of this. */ |
1537 |
|
+#include <netpriv.h> /* myipaddr */ |
1538 |
|
+#include <arpa.h> |
1539 |
|
+#include <system.h> /* our own prototypes */ |
1540 |
|
+ |
1541 |
|
+/* |
1542 |
|
+ * We export this. |
1543 |
|
+ */ |
1544 |
|
+char idprom[IDPROM_SIZE]; |
1545 |
|
+ |
1546 |
|
+ |
1547 |
|
+/* |
1548 |
|
+ * Create an I/O mapping to pa[size]. |
1549 |
|
+ * Returns va of the mapping or 0 if unsuccessful. |
1550 |
|
+ */ |
1551 |
|
+void * |
1552 |
|
+map_io(unsigned pa, int size) |
1553 |
|
+{ |
1554 |
|
+ void *va; |
1555 |
|
+ unsigned int npages; |
1556 |
|
+ unsigned int off; |
1557 |
|
+ unsigned int mva; |
1558 |
|
+ |
1559 |
|
+ off = pa & (PAGE_SIZE-1); |
1560 |
|
+ npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE; |
1561 |
|
+ pa &= ~(PAGE_SIZE-1); |
1562 |
|
+ |
1563 |
|
+ va = mem_alloc(&cio, npages*PAGE_SIZE, PAGE_SIZE); |
1564 |
|
+ if (va == 0) return va; |
1565 |
|
+ |
1566 |
|
+ mva = (unsigned int) va; |
1567 |
|
+ /* printk("map_io: va 0x%x pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); */ /* P3 */ |
1568 |
|
+ while (npages-- != 0) { |
1569 |
|
+ map_page(pmem.pl1, mva, pa, 1, pmem.pbas); |
1570 |
|
+ mva += PAGE_SIZE; |
1571 |
|
+ pa += PAGE_SIZE; |
1572 |
|
+ } |
1573 |
|
+ |
1574 |
|
+ return (void *)((unsigned int)va + off); |
1575 |
|
+} |
1576 |
|
+ |
1577 |
|
+/* |
1578 |
|
+ * Tablewalk routine used for testing. |
1579 |
|
+ * Returns PTP/PTE. |
1580 |
|
+ */ |
1581 |
|
+unsigned int |
1582 |
|
+proc_tablewalk(int ctx, unsigned int va) |
1583 |
|
+{ |
1584 |
|
+ unsigned int pa1; |
1585 |
|
+ |
1586 |
|
+ __asm__ __volatile__ ("lda [%1] %2, %0" : |
1587 |
|
+ "=r" (pa1) : |
1588 |
|
+ "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS)); |
1589 |
|
+ /* printk(" ctpr %x ctx %x\n", pa1, ctx); */ /* P3 */ |
1590 |
|
+ pa1 <<= 4; |
1591 |
|
+ pa1 = ld_bypass(pa1 + (ctx << 2)); |
1592 |
|
+ if ((pa1 & 0x03) == 0) goto invalid; |
1593 |
|
+ return mem_tablewalk((pa1 & 0xFFFFFFF0) << 4, va); |
1594 |
|
+ |
1595 |
|
+invalid: |
1596 |
|
+ printk(" invalid %x\n", pa1); |
1597 |
|
+ return 0; |
1598 |
|
+} |
1599 |
|
+ |
1600 |
|
+/* |
1601 |
|
+ * Walk the tables in memory, starting at physical address pa. |
1602 |
|
+ */ |
1603 |
|
+unsigned int |
1604 |
|
+mem_tablewalk(unsigned int pa, unsigned int va) |
1605 |
|
+{ |
1606 |
|
+ unsigned int pa1; |
1607 |
|
+ |
1608 |
|
+ printk("pa %x va %x", pa, va); |
1609 |
|
+ pa1 = ld_bypass(pa + (((va&0xFF000000)>>24) << 2)); |
1610 |
|
+ if ((pa1 & 0x03) == 0) goto invalid; |
1611 |
|
+ printk(" l1 %x", pa1); |
1612 |
|
+ pa1 <<= 4; pa1 &= 0xFFFFFF00; |
1613 |
|
+ pa1 = ld_bypass(pa1 + (((va&0x00FC0000)>>18) << 2)); |
1614 |
|
+ if ((pa1 & 0x03) == 0) goto invalid; |
1615 |
|
+ printk(" l2 %x", pa1); |
1616 |
|
+ pa1 <<= 4; pa1 &= 0xFFFFFF00; |
1617 |
|
+ pa1 = ld_bypass(pa1 + (((va&0x0003F000)>>12) << 2)); |
1618 |
|
+ if ((pa1 & 0x03) == 0) goto invalid; |
1619 |
|
+ printk(" l3 %x", pa1); |
1620 |
|
+ printk(" off %x\n", va&0x00000FFF); |
1621 |
|
+ return pa1; |
1622 |
|
+invalid: |
1623 |
|
+ printk(" invalid %x\n", pa1); |
1624 |
|
+ return 0; |
1625 |
|
+} |
1626 |
|
+ |
1627 |
|
+/* |
1628 |
|
+ * Make CPU page tables. |
1629 |
|
+ * Returns pointer to context table. |
1630 |
|
+ * Here we ignore memory allocation errors which "should not happen" |
1631 |
|
+ * because we cannot print anything anyways if memory initialization fails. |
1632 |
|
+ */ |
1633 |
|
+void makepages(struct phym *t, unsigned int highbase) |
1634 |
|
+{ |
1635 |
|
+ unsigned int *ctp, *l1, pte; |
1636 |
|
+ int i; |
1637 |
|
+ unsigned int pa, va; |
1638 |
|
+ |
1639 |
|
+ ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int)); |
1640 |
|
+ l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int)); |
1641 |
|
+ |
1642 |
|
+ pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4); |
1643 |
|
+ for (i = 0; i < NCTX_SWIFT; i++) { |
1644 |
|
+ ctp[i] = pte; |
1645 |
|
+ } |
1646 |
|
+ |
1647 |
|
+ pa = PROLBASE; |
1648 |
|
+ for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) { |
1649 |
|
+ map_page(l1, va, pa, 0, highbase); |
1650 |
|
+ pa += PAGE_SIZE; |
1651 |
|
+ } |
1652 |
|
+ pa = highbase + PROLDATA - PROLBASE; |
1653 |
|
+ for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) { |
1654 |
|
+ map_page(l1, va, pa, 0, highbase); |
1655 |
|
+ pa += PAGE_SIZE; |
1656 |
|
+ } |
1657 |
|
+ |
1658 |
|
+ /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */ |
1659 |
|
+ pa = 0; |
1660 |
|
+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) { |
1661 |
|
+ map_page(l1, va, pa, 0, highbase); |
1662 |
|
+ pa += PAGE_SIZE; |
1663 |
|
+ } |
1664 |
|
+ |
1665 |
|
+ t->pctp = ctp; |
1666 |
|
+ t->pl1 = l1; |
1667 |
|
+ t->pbas = highbase; |
1668 |
|
+} |
1669 |
|
+ |
1670 |
|
+/* |
1671 |
|
+ * Create a memory mapping from va to epa in page table pgd. |
1672 |
|
+ * highbase is used for v2p translation. |
1673 |
|
+ */ |
1674 |
|
+int |
1675 |
|
+map_page(unsigned int *pgd, unsigned int va, |
1676 |
|
+ unsigned int epa, int type, unsigned int highbase) |
1677 |
|
+{ |
1678 |
|
+ unsigned int pte; |
1679 |
|
+ unsigned int *p; |
1680 |
|
+ unsigned int pa; |
1681 |
|
+ |
1682 |
|
+ pte = pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)]; |
1683 |
|
+ if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) { |
1684 |
|
+ p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD*sizeof(int), |
1685 |
|
+ SRMMU_PTRS_PER_PMD*sizeof(int)); |
1686 |
|
+ if (p == 0) goto drop; |
1687 |
|
+ pte = SRMMU_ET_PTD | |
1688 |
|
+ (((unsigned int)p - PROLBASE + highbase) >> 4); |
1689 |
|
+ pgd[((va)>>SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD-1)] = pte; |
1690 |
|
+ /* barrier() */ |
1691 |
|
+ } |
1692 |
|
+ |
1693 |
|
+ pa = ((pte & 0xFFFFFFF0) << 4); |
1694 |
|
+ pa += (((va)>>SRMMU_PMD_SHIFT & (SRMMU_PTRS_PER_PMD-1)) << 2); |
1695 |
|
+ pte = ld_bypass(pa); |
1696 |
|
+ if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) { |
1697 |
|
+ p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE*sizeof(int), |
1698 |
|
+ SRMMU_PTRS_PER_PTE*sizeof(int)); |
1699 |
|
+ if (p == 0) goto drop; |
1700 |
|
+ pte = SRMMU_ET_PTD | |
1701 |
|
+ (((unsigned int)p - PROLBASE + highbase) >> 4); |
1702 |
|
+ st_bypass(pa, pte); |
1703 |
|
+ } |
1704 |
|
+ |
1705 |
|
+ pa = ((pte & 0xFFFFFFF0) << 4); |
1706 |
|
+ pa += (((va)>>PAGE_SHIFT & (SRMMU_PTRS_PER_PTE-1)) << 2); |
1707 |
|
+ |
1708 |
|
+ pte = SRMMU_ET_PTE | ((epa & PAGE_MASK) >> 4); |
1709 |
|
+ if (type) { /* I/O */ |
1710 |
|
+ pte |= SRMMU_REF; |
1711 |
|
+ /* SRMMU cannot make Supervisor-only, but not exectutable */ |
1712 |
|
+ pte |= SRMMU_PRIV; |
1713 |
|
+ } else { /* memory */ |
1714 |
|
+ pte |= SRMMU_REF|SRMMU_CACHE; |
1715 |
|
+ pte |= SRMMU_PRIV; /* Supervisor only access */ |
1716 |
|
+ } |
1717 |
|
+ st_bypass(pa, pte); |
1718 |
|
+ return 0; |
1719 |
|
+ |
1720 |
|
+drop: |
1721 |
|
+ return -1; |
1722 |
|
+} |
1723 |
|
+ |
1724 |
|
+/* |
1725 |
|
+ * Switch page tables. |
1726 |
|
+ */ |
1727 |
|
+void |
1728 |
|
+init_mmu_swift(unsigned int ctp_phy) |
1729 |
|
+{ |
1730 |
|
+ unsigned int addr; |
1731 |
|
+ |
1732 |
|
+ /* |
1733 |
|
+ * Flush cache |
1734 |
|
+ */ |
1735 |
|
+ for (addr = 0; addr < 0x2000; addr += 0x10) { |
1736 |
|
+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : : |
1737 |
|
+ "r" (addr), "i" (ASI_M_DATAC_TAG)); |
1738 |
|
+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : : |
1739 |
|
+ "r" (addr<<1), "i" (ASI_M_TXTC_TAG)); |
1740 |
|
+ } |
1741 |
|
+ |
1742 |
|
+ /* |
1743 |
|
+ * Switch ctx table |
1744 |
|
+ */ |
1745 |
|
+ ctp_phy >>= 4; |
1746 |
|
+ /* printk("done flushing, switching to %x\n", ctp_phy); */ |
1747 |
|
+ __asm__ __volatile__ ("sta %0, [%1] %2\n\t" : : |
1748 |
|
+ "r" (ctp_phy), "r" (AC_M_CTPR), "i" (ASI_M_MMUREGS)); |
1749 |
|
+ |
1750 |
|
+ /* |
1751 |
|
+ * Flush old page table references |
1752 |
|
+ */ |
1753 |
|
+ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : : |
1754 |
|
+ "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory"); |
1755 |
|
+} |
1756 |
|
+ |
1757 |
|
+/* |
1758 |
|
+ * add_timer, del_timer |
1759 |
|
+ * This should go into sched.c, but we have it split for different archs. |
1760 |
|
+ */ |
1761 |
|
+struct timer_list_head { |
1762 |
|
+ struct timer_list *head, *tail; |
1763 |
|
+}; |
1764 |
|
+ |
1765 |
|
+static struct timer_list_head timers; /* Anonymous heap of timers */ |
1766 |
|
+ |
1767 |
|
+void add_timer(struct timer_list *timer) { |
1768 |
|
+ struct timer_list *p; |
1769 |
|
+ if (timer->prev != NULL || timer->next != NULL) { |
1770 |
|
+ printk("bug: kernel timer added twice at 0x%x.\n", |
1771 |
|
+ __builtin_return_address(0)); |
1772 |
|
+ return; |
1773 |
|
+ } |
1774 |
|
+ if ((p = timers.tail) != NULL) { |
1775 |
|
+ timer->prev = p; |
1776 |
|
+ p->next = timer; |
1777 |
|
+ timers.tail = timer; |
1778 |
|
+ } else { |
1779 |
|
+ timers.head = timer; |
1780 |
|
+ timers.tail = timer; |
1781 |
|
+ } |
1782 |
|
+ return; |
1783 |
|
+} |
1784 |
|
+ |
1785 |
|
+int del_timer(struct timer_list *timer) { |
1786 |
|
+ struct timer_list *p; |
1787 |
|
+ int ret; |
1788 |
|
+ |
1789 |
|
+ if (timers.head == timer) timers.head = timer->next; |
1790 |
|
+ if (timers.tail == timer) timers.tail = timer->prev; |
1791 |
|
+ if ((p = timer->prev) != NULL) p->next = timer->next; |
1792 |
|
+ if ((p = timer->next) != NULL) p->prev = timer->prev; |
1793 |
|
+ ret = timer->next != 0 || timer->prev != 0; |
1794 |
|
+ timer->next = NULL; |
1795 |
|
+ timer->prev = NULL; |
1796 |
|
+ return ret; |
1797 |
|
+} |
1798 |
|
+ |
1799 |
|
+void run_timers() { |
1800 |
|
+ struct timer_list *p; |
1801 |
|
+ |
1802 |
|
+ p = timers.head; |
1803 |
|
+ while (p != NULL) { |
1804 |
|
+ if (p->expires < jiffies) { |
1805 |
|
+ del_timer(p); /* XXX make nonstatic member */ |
1806 |
|
+ (*p->function)(p->data); |
1807 |
|
+ p = timers.head; |
1808 |
|
+ } else { |
1809 |
|
+ p = p->next; |
1810 |
|
+ } |
1811 |
|
+ } |
1812 |
|
+} |
1813 |
|
+ |
1814 |
|
+/* |
1815 |
|
+ * Allocate memory. This is reusable. |
1816 |
|
+ */ |
1817 |
|
+void mem_init(struct mem *t, char *begin, char *limit) |
1818 |
|
+{ |
1819 |
|
+ t->start = begin; |
1820 |
|
+ t->uplim = limit; |
1821 |
|
+ t->curp = begin; |
1822 |
|
+} |
1823 |
|
+ |
1824 |
|
+void mem_fini(struct mem *t) |
1825 |
|
+{ |
1826 |
|
+ t->curp = 0; |
1827 |
|
+} |
1828 |
|
+ |
1829 |
|
+void *mem_alloc(struct mem *t, int size, int align) |
1830 |
|
+{ |
1831 |
|
+ char *p; |
1832 |
|
+ |
1833 |
|
+ p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1)); |
1834 |
|
+ if (p >= t->uplim || p + size > t->uplim) return 0; |
1835 |
|
+ t->curp = p + size; |
1836 |
|
+ return p; |
1837 |
|
+} |
1838 |
|
+ |
1839 |
|
+void *mem_zalloc(struct mem *t, int size, int align) |
1840 |
|
+{ |
1841 |
|
+ char *p; |
1842 |
|
+ |
1843 |
|
+ if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size); |
1844 |
|
+ return p; |
1845 |
|
+} |
1846 |
|
+ |
1847 |
|
+/* |
1848 |
|
+ * Library functions |
1849 |
|
+ */ |
1850 |
|
+void bzero(void *s, int len) { |
1851 |
|
+ while (len--) *((char *)s)++ = 0; |
1852 |
|
+} |
1853 |
|
+ |
1854 |
|
+void bcopy(const void *f, void *t, int len) { |
1855 |
|
+ while (len--) *((char *)t)++ = *((char *)f)++; |
1856 |
|
+} |
1857 |
|
+ |
1858 |
|
+/* Comparison is 7-bit */ |
1859 |
|
+int bcmp(const void *s1, const void *s2, int len) |
1860 |
|
+{ |
1861 |
|
+ int i; |
1862 |
|
+ char ch; |
1863 |
|
+ |
1864 |
|
+ while (len--) { |
1865 |
|
+ ch = *((char *)s1)++; |
1866 |
|
+ if ((i = ch - *((char *)s2)++) != 0) |
1867 |
|
+ return i; |
1868 |
|
+ if (ch == 0) |
1869 |
|
+ return 0; |
1870 |
|
+ } |
1871 |
|
+ return 0; |
1872 |
|
+} |
1873 |
|
+ |
1874 |
|
+int strlen(const char *s) { |
1875 |
|
+ const char *p; |
1876 |
|
+ for (p = s; *p != 0; p++) { } |
1877 |
|
+ return p - s; |
1878 |
|
+} |
1879 |
|
+ |
1880 |
|
+extern void *printk_fn; |
1881 |
|
+ |
1882 |
|
+void printk(char *fmt, ...) |
1883 |
|
+{ |
1884 |
|
+ struct prf_fp { |
1885 |
|
+ void *xfp; |
1886 |
|
+ void (*write)(void *, char *, int); |
1887 |
|
+ } prfa; |
1888 |
|
+ extern void prf(struct prf_fp *, char *fmt, va_list adx); |
1889 |
|
+ va_list x1; |
1890 |
|
+ |
1891 |
|
+ va_start(x1, fmt); |
1892 |
|
+ prfa.xfp = &dp0; |
1893 |
|
+ prfa.write = printk_fn; |
1894 |
|
+ prf(&prfa, fmt, x1); |
1895 |
|
+ va_end(x1); |
1896 |
|
+} |
1897 |
|
+ |
1898 |
|
+void fatal() |
1899 |
|
+{ |
1900 |
|
+ printk("fatal."); |
1901 |
|
+loop: goto loop; |
1902 |
|
+} |
1903 |
|
+ |
1904 |
|
+/* |
1905 |
|
+ * Get the highest bit number from the mask. |
1906 |
|
+ */ |
1907 |
|
+int highc(int mask, int size) |
1908 |
|
+{ |
1909 |
|
+ int m1; |
1910 |
|
+ |
1911 |
|
+ m1 = 1 << size; |
1912 |
|
+ while (size != 0) { |
1913 |
|
+ size--; |
1914 |
|
+ m1 >>= 1; |
1915 |
|
+ if (m1 & mask) break; |
1916 |
|
+ } |
1917 |
|
+ return size; |
1918 |
|
+} |
1919 |
|
+ |
1920 |
|
+/* |
1921 |
|
+ */ |
1922 |
|
+unsigned int ld_bp_swap(unsigned int ptr) { |
1923 |
|
+ unsigned int n; |
1924 |
|
+ n = ld_bypass(ptr); |
1925 |
|
+ n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24); |
1926 |
|
+ return n; |
1927 |
|
+} |
1928 |
|
+ |
1929 |
|
+void st_bp_swap(unsigned int ptr, unsigned int n) { |
1930 |
|
+ n = (n>>24 & 0xFF) | (n>>8 & 0xFF00) | ((n&0xFF00) << 8) | (n<<24); |
1931 |
|
+ st_bypass(ptr, n); |
1932 |
|
+}; |
1933 |
|
diff -ruN proll_18.orig/src/arp.c proll-patch7/src/arp.c |
1934 |
--- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000 |
--- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000 |
1935 |
+++ proll-patch4/src/arp.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/arp.c 2004-11-13 15:50:49.000000000 +0000 |
1936 |
@@ -45,7 +45,7 @@ |
@@ -45,7 +45,7 @@ |
1937 |
#endif |
#endif |
1938 |
static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */ |
static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */ |
1967 |
+ def_gw = IP_ANY; |
+ def_gw = IP_ANY; |
1968 |
return(TRUE); |
return(TRUE); |
1969 |
} |
} |
1970 |
diff -ruN proll_18.orig/src/arp.h proll-patch4/src/arp.h |
diff -ruN proll_18.orig/src/arp.h proll-patch7/src/arp.h |
1971 |
--- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000 |
--- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000 |
1972 |
+++ proll-patch4/src/arp.h 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/arp.h 2004-11-13 15:50:49.000000000 +0000 |
1973 |
@@ -104,7 +104,7 @@ |
@@ -104,7 +104,7 @@ |
1974 |
extern int init_arp __P((void)); |
extern int init_arp __P((void)); |
1975 |
|
|
1979 |
|
|
1980 |
/* Add a new antry to the ARP cache */ |
/* Add a new antry to the ARP cache */ |
1981 |
extern void addcache __P((unsigned char *ha, t_ipaddr ip)); |
extern void addcache __P((unsigned char *ha, t_ipaddr ip)); |
1982 |
diff -ruN proll_18.orig/src/hconsole.c proll-patch4/src/hconsole.c |
diff -ruN proll_18.orig/src/hconsole.c proll-patch7/src/hconsole.c |
1983 |
--- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000 |
--- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000 |
1984 |
+++ proll-patch4/src/hconsole.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/hconsole.c 2005-03-02 17:03:09.000000000 +0000 |
1985 |
@@ -42,7 +42,11 @@ |
@@ -29,6 +29,10 @@ |
1986 |
|
struct raster r_master; /* For a case of resize, whole fb */ |
1987 |
|
struct raster r_0; /* malloc() erzatz */ |
1988 |
|
|
1989 |
|
+#ifdef QEMU |
1990 |
|
+extern unsigned int q_height, q_width; |
1991 |
|
+#endif |
1992 |
|
+ |
1993 |
|
int hcon_init(struct hconsole *t, unsigned int a0) |
1994 |
|
{ |
1995 |
|
struct raster *q, *r; |
1996 |
|
@@ -42,7 +46,11 @@ |
1997 |
* No probing sequence or argument passing, hardcode everything. XXX |
* No probing sequence or argument passing, hardcode everything. XXX |
1998 |
*/ |
*/ |
1999 |
raster8_cons_a(q, 768, 1024, (char *)a0); |
raster8_cons_a(q, 768, 1024, (char *)a0); |
2000 |
+#if 1 |
+#ifndef QEMU |
2001 |
raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80)); |
raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80)); |
2002 |
+#else |
+#else |
2003 |
+ raster_cons_2(r, q, 0, 0, 768, 1024); |
+ raster_cons_2(r, q, 0, 0, q_height, q_width); |
2004 |
+#endif |
+#endif |
2005 |
t->r_ = r; |
t->r_ = r; |
2006 |
t->r0_ = q; |
t->r0_ = q; |
2007 |
t->f_ = &f_master; |
t->f_ = &f_master; |
2008 |
diff -ruN proll_18.orig/src/lat7_2.bm proll-patch4/src/lat7_2.bm |
diff -ruN proll_18.orig/src/lat7_2.bm proll-patch7/src/lat7_2.bm |
2009 |
--- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000 |
--- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000 |
2010 |
+++ proll-patch4/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000 |
2011 |
@@ -1,6 +1,6 @@ |
@@ -1,6 +1,6 @@ |
2012 |
#define lat7_2_width 128 |
#define lat7_2_width 128 |
2013 |
#define lat7_2_height 88 |
#define lat7_2_height 88 |
2016 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
2017 |
0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18, |
0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18, |
2018 |
0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02, |
0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02, |
2019 |
diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch4/src/lat7_2_swapped.bm |
diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch7/src/lat7_2_swapped.bm |
2020 |
--- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000 |
--- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000 |
2021 |
+++ proll-patch4/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000 |
2022 |
@@ -0,0 +1,121 @@ |
@@ -0,0 +1,121 @@ |
2023 |
+#define lat7_2_width 128 |
+#define lat7_2_width 128 |
2024 |
+#define lat7_2_height 88 |
+#define lat7_2_height 88 |
2141 |
+ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00, |
+ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00, |
2142 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00, |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00, |
2143 |
+ 0x00, 0x00, 0x00, 0x00}; |
+ 0x00, 0x00, 0x00, 0x00}; |
2144 |
diff -ruN proll_18.orig/src/le.c proll-patch4/src/le.c |
diff -ruN proll_18.orig/src/le.c proll-patch7/src/le.c |
2145 |
--- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000 |
--- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000 |
2146 |
+++ proll-patch4/src/le.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/le.c 2004-11-13 15:50:49.000000000 +0000 |
2147 |
@@ -185,8 +185,6 @@ |
@@ -185,8 +185,6 @@ |
2148 |
unsigned short rap; /* register address port */ |
unsigned short rap; /* register address port */ |
2149 |
}; |
}; |
2153 |
/* The Lance uses 24 bit addresses */ |
/* The Lance uses 24 bit addresses */ |
2154 |
/* On the Sun4c the DVMA will provide the remaining bytes for us */ |
/* On the Sun4c the DVMA will provide the remaining bytes for us */ |
2155 |
/* On the Sun4m we have to instruct the ledma to provide them */ |
/* On the Sun4m we have to instruct the ledma to provide them */ |
2156 |
diff -ruN proll_18.orig/src/netinit.c proll-patch4/src/netinit.c |
diff -ruN proll_18.orig/src/netinit.c proll-patch7/src/netinit.c |
2157 |
--- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000 |
--- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000 |
2158 |
+++ proll-patch4/src/netinit.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/netinit.c 2004-11-13 15:50:49.000000000 +0000 |
2159 |
@@ -49,13 +49,20 @@ |
@@ -49,13 +49,20 @@ |
2160 |
unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */ |
unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */ |
2161 |
t_ipaddr myipaddr; /* my own IP address */ |
t_ipaddr myipaddr; /* my own IP address */ |
2199 |
fatal(); |
fatal(); |
2200 |
} |
} |
2201 |
} |
} |
2202 |
diff -ruN proll_18.orig/src/netpriv.h proll-patch4/src/netpriv.h |
diff -ruN proll_18.orig/src/netpriv.h proll-patch7/src/netpriv.h |
2203 |
--- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000 |
--- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000 |
2204 |
+++ proll-patch4/src/netpriv.h 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/netpriv.h 2004-11-13 15:50:49.000000000 +0000 |
2205 |
@@ -130,10 +130,9 @@ |
@@ -130,10 +130,9 @@ |
2206 |
* |
* |
2207 |
*/ |
*/ |
2223 |
|
|
2224 |
/* Empty read buffer */ |
/* Empty read buffer */ |
2225 |
extern void empty_buf __P((void)); |
extern void empty_buf __P((void)); |
2226 |
diff -ruN proll_18.orig/src/openprom.h proll-patch4/src/openprom.h |
diff -ruN proll_18.orig/src/openprom.h proll-patch7/src/openprom.h |
2227 |
--- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000 |
--- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000 |
2228 |
+++ proll-patch4/src/openprom.h 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/openprom.h 2004-11-13 15:50:49.000000000 +0000 |
2229 |
@@ -54,20 +54,20 @@ |
@@ -54,20 +54,20 @@ |
2230 |
}; |
}; |
2231 |
|
|
2287 |
}; |
}; |
2288 |
|
|
2289 |
/* More fun PROM structures for device probing. */ |
/* More fun PROM structures for device probing. */ |
2290 |
diff -ruN proll_18.orig/src/packet.c proll-patch4/src/packet.c |
diff -ruN proll_18.orig/src/packet.c proll-patch7/src/packet.c |
2291 |
--- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000 |
--- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000 |
2292 |
+++ proll-patch4/src/packet.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/packet.c 2004-11-13 15:50:49.000000000 +0000 |
2293 |
@@ -41,7 +41,7 @@ |
@@ -41,7 +41,7 @@ |
2294 |
int aligner; |
int aligner; |
2295 |
} wbuf; |
} wbuf; |
2317 |
{ |
{ |
2318 |
struct sk_buff *skb; |
struct sk_buff *skb; |
2319 |
unsigned char *s; |
unsigned char *s; |
2320 |
diff -ruN proll_18.orig/src/printf.c proll-patch4/src/printf.c |
diff -ruN proll_18.orig/src/printf.c proll-patch7/src/printf.c |
2321 |
--- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000 |
--- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000 |
2322 |
+++ proll-patch4/src/printf.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/printf.c 2004-11-13 15:50:49.000000000 +0000 |
2323 |
@@ -19,7 +19,7 @@ |
@@ -19,7 +19,7 @@ |
2324 |
static void printn(struct prf_fp *, unsigned long, unsigned int); |
static void printn(struct prf_fp *, unsigned long, unsigned int); |
2325 |
static void putchar(char, struct prf_fp *); |
static void putchar(char, struct prf_fp *); |
2347 |
putchar(c,filog); |
putchar(c,filog); |
2348 |
} else if (c == 'l' || c == 'O') { |
} else if (c == 'l' || c == 'O') { |
2349 |
printn(filog, (long)va_arg(adx,long), c=='l'?10:8); |
printn(filog, (long)va_arg(adx,long), c=='l'?10:8); |
2350 |
diff -ruN proll_18.orig/src/rconsole.c proll-patch4/src/rconsole.c |
diff -ruN proll_18.orig/src/rconsole.c proll-patch7/src/rconsole.c |
2351 |
--- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000 |
--- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000 |
2352 |
+++ proll-patch4/src/rconsole.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/rconsole.c 2004-11-13 15:50:49.000000000 +0000 |
2353 |
@@ -28,12 +28,18 @@ |
@@ -28,12 +28,18 @@ |
2354 |
* move to California. Only plain lat7 survived. |
* move to California. Only plain lat7 survived. |
2355 |
* I recreated lat7-1 changes in lat7-2. --zaitcev |
* I recreated lat7-1 changes in lat7-2. --zaitcev |
2404 |
p->nchars_ = LAT7_NCHARS; |
p->nchars_ = LAT7_NCHARS; |
2405 |
p->width_ = LAT7_WIDTH; |
p->width_ = LAT7_WIDTH; |
2406 |
p->height_ = LAT7_HEIGHT; |
p->height_ = LAT7_HEIGHT; |
2407 |
diff -ruN proll_18.orig/src/rconsole.h proll-patch4/src/rconsole.h |
diff -ruN proll_18.orig/src/rconsole.h proll-patch7/src/rconsole.h |
2408 |
--- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000 |
--- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000 |
2409 |
+++ proll-patch4/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000 |
2410 |
@@ -13,10 +13,10 @@ |
@@ -13,10 +13,10 @@ |
2411 |
*/ |
*/ |
2412 |
|
|
2420 |
int nchars_; /* 128 for ASCII ... 65536 for Unicode */ |
int nchars_; /* 128 for ASCII ... 65536 for Unicode */ |
2421 |
int width_; /* [Pixels]. Maximum size is 16. */ |
int width_; /* [Pixels]. Maximum size is 16. */ |
2422 |
int height_; /* [Pixels == scan lines]. */ |
int height_; /* [Pixels == scan lines]. */ |
2423 |
diff -ruN proll_18.orig/src/romlib.h proll-patch4/src/romlib.h |
diff -ruN proll_18.orig/src/romlib.h proll-patch7/src/romlib.h |
2424 |
--- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000 |
--- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000 |
2425 |
+++ proll-patch4/src/romlib.h 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/romlib.h 2004-11-13 15:50:49.000000000 +0000 |
2426 |
@@ -73,12 +73,12 @@ |
@@ -73,12 +73,12 @@ |
2427 |
#define memcpy(dst, src, len) bcopy(src, dst, len) |
#define memcpy(dst, src, len) bcopy(src, dst, len) |
2428 |
#define memcmp(x1, x2, len) bcmp(x1, x2, len) |
#define memcmp(x1, x2, len) bcmp(x1, x2, len) |
2439 |
|
|
2440 |
|
|
2441 |
/* |
/* |
2442 |
diff -ruN proll_18.orig/src/sched_4m.c proll-patch4/src/sched_4m.c |
diff -ruN proll_18.orig/src/sched_4m.c proll-patch7/src/sched_4m.c |
2443 |
--- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000 |
--- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000 |
2444 |
+++ proll-patch4/src/sched_4m.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/sched_4m.c 2004-11-13 15:50:49.000000000 +0000 |
2445 |
@@ -108,7 +108,7 @@ |
@@ -108,7 +108,7 @@ |
2446 |
static int set_bolt; /* Tick counter limit */ |
static int set_bolt; /* Tick counter limit */ |
2447 |
static struct handsc hndv[16]; |
static struct handsc hndv[16]; |
2451 |
0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0, |
0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0, |
2452 |
0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, |
2453 |
}; |
}; |
2454 |
diff -ruN proll_18.orig/src/swap.c proll-patch4/src/swap.c |
diff -ruN proll_18.orig/src/swap.c proll-patch7/src/swap.c |
2455 |
--- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000 |
--- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000 |
2456 |
+++ proll-patch4/src/swap.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/swap.c 2004-11-13 15:50:49.000000000 +0000 |
2457 |
@@ -0,0 +1,21 @@ |
@@ -0,0 +1,21 @@ |
2458 |
+// Convert the lat7 font so that no conversion is needed at runtime. |
+// Convert the lat7 font so that no conversion is needed at runtime. |
2459 |
+#define ORIG |
+#define ORIG |
2476 |
+ } |
+ } |
2477 |
+ printf("\n"); |
+ printf("\n"); |
2478 |
+} |
+} |
2479 |
diff -ruN proll_18.orig/src/system.c proll-patch4/src/system.c |
diff -ruN proll_18.orig/src/system.c proll-patch7/src/system.c |
2480 |
--- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000 |
--- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000 |
2481 |
+++ proll-patch4/src/system.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/system.c 2004-11-13 15:50:49.000000000 +0000 |
2482 |
@@ -298,8 +298,8 @@ |
@@ -298,8 +298,8 @@ |
2483 |
} |
} |
2484 |
|
|
2531 |
void fatal() |
void fatal() |
2532 |
{ |
{ |
2533 |
printk("fatal."); |
printk("fatal."); |
2534 |
diff -ruN proll_18.orig/src/system.h proll-patch4/src/system.h |
diff -ruN proll_18.orig/src/system.h proll-patch7/src/system.h |
2535 |
--- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000 |
--- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000 |
2536 |
+++ proll-patch4/src/system.h 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/system.h 2004-11-13 15:50:49.000000000 +0000 |
2537 |
@@ -16,7 +16,7 @@ |
@@ -16,7 +16,7 @@ |
2538 |
#define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */ |
#define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */ |
2539 |
#define NCTX_SWIFT 0x100 |
#define NCTX_SWIFT 0x100 |
2543 |
|
|
2544 |
#ifndef __ASSEMBLY__ |
#ifndef __ASSEMBLY__ |
2545 |
struct bank { |
struct bank { |
2546 |
diff -ruN proll_18.orig/src/udp.c proll-patch4/src/udp.c |
diff -ruN proll_18.orig/src/udp.c proll-patch7/src/udp.c |
2547 |
--- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000 |
--- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000 |
2548 |
+++ proll-patch4/src/udp.c 2004-11-13 15:50:49.000000000 +0000 |
+++ proll-patch7/src/udp.c 2004-11-13 15:50:49.000000000 +0000 |
2549 |
@@ -81,7 +81,7 @@ |
@@ -81,7 +81,7 @@ |
2550 |
int source; |
int source; |
2551 |
int dest; |
int dest; |
2565 |
/* Register IP packet type and set write buffer pointer */ |
/* Register IP packet type and set write buffer pointer */ |
2566 |
if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL) |
if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL) |
2567 |
return(FALSE); |
return(FALSE); |
2568 |
|
diff -ruN proll_18.orig/src/vcons_zs.c proll-patch7/src/vcons_zs.c |
2569 |
|
--- proll_18.orig/src/vcons_zs.c 1970-01-01 00:00:00.000000000 +0000 |
2570 |
|
+++ proll-patch7/src/vcons_zs.c 2005-03-02 12:07:41.000000000 +0000 |
2571 |
|
@@ -0,0 +1,68 @@ |
2572 |
|
+/** |
2573 |
|
+ ** Console over 'zs' (Zilog serial port) |
2574 |
|
+ ** Copyright 1999 Pete Zaitcev |
2575 |
|
+ ** This code is licensed under GNU General Public License. |
2576 |
|
+ **/ |
2577 |
|
+ |
2578 |
|
+#include "vconsole.h" |
2579 |
|
+#include <system.h> |
2580 |
|
+ |
2581 |
|
+#define ZS_DATA 0x02 |
2582 |
|
+ |
2583 |
|
+int vcon_zs_init(struct vconterm *t, unsigned int a0) |
2584 |
|
+{ |
2585 |
|
+ |
2586 |
|
+ t->impl = (void *) a0; |
2587 |
|
+ |
2588 |
|
+ t->vc_x = 0; t->vc_y = 0; |
2589 |
|
+ t->backp = 0; t->backc = 0; |
2590 |
|
+ |
2591 |
|
+ stb_bypass(a0, 3); // reg 3 |
2592 |
|
+ stb_bypass(a0, 1); // enable rx |
2593 |
|
+ |
2594 |
|
+ stb_bypass(a0, 5); // reg 5 |
2595 |
|
+ stb_bypass(a0, 8); // enable tx |
2596 |
|
+ |
2597 |
|
+ return 0; |
2598 |
|
+} |
2599 |
|
+ |
2600 |
|
+int vcon_zs_putch(struct vconterm *t, char c) |
2601 |
|
+{ |
2602 |
|
+ unsigned zs_ptr = (unsigned) t->impl; |
2603 |
|
+ |
2604 |
|
+ //while ((ldb_bypass(zs_ptr + ZS_LSR) & 0x60) != 0x60) { } |
2605 |
|
+ stb_bypass(zs_ptr + ZS_DATA, c); |
2606 |
|
+ return 0; |
2607 |
|
+} |
2608 |
|
+ |
2609 |
|
+int vcon_zs_write(struct vconterm *t, char *data, int leng) |
2610 |
|
+{ |
2611 |
|
+ while (leng != 0) { |
2612 |
|
+ leng--; |
2613 |
|
+ vcon_zs_putch(t, *data++); |
2614 |
|
+ } |
2615 |
|
+ return leng; |
2616 |
|
+} |
2617 |
|
+ |
2618 |
|
+int vcon_zs_read(struct vconterm *t, char *data, int leng) |
2619 |
|
+{ |
2620 |
|
+ unsigned zs_ptr = (unsigned) t->impl; |
2621 |
|
+ |
2622 |
|
+ while ((ldb_bypass(zs_ptr) & 1) != 1) { } |
2623 |
|
+ *data = ldb_bypass(zs_ptr + ZS_DATA); |
2624 |
|
+ return 0; |
2625 |
|
+} |
2626 |
|
+ |
2627 |
|
+int vcon_zs_getch(struct vconterm *t) |
2628 |
|
+{ |
2629 |
|
+ unsigned zs_ptr = (unsigned) t->impl; |
2630 |
|
+ |
2631 |
|
+ while ((ldb_bypass(zs_ptr) & 1) != 1) { } |
2632 |
|
+ return ldb_bypass(zs_ptr + ZS_DATA); |
2633 |
|
+} |
2634 |
|
+ |
2635 |
|
+void vcon_zs_fini(struct vconterm *t) |
2636 |
|
+{ |
2637 |
|
+ /* violent crash in the end */ |
2638 |
|
+ ; |
2639 |
|
+} |
2640 |
|
diff -ruN proll_18.orig/src/vconsole.c proll-patch7/src/vconsole.c |
2641 |
|
--- proll_18.orig/src/vconsole.c 1999-11-08 03:10:28.000000000 +0000 |
2642 |
|
+++ proll-patch7/src/vconsole.c 2005-03-02 14:29:05.000000000 +0000 |
2643 |
|
@@ -13,6 +13,10 @@ |
2644 |
|
|
2645 |
|
struct hconsole hcons0; |
2646 |
|
|
2647 |
|
+enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey, |
2648 |
|
+ EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, |
2649 |
|
+ ESpalette }; |
2650 |
|
+ |
2651 |
|
int vcon_init(struct vconterm *t, unsigned int a0) |
2652 |
|
{ |
2653 |
|
struct hconsole *hconp; |
2654 |
|
@@ -25,11 +29,49 @@ |
2655 |
|
|
2656 |
|
t->vc_x = 0; t->vc_y = 0; |
2657 |
|
t->backp = 0; t->backc = 0; |
2658 |
|
+ t->vc_state = ESnormal; |
2659 |
|
|
2660 |
|
hcon_clear(hconp, 0, 0, hconp->ydim_, hconp->xdim_); |
2661 |
|
return 0; |
2662 |
|
} |
2663 |
|
|
2664 |
|
+/* |
2665 |
|
+ * gotoxy() must verify all boundaries, because the arguments |
2666 |
|
+ * might also be negative. If the given position is out of |
2667 |
|
+ * bounds, the cursor is placed at the nearest margin. |
2668 |
|
+ */ |
2669 |
|
+static void gotoxy(struct vconterm *vc, int new_x, int new_y) |
2670 |
|
+{ |
2671 |
|
+ int max_x, max_y; |
2672 |
|
+ struct hconsole *hconp = vc->impl; |
2673 |
|
+ |
2674 |
|
+ max_x = hcon_qxdim(hconp); |
2675 |
|
+ max_y = hcon_qydim(hconp); |
2676 |
|
+ |
2677 |
|
+ if (new_x < 0) |
2678 |
|
+ vc->vc_x = 0; |
2679 |
|
+ else { |
2680 |
|
+ if (new_x >= max_x) |
2681 |
|
+ vc->vc_x = max_x - 1; |
2682 |
|
+ else |
2683 |
|
+ vc->vc_x = new_x; |
2684 |
|
+ } |
2685 |
|
+ |
2686 |
|
+ if (new_y < 0) |
2687 |
|
+ vc->vc_y = 0; |
2688 |
|
+ else if (new_y >= max_y) |
2689 |
|
+ vc->vc_y = max_y - 1; |
2690 |
|
+ else |
2691 |
|
+ vc->vc_y = new_y; |
2692 |
|
+ |
2693 |
|
+} |
2694 |
|
+ |
2695 |
|
+/* for absolute user moves, when decom is set */ |
2696 |
|
+static void gotoxay(struct vconterm *t, int new_x, int new_y) |
2697 |
|
+{ |
2698 |
|
+ gotoxy(t, new_x, new_y); |
2699 |
|
+} |
2700 |
|
+ |
2701 |
|
int vcon_write(struct vconterm *t, char *data, int leng) |
2702 |
|
{ |
2703 |
|
int l = leng; |
2704 |
|
@@ -40,29 +82,84 @@ |
2705 |
|
if (l <= 0) break; |
2706 |
|
c = *data++; --l; |
2707 |
|
|
2708 |
|
- switch (c) { |
2709 |
|
- case 0x07: /* Bell */ |
2710 |
|
- vcon_i_backflush(t); |
2711 |
|
- break; |
2712 |
|
- case 0x0A: /* Linefeed */ |
2713 |
|
- vcon_i_backflush(t); |
2714 |
|
- vcon_i_cursfeed(t); |
2715 |
|
+ switch(t->vc_state) { |
2716 |
|
+ case ESesc: |
2717 |
|
+ t->vc_state = ESnormal; |
2718 |
|
+ switch (c) { |
2719 |
|
+ case '[': |
2720 |
|
+ t->vc_state = ESsquare; |
2721 |
|
+ break; |
2722 |
|
+ case 'M': |
2723 |
|
+ hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1); |
2724 |
|
+ break; |
2725 |
|
+ } |
2726 |
|
break; |
2727 |
|
- case 0x0D: /* Return */ |
2728 |
|
- vcon_i_backflush(t); |
2729 |
|
- t->vc_x = 0; |
2730 |
|
+ case ESsquare: |
2731 |
|
+ for(t->vc_npar = 0 ; t->vc_npar < NPAR ; t->vc_npar++) |
2732 |
|
+ t->vc_par[t->vc_npar] = 0; |
2733 |
|
+ t->vc_npar = 0; |
2734 |
|
+ t->vc_state = ESgetpars; |
2735 |
|
+ case ESgetpars: |
2736 |
|
+ if (c==';' && t->vc_npar<NPAR-1) { |
2737 |
|
+ t->vc_npar++; |
2738 |
|
+ break; |
2739 |
|
+ } else if (c>='0' && c<='9') { |
2740 |
|
+ t->vc_par[t->vc_npar] *= 10; |
2741 |
|
+ t->vc_par[t->vc_npar] += c-'0'; |
2742 |
|
+ break; |
2743 |
|
+ } else t->vc_state=ESgotpars; |
2744 |
|
+ case ESgotpars: |
2745 |
|
+ t->vc_state = ESnormal; |
2746 |
|
+ switch(c) { |
2747 |
|
+ case 'H': case 'f': |
2748 |
|
+ if (t->vc_par[0]) t->vc_par[0]--; |
2749 |
|
+ if (t->vc_par[1]) t->vc_par[1]--; |
2750 |
|
+ gotoxay(t, t->vc_par[1], t->vc_par[0]); |
2751 |
|
+ break; |
2752 |
|
+ case 'M': |
2753 |
|
+ hcon_scroll(hconp, 0, hcon_qydim(hconp), SM_UP, 1); |
2754 |
|
+ break; |
2755 |
|
+ } |
2756 |
|
break; |
2757 |
|
default: |
2758 |
|
- if (t->backp == 0) { |
2759 |
|
- t->backc = 1; |
2760 |
|
- t->backp = data-1; |
2761 |
|
- } else { |
2762 |
|
- t->backc++; |
2763 |
|
- } |
2764 |
|
- if (t->vc_x + t->backc >= hcon_qxdim(hconp)) { |
2765 |
|
+ t->vc_state = ESnormal; |
2766 |
|
+ switch (c) { |
2767 |
|
+ case 0x07: /* Bell */ |
2768 |
|
+ vcon_i_backflush(t); |
2769 |
|
+ break; |
2770 |
|
+ case 0x08: /* BS */ |
2771 |
|
+ vcon_i_backflush(t); |
2772 |
|
+ if (t->vc_x > 0) |
2773 |
|
+ t->vc_x--; |
2774 |
|
+ break; |
2775 |
|
+ case 0x0A: /* Linefeed */ |
2776 |
|
vcon_i_backflush(t); |
2777 |
|
- t->vc_x = 0; |
2778 |
|
vcon_i_cursfeed(t); |
2779 |
|
+ break; |
2780 |
|
+ case 0x0D: /* Return */ |
2781 |
|
+ vcon_i_backflush(t); |
2782 |
|
+ t->vc_x = 0; |
2783 |
|
+ break; |
2784 |
|
+ case 24: case 26: |
2785 |
|
+ vcon_i_backflush(t); |
2786 |
|
+ t->vc_state = ESnormal; |
2787 |
|
+ break; |
2788 |
|
+ case 27: |
2789 |
|
+ vcon_i_backflush(t); |
2790 |
|
+ t->vc_state = ESesc; |
2791 |
|
+ break; |
2792 |
|
+ default: |
2793 |
|
+ if (t->backp == 0) { |
2794 |
|
+ t->backc = 1; |
2795 |
|
+ t->backp = data-1; |
2796 |
|
+ } else { |
2797 |
|
+ t->backc++; |
2798 |
|
+ } |
2799 |
|
+ if (t->vc_x + t->backc >= hcon_qxdim(hconp)) { |
2800 |
|
+ vcon_i_backflush(t); |
2801 |
|
+ t->vc_x = 0; |
2802 |
|
+ vcon_i_cursfeed(t); |
2803 |
|
+ } |
2804 |
|
} |
2805 |
|
} |
2806 |
|
} |
2807 |
|
diff -ruN proll_18.orig/src/vconsole.h proll-patch7/src/vconsole.h |
2808 |
|
--- proll_18.orig/src/vconsole.h 1999-11-08 00:58:13.000000000 +0000 |
2809 |
|
+++ proll-patch7/src/vconsole.h 2005-03-02 12:40:12.000000000 +0000 |
2810 |
|
@@ -6,6 +6,8 @@ |
2811 |
|
#ifndef VCONSOLE_H |
2812 |
|
#define VCONSOLE_H |
2813 |
|
|
2814 |
|
+#define NPAR 16 |
2815 |
|
+ |
2816 |
|
struct vconterm { |
2817 |
|
void *impl; |
2818 |
|
|
2819 |
|
@@ -13,6 +15,8 @@ |
2820 |
|
int backc; /* Same, count */ |
2821 |
|
|
2822 |
|
int vc_x, vc_y; /* XXX Make vcon_xxx() to use cellmap->xpos_ */ |
2823 |
|
+ int vc_state; |
2824 |
|
+ unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ |
2825 |
|
}; |
2826 |
|
|
2827 |
|
int vcon_init(struct vconterm *t, unsigned int a0); |