Commit 6f7e9aec5eb5bdfa57a9e458e391b785c283a007

Authored by bellard
1 parent b756921a

sparc fixes (Blue Swirl)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1326 c046a42c-6fe2-441c-8c8c-71466251a162
Makefile.target
@@ -338,7 +338,7 @@ VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o @@ -338,7 +338,7 @@ VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
338 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o mixeng.o 338 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o mixeng.o
339 endif 339 endif
340 ifeq ($(TARGET_BASE_ARCH), sparc) 340 ifeq ($(TARGET_BASE_ARCH), sparc)
341 -VL_OBJS+= sun4m.o tcx.o lance.o iommu.o m48t08.o magic-load.o slavio_intctl.o slavio_timer.o slavio_serial.o fdc.o 341 +VL_OBJS+= sun4m.o tcx.o lance.o iommu.o m48t08.o magic-load.o slavio_intctl.o slavio_timer.o slavio_serial.o fdc.o esp.o
342 endif 342 endif
343 ifdef CONFIG_GDBSTUB 343 ifdef CONFIG_GDBSTUB
344 VL_OBJS+=gdbstub.o 344 VL_OBJS+=gdbstub.o
@@ -3,7 +3,6 @@ short term: @@ -3,7 +3,6 @@ short term:
3 - debug option in 'configure' script + disable -fomit-frame-pointer 3 - debug option in 'configure' script + disable -fomit-frame-pointer
4 - Precise VGA timings for old games/demos (malc patch) 4 - Precise VGA timings for old games/demos (malc patch)
5 - merge PIC spurious interrupt patch 5 - merge PIC spurious interrupt patch
6 -- merge VNC keyboard patch  
7 - merge Solaris patch 6 - merge Solaris patch
8 - warning for OS/2: must not use 128 MB memory (merge bochs cmos patch ?) 7 - warning for OS/2: must not use 128 MB memory (merge bochs cmos patch ?)
9 - config file (at least for windows/Mac OS X) 8 - config file (at least for windows/Mac OS X)
hw/esp.c 0 → 100644
  1 +/*
  2 + * QEMU ESP emulation
  3 + *
  4 + * Copyright (c) 2005 Fabrice Bellard
  5 + *
  6 + * Permission is hereby granted, free of charge, to any person obtaining a copy
  7 + * of this software and associated documentation files (the "Software"), to deal
  8 + * in the Software without restriction, including without limitation the rights
  9 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10 + * copies of the Software, and to permit persons to whom the Software is
  11 + * furnished to do so, subject to the following conditions:
  12 + *
  13 + * The above copyright notice and this permission notice shall be included in
  14 + * all copies or substantial portions of the Software.
  15 + *
  16 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22 + * THE SOFTWARE.
  23 + */
  24 +#include "vl.h"
  25 +
  26 +/* debug ESP card */
  27 +#define DEBUG_ESP
  28 +
  29 +#ifdef DEBUG_ESP
  30 +#define DPRINTF(fmt, args...) \
  31 +do { printf("ESP: " fmt , ##args); } while (0)
  32 +#else
  33 +#define DPRINTF(fmt, args...)
  34 +#endif
  35 +
  36 +#define ESPDMA_REGS 4
  37 +#define ESPDMA_MAXADDR (ESPDMA_REGS * 4 - 1)
  38 +#define ESP_MAXREG 0x3f
  39 +
  40 +typedef struct ESPState {
  41 + BlockDriverState **bd;
  42 + uint8_t regs[ESP_MAXREG];
  43 + int irq;
  44 + uint32_t espdmaregs[ESPDMA_REGS];
  45 +} ESPState;
  46 +
  47 +static void esp_reset(void *opaque)
  48 +{
  49 + ESPState *s = opaque;
  50 + memset(s->regs, 0, ESP_MAXREG);
  51 + s->regs[0x0e] = 0x4; // Indicate fas100a
  52 + memset(s->espdmaregs, 0, ESPDMA_REGS * 4);
  53 +}
  54 +
  55 +static uint32_t esp_mem_readb(void *opaque, target_phys_addr_t addr)
  56 +{
  57 + ESPState *s = opaque;
  58 + uint32_t saddr;
  59 +
  60 + saddr = (addr & ESP_MAXREG) >> 2;
  61 + switch (saddr) {
  62 + default:
  63 + break;
  64 + }
  65 + DPRINTF("esp: read reg[%d]: 0x%2.2x\n", saddr, s->regs[saddr]);
  66 + return s->regs[saddr];
  67 +}
  68 +
  69 +static void esp_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
  70 +{
  71 + ESPState *s = opaque;
  72 + uint32_t saddr;
  73 +
  74 + saddr = (addr & ESP_MAXREG) >> 2;
  75 + DPRINTF("esp: write reg[%d]: 0x%2.2x -> 0x%2.2x\n", saddr, s->regs[saddr], val);
  76 + switch (saddr) {
  77 + case 3:
  78 + // Command
  79 + switch(val & 0x7f) {
  80 + case 0:
  81 + DPRINTF("esp: NOP (%2.2x)\n", val);
  82 + break;
  83 + case 2:
  84 + DPRINTF("esp: Chip reset (%2.2x)\n", val);
  85 + esp_reset(s);
  86 + break;
  87 + case 3:
  88 + DPRINTF("esp: Bus reset (%2.2x)\n", val);
  89 + break;
  90 + case 0x1a:
  91 + DPRINTF("esp: Set ATN (%2.2x)\n", val);
  92 + break;
  93 + case 0x42:
  94 + DPRINTF("esp: Select with ATN (%2.2x)\n", val);
  95 + s->regs[4] = 0x1a; // Status: TCNT | TDONE | CMD
  96 + s->regs[5] = 0x20; // Intr: Disconnect, nobody there
  97 + s->regs[6] = 0x4; // Seq: Cmd done
  98 + pic_set_irq(s->irq, 1);
  99 + break;
  100 + }
  101 + break;
  102 + case 4 ... 7:
  103 + case 9 ... 0xf:
  104 + break;
  105 + default:
  106 + s->regs[saddr] = val;
  107 + break;
  108 + }
  109 +}
  110 +
  111 +static CPUReadMemoryFunc *esp_mem_read[3] = {
  112 + esp_mem_readb,
  113 + esp_mem_readb,
  114 + esp_mem_readb,
  115 +};
  116 +
  117 +static CPUWriteMemoryFunc *esp_mem_write[3] = {
  118 + esp_mem_writeb,
  119 + esp_mem_writeb,
  120 + esp_mem_writeb,
  121 +};
  122 +
  123 +static uint32_t espdma_mem_readl(void *opaque, target_phys_addr_t addr)
  124 +{
  125 + ESPState *s = opaque;
  126 + uint32_t saddr;
  127 +
  128 + saddr = (addr & ESPDMA_MAXADDR) >> 2;
  129 + return s->espdmaregs[saddr];
  130 +}
  131 +
  132 +static void espdma_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
  133 +{
  134 + ESPState *s = opaque;
  135 + uint32_t saddr;
  136 +
  137 + saddr = (addr & ESPDMA_MAXADDR) >> 2;
  138 + s->espdmaregs[saddr] = val;
  139 +}
  140 +
  141 +static CPUReadMemoryFunc *espdma_mem_read[3] = {
  142 + espdma_mem_readl,
  143 + espdma_mem_readl,
  144 + espdma_mem_readl,
  145 +};
  146 +
  147 +static CPUWriteMemoryFunc *espdma_mem_write[3] = {
  148 + espdma_mem_writel,
  149 + espdma_mem_writel,
  150 + espdma_mem_writel,
  151 +};
  152 +
  153 +static void esp_save(QEMUFile *f, void *opaque)
  154 +{
  155 + ESPState *s = opaque;
  156 +
  157 +}
  158 +
  159 +static int esp_load(QEMUFile *f, void *opaque, int version_id)
  160 +{
  161 + ESPState *s = opaque;
  162 +
  163 + if (version_id != 1)
  164 + return -EINVAL;
  165 +
  166 + return 0;
  167 +}
  168 +
  169 +void esp_init(BlockDriverState **bd, int irq, uint32_t espaddr, uint32_t espdaddr)
  170 +{
  171 + ESPState *s;
  172 + int esp_io_memory, espdma_io_memory;
  173 +
  174 + s = qemu_mallocz(sizeof(ESPState));
  175 + if (!s)
  176 + return;
  177 +
  178 + s->bd = bd;
  179 + s->irq = irq;
  180 +
  181 + esp_io_memory = cpu_register_io_memory(0, esp_mem_read, esp_mem_write, s);
  182 + cpu_register_physical_memory(espaddr, ESP_MAXREG*4, esp_io_memory);
  183 +
  184 + espdma_io_memory = cpu_register_io_memory(0, espdma_mem_read, espdma_mem_write, s);
  185 + cpu_register_physical_memory(espdaddr, 16, espdma_io_memory);
  186 +
  187 + esp_reset(s);
  188 +
  189 + register_savevm("esp", espaddr, 1, esp_save, esp_load, s);
  190 + qemu_register_reset(esp_reset, s);
  191 +}
  192 +
hw/fdc.c
@@ -94,21 +94,6 @@ typedef struct fdrive_t { @@ -94,21 +94,6 @@ typedef struct fdrive_t {
94 uint8_t ro; /* Is read-only */ 94 uint8_t ro; /* Is read-only */
95 } fdrive_t; 95 } fdrive_t;
96 96
97 -#ifdef TARGET_SPARC  
98 -/* XXX: suppress those hacks */  
99 -#define DMA_read_memory(a,b,c,d)  
100 -#define DMA_write_memory(a,b,c,d)  
101 -void DMA_register_channel (int nchan,  
102 - DMA_transfer_handler transfer_handler,  
103 - void *opaque)  
104 -{  
105 -}  
106 -#define DMA_hold_DREQ(a)  
107 -#define DMA_release_DREQ(a)  
108 -#define DMA_get_channel_mode(a) (0)  
109 -#define DMA_schedule(a)  
110 -#endif  
111 -  
112 static void fd_init (fdrive_t *drv, BlockDriverState *bs) 97 static void fd_init (fdrive_t *drv, BlockDriverState *bs)
113 { 98 {
114 /* Drive */ 99 /* Drive */
@@ -423,6 +408,12 @@ static uint32_t fdctrl_read (void *opaque, uint32_t reg) @@ -423,6 +408,12 @@ static uint32_t fdctrl_read (void *opaque, uint32_t reg)
423 uint32_t retval; 408 uint32_t retval;
424 409
425 switch (reg & 0x07) { 410 switch (reg & 0x07) {
  411 +#ifdef TARGET_SPARC
  412 + case 0x00:
  413 + // Identify to Linux as S82078B
  414 + retval = fdctrl_read_statusB(fdctrl);
  415 + break;
  416 +#endif
426 case 0x01: 417 case 0x01:
427 retval = fdctrl_read_statusB(fdctrl); 418 retval = fdctrl_read_statusB(fdctrl);
428 break; 419 break;
@@ -577,6 +568,14 @@ static void fdctrl_reset_irq (fdctrl_t *fdctrl) @@ -577,6 +568,14 @@ static void fdctrl_reset_irq (fdctrl_t *fdctrl)
577 568
578 static void fdctrl_raise_irq (fdctrl_t *fdctrl, uint8_t status) 569 static void fdctrl_raise_irq (fdctrl_t *fdctrl, uint8_t status)
579 { 570 {
  571 +#ifdef TARGET_SPARC
  572 + // Sparc mutation
  573 + if (!fdctrl->dma_en) {
  574 + fdctrl->state &= ~FD_CTRL_BUSY;
  575 + fdctrl->int_status = status;
  576 + return;
  577 + }
  578 +#endif
580 if (~(fdctrl->state & FD_CTRL_INTR)) { 579 if (~(fdctrl->state & FD_CTRL_INTR)) {
581 pic_set_irq(fdctrl->irq_lvl, 1); 580 pic_set_irq(fdctrl->irq_lvl, 1);
582 fdctrl->state |= FD_CTRL_INTR; 581 fdctrl->state |= FD_CTRL_INTR;
@@ -980,11 +979,11 @@ static int fdctrl_transfer_handler (void *opaque, int nchan, @@ -980,11 +979,11 @@ static int fdctrl_transfer_handler (void *opaque, int nchan,
980 len = dma_len - fdctrl->data_pos; 979 len = dma_len - fdctrl->data_pos;
981 if (len + rel_pos > FD_SECTOR_LEN) 980 if (len + rel_pos > FD_SECTOR_LEN)
982 len = FD_SECTOR_LEN - rel_pos; 981 len = FD_SECTOR_LEN - rel_pos;
983 - FLOPPY_DPRINTF("copy %d bytes (%d %d %d) %d pos %d %02x %02x "  
984 - "(%d-0x%08x 0x%08x)\n", len, size, fdctrl->data_pos, 982 + FLOPPY_DPRINTF("copy %d bytes (%d %d %d) %d pos %d %02x "
  983 + "(%d-0x%08x 0x%08x)\n", len, dma_len, fdctrl->data_pos,
985 fdctrl->data_len, fdctrl->cur_drv, cur_drv->head, 984 fdctrl->data_len, fdctrl->cur_drv, cur_drv->head,
986 cur_drv->track, cur_drv->sect, fd_sector(cur_drv), 985 cur_drv->track, cur_drv->sect, fd_sector(cur_drv),
987 - fd_sector(cur_drv) * 512, addr); 986 + fd_sector(cur_drv) * 512);
988 if (fdctrl->data_dir != FD_DIR_WRITE || 987 if (fdctrl->data_dir != FD_DIR_WRITE ||
989 len < FD_SECTOR_LEN || rel_pos != 0) { 988 len < FD_SECTOR_LEN || rel_pos != 0) {
990 /* READ & SCAN commands and realign to a sector for WRITE */ 989 /* READ & SCAN commands and realign to a sector for WRITE */
@@ -1045,7 +1044,7 @@ static int fdctrl_transfer_handler (void *opaque, int nchan, @@ -1045,7 +1044,7 @@ static int fdctrl_transfer_handler (void *opaque, int nchan,
1045 FLOPPY_DPRINTF("seek to next sector (%d %02x %02x => %d) (%d)\n", 1044 FLOPPY_DPRINTF("seek to next sector (%d %02x %02x => %d) (%d)\n",
1046 cur_drv->head, cur_drv->track, cur_drv->sect, 1045 cur_drv->head, cur_drv->track, cur_drv->sect,
1047 fd_sector(cur_drv), 1046 fd_sector(cur_drv),
1048 - fdctrl->data_pos - size); 1047 + fdctrl->data_pos - len);
1049 /* XXX: cur_drv->sect >= cur_drv->last_sect should be an 1048 /* XXX: cur_drv->sect >= cur_drv->last_sect should be an
1050 error in fact */ 1049 error in fact */
1051 if (cur_drv->sect >= cur_drv->last_sect || 1050 if (cur_drv->sect >= cur_drv->last_sect ||
hw/sun4m.c
@@ -36,7 +36,10 @@ @@ -36,7 +36,10 @@
36 // IRQs are not PIL ones, but master interrupt controller register 36 // IRQs are not PIL ones, but master interrupt controller register
37 // bits 37 // bits
38 #define PHYS_JJ_IOMMU 0x10000000 /* I/O MMU */ 38 #define PHYS_JJ_IOMMU 0x10000000 /* I/O MMU */
39 -#define PHYS_JJ_TCX_FB 0x50800000 /* Start address, frame buffer body */ 39 +#define PHYS_JJ_TCX_FB 0x50000000 /* TCX frame buffer */
  40 +#define PHYS_JJ_ESPDMA 0x78400000 /* ESP DMA controller */
  41 +#define PHYS_JJ_ESP 0x78800000 /* ESP SCSI */
  42 +#define PHYS_JJ_ESP_IRQ 18
40 #define PHYS_JJ_LEDMA 0x78400010 /* Lance DMA controller */ 43 #define PHYS_JJ_LEDMA 0x78400010 /* Lance DMA controller */
41 #define PHYS_JJ_LE 0x78C00000 /* Lance ethernet */ 44 #define PHYS_JJ_LE 0x78C00000 /* Lance ethernet */
42 #define PHYS_JJ_LE_IRQ 16 45 #define PHYS_JJ_LE_IRQ 16
@@ -50,7 +53,6 @@ @@ -50,7 +53,6 @@
50 #define PHYS_JJ_MS_KBD_IRQ 14 53 #define PHYS_JJ_MS_KBD_IRQ 14
51 #define PHYS_JJ_SER 0x71100000 /* Serial */ 54 #define PHYS_JJ_SER 0x71100000 /* Serial */
52 #define PHYS_JJ_SER_IRQ 15 55 #define PHYS_JJ_SER_IRQ 15
53 -#define PHYS_JJ_SCSI_IRQ 18  
54 #define PHYS_JJ_FDC 0x71400000 /* Floppy */ 56 #define PHYS_JJ_FDC 0x71400000 /* Floppy */
55 #define PHYS_JJ_FLOPPY_IRQ 22 57 #define PHYS_JJ_FLOPPY_IRQ 22
56 58
@@ -61,32 +63,86 @@ uint64_t cpu_get_tsc() @@ -61,32 +63,86 @@ uint64_t cpu_get_tsc()
61 return qemu_get_clock(vm_clock); 63 return qemu_get_clock(vm_clock);
62 } 64 }
63 65
64 -void DMA_run() {} 66 +int DMA_get_channel_mode (int nchan)
  67 +{
  68 + return 0;
  69 +}
  70 +int DMA_read_memory (int nchan, void *buf, int pos, int size)
  71 +{
  72 + return 0;
  73 +}
  74 +int DMA_write_memory (int nchan, void *buf, int pos, int size)
  75 +{
  76 + return 0;
  77 +}
  78 +void DMA_hold_DREQ (int nchan) {}
  79 +void DMA_release_DREQ (int nchan) {}
  80 +void DMA_schedule(int nchan) {}
  81 +void DMA_run (void) {}
  82 +void DMA_init (int high_page_enable) {}
  83 +void DMA_register_channel (int nchan,
  84 + DMA_transfer_handler transfer_handler,
  85 + void *opaque)
  86 +{
  87 +}
  88 +
  89 +static void nvram_set_word (m48t08_t *nvram, uint32_t addr, uint16_t value)
  90 +{
  91 + m48t08_write(nvram, addr++, (value >> 8) & 0xff);
  92 + m48t08_write(nvram, addr++, value & 0xff);
  93 +}
  94 +
  95 +static void nvram_set_lword (m48t08_t *nvram, uint32_t addr, uint32_t value)
  96 +{
  97 + m48t08_write(nvram, addr++, value >> 24);
  98 + m48t08_write(nvram, addr++, (value >> 16) & 0xff);
  99 + m48t08_write(nvram, addr++, (value >> 8) & 0xff);
  100 + m48t08_write(nvram, addr++, value & 0xff);
  101 +}
  102 +
  103 +static void nvram_set_string (m48t08_t *nvram, uint32_t addr,
  104 + const unsigned char *str, uint32_t max)
  105 +{
  106 + unsigned int i;
  107 +
  108 + for (i = 0; i < max && str[i] != '\0'; i++) {
  109 + m48t08_write(nvram, addr + i, str[i]);
  110 + }
  111 + m48t08_write(nvram, addr + max - 1, '\0');
  112 +}
65 113
66 static m48t08_t *nvram; 114 static m48t08_t *nvram;
67 115
68 -static void nvram_init(m48t08_t *nvram, uint8_t *macaddr, const char *cmdline) 116 +extern int nographic;
  117 +
  118 +static void nvram_init(m48t08_t *nvram, uint8_t *macaddr, const char *cmdline,
  119 + int boot_device, uint32_t RAM_size,
  120 + uint32_t kernel_size,
  121 + int width, int height, int depth)
69 { 122 {
70 unsigned char tmp = 0; 123 unsigned char tmp = 0;
71 int i, j; 124 int i, j;
72 125
73 - i = 0x40; 126 + // Try to match PPC NVRAM
  127 + nvram_set_string(nvram, 0x00, "QEMU_BIOS", 16);
  128 + nvram_set_lword(nvram, 0x10, 0x00000001); /* structure v1 */
  129 + // NVRAM_size, arch not applicable
  130 + m48t08_write(nvram, 0x2F, nographic & 0xff);
  131 + nvram_set_lword(nvram, 0x30, RAM_size);
  132 + m48t08_write(nvram, 0x34, boot_device & 0xff);
  133 + nvram_set_lword(nvram, 0x38, KERNEL_LOAD_ADDR);
  134 + nvram_set_lword(nvram, 0x3C, kernel_size);
74 if (cmdline) { 135 if (cmdline) {
75 - uint32_t cmdline_len;  
76 -  
77 strcpy(phys_ram_base + CMDLINE_ADDR, cmdline); 136 strcpy(phys_ram_base + CMDLINE_ADDR, cmdline);
78 - m48t08_write(nvram, i++, CMDLINE_ADDR >> 24);  
79 - m48t08_write(nvram, i++, (CMDLINE_ADDR >> 16) & 0xff);  
80 - m48t08_write(nvram, i++, (CMDLINE_ADDR >> 8) & 0xff);  
81 - m48t08_write(nvram, i++, CMDLINE_ADDR & 0xff);  
82 -  
83 - cmdline_len = strlen(cmdline);  
84 - m48t08_write(nvram, i++, cmdline_len >> 24);  
85 - m48t08_write(nvram, i++, (cmdline_len >> 16) & 0xff);  
86 - m48t08_write(nvram, i++, (cmdline_len >> 8) & 0xff);  
87 - m48t08_write(nvram, i++, cmdline_len & 0xff); 137 + nvram_set_lword(nvram, 0x40, CMDLINE_ADDR);
  138 + nvram_set_lword(nvram, 0x44, strlen(cmdline));
88 } 139 }
  140 + // initrd_image, initrd_size passed differently
  141 + nvram_set_word(nvram, 0x54, width);
  142 + nvram_set_word(nvram, 0x56, height);
  143 + nvram_set_word(nvram, 0x58, depth);
89 144
  145 + // Sun4m specific use
90 i = 0x1fd8; 146 i = 0x1fd8;
91 m48t08_write(nvram, i++, 0x01); 147 m48t08_write(nvram, i++, 0x01);
92 m48t08_write(nvram, i++, 0x80); /* Sun4m OBP */ 148 m48t08_write(nvram, i++, 0x80); /* Sun4m OBP */
@@ -155,7 +211,7 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device, @@ -155,7 +211,7 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
155 char buf[1024]; 211 char buf[1024];
156 int ret, linux_boot; 212 int ret, linux_boot;
157 unsigned int i; 213 unsigned int i;
158 - unsigned long vram_size = 0x100000, prom_offset, initrd_size; 214 + long vram_size = 0x100000, prom_offset, initrd_size, kernel_size;
159 215
160 linux_boot = (kernel_filename != NULL); 216 linux_boot = (kernel_filename != NULL);
161 217
@@ -164,14 +220,14 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device, @@ -164,14 +220,14 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
164 220
165 iommu = iommu_init(PHYS_JJ_IOMMU); 221 iommu = iommu_init(PHYS_JJ_IOMMU);
166 slavio_intctl = slavio_intctl_init(PHYS_JJ_INTR0, PHYS_JJ_INTR_G); 222 slavio_intctl = slavio_intctl_init(PHYS_JJ_INTR0, PHYS_JJ_INTR_G);
167 - tcx = tcx_init(ds, PHYS_JJ_TCX_FB, phys_ram_base + ram_size, ram_size, vram_size); 223 + tcx = tcx_init(ds, PHYS_JJ_TCX_FB, phys_ram_base + ram_size, ram_size, vram_size, graphic_width, graphic_height);
168 lance_init(&nd_table[0], PHYS_JJ_LE_IRQ, PHYS_JJ_LE, PHYS_JJ_LEDMA); 224 lance_init(&nd_table[0], PHYS_JJ_LE_IRQ, PHYS_JJ_LE, PHYS_JJ_LEDMA);
169 nvram = m48t08_init(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE); 225 nvram = m48t08_init(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE);
170 - nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline);  
171 slavio_timer_init(PHYS_JJ_CLOCK, PHYS_JJ_CLOCK_IRQ, PHYS_JJ_CLOCK1, PHYS_JJ_CLOCK1_IRQ); 226 slavio_timer_init(PHYS_JJ_CLOCK, PHYS_JJ_CLOCK_IRQ, PHYS_JJ_CLOCK1, PHYS_JJ_CLOCK1_IRQ);
172 slavio_serial_ms_kbd_init(PHYS_JJ_MS_KBD, PHYS_JJ_MS_KBD_IRQ); 227 slavio_serial_ms_kbd_init(PHYS_JJ_MS_KBD, PHYS_JJ_MS_KBD_IRQ);
173 slavio_serial_init(PHYS_JJ_SER, PHYS_JJ_SER_IRQ, serial_hds[0], serial_hds[1]); 228 slavio_serial_init(PHYS_JJ_SER, PHYS_JJ_SER_IRQ, serial_hds[0], serial_hds[1]);
174 fdctrl_init(PHYS_JJ_FLOPPY_IRQ, 0, 1, PHYS_JJ_FDC, fd_table); 229 fdctrl_init(PHYS_JJ_FLOPPY_IRQ, 0, 1, PHYS_JJ_FDC, fd_table);
  230 + esp_init(bs_table, PHYS_JJ_ESP_IRQ, PHYS_JJ_ESP, PHYS_JJ_ESPDMA);
175 231
176 prom_offset = ram_size + vram_size; 232 prom_offset = ram_size + vram_size;
177 233
@@ -189,13 +245,14 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device, @@ -189,13 +245,14 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
189 cpu_register_physical_memory(PROM_ADDR, (ret + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK, 245 cpu_register_physical_memory(PROM_ADDR, (ret + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK,
190 prom_offset | IO_MEM_ROM); 246 prom_offset | IO_MEM_ROM);
191 247
  248 + kernel_size = 0;
192 if (linux_boot) { 249 if (linux_boot) {
193 - ret = load_elf(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);  
194 - if (ret < 0)  
195 - ret = load_aout(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);  
196 - if (ret < 0)  
197 - ret = load_image(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);  
198 - if (ret < 0) { 250 + kernel_size = load_elf(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);
  251 + if (kernel_size < 0)
  252 + kernel_size = load_aout(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);
  253 + if (kernel_size < 0)
  254 + kernel_size = load_image(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);
  255 + if (kernel_size < 0) {
199 fprintf(stderr, "qemu: could not load kernel '%s'\n", 256 fprintf(stderr, "qemu: could not load kernel '%s'\n",
200 kernel_filename); 257 kernel_filename);
201 exit(1); 258 exit(1);
@@ -222,4 +279,5 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device, @@ -222,4 +279,5 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
222 } 279 }
223 } 280 }
224 } 281 }
  282 + nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline, boot_device, ram_size, kernel_size, graphic_width, graphic_height, graphic_depth);
225 } 283 }
hw/tcx.c
1 /* 1 /*
2 - * QEMU Sun4m System Emulator 2 + * QEMU TCX Frame buffer
3 * 3 *
4 - * Copyright (c) 2003-2004 Fabrice Bellard 4 + * Copyright (c) 2003-2005 Fabrice Bellard
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy 6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal 7 * of this software and associated documentation files (the "Software"), to deal
@@ -25,29 +25,16 @@ @@ -25,29 +25,16 @@
25 25
26 #define MAXX 1024 26 #define MAXX 1024
27 #define MAXY 768 27 #define MAXY 768
28 -/*  
29 - * Proll uses only small part of display, we need to switch to full  
30 - * display when we get linux framebuffer console or X11 running. For  
31 - * now it's just slower and awkward.  
32 -*/  
33 -#if 1  
34 -#define XSZ (8*80)  
35 -#define YSZ (24*11)  
36 -#define XOFF (MAXX-XSZ)  
37 -#define YOFF (MAXY-YSZ)  
38 -#else  
39 -#define XSZ MAXX  
40 -#define YSZ MAXY  
41 -#define XOFF 0  
42 -#define YOFF 0  
43 -#endif 28 +#define TCX_DAC_NREGS 16
44 29
45 typedef struct TCXState { 30 typedef struct TCXState {
46 uint32_t addr; 31 uint32_t addr;
47 DisplayState *ds; 32 DisplayState *ds;
48 uint8_t *vram; 33 uint8_t *vram;
49 unsigned long vram_offset; 34 unsigned long vram_offset;
  35 + uint16_t width, height;
50 uint8_t r[256], g[256], b[256]; 36 uint8_t r[256], g[256], b[256];
  37 + uint8_t dac_index, dac_state;
51 } TCXState; 38 } TCXState;
52 39
53 static void tcx_draw_line32(TCXState *s1, uint8_t *d, 40 static void tcx_draw_line32(TCXState *s1, uint8_t *d,
@@ -58,9 +45,9 @@ static void tcx_draw_line32(TCXState *s1, uint8_t *d, @@ -58,9 +45,9 @@ static void tcx_draw_line32(TCXState *s1, uint8_t *d,
58 45
59 for(x = 0; x < width; x++) { 46 for(x = 0; x < width; x++) {
60 val = *s++; 47 val = *s++;
61 - *d++ = s1->r[val];  
62 - *d++ = s1->g[val];  
63 *d++ = s1->b[val]; 48 *d++ = s1->b[val];
  49 + *d++ = s1->g[val];
  50 + *d++ = s1->r[val];
64 d++; 51 d++;
65 } 52 }
66 } 53 }
@@ -73,9 +60,9 @@ static void tcx_draw_line24(TCXState *s1, uint8_t *d, @@ -73,9 +60,9 @@ static void tcx_draw_line24(TCXState *s1, uint8_t *d,
73 60
74 for(x = 0; x < width; x++) { 61 for(x = 0; x < width; x++) {
75 val = *s++; 62 val = *s++;
76 - *d++ = s1->r[val];  
77 - *d++ = s1->g[val];  
78 *d++ = s1->b[val]; 63 *d++ = s1->b[val];
  64 + *d++ = s1->g[val];
  65 + *d++ = s1->r[val];
79 } 66 }
80 } 67 }
81 68
@@ -104,12 +91,12 @@ void tcx_update_display(void *opaque) @@ -104,12 +91,12 @@ void tcx_update_display(void *opaque)
104 91
105 if (ts->ds->depth == 0) 92 if (ts->ds->depth == 0)
106 return; 93 return;
107 - page = ts->vram_offset + YOFF*MAXX; 94 + page = ts->vram_offset;
108 y_start = -1; 95 y_start = -1;
109 page_min = 0x7fffffff; 96 page_min = 0x7fffffff;
110 page_max = -1; 97 page_max = -1;
111 d = ts->ds->data; 98 d = ts->ds->data;
112 - s = ts->vram + YOFF*MAXX + XOFF; 99 + s = ts->vram;
113 dd = ts->ds->linesize; 100 dd = ts->ds->linesize;
114 ds = 1024; 101 ds = 1024;
115 102
@@ -128,7 +115,7 @@ void tcx_update_display(void *opaque) @@ -128,7 +115,7 @@ void tcx_update_display(void *opaque)
128 return; 115 return;
129 } 116 }
130 117
131 - for(y = 0; y < YSZ; y += 4, page += TARGET_PAGE_SIZE) { 118 + for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) {
132 if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) { 119 if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) {
133 if (y_start < 0) 120 if (y_start < 0)
134 y_start = y; 121 y_start = y;
@@ -136,23 +123,23 @@ void tcx_update_display(void *opaque) @@ -136,23 +123,23 @@ void tcx_update_display(void *opaque)
136 page_min = page; 123 page_min = page;
137 if (page > page_max) 124 if (page > page_max)
138 page_max = page; 125 page_max = page;
139 - f(ts, d, s, XSZ); 126 + f(ts, d, s, ts->width);
140 d += dd; 127 d += dd;
141 s += ds; 128 s += ds;
142 - f(ts, d, s, XSZ); 129 + f(ts, d, s, ts->width);
143 d += dd; 130 d += dd;
144 s += ds; 131 s += ds;
145 - f(ts, d, s, XSZ); 132 + f(ts, d, s, ts->width);
146 d += dd; 133 d += dd;
147 s += ds; 134 s += ds;
148 - f(ts, d, s, XSZ); 135 + f(ts, d, s, ts->width);
149 d += dd; 136 d += dd;
150 s += ds; 137 s += ds;
151 } else { 138 } else {
152 if (y_start >= 0) { 139 if (y_start >= 0) {
153 /* flush to display */ 140 /* flush to display */
154 dpy_update(ts->ds, 0, y_start, 141 dpy_update(ts->ds, 0, y_start,
155 - XSZ, y - y_start); 142 + ts->width, y - y_start);
156 y_start = -1; 143 y_start = -1;
157 } 144 }
158 d += dd * 4; 145 d += dd * 4;
@@ -162,7 +149,7 @@ void tcx_update_display(void *opaque) @@ -162,7 +149,7 @@ void tcx_update_display(void *opaque)
162 if (y_start >= 0) { 149 if (y_start >= 0) {
163 /* flush to display */ 150 /* flush to display */
164 dpy_update(ts->ds, 0, y_start, 151 dpy_update(ts->ds, 0, y_start,
165 - XSZ, y - y_start); 152 + ts->width, y - y_start);
166 } 153 }
167 /* reset modified pages */ 154 /* reset modified pages */
168 if (page_max != -1) { 155 if (page_max != -1) {
@@ -187,9 +174,13 @@ static void tcx_save(QEMUFile *f, void *opaque) @@ -187,9 +174,13 @@ static void tcx_save(QEMUFile *f, void *opaque)
187 174
188 qemu_put_be32s(f, (uint32_t *)&s->addr); 175 qemu_put_be32s(f, (uint32_t *)&s->addr);
189 qemu_put_be32s(f, (uint32_t *)&s->vram); 176 qemu_put_be32s(f, (uint32_t *)&s->vram);
  177 + qemu_put_be16s(f, (uint16_t *)&s->height);
  178 + qemu_put_be16s(f, (uint16_t *)&s->width);
190 qemu_put_buffer(f, s->r, 256); 179 qemu_put_buffer(f, s->r, 256);
191 qemu_put_buffer(f, s->g, 256); 180 qemu_put_buffer(f, s->g, 256);
192 qemu_put_buffer(f, s->b, 256); 181 qemu_put_buffer(f, s->b, 256);
  182 + qemu_put_8s(f, &s->dac_index);
  183 + qemu_put_8s(f, &s->dac_state);
193 } 184 }
194 185
195 static int tcx_load(QEMUFile *f, void *opaque, int version_id) 186 static int tcx_load(QEMUFile *f, void *opaque, int version_id)
@@ -201,9 +192,13 @@ static int tcx_load(QEMUFile *f, void *opaque, int version_id) @@ -201,9 +192,13 @@ static int tcx_load(QEMUFile *f, void *opaque, int version_id)
201 192
202 qemu_get_be32s(f, (uint32_t *)&s->addr); 193 qemu_get_be32s(f, (uint32_t *)&s->addr);
203 qemu_get_be32s(f, (uint32_t *)&s->vram); 194 qemu_get_be32s(f, (uint32_t *)&s->vram);
  195 + qemu_get_be16s(f, (uint16_t *)&s->height);
  196 + qemu_get_be16s(f, (uint16_t *)&s->width);
204 qemu_get_buffer(f, s->r, 256); 197 qemu_get_buffer(f, s->r, 256);
205 qemu_get_buffer(f, s->g, 256); 198 qemu_get_buffer(f, s->g, 256);
206 qemu_get_buffer(f, s->b, 256); 199 qemu_get_buffer(f, s->b, 256);
  200 + qemu_get_8s(f, &s->dac_index);
  201 + qemu_get_8s(f, &s->dac_state);
207 return 0; 202 return 0;
208 } 203 }
209 204
@@ -219,12 +214,66 @@ static void tcx_reset(void *opaque) @@ -219,12 +214,66 @@ static void tcx_reset(void *opaque)
219 memset(s->vram, 0, MAXX*MAXY); 214 memset(s->vram, 0, MAXX*MAXY);
220 cpu_physical_memory_reset_dirty(s->vram_offset, s->vram_offset + MAXX*MAXY, 215 cpu_physical_memory_reset_dirty(s->vram_offset, s->vram_offset + MAXX*MAXY,
221 VGA_DIRTY_FLAG); 216 VGA_DIRTY_FLAG);
  217 + s->dac_index = 0;
  218 + s->dac_state = 0;
  219 +}
  220 +
  221 +static uint32_t tcx_dac_readl(void *opaque, target_phys_addr_t addr)
  222 +{
  223 + return 0;
  224 +}
  225 +
  226 +static void tcx_dac_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
  227 +{
  228 + TCXState *s = opaque;
  229 + uint32_t saddr;
  230 +
  231 + saddr = (addr & (TCX_DAC_NREGS - 1)) >> 2;
  232 + switch (saddr) {
  233 + case 0:
  234 + s->dac_index = val >> 24;
  235 + s->dac_state = 0;
  236 + break;
  237 + case 1:
  238 + switch (s->dac_state) {
  239 + case 0:
  240 + s->r[s->dac_index] = val >> 24;
  241 + s->dac_state++;
  242 + break;
  243 + case 1:
  244 + s->g[s->dac_index] = val >> 24;
  245 + s->dac_state++;
  246 + break;
  247 + case 2:
  248 + s->b[s->dac_index] = val >> 24;
  249 + default:
  250 + s->dac_state = 0;
  251 + break;
  252 + }
  253 + break;
  254 + default:
  255 + break;
  256 + }
  257 + return;
222 } 258 }
223 259
  260 +static CPUReadMemoryFunc *tcx_dac_read[3] = {
  261 + tcx_dac_readl,
  262 + tcx_dac_readl,
  263 + tcx_dac_readl,
  264 +};
  265 +
  266 +static CPUWriteMemoryFunc *tcx_dac_write[3] = {
  267 + tcx_dac_writel,
  268 + tcx_dac_writel,
  269 + tcx_dac_writel,
  270 +};
  271 +
224 void *tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base, 272 void *tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base,
225 - unsigned long vram_offset, int vram_size) 273 + unsigned long vram_offset, int vram_size, int width, int height)
226 { 274 {
227 TCXState *s; 275 TCXState *s;
  276 + int io_memory;
228 277
229 s = qemu_mallocz(sizeof(TCXState)); 278 s = qemu_mallocz(sizeof(TCXState));
230 if (!s) 279 if (!s)
@@ -233,13 +282,17 @@ void *tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base, @@ -233,13 +282,17 @@ void *tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base,
233 s->addr = addr; 282 s->addr = addr;
234 s->vram = vram_base; 283 s->vram = vram_base;
235 s->vram_offset = vram_offset; 284 s->vram_offset = vram_offset;
  285 + s->width = width;
  286 + s->height = height;
236 287
237 - cpu_register_physical_memory(addr, vram_size, vram_offset); 288 + cpu_register_physical_memory(addr + 0x800000, vram_size, vram_offset);
  289 + io_memory = cpu_register_io_memory(0, tcx_dac_read, tcx_dac_write, s);
  290 + cpu_register_physical_memory(addr + 0x200000, TCX_DAC_NREGS, io_memory);
238 291
239 register_savevm("tcx", addr, 1, tcx_save, tcx_load, s); 292 register_savevm("tcx", addr, 1, tcx_save, tcx_load, s);
240 qemu_register_reset(tcx_reset, s); 293 qemu_register_reset(tcx_reset, s);
241 tcx_reset(s); 294 tcx_reset(s);
242 - dpy_resize(s->ds, XSZ, YSZ); 295 + dpy_resize(s->ds, width, height);
243 return s; 296 return s;
244 } 297 }
245 298
@@ -253,11 +306,11 @@ void tcx_screen_dump(void *opaque, const char *filename) @@ -253,11 +306,11 @@ void tcx_screen_dump(void *opaque, const char *filename)
253 f = fopen(filename, "wb"); 306 f = fopen(filename, "wb");
254 if (!f) 307 if (!f)
255 return; 308 return;
256 - fprintf(f, "P6\n%d %d\n%d\n", XSZ, YSZ, 255);  
257 - d1 = s->vram + YOFF*MAXX + XOFF;  
258 - for(y = 0; y < YSZ; y++) { 309 + fprintf(f, "P6\n%d %d\n%d\n", s->width, s->height, 255);
  310 + d1 = s->vram;
  311 + for(y = 0; y < s->height; y++) {
259 d = d1; 312 d = d1;
260 - for(x = 0; x < XSZ; x++) { 313 + for(x = 0; x < s->width; x++) {
261 v = *d; 314 v = *d;
262 fputc(s->r[v], f); 315 fputc(s->r[v], f);
263 fputc(s->g[v], f); 316 fputc(s->g[v], f);
pc-bios/proll.elf
No preview for this file type
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 --- proll_18.orig/Makefile 2002-09-13 14:16:59.000000000 +0000 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,6 +4,7 @@ 4 @@ -4,6 +4,7 @@
5 make -C krups-ser all 5 make -C krups-ser all
6 make -C espresso all 6 make -C espresso all
@@ -14,17 +14,143 @@ diff -ruN proll_18.orig/Makefile proll-patch4/Makefile @@ -14,17 +14,143 @@ diff -ruN proll_18.orig/Makefile proll-patch4/Makefile
14 make -C espresso clean 14 make -C espresso clean
15 make -C espresso-ser clean 15 make -C espresso-ser clean
16 + make -C qemu clean 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 --- proll_18.orig/qemu/head.S 1970-01-01 00:00:00.000000000 +0000 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 + ** Standalone startup code for Linux PROM emulator. 148 + ** Standalone startup code for Linux PROM emulator.
23 + ** Copyright 1999 Pete A. Zaitcev 149 + ** Copyright 1999 Pete A. Zaitcev
24 + ** This code is licensed under GNU General Public License. 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 +#include <psr.h> 156 +#include <psr.h>
@@ -167,6 +293,31 @@ diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S @@ -167,6 +293,31 @@ diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S
167 +_start: 293 +_start:
168 +start: 294 +start:
169 + .globl spill_window_entry, fill_window_entry 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 +C_LABEL(trapbase): 321 +C_LABEL(trapbase):
171 +t_zero: b goprol; nop; nop; nop; 322 +t_zero: b goprol; nop; nop; nop;
172 +t_tflt: SRMMU_TFAULT /* Inst. Access Exception */ 323 +t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
@@ -294,6 +445,8 @@ diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S @@ -294,6 +445,8 @@ diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S
294 + 445 +
295 +goprol: 446 +goprol:
296 + ! %g1 contains end of memory 447 + ! %g1 contains end of memory
  448 ++ set PHYS_JJ_EEPROM + 0x30, %g1
  449 ++ lda [%g1] ASI_M_BYPASS, %g1
297 + ! map PROLDATA to PROLBASE+PROLSIZE to end of ram 450 + ! map PROLDATA to PROLBASE+PROLSIZE to end of ram
298 + set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables 451 + set PROLSIZE+0x1000-PROLDATA+PROLBASE, %g2 ! add 0x1000 for temp tables
299 + sub %g1, %g2, %g2 ! start of private memory 452 + sub %g1, %g2, %g2 ! start of private memory
@@ -397,9 +550,6 @@ diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S @@ -397,9 +550,6 @@ diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S
397 + bl 1b 550 + bl 1b
398 + add %o0, 0x4, %o0 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 + mov 2, %g1 553 + mov 2, %g1
404 + wr %g1, 0x0, %wim ! make window 1 invalid 554 + wr %g1, 0x0, %wim ! make window 1 invalid
405 + WRITE_PAUSE 555 + WRITE_PAUSE
@@ -533,10 +683,10 @@ diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S @@ -533,10 +683,10 @@ diff -ruN proll_18.orig/qemu/head.S proll-patch4/qemu/head.S
533 +C_LABEL(ldb_bypass): 683 +C_LABEL(ldb_bypass):
534 + retl 684 + retl
535 + lduba [%o0] ASI_M_BYPASS, %o0 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 --- proll_18.orig/qemu/main.c 1970-01-01 00:00:00.000000000 +0000 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 + ** Proll (PROM replacement) 691 + ** Proll (PROM replacement)
542 + ** Copyright 1999 Pete Zaitcev 692 + ** Copyright 1999 Pete Zaitcev
@@ -558,8 +708,11 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c @@ -558,8 +708,11 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c
558 +#include <arpa.h> 708 +#include <arpa.h>
559 +#include <system.h> /* our own prototypes */ 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 +static void init_idprom(void); 715 +static void init_idprom(void);
562 -+static void makepages_q(struct phym *t, unsigned int highbase);  
563 + 716 +
564 +struct vconterm dp0; 717 +struct vconterm dp0;
565 +struct mem cmem; /* Current memory, virtual */ 718 +struct mem cmem; /* Current memory, virtual */
@@ -567,20 +720,48 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c @@ -567,20 +720,48 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c
567 +struct phym pmem; /* Current phys. mem. */ 720 +struct phym pmem; /* Current phys. mem. */
568 +struct iommu ciommu; /* Our IOMMU on sun4m */ 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 +void prolmain() 741 +void prolmain()
576 +{ 742 +{
577 -+ //static const char fname[14] = "00000000.PROL"; 743 ++ static char fname[14];
578 + static struct banks bb; 744 + static struct banks bb;
579 + unsigned int hiphybas; 745 + unsigned int hiphybas;
580 + const void *romvec; 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 + printk("PROLL %s QEMU\n", PROLL_VERSION_STRING); 763 + printk("PROLL %s QEMU\n", PROLL_VERSION_STRING);
  764 ++ ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);
584 + printk("%d MB total\n", ram_size/(1024*1024)); 765 + printk("%d MB total\n", ram_size/(1024*1024));
585 + 766 +
586 + bb.nbanks = 1; 767 + bb.nbanks = 1;
@@ -590,7 +771,7 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c @@ -590,7 +771,7 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c
590 + hiphybas = ram_size - PROLSIZE; 771 + hiphybas = ram_size - PROLSIZE;
591 + 772 +
592 + mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE)); 773 + mem_init(&cmem, (char *) &_end, (char *)(PROLBASE+PROLSIZE));
593 -+ makepages_q(&pmem, hiphybas); 774 ++ makepages(&pmem, hiphybas);
594 + init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas); 775 + init_mmu_swift((unsigned int)pmem.pctp - PROLBASE + hiphybas);
595 + 776 +
596 + mem_init(&cio, (char *)(PROLBASE+PROLSIZE), 777 + mem_init(&cio, (char *)(PROLBASE+PROLSIZE),
@@ -601,38 +782,46 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c @@ -601,38 +782,46 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c
601 + /* 782 + /*
602 + */ 783 + */
603 + init_idprom(); 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 + sched_init(); 790 + sched_init();
605 + le_probe(); 791 + le_probe();
606 + init_net(); 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 + printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n", 817 + printk("Memory used: virt 0x%x:0x%x[%dK] iomap 0x%x:0x%x\n",
630 + PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024, 818 + PROLBASE, (int)cmem.curp, ((unsigned) cmem.curp - PROLBASE)/1024,
631 + (int)cio.start, (int)cio.curp); 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 + entry(romvec, 0, 0, 0, 0); 825 + entry(romvec, 0, 0, 0, 0);
637 + } 826 + }
638 + 827 +
@@ -652,14 +841,12 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c @@ -652,14 +841,12 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c
652 + */ 841 + */
653 +void udelay(unsigned long usecs) 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 +static void init_idprom() 847 +static void init_idprom()
661 +{ 848 +{
662 -+ char *va_prom; 849 ++ void *va_prom;
663 + 850 +
664 + if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) { 851 + if ((va_prom = map_io(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE)) == NULL) {
665 + printk("init_idprom: cannot map eeprom\n"); 852 + printk("init_idprom: cannot map eeprom\n");
@@ -673,259 +860,97 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c @@ -673,259 +860,97 @@ diff -ruN proll_18.orig/qemu/main.c proll-patch4/qemu/main.c
673 + hw_idprom = va_prom; 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 +#if 1 /* Zaitcev */ 955 +#if 1 /* Zaitcev */
931 +static const int pixfreq = 0x03dfd240; 956 +static const int pixfreq = 0x03dfd240;
@@ -1005,6 +1030,7 @@ diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c @@ -1005,6 +1030,7 @@ diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c
1005 +static const struct property propv_obio[] = { 1030 +static const struct property propv_obio[] = {
1006 + {"name", "obio", 5 }, 1031 + {"name", "obio", 5 },
1007 + {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) }, 1032 + {"ranges", (char*)&prop_obio_ranges[0], sizeof(prop_obio_ranges) },
  1033 ++ {"device_type", "hierarchical", sizeof("hierarchical") },
1008 + {NULL, NULL, -1} 1034 + {NULL, NULL, -1}
1009 +}; 1035 +};
1010 + 1036 +
@@ -1056,29 +1082,35 @@ diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c @@ -1056,29 +1082,35 @@ diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c
1056 + {NULL, NULL, -1} 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 +static const int prop_zs_reg[] = { 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 +static const struct property propv_obio_zs[] = { 1091 +static const struct property propv_obio_zs[] = {
1065 + {"name", "zs", sizeof("zs")}, 1092 + {"name", "zs", sizeof("zs")},
1066 + {"reg", (char*)&prop_zs_reg[0], sizeof(prop_zs_reg) }, 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 + {"device_type", "serial", sizeof("serial") }, 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 + {NULL, NULL, -1} 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 +static const int prop_zs1_reg[] = { 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 +static const struct property propv_obio_zs1[] = { 1107 +static const struct property propv_obio_zs1[] = {
1078 + {"name", "zs", sizeof("zs")}, 1108 + {"name", "zs", sizeof("zs")},
1079 + {"reg", (char*)&prop_zs1_reg[0], sizeof(prop_zs1_reg) }, 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 + {"device_type", "serial", sizeof("serial") }, 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 + {NULL, NULL, -1} 1114 + {NULL, NULL, -1}
1083 +}; 1115 +};
1084 + 1116 +
@@ -1106,24 +1138,110 @@ diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c @@ -1106,24 +1138,110 @@ diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c
1106 + {NULL, NULL, -1} 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 +static const struct node nodes[] = { 1205 +static const struct node nodes[] = {
1110 + { &null_properties, 1, 0 }, /* 0 = big brother of root */ 1206 + { &null_properties, 1, 0 }, /* 0 = big brother of root */
1111 + { propv_root, 0, 2 }, /* 1 "/" */ 1207 + { propv_root, 0, 2 }, /* 1 "/" */
1112 -+ { propv_iommu, 8, 3 }, /* 2 "/iommu" */ 1208 ++ { propv_iommu, 11, 3 }, /* 2 "/iommu" */
1113 + { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */ 1209 + { propv_sbus, 0, 4 }, /* 3 "/iommu/sbus" */
1114 + { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */ 1210 + { propv_sbus_tcx, 5, 0 }, /* 4 "/iommu/sbus/SUNW,tcx" */
1115 + { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */ 1211 + { propv_sbus_ledma, 7, 6 }, /* 5 "/iommu/sbus/ledma" */
1116 + { propv_sbus_ledma_le, 0, 0 }, /* 6 "/iommu/sbus/ledma/le" */ 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 + { propv_obio_su, 14, 0 }, /* 13 "/obio/su" */ 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 +static struct linux_mlist_v0 totphys[MAX_BANKS]; 1247 +static struct linux_mlist_v0 totphys[MAX_BANKS];
@@ -1144,303 +1262,677 @@ diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c @@ -1144,303 +1262,677 @@ diff -ruN proll_18.orig/qemu/openprom.c proll-patch4/qemu/openprom.c
1144 + obp_nextprop /* char * (*no_nextprop)(int node, char *name); */ 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 +static const struct linux_arguments_v0 * const obp_argp = &obp_arg; 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];  
1280 -+ totphys[i].start_adr = (char*) bankv[i].start;  
1281 -+ totphys[i].num_bytes = bankv[i].length; 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));
1282 + } 1740 + }
1283 -+ totphys[i-1].theres_more = 0;  
1284 + 1741 +
1285 + /* 1742 + /*
1286 -+ * XXX Merged in normal PROM when full banks touch. 1743 ++ * Switch ctx table
1287 + */ 1744 + */
1288 -+ for (i = 0; i < bankc; i++) {  
1289 -+ unsigned bankbase = bankv[i].start;  
1290 -+ unsigned banksize = bankv[i].length;  
1291 -+ if (hiphybas > bankbase &&  
1292 -+ hiphybas < bankbase + banksize) {  
1293 -+ banksize = hiphybas - bankbase;  
1294 -+ }  
1295 -+ totavail[i].theres_more = &totavail[i+1];  
1296 -+ totavail[i].start_adr = (char*) bankbase;  
1297 -+ totavail[i].num_bytes = banksize;  
1298 -+ }  
1299 -+ totavail[i-1].theres_more = 0;  
1300 -+  
1301 -+ totmap[0].theres_more = 0;  
1302 -+ totmap[0].start_adr = (char*) PROLBASE;  
1303 -+ totmap[0].num_bytes = PROLSIZE; 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));
1304 + 1749 +
1305 + /* 1750 + /*
1306 -+ * idprom 1751 ++ * Flush old page table references
1307 + */ 1752 + */
1308 -+ bcopy(idprom, obp_idprom, IDPROM_SIZE);  
1309 -+  
1310 -+ // Linux wants a R/W romvec table  
1311 -+ romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;  
1312 -+ romvec0.pv_plugin_revision = 77;  
1313 -+ romvec0.pv_printrev = 0x10203;  
1314 -+ romvec0.pv_v0mem.v0_totphys = &ptphys;  
1315 -+ romvec0.pv_v0mem.v0_prommap = &ptmap;  
1316 -+ romvec0.pv_v0mem.v0_available = &ptavail;  
1317 -+ romvec0.pv_nodeops = &nodeops0;  
1318 -+ romvec0.pv_bootstr = (void *)doublewalk;  
1319 -+ romvec0.pv_stdin = &obp_stdin;  
1320 -+ romvec0.pv_stdout = &obp_stdout;  
1321 -+ romvec0.pv_getchar = obp_nbgetchar;  
1322 -+ romvec0.pv_putchar = obp_nbputchar;  
1323 -+ romvec0.pv_nbgetchar = obp_nbgetchar;  
1324 -+ romvec0.pv_nbputchar = obp_nbputchar;  
1325 -+ romvec0.pv_reboot = obp_reboot;  
1326 -+ romvec0.pv_abort = obp_abort;  
1327 -+ romvec0.pv_halt = obp_halt;  
1328 -+ romvec0.pv_synchook = &synch_hook;  
1329 -+ romvec0.pv_v0bootargs = &obp_argp;  
1330 -+ return &romvec0; 1753 ++ __asm__ __volatile__ ("sta %%g0, [%0] %1\n\t" : :
  1754 ++ "r" (0x400), "i" (ASI_M_FLUSH_PROBE) : "memory");
1331 +} 1755 +}
1332 + 1756 +
1333 -+static const struct property *find_property(int node,char *name)  
1334 -+{  
1335 -+ const struct property *prop = &nodes[node].properties[0];  
1336 -+ while (prop && prop->name) {  
1337 -+ if (bcmp(prop->name, name, 128) == 0) return prop;  
1338 -+ prop++; 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;
1339 + } 1773 + }
1340 -+ return NULL; 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;
1341 +} 1783 +}
1342 + 1784 +
1343 -+static int obp_nextnode(int node)  
1344 -+{  
1345 -+ return nodes[node].sibling; 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;
1346 +} 1797 +}
1347 + 1798 +
1348 -+static int obp_child(int node)  
1349 -+{  
1350 -+ return nodes[node].child; 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 ++ }
1351 +} 1812 +}
1352 + 1813 +
1353 -+static int obp_proplen(int node, char *name) 1814 ++/*
  1815 ++ * Allocate memory. This is reusable.
  1816 ++ */
  1817 ++void mem_init(struct mem *t, char *begin, char *limit)
1354 +{ 1818 +{
1355 -+ const struct property *prop = find_property(node,name);  
1356 -+ if (prop) return prop->length;  
1357 -+ return -1; 1819 ++ t->start = begin;
  1820 ++ t->uplim = limit;
  1821 ++ t->curp = begin;
1358 +} 1822 +}
1359 + 1823 +
1360 -+static int obp_getprop(int node, char *name, char *value) 1824 ++void mem_fini(struct mem *t)
1361 +{ 1825 +{
1362 -+ const struct property *prop;  
1363 -+  
1364 -+ prop = find_property(node,name);  
1365 -+ if (prop) {  
1366 -+ memcpy(value,prop->value,prop->length);  
1367 -+ //printk("obp_getprop '%s'= %s\n", name, value);  
1368 -+ return prop->length;  
1369 -+ }  
1370 -+ //printk("obp_getprop: not found\n");  
1371 -+ return -1; 1826 ++ t->curp = 0;
1372 +} 1827 +}
1373 + 1828 +
1374 -+static int obp_setprop(int node, char *name, char *value, int len) 1829 ++void *mem_alloc(struct mem *t, int size, int align)
1375 +{ 1830 +{
1376 -+ return -1;  
1377 -+} 1831 ++ char *p;
1378 + 1832 +
1379 -+static const char *obp_nextprop(int node,char *name)  
1380 -+{  
1381 -+ const struct property *prop = find_property(node,name);  
1382 -+ if (prop) return prop[1].name;  
1383 -+ return NULL; 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;
1384 +} 1837 +}
1385 + 1838 +
1386 -+#if 0  
1387 -+static unsigned char calc_idprom_cksum(struct idprom *idprom) 1839 ++void *mem_zalloc(struct mem *t, int size, int align)
1388 +{ 1840 +{
1389 -+ unsigned char cksum, i, *ptr = (unsigned char *)idprom;  
1390 -+  
1391 -+ for (i = cksum = 0; i <= 0x0E; i++)  
1392 -+ cksum ^= *ptr++; 1841 ++ char *p;
1393 + 1842 +
1394 -+ return cksum; 1843 ++ if ((p = mem_alloc(t, size, align)) != 0) bzero(p, size);
  1844 ++ return p;
1395 +} 1845 +}
1396 -+#endif  
1397 + 1846 +
1398 -+static int obp_nbgetchar(void) {  
1399 -+ return -1; 1847 ++/*
  1848 ++ * Library functions
  1849 ++ */
  1850 ++void bzero(void *s, int len) {
  1851 ++ while (len--) *((char *)s)++ = 0;
1400 +} 1852 +}
1401 + 1853 +
1402 -+static int obp_nbputchar(int ch) {  
1403 -+ extern struct vconterm dp0;  
1404 -+ char buf = ch; 1854 ++void bcopy(const void *f, void *t, int len) {
  1855 ++ while (len--) *((char *)t)++ = *((char *)f)++;
  1856 ++}
1405 + 1857 +
1406 -+ /* We do not use printk() in order to reduce stack depth. */  
1407 -+ vcon_write(&dp0, &buf, 1); 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 ++ }
1408 + return 0; 1871 + return 0;
1409 +} 1872 +}
1410 + 1873 +
1411 -+static void obp_reboot(char *str) {  
1412 -+ printk("rebooting (%s): not implemented, freezing\n", str);  
1413 -+ for (;;) {} 1874 ++int strlen(const char *s) {
  1875 ++ const char *p;
  1876 ++ for (p = s; *p != 0; p++) { }
  1877 ++ return p - s;
1414 +} 1878 +}
1415 + 1879 +
1416 -+static void obp_abort() {  
1417 -+ printk("abort, freezing\n");  
1418 -+ for (;;) {}  
1419 -+} 1880 ++extern void *printk_fn;
1420 + 1881 +
1421 -+static void obp_halt() {  
1422 -+ printk("halt, freezing\n");  
1423 -+ for (;;) {} 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);
1424 +} 1896 +}
1425 + 1897 +
1426 -+static int obp_devopen(char *str) {  
1427 -+ //printk("open %s\n", str);  
1428 -+ return 0; 1898 ++void fatal()
  1899 ++{
  1900 ++ printk("fatal.");
  1901 ++loop: goto loop;
1429 +} 1902 +}
1430 + 1903 +
1431 -+static int obp_devclose(int dev_desc) {  
1432 -+ //printk("close %d\n", dev_desc);  
1433 -+ return 0; 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;
1434 +} 1918 +}
1435 + 1919 +
1436 -+static int obp_rdblkdev(int dev_desc, int num_blks, int blk_st, char *buf) {  
1437 -+ //printk("rdblkdev: fd %d, num_blks %d, blk_st %d, buf 0x%x\n", dev_desc, num_blks, blk_st, buf);  
1438 -+ //buf[8] = 'L';  
1439 -+ return num_blks; 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;
1440 +} 1927 +}
1441 -diff -ruN proll_18.orig/src/arp.c proll-patch4/src/arp.c 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
1442 --- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000 1934 --- proll_18.orig/src/arp.c 2001-12-24 05:12:31.000000000 +0000
1443 -+++ proll-patch4/src/arp.c 2004-11-13 15:50:49.000000000 +0000 1935 ++++ proll-patch7/src/arp.c 2004-11-13 15:50:49.000000000 +0000
1444 @@ -45,7 +45,7 @@ 1936 @@ -45,7 +45,7 @@
1445 #endif 1937 #endif
1446 static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */ 1938 static struct arp_cache arp_list[ARPNUM]; /* ARP address cache */
@@ -1475,9 +1967,9 @@ diff -ruN proll_18.orig/src/arp.c proll-patch4/src/arp.c @@ -1475,9 +1967,9 @@ diff -ruN proll_18.orig/src/arp.c proll-patch4/src/arp.c
1475 + def_gw = IP_ANY; 1967 + def_gw = IP_ANY;
1476 return(TRUE); 1968 return(TRUE);
1477 } 1969 }
1478 -diff -ruN proll_18.orig/src/arp.h proll-patch4/src/arp.h 1970 +diff -ruN proll_18.orig/src/arp.h proll-patch7/src/arp.h
1479 --- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000 1971 --- proll_18.orig/src/arp.h 1999-03-18 03:39:43.000000000 +0000
1480 -+++ proll-patch4/src/arp.h 2004-11-13 15:50:49.000000000 +0000 1972 ++++ proll-patch7/src/arp.h 2004-11-13 15:50:49.000000000 +0000
1481 @@ -104,7 +104,7 @@ 1973 @@ -104,7 +104,7 @@
1482 extern int init_arp __P((void)); 1974 extern int init_arp __P((void));
1483 1975
@@ -1487,24 +1979,35 @@ diff -ruN proll_18.orig/src/arp.h proll-patch4/src/arp.h @@ -1487,24 +1979,35 @@ diff -ruN proll_18.orig/src/arp.h proll-patch4/src/arp.h
1487 1979
1488 /* Add a new antry to the ARP cache */ 1980 /* Add a new antry to the ARP cache */
1489 extern void addcache __P((unsigned char *ha, t_ipaddr ip)); 1981 extern void addcache __P((unsigned char *ha, t_ipaddr ip));
1490 -diff -ruN proll_18.orig/src/hconsole.c proll-patch4/src/hconsole.c 1982 +diff -ruN proll_18.orig/src/hconsole.c proll-patch7/src/hconsole.c
1491 --- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000 1983 --- proll_18.orig/src/hconsole.c 2002-07-23 05:52:48.000000000 +0000
1492 -+++ proll-patch4/src/hconsole.c 2004-11-13 15:50:49.000000000 +0000  
1493 -@@ -42,7 +42,11 @@ 1984 ++++ proll-patch7/src/hconsole.c 2005-03-02 17:03:09.000000000 +0000
  1985 +@@ -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 @@
1494 * No probing sequence or argument passing, hardcode everything. XXX 1997 * No probing sequence or argument passing, hardcode everything. XXX
1495 */ 1998 */
1496 raster8_cons_a(q, 768, 1024, (char *)a0); 1999 raster8_cons_a(q, 768, 1024, (char *)a0);
1497 -+#if 1 2000 ++#ifndef QEMU
1498 raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80)); 2001 raster_cons_2(r, q, 768-(24*11)-1, 1024-(8*80)-1, (24*11), (8*80));
1499 +#else 2002 +#else
1500 -+ raster_cons_2(r, q, 0, 0, 768, 1024); 2003 ++ raster_cons_2(r, q, 0, 0, q_height, q_width);
1501 +#endif 2004 +#endif
1502 t->r_ = r; 2005 t->r_ = r;
1503 t->r0_ = q; 2006 t->r0_ = q;
1504 t->f_ = &f_master; 2007 t->f_ = &f_master;
1505 -diff -ruN proll_18.orig/src/lat7_2.bm proll-patch4/src/lat7_2.bm 2008 +diff -ruN proll_18.orig/src/lat7_2.bm proll-patch7/src/lat7_2.bm
1506 --- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000 2009 --- proll_18.orig/src/lat7_2.bm 1999-02-27 05:48:54.000000000 +0000
1507 -+++ proll-patch4/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000 2010 ++++ proll-patch7/src/lat7_2.bm 2004-11-13 15:50:49.000000000 +0000
1508 @@ -1,6 +1,6 @@ 2011 @@ -1,6 +1,6 @@
1509 #define lat7_2_width 128 2012 #define lat7_2_width 128
1510 #define lat7_2_height 88 2013 #define lat7_2_height 88
@@ -1513,9 +2016,9 @@ diff -ruN proll_18.orig/src/lat7_2.bm proll-patch4/src/lat7_2.bm @@ -1513,9 +2016,9 @@ diff -ruN proll_18.orig/src/lat7_2.bm proll-patch4/src/lat7_2.bm
1513 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2016 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1514 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18, 2017 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x12, 0x1e, 0x0c, 0x02, 0x70, 0x18,
1515 0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02, 2018 0x22, 0x22, 0x18, 0x00, 0x00, 0x18, 0x18, 0xff, 0x18, 0x00, 0x12, 0x02,
1516 -diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch4/src/lat7_2_swapped.bm 2019 +diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch7/src/lat7_2_swapped.bm
1517 --- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000 2020 --- proll_18.orig/src/lat7_2_swapped.bm 1970-01-01 00:00:00.000000000 +0000
1518 -+++ proll-patch4/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000 2021 ++++ proll-patch7/src/lat7_2_swapped.bm 2004-11-13 15:50:49.000000000 +0000
1519 @@ -0,0 +1,121 @@ 2022 @@ -0,0 +1,121 @@
1520 +#define lat7_2_width 128 2023 +#define lat7_2_width 128
1521 +#define lat7_2_height 88 2024 +#define lat7_2_height 88
@@ -1638,9 +2141,9 @@ diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch4/src/lat7_2_swapped.bm @@ -1638,9 +2141,9 @@ diff -ruN proll_18.orig/src/lat7_2_swapped.bm proll-patch4/src/lat7_2_swapped.bm
1638 + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00, 2141 + 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0x00, 0x00, 0x00,
1639 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00, 2142 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x00, 0x00, 0x00, 0x00,
1640 + 0x00, 0x00, 0x00, 0x00}; 2143 + 0x00, 0x00, 0x00, 0x00};
1641 -diff -ruN proll_18.orig/src/le.c proll-patch4/src/le.c 2144 +diff -ruN proll_18.orig/src/le.c proll-patch7/src/le.c
1642 --- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000 2145 --- proll_18.orig/src/le.c 2002-07-23 05:52:49.000000000 +0000
1643 -+++ proll-patch4/src/le.c 2004-11-13 15:50:49.000000000 +0000 2146 ++++ proll-patch7/src/le.c 2004-11-13 15:50:49.000000000 +0000
1644 @@ -185,8 +185,6 @@ 2147 @@ -185,8 +185,6 @@
1645 unsigned short rap; /* register address port */ 2148 unsigned short rap; /* register address port */
1646 }; 2149 };
@@ -1650,9 +2153,9 @@ diff -ruN proll_18.orig/src/le.c proll-patch4/src/le.c @@ -1650,9 +2153,9 @@ diff -ruN proll_18.orig/src/le.c proll-patch4/src/le.c
1650 /* The Lance uses 24 bit addresses */ 2153 /* The Lance uses 24 bit addresses */
1651 /* On the Sun4c the DVMA will provide the remaining bytes for us */ 2154 /* On the Sun4c the DVMA will provide the remaining bytes for us */
1652 /* On the Sun4m we have to instruct the ledma to provide them */ 2155 /* On the Sun4m we have to instruct the ledma to provide them */
1653 -diff -ruN proll_18.orig/src/netinit.c proll-patch4/src/netinit.c 2156 +diff -ruN proll_18.orig/src/netinit.c proll-patch7/src/netinit.c
1654 --- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000 2157 --- proll_18.orig/src/netinit.c 2002-09-13 21:53:33.000000000 +0000
1655 -+++ proll-patch4/src/netinit.c 2004-11-13 15:50:49.000000000 +0000 2158 ++++ proll-patch7/src/netinit.c 2004-11-13 15:50:49.000000000 +0000
1656 @@ -49,13 +49,20 @@ 2159 @@ -49,13 +49,20 @@
1657 unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */ 2160 unsigned char myhwaddr[ETH_ALEN]; /* my own hardware addr */
1658 t_ipaddr myipaddr; /* my own IP address */ 2161 t_ipaddr myipaddr; /* my own IP address */
@@ -1696,9 +2199,9 @@ diff -ruN proll_18.orig/src/netinit.c proll-patch4/src/netinit.c @@ -1696,9 +2199,9 @@ diff -ruN proll_18.orig/src/netinit.c proll-patch4/src/netinit.c
1696 fatal(); 2199 fatal();
1697 } 2200 }
1698 } 2201 }
1699 -diff -ruN proll_18.orig/src/netpriv.h proll-patch4/src/netpriv.h 2202 +diff -ruN proll_18.orig/src/netpriv.h proll-patch7/src/netpriv.h
1700 --- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000 2203 --- proll_18.orig/src/netpriv.h 1999-04-27 05:39:37.000000000 +0000
1701 -+++ proll-patch4/src/netpriv.h 2004-11-13 15:50:49.000000000 +0000 2204 ++++ proll-patch7/src/netpriv.h 2004-11-13 15:50:49.000000000 +0000
1702 @@ -130,10 +130,9 @@ 2205 @@ -130,10 +130,9 @@
1703 * 2206 *
1704 */ 2207 */
@@ -1720,9 +2223,9 @@ diff -ruN proll_18.orig/src/netpriv.h proll-patch4/src/netpriv.h @@ -1720,9 +2223,9 @@ diff -ruN proll_18.orig/src/netpriv.h proll-patch4/src/netpriv.h
1720 2223
1721 /* Empty read buffer */ 2224 /* Empty read buffer */
1722 extern void empty_buf __P((void)); 2225 extern void empty_buf __P((void));
1723 -diff -ruN proll_18.orig/src/openprom.h proll-patch4/src/openprom.h 2226 +diff -ruN proll_18.orig/src/openprom.h proll-patch7/src/openprom.h
1724 --- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000 2227 --- proll_18.orig/src/openprom.h 2002-07-14 02:26:30.000000000 +0000
1725 -+++ proll-patch4/src/openprom.h 2004-11-13 15:50:49.000000000 +0000 2228 ++++ proll-patch7/src/openprom.h 2004-11-13 15:50:49.000000000 +0000
1726 @@ -54,20 +54,20 @@ 2229 @@ -54,20 +54,20 @@
1727 }; 2230 };
1728 2231
@@ -1784,9 +2287,9 @@ diff -ruN proll_18.orig/src/openprom.h proll-patch4/src/openprom.h @@ -1784,9 +2287,9 @@ diff -ruN proll_18.orig/src/openprom.h proll-patch4/src/openprom.h
1784 }; 2287 };
1785 2288
1786 /* More fun PROM structures for device probing. */ 2289 /* More fun PROM structures for device probing. */
1787 -diff -ruN proll_18.orig/src/packet.c proll-patch4/src/packet.c 2290 +diff -ruN proll_18.orig/src/packet.c proll-patch7/src/packet.c
1788 --- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000 2291 --- proll_18.orig/src/packet.c 2000-02-11 04:56:45.000000000 +0000
1789 -+++ proll-patch4/src/packet.c 2004-11-13 15:50:49.000000000 +0000 2292 ++++ proll-patch7/src/packet.c 2004-11-13 15:50:49.000000000 +0000
1790 @@ -41,7 +41,7 @@ 2293 @@ -41,7 +41,7 @@
1791 int aligner; 2294 int aligner;
1792 } wbuf; 2295 } wbuf;
@@ -1814,9 +2317,9 @@ diff -ruN proll_18.orig/src/packet.c proll-patch4/src/packet.c @@ -1814,9 +2317,9 @@ diff -ruN proll_18.orig/src/packet.c proll-patch4/src/packet.c
1814 { 2317 {
1815 struct sk_buff *skb; 2318 struct sk_buff *skb;
1816 unsigned char *s; 2319 unsigned char *s;
1817 -diff -ruN proll_18.orig/src/printf.c proll-patch4/src/printf.c 2320 +diff -ruN proll_18.orig/src/printf.c proll-patch7/src/printf.c
1818 --- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000 2321 --- proll_18.orig/src/printf.c 1999-03-19 07:03:59.000000000 +0000
1819 -+++ proll-patch4/src/printf.c 2004-11-13 15:50:49.000000000 +0000 2322 ++++ proll-patch7/src/printf.c 2004-11-13 15:50:49.000000000 +0000
1820 @@ -19,7 +19,7 @@ 2323 @@ -19,7 +19,7 @@
1821 static void printn(struct prf_fp *, unsigned long, unsigned int); 2324 static void printn(struct prf_fp *, unsigned long, unsigned int);
1822 static void putchar(char, struct prf_fp *); 2325 static void putchar(char, struct prf_fp *);
@@ -1844,9 +2347,9 @@ diff -ruN proll_18.orig/src/printf.c proll-patch4/src/printf.c @@ -1844,9 +2347,9 @@ diff -ruN proll_18.orig/src/printf.c proll-patch4/src/printf.c
1844 putchar(c,filog); 2347 putchar(c,filog);
1845 } else if (c == 'l' || c == 'O') { 2348 } else if (c == 'l' || c == 'O') {
1846 printn(filog, (long)va_arg(adx,long), c=='l'?10:8); 2349 printn(filog, (long)va_arg(adx,long), c=='l'?10:8);
1847 -diff -ruN proll_18.orig/src/rconsole.c proll-patch4/src/rconsole.c 2350 +diff -ruN proll_18.orig/src/rconsole.c proll-patch7/src/rconsole.c
1848 --- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000 2351 --- proll_18.orig/src/rconsole.c 1999-01-16 07:16:55.000000000 +0000
1849 -+++ proll-patch4/src/rconsole.c 2004-11-13 15:50:49.000000000 +0000 2352 ++++ proll-patch7/src/rconsole.c 2004-11-13 15:50:49.000000000 +0000
1850 @@ -28,12 +28,18 @@ 2353 @@ -28,12 +28,18 @@
1851 * move to California. Only plain lat7 survived. 2354 * move to California. Only plain lat7 survived.
1852 * I recreated lat7-1 changes in lat7-2. --zaitcev 2355 * I recreated lat7-1 changes in lat7-2. --zaitcev
@@ -1901,9 +2404,9 @@ diff -ruN proll_18.orig/src/rconsole.c proll-patch4/src/rconsole.c @@ -1901,9 +2404,9 @@ diff -ruN proll_18.orig/src/rconsole.c proll-patch4/src/rconsole.c
1901 p->nchars_ = LAT7_NCHARS; 2404 p->nchars_ = LAT7_NCHARS;
1902 p->width_ = LAT7_WIDTH; 2405 p->width_ = LAT7_WIDTH;
1903 p->height_ = LAT7_HEIGHT; 2406 p->height_ = LAT7_HEIGHT;
1904 -diff -ruN proll_18.orig/src/rconsole.h proll-patch4/src/rconsole.h 2407 +diff -ruN proll_18.orig/src/rconsole.h proll-patch7/src/rconsole.h
1905 --- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000 2408 --- proll_18.orig/src/rconsole.h 1999-01-16 05:00:59.000000000 +0000
1906 -+++ proll-patch4/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000 2409 ++++ proll-patch7/src/rconsole.h 2004-11-13 15:50:49.000000000 +0000
1907 @@ -13,10 +13,10 @@ 2410 @@ -13,10 +13,10 @@
1908 */ 2411 */
1909 2412
@@ -1917,9 +2420,9 @@ diff -ruN proll_18.orig/src/rconsole.h proll-patch4/src/rconsole.h @@ -1917,9 +2420,9 @@ diff -ruN proll_18.orig/src/rconsole.h proll-patch4/src/rconsole.h
1917 int nchars_; /* 128 for ASCII ... 65536 for Unicode */ 2420 int nchars_; /* 128 for ASCII ... 65536 for Unicode */
1918 int width_; /* [Pixels]. Maximum size is 16. */ 2421 int width_; /* [Pixels]. Maximum size is 16. */
1919 int height_; /* [Pixels == scan lines]. */ 2422 int height_; /* [Pixels == scan lines]. */
1920 -diff -ruN proll_18.orig/src/romlib.h proll-patch4/src/romlib.h 2423 +diff -ruN proll_18.orig/src/romlib.h proll-patch7/src/romlib.h
1921 --- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000 2424 --- proll_18.orig/src/romlib.h 1999-04-20 04:26:45.000000000 +0000
1922 -+++ proll-patch4/src/romlib.h 2004-11-13 15:50:49.000000000 +0000 2425 ++++ proll-patch7/src/romlib.h 2004-11-13 15:50:49.000000000 +0000
1923 @@ -73,12 +73,12 @@ 2426 @@ -73,12 +73,12 @@
1924 #define memcpy(dst, src, len) bcopy(src, dst, len) 2427 #define memcpy(dst, src, len) bcopy(src, dst, len)
1925 #define memcmp(x1, x2, len) bcmp(x1, x2, len) 2428 #define memcmp(x1, x2, len) bcmp(x1, x2, len)
@@ -1936,9 +2439,9 @@ diff -ruN proll_18.orig/src/romlib.h proll-patch4/src/romlib.h @@ -1936,9 +2439,9 @@ diff -ruN proll_18.orig/src/romlib.h proll-patch4/src/romlib.h
1936 2439
1937 2440
1938 /* 2441 /*
1939 -diff -ruN proll_18.orig/src/sched_4m.c proll-patch4/src/sched_4m.c 2442 +diff -ruN proll_18.orig/src/sched_4m.c proll-patch7/src/sched_4m.c
1940 --- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000 2443 --- proll_18.orig/src/sched_4m.c 1999-04-27 05:48:51.000000000 +0000
1941 -+++ proll-patch4/src/sched_4m.c 2004-11-13 15:50:49.000000000 +0000 2444 ++++ proll-patch7/src/sched_4m.c 2004-11-13 15:50:49.000000000 +0000
1942 @@ -108,7 +108,7 @@ 2445 @@ -108,7 +108,7 @@
1943 static int set_bolt; /* Tick counter limit */ 2446 static int set_bolt; /* Tick counter limit */
1944 static struct handsc hndv[16]; 2447 static struct handsc hndv[16];
@@ -1948,9 +2451,9 @@ diff -ruN proll_18.orig/src/sched_4m.c proll-patch4/src/sched_4m.c @@ -1948,9 +2451,9 @@ diff -ruN proll_18.orig/src/sched_4m.c proll-patch4/src/sched_4m.c
1948 0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0, 2451 0, 0, 0, 0, 0, 0, SUN4M_INT_ETHERNET, 0,
1949 0, 0, 0, 0, 0, 0, 0, 0, 2452 0, 0, 0, 0, 0, 0, 0, 0,
1950 }; 2453 };
1951 -diff -ruN proll_18.orig/src/swap.c proll-patch4/src/swap.c 2454 +diff -ruN proll_18.orig/src/swap.c proll-patch7/src/swap.c
1952 --- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000 2455 --- proll_18.orig/src/swap.c 1970-01-01 00:00:00.000000000 +0000
1953 -+++ proll-patch4/src/swap.c 2004-11-13 15:50:49.000000000 +0000 2456 ++++ proll-patch7/src/swap.c 2004-11-13 15:50:49.000000000 +0000
1954 @@ -0,0 +1,21 @@ 2457 @@ -0,0 +1,21 @@
1955 +// Convert the lat7 font so that no conversion is needed at runtime. 2458 +// Convert the lat7 font so that no conversion is needed at runtime.
1956 +#define ORIG 2459 +#define ORIG
@@ -1973,9 +2476,9 @@ diff -ruN proll_18.orig/src/swap.c proll-patch4/src/swap.c @@ -1973,9 +2476,9 @@ diff -ruN proll_18.orig/src/swap.c proll-patch4/src/swap.c
1973 + } 2476 + }
1974 + printf("\n"); 2477 + printf("\n");
1975 +} 2478 +}
1976 -diff -ruN proll_18.orig/src/system.c proll-patch4/src/system.c 2479 +diff -ruN proll_18.orig/src/system.c proll-patch7/src/system.c
1977 --- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000 2480 --- proll_18.orig/src/system.c 2002-07-23 05:52:49.000000000 +0000
1978 -+++ proll-patch4/src/system.c 2004-11-13 15:50:49.000000000 +0000 2481 ++++ proll-patch7/src/system.c 2004-11-13 15:50:49.000000000 +0000
1979 @@ -298,8 +298,8 @@ 2482 @@ -298,8 +298,8 @@
1980 } 2483 }
1981 2484
@@ -2028,9 +2531,9 @@ diff -ruN proll_18.orig/src/system.c proll-patch4/src/system.c @@ -2028,9 +2531,9 @@ diff -ruN proll_18.orig/src/system.c proll-patch4/src/system.c
2028 void fatal() 2531 void fatal()
2029 { 2532 {
2030 printk("fatal."); 2533 printk("fatal.");
2031 -diff -ruN proll_18.orig/src/system.h proll-patch4/src/system.h 2534 +diff -ruN proll_18.orig/src/system.h proll-patch7/src/system.h
2032 --- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000 2535 --- proll_18.orig/src/system.h 2002-09-13 21:53:32.000000000 +0000
2033 -+++ proll-patch4/src/system.h 2004-11-13 15:50:49.000000000 +0000 2536 ++++ proll-patch7/src/system.h 2004-11-13 15:50:49.000000000 +0000
2034 @@ -16,7 +16,7 @@ 2537 @@ -16,7 +16,7 @@
2035 #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */ 2538 #define IOMAPSIZE (1*1024*1024) /* 1 Meg maximum: we do not map framebuffer. */
2036 #define NCTX_SWIFT 0x100 2539 #define NCTX_SWIFT 0x100
@@ -2040,9 +2543,9 @@ diff -ruN proll_18.orig/src/system.h proll-patch4/src/system.h @@ -2040,9 +2543,9 @@ diff -ruN proll_18.orig/src/system.h proll-patch4/src/system.h
2040 2543
2041 #ifndef __ASSEMBLY__ 2544 #ifndef __ASSEMBLY__
2042 struct bank { 2545 struct bank {
2043 -diff -ruN proll_18.orig/src/udp.c proll-patch4/src/udp.c 2546 +diff -ruN proll_18.orig/src/udp.c proll-patch7/src/udp.c
2044 --- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000 2547 --- proll_18.orig/src/udp.c 2001-12-24 05:12:53.000000000 +0000
2045 -+++ proll-patch4/src/udp.c 2004-11-13 15:50:49.000000000 +0000 2548 ++++ proll-patch7/src/udp.c 2004-11-13 15:50:49.000000000 +0000
2046 @@ -81,7 +81,7 @@ 2549 @@ -81,7 +81,7 @@
2047 int source; 2550 int source;
2048 int dest; 2551 int dest;
@@ -2062,3 +2565,263 @@ diff -ruN proll_18.orig/src/udp.c proll-patch4/src/udp.c @@ -2062,3 +2565,263 @@ diff -ruN proll_18.orig/src/udp.c proll-patch4/src/udp.c
2062 /* Register IP packet type and set write buffer pointer */ 2565 /* Register IP packet type and set write buffer pointer */
2063 if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL) 2566 if ((writebuf = reg_type(htons(ETH_P_IP), ip_recv)) == NULL)
2064 return(FALSE); 2567 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);
target-sparc/helper.c
@@ -138,6 +138,7 @@ int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot @@ -138,6 +138,7 @@ int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot
138 } 138 }
139 139
140 *access_index = ((rw & 1) << 2) | (rw & 2) | (is_user? 0 : 1); 140 *access_index = ((rw & 1) << 2) | (rw & 2) | (is_user? 0 : 1);
  141 + *physical = 0xfffff000;
141 142
142 /* SPARC reference MMU table walk: Context table->L1->L2->PTE */ 143 /* SPARC reference MMU table walk: Context table->L1->L2->PTE */
143 /* Context base + context number */ 144 /* Context base + context number */
@@ -210,7 +211,7 @@ int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot @@ -210,7 +211,7 @@ int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot
210 /* check access */ 211 /* check access */
211 access_perms = (pde & PTE_ACCESS_MASK) >> PTE_ACCESS_SHIFT; 212 access_perms = (pde & PTE_ACCESS_MASK) >> PTE_ACCESS_SHIFT;
212 error_code = access_table[*access_index][access_perms]; 213 error_code = access_table[*access_index][access_perms];
213 - if (error_code) 214 + if (error_code && !(env->mmuregs[0] & MMU_NF))
214 return error_code; 215 return error_code;
215 216
216 /* the page can be put in the TLB */ 217 /* the page can be put in the TLB */
@@ -225,7 +226,7 @@ int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot @@ -225,7 +226,7 @@ int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot
225 /* Even if large ptes, we map only one 4KB page in the cache to 226 /* Even if large ptes, we map only one 4KB page in the cache to
226 avoid filling it too fast */ 227 avoid filling it too fast */
227 *physical = ((pde & PTE_ADDR_MASK) << 4) + page_offset; 228 *physical = ((pde & PTE_ADDR_MASK) << 4) + page_offset;
228 - return 0; 229 + return error_code;
229 } 230 }
230 231
231 /* Perform address translation */ 232 /* Perform address translation */
@@ -251,17 +252,14 @@ int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, @@ -251,17 +252,14 @@ int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
251 env->mmuregs[4] = address; /* Fault address register */ 252 env->mmuregs[4] = address; /* Fault address register */
252 253
253 if ((env->mmuregs[0] & MMU_NF) || env->psret == 0) { 254 if ((env->mmuregs[0] & MMU_NF) || env->psret == 0) {
254 -#if 0  
255 - // No fault 255 + // No fault mode: if a mapping is available, just override
  256 + // permissions. If no mapping is available, redirect accesses to
  257 + // neverland. Fake/overridden mappings will be flushed when
  258 + // switching to normal mode.
256 vaddr = address & TARGET_PAGE_MASK; 259 vaddr = address & TARGET_PAGE_MASK;
257 - paddr = 0xfffff000;  
258 prot = PAGE_READ | PAGE_WRITE; 260 prot = PAGE_READ | PAGE_WRITE;
259 ret = tlb_set_page(env, vaddr, paddr, prot, is_user, is_softmmu); 261 ret = tlb_set_page(env, vaddr, paddr, prot, is_user, is_softmmu);
260 return ret; 262 return ret;
261 -#else  
262 - cpu_abort(env, "MMU no fault case no handled");  
263 - return 0;  
264 -#endif  
265 } else { 263 } else {
266 if (rw & 2) 264 if (rw & 2)
267 env->exception_index = TT_TFAULT; 265 env->exception_index = TT_TFAULT;
@@ -316,8 +314,8 @@ void do_interrupt(int intno) @@ -316,8 +314,8 @@ void do_interrupt(int intno)
316 count, intno, 314 count, intno,
317 env->pc, 315 env->pc,
318 env->npc, env->regwptr[6]); 316 env->npc, env->regwptr[6]);
319 -#if 1  
320 cpu_dump_state(env, logfile, fprintf, 0); 317 cpu_dump_state(env, logfile, fprintf, 0);
  318 +#if 0
321 { 319 {
322 int i; 320 int i;
323 uint8_t *ptr; 321 uint8_t *ptr;
target-sparc/op_helper.c
@@ -164,7 +164,9 @@ void helper_st_asi(int asi, int size, int sign) @@ -164,7 +164,9 @@ void helper_st_asi(int asi, int size, int sign)
164 case 0: 164 case 0:
165 env->mmuregs[reg] &= ~(MMU_E | MMU_NF); 165 env->mmuregs[reg] &= ~(MMU_E | MMU_NF);
166 env->mmuregs[reg] |= T1 & (MMU_E | MMU_NF); 166 env->mmuregs[reg] |= T1 & (MMU_E | MMU_NF);
167 - if ((oldreg & MMU_E) != (env->mmuregs[reg] & MMU_E)) 167 + // Mappings generated during no-fault mode or MMU
  168 + // disabled mode are invalid in normal mode
  169 + if (oldreg != env->mmuregs[reg])
168 tlb_flush(env, 1); 170 tlb_flush(env, 1);
169 break; 171 break;
170 case 2: 172 case 2:
@@ -2733,7 +2733,9 @@ void help(void) @@ -2733,7 +2733,9 @@ void help(void)
2733 "-full-screen start in full screen\n" 2733 "-full-screen start in full screen\n"
2734 #ifdef TARGET_PPC 2734 #ifdef TARGET_PPC
2735 "-prep Simulate a PREP system (default is PowerMAC)\n" 2735 "-prep Simulate a PREP system (default is PowerMAC)\n"
2736 - "-g WxH[xDEPTH] Set the initial VGA graphic mode\n" 2736 +#endif
  2737 +#if defined(TARGET_PPC) || defined(TARGET_SPARC)
  2738 + "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n"
2737 #endif 2739 #endif
2738 "\n" 2740 "\n"
2739 "Network options:\n" 2741 "Network options:\n"
@@ -2916,6 +2918,8 @@ const QEMUOption qemu_options[] = { @@ -2916,6 +2918,8 @@ const QEMUOption qemu_options[] = {
2916 #endif 2918 #endif
2917 #ifdef TARGET_PPC 2919 #ifdef TARGET_PPC
2918 { "prep", 0, QEMU_OPTION_prep }, 2920 { "prep", 0, QEMU_OPTION_prep },
  2921 +#endif
  2922 +#if defined(TARGET_PPC) || defined(TARGET_SPARC)
2919 { "g", 1, QEMU_OPTION_g }, 2923 { "g", 1, QEMU_OPTION_g },
2920 #endif 2924 #endif
2921 { "localtime", 0, QEMU_OPTION_localtime }, 2925 { "localtime", 0, QEMU_OPTION_localtime },
@@ -3179,6 +3183,10 @@ int main(int argc, char **argv) @@ -3179,6 +3183,10 @@ int main(int argc, char **argv)
3179 case QEMU_OPTION_boot: 3183 case QEMU_OPTION_boot:
3180 boot_device = optarg[0]; 3184 boot_device = optarg[0];
3181 if (boot_device != 'a' && 3185 if (boot_device != 'a' &&
  3186 +#ifdef TARGET_SPARC
  3187 + // Network boot
  3188 + boot_device != 'n' &&
  3189 +#endif
3182 boot_device != 'c' && boot_device != 'd') { 3190 boot_device != 'c' && boot_device != 'd') {
3183 fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device); 3191 fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device);
3184 exit(1); 3192 exit(1);
@@ -714,7 +714,7 @@ void lance_init(NetDriverState *nd, int irq, uint32_t leaddr, uint32_t ledaddr); @@ -714,7 +714,7 @@ void lance_init(NetDriverState *nd, int irq, uint32_t leaddr, uint32_t ledaddr);
714 714
715 /* tcx.c */ 715 /* tcx.c */
716 void *tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base, 716 void *tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base,
717 - unsigned long vram_offset, int vram_size); 717 + unsigned long vram_offset, int vram_size, int width, int height);
718 void tcx_update_display(void *opaque); 718 void tcx_update_display(void *opaque);
719 void tcx_invalidate_display(void *opaque); 719 void tcx_invalidate_display(void *opaque);
720 void tcx_screen_dump(void *opaque, const char *filename); 720 void tcx_screen_dump(void *opaque, const char *filename);
@@ -736,6 +736,9 @@ void slavio_timer_init(uint32_t addr1, int irq1, uint32_t addr2, int irq2); @@ -736,6 +736,9 @@ void slavio_timer_init(uint32_t addr1, int irq1, uint32_t addr2, int irq2);
736 SerialState *slavio_serial_init(int base, int irq, CharDriverState *chr1, CharDriverState *chr2); 736 SerialState *slavio_serial_init(int base, int irq, CharDriverState *chr1, CharDriverState *chr2);
737 void slavio_serial_ms_kbd_init(int base, int irq); 737 void slavio_serial_ms_kbd_init(int base, int irq);
738 738
  739 +/* esp.c */
  740 +void esp_init(BlockDriverState **bd, int irq, uint32_t espaddr, uint32_t espdaddr);
  741 +
739 /* NVRAM helpers */ 742 /* NVRAM helpers */
740 #include "hw/m48t59.h" 743 #include "hw/m48t59.h"
741 744