From nobody Wed Nov 5 14:46:46 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535609585414426.89442893666126; Wed, 29 Aug 2018 23:13:05 -0700 (PDT) Received: from localhost ([::1]:47279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvGCW-0002fw-EJ for importer@patchew.org; Thu, 30 Aug 2018 02:13:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvGBE-0000wg-39 for qemu-devel@nongnu.org; Thu, 30 Aug 2018 02:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvGBB-0002pg-7r for qemu-devel@nongnu.org; Thu, 30 Aug 2018 02:11:44 -0400 Received: from chuckie.co.uk ([82.165.15.123]:40028 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 1fvGBA-0002pG-Vs for qemu-devel@nongnu.org; Thu, 30 Aug 2018 02:11:41 -0400 Received: from [86.188.254.49] (helo=kentang.int.eigen.co) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fvGBM-0006W2-SY; Thu, 30 Aug 2018 07:11:53 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Thu, 30 Aug 2018 07:11:28 +0100 Message-Id: <20180830061129.4157-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830061129.4157-1-mark.cave-ayland@ilande.co.uk> References: <20180830061129.4157-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.188.254.49 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 X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 1/2] sabre: generate correct fw path for sabre PCI host bridge 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" Set the fw_name property to "pci" and also set an explicit OFW address using the value of the special_base property. Signed-off-by: Mark Cave-Ayland --- hw/pci-host/sabre.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/pci-host/sabre.c b/hw/pci-host/sabre.c index e2f4ee480e..e33bd46967 100644 --- a/hw/pci-host/sabre.c +++ b/hw/pci-host/sabre.c @@ -496,6 +496,15 @@ static const TypeInfo sabre_pci_info =3D { }, }; =20 +static char *sabre_ofw_unit_address(const SysBusDevice *dev) +{ + SabreState *s =3D SABRE_DEVICE(dev); + + return g_strdup_printf("%x,%x", + (uint32_t)((s->special_base >> 32) & 0xffffffff), + (uint32_t)(s->special_base & 0xffffffff)); +} + static Property sabre_properties[] =3D { DEFINE_PROP_UINT64("special-base", SabreState, special_base, 0), DEFINE_PROP_UINT64("mem-base", SabreState, mem_base, 0), @@ -505,11 +514,14 @@ static Property sabre_properties[] =3D { static void sabre_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + SysBusDeviceClass *sbc =3D SYS_BUS_DEVICE_CLASS(klass); =20 dc->realize =3D sabre_realize; dc->reset =3D sabre_reset; dc->props =3D sabre_properties; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); + dc->fw_name =3D "pci"; + sbc->explicit_ofw_unit_address =3D sabre_ofw_unit_address; } =20 static const TypeInfo sabre_info =3D { --=20 2.11.0 From nobody Wed Nov 5 14:46:46 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535609585885399.18204438952125; Wed, 29 Aug 2018 23:13:05 -0700 (PDT) Received: from localhost ([::1]:47280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvGCW-0002g9-Rd for importer@patchew.org; Thu, 30 Aug 2018 02:13:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvGBE-0000wh-38 for qemu-devel@nongnu.org; Thu, 30 Aug 2018 02:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvGBC-0002qx-Ep for qemu-devel@nongnu.org; Thu, 30 Aug 2018 02:11:44 -0400 Received: from chuckie.co.uk ([82.165.15.123]:40029 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 1fvGBC-0002qg-88 for qemu-devel@nongnu.org; Thu, 30 Aug 2018 02:11:42 -0400 Received: from [86.188.254.49] (helo=kentang.int.eigen.co) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fvGBO-0006W2-1Q; Thu, 30 Aug 2018 07:11:55 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Thu, 30 Aug 2018 07:11:29 +0100 Message-Id: <20180830061129.4157-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180830061129.4157-1-mark.cave-ayland@ilande.co.uk> References: <20180830061129.4157-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.188.254.49 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 X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 2/2] sun4u: implement custom FWPathProvider 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" This enables the correct generation of bootdevice fw paths for in-built IDE and virtio-pci-blk devices suitable for OpenBIOS. Note we also set the MachineClass ignore_boot_device_suffixes property to t= rue to allow the correct customisation of the disk node names as required. Signed-off-by: Mark Cave-Ayland --- hw/sparc64/sun4u.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 58 insertions(+) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index d16843b30e..f76b19e4e9 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -51,6 +51,7 @@ #include "hw/ide.h" #include "hw/ide/pci.h" #include "hw/loader.h" +#include "hw/fw-path-provider.h" #include "elf.h" #include "trace.h" =20 @@ -693,6 +694,56 @@ enum { sun4v_id =3D 64, }; =20 +/* + * Implementation of an interface to adjust firmware path + * for the bootindex property handling. + */ +static char *sun4u_fw_dev_path(FWPathProvider *p, BusState *bus, + DeviceState *dev) +{ + PCIDevice *pci; + IDEBus *ide_bus; + IDEState *ide_s; + int bus_id; + + if (!strcmp(object_get_typename(OBJECT(dev)), "pbm-bridge")) { + pci =3D PCI_DEVICE(dev); + + if (PCI_FUNC(pci->devfn)) { + return g_strdup_printf("pci@%x,%x", PCI_SLOT(pci->devfn), + PCI_FUNC(pci->devfn)); + } else { + return g_strdup_printf("pci@%x", PCI_SLOT(pci->devfn)); + } + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-drive")) { + ide_bus =3D IDE_BUS(qdev_get_parent_bus(dev)); + ide_s =3D idebus_active_if(ide_bus); + bus_id =3D ide_bus->bus_id; + + if (ide_s->drive_kind =3D=3D IDE_CD) { + return g_strdup_printf("ide@%x/cdrom", bus_id); + } + + return g_strdup_printf("ide@%x/disk", bus_id); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-hd")) { + return g_strdup("disk"); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-cd")) { + return g_strdup("cdrom"); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "virtio-blk-device")) { + return g_strdup("disk"); + } + + return NULL; +} + static const struct hwdef hwdefs[] =3D { /* Sun4u generic PC-like machine */ { @@ -723,6 +774,7 @@ static void sun4v_init(MachineState *machine) static void sun4u_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); + FWPathProviderClass *fwc =3D FW_PATH_PROVIDER_CLASS(oc); =20 mc->desc =3D "Sun4u platform"; mc->init =3D sun4u_init; @@ -731,12 +783,18 @@ static void sun4u_class_init(ObjectClass *oc, void *d= ata) mc->is_default =3D 1; mc->default_boot_order =3D "c"; mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi"); + mc->ignore_boot_device_suffixes =3D true; + fwc->get_dev_path =3D sun4u_fw_dev_path; } =20 static const TypeInfo sun4u_type =3D { .name =3D MACHINE_TYPE_NAME("sun4u"), .parent =3D TYPE_MACHINE, .class_init =3D sun4u_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_FW_PATH_PROVIDER }, + { } + }, }; =20 static void sun4v_class_init(ObjectClass *oc, void *data) --=20 2.11.0