X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=hw%2Fsun4m.c;h=9b6aae53c8e373ec889ae9cdc7129f70dd2d37f7;hb=4de9b249d37c1b382cc3e5a21fad1b4a11cec2fa;hp=b41ee25828f699990b912d95222a06e5a0dff84e;hpb=a41b2ff2ddd0ba05ac2ca1bb657603b1d09dc9bc;p=qemu diff --git a/hw/sun4m.c b/hw/sun4m.c index b41ee25..9b6aae5 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -26,9 +26,9 @@ #define KERNEL_LOAD_ADDR 0x00004000 #define CMDLINE_ADDR 0x007ff000 #define INITRD_LOAD_ADDR 0x00800000 +#define PROM_SIZE_MAX (256 * 1024) #define PROM_ADDR 0xffd00000 -#define PROM_FILENAMEB "proll.bin" -#define PROM_FILENAMEE "proll.elf" +#define PROM_FILENAME "openbios-sparc32" #define PHYS_JJ_EEPROM 0x71200000 /* m48t08 */ #define PHYS_JJ_IDPROM_OFF 0x1FD8 #define PHYS_JJ_EEPROM_SIZE 0x2000 @@ -37,10 +37,9 @@ #define PHYS_JJ_IOMMU 0x10000000 /* I/O MMU */ #define PHYS_JJ_TCX_FB 0x50000000 /* TCX frame buffer */ #define PHYS_JJ_SLAVIO 0x70000000 /* Slavio base */ -#define PHYS_JJ_ESPDMA 0x78400000 /* ESP DMA controller */ +#define PHYS_JJ_DMA 0x78400000 /* DMA controller */ #define PHYS_JJ_ESP 0x78800000 /* ESP SCSI */ #define PHYS_JJ_ESP_IRQ 18 -#define PHYS_JJ_LEDMA 0x78400010 /* Lance DMA controller */ #define PHYS_JJ_LE 0x78C00000 /* Lance ethernet */ #define PHYS_JJ_LE_IRQ 16 #define PHYS_JJ_CLOCK 0x71D00000 /* Per-CPU timer/counter, L14 */ @@ -56,6 +55,9 @@ #define PHYS_JJ_FDC 0x71400000 /* Floppy */ #define PHYS_JJ_FLOPPY_IRQ 22 #define PHYS_JJ_ME_IRQ 30 /* Module error, power fail */ +#define PHYS_JJ_CS 0x6c000000 /* Crystal CS4231 */ +#define PHYS_JJ_CS_IRQ 5 + #define MAX_CPUS 16 /* TSC handling */ @@ -182,33 +184,14 @@ void pic_set_irq(int irq, int level) slavio_pic_set_irq(slavio_intctl, irq, level); } -void pic_set_irq_cpu(int irq, int level, unsigned int cpu) -{ - slavio_pic_set_irq_cpu(slavio_intctl, irq, level, cpu); -} - -static void *tcx; - -void vga_update_display() -{ - tcx_update_display(tcx); -} - -void vga_invalidate_display() -{ - tcx_invalidate_display(tcx); -} - -void vga_screen_dump(const char *filename) +void pic_set_irq_new(void *opaque, int irq, int level) { - tcx_screen_dump(tcx, filename); + pic_set_irq(irq, level); } -static void *iommu; - -uint32_t iommu_translate(uint32_t addr) +void pic_set_irq_cpu(int irq, int level, unsigned int cpu) { - return iommu_translate_local(iommu, addr); + slavio_pic_set_irq_cpu(slavio_intctl, irq, level, cpu); } static void *slavio_misc; @@ -235,6 +218,7 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device, int ret, linux_boot; unsigned int i; long vram_size = 0x100000, prom_offset, initrd_size, kernel_size; + void *iommu, *dma, *main_esp, *main_lance = NULL; linux_boot = (kernel_filename != NULL); @@ -255,12 +239,13 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device, for(i = 0; i < smp_cpus; i++) { slavio_intctl_set_cpu(slavio_intctl, i, envs[i]); } + dma = sparc32_dma_init(PHYS_JJ_DMA, PHYS_JJ_ESP_IRQ, PHYS_JJ_LE_IRQ, iommu, slavio_intctl); - tcx = tcx_init(ds, PHYS_JJ_TCX_FB, phys_ram_base + ram_size, ram_size, vram_size, graphic_width, graphic_height); + tcx_init(ds, PHYS_JJ_TCX_FB, phys_ram_base + ram_size, ram_size, vram_size, graphic_width, graphic_height); if (nd_table[0].vlan) { if (nd_table[0].model == NULL || strcmp(nd_table[0].model, "lance") == 0) { - lance_init(&nd_table[0], PHYS_JJ_LE_IRQ, PHYS_JJ_LE, PHYS_JJ_LEDMA); + main_lance = lance_init(&nd_table[0], PHYS_JJ_LE, dma); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); exit (1); @@ -276,28 +261,34 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device, // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device slavio_serial_init(PHYS_JJ_SER, PHYS_JJ_SER_IRQ, serial_hds[1], serial_hds[0]); fdctrl_init(PHYS_JJ_FLOPPY_IRQ, 0, 1, PHYS_JJ_FDC, fd_table); - esp_init(bs_table, PHYS_JJ_ESP_IRQ, PHYS_JJ_ESP, PHYS_JJ_ESPDMA); + main_esp = esp_init(bs_table, PHYS_JJ_ESP, dma); + + for (i = 0; i < MAX_DISKS; i++) { + if (bs_table[i]) { + esp_scsi_attach(main_esp, bs_table[i], i); + } + } + slavio_misc = slavio_misc_init(PHYS_JJ_SLAVIO, PHYS_JJ_ME_IRQ); + cs_init(PHYS_JJ_CS, PHYS_JJ_CS_IRQ, slavio_intctl); + sparc32_dma_set_reset_data(dma, main_esp, main_lance); prom_offset = ram_size + vram_size; + cpu_register_physical_memory(PROM_ADDR, + (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK, + prom_offset | IO_MEM_ROM); - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAMEE); - ret = load_elf(buf, phys_ram_base + prom_offset); - if (ret < 0) { - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAMEB); - ret = load_image(buf, phys_ram_base + prom_offset); - } + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME); + ret = load_elf(buf, 0, NULL); if (ret < 0) { fprintf(stderr, "qemu: could not load prom '%s'\n", buf); exit(1); } - cpu_register_physical_memory(PROM_ADDR, (ret + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK, - prom_offset | IO_MEM_ROM); kernel_size = 0; if (linux_boot) { - kernel_size = load_elf(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR); + kernel_size = load_elf(kernel_filename, -0xf0000000, NULL); if (kernel_size < 0) kernel_size = load_aout(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR); if (kernel_size < 0)