Revision 6f7e9aec pc-bios/proll.patch
b/pc-bios/proll.patch | ||
---|---|---|
1 |
diff -ruN proll_18.orig/Makefile proll-patch4/Makefile
|
|
1 |
diff -ruN proll_18.orig/Makefile proll-patch7/Makefile
|
|
2 | 2 |
--- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000 |
3 |
+++ proll-patch4/Makefile 2004-11-13 15:50:49.000000000 +0000
|
|
3 |
+++ proll-patch7/Makefile 2004-11-13 15:50:49.000000000 +0000
|
|
4 | 4 |
@@ -4,6 +4,7 @@ |
5 | 5 |
make -C krups-ser all |
6 | 6 |
make -C espresso all |
... | ... | |
14 | 14 |
make -C espresso clean |
15 | 15 |
make -C espresso-ser clean |
16 | 16 |
+ make -C qemu clean |
17 |
diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S |
|
17 |
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: proll.patch,v 1.3 2005-03-13 09:43:36 bellard Exp $ |
|
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 |
|
18 | 144 |
--- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000 |
19 |
+++ proll-patch4/qemu/head.S 2004-11-13 15:50:49.000000000 +0000
|
|
20 |
@@ -0,0 +1,515 @@
|
|
145 |
+++ proll-patch7/qemu/head.S 2005-03-02 15:30:47.000000000 +0000
|
|
146 |
@@ -0,0 +1,539 @@
|
|
21 | 147 |
+/** |
22 | 148 |
+ ** Standalone startup code for Linux PROM emulator. |
23 | 149 |
+ ** Copyright 1999 Pete A. Zaitcev |
24 | 150 |
+ ** This code is licensed under GNU General Public License. |
25 | 151 |
+ **/ |
26 | 152 |
+/* |
27 |
+ * $Id: proll.patch,v 1.2 2004-12-19 23:18:01 bellard Exp $
|
|
153 |
+ * $Id: proll.patch,v 1.3 2005-03-13 09:43:36 bellard Exp $
|
|
28 | 154 |
+ */ |
29 | 155 |
+ |
30 | 156 |
+#include <psr.h> |
... | ... | |
167 | 293 |
+_start: |
168 | 294 |
+start: |
169 | 295 |
+ .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 |
+ |
|
170 | 321 |
+C_LABEL(trapbase): |
171 | 322 |
+t_zero: b goprol; nop; nop; nop; |
172 | 323 |
+t_tflt: SRMMU_TFAULT /* Inst. Access Exception */ |
... | ... | |
294 | 445 |
+ |
295 | 446 |
+goprol: |
296 | 447 |
+ ! %g1 contains end of memory |
448 |
+ set PHYS_JJ_EEPROM + 0x30, %g1 |
|
449 |
+ lda [%g1] ASI_M_BYPASS, %g1 |
|
297 | 450 |
+ ! map PROLDATA to PROLBASE+PROLSIZE to end of ram |
298 | 451 |
+ set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables |
299 | 452 |
+ sub %g1, %g2, %g2 ! start of private memory |
... | ... | |
397 | 550 |
+ bl 1b |
398 | 551 |
+ add %o0, 0x4, %o0 |
399 | 552 |
+ |
400 |
+ sethi %hi( C_LABEL(ram_size) ), %o0 |
|
401 |
+ st %g3, [%o0 + %lo( C_LABEL(ram_size) )] |
|
402 |
+ |
|
403 | 553 |
+ mov 2, %g1 |
404 | 554 |
+ wr %g1, 0x0, %wim ! make window 1 invalid |
405 | 555 |
+ WRITE_PAUSE |
... | ... | |
533 | 683 |
+C_LABEL(ldb_bypass): |
534 | 684 |
+ retl |
535 | 685 |
+ lduba [%o0] ASI_M_BYPASS, %o0 |
536 |
diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c
|
|
686 |
diff -ruN proll_18.orig/qemu/main.c proll-patch7/qemu/main.c
|
|
537 | 687 |
--- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000 |
538 |
+++ proll-patch4/qemu/main.c 2004-11-23 19:05:34.000000000 +0000
|
|
539 |
@@ -0,0 +1,178 @@
|
|
688 |
+++ proll-patch7/qemu/main.c 2005-03-02 20:08:23.000000000 +0000
|
|
689 |
@@ -0,0 +1,173 @@
|
|
540 | 690 |
+/** |
541 | 691 |
+ ** Proll (PROM replacement) |
542 | 692 |
+ ** Copyright 1999 Pete Zaitcev |
... | ... | |
558 | 708 |
+#include <arpa.h> |
559 | 709 |
+#include <system.h> /* our own prototypes */ |
560 | 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 |
+ |
|
561 | 715 |
+static void init_idprom(void); |
562 |
+static void makepages_q(struct phym *t, unsigned int highbase); |
|
563 | 716 |
+ |
564 | 717 |
+struct vconterm dp0; |
565 | 718 |
+struct mem cmem; /* Current memory, virtual */ |
... | ... | |
567 | 720 |
+struct phym pmem; /* Current phys. mem. */ |
568 | 721 |
+struct iommu ciommu; /* Our IOMMU on sun4m */ |
569 | 722 |
+ |
570 |
+static char *hw_idprom; |
|
571 |
+int ignore_fault, fault_ignored, ram_size; |
|
723 |
+static struct { |
|
724 |
+ 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; |
|
572 | 738 |
+ |
573 | 739 |
+/* |
574 | 740 |
+ */ |
575 | 741 |
+void prolmain() |
576 | 742 |
+{ |
577 |
+ //static const char fname[14] = "00000000.PROL";
|
|
743 |
+ static char fname[14];
|
|
578 | 744 |
+ static struct banks bb; |
579 | 745 |
+ unsigned int hiphybas; |
580 | 746 |
+ 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 |
+ |
|
581 | 762 |
+ |
582 |
+ vcon_init(&dp0, PHYS_JJ_TCX_FB); |
|
583 | 763 |
+ printk("PROLL %s QEMU\n", PROLL_VERSION_STRING); |
764 |
+ ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30); |
|
584 | 765 |
+ printk("%d MB total\n", ram_size/(1024*1024)); |
585 | 766 |
+ |
586 | 767 |
+ bb.nbanks = 1; |
... | ... | |
590 | 771 |
+ hiphybas = ram_size - PROLSIZE; |
591 | 772 |
+ |
592 | 773 |
+ mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE)); |
593 |
+ makepages_q(&pmem, hiphybas);
|
|
774 |
+ makepages(&pmem, hiphybas); |
|
594 | 775 |
+ init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas); |
595 | 776 |
+ |
596 | 777 |
+ mem_init(&cio, (char *)(PROLBASE+PROLSIZE), |
... | ... | |
601 | 782 |
+ /* |
602 | 783 |
+ */ |
603 | 784 |
+ 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"); |
|
604 | 790 |
+ sched_init(); |
605 | 791 |
+ le_probe(); |
606 | 792 |
+ init_net(); |
607 | 793 |
+ |
608 |
+#if 0 |
|
609 |
+#if 0 /* RARP */ |
|
610 |
+ if (rarp() != 0) fatal(); |
|
611 |
+ /* printrarp(); */ |
|
612 |
+ xtoa(myipaddr, fname, 8); |
|
613 |
+ if (load(servaddr, fname) != 0) fatal(); |
|
614 |
+#else |
|
615 |
+ if (bootp() != 0) fatal(); |
|
616 |
+ /* |
|
617 |
+ * boot_rec.bp_file cannot be used because system PROM |
|
618 |
+ * uses it to locate ourselves. If we load from boot_rec.bp_file, |
|
619 |
+ * we will loop reloading PROLL over and over again. |
|
620 |
+ * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L). |
|
621 |
+ */ |
|
622 |
+ xtoa(myipaddr, fname, 8); |
|
623 |
+ if (load(boot_rec.bp_siaddr, fname) != 0) fatal(); |
|
624 |
+#endif |
|
625 |
+#endif |
|
794 |
+ printk("Boot device: %c\n", hw_idprom->boot_device); |
|
795 |
+ if (hw_idprom->boot_device == 'n') { |
|
796 |
+ if (bootp() != 0) fatal(); |
|
797 |
+ /* |
|
798 |
+ * boot_rec.bp_file cannot be used because system PROM |
|
799 |
+ * uses it to locate ourselves. If we load from boot_rec.bp_file, |
|
800 |
+ * we will loop reloading PROLL over and over again. |
|
801 |
+ * Thus we use traditional PROLL scheme HEXIPADDR.PROL (single L). |
|
802 |
+ */ |
|
803 |
+ xtoa(myipaddr, fname, 8); |
|
804 |
+ fname[9] = '.'; |
|
805 |
+ fname[10] = 'P'; |
|
806 |
+ fname[11] = 'R'; |
|
807 |
+ fname[12] = 'O'; |
|
808 |
+ fname[13] = 'L'; |
|
809 |
+ fname[14] = 0; |
|
810 |
+ |
|
811 |
+ if (load(boot_rec.bp_siaddr, fname) != 0) fatal(); |
|
812 |
+ } |
|
626 | 813 |
+ |
627 |
+ romvec = init_openprom(bb.nbanks, bb.bankv, hiphybas); |
|
814 |
+ romvec = init_openprom_qemu(bb.nbanks, bb.bankv, hiphybas, |
|
815 |
+ (void *)hw_idprom->cmdline, hw_idprom->boot_device, nographic); |
|
628 | 816 |
+ |
629 | 817 |
+ printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n", |
630 | 818 |
+ PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024, |
631 | 819 |
+ (int)cio.start, (int)cio.curp); |
632 |
+ //set_timeout(5); while (!chk_timeout()) { } /* P3: let me read */ |
|
633 | 820 |
+ |
634 | 821 |
+ { |
635 |
+ void (*entry)(const void *, int, int, int, int) = (void (*)(const void*, int, int, int, int)) LOADBASE; |
|
822 |
+ 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); |
|
636 | 825 |
+ entry(romvec, 0, 0, 0, 0); |
637 | 826 |
+ } |
638 | 827 |
+ |
... | ... | |
652 | 841 |
+ */ |
653 | 842 |
+void udelay(unsigned long usecs) |
654 | 843 |
+{ |
655 |
+ int i, n; |
|
656 |
+ n = usecs*50; |
|
657 |
+ for (i = 0; i < n; i++) { } |
|
844 |
+ // Qemu hardware is perfect and does not need any delays! |
|
658 | 845 |
+} |
659 | 846 |
+ |
660 | 847 |
+static void init_idprom() |
661 | 848 |
+{ |
662 |
+ char *va_prom;
|
|
849 |
+ void *va_prom;
|
|
663 | 850 |
+ |
664 | 851 |
+ if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) { |
665 | 852 |
+ printk("init_idprom: cannot map eeprom\n"); |
... | ... | |
673 | 860 |
+ hw_idprom = va_prom; |
674 | 861 |
+} |
675 | 862 |
+ |
863 |
diff -ruN proll_18.orig/qemu/openprom.c proll-patch7/qemu/openprom.c |
|
864 |
--- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000 |
|
865 |
+++ proll-patch7/qemu/openprom.c 2005-03-02 20:09:57.000000000 +0000 |
|
866 |
@@ -0,0 +1,646 @@ |
|
676 | 867 |
+/* |
677 |
+ * Make CPU page tables. |
|
678 |
+ * Returns pointer to context table. |
|
679 |
+ * Here we ignore memory allocation errors which "should not happen" |
|
680 |
+ * because we cannot print anything anyways if memory initialization fails. |
|
868 |
+ * PROM interface support |
|
869 |
+ * Copyright 1996 The Australian National University. |
|
870 |
+ * Copyright 1996 Fujitsu Laboratories Limited |
|
871 |
+ * Copyright 1999 Pete A. Zaitcev |
|
872 |
+ * This software may be distributed under the terms of the Gnu |
|
873 |
+ * Public License version 2 or later |
|
681 | 874 |
+ */ |
682 |
+void makepages_q(struct phym *t, unsigned int highbase) |
|
683 |
+{ |
|
684 |
+ unsigned int *ctp, *l1, pte; |
|
685 |
+ int i; |
|
686 |
+ unsigned int pa, va; |
|
687 | 875 |
+ |
688 |
+ ctp = mem_zalloc(&cmem, NCTX_SWIFT*sizeof(int), NCTX_SWIFT*sizeof(int)); |
|
689 |
+ l1 = mem_zalloc(&cmem, 256*sizeof(int), 256*sizeof(int)); |
|
876 |
+#include <openprom.h> |
|
877 |
+#include <general.h> |
|
878 |
+#include <romlib.h> |
|
879 |
+#include <system.h> |
|
880 |
+#include <vconsole.h> |
|
881 |
+#include "phys_jj.h" |
|
690 | 882 |
+ |
691 |
+ pte = SRMMU_ET_PTD | (((unsigned int)l1 - PROLBASE + highbase) >> 4); |
|
692 |
+ for (i = 0; i < NCTX_SWIFT; i++) { |
|
693 |
+ ctp[i] = pte; |
|
694 |
+ } |
|
883 |
+//#define DEBUG_OBP |
|
695 | 884 |
+ |
696 |
+ pa = PROLBASE; |
|
697 |
+ for (va = PROLBASE; va < PROLDATA; va += PAGE_SIZE) { |
|
698 |
+ map_page(l1, va, pa, 0, highbase); |
|
699 |
+ pa += PAGE_SIZE; |
|
700 |
+ } |
|
701 |
+ pa = highbase + PROLDATA - PROLBASE; |
|
702 |
+ for (va = PROLDATA; va < PROLBASE + PROLSIZE; va += PAGE_SIZE) { |
|
703 |
+ map_page(l1, va, pa, 0, highbase); |
|
704 |
+ pa += PAGE_SIZE; |
|
705 |
+ } |
|
885 |
+struct property { |
|
886 |
+ const char *name; |
|
887 |
+ const char *value; |
|
888 |
+ const int length; |
|
889 |
+}; |
|
706 | 890 |
+ |
707 |
+ /* We need to start from LOADBASE, but kernel wants PAGE_SIZE. */ |
|
708 |
+ pa = 0; |
|
709 |
+ for (va = 0; va < LOWMEMSZ; va += PAGE_SIZE) { |
|
710 |
+ map_page(l1, va, pa, 0, highbase); |
|
711 |
+ pa += PAGE_SIZE; |
|
712 |
+ } |
|
891 |
+struct node { |
|
892 |
+ const struct property *properties; |
|
893 |
+ /* short */ const int sibling; |
|
894 |
+ /* short */ const int child; |
|
895 |
+}; |
|
713 | 896 |
+ |
714 |
+ t->pctp = ctp; |
|
715 |
+ t->pl1 = l1; |
|
716 |
+ t->pbas = highbase; |
|
717 |
+} |
|
718 |
diff -ruN proll_18.orig/qemu/Makefile proll-patch4/qemu/Makefile |
|
719 |
--- proll_18.orig/qemu/Makefile 1970-01-01 00:00:00.000000000 +0000 |
|
720 |
+++ proll-patch4/qemu/Makefile 2004-11-13 15:50:49.000000000 +0000 |
|
721 |
@@ -0,0 +1,119 @@ |
|
722 |
+# |
|
723 |
+# proll: |
|
724 |
+# qemu/Makefile - make PROLL for QEMU |
|
725 |
+# $Id: proll.patch,v 1.2 2004-12-19 23:18:01 bellard Exp $ |
|
726 |
+# |
|
727 |
+# Copyright 1999 Pete Zaitcev |
|
728 |
+# This is Free Software is licensed under terms of GNU General Public License. |
|
729 |
+# |
|
897 |
+static int obp_nextnode(int node); |
|
898 |
+static int obp_child(int node); |
|
899 |
+static int obp_proplen(int node, char *name); |
|
900 |
+static int obp_getprop(int node, char *name, char *val); |
|
901 |
+static int obp_setprop(int node, char *name, char *val, int len); |
|
902 |
+static const char *obp_nextprop(int node, char *name); |
|
730 | 903 |
+ |
731 |
+CC = gcc |
|
904 |
+static char obp_idprom[IDPROM_SIZE]; |
|
905 |
+static const struct property null_properties = { NULL, NULL, -1 }; |
|
906 |
+static const int prop_true = -1; |
|
732 | 907 |
+ |
733 |
+#CROSS = /usr/local/sparc/bin/sparc-sun-linux- |
|
734 |
+CROSS = sparc-unknown-linux-gnu- |
|
908 |
+static const struct property propv_root[] = { |
|
909 |
+ {"name", "SUNW,JavaStation-1", sizeof("SUNW,JavaStation-1") }, |
|
910 |
+ {"idprom", obp_idprom, IDPROM_SIZE}, |
|
911 |
+ {"banner-name", "JavaStation", sizeof("JavaStation")}, |
|
912 |
+ {"compatible", "sun4m", 6}, |
|
913 |
+ {NULL, NULL, -1} |
|
914 |
+}; |
|
735 | 915 |
+ |
736 |
+CROSSCC = $(CROSS)gcc |
|
737 |
+CROSSLD = $(CROSS)ld |
|
738 |
+CROSSNM = $(CROSS)nm |
|
916 |
+static const int prop_iommu_reg[] = { |
|
917 |
+ 0x0, 0x10000000, 0x00000300, |
|
918 |
+}; |
|
919 |
+static const struct property propv_iommu[] = { |
|
920 |
+ {"name", "iommu", sizeof("iommu")}, |
|
921 |
+ {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) }, |
|
922 |
+ {NULL, NULL, -1} |
|
923 |
+}; |
|
739 | 924 |
+ |
740 |
+RM = /bin/rm -f |
|
741 |
+ELFTOAOUT = elftoaout |
|
925 |
+static const int prop_sbus_ranges[] = { |
|
926 |
+ 0x0, 0x0, 0x0, 0x30000000, 0x10000000, |
|
927 |
+ 0x1, 0x0, 0x0, 0x40000000, 0x10000000, |
|
928 |
+ 0x2, 0x0, 0x0, 0x50000000, 0x10000000, |
|
929 |
+ 0x3, 0x0, 0x0, 0x60000000, 0x10000000, |
|
930 |
+ 0x4, 0x0, 0x0, 0x70000000, 0x10000000, |
|
931 |
+}; |
|
932 |
+static const struct property propv_sbus[] = { |
|
933 |
+ {"name", "sbus", 5}, |
|
934 |
+ {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)}, |
|
935 |
+ {"device_type", "hierarchical", sizeof("hierarchical") }, |
|
936 |
+ {NULL, NULL, -1} |
|
937 |
+}; |
|
742 | 938 |
+ |
743 |
+# |
|
744 |
+SRC = ../src |
|
745 |
+ |
|
746 |
+# Due to remapping algorithm PROLBASE should be algned on PMD. |
|
747 |
+# We make PROLBASE a define instead of using _start because we |
|
748 |
+# want to shift it to form a PGD entry. A relocatable label will not work. |
|
749 |
+# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>. |
|
750 |
+PROLBASE = 0xffd00000 |
|
751 |
+PROLRODATA = 0xffd07000 |
|
752 |
+PROLDATA = 0xffd09000 |
|
753 |
+PROLSIZE = (240*1024) |
|
754 |
+ |
|
755 |
+# Linux |
|
756 |
+# Fixed %g6 is for arch/sparc/kernel/head.S, it seems ok w/o -ffixed-g6. |
|
757 |
+# Kernel uses -fcall-used-g5 -fcall-used-g7, we probably do not need them. |
|
758 |
+# __ANSI__ is supposed to be on by default but it is not. |
|
759 |
+CFLAGS = -O2 -Wall -DPROLBASE=$(PROLBASE) -DPROLDATA=$(PROLDATA) -DPROLRODATA=$(PROLRODATA) -D__ANSI__=1 -I$(SRC) -mcpu=hypersparc -g |
|
760 |
+ASFLAGS = -D__ASSEMBLY__ -I$(SRC) -DPROLRODATA=$(PROLRODATA) -DPROLDATA=$(PROLDATA) -DPROLSIZE=$(PROLSIZE) -g |
|
761 |
+# Solaris or Linux/i386 cross compilation |
|
762 |
+#CFLAGS = -Iinclude -O |
|
763 |
+ |
|
764 |
+LDFLAGS = -N -Ttext $(PROLBASE) --section-start .rodata=$(PROLRODATA) -Tdata $(PROLDATA) -Tbss $(PROLDATA) |
|
765 |
+ |
|
766 |
+ALL = proll.aout |
|
767 |
+PROLLEXE = proll.elf |
|
768 |
+ |
|
769 |
+OBJS = head.o wuf.o wof.o main.o vconsole.o hconsole.o rconsole.o \ |
|
770 |
+ printf.o le.o system.o iommu.o \ |
|
771 |
+ arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o |
|
772 |
+ |
|
773 |
+all: $(ALL) |
|
774 |
+ |
|
775 |
+$(PROLLEXE): $(OBJS) |
|
776 |
+ $(CROSSLD) $(LDFLAGS) -o $(PROLLEXE) $(OBJS) |
|
777 |
+ |
|
778 |
+head.o: head.S $(SRC)/phys_jj.h \ |
|
779 |
+ $(SRC)/asi.h $(SRC)/psr.h $(SRC)/crs.h |
|
780 |
+ $(CROSSCC) $(ASFLAGS) -DPROLBASE=$(PROLBASE) -o $*.o -c $*.S |
|
781 |
+ |
|
782 |
+main.o: main.c $(SRC)/asi.h $(SRC)/pgtsrmmu.h $(SRC)/iommu.h \ |
|
783 |
+ $(SRC)/phys_jj.h $(SRC)/vconsole.h $(SRC)/version.h $(SRC)/general.h \ |
|
784 |
+ $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h |
|
785 |
+ $(CROSSCC) $(CFLAGS) -c $*.c |
|
786 |
+openprom.o: openprom.c $(SRC)/openprom.h $(SRC)/general.h $(SRC)/romlib.h \ |
|
787 |
+ $(SRC)/vconsole.h $(SRC)/system.h $(SRC)/phys_jj.h |
|
788 |
+ $(CROSSCC) $(CFLAGS) -c $*.c |
|
789 |
+ |
|
790 |
+system.o: $(SRC)/system.c $(SRC)/vconsole.h $(SRC)/pgtsrmmu.h \ |
|
791 |
+ $(SRC)/timer.h $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/asi.h \ |
|
792 |
+ $(SRC)/netpriv.h $(SRC)/arpa.h $(SRC)/system.h $(SRC)/crs.h |
|
793 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
794 |
+iommu.o: $(SRC)/iommu.c $(SRC)/pgtsrmmu.h $(SRC)/phys_jj.h $(SRC)/iommu.h \ |
|
795 |
+ $(SRC)/vconsole.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/asi.h |
|
796 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
797 |
+vconsole.o: $(SRC)/vconsole.c $(SRC)/vconsole.h $(SRC)/hconsole.h |
|
798 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
799 |
+hconsole.o: $(SRC)/hconsole.c $(SRC)/hconsole.h $(SRC)/rconsole.h $(SRC)/phys_jj.h |
|
800 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
801 |
+rconsole.o: $(SRC)/rconsole.c $(SRC)/rconsole.h |
|
802 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
803 |
+printf.o: $(SRC)/printf.c |
|
804 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
805 |
+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 |
|
806 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
807 |
+ |
|
808 |
+arp.o: $(SRC)/arp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h $(SRC)/arp.h |
|
809 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
810 |
+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 |
|
811 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
812 |
+tftp.o: $(SRC)/tftp.c $(SRC)/general.h $(SRC)/net.h $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/tftp.h |
|
813 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
814 |
+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 |
|
815 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
816 |
+packet.o: $(SRC)/packet.c $(SRC)/general.h $(SRC)/net.h $(SRC)/romlib.h $(SRC)/netpriv.h |
|
817 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
818 |
+sched_4m.o: $(SRC)/sched_4m.c $(SRC)/system.h $(SRC)/general.h $(SRC)/romlib.h $(SRC)/phys_jj.h |
|
819 |
+ $(CROSSCC) $(CFLAGS) -c $(SRC)/$*.c |
|
820 |
+bootp.o: $(SRC)/bootp.c $(SRC)/general.h $(SRC)/net.h \ |
|
821 |
+ $(SRC)/arpa.h $(SRC)/romlib.h $(SRC)/system.h $(SRC)/bootp.h |
|
822 |
+ $(CROSSCC) $(CFLAGS) -DNOBPEXT=1 -c $(SRC)/$*.c |
|
823 |
+ |
|
824 |
+wuf.o: $(SRC)/wuf.S |
|
825 |
+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S |
|
826 |
+wof.o: $(SRC)/wof.S |
|
827 |
+ $(CROSSCC) $(ASFLAGS) -o $*.o -c $(SRC)/$*.S |
|
828 |
+ |
|
829 |
+#genlab.o: genlab.c |
|
830 |
+# $(CC) -c $*.c |
|
831 |
+# |
|
832 |
+#genlab: genlab.o |
|
833 |
+# $(CC) -o genlab genlab.o |
|
834 |
+ |
|
835 |
+clean: |
|
836 |
+ $(RM) $(OBJS) |
|
837 |
+ $(RM) $(PROLLEXE) proll.aout |
|
838 |
+ |
|
839 |
+proll.aout: $(PROLLEXE) |
|
840 |
+ $(ELFTOAOUT) -o proll.aout $(PROLLEXE) |
|
841 |
diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c |
|
842 |
--- proll_18.orig/qemu/openprom.c 1970-01-01 00:00:00.000000000 +0000 |
|
843 |
+++ proll-patch4/qemu/openprom.c 2004-11-23 19:14:05.000000000 +0000 |
|
844 |
@@ -0,0 +1,596 @@ |
|
845 |
+/* |
|
846 |
+ * PROM interface support |
|
847 |
+ * Copyright 1996 The Australian National University. |
|
848 |
+ * Copyright 1996 Fujitsu Laboratories Limited |
|
849 |
+ * Copyright 1999 Pete A. Zaitcev |
|
850 |
+ * This software may be distributed under the terms of the Gnu |
|
851 |
+ * Public License version 2 or later |
|
852 |
+ */ |
|
853 |
+ |
|
854 |
+#include <openprom.h> |
|
855 |
+#include <general.h> |
|
856 |
+#include <romlib.h> |
|
857 |
+#include <system.h> |
|
858 |
+#include <vconsole.h> |
|
859 |
+#include "phys_jj.h" |
|
860 |
+ |
|
861 |
+struct property { |
|
862 |
+ const char *name; |
|
863 |
+ const char *value; |
|
864 |
+ const int length; |
|
865 |
+}; |
|
866 |
+ |
|
867 |
+struct node { |
|
868 |
+ const struct property *properties; |
|
869 |
+ /* short */ const int sibling; |
|
870 |
+ /* short */ const int child; |
|
871 |
+}; |
|
872 |
+ |
|
873 |
+static int obp_nextnode(int node); |
|
874 |
+static int obp_child(int node); |
|
875 |
+static int obp_proplen(int node, char *name); |
|
876 |
+static int obp_getprop(int node, char *name, char *val); |
|
877 |
+static int obp_setprop(int node, char *name, char *val, int len); |
|
878 |
+static const char *obp_nextprop(int node, char *name); |
|
879 |
+ |
|
880 |
+static char obp_idprom[IDPROM_SIZE]; |
|
881 |
+static const struct property null_properties = { NULL, NULL, -1 }; |
|
882 |
+static const int prop_true = -1; |
|
883 |
+ |
|
884 |
+static const struct property propv_root[] = { |
|
885 |
+ {"name", "SUNW,JavaStation-1", sizeof("SUNW,JavaStation-1") }, |
|
886 |
+ {"idprom", obp_idprom, IDPROM_SIZE}, |
|
887 |
+ {"banner-name", "JavaStation", sizeof("JavaStation")}, |
|
888 |
+ {"compatible", "sun4m", 6}, |
|
889 |
+ {NULL, NULL, -1} |
|
890 |
+}; |
|
891 |
+ |
|
892 |
+static const int prop_iommu_reg[] = { |
|
893 |
+ 0x0, 0x10000000, 0x00000300, |
|
894 |
+}; |
|
895 |
+static const struct property propv_iommu[] = { |
|
896 |
+ {"name", "iommu", sizeof("iommu")}, |
|
897 |
+ {"reg", (char*)&prop_iommu_reg[0], sizeof(prop_iommu_reg) }, |
|
898 |
+ {NULL, NULL, -1} |
|
899 |
+}; |
|
900 |
+ |
|
901 |
+static const int prop_sbus_ranges[] = { |
|
902 |
+ 0x0, 0x0, 0x0, 0x30000000, 0x10000000, |
|
903 |
+ 0x1, 0x0, 0x0, 0x40000000, 0x10000000, |
|
904 |
+ 0x2, 0x0, 0x0, 0x50000000, 0x10000000, |
|
905 |
+ 0x3, 0x0, 0x0, 0x60000000, 0x10000000, |
|
906 |
+ 0x4, 0x0, 0x0, 0x70000000, 0x10000000, |
|
907 |
+}; |
|
908 |
+static const struct property propv_sbus[] = { |
|
909 |
+ {"name", "sbus", 5}, |
|
910 |
+ {"ranges", (char*)&prop_sbus_ranges[0], sizeof(prop_sbus_ranges)}, |
|
911 |
+ {NULL, NULL, -1} |
|
912 |
+}; |
|
913 |
+ |
|
914 |
+static const int prop_tcx_regs[] = { |
|
915 |
+ 0x2, 0x00800000, 0x00100000, |
|
916 |
+ 0x2, 0x02000000, 0x00000001, |
|
917 |
+ 0x2, 0x04000000, 0x00800000, |
|
918 |
+ 0x2, 0x06000000, 0x00800000, |
|
919 |
+ 0x2, 0x0a000000, 0x00000001, |
|
920 |
+ 0x2, 0x0c000000, 0x00000001, |
|
921 |
+ 0x2, 0x0e000000, 0x00000001, |
|
922 |
+ 0x2, 0x00700000, 0x00001000, |
|
923 |
+ 0x2, 0x00200000, 0x00000004, |
|
924 |
+ 0x2, 0x00300000, 0x0000081c, |
|
925 |
+ 0x2, 0x00000000, 0x00010000, |
|
926 |
+ 0x2, 0x00240000, 0x00000004, |
|
927 |
+ 0x2, 0x00280000, 0x00000001, |
|
928 |
+}; |
|
939 |
+static const int prop_tcx_regs[] = { |
|
940 |
+ 0x2, 0x00800000, 0x00100000, |
|
941 |
+ 0x2, 0x02000000, 0x00000001, |
|
942 |
+ 0x2, 0x04000000, 0x00800000, |
|
943 |
+ 0x2, 0x06000000, 0x00800000, |
|
944 |
+ 0x2, 0x0a000000, 0x00000001, |
|
945 |
+ 0x2, 0x0c000000, 0x00000001, |
|
946 |
+ 0x2, 0x0e000000, 0x00000001, |
|
947 |
+ 0x2, 0x00700000, 0x00001000, |
|
948 |
+ 0x2, 0x00200000, 0x00000004, |
|
949 |
+ 0x2, 0x00300000, 0x0000081c, |
|
950 |
+ 0x2, 0x00000000, 0x00010000, |
|
951 |
+ 0x2, 0x00240000, 0x00000004, |
|
952 |
+ 0x2, 0x00280000, 0x00000001, |
|
953 |
+}; |
|
929 | 954 |
+ |
930 | 955 |
+#if 1 /* Zaitcev */ |
931 | 956 |
+static const int pixfreq = 0x03dfd240; |
... | ... | |
1005 | 1030 |
+static const struct property propv_obio[] = { |
1006 | 1031 |
+ {"name", "obio", 5 }, |
1007 | 1032 |
+ {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) }, |
1033 |
+ {"device_type", "hierarchical", sizeof("hierarchical") }, |
|
1008 | 1034 |
+ {NULL, NULL, -1} |
1009 | 1035 |
+}; |
1010 | 1036 |
+ |
... | ... | |
1056 | 1082 |
+ {NULL, NULL, -1} |
1057 | 1083 |
+}; |
1058 | 1084 |
+ |
1059 |
+static const int prop_zs_intr[] = { 0x26, 0x0 };
|
|
1085 |
+static const int prop_zs_intr[] = { 12, 0x0 };
|
|
1060 | 1086 |
+static const int prop_zs_reg[] = { |
1061 |
+ 0x4, 0x00000000, 0x0000000f,
|
|
1087 |
+ 0x0, 0x00000000, 0x00000008,
|
|
1062 | 1088 |
+}; |
1063 |
+static const int prop_zs_slave[] = { 0x1 }; |
|
1089 |
+static const int prop_zs_addr = { 0x70000000 }; |
|
1090 |
+static const int prop_zs_slave[] = { 1 }; |
|
1064 | 1091 |
+static const struct property propv_obio_zs[] = { |
1065 | 1092 |
+ {"name", "zs", sizeof("zs")}, |
1066 | 1093 |
+ {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) }, |
1067 |
+ {"reg", (char*)&prop_zs_slave[0], sizeof(prop_zs_slave) },
|
|
1094 |
+ {"slave", (char*)&prop_zs_slave[0], sizeof(prop_zs_slave) },
|
|
1068 | 1095 |
+ {"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) }, |
|
1069 | 1098 |
+ {NULL, NULL, -1} |
1070 | 1099 |
+}; |
1071 | 1100 |
+ |
1072 |
+static const int prop_zs1_intr[] = { 0x26, 0x0 };
|
|
1101 |
+static const int prop_zs1_intr[] = { 12, 0x0 };
|
|
1073 | 1102 |
+static const int prop_zs1_reg[] = { |
1074 |
+ 0x4, 0x00100000, 0x0000000f,
|
|
1103 |
+ 0x0, 0x00100000, 0x00000008,
|
|
1075 | 1104 |
+}; |
1076 |
+static const int prop_zs1_slave[] = { 0x0 }; |
|
1105 |
+static const int prop_zs1_addr = { 0x70100000 }; |
|
1106 |
+static const int prop_zs1_slave[] = { 0 }; |
|
1077 | 1107 |
+static const struct property propv_obio_zs1[] = { |
1078 | 1108 |
+ {"name", "zs", sizeof("zs")}, |
1079 | 1109 |
+ {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) }, |
1080 |
+ {"reg", (char*)&prop_zs1_slave[0], sizeof(prop_zs1_slave) },
|
|
1110 |
+ {"slave", (char*)&prop_zs1_slave[0], sizeof(prop_zs1_slave) },
|
|
1081 | 1111 |
+ {"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) }, |
|
1082 | 1114 |
+ {NULL, NULL, -1} |
1083 | 1115 |
+}; |
1084 | 1116 |
+ |
... | ... | |
1106 | 1138 |
+ {NULL, NULL, -1} |
1107 | 1139 |
+}; |
1108 | 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 |
+ |
|
1109 | 1205 |
+static const struct node nodes[] = { |
1110 | 1206 |
+ { &null_properties, 1, 0 }, /* 0 = big brother of root */ |
1111 | 1207 |
+ { propv_root, 0, 2 }, /* 1 "/" */ |
1112 |
+ { propv_iommu, 8, 3 }, /* 2 "/iommu" */
|
|
1208 |
+ { propv_iommu, 11, 3 }, /* 2 "/iommu" */
|
|
1113 | 1209 |
+ { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */ |
1114 | 1210 |
+ { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */ |
1115 | 1211 |
+ { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */ |
1116 | 1212 |
+ { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */ |
1117 |
+ { propv_sbus_cs4231, 0, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */ |
|
1118 |
+ { propv_cpu, 9, 0 }, /* 8 "/STP1012PGA" */ |
|
1119 |
+ { propv_obio, 0, 10 }, /* 9 "/obio" */ |
|
1120 |
+ { propv_obio_int, 11, 0 }, /* 10 "/obio/interrupt" */ |
|
1121 |
+ { propv_obio_cnt, 12, 0 }, /* 11 "/obio/counter" */ |
|
1122 |
+ { propv_obio_eep, 13, 0 }, /* 12 "/obio/eeprom" */ |
|
1213 |
+ { propv_sbus_cs4231, 8, 0 }, /* 7 "/iommu/sbus/SUNW,CS4231 */ |
|
1214 |
+ { propv_sbus_bpp, 9, 0 }, /* 8 "/iommu/sbus/SUNW,bpp */ |
|
1215 |
+ { propv_sbus_espdma, 0, 10 }, /* 9 "/iommu/sbus/espdma" */ |
|
1216 |
+ { propv_sbus_espdma_esp, 0, 0 }, /* 10 "/iommu/sbus/espdma/esp" */ |
|
1217 |
+ { propv_cpu, 12, 0 }, /* 11 "/STP1012PGA" */ |
|
1218 |
+ { 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 |
|
1123 | 1229 |
+ { propv_obio_su, 14, 0 }, /* 13 "/obio/su" */ |
1124 |
+ { propv_obio_auxio, 0, 0 }, /* 14 "/obio/auxio" */ |
|
1125 |
+ { propv_obio_zs, 0, 0 }, /* 14 "/obio/zs@0,0" */ |
|
1126 |
+ { propv_obio_zs1, 0, 0 }, /* 14 "/obio/zs@0,100000" */ |
|
1230 |
+ { propv_cpu, 18, 0 }, /* 17 "/STP1012PGA" */ |
|
1231 |
+ { propv_cpu, 19, 0 }, /* 18 "/STP1012PGA" */ |
|
1232 |
+ |
|
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 |
|
1127 | 1245 |
+}; |
1128 | 1246 |
+ |
1129 | 1247 |
+static struct linux_mlist_v0 totphys[MAX_BANKS]; |
... | ... | |
1144 | 1262 |
+ obp_nextprop /* char * (*no_nextprop)(int node, char *name); */ |
1145 | 1263 |
+}; |
1146 | 1264 |
+ |
1147 |
+static const char arg_nfsroot[] = "console=ttyS0 ip=bootp root=nfs"; |
|
1148 |
+ |
|
1149 |
+static const struct linux_arguments_v0 obp_arg = { |
|
1150 |
+ { "le()", arg_nfsroot, NULL, NULL, NULL, NULL, NULL, NULL }, |
|
1151 |
+ { "" }, |
|
1152 |
+ { 'l', 'e' }, 0, 0, 0, NULL, |
|
1153 |
+ NULL |
|
1154 |
+}; |
|
1265 |
+static struct linux_arguments_v0 obp_arg; |
|
1155 | 1266 |
+static const struct linux_arguments_v0 * const obp_argp = &obp_arg; |
1156 | 1267 |
+ |
1157 |
+static const void * const synch_hook = NULL; |
|
1158 |
+#if 0 |
|
1159 |
+static const char obp_stdin = PROMDEV_KBD; |
|
1160 |
+static const char obp_stdout = PROMDEV_SCREEN; |
|
1161 |
+#else |
|
1162 |
+static const char obp_stdin = PROMDEV_TTYA; |
|
1163 |
+static const char obp_stdout = PROMDEV_TTYA; |
|
1164 |
+#endif |
|
1268 |
+static void (*synch_hook)(void); |
|
1269 |
+static char obp_stdin, obp_stdout; |
|
1270 |
+ |
|
1271 |
+static int obp_nbgetchar(void); |
|
1272 |
+static int obp_nbputchar(int ch); |
|
1273 |
+static void obp_reboot(char *); |
|
1274 |
+static void obp_abort(void); |
|
1275 |
+static void obp_halt(void); |
|
1276 |
+static int obp_devopen(char *str); |
|
1277 |
+static int obp_devclose(int dev_desc); |
|
1278 |
+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf); |
|
1279 |
+ |
|
1280 |
+static void doublewalk(unsigned ptab1, unsigned va) |
|
1281 |
+{ |
|
1282 |
+unsigned int proc_tablewalk(int ctx, unsigned int va); |
|
1283 |
+unsigned int mem_tablewalk(unsigned int pa, unsigned int va); |
|
1284 |
+ |
|
1285 |
+ proc_tablewalk(0, va); |
|
1286 |
+ if (ptab1 != 0) mem_tablewalk(ptab1, va); |
|
1287 |
+} |
|
1288 |
+ |
|
1289 |
+static struct linux_romvec romvec0; |
|
1290 |
+ |
|
1291 |
+void * |
|
1292 |
+init_openprom_qemu(int bankc, struct bank *bankv, unsigned hiphybas, |
|
1293 |
+ const char *cmdline, char boot_device, int nographic) |
|
1294 |
+{ |
|
1295 |
+ int i; |
|
1296 |
+ |
|
1297 |
+ /* |
|
1298 |
+ * Avoid data segment allocations |
|
1299 |
+ */ |
|
1300 |
+ ptphys = totphys; |
|
1301 |
+ ptmap = totmap; |
|
1302 |
+ ptavail = totavail; |
|
1303 |
+ /* |
|
1304 |
+ * Form memory descriptors. |
|
1305 |
+ */ |
|
1306 |
+ for (i = 0; i < bankc; i++) { |
|
1307 |
+ totphys[i].theres_more = &totphys[i+1]; |
|
1308 |
+ totphys[i].start_adr = (char*) bankv[i].start; |
|
1309 |
+ totphys[i].num_bytes = bankv[i].length; |
|
1310 |
+ } |
|
1311 |
+ totphys[i-1].theres_more = 0; |
|
1312 |
+ |
|
1313 |
+ /* |
|
1314 |
+ * XXX Merged in normal PROM when full banks touch. |
|
1315 |
+ */ |
|
1316 |
+ for (i = 0; i < bankc; i++) { |
|
1317 |
+ unsigned bankbase = bankv[i].start; |
|
1318 |
+ unsigned banksize = bankv[i].length; |
|
1319 |
+ if (hiphybas > bankbase && |
|
1320 |
+ hiphybas < bankbase + banksize) { |
|
1321 |
+ banksize = hiphybas - bankbase; |
|
1322 |
+ } |
|
1323 |
+ totavail[i].theres_more = &totavail[i+1]; |
|
1324 |
+ totavail[i].start_adr = (char*) bankbase; |
|
1325 |
+ totavail[i].num_bytes = banksize; |
|
1326 |
+ } |
|
1327 |
+ totavail[i-1].theres_more = 0; |
|
1328 |
+ |
|
1329 |
+ totmap[0].theres_more = 0; |
|
1330 |
+ totmap[0].start_adr = (char*) PROLBASE; |
|
1331 |
+ totmap[0].num_bytes = PROLSIZE; |
|
1332 |
+ |
|
1333 |
+ /* |
|
1334 |
+ * idprom |
|
1335 |
+ */ |
|
1336 |
+ bcopy(idprom, obp_idprom, IDPROM_SIZE); |
|
1337 |
+ |
|
1338 |
+ // Linux wants a R/W romvec table |
|
1339 |
+ romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC; |
|
1340 |
+ romvec0.pv_plugin_revision = 77; |
|
1341 |
+ romvec0.pv_printrev = 0x10203; |
|
1342 |
+ romvec0.pv_v0mem.v0_totphys = &ptphys; |
|
1343 |
+ romvec0.pv_v0mem.v0_prommap = &ptmap; |
|
1344 |
+ romvec0.pv_v0mem.v0_available = &ptavail; |
|
1345 |
+ romvec0.pv_nodeops = &nodeops0; |
|
1346 |
+ 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; |
|
1351 |
+ romvec0.pv_stdout = &obp_stdout; |
|
1352 |
+ romvec0.pv_getchar = obp_nbgetchar; |
|
1353 |
+ romvec0.pv_putchar = (void (*)(int))obp_nbputchar; |
|
1354 |
+ romvec0.pv_nbgetchar = obp_nbgetchar; |
|
1355 |
+ romvec0.pv_nbputchar = obp_nbputchar; |
|
1356 |
+ romvec0.pv_reboot = obp_reboot; |
|
1357 |
+ romvec0.pv_abort = obp_abort; |
|
1358 |
+ romvec0.pv_halt = obp_halt; |
|
1359 |
+ romvec0.pv_synchook = &synch_hook; |
|
1360 |
+ 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; |
|
1383 |
+} |
|
1384 |
+ |
|
1385 |
+static const struct property *find_property(int node,char *name) |
|
1386 |
+{ |
|
1387 |
+ const struct property *prop = &nodes[node].properties[0]; |
|
1388 |
+ while (prop && prop->name) { |
|
1389 |
+ if (bcmp(prop->name, name, 128) == 0) return prop; |
|
1390 |
+ prop++; |
|
1391 |
+ } |
|
1392 |
+ return NULL; |
|
1393 |
+} |
|
1394 |
+ |
|
1395 |
+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; |
|
1401 |
+} |
|
1402 |
+ |
|
1403 |
+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; |
|
1409 |
+} |
|
1410 |
+ |
|
1411 |
+static int obp_proplen(int node, char *name) |
|
1412 |
+{ |
|
1413 |
+ const struct property *prop = find_property(node,name); |
|
1414 |
+ 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; |
|
1424 |
+} |
|
1425 |
+ |
|
1426 |
+static int obp_getprop(int node, char *name, char *value) |
|
1427 |
+{ |
|
1428 |
+ const struct property *prop; |
|
1429 |
+ |
|
1430 |
+ prop = find_property(node,name); |
|
1431 |
+ if (prop) { |
|
1432 |
+ memcpy(value,prop->value,prop->length); |
|
1433 |
+#ifdef DEBUG_OBP |
|
1434 |
+ printk("obp_getprop(%d, %s) = %s\n", node, name, value); |
|
1435 |
+#endif |
|
1436 |
+ return prop->length; |
|
1437 |
+ } |
|
1438 |
+#ifdef DEBUG_OBP |
|
1439 |
+ printk("obp_getprop(%d, %s): not found\n", node, name); |
|
1440 |
+#endif |
|
1441 |
+ return -1; |
|
1442 |
+} |
|
1443 |
+ |
|
1444 |
+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; |
|
1450 |
+} |
|
1451 |
+ |
|
1452 |
+static const char *obp_nextprop(int node,char *name) |
|
1453 |
+{ |
|
1454 |
+ const struct property *prop = find_property(node,name); |
|
1455 |
+ 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; |
|
1465 |
+} |
|
1466 |
+ |
|
1467 |
+static int obp_nbgetchar(void) { |
|
1468 |
+ extern struct vconterm dp0; |
|
1469 |
+ return vcon_getch(&dp0); |
|
1470 |
+} |
|
1471 |
+ |
|
1472 |
+static int obp_nbputchar(int ch) { |
|
1473 |
+ printk("%c", ch); |
|
1474 |
+ return 0; |
|
1475 |
+} |
|
1476 |
+ |
|
1477 |
+static void obp_reboot(char *str) { |
|
1478 |
+ printk("rebooting (%s): not implemented, freezing\n", str); |
|
1479 |
+ for (;;) {} |
|
1480 |
+} |
|
1481 |
+ |
|
1482 |
+static void obp_abort() { |
|
1483 |
+ printk("abort, freezing\n"); |
|
1484 |
+ for (;;) {} |
|
1485 |
+} |
|
1486 |
+ |
|
1487 |
+static void obp_halt() { |
|
1488 |
+ printk("halt, freezing\n"); |
|
1489 |
+ for (;;) {} |
|
1490 |
+} |
|
1491 |
+ |
|
1492 |
+static int obp_devopen(char *str) { |
|
1493 |
+#ifdef DEBUG_OBP |
|
1494 |
+ printk("open %s\n", str); |
|
1495 |
+#endif |
|
1496 |
+ return 0; |
|
1497 |
+} |
|
1498 |
+ |
|
1499 |
+static int obp_devclose(int dev_desc) { |
|
1500 |
+#ifdef DEBUG_OBP |
|
1501 |
+ printk("close %d\n", dev_desc); |
|
1502 |
+#endif |
|
1503 |
+ return 0; |
|
1504 |
+} |
|
1505 |
+ |
|
1506 |
+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf) { |
|
1507 |
+#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'; |
|
1511 |
+ return num_blks; |
|
1512 |
+} |
|
1513 |
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 |
+ } |
|
1165 | 1664 |
+ |
1166 |
+static int obp_nbgetchar(void); |
|
1167 |
+static int obp_nbputchar(int ch); |
|
1168 |
+static void obp_reboot(char *); |
|
1169 |
+static void obp_abort(void); |
|
1170 |
+static void obp_halt(void); |
|
1171 |
+static int obp_devopen(char *str); |
|
1172 |
+static int obp_devclose(int dev_desc); |
|
1173 |
+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf); |
|
1665 |
+ t->pctp = ctp; |
|
1666 |
+ t->pl1 = l1; |
|
1667 |
+ t->pbas = highbase; |
|
1668 |
+} |
|
1174 | 1669 |
+ |
1175 |
+static void doublewalk(unsigned ptab1, unsigned va) |
|
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) |
|
1176 | 1677 |
+{ |
1177 |
+unsigned int proc_tablewalk(int ctx, unsigned int va); |
|
1178 |
+unsigned int mem_tablewalk(unsigned int pa, unsigned int va); |
|
1179 |
+ |
|
1180 |
+ proc_tablewalk(0, va); |
|
1181 |
+ if (ptab1 != 0) mem_tablewalk(ptab1, va); |
|
1182 |
+} |
|
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 |
+ } |
|
1183 | 1692 |
+ |
1184 |
+#ifdef ORIG |
|
1185 |
+static const struct linux_romvec romvec0 = { |
|
1186 |
+ LINUX_OPPROM_MAGIC, /* pv_magic_cookie */ |
|
1187 |
+ 0, /* pv_romvers - Format selector! */ |
|
1188 |
+ 77, /* pv_plugin_revision */ |
|
1189 |
+ 0x10203, /* pv_printrev */ |
|
1190 |
+ { /* pv_v0mem */ |
|
1191 |
+ &ptphys, /* v0_totphys */ |
|
1192 |
+ &ptmap, /* v0_prommap */ |
|
1193 |
+ &ptavail /* v0_available */ |
|
1194 |
+ }, |
|
1195 |
+ &nodeops0, /* struct linux_nodeops *pv_nodeops; */ |
|
1196 |
+ (void*)doublewalk, /* P3 */ /* char **pv_bootstr; */ |
|
1197 |
+ { /* struct linux_dev_v0_funcs pv_v0devops; */ |
|
1198 |
+ &obp_devopen, /* v0_devopen */ |
|
1199 |
+ &obp_devclose, /* v0_devclose */ |
|
1200 |
+ &obp_rdblkdev, /* v0_rdblkdev */ |
|
1201 |
+ NULL, /* v0_wrblkdev */ |
|
1202 |
+ NULL, /* v0_wrnetdev */ |
|
1203 |
+ NULL, /* v0_rdnetdev */ |
|
1204 |
+ NULL, /* v0_rdchardev */ |
|
1205 |
+ NULL, /* v0_wrchardev */ |
|
1206 |
+ NULL /* v0_seekdev */ |
|
1207 |
+ }, |
|
1208 |
+ &obp_stdin, /* char *pv_stdin */ |
|
1209 |
+ &obp_stdout, /* char *pv_stdout; */ |
|
1210 |
+ obp_nbgetchar, /* int (*pv_getchar)(void); */ |
|
1211 |
+ obp_nbputchar, /* void (*pv_putchar)(int ch); */ |
|
1212 |
+ obp_nbgetchar, /* int (*pv_nbgetchar)(void); */ |
|
1213 |
+ obp_nbputchar, /* int (*pv_nbputchar)(int ch); */ |
|
1214 |
+ NULL, /* void (*pv_putstr)(char *str, int len); */ |
|
1215 |
+ obp_reboot, /* void (*pv_reboot)(char *bootstr); */ |
|
1216 |
+ NULL, /* void (*pv_printf)(__const__ char *fmt, ...); */ |
|
1217 |
+ obp_abort, /* void (*pv_abort)(void); */ |
|
1218 |
+ NULL, /* __volatile__ int *pv_ticks; */ |
|
1219 |
+ obp_halt, /* void (*pv_halt)(void); */ |
|
1220 |
+ (void *)&synch_hook, /* void (**pv_synchook)(void); */ |
|
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 |
+ } |
|
1221 | 1704 |
+ |
1222 |
+#if 0 |
|
1223 |
+ /* Evaluate a forth string, not different proto for V0 and V2->up. */ |
|
1224 |
+ union { |
|
1225 |
+ void (*v0_eval)(int len, char *str); |
|
1226 |
+ void (*v2_eval)(char *str); |
|
1227 |
+ } pv_fortheval; |
|
1228 |
+#endif |
|
1229 |
+ { 0 }, /* pv_fortheval */ |
|
1230 |
+ |
|
1231 |
+ &obp_argp, /* struct linux_arguments_v0 **pv_v0bootargs; */ |
|
1232 |
+ NULL, /* pv_enaddr */ |
|
1233 |
+ { /* pv_v2bootargs */ |
|
1234 |
+ NULL, /* char **bootpath; */ |
|
1235 |
+ NULL, /* char **bootargs; */ |
|
1236 |
+ NULL, /* fd_stdin; */ |
|
1237 |
+ NULL, /* fd_stdout */ |
|
1238 |
+ }, |
|
1239 |
+ { /* pv_v2devops */ |
|
1240 |
+ NULL, /* v2_inst2pkg */ |
|
1241 |
+ NULL, /* v2_dumb_mem_alloc */ |
|
1242 |
+ NULL, /* v2_dumb_mem_free */ |
|
1243 |
+ NULL, /* v2_dumb_mmap */ |
|
1244 |
+ NULL, /* v2_dumb_munmap */ |
|
1245 |
+ NULL, /* v2_dev_open */ |
|
1246 |
+ NULL, /* v2_dev_close */ |
|
1247 |
+ NULL, /* v2_dev_read */ |
|
1248 |
+ NULL, /* v2_dev_write */ |
|
1249 |
+ NULL, /* v2_dev_seek */ |
|
1250 |
+ NULL, /* v2_wheee2 */ |
|
1251 |
+ NULL, /* v2_wheee3 */ |
|
1252 |
+ }, |
|
1253 |
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* filler[15] */ |
|
1254 |
+ NULL, /* pv_setctxt */ |
|
1255 |
+ NULL, /* v3_cpustart */ |
|
1256 |
+ NULL, /* v3_cpustop */ |
|
1257 |
+ NULL, /* v3_cpuidle */ |
|
1258 |
+ NULL /* v3_cpuresume */ |
|
1259 |
+}; |
|
1260 |
+#endif |
|
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; |
|
1261 | 1719 |
+ |
1262 |
+static struct linux_romvec romvec0; |
|
1720 |
+drop: |
|
1721 |
+ return -1; |
|
1722 |
+} |
|
1263 | 1723 |
+ |
1264 |
+void * |
|
1265 |
+init_openprom(int bankc, struct bank *bankv, unsigned hiphybas) |
|
1724 |
+/* |
|
1725 |
+ * Switch page tables. |
|
1726 |
+ */ |
|
1727 |
+void |
|
1728 |
+init_mmu_swift(unsigned int ctp_phy) |
|
1266 | 1729 |
+{ |
1267 |
+ int i;
|
|
1730 |
+ unsigned int addr;
|
|
1268 | 1731 |
+ |
1269 | 1732 |
+ /* |
1270 |
+ * Avoid data segment allocations |
|
1271 |
+ */ |
|
1272 |
+ ptphys = totphys; |
|
1273 |
+ ptmap = totmap; |
|
1274 |
+ ptavail = totavail; |
|
1275 |
+ /* |
|
1276 |
+ * Form memory descriptors. |
|
1733 |
+ * Flush cache |
|
1277 | 1734 |
+ */ |
1278 |
+ for (i = 0; i < bankc; i++) { |
|
1279 |
+ totphys[i].theres_more = &totphys[i+1]; |
Also available in: Unified diff