On 05/06/2023 13:41, Philippe Mathieu-Daudé wrote:
On 4/6/23 15:14, Mark Cave-Ayland wrote:
This will allow the q800-glue.h header to be included separately so that the
GLUE device can be referenced externally.
Signed-off-by: Mark Cave-Ayland <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
---
MAINTAINERS | 2 +
hw/m68k/meson.build | 2 +-
hw/m68k/q800-glue.c | 252 ++++++++++++++++++++++++++++++++++++
hw/m68k/q800.c | 238 +---------------------------------
include/hw/m68k/q800-glue.h | 50 +++++++
5 files changed, 306 insertions(+), 238 deletions(-)
create mode 100644 hw/m68k/q800-glue.c
create mode 100644 include/hw/m68k/q800-glue.h
diff --git a/hw/m68k/q800-glue.c b/hw/m68k/q800-glue.c
new file mode 100644
index 0000000000..793bdb110c
--- /dev/null
+++ b/hw/m68k/q800-glue.c
@@ -0,0 +1,252 @@
+/*
+ * QEMU q800 logic glue
Although mentioned later, could we describe as "GLUE (General
Logic Unit)" here?
Sure, I can fix this in v4.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
Or simpler:
* SPDX-License-Identifier: MIT
Thanks, I didn't realise that we could do this. In this particular case the header is
simply a copy of the one from q800.c where the code originated from, so my thinking
is that it makes sense to leave this for now and consider a wider update for the m68k
machines as a follow-up.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "hw/m68k/q800-glue.h"
+#include "hw/boards.h"
+#include "hw/irq.h"
+#include "hw/nmi.h"
+#include "hw/qdev-properties.h"
+#include "migration/vmstate.h"
+
+/*
+ * The GLUE (General Logic Unit) is an Apple custom integrated circuit chip
+ * that performs a variety of functions (RAM management, clock generation,
...).
+ * The GLUE chip receives interrupt requests from various devices,
+ * assign priority to each, and asserts one or more interrupt line to the
+ * CPU.
+ */
+static const TypeInfo glue_info = {
+ .name = TYPE_GLUE,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(GLUEState),
+ .instance_init = glue_init,
+ .instance_finalize = glue_finalize,
+ .class_init = glue_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_NMI },
+ { }
+ },
+};
+
+static void glue_register_types(void)
+{
+ type_register_static(&glue_info);
+}
> +
> +type_init(glue_register_types)
Soon DEFINE_TYPES() will be recommended over type_init().
I see, I'll add this as a separate patch in v4.
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Thanks!
ATB,
Mark.