From nobody Wed Nov 5 07:15:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533756100532104.24243316685795; Wed, 8 Aug 2018 12:21:40 -0700 (PDT) Received: from localhost ([::1]:45167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnU1R-0001fc-ET for importer@patchew.org; Wed, 08 Aug 2018 15:21:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnU0R-0000mN-AW for qemu-devel@nongnu.org; Wed, 08 Aug 2018 15:20:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnU0O-0001U8-4u for qemu-devel@nongnu.org; Wed, 08 Aug 2018 15:20:27 -0400 Received: from chuckie.co.uk ([82.165.15.123]:41483 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnU0N-0001Sb-Qi for qemu-devel@nongnu.org; Wed, 08 Aug 2018 15:20:24 -0400 Received: from host109-147-53-216.range109-147.btcentralplus.com ([109.147.53.216] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fnU0Y-0001Kd-Cl; Wed, 08 Aug 2018 20:20:35 +0100 From: Mark Cave-Ayland To: ehabkost@redhat.com, marcel.apfelbaum@gmail.com, lersek@redhat.com, qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:19:51 +0100 Message-Id: <20180808191951.23193-1-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 X-SA-Exim-Connect-IP: 109.147.53.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH] fw_cfg: add bootdevice-ignore-suffixes property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For the older machines (such as Mac and SPARC) the DT nodes representing bootdevices for disk nodes are irregular for mainly historical reasons. Since the majority of bootdevice nodes for these machines either do not hav= e a separate disk node or require different (custom) names then it is much easi= er to disable all suffixes for a particular machine by setting the ignore_suff= ixes parameter to get_boot_devices_list() to true, and customise the disk nodes = as required. Here we add a new bootdevice-ignore-suffixes property to the FW_CFG device = to allow the generation of disk suffixes to be controlled on a per-machine bas= is. Signed-off-by: Mark Cave-Ayland Reviewed-by: Eduardo Habkost --- hw/nvram/fw_cfg.c | 9 ++++++++- include/hw/nvram/fw_cfg.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index b23e7f64a8..52488b999f 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -861,7 +861,8 @@ static void fw_cfg_machine_reset(void *opaque) void *ptr; size_t len; FWCfgState *s =3D opaque; - char *bootindex =3D get_boot_devices_list(&len, false); + char *bootindex =3D get_boot_devices_list(&len, + s->bootdevice_ignore_suffixes); =20 ptr =3D fw_cfg_modify_file(s, "bootorder", (uint8_t *)bootindex, len); g_free(ptr); @@ -990,12 +991,18 @@ FWCfgState *fw_cfg_find(void) return FW_CFG(object_resolve_path_type("", TYPE_FW_CFG, NULL)); } =20 +static Property fw_cfg_properties[] =3D { + DEFINE_PROP_BOOL("bootdevice-ignore-suffixes", FWCfgState, + bootdevice_ignore_suffixes, false), + DEFINE_PROP_END_OF_LIST(), +}; =20 static void fw_cfg_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->reset =3D fw_cfg_reset; + dc->props =3D fw_cfg_properties; dc->vmsd =3D &vmstate_fw_cfg; } =20 diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index b2259cc4a3..848c83aef4 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -58,6 +58,7 @@ struct FWCfgState { uint16_t cur_entry; uint32_t cur_offset; Notifier machine_ready; + bool bootdevice_ignore_suffixes; =20 int fw_cfg_order_override; =20 --=20 2.11.0