Skip to contentSkip to conversation

Q800 branch patches

GIT PULL In review Laurent Vivier 8 participants 27 messages Oct 28, 2019 – Nov 7, 2019

lore
Share & tools
lore
#0 lore raw

The following changes since commit 7bc8f9734213b76e76631a483be13d6737c2adbc:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20191025' into staging (2019-10-25 13:12:16 +0100)

are available in the Git repository at:

git://github.com/vivier/qemu-m68k.git tags/q800-branch-pull-request

for you to fetch changes up to f7d85525f14b99aaa7bf561c9f3cf11c85a080c9:

BootLinuxConsoleTest: Test the Quadra 800 (2019-10-28 19:07:22 +0100)

----------------------------------------------------------------
Add Macintosh Quadra 800 machine in hw/m68k

----------------------------------------------------------------

Laurent Vivier (10):
esp: move handle_ti_cmd() cleanup code to esp_do_dma().
esp: move get_cmd() post-DMA code to get_cmd_cb()
esp: add pseudo-DMA as used by Macintosh
dp8393x: manage big endian bus
hw/m68k: add VIA support
hw/m68k: implement ADB bus support for via hw/m68k: add Nubus support
hw/m68k: add Nubus macfb video card
hw/m68k: add a dummy SWIM floppy controller hw/m68k: define Macintosh Quadra 800

Philippe Mathieu-Daudé (1):
BootLinuxConsoleTest: Test the Quadra 800

 default-configs/m68k-softmmu.mak       |   1 +
 hw/m68k/bootinfo.h                     | 114 +++
 include/hw/block/swim.h                |  76 ++
 include/hw/display/macfb.h             |  64 ++
 include/hw/misc/mac_via.h              | 115 +++
 include/hw/nubus/mac-nubus-bridge.h    |  24 +
 include/hw/nubus/nubus.h               |  69 ++
 include/hw/scsi/esp.h                  |  15 +
 arch_init.c                            |   4 +
 hw/block/swim.c                        | 489 +++++++++++++
 hw/display/macfb.c                     | 477 ++++++++++++
 hw/m68k/q800.c                         | 401 ++++++++++
 hw/misc/mac_via.c                      | 964 +++++++++++++++++++++++++
 hw/net/dp8393x.c                       |  88 ++-
 hw/nubus/mac-nubus-bridge.c            |  45 ++
 hw/nubus/nubus-bridge.c                |  34 +
 hw/nubus/nubus-bus.c                   | 111 +++
 hw/nubus/nubus-device.c                | 215 ++++++
 hw/scsi/esp.c                          | 336 ++++++++-
 vl.c                                   |   3 +-
 MAINTAINERS                            |  14 +
 hw/Kconfig                             |   1 +
 hw/Makefile.objs                       |   1 +
 hw/block/Kconfig                       |   3 +
 hw/block/Makefile.objs                 |   1 +
 hw/display/Kconfig                     |   5 +
 hw/display/Makefile.objs               |   1 +
 hw/m68k/Kconfig                        |  10 +
 hw/m68k/Makefile.objs                  |   1 +
 hw/misc/Kconfig                        |   5 +
 hw/misc/Makefile.objs                  |   1 +
 hw/nubus/Kconfig                       |   2 +
 hw/nubus/Makefile.objs                 |   4 +
 qemu-options.hx                        |   2 +-
 tests/acceptance/boot_linux_console.py |  24 +
 35 files changed, 3659 insertions(+), 61 deletions(-)
 create mode 100644 hw/m68k/bootinfo.h
 create mode 100644 include/hw/block/swim.h
 create mode 100644 include/hw/display/macfb.h
 create mode 100644 include/hw/misc/mac_via.h
 create mode 100644 include/hw/nubus/mac-nubus-bridge.h
 create mode 100644 include/hw/nubus/nubus.h
 create mode 100644 hw/block/swim.c
 create mode 100644 hw/display/macfb.c
 create mode 100644 hw/m68k/q800.c
 create mode 100644 hw/misc/mac_via.c
 create mode 100644 hw/nubus/mac-nubus-bridge.c
 create mode 100644 hw/nubus/nubus-bridge.c
 create mode 100644 hw/nubus/nubus-bus.c
 create mode 100644 hw/nubus/nubus-device.c
 create mode 100644 hw/nubus/Kconfig
 create mode 100644 hw/nubus/Makefile.objs
Signature · 1 line
2.21.0
#1 lore raw

[PULL 02/11] esp: move get_cmd() post-DMA code to get_cmd_cb()

This will be needed to implement pseudo-DMA

Message-Id: <[email protected]>

---
 hw/scsi/esp.c | 46 +++++++++++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 17 deletions(-)
hw/scsi/esp.c +29 -17
index 09b28cba17..0230ede21d 100644
@@ -84,6 +84,34 @@ void esp_request_cancelled(SCSIRequest *req)
     }
 }
 
+static int get_cmd_cb(ESPState *s)
+{
+    int target;
+
+    target = s->wregs[ESP_WBUSID] & BUSID_DID;
+
+    s->ti_size = 0;
+    s->ti_rptr = 0;
+    s->ti_wptr = 0;
+
+    if (s->current_req) {
+        /* Started a new command before the old one finished.  Cancel it.  */
+        scsi_req_cancel(s->current_req);
+        s->async_len = 0;
+    }
+
+    s->current_dev = scsi_device_find(&s->bus, 0, target, 0);
+    if (!s->current_dev) {
+        /* No such drive */
+        s->rregs[ESP_RSTAT] = 0;
+        s->rregs[ESP_RINTR] = INTR_DC;
+        s->rregs[ESP_RSEQ] = SEQ_0;
+        esp_raise_irq(s);
+        return -1;
+    }
+    return 0;
+}
+
 static uint32_t get_cmd(ESPState *s, uint8_t *buf, uint8_t buflen)
 {
     uint32_t dmalen;
@@ -108,23 +136,7 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf, uint8_t buflen)
     }
     trace_esp_get_cmd(dmalen, target);
 
-    s->ti_size = 0;
-    s->ti_rptr = 0;
-    s->ti_wptr = 0;
-
-    if (s->current_req) {
-        /* Started a new command before the old one finished.  Cancel it.  */
-        scsi_req_cancel(s->current_req);
-        s->async_len = 0;
-    }
-
-    s->current_dev = scsi_device_find(&s->bus, 0, target, 0);
-    if (!s->current_dev) {
-        // No such drive
-        s->rregs[ESP_RSTAT] = 0;
-        s->rregs[ESP_RINTR] = INTR_DC;
-        s->rregs[ESP_RSEQ] = SEQ_0;
-        esp_raise_irq(s);
+    if (get_cmd_cb(s) < 0) {
         return 0;
     }
     return dmalen;
Signature · 1 line
2.21.0
#2 lore raw

[PULL 06/11] hw/m68k: implement ADB bus support for via

In reply to Laurent Vivier

VIA needs to be able to poll the ADB interface and to read/write data from/to the bus.

This patch adds functions allowing that.

Message-Id: <[email protected]>

---
 include/hw/misc/mac_via.h |   7 ++
 hw/misc/mac_via.c         | 197 ++++++++++++++++++++++++++++++++++++++
 hw/misc/Kconfig           |   1 +
 3 files changed, 205 insertions(+)
include/hw/misc/mac_via.h +7 -0
index efc8ef3ce3..3f86fcb7e1 100644
@@ -103,6 +103,13 @@ typedef struct MacVIAState {
 
     /* ADB */
     ADBBusState adb_bus;
+    QEMUTimer *adb_poll_timer;
+    qemu_irq adb_data_ready;
+    int adb_data_in_size;
+    int adb_data_in_index;
+    int adb_data_out_index;
+    uint8_t adb_data_in[128];
+    uint8_t adb_data_out[16];
 } MacVIAState;
 
 #endif
hw/misc/mac_via.c +197 -0

237 lines not on this page · raw message

hw/misc/Kconfig +1 -0
index 18a5dc9c09..2164646553 100644
@@ -123,5 +123,6 @@ config UNIMP
 config MAC_VIA
     bool
     select MOS6522
+    select ADB
 
 source macio/Kconfig
Signature · 1 line
2.21.0
#3 lore raw

[PULL 09/11] hw/m68k: add a dummy SWIM floppy controller

In reply to Laurent Vivier

SWIM (Sander-Wozniak Integrated Machine) is the floppy controller of the 680x0 Macintosh.

This patch introduces only the basic support: it allows to switch from IWM (Integrated WOZ Machine) mode to the SWIM mode and makes the linux driver happy.

It cannot read any floppy image.

Message-Id: <[email protected]>

---
 include/hw/block/swim.h |  76 +++++++
 hw/block/swim.c         | 489 ++++++++++++++++++++++++++++++++++++++++
 MAINTAINERS             |   2 +
 hw/block/Kconfig        |   3 +
 hw/block/Makefile.objs  |   1 +
 hw/m68k/Kconfig         |   1 +
 6 files changed, 572 insertions(+)
 create mode 100644 include/hw/block/swim.h
 create mode 100644 hw/block/swim.c
include/hw/block/swim.h new file +76 -0
new file mode 100644
index 0000000000..6add3499d0
@@ -0,0 +1,76 @@
+/*
+ * QEMU Macintosh floppy disk controller emulator (SWIM)
+ *
+ * Copyright (c) 2014-2018 Laurent Vivier <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef SWIM_H
+#define SWIM_H
+
+#include "qemu/osdep.h"
+#include "hw/sysbus.h"
+
+#define SWIM_MAX_FD            2
+
+typedef struct SWIMDrive SWIMDrive;
+typedef struct SWIMBus SWIMBus;
+typedef struct SWIMCtrl SWIMCtrl;
+
+#define TYPE_SWIM_DRIVE "swim-drive"
+#define SWIM_DRIVE(obj) OBJECT_CHECK(SWIMDrive, (obj), TYPE_SWIM_DRIVE)
+
+struct SWIMDrive {
+    DeviceState qdev;
+    int32_t     unit;
+    BlockConf   conf;
+};
+
+#define TYPE_SWIM_BUS "swim-bus"
+#define SWIM_BUS(obj) OBJECT_CHECK(SWIMBus, (obj), TYPE_SWIM_BUS)
+
+struct SWIMBus {
+    BusState bus;
+    struct SWIMCtrl *ctrl;
+};
+
+typedef struct FDrive {
+    SWIMCtrl *swimctrl;
+    BlockBackend *blk;
+    BlockConf *conf;
+} FDrive;
+
+struct SWIMCtrl {
+    MemoryRegion iomem;
+    FDrive drives[SWIM_MAX_FD];
+    int mode;
+    /* IWM mode */
+    int iwm_switch;
+    uint16_t regs[8];
+#define IWM_PH0   0
+#define IWM_PH1   1
+#define IWM_PH2   2
+#define IWM_PH3   3
+#define IWM_MTR   4
+#define IWM_DRIVE 5
+#define IWM_Q6    6
+#define IWM_Q7    7
+    uint8_t iwm_data;
+    uint8_t iwm_mode;
+    /* SWIM mode */
+    uint8_t swim_phase;
+    uint8_t swim_mode;
+    SWIMBus bus;
+};
+
+#define TYPE_SWIM "swim"
+#define SWIM(obj) OBJECT_CHECK(SWIM, (obj), TYPE_SWIM)
+
+typedef struct SWIM {
+    SysBusDevice parent_obj;
+    SWIMCtrl     ctrl;
+} SWIM;
+#endif
hw/block/swim.c new file +489 -0

489 lines not on this page · raw message

MAINTAINERS +2 -0
index bd0df67e62..7f806eb1b2 100644
@@ -923,9 +923,11 @@ S: Maintained
 F: hw/misc/mac_via.c
 F: hw/nubus/*
 F: hw/display/macfb.c
+F: hw/block/swim.c
 F: include/hw/misc/mac_via.h
 F: include/hw/nubus/*
 F: include/hw/display/macfb.h
+F: include/hw/block/swim.h
 
 MicroBlaze Machines
 -------------------
hw/block/Kconfig +3 -0
index df96dc5dcc..2d17f481ad 100644
@@ -37,3 +37,6 @@ config VHOST_USER_BLK
     # Only PCI devices are provided for now
     default y if VIRTIO_PCI
     depends on VIRTIO && VHOST_USER && LINUX
+
+config SWIM
+    bool
hw/block/Makefile.objs +1 -0
index f5f643f0cc..28c2495a00 100644
@@ -8,6 +8,7 @@ common-obj-$(CONFIG_XEN) += xen-block.o
 common-obj-$(CONFIG_ECC) += ecc.o
 common-obj-$(CONFIG_ONENAND) += onenand.o
 common-obj-$(CONFIG_NVME_PCI) += nvme.o
+common-obj-$(CONFIG_SWIM) += swim.o
 
 obj-$(CONFIG_SH4) += tc58128.o
 
hw/m68k/Kconfig +1 -0
index ef4917dee6..bab4885ca5 100644
@@ -18,3 +18,4 @@ config Q800
     select MAC_VIA
     select NUBUS
     select MACFB
+    select SWIM
Signature · 1 line
2.21.0
#4 lore raw

[PULL 11/11] BootLinuxConsoleTest: Test the Quadra 800

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

This test boots a Linux kernel on a Quadra 800 board and verify the serial is working.

Example:

  $ avocado --show=app,console run -t machine:q800 tests/acceptance/boot_linux_console.py
  console: ABCFGHIJK
  console: Linux version 5.2.0-2-m68k ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-21)) #1 Debian 5.2.9-2 (2019-08-21)
  console: Detected Macintosh model: 35
  console: Apple Macintosh Quadra 800
  console: Built 1 zonelists, mobility grouping on.  Total pages: 32448
  console: Kernel command line: printk.time=0 console=ttyS0 vga=off
  [...]
  console: Calibrating delay loop... 1236.99 BogoMIPS (lpj=6184960)
  [...]
  console: NuBus: Scanning NuBus slots.
  console: Slot 9: Board resource not found!
  console: SCSI subsystem initialized
  console: clocksource: Switched to clocksource via1
  [...]
  console: macfb: framebuffer at 0xf9001000, mapped to 0x(ptrval), size 468k
  console: macfb: mode is 800x600x8, linelength=800
  console: Console: switching to colour frame buffer device 100x37
  console: fb0: DAFB frame buffer device
  console: pmac_zilog: 0.6 (Benjamin Herrenschmidt <[email protected]>)
  console: scc.0: ttyS0 at MMIO 0x50f0c022 (irq = 4, base_baud = 230400) is a Z85c30 ESCC - Serial port
  console: scc.1: ttyS1 at MMIO 0x50f0c020 (irq = 4, base_baud = 230400) is a Z85c30 ESCC - Serial port
  console: Non-volatile memory driver v1.3
  console: adb: Mac II ADB Driver v1.0 for Unified ADB
  console: mousedev: PS/2 mouse device common for all mice
  console: random: fast init done
  console: Detected ADB keyboard, type <unknown>.
  console: input: ADB keyboard as /devices/virtual/input/input0
  console: input: ADB mouse as /devices/virtual/input/input1
  console: rtc-generic rtc-generic: registered as rtc0
  console: ledtrig-cpu: registered to indicate activity on CPUs
  [...]
  console: rtc-generic rtc-generic: setting system clock to 2019-09-10T16:20:25 UTC (1568132425)
  console: List of all partitions:
  console: No filesystem could mount root, tried:
  JOB TIME   : 2.91 s

Message-Id: <[email protected]>

Message-Id: <[email protected]>

---
 tests/acceptance/boot_linux_console.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
tests/acceptance/boot_linux_console.py +24 -0
index 8a9a314ab4..df27813c78 100644
@@ -378,3 +378,27 @@ class BootLinuxConsole(Test):
         self.vm.launch()
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
+
+    def test_m68k_q800(self):
+        """
+        :avocado: tags=arch:m68k
+        :avocado: tags=machine:q800
+        """
+        deb_url = ('http://ftp.ports.debian.org/debian-ports/pool-m68k/main'
+                   '/l/linux/kernel-image-5.2.0-2-m68k-di_5.2.9-2_m68k.udeb')
+        deb_hash = '0797e05129595f22f3c0142db5e199769a723bf9'
+        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        kernel_path = self.extract_from_deb(deb_path,
+                                            '/boot/vmlinux-5.2.0-2-m68k')
+
+        self.vm.set_machine('q800')
+        self.vm.set_console()
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+                               'console=ttyS0 vga=off')
+        self.vm.add_args('-kernel', kernel_path,
+                         '-append', kernel_command_line)
+        self.vm.launch()
+        console_pattern = 'Kernel command line: %s' % kernel_command_line
+        self.wait_for_console_pattern(console_pattern)
+        console_pattern = 'No filesystem could mount root'
+        self.wait_for_console_pattern(console_pattern)
Signature · 1 line
2.21.0
#5 lore raw

cover Acceptance test: update kernel used on m68k/q800 test

The boot_linux_console.py:BootLinuxConsole.test_m68k_q800 was very recently merged, but between its last review and now, the Kernel package used went missing.

This updates the Kernel package, and protects the test from failing if it gets updated again.

Cleber Rosa (2):
Acceptance test: cancel test if m68k kernel packages goes missing Acceptance test: update kernel for m68k/q800 test

 tests/acceptance/boot_linux_console.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
2.21.0
#6 lore raw

PATCH 1/2 Acceptance test: cancel test if m68k kernel packages goes missing

The Linux kernel that is extracted from a Debian package for the q800 machine test is hosted on a "pool" location. AFAICT, it gets updated without too much ceremony, and I don't see any archival location that is stable enough.

For now, to avoid test errors, let's cancel the test if fetching the package fails.

---
 tests/acceptance/boot_linux_console.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/acceptance/boot_linux_console.py +4 -1
index df27813c78..c439fd90fc 100644
@@ -387,7 +387,10 @@ class BootLinuxConsole(Test):
         deb_url = ('http://ftp.ports.debian.org/debian-ports/pool-m68k/main'
                    '/l/linux/kernel-image-5.2.0-2-m68k-di_5.2.9-2_m68k.udeb')
         deb_hash = '0797e05129595f22f3c0142db5e199769a723bf9'
-        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        try:
+            deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        except OSError as exp:
+            self.cancel(exp)
         kernel_path = self.extract_from_deb(deb_path,
                                             '/boot/vmlinux-5.2.0-2-m68k')
 
Signature · 1 line
2.21.0
Reviewed-by on v1 1/2
#7 lore raw

Re: [PATCH 1/2] Acceptance test: cancel test if m68k kernel packages goes missing

Quoted 9 lines · Cleber Rosa

The Linux kernel that is extracted from a Debian package for the q800 machine test is hosted on a "pool" location. AFAICT, it gets updated without too much ceremony, and I don't see any archival location that is stable enough.

For now, to avoid test errors, let's cancel the test if fetching the package fails.

Quoted 9 lines
---
 tests/acceptance/boot_linux_console.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/acceptance/boot_linux_console.py +0 -0
index df27813c78..c439fd90fc 100644

tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 395

Quoted 10 lines
tests/acceptance/boot_linux_console.py +4 -1
@@ -387,7 +387,10 @@ class BootLinuxConsole(Test):
         deb_url = ('http://ftp.ports.debian.org/debian-ports/pool-m68k/main'
                    '/l/linux/kernel-image-5.2.0-2-m68k-di_5.2.9-2_m68k.udeb')
         deb_hash = '0797e05129595f22f3c0142db5e199769a723bf9'
-        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        try:
+            deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        except OSError as exp:
+            self.cancel(exp)
         kernel_path = self.extract_from_deb(deb_path,
                                             '/boot/vmlinux-5.2.0-2-m68k')

--
Alex Bennée

#8 lore raw

PATCH 2/2 Acceptance test: update kernel for m68k/q800 test

In reply to Cleber Rosa

There's an updated version of the Debian package containing the m68k Kernel.

Now, if the package gets updated again, the test won't fail, but will be canceled. A more permanent solution is certainly needed.

---
 tests/acceptance/boot_linux_console.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/acceptance/boot_linux_console.py +3 -3
index c439fd90fc..8f676d8e92 100644
@@ -385,14 +385,14 @@ class BootLinuxConsole(Test):
         :avocado: tags=machine:q800
         """
         deb_url = ('http://ftp.ports.debian.org/debian-ports/pool-m68k/main'
-                   '/l/linux/kernel-image-5.2.0-2-m68k-di_5.2.9-2_m68k.udeb')
-        deb_hash = '0797e05129595f22f3c0142db5e199769a723bf9'
+                   '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
+        deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'
         try:
             deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
         except OSError as exp:
             self.cancel(exp)
         kernel_path = self.extract_from_deb(deb_path,
-                                            '/boot/vmlinux-5.2.0-2-m68k')
+                                            '/boot/vmlinux-5.3.0-1-m68k')
 
         self.vm.set_machine('q800')
         self.vm.set_console()
Signature · 1 line
2.21.0
#9 lore raw

Re: [PATCH 2/2] Acceptance test: update kernel for m68k/q800 test

Quoted 5 lines · Cleber Rosa

There's an updated version of the Debian package containing the m68k Kernel.

Now, if the package gets updated again, the test won't fail, but will be canceled. A more permanent solution is certainly needed.

At least for open source blobs can't we do something similar to the firmware and host a blob mirror on our infrastructure as a fallback?

Quoted 18 lines
---
 tests/acceptance/boot_linux_console.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/acceptance/boot_linux_console.py +2 -2
index c439fd90fc..8f676d8e92 100644
@@ -385,14 +385,14 @@ class BootLinuxConsole(Test):
         :avocado: tags=machine:q800
         """
         deb_url = ('http://ftp.ports.debian.org/debian-ports/pool-m68k/main'
-                   '/l/linux/kernel-image-5.2.0-2-m68k-di_5.2.9-2_m68k.udeb')
-        deb_hash = '0797e05129595f22f3c0142db5e199769a723bf9'
+                   '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
+        deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'

tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 398

Quoted 10 lines
tests/acceptance/boot_linux_console.py +1 -1
         try:
             deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
         except OSError as exp:
             self.cancel(exp)
         kernel_path = self.extract_from_deb(deb_path,
-                                            '/boot/vmlinux-5.2.0-2-m68k')
+                                            '/boot/vmlinux-5.3.0-1-m68k')
 
         self.vm.set_machine('q800')
         self.vm.set_console()

--
Alex Bennée

#10 lore raw

Re: [PATCH 2/2] Acceptance test: update kernel for m68k/q800 test

Quoted 9 lines · Alex Bennée
Quoted 5 lines · Cleber Rosa

There's an updated version of the Debian package containing the m68k Kernel.

Now, if the package gets updated again, the test won't fail, but will be canceled. A more permanent solution is certainly needed.

At least for open source blobs can't we do something similar to the firmware and host a blob mirror on our infrastructure as a fallback?

I support that idea. Some of those kernels used on our acceptance tests are moving targets.

- Wainer

Quoted 32 lines
Quoted 18 lines
---
  tests/acceptance/boot_linux_console.py | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
tests/acceptance/boot_linux_console.py +2 -2
index c439fd90fc..8f676d8e92 100644
@@ -385,14 +385,14 @@ class BootLinuxConsole(Test):
          :avocado: tags=machine:q800
          """
          deb_url = ('http://ftp.ports.debian.org/debian-ports/pool-m68k/main'
-                   '/l/linux/kernel-image-5.2.0-2-m68k-di_5.2.9-2_m68k.udeb')
-        deb_hash = '0797e05129595f22f3c0142db5e199769a723bf9'
+                   '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
+        deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'

tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 398

Quoted 10 lines
tests/acceptance/boot_linux_console.py +1 -1
          try:
              deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
          except OSError as exp:
              self.cancel(exp)
          kernel_path = self.extract_from_deb(deb_path,
-                                            '/boot/vmlinux-5.2.0-2-m68k')
+                                            '/boot/vmlinux-5.3.0-1-m68k')
 
          self.vm.set_machine('q800')
          self.vm.set_console()

--
Alex Bennée

Reviewed-by Tested-by on v1 2/2
#11 lore raw

Re: [PATCH 2/2] Acceptance test: update kernel for m68k/q800 test

In reply to Cleber Rosa
Quoted 7 lines · Cleber Rosa

There's an updated version of the Debian package containing the m68k Kernel.

Now, if the package gets updated again, the test won't fail, but will be canceled. A more permanent solution is certainly needed.

Quoted 16 lines
---
 tests/acceptance/boot_linux_console.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/acceptance/boot_linux_console.py +2 -2
index c439fd90fc..8f676d8e92 100644
@@ -385,14 +385,14 @@ class BootLinuxConsole(Test):
         :avocado: tags=machine:q800
         """
         deb_url = ('http://ftp.ports.debian.org/debian-ports/pool-m68k/main'
-                   '/l/linux/kernel-image-5.2.0-2-m68k-di_5.2.9-2_m68k.udeb')
-        deb_hash = '0797e05129595f22f3c0142db5e199769a723bf9'
+                   '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
+        deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'

tests/acceptance/boot_linux_console.py class BootLinuxConsole(Test): · line 398

Quoted 10 lines
tests/acceptance/boot_linux_console.py +1 -1
         try:
             deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
         except OSError as exp:
             self.cancel(exp)
         kernel_path = self.extract_from_deb(deb_path,
-                                            '/boot/vmlinux-5.2.0-2-m68k')
+                                            '/boot/vmlinux-5.3.0-1-m68k')
 
         self.vm.set_machine('q800')
         self.vm.set_console()

--
Alex Bennée

#12 lore raw

Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

In reply to Cleber Rosa
Quoted 6 lines · Cleber Rosa

The boot_linux_console.py:BootLinuxConsole.test_m68k_q800 was very recently merged, but between its last review and now, the Kernel package used went missing.

This updates the Kernel package, and protects the test from failing if it gets updated again.

Queued to testing/next, thanks. I'll roll it up with Daniel's fix to get green again.

Quoted 7 lines

Cleber Rosa (2):
Acceptance test: cancel test if m68k kernel packages goes missing Acceptance test: update kernel for m68k/q800 test

 tests/acceptance/boot_linux_console.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

--
Alex Bennée

#13 lore raw

Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

In reply to Cleber Rosa
Quoted 4 lines · Cleber Rosa

The boot_linux_console.py:BootLinuxConsole.test_m68k_q800 was very recently merged, but between its last review and now, the Kernel package used went missing.

meta-question: Why was this series posted in-reply-to the pull request, rather than as a new top-level thread? I nearly missed it because I don't expect to see unreviewed patches buried in threading like that. My workflow would have been to post the series in isolation, then manually reply to the pull request to mention the message-id of the related series proposed as a followup.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#14 lore raw

Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

----- Original Message -----

Quoted 14 lines

From: "Eric Blake" <[email protected]>
To: "Cleber Rosa" <[email protected]>, [email protected]
Cc: "Peter Maydell" <[email protected]>, "Eduardo Habkost" <[email protected]>, "Philippe Mathieu-Daudé" <[email protected]>, "Wainer dos Santos Moschetta" <[email protected]>, "Laurent Vivier" <[email protected]>, "Willian Rampazzo" <[email protected]>, "Philippe Mathieu-Daudé" <[email protected]>
Sent: Thursday, November 7, 2019 10:43:08 AM
Subject: Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

Quoted 4 lines · Cleber Rosa

The boot_linux_console.py:BootLinuxConsole.test_m68k_q800 was very recently merged, but between its last review and now, the Kernel package used went missing.

Quoted 7 lines

meta-question: Why was this series posted in-reply-to the pull request, rather than as a new top-level thread? I nearly missed it because I don't expect to see unreviewed patches buried in threading like that. My workflow would have been to post the series in isolation, then manually reply to the pull request to mention the message-id of the related series proposed as a followup.

Hi Eric,

That was my attempt to signal that it was a fix to something which had *just* being merged as part of that pull request (though now caused by it).

I basically did not know how to act properly, so I thank you for the workflow suggestion. I'll certainly follow it next time.

Thanks a lot!
- Cleber.

Quoted 5 lines

--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org

#15 lore raw

Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

Le 07/11/2019 à 17:38, Cleber Rosa a écrit :

Quoted 25 lines

----- Original Message -----

Quoted 14 lines

From: "Eric Blake" <[email protected]>
To: "Cleber Rosa" <[email protected]>, [email protected]
Cc: "Peter Maydell" <[email protected]>, "Eduardo Habkost" <[email protected]>, "Philippe Mathieu-Daudé" <[email protected]>, "Wainer dos Santos Moschetta" <[email protected]>, "Laurent Vivier" <[email protected]>, "Willian Rampazzo" <[email protected]>, "Philippe Mathieu-Daudé" <[email protected]>
Sent: Thursday, November 7, 2019 10:43:08 AM
Subject: Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

Quoted 4 lines · Cleber Rosa

The boot_linux_console.py:BootLinuxConsole.test_m68k_q800 was very recently merged, but between its last review and now, the Kernel package used went missing.

Quoted 7 lines

meta-question: Why was this series posted in-reply-to the pull request, rather than as a new top-level thread? I nearly missed it because I don't expect to see unreviewed patches buried in threading like that. My workflow would have been to post the series in isolation, then manually reply to the pull request to mention the message-id of the related series proposed as a followup.

Quoted 7 lines

Hi Eric,

That was my attempt to signal that it was a fix to something which had *just* being merged as part of that pull request (though now caused by it).

I basically did not know how to act properly, so I thank you for the workflow suggestion. I'll certainly follow it next time.

IMHO, you should send your series and then replies to the pull request to tell you have sent your series that fixes the patch in the pull request, or vice-versa.

But your series has been queued by Alex, so there is no problem...

Thanks,
Laurent

#16 lore raw

Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

Quoted 29 lines · Laurent Vivier

Le 07/11/2019 à 17:38, Cleber Rosa a écrit :

Quoted 28 lines

----- Original Message -----

Quoted 14 lines

From: "Eric Blake" <[email protected]>
To: "Cleber Rosa" <[email protected]>, [email protected]
Cc: "Peter Maydell" <[email protected]>, "Eduardo Habkost" <[email protected]>, "Philippe Mathieu-Daudé" <[email protected]>, "Wainer dos Santos Moschetta" <[email protected]>, "Laurent Vivier" <[email protected]>, "Willian Rampazzo" <[email protected]>, "Philippe Mathieu-Daudé" <[email protected]>
Sent: Thursday, November 7, 2019 10:43:08 AM
Subject: Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

Quoted 4 lines · Cleber Rosa

The boot_linux_console.py:BootLinuxConsole.test_m68k_q800 was very recently merged, but between its last review and now, the Kernel package used went missing.

Quoted 7 lines

meta-question: Why was this series posted in-reply-to the pull request, rather than as a new top-level thread? I nearly missed it because I don't expect to see unreviewed patches buried in threading like that. My workflow would have been to post the series in isolation, then manually reply to the pull request to mention the message-id of the related series proposed as a followup.

Hi Eric,

That was my attempt to signal that it was a fix to something which had *just* being merged as part of that pull request (though now caused by it).

Quoted 8 lines
Quoted 2 lines

I basically did not know how to act properly, so I thank you for the workflow suggestion. I'll certainly follow it next time.

IMHO, you should send your series and then replies to the pull request to tell you have sent your series that fixes the patch in the pull request, or vice-versa.

But your series has been queued by Alex, so there is no problem...

I prepared a different fix around the same time, but closed my laptop before the patch was sent and noticed the next day:
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg08120.html

Laurent, are you OK with the new kernel being tested?

#17 lore raw

Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

Le 07/11/2019 à 19:00, Philippe Mathieu-Daudé a écrit :

Quoted 43 lines · Laurent Vivier
Quoted 42 lines

Le 07/11/2019 à 17:38, Cleber Rosa a écrit :

Quoted 29 lines

----- Original Message -----

Quoted 18 lines

From: "Eric Blake" <[email protected]>
To: "Cleber Rosa" <[email protected]>, [email protected]
Cc: "Peter Maydell" <[email protected]>, "Eduardo Habkost" <[email protected]>, "Philippe Mathieu-Daudé" <[email protected]>, "Wainer dos Santos Moschetta" <[email protected]>, "Laurent Vivier" <[email protected]>, "Willian Rampazzo" <[email protected]>, "Philippe Mathieu-Daudé" <[email protected]>
Sent: Thursday, November 7, 2019 10:43:08 AM
Subject: Re: [PATCH 0/2] Acceptance test: update kernel used on m68k/q800 test

Quoted 4 lines · Cleber Rosa

The boot_linux_console.py:BootLinuxConsole.test_m68k_q800 was very recently merged, but between its last review and now, the Kernel package used went missing.

Quoted 7 lines

meta-question: Why was this series posted in-reply-to the pull request, rather than as a new top-level thread? I nearly missed it because I don't expect to see unreviewed patches buried in threading like that. My workflow would have been to post the series in isolation, then manually reply to the pull request to mention the message-id of the related series proposed as a followup.

Hi Eric,

Quoted 7 lines

That was my attempt to signal that it was a fix to something which had *just*
being merged as part of that pull request (though now caused by it).

I basically did not know how to act properly, so I thank you for the workflow
suggestion.  I'll certainly follow it next time.

IMHO, you should send your series and then replies to the pull request to tell you have sent your series that fixes the patch in the pull request, or vice-versa.

Quoted 8 lines
Quoted 1 line

But your series has been queued by Alex, so there is no problem...

I prepared a different fix around the same time, but closed my laptop before the patch was sent and noticed the next day:
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg08120.html

Laurent, are you OK with the new kernel being tested?

I'm fine. We could have problems with 5.4 because the address mapping has been changed for SWIM (aee6bff1c325 "m68k: mac: Revisit floppy disc controller base addresses), but this has been fixed by my patch that has been merged today in QEMU (653901ca2b "q800: fix I/O memory map").

Thanks,
Laurent

#18 lore raw

[PULL 10/11] hw/m68k: define Macintosh Quadra 800

In reply to Laurent Vivier

If you want to test the machine, it doesn't yet boot a MacROM, but you can boot a linux kernel from the command line.

You can install your own disk using debian-installer with:

    ./qemu-system-m68k \
    -M q800 \
    -serial none -serial mon:stdio \
    -m 1000M -drive file=m68k.qcow2,format=qcow2 \
    -net nic,model=dp83932,addr=09:00:07:12:34:57 \
    -append "console=ttyS0 vga=off" \
    -kernel vmlinux-4.15.0-2-m68k \
    -initrd initrd.gz \
    -drive file=debian-9.0-m68k-NETINST-1.iso \
    -drive file=m68k.qcow2,format=qcow2 \
    -nographic

If you use a graphic adapter instead of "-nographic", you can use "-g" to set the size of the display (I use "-g 1600x800x24").

Message-Id: <[email protected]>

---
 hw/m68k/bootinfo.h    | 114 ++++++++++++
 hw/m68k/q800.c        | 401 ++++++++++++++++++++++++++++++++++++++++++
 MAINTAINERS           |   2 +
 hw/m68k/Kconfig       |   3 +
 hw/m68k/Makefile.objs |   1 +
 5 files changed, 521 insertions(+)
 create mode 100644 hw/m68k/bootinfo.h
 create mode 100644 hw/m68k/q800.c
hw/m68k/bootinfo.h new file +114 -0
new file mode 100644
index 0000000000..5f8ded2686
@@ -0,0 +1,114 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+ *
+ * Bootinfo tags from linux bootinfo.h and bootinfo-mac.h:
+ * This is an easily parsable and extendable structure containing all
+ * information to be passed from the bootstrap to the kernel
+ *
+ * This structure is copied right after the kernel by the bootstrap
+ * routine.
+ */
+
+#ifndef HW_M68K_BOOTINFO_H
+#define HW_M68K_BOOTINFO_H
+struct bi_record {
+    uint16_t tag;        /* tag ID */
+    uint16_t size;       /* size of record */
+    uint32_t data[0];    /* data */
+};
+
+/* machine independent tags */
+
+#define BI_LAST         0x0000 /* last record */
+#define BI_MACHTYPE     0x0001 /* machine type (u_long) */
+#define BI_CPUTYPE      0x0002 /* cpu type (u_long) */
+#define BI_FPUTYPE      0x0003 /* fpu type (u_long) */
+#define BI_MMUTYPE      0x0004 /* mmu type (u_long) */
+#define BI_MEMCHUNK     0x0005 /* memory chunk address and size */
+                               /* (struct mem_info) */
+#define BI_RAMDISK      0x0006 /* ramdisk address and size */
+                               /* (struct mem_info) */
+#define BI_COMMAND_LINE 0x0007 /* kernel command line parameters */
+                               /* (string) */
+
+/*  Macintosh-specific tags (all u_long) */
+
+#define BI_MAC_MODEL    0x8000  /* Mac Gestalt ID (model type) */
+#define BI_MAC_VADDR    0x8001  /* Mac video base address */
+#define BI_MAC_VDEPTH   0x8002  /* Mac video depth */
+#define BI_MAC_VROW     0x8003  /* Mac video rowbytes */
+#define BI_MAC_VDIM     0x8004  /* Mac video dimensions */
+#define BI_MAC_VLOGICAL 0x8005  /* Mac video logical base */
+#define BI_MAC_SCCBASE  0x8006  /* Mac SCC base address */
+#define BI_MAC_BTIME    0x8007  /* Mac boot time */
+#define BI_MAC_GMTBIAS  0x8008  /* Mac GMT timezone offset */
+#define BI_MAC_MEMSIZE  0x8009  /* Mac RAM size (sanity check) */
+#define BI_MAC_CPUID    0x800a  /* Mac CPU type (sanity check) */
+#define BI_MAC_ROMBASE  0x800b  /* Mac system ROM base address */
+
+/*  Macintosh hardware profile data */
+
+#define BI_MAC_VIA1BASE 0x8010  /* Mac VIA1 base address (always present) */
+#define BI_MAC_VIA2BASE 0x8011  /* Mac VIA2 base address (type varies) */
+#define BI_MAC_VIA2TYPE 0x8012  /* Mac VIA2 type (VIA, RBV, OSS) */
+#define BI_MAC_ADBTYPE  0x8013  /* Mac ADB interface type */
+#define BI_MAC_ASCBASE  0x8014  /* Mac Apple Sound Chip base address */
+#define BI_MAC_SCSI5380 0x8015  /* Mac NCR 5380 SCSI (base address, multi) */
+#define BI_MAC_SCSIDMA  0x8016  /* Mac SCSI DMA (base address) */
+#define BI_MAC_SCSI5396 0x8017  /* Mac NCR 53C96 SCSI (base address, multi) */
+#define BI_MAC_IDETYPE  0x8018  /* Mac IDE interface type */
+#define BI_MAC_IDEBASE  0x8019  /* Mac IDE interface base address */
+#define BI_MAC_NUBUS    0x801a  /* Mac Nubus type (none, regular, pseudo) */
+#define BI_MAC_SLOTMASK 0x801b  /* Mac Nubus slots present */
+#define BI_MAC_SCCTYPE  0x801c  /* Mac SCC serial type (normal, IOP) */
+#define BI_MAC_ETHTYPE  0x801d  /* Mac builtin ethernet type (Sonic, MACE */
+#define BI_MAC_ETHBASE  0x801e  /* Mac builtin ethernet base address */
+#define BI_MAC_PMU      0x801f  /* Mac power management / poweroff hardware */
+#define BI_MAC_IOP_SWIM 0x8020  /* Mac SWIM floppy IOP */
+#define BI_MAC_IOP_ADB  0x8021  /* Mac ADB IOP */
+
+#define BOOTINFO0(as, base, id) \
+    do { \
+        stw_phys(as, base, id); \
+        base += 2; \
+        stw_phys(as, base, sizeof(struct bi_record)); \
+        base += 2; \
+    } while (0)
+
+#define BOOTINFO1(as, base, id, value) \
+    do { \
+        stw_phys(as, base, id); \
+        base += 2; \
+        stw_phys(as, base, sizeof(struct bi_record) + 4); \
+        base += 2; \
+        stl_phys(as, base, value); \
+        base += 4; \
+    } while (0)
+
+#define BOOTINFO2(as, base, id, value1, value2) \
+    do { \
+        stw_phys(as, base, id); \
+        base += 2; \
+        stw_phys(as, base, sizeof(struct bi_record) + 8); \
+        base += 2; \
+        stl_phys(as, base, value1); \
+        base += 4; \
+        stl_phys(as, base, value2); \
+        base += 4; \
+    } while (0)
+
+#define BOOTINFOSTR(as, base, id, string) \
+    do { \
+        int i; \
+        stw_phys(as, base, id); \
+        base += 2; \
+        stw_phys(as, base, \
+                 (sizeof(struct bi_record) + strlen(string) + 2) & ~1); \
+        base += 2; \
+        for (i = 0; string[i]; i++) { \
+            stb_phys(as, base++, string[i]); \
+        } \
+        stb_phys(as, base++, 0); \
+        base = (parameters_base + 1) & ~1; \
+    } while (0)
+#endif
hw/m68k/q800.c new file +401 -0

401 lines not on this page · raw message

MAINTAINERS +2 -0
index 7f806eb1b2..afe9dc5b57 100644
@@ -920,10 +920,12 @@ F: include/hw/m68k/next-cube.h
 q800
 M: Laurent Vivier <[email protected]>
 S: Maintained
+F: hw/m68k/q800.c
 F: hw/misc/mac_via.c
 F: hw/nubus/*
 F: hw/display/macfb.c
 F: hw/block/swim.c
+F: hw/m68k/bootinfo.h
 F: include/hw/misc/mac_via.h
 F: include/hw/nubus/*
 F: include/hw/display/macfb.h
hw/m68k/Kconfig +3 -0
index bab4885ca5..c757e7dfa4 100644
@@ -19,3 +19,6 @@ config Q800
     select NUBUS
     select MACFB
     select SWIM
+    select ESCC
+    select ESP
+    select DP8393X
hw/m68k/Makefile.objs +1 -0
index f25854730d..b2c9e5ab12 100644
@@ -1,3 +1,4 @@
 obj-$(CONFIG_AN5206) += an5206.o mcf5206.o
 obj-$(CONFIG_MCF5208) += mcf5208.o mcf_intc.o
 obj-$(CONFIG_NEXTCUBE) += next-kbd.o next-cube.o
+obj-$(CONFIG_Q800) += q800.o
Signature · 1 line
2.21.0
#19 lore raw

[PULL 01/11] esp: move handle_ti_cmd() cleanup code to esp_do_dma().

In reply to Laurent Vivier

To prepare following patches move do_cmd and DMA special case from handle_ti() to esp_do_dma().

This part of the code must be only executed with real DMA, not with pseudo-DMA. And PDMA is detected in esp_do_dma(), so move this part of the code in esp_do_dma(). We keep the code in handle_ti_cmd() in the case no DMA is done.

Message-Id: <[email protected]>

---
 hw/scsi/esp.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
hw/scsi/esp.c +10 -2
index 841d79b60e..09b28cba17 100644
@@ -249,10 +249,19 @@ static void esp_do_dma(ESPState *s)
 
     len = s->dma_left;
     if (s->do_cmd) {
+        /*
+         * handle_ti_cmd() case: esp_do_dma() is called only from
+         * handle_ti_cmd() with do_cmd != NULL (see the assert())
+         */
         trace_esp_do_dma(s->cmdlen, len);
         assert (s->cmdlen <= sizeof(s->cmdbuf) &&
                 len <= sizeof(s->cmdbuf) - s->cmdlen);
         s->dma_memory_read(s->dma_opaque, &s->cmdbuf[s->cmdlen], len);
+        trace_esp_handle_ti_cmd(s->cmdlen);
+        s->ti_size = 0;
+        s->cmdlen = 0;
+        s->do_cmd = 0;
+        do_cmd(s, s->cmdbuf);
         return;
     }
     if (s->async_len == 0) {
@@ -373,8 +382,7 @@ static void handle_ti(ESPState *s)
         s->dma_left = minlen;
         s->rregs[ESP_RSTAT] &= ~STAT_TC;
         esp_do_dma(s);
-    }
-    if (s->do_cmd) {
+    } else if (s->do_cmd) {
         trace_esp_handle_ti_cmd(s->cmdlen);
         s->ti_size = 0;
         s->cmdlen = 0;
Signature · 1 line
2.21.0
#20 lore raw

[PULL 05/11] hw/m68k: add VIA support

In reply to Laurent Vivier

Inside the 680x0 Macintosh, VIA (Versatile Interface Adapter) is used to interface the keyboard, Mouse, and real-time clock. It also provides control line for the floppy disk driver, video interface, sound circuitry and serial interface.

This implementation is based on the MOS6522 object.

Message-Id: <[email protected]>

---
 default-configs/m68k-softmmu.mak |   1 +
 include/hw/misc/mac_via.h        | 108 +++++
 hw/misc/mac_via.c                | 767 +++++++++++++++++++++++++++++++
 MAINTAINERS                      |   6 +
 hw/m68k/Kconfig                  |   4 +
 hw/misc/Kconfig                  |   4 +
 hw/misc/Makefile.objs            |   1 +
 7 files changed, 891 insertions(+)
 create mode 100644 include/hw/misc/mac_via.h
 create mode 100644 hw/misc/mac_via.c
default-configs/m68k-softmmu.mak +1 -0
index d67ab8b96d..6629fd2aa3 100644
@@ -7,3 +7,4 @@ CONFIG_SEMIHOSTING=y
 CONFIG_AN5206=y
 CONFIG_MCF5208=y
 CONFIG_NEXTCUBE=y
+CONFIG_Q800=y
include/hw/misc/mac_via.h new file +108 -0

108 lines not on this page · raw message

hw/misc/mac_via.c new file +767 -0

767 lines not on this page · raw message

MAINTAINERS +6 -0
index ed41d7d1b6..3ce8d10b58 100644
@@ -917,6 +917,12 @@ F: hw/m68k/next-*.c
 F: hw/display/next-fb.c
 F: include/hw/m68k/next-cube.h
 
+q800
+M: Laurent Vivier <[email protected]>
+S: Maintained
+F: hw/misc/mac_via.c
+F: include/hw/misc/mac_via.h
+
 MicroBlaze Machines
 -------------------
 petalogix_s3adsp1800
hw/m68k/Kconfig +4 -0
index a74fac5abd..22a357609c 100644
@@ -12,3 +12,7 @@ config NEXTCUBE
     bool
     select FRAMEBUFFER
     select ESCC
+
+config Q800
+    bool
+    select MAC_VIA
hw/misc/Kconfig +4 -0
index 51754bb47c..18a5dc9c09 100644
@@ -120,4 +120,8 @@ config AUX
 config UNIMP
     bool
 
+config MAC_VIA
+    bool
+    select MOS6522
+
 source macio/Kconfig
hw/misc/Makefile.objs +1 -0
index c89f3816a5..ba898a5781 100644
@@ -79,5 +79,6 @@ common-obj-$(CONFIG_ASPEED_SOC) += aspeed_xdma.o
 common-obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
 common-obj-$(CONFIG_MSF2) += msf2-sysreg.o
 common-obj-$(CONFIG_NRF51_SOC) += nrf51_rng.o
+obj-$(CONFIG_MAC_VIA) += mac_via.o
 
 common-obj-$(CONFIG_GRLIB) += grlib_ahb_apb_pnp.o
Signature · 1 line
2.21.0
#21 lore raw

[PULL 03/11] esp: add pseudo-DMA as used by Macintosh

In reply to Laurent Vivier

There is no DMA in Quadra 800, so the CPU reads/writes the data from the PDMA register (offset 0x100, ESP_PDMA in hw/m68k/q800.c) and copies them to/from the memory.

There is a nice assembly loop in the kernel to do that, see linux/drivers/scsi/mac_esp.c:MAC_ESP_PDMA_LOOP().

The start of the transfer is triggered by the DREQ interrupt (see linux mac_esp_send_pdma_cmd()), the CPU polls on the IRQ flag to start the transfer after a SCSI command has been sent (in Quadra 800 it goes through the VIA2, the via2-irq line and the vIFR register)

The Macintosh hardware includes hardware handshaking to prevent the CPU from reading invalid data or writing data faster than the peripheral device can accept it.

This is the "blind mode", and from the doc:
"Approximate maximum SCSI transfer rates within a blocks are 1.4 MB per second for blind transfers in the Macintosh II"

Some references can be found in:
Apple Macintosh Family Hardware Reference, ISBN 0-201-19255-1 Guide to the Macintosh Family Hardware, ISBN-0-201-52405-8

Message-Id: <[email protected]>

---
 include/hw/scsi/esp.h |  15 +++
 hw/scsi/esp.c         | 278 ++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 284 insertions(+), 9 deletions(-)
include/hw/scsi/esp.h +15 -0
index adab63d1c9..6ba47dac41 100644
@@ -14,10 +14,18 @@ typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int len);
 
 typedef struct ESPState ESPState;
 
+enum pdma_origin_id {
+    PDMA,
+    TI,
+    CMD,
+    ASYNC,
+};
+
 struct ESPState {
     uint8_t rregs[ESP_REGS];
     uint8_t wregs[ESP_REGS];
     qemu_irq irq;
+    qemu_irq irq_data;
     uint8_t chip_id;
     bool tchi_written;
     int32_t ti_size;
@@ -48,6 +56,12 @@ struct ESPState {
     ESPDMAMemoryReadWriteFunc dma_memory_write;
     void *dma_opaque;
     void (*dma_cb)(ESPState *s);
+    uint8_t pdma_buf[32];
+    int pdma_origin;
+    uint32_t pdma_len;
+    uint32_t pdma_start;
+    uint32_t pdma_cur;
+    void (*pdma_cb)(ESPState *s);
 };
 
 #define TYPE_ESP "esp"
@@ -59,6 +73,7 @@ typedef struct {
     /*< public >*/
 
     MemoryRegion iomem;
+    MemoryRegion pdma;
     uint32_t it_shift;
     ESPState esp;
 } SysBusESPState;
hw/scsi/esp.c +269 -9

403 lines not on this page · raw message

Signature · 1 line
2.21.0
#22 lore raw

[PULL 04/11] dp8393x: manage big endian bus

In reply to Laurent Vivier

This is needed by Quadra 800, this card can run on little-endian or big-endian bus.

Message-Id: <[email protected]>

---
 hw/net/dp8393x.c | 88 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 57 insertions(+), 31 deletions(-)
hw/net/dp8393x.c +57 -31
index a5678e11fa..693e244ce6 100644
@@ -153,6 +153,7 @@ typedef struct dp8393xState {
 
     /* Hardware */
     uint8_t it_shift;
+    bool big_endian;
     qemu_irq irq;
 #ifdef DEBUG_SONIC
     int irq_level;
@@ -223,6 +224,29 @@ static uint32_t dp8393x_wt(dp8393xState *s)
     return s->regs[SONIC_WT1] << 16 | s->regs[SONIC_WT0];
 }
 
+static uint16_t dp8393x_get(dp8393xState *s, int width, uint16_t *base,
+                            int offset)
+{
+    uint16_t val;
+
+    if (s->big_endian) {
+        val = be16_to_cpu(base[offset * width + width - 1]);
+    } else {
+        val = le16_to_cpu(base[offset * width]);
+    }
+    return val;
+}
+
+static void dp8393x_put(dp8393xState *s, int width, uint16_t *base, int offset,
+                        uint16_t val)
+{
+    if (s->big_endian) {
+        base[offset * width + width - 1] = cpu_to_be16(val);
+    } else {
+        base[offset * width] = cpu_to_le16(val);
+    }
+}
+
 static void dp8393x_update_irq(dp8393xState *s)
 {
     int level = (s->regs[SONIC_IMR] & s->regs[SONIC_ISR]) ? 1 : 0;
@@ -254,12 +278,12 @@ static void dp8393x_do_load_cam(dp8393xState *s)
         /* Fill current entry */
         address_space_rw(&s->as, dp8393x_cdp(s),
             MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 0);
-        s->cam[index][0] = data[1 * width] & 0xff;
-        s->cam[index][1] = data[1 * width] >> 8;
-        s->cam[index][2] = data[2 * width] & 0xff;
-        s->cam[index][3] = data[2 * width] >> 8;
-        s->cam[index][4] = data[3 * width] & 0xff;
-        s->cam[index][5] = data[3 * width] >> 8;
+        s->cam[index][0] = dp8393x_get(s, width, data, 1) & 0xff;
+        s->cam[index][1] = dp8393x_get(s, width, data, 1) >> 8;
+        s->cam[index][2] = dp8393x_get(s, width, data, 2) & 0xff;
+        s->cam[index][3] = dp8393x_get(s, width, data, 2) >> 8;
+        s->cam[index][4] = dp8393x_get(s, width, data, 3) & 0xff;
+        s->cam[index][5] = dp8393x_get(s, width, data, 3) >> 8;
         DPRINTF("load cam[%d] with %02x%02x%02x%02x%02x%02x\n", index,
             s->cam[index][0], s->cam[index][1], s->cam[index][2],
             s->cam[index][3], s->cam[index][4], s->cam[index][5]);
@@ -272,7 +296,7 @@ static void dp8393x_do_load_cam(dp8393xState *s)
     /* Read CAM enable */
     address_space_rw(&s->as, dp8393x_cdp(s),
         MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 0);
-    s->regs[SONIC_CE] = data[0 * width];
+    s->regs[SONIC_CE] = dp8393x_get(s, width, data, 0);
     DPRINTF("load cam done. cam enable mask 0x%04x\n", s->regs[SONIC_CE]);
 
     /* Done */
@@ -293,10 +317,10 @@ static void dp8393x_do_read_rra(dp8393xState *s)
         MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 0);
 
     /* Update SONIC registers */
-    s->regs[SONIC_CRBA0] = data[0 * width];
-    s->regs[SONIC_CRBA1] = data[1 * width];
-    s->regs[SONIC_RBWC0] = data[2 * width];
-    s->regs[SONIC_RBWC1] = data[3 * width];
+    s->regs[SONIC_CRBA0] = dp8393x_get(s, width, data, 0);
+    s->regs[SONIC_CRBA1] = dp8393x_get(s, width, data, 1);
+    s->regs[SONIC_RBWC0] = dp8393x_get(s, width, data, 2);
+    s->regs[SONIC_RBWC1] = dp8393x_get(s, width, data, 3);
     DPRINTF("CRBA0/1: 0x%04x/0x%04x, RBWC0/1: 0x%04x/0x%04x\n",
         s->regs[SONIC_CRBA0], s->regs[SONIC_CRBA1],
         s->regs[SONIC_RBWC0], s->regs[SONIC_RBWC1]);
@@ -411,12 +435,12 @@ static void dp8393x_do_transmit_packets(dp8393xState *s)
         tx_len = 0;
 
         /* Update registers */
-        s->regs[SONIC_TCR] = data[0 * width] & 0xf000;
-        s->regs[SONIC_TPS] = data[1 * width];
-        s->regs[SONIC_TFC] = data[2 * width];
-        s->regs[SONIC_TSA0] = data[3 * width];
-        s->regs[SONIC_TSA1] = data[4 * width];
-        s->regs[SONIC_TFS] = data[5 * width];
+        s->regs[SONIC_TCR] = dp8393x_get(s, width, data, 0) & 0xf000;
+        s->regs[SONIC_TPS] = dp8393x_get(s, width, data, 1);
+        s->regs[SONIC_TFC] = dp8393x_get(s, width, data, 2);
+        s->regs[SONIC_TSA0] = dp8393x_get(s, width, data, 3);
+        s->regs[SONIC_TSA1] = dp8393x_get(s, width, data, 4);
+        s->regs[SONIC_TFS] = dp8393x_get(s, width, data, 5);
 
         /* Handle programmable interrupt */
         if (s->regs[SONIC_TCR] & SONIC_TCR_PINT) {
@@ -442,9 +466,9 @@ static void dp8393x_do_transmit_packets(dp8393xState *s)
                 address_space_rw(&s->as,
                     dp8393x_ttda(s) + sizeof(uint16_t) * (4 + 3 * i) * width,
                     MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 0);
-                s->regs[SONIC_TSA0] = data[0 * width];
-                s->regs[SONIC_TSA1] = data[1 * width];
-                s->regs[SONIC_TFS] = data[2 * width];
+                s->regs[SONIC_TSA0] = dp8393x_get(s, width, data, 0);
+                s->regs[SONIC_TSA1] = dp8393x_get(s, width, data, 1);
+                s->regs[SONIC_TFS] = dp8393x_get(s, width, data, 2);
             }
         }
 
@@ -471,7 +495,8 @@ static void dp8393x_do_transmit_packets(dp8393xState *s)
         s->regs[SONIC_TCR] |= SONIC_TCR_PTX;
 
         /* Write status */
-        data[0 * width] = s->regs[SONIC_TCR] & 0x0fff; /* status */
+        dp8393x_put(s, width, data, 0,
+                    s->regs[SONIC_TCR] & 0x0fff); /* status */
         size = sizeof(uint16_t) * width;
         address_space_rw(&s->as,
             dp8393x_ttda(s),
@@ -485,8 +510,8 @@ static void dp8393x_do_transmit_packets(dp8393xState *s)
                              sizeof(uint16_t) *
                              (4 + 3 * s->regs[SONIC_TFC]) * width,
                 MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 0);
-            s->regs[SONIC_CTDA] = data[0 * width] & ~0x1;
-            if (data[0 * width] & 0x1) {
+            s->regs[SONIC_CTDA] = dp8393x_get(s, width, data, 0) & ~0x1;
+            if (dp8393x_get(s, width, data, 0) & 0x1) {
                 /* EOL detected */
                 break;
             }
@@ -749,7 +774,7 @@ static ssize_t dp8393x_receive(NetClientState *nc, const uint8_t * buf,
         address = dp8393x_crda(s) + sizeof(uint16_t) * 5 * width;
         address_space_rw(&s->as, address, MEMTXATTRS_UNSPECIFIED,
                          (uint8_t *)data, size, 0);
-        if (data[0 * width] & 0x1) {
+        if (dp8393x_get(s, width, data, 0) & 0x1) {
             /* Still EOL ; stop reception */
             return -1;
         } else {
@@ -793,11 +818,11 @@ static ssize_t dp8393x_receive(NetClientState *nc, const uint8_t * buf,
 
     /* Write status to memory */
     DPRINTF("Write status at %08x\n", dp8393x_crda(s));
-    data[0 * width] = s->regs[SONIC_RCR]; /* status */
-    data[1 * width] = rx_len; /* byte count */
-    data[2 * width] = s->regs[SONIC_TRBA0]; /* pkt_ptr0 */
-    data[3 * width] = s->regs[SONIC_TRBA1]; /* pkt_ptr1 */
-    data[4 * width] = s->regs[SONIC_RSC]; /* seq_no */
+    dp8393x_put(s, width, data, 0, s->regs[SONIC_RCR]); /* status */
+    dp8393x_put(s, width, data, 1, rx_len); /* byte count */
+    dp8393x_put(s, width, data, 2, s->regs[SONIC_TRBA0]); /* pkt_ptr0 */
+    dp8393x_put(s, width, data, 3, s->regs[SONIC_TRBA1]); /* pkt_ptr1 */
+    dp8393x_put(s, width, data, 4, s->regs[SONIC_RSC]); /* seq_no */
     size = sizeof(uint16_t) * 5 * width;
     address_space_rw(&s->as, dp8393x_crda(s),
         MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 1);
@@ -806,12 +831,12 @@ static ssize_t dp8393x_receive(NetClientState *nc, const uint8_t * buf,
     size = sizeof(uint16_t) * width;
     address_space_rw(&s->as, dp8393x_crda(s) + sizeof(uint16_t) * 5 * width,
         MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 0);
-    s->regs[SONIC_LLFA] = data[0 * width];
+    s->regs[SONIC_LLFA] = dp8393x_get(s, width, data, 0);
     if (s->regs[SONIC_LLFA] & 0x1) {
         /* EOL detected */
         s->regs[SONIC_ISR] |= SONIC_ISR_RDE;
     } else {
-        data[0 * width] = 0; /* in_use */
+        dp8393x_put(s, width, data, 0, 0); /* in_use */
         address_space_rw(&s->as, dp8393x_crda(s) + sizeof(uint16_t) * 6 * width,
             MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, sizeof(uint16_t), 1);
         s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA];
@@ -924,6 +949,7 @@ static Property dp8393x_properties[] = {
     DEFINE_NIC_PROPERTIES(dp8393xState, conf),
     DEFINE_PROP_PTR("dma_mr", dp8393xState, dma_mr),
     DEFINE_PROP_UINT8("it_shift", dp8393xState, it_shift, 0),
+    DEFINE_PROP_BOOL("big_endian", dp8393xState, big_endian, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
Signature · 1 line
2.21.0
#23 lore raw

[PULL 07/11] hw/m68k: add Nubus support

In reply to Laurent Vivier

This patch adds basic support for the NuBus bus. This is used by 680x0 Macintosh.

Message-Id: <[email protected]>

---
 include/hw/nubus/mac-nubus-bridge.h |  24 ++++
 include/hw/nubus/nubus.h            |  69 +++++++++
 hw/nubus/mac-nubus-bridge.c         |  45 ++++++
 hw/nubus/nubus-bridge.c             |  34 +++++
 hw/nubus/nubus-bus.c                | 111 ++++++++++++++
 hw/nubus/nubus-device.c             | 215 ++++++++++++++++++++++++++++
 MAINTAINERS                         |   2 +
 hw/Kconfig                          |   1 +
 hw/Makefile.objs                    |   1 +
 hw/m68k/Kconfig                     |   1 +
 hw/nubus/Kconfig                    |   2 +
 hw/nubus/Makefile.objs              |   4 +
 12 files changed, 509 insertions(+)
 create mode 100644 include/hw/nubus/mac-nubus-bridge.h
 create mode 100644 include/hw/nubus/nubus.h
 create mode 100644 hw/nubus/mac-nubus-bridge.c
 create mode 100644 hw/nubus/nubus-bridge.c
 create mode 100644 hw/nubus/nubus-bus.c
 create mode 100644 hw/nubus/nubus-device.c
 create mode 100644 hw/nubus/Kconfig
 create mode 100644 hw/nubus/Makefile.objs
include/hw/nubus/mac-nubus-bridge.h new file +24 -0
new file mode 100644
index 0000000000..ce9c789d99
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2013-2018 Laurent Vivier <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef HW_NUBUS_MAC_H
+#define HW_NUBUS_MAC_H
+
+#include "hw/nubus/nubus.h"
+
+#define TYPE_MAC_NUBUS_BRIDGE "mac-nubus-bridge"
+#define MAC_NUBUS_BRIDGE(obj) OBJECT_CHECK(MacNubusState, (obj), \
+                                           TYPE_MAC_NUBUS_BRIDGE)
+
+typedef struct MacNubusState {
+    SysBusDevice sysbus_dev;
+
+    NubusBus *bus;
+} MacNubusState;
+
+#endif
include/hw/nubus/nubus.h new file +69 -0

69 lines not on this page · raw message

hw/nubus/mac-nubus-bridge.c new file +45 -0

45 lines not on this page · raw message

hw/nubus/nubus-bridge.c new file +34 -0
new file mode 100644
index 0000000000..cd8c6a91eb
@@ -0,0 +1,34 @@
+/*
+ * QEMU Macintosh Nubus
+ *
+ * Copyright (c) 2013-2018 Laurent Vivier <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "hw/sysbus.h"
+#include "hw/nubus/nubus.h"
+
+static void nubus_bridge_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->fw_name = "nubus";
+}
+
+static const TypeInfo nubus_bridge_info = {
+    .name          = TYPE_NUBUS_BRIDGE,
+    .parent        = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(SysBusDevice),
+    .class_init    = nubus_bridge_class_init,
+};
+
+static void nubus_register_types(void)
+{
+    type_register_static(&nubus_bridge_info);
+}
+
+type_init(nubus_register_types)
hw/nubus/nubus-bus.c new file +111 -0

111 lines not on this page · raw message

hw/nubus/nubus-device.c new file +215 -0

215 lines not on this page · raw message

MAINTAINERS +2 -0
index 3ce8d10b58..7892ab5f02 100644
@@ -921,7 +921,9 @@ q800
 M: Laurent Vivier <[email protected]>
 S: Maintained
 F: hw/misc/mac_via.c
+F: hw/nubus/*
 F: include/hw/misc/mac_via.h
+F: include/hw/nubus/*
 
 MicroBlaze Machines
 -------------------
hw/Kconfig +1 -0
index b45db3c813..0501a55315 100644
@@ -21,6 +21,7 @@ source isa/Kconfig
 source mem/Kconfig
 source misc/Kconfig
 source net/Kconfig
+source nubus/Kconfig
 source nvram/Kconfig
 source pci-bridge/Kconfig
 source pci-host/Kconfig
hw/Makefile.objs +1 -0
index ece6cc3755..457b95e28d 100644
@@ -37,6 +37,7 @@ devices-dirs-y += virtio/
 devices-dirs-y += watchdog/
 devices-dirs-y += xen/
 devices-dirs-$(CONFIG_MEM_DEVICE) += mem/
+devices-dirs-$(CONFIG_NUBUS) += nubus/
 devices-dirs-y += semihosting/
 devices-dirs-y += smbios/
 endif
hw/m68k/Kconfig +1 -0
index 22a357609c..947cd42c01 100644
@@ -16,3 +16,4 @@ config NEXTCUBE
 config Q800
     bool
     select MAC_VIA
+    select NUBUS
hw/nubus/Kconfig new file +2 -0
new file mode 100644
index 0000000000..8fb8b22189
@@ -0,0 +1,2 @@
+config NUBUS
+    bool
hw/nubus/Makefile.objs new file +4 -0
new file mode 100644
index 0000000000..135ba7878d
@@ -0,0 +1,4 @@
+common-obj-y += nubus-device.o
+common-obj-y += nubus-bus.o
+common-obj-y += nubus-bridge.o
+common-obj-$(CONFIG_Q800) += mac-nubus-bridge.o
Signature · 1 line
2.21.0
#24 lore raw

[PULL 08/11] hw/m68k: add Nubus macfb video card

In reply to Laurent Vivier

This patch adds support for a graphic framebuffer device. This device can be added as a sysbus device or as a NuBus device.

It is accessed as a framebuffer but the color palette can be set.

Message-Id: <[email protected]>

---
 include/hw/display/macfb.h |  64 +++++
 arch_init.c                |   4 +
 hw/display/macfb.c         | 477 +++++++++++++++++++++++++++++++++++++
 vl.c                       |   3 +-
 MAINTAINERS                |   2 +
 hw/display/Kconfig         |   5 +
 hw/display/Makefile.objs   |   1 +
 hw/m68k/Kconfig            |   1 +
 qemu-options.hx            |   2 +-
 9 files changed, 557 insertions(+), 2 deletions(-)
 create mode 100644 include/hw/display/macfb.h
 create mode 100644 hw/display/macfb.c
include/hw/display/macfb.h new file +64 -0
new file mode 100644
index 0000000000..26367ae2c4
@@ -0,0 +1,64 @@
+/*
+ * QEMU Motorola 680x0 Macintosh Video Card Emulation
+ *                 Copyright (c) 2012-2018 Laurent Vivier
+ *
+ * some parts from QEMU G364 framebuffer Emulator.
+ *                 Copyright (c) 2007-2011 Herve Poussineau
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef MACFB_H
+#define MACFB_H
+
+#include "qemu/osdep.h"
+#include "exec/memory.h"
+#include "ui/console.h"
+
+typedef struct MacfbState {
+    MemoryRegion mem_vram;
+    MemoryRegion mem_ctrl;
+    QemuConsole *con;
+
+    uint8_t *vram;
+    uint32_t vram_bit_mask;
+    uint32_t palette_current;
+    uint8_t color_palette[256 * 3];
+    uint32_t width, height; /* in pixels */
+    uint8_t depth;
+} MacfbState;
+
+#define TYPE_MACFB "sysbus-macfb"
+#define MACFB(obj) \
+    OBJECT_CHECK(MacfbSysBusState, (obj), TYPE_MACFB)
+
+typedef struct {
+    SysBusDevice busdev;
+
+    MacfbState macfb;
+} MacfbSysBusState;
+
+#define MACFB_NUBUS_DEVICE_CLASS(class) \
+    OBJECT_CLASS_CHECK(MacfbNubusDeviceClass, (class), TYPE_NUBUS_MACFB)
+#define MACFB_NUBUS_GET_CLASS(obj) \
+    OBJECT_GET_CLASS(MacfbNubusDeviceClass, (obj), TYPE_NUBUS_MACFB)
+
+typedef struct MacfbNubusDeviceClass {
+    DeviceClass parent_class;
+
+    DeviceRealize parent_realize;
+} MacfbNubusDeviceClass;
+
+#define TYPE_NUBUS_MACFB "nubus-macfb"
+#define NUBUS_MACFB(obj) \
+    OBJECT_CHECK(MacfbNubusState, (obj), TYPE_NUBUS_MACFB)
+
+typedef struct {
+    NubusDevice busdev;
+
+    MacfbState macfb;
+} MacfbNubusState;
+
+#endif
arch_init.c +4 -0
index 0a1531124c..705d0b94ad 100644
@@ -38,6 +38,10 @@
 int graphic_width = 1024;
 int graphic_height = 768;
 int graphic_depth = 8;
+#elif defined(TARGET_M68K)
+int graphic_width = 800;
+int graphic_height = 600;
+int graphic_depth = 8;
 #else
 int graphic_width = 800;
 int graphic_height = 600;
hw/display/macfb.c new file +477 -0

477 lines not on this page · raw message

vl.c +2 -1
index 4489cfb2bb..59e82fba35 100644
@@ -3226,7 +3226,8 @@ int main(int argc, char **argv, char **envp)
                     if (*p == 'x') {
                         p++;
                         depth = strtol(p, (char **)&p, 10);
-                        if (depth != 8 && depth != 15 && depth != 16 &&
+                        if (depth != 1 && depth != 2 && depth != 4 &&
+                            depth != 8 && depth != 15 && depth != 16 &&
                             depth != 24 && depth != 32)
                             goto graphic_error;
                     } else if (*p == '\0') {
MAINTAINERS +2 -0
index 7892ab5f02..bd0df67e62 100644
@@ -922,8 +922,10 @@ M: Laurent Vivier <[email protected]>
 S: Maintained
 F: hw/misc/mac_via.c
 F: hw/nubus/*
+F: hw/display/macfb.c
 F: include/hw/misc/mac_via.h
 F: include/hw/nubus/*
+F: include/hw/display/macfb.h
 
 MicroBlaze Machines
 -------------------
hw/display/Kconfig +5 -0
index cbdf7b1a67..c500d1fc6d 100644
@@ -132,3 +132,8 @@ config ATI_VGA
     select VGA
     select BITBANG_I2C
     select DDC
+
+config MACFB
+    bool
+    select FRAMEBUFFER
+    depends on NUBUS
hw/display/Makefile.objs +1 -0
index 5a4066383b..f2182e3bef 100644
@@ -26,6 +26,7 @@ common-obj-$(CONFIG_EXYNOS4) += exynos4210_fimd.o
 common-obj-$(CONFIG_FRAMEBUFFER) += framebuffer.o
 obj-$(CONFIG_MILKYMIST) += milkymist-vgafb.o
 common-obj-$(CONFIG_ZAURUS) += tc6393xb.o
+common-obj-$(CONFIG_MACFB) += macfb.o
 
 obj-$(CONFIG_MILKYMIST_TMU2) += milkymist-tmu2.o
 milkymist-tmu2.o-cflags := $(X11_CFLAGS) $(OPENGL_CFLAGS)
hw/m68k/Kconfig +1 -0
index 947cd42c01..ef4917dee6 100644
@@ -17,3 +17,4 @@ config Q800
     bool
     select MAC_VIA
     select NUBUS
+    select MACFB
qemu-options.hx +1 -1
index 996b6fba74..1c5bc8ae99 100644
@@ -1839,7 +1839,7 @@ ETEXI
 
 DEF("g", 1, QEMU_OPTION_g ,
     "-g WxH[xDEPTH]  Set the initial graphical resolution and depth\n",
-    QEMU_ARCH_PPC | QEMU_ARCH_SPARC)
+    QEMU_ARCH_PPC | QEMU_ARCH_SPARC | QEMU_ARCH_M68K)
 STEXI
 @item -g @var{width}x@var{height}[x@var{depth}]
 @findex -g
Signature · 1 line
2.21.0
#25 lore raw
In reply to Laurent Vivier
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [PULL 00/11] Q800 branch patches
Type: series
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Switched to a new branch 'test'
0aafe33 BootLinuxConsoleTest: Test the Quadra 800 6578d05 hw/m68k: define Macintosh Quadra 800
8d92411 hw/m68k: add a dummy SWIM floppy controller 33e127e hw/m68k: add Nubus macfb video card
9e5413f hw/m68k: add Nubus support
777b85a hw/m68k: implement ADB bus support for via d23cb98 hw/m68k: add VIA support
477391a dp8393x: manage big endian bus
a5915a5 esp: add pseudo-DMA as used by Macintosh 324dd11 esp: move get_cmd() post-DMA code to get_cmd_cb() 447e0b9 esp: move handle_ti_cmd() cleanup code to esp_do_dma().

=== OUTPUT BEGIN ===
1/11 Checking commit 447e0b9e7e82 (esp: move handle_ti_cmd() cleanup code to esp_do_dma().) 2/11 Checking commit 324dd11bd843 (esp: move get_cmd() post-DMA code to get_cmd_cb()) 3/11 Checking commit a5915a587841 (esp: add pseudo-DMA as used by Macintosh) 4/11 Checking commit 477391a3299a (dp8393x: manage big endian bus)
5/11 Checking commit d23cb98ca175 (hw/m68k: add VIA support)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #84:
new file mode 100644

ERROR: space prohibited after that '&&' (ctx:WxW)
#456: FILE: hw/misc/mac_via.c:368:

+        if (!(v1s->last_b & VIA1B_vRTCClk) && (s->b & VIA1B_vRTCClk)) {
                                            ^

total: 1 errors, 1 warnings, 912 lines checked

Patch 5/11 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

6/11 Checking commit 777b85a4403d (hw/m68k: implement ADB bus support for via) 7/11 Checking commit 9e5413fe652c (hw/m68k: add Nubus support)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #65:
new file mode 100644

total: 0 errors, 1 warnings, 531 lines checked

Patch 7/11 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
8/11 Checking commit 33e127ea8c90 (hw/m68k: add Nubus macfb video card)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #76:
new file mode 100644

total: 0 errors, 1 warnings, 597 lines checked

Patch 8/11 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
9/11 Checking commit 8d9241120f8f (hw/m68k: add a dummy SWIM floppy controller)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #63:
new file mode 100644

total: 0 errors, 1 warnings, 593 lines checked

Patch 9/11 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
10/11 Checking commit 6578d05b2deb (hw/m68k: define Macintosh Quadra 800)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #72:
new file mode 100644

total: 0 errors, 1 warnings, 537 lines checked

Patch 10/11 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/11 Checking commit 0aafe3328f0b (BootLinuxConsoleTest: Test the Quadra 800) === OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#26 lore raw
In reply to Laurent Vivier
Quoted 9 lines · Laurent Vivier

The following changes since commit 7bc8f9734213b76e76631a483be13d6737c2adbc:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20191025' into staging (2019-10-25 13:12:16 +0100)

are available in the Git repository at:

git://github.com/vivier/qemu-m68k.git tags/q800-branch-pull-request

Quoted 8 lines

for you to fetch changes up to f7d85525f14b99aaa7bf561c9f3cf11c85a080c9:

BootLinuxConsoleTest: Test the Quadra 800 (2019-10-28 19:07:22 +0100)

----------------------------------------------------------------
Add Macintosh Quadra 800 machine in hw/m68k

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.

-- PMM