aboutsummaryrefslogtreecommitdiff
path: root/hw/m68k
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2021-10-07 23:12:49 +0100
committerLaurent Vivier <laurent@vivier.eu>2021-10-08 13:31:03 +0200
commitdf8abbbadf743bef6be5543b26f51231285b8923 (patch)
tree465d528aa19546cdbca56ebd877c83d58605b881 /hw/m68k
parent4317c518618adcd5d41637c849be17e94cecf003 (diff)
downloadqemu-df8abbbadf743bef6be5543b26f51231285b8923.zip
qemu-df8abbbadf743bef6be5543b26f51231285b8923.tar.gz
qemu-df8abbbadf743bef6be5543b26f51231285b8923.tar.bz2
macfb: add common monitor modes supported by the MacOS toolbox ROM
The monitor modes table is found by experimenting with the Monitors Control Panel in MacOS and analysing the reads/writes. From this it can be found that the mode is controlled by writes to the DAFB_MODE_CTRL1 and DAFB_MODE_CTRL2 registers. Implement the first block of DAFB registers as a register array including the existing sense register, the newly discovered control registers above, and also the DAFB_MODE_VADDR1 and DAFB_MODE_VADDR2 registers which are used by NetBSD to determine the current video mode. These experiments also show that the offset of the start of video RAM and the stride can change depending upon the monitor mode, so update macfb_draw_graphic() and both the BI_MAC_VADDR and BI_MAC_VROW bootinfo for the q800 machine accordingly. Finally update macfb_common_realize() so that only the resolution and depth supported by the display type can be specified on the command line, and add an error hint showing the list of supported resolutions and depths if the user tries to specify an invalid display mode. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20211007221253.29024-10-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/m68k')
-rw-r--r--hw/m68k/q800.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 5223b88..df3fd37 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -74,7 +74,7 @@
* is needed by the kernel to have early display and
* thus provided by the bootloader
*/
-#define VIDEO_BASE 0xf9001000
+#define VIDEO_BASE 0xf9000000
#define MAC_CLOCK 3686418
@@ -221,6 +221,7 @@ static void q800_init(MachineState *machine)
uint8_t *prom;
const int io_slice_nb = (IO_SIZE / IO_SLICE) - 1;
int i, checksum;
+ MacFbMode *macfb_mode;
ram_addr_t ram_size = machine->ram_size;
const char *kernel_filename = machine->kernel_filename;
const char *initrd_filename = machine->initrd_filename;
@@ -428,6 +429,8 @@ static void q800_init(MachineState *machine)
}
qdev_realize_and_unref(dev, BUS(nubus), &error_fatal);
+ macfb_mode = (NUBUS_MACFB(dev)->macfb).mode;
+
cs = CPU(cpu);
if (linux_boot) {
uint64_t high;
@@ -450,12 +453,12 @@ static void q800_init(MachineState *machine)
BOOTINFO1(cs->as, parameters_base,
BI_MAC_MEMSIZE, ram_size >> 20); /* in MB */
BOOTINFO2(cs->as, parameters_base, BI_MEMCHUNK, 0, ram_size);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_VADDR, VIDEO_BASE);
+ BOOTINFO1(cs->as, parameters_base, BI_MAC_VADDR,
+ VIDEO_BASE + macfb_mode->offset);
BOOTINFO1(cs->as, parameters_base, BI_MAC_VDEPTH, graphic_depth);
BOOTINFO1(cs->as, parameters_base, BI_MAC_VDIM,
(graphic_height << 16) | graphic_width);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_VROW,
- (graphic_width * graphic_depth + 7) / 8);
+ BOOTINFO1(cs->as, parameters_base, BI_MAC_VROW, macfb_mode->stride);
BOOTINFO1(cs->as, parameters_base, BI_MAC_SCCBASE, SCC_BASE);
rom = g_malloc(sizeof(*rom));