aboutsummaryrefslogtreecommitdiff
path: root/hw/display/tcx.c
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2013-11-02 16:03:50 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2013-11-21 17:38:52 +0100
commitda87dd7bd70f71ceaf9ff40d7cdb8394a7dc4bf5 (patch)
tree3e28a240cb48ad8e6f19f99821bc18f6b10d0ef5 /hw/display/tcx.c
parent394cfa39ba24dd838ace1308ae24961243947fb8 (diff)
sun4m: Add FCode ROM for TCX framebuffer
Upstream OpenBIOS now implements SBus probing in order to determine the contents of a physical bus slot, which is required to allow OpenBIOS to identify the framebuffer without help from the fw_cfg interface. SBus probing works by detecting the presence of an FCode program (effectively tokenised Forth) at the base address of each slot, and if present executes it so that it creates its own device node in the OpenBIOS device tree. The FCode ROM is generated as part of the OpenBIOS build and should generally be updated at the same time. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> CC: Blue Swirl <blauwirbel@gmail.com> CC: Bob Breuer <breuerr@mc.net> CC: Artyom Tarasenko <atar4qemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/display/tcx.c')
-rw-r--r--hw/display/tcx.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index 24876d33ef..873b82c8db 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -25,8 +25,12 @@
#include "qemu-common.h"
#include "ui/console.h"
#include "ui/pixel_ops.h"
+#include "hw/loader.h"
#include "hw/sysbus.h"
+#define TCX_ROM_FILE "QEMU,tcx.bin"
+#define FCODE_MAX_ROM_SIZE 0x10000
+
#define MAXX 1024
#define MAXY 768
#define TCX_DAC_NREGS 16
@@ -43,6 +47,8 @@ typedef struct TCXState {
QemuConsole *con;
uint8_t *vram;
uint32_t *vram24, *cplane;
+ hwaddr prom_addr;
+ MemoryRegion rom;
MemoryRegion vram_mem;
MemoryRegion vram_8bit;
MemoryRegion vram_24bit;
@@ -529,14 +535,31 @@ static int tcx_init1(SysBusDevice *dev)
{
TCXState *s = TCX(dev);
ram_addr_t vram_offset = 0;
- int size;
+ int size, ret;
uint8_t *vram_base;
+ char *fcode_filename;
memory_region_init_ram(&s->vram_mem, OBJECT(s), "tcx.vram",
s->vram_size * (1 + 4 + 4));
vmstate_register_ram_global(&s->vram_mem);
vram_base = memory_region_get_ram_ptr(&s->vram_mem);
+ /* FCode ROM */
+ memory_region_init_ram(&s->rom, NULL, "tcx.prom", FCODE_MAX_ROM_SIZE);
+ vmstate_register_ram_global(&s->rom);
+ memory_region_set_readonly(&s->rom, true);
+ sysbus_init_mmio(dev, &s->rom);
+
+ fcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, TCX_ROM_FILE);
+ if (fcode_filename) {
+ ret = load_image_targphys(fcode_filename, s->prom_addr,
+ FCODE_MAX_ROM_SIZE);
+ if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
+ fprintf(stderr, "tcx: could not load prom '%s'\n", TCX_ROM_FILE);
+ return -1;
+ }
+ }
+
/* 8-bit plane */
s->vram = vram_base;
size = s->vram_size;
@@ -598,6 +621,7 @@ static Property tcx_properties[] = {
DEFINE_PROP_UINT16("width", TCXState, width, -1),
DEFINE_PROP_UINT16("height", TCXState, height, -1),
DEFINE_PROP_UINT16("depth", TCXState, depth, -1),
+ DEFINE_PROP_HEX64("prom_addr", TCXState, prom_addr, -1),
DEFINE_PROP_END_OF_LIST(),
};