summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--hw/mips_r4k.c2
-rw-r--r--hw/pc.c2
-rw-r--r--hw/ppc_chrp.c51
-rw-r--r--hw/vga.c21
-rw-r--r--hw/vga_int.h2
-rw-r--r--pc-bios/video.xbin0 -> 12192 bytes
-rw-r--r--vl.h5
8 files changed, 65 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 11b38d15f1..74b1a94eb9 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ install: all
mkdir -p "$(datadir)"
install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
pc-bios/vgabios-cirrus.bin \
- pc-bios/ppc_rom.bin \
+ pc-bios/ppc_rom.bin pc-bios/video.x \
pc-bios/proll.elf \
pc-bios/linux_boot.bin "$(datadir)"
mkdir -p "$(docdir)"
@@ -121,6 +121,7 @@ tarbin:
$(datadir)/vgabios.bin \
$(datadir)/vgabios-cirrus.bin \
$(datadir)/ppc_rom.bin \
+ $(datadir)/video.x \
$(datadir)/proll.elf \
$(datadir)/linux_boot.bin \
$(docdir)/qemu-doc.html \
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 9ce4a5ac94..ca135ac39b 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -242,7 +242,7 @@ void mips_r4k_init (int ram_size, int vga_ram_size, int boot_device,
isa_pic = pic_init(pic_irq_request, cpu_single_env);
serial_init(0x3f8, 4, serial_hds[0]);
vga_initialize(NULL, ds, phys_ram_base + ram_size, ram_size,
- vga_ram_size);
+ vga_ram_size, 0, 0);
isa_ne2000_init(0x300, 9, &nd_table[0]);
}
diff --git a/hw/pc.c b/hw/pc.c
index 696c9192c9..29037db7b5 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -547,7 +547,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
}
} else {
vga_initialize(pci_bus, ds, phys_ram_base + ram_size, ram_size,
- vga_ram_size);
+ vga_ram_size, 0, 0);
}
rtc_state = rtc_init(0x70, 8);
diff --git a/hw/ppc_chrp.c b/hw/ppc_chrp.c
index 515806fbb5..5d20333d73 100644
--- a/hw/ppc_chrp.c
+++ b/hw/ppc_chrp.c
@@ -24,6 +24,7 @@
#include "vl.h"
#define BIOS_FILENAME "ppc_rom.bin"
+#define VGABIOS_FILENAME "video.x"
#define NVRAM_SIZE 0x2000
#define KERNEL_LOAD_ADDR 0x01000000
@@ -232,12 +233,13 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
void *pic;
m48t59_t *nvram;
int PPC_io_memory, unin_memory;
- int ret, linux_boot, i;
- unsigned long bios_offset;
+ int linux_boot, i;
+ unsigned long bios_offset, vga_bios_offset;
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
ppc_def_t *def;
PCIBus *pci_bus;
const char *arch_name;
+ int vga_bios_size, bios_size;
linux_boot = (kernel_filename != NULL);
@@ -247,15 +249,36 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
/* allocate and load BIOS */
bios_offset = ram_size + vga_ram_size;
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
- ret = load_image(buf, phys_ram_base + bios_offset);
- if (ret != BIOS_SIZE) {
- fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", buf);
+ bios_size = load_image(buf, phys_ram_base + bios_offset);
+ if (bios_size < 0 || bios_size > BIOS_SIZE) {
+ fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf);
exit(1);
}
- cpu_register_physical_memory((uint32_t)(-BIOS_SIZE),
- BIOS_SIZE, bios_offset | IO_MEM_ROM);
- cpu_single_env->nip = 0xfffffffc;
-
+ bios_size = (bios_size + 0xfff) & ~0xfff;
+ cpu_register_physical_memory((uint32_t)(-bios_size),
+ bios_size, bios_offset | IO_MEM_ROM);
+
+ /* allocate and load VGA BIOS */
+ vga_bios_offset = bios_offset + bios_size;
+ snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
+ vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8);
+ if (vga_bios_size < 0) {
+ /* if no bios is present, we can still work */
+ fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf);
+ vga_bios_size = 0;
+ } else {
+ /* set a specific header (XXX: find real Apple format for NDRV
+ drivers) */
+ phys_ram_base[vga_bios_offset] = 'N';
+ phys_ram_base[vga_bios_offset + 1] = 'D';
+ phys_ram_base[vga_bios_offset + 2] = 'R';
+ phys_ram_base[vga_bios_offset + 3] = 'V';
+ cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4),
+ vga_bios_size);
+ vga_bios_size += 8;
+ }
+ vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff;
+
if (linux_boot) {
kernel_base = KERNEL_LOAD_ADDR;
/* now we can load the kernel */
@@ -321,8 +344,9 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
cpu_register_physical_memory(0xfe000000, 0x00200000, PPC_io_memory);
/* init basic PC hardware */
- vga_initialize(pci_bus, ds, phys_ram_base + ram_size, ram_size,
- vga_ram_size);
+ vga_initialize(pci_bus, ds, phys_ram_base + ram_size,
+ ram_size, vga_ram_size,
+ vga_bios_offset, vga_bios_size);
pic = heathrow_pic_init(&heathrow_pic_mem_index);
set_irq = heathrow_pic_set_irq;
pci_set_pic(pci_bus, set_irq, pic);
@@ -363,8 +387,9 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
cpu_register_physical_memory(0xf8000000, 0x00001000, unin_memory);
/* init basic PC hardware */
- vga_initialize(pci_bus, ds, phys_ram_base + ram_size, ram_size,
- vga_ram_size);
+ vga_initialize(pci_bus, ds, phys_ram_base + ram_size,
+ ram_size, vga_ram_size,
+ vga_bios_offset, vga_bios_size);
pic = openpic_init(NULL, &openpic_mem_index, 1);
set_irq = openpic_set_irq;
pci_set_pic(pci_bus, set_irq, pic);
diff --git a/hw/vga.c b/hw/vga.c
index 2c425ffe9b..49e5b211f9 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1654,8 +1654,11 @@ static void vga_map(PCIDevice *pci_dev, int region_num,
uint32_t addr, uint32_t size, int type)
{
VGAState *s = vga_state;
-
- cpu_register_physical_memory(addr, s->vram_size, s->vram_offset);
+ if (region_num == PCI_ROM_SLOT) {
+ cpu_register_physical_memory(addr, s->bios_size, s->bios_offset);
+ } else {
+ cpu_register_physical_memory(addr, s->vram_size, s->vram_offset);
+ }
}
void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
@@ -1701,7 +1704,8 @@ void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
int vga_initialize(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
- unsigned long vga_ram_offset, int vga_ram_size)
+ unsigned long vga_ram_offset, int vga_ram_size,
+ unsigned long vga_bios_offset, int vga_bios_size)
{
VGAState *s;
@@ -1776,6 +1780,17 @@ int vga_initialize(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
/* XXX: vga_ram_size must be a power of two */
pci_register_io_region(d, 0, vga_ram_size,
PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
+ if (vga_bios_size != 0) {
+ unsigned int bios_total_size;
+ s->bios_offset = vga_bios_offset;
+ s->bios_size = vga_bios_size;
+ /* must be a power of two */
+ bios_total_size = 1;
+ while (bios_total_size < vga_bios_size)
+ bios_total_size <<= 1;
+ pci_register_io_region(d, PCI_ROM_SLOT, bios_total_size,
+ PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
+ }
} else {
#ifdef CONFIG_BOCHS_VBE
/* XXX: use optimized standard vga accesses */
diff --git a/hw/vga_int.h b/hw/vga_int.h
index 2e7fb30efb..621268de4c 100644
--- a/hw/vga_int.h
+++ b/hw/vga_int.h
@@ -78,6 +78,8 @@
uint8_t *vram_ptr; \
unsigned long vram_offset; \
unsigned int vram_size; \
+ unsigned long bios_offset; \
+ unsigned int bios_size; \
uint32_t latch; \
uint8_t sr_index; \
uint8_t sr[256]; \
diff --git a/pc-bios/video.x b/pc-bios/video.x
new file mode 100644
index 0000000000..761aa0c9d4
--- /dev/null
+++ b/pc-bios/video.x
Binary files differ
diff --git a/vl.h b/vl.h
index 6f6aba75b8..85d0cf4733 100644
--- a/vl.h
+++ b/vl.h
@@ -137,7 +137,7 @@ extern int win2k_install_hack;
/* XXX: make it dynamic */
#if defined (TARGET_PPC)
-#define BIOS_SIZE (512 * 1024)
+#define BIOS_SIZE ((512 + 32) * 1024)
#elif defined(TARGET_MIPS)
#define BIOS_SIZE (128 * 1024)
#else
@@ -596,7 +596,8 @@ static inline void dpy_resize(DisplayState *s, int w, int h)
}
int vga_initialize(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
- unsigned long vga_ram_offset, int vga_ram_size);
+ unsigned long vga_ram_offset, int vga_ram_size,
+ unsigned long vga_bios_offset, int vga_bios_size);
void vga_update_display(void);
void vga_invalidate_display(void);
void vga_screen_dump(const char *filename);