Commit b6f479d355a5391e0ac939a17e9175473e6516d1

Authored by bellard
1 parent 1289f43a

-append support (Blue Swirl)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1316 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 20 additions and 2 deletions
hw/sun4m.c
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 #include "m48t08.h" 25 #include "m48t08.h"
26 26
27 #define KERNEL_LOAD_ADDR 0x00004000 27 #define KERNEL_LOAD_ADDR 0x00004000
  28 +#define CMDLINE_ADDR 0x007ff000
28 #define INITRD_LOAD_ADDR 0x00800000 29 #define INITRD_LOAD_ADDR 0x00800000
29 #define PROM_ADDR 0xffd00000 30 #define PROM_ADDR 0xffd00000
30 #define PROM_FILENAMEB "proll.bin" 31 #define PROM_FILENAMEB "proll.bin"
@@ -64,11 +65,28 @@ void DMA_run() {} @@ -64,11 +65,28 @@ void DMA_run() {}
64 65
65 static m48t08_t *nvram; 66 static m48t08_t *nvram;
66 67
67 -static void nvram_init(m48t08_t *nvram, uint8_t *macaddr) 68 +static void nvram_init(m48t08_t *nvram, uint8_t *macaddr, const char *cmdline)
68 { 69 {
69 unsigned char tmp = 0; 70 unsigned char tmp = 0;
70 int i, j; 71 int i, j;
71 72
  73 + i = 0x40;
  74 + if (cmdline) {
  75 + uint32_t cmdline_len;
  76 +
  77 + 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);
  88 + }
  89 +
72 i = 0x1fd8; 90 i = 0x1fd8;
73 m48t08_write(nvram, i++, 0x01); 91 m48t08_write(nvram, i++, 0x01);
74 m48t08_write(nvram, i++, 0x80); /* Sun4m OBP */ 92 m48t08_write(nvram, i++, 0x80); /* Sun4m OBP */
@@ -149,7 +167,7 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device, @@ -149,7 +167,7 @@ void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
149 tcx = tcx_init(ds, PHYS_JJ_TCX_FB, phys_ram_base + ram_size, ram_size, vram_size); 167 tcx = tcx_init(ds, PHYS_JJ_TCX_FB, phys_ram_base + ram_size, ram_size, vram_size);
150 lance_init(&nd_table[0], PHYS_JJ_LE_IRQ, PHYS_JJ_LE, PHYS_JJ_LEDMA); 168 lance_init(&nd_table[0], PHYS_JJ_LE_IRQ, PHYS_JJ_LE, PHYS_JJ_LEDMA);
151 nvram = m48t08_init(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE); 169 nvram = m48t08_init(PHYS_JJ_EEPROM, PHYS_JJ_EEPROM_SIZE);
152 - nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr); 170 + nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline);
153 slavio_timer_init(PHYS_JJ_CLOCK, PHYS_JJ_CLOCK_IRQ, PHYS_JJ_CLOCK1, PHYS_JJ_CLOCK1_IRQ); 171 slavio_timer_init(PHYS_JJ_CLOCK, PHYS_JJ_CLOCK_IRQ, PHYS_JJ_CLOCK1, PHYS_JJ_CLOCK1_IRQ);
154 slavio_serial_ms_kbd_init(PHYS_JJ_MS_KBD, PHYS_JJ_MS_KBD_IRQ); 172 slavio_serial_ms_kbd_init(PHYS_JJ_MS_KBD, PHYS_JJ_MS_KBD_IRQ);
155 slavio_serial_init(PHYS_JJ_SER, PHYS_JJ_SER_IRQ, serial_hds[0], serial_hds[1]); 173 slavio_serial_init(PHYS_JJ_SER, PHYS_JJ_SER_IRQ, serial_hds[0], serial_hds[1]);