From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Artyom Tarasenko" <atar4qemu@gmail.com>
Subject: [PATCH-for-6.1 2/3] hw/sparc/sun4m: Factor out sun4m_machine_class_common_init()
Date: Wed, 7 Apr 2021 19:53:04 +0200 [thread overview]
Message-ID: <20210407175305.1771069-3-f4bug@amsat.org> (raw)
In-Reply-To: <20210407175305.1771069-1-f4bug@amsat.org>
Some MachineClass fields are common to all sun4m machines.
Factor setting these fields out in a common helper:
sun4m_machine_class_common_init().
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/sparc/sun4m.c | 53 ++++++++++++++++--------------------------------
1 file changed, 17 insertions(+), 36 deletions(-)
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 543a52a8fc8..a0d0624e41b 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -1427,18 +1427,23 @@ static void sbook_init(MachineState *machine)
sun4m_hw_init(&sun4m_hwdefs[8], machine);
}
+static void sun4m_machine_class_common_init(MachineClass *mc)
+{
+ mc->block_default_type = IF_SCSI;
+ mc->default_boot_order = "c";
+ mc->default_display = "tcx";
+ mc->default_ram_id = "sun4m.ram";
+}
+
static void ss5_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
mc->desc = "Sun4m platform, SPARCstation 5";
mc->init = ss5_init;
- mc->block_default_type = IF_SCSI;
mc->is_default = true;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo ss5_type = {
@@ -1453,12 +1458,9 @@ static void ss10_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCstation 10";
mc->init = ss10_init;
- mc->block_default_type = IF_SCSI;
mc->max_cpus = 4;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-SuperSparc-II");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo ss10_type = {
@@ -1473,12 +1475,9 @@ static void ss600mp_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCserver 600MP";
mc->init = ss600mp_init;
- mc->block_default_type = IF_SCSI;
mc->max_cpus = 4;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-SuperSparc-II");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo ss600mp_type = {
@@ -1493,12 +1492,9 @@ static void ss20_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCstation 20";
mc->init = ss20_init;
- mc->block_default_type = IF_SCSI;
mc->max_cpus = 4;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-SuperSparc-II");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo ss20_type = {
@@ -1513,11 +1509,8 @@ static void voyager_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCstation Voyager";
mc->init = vger_init;
- mc->block_default_type = IF_SCSI;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo voyager_type = {
@@ -1532,11 +1525,8 @@ static void ss_lx_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCstation LX";
mc->init = ss_lx_init;
- mc->block_default_type = IF_SCSI;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-MicroSparc-I");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo ss_lx_type = {
@@ -1551,11 +1541,8 @@ static void ss4_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCstation 4";
mc->init = ss4_init;
- mc->block_default_type = IF_SCSI;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo ss4_type = {
@@ -1570,11 +1557,8 @@ static void scls_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCClassic";
mc->init = scls_init;
- mc->block_default_type = IF_SCSI;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-MicroSparc-I");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo scls_type = {
@@ -1589,11 +1573,8 @@ static void sbook_class_init(ObjectClass *oc, void *data)
mc->desc = "Sun4m platform, SPARCbook";
mc->init = sbook_init;
- mc->block_default_type = IF_SCSI;
- mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-MicroSparc-I");
- mc->default_display = "tcx";
- mc->default_ram_id = "sun4m.ram";
+ sun4m_machine_class_common_init(mc);
}
static const TypeInfo sbook_type = {
--
2.26.3
next prev parent reply other threads:[~2021-04-07 17:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-07 17:53 [PATCH-for-6.1 0/3] hw/sparc/sun4m: Introduce Sun4mMachineClass to access sun4m_hwdefs Philippe Mathieu-Daudé
2021-04-07 17:53 ` [PATCH-for-6.1 1/3] hw/sparc/sun4m: Introduce TYPE_SUN4M_MACHINE and Sun4mMachineClass Philippe Mathieu-Daudé
2021-04-07 17:53 ` Philippe Mathieu-Daudé [this message]
2021-04-07 17:53 ` [PATCH-for-6.1 3/3] hw/sparc/sun4m: Make sun4m_hwdefs a Sun4mMachineClass field Philippe Mathieu-Daudé
2021-05-02 11:20 ` [PATCH-for-6.1 0/3] hw/sparc/sun4m: Introduce Sun4mMachineClass to access sun4m_hwdefs Mark Cave-Ayland
2021-05-02 17:40 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210407175305.1771069-3-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=atar4qemu@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).