From nobody Wed Nov 27 18:48:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1697756105; cv=none; d=zohomail.com; s=zohoarc; b=IgrDJbQ3t0kTCoibC1nyAM2dAiockVVPPzYFLxeOPFoWrHJlrWO/SOOcBwTW+b/sTQ4VY5xHIoibO0wh5YpnPHoCRixaIhNbDjpAkrt2DNFapp+kmJEgx5ICIofbtnd+//pMqmmnJDirCGyOpdUwWhGbG4s61kdPVsLjWaESAcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697756105; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0GTq4MiX9MU0YA6VN0+lhNfLgF/iP9H189RcCPW800Y=; b=gWg7DCY+ZyMIovbsOi5XsUH27fntxZ8ojYTfYMOfWEiE2j3KQLV/aHPJ5Sy4AAPL0XAZhxZr7KFL5jpHQKG8HslHX5HMmlc8+enUOmFYKbF3Jx17VK4eBUK+bTdu4PIpmGPM5KEpOyodJCWWefyP6vgp3BMx2l4I0Dbv58v46h8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697756105624844.746103485731; Thu, 19 Oct 2023 15:55:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtbtO-0008D7-Sq; Thu, 19 Oct 2023 18:53:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtbtN-0008CI-KF for qemu-devel@nongnu.org; Thu, 19 Oct 2023 18:53:25 -0400 Received: from sin.source.kernel.org ([145.40.73.55]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtbtL-0002hM-7N for qemu-devel@nongnu.org; Thu, 19 Oct 2023 18:53:25 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7FBD5CE32A2; Thu, 19 Oct 2023 22:53:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A568EC433CA; Thu, 19 Oct 2023 22:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697755999; bh=xUiub3Sw3ZwDDeISNuMoM/nkTfKAh5F9xvHO+JTSKWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PKnwVv3OlVVg3QAoAxBI4ZGbaH2TSd47DzUBgNUHP9yi51PFVxB59vqAjusXiSRdJ bHaLQtO1YqplAjP3KT/b8TdppDjYXUUbq22OacHdCKHTsbBoo2lukKAIrZPbouhlkK T2tfBM10akKKaylSyqJsNAnucuyItergudE4oaDUG5jYwv/Wa6Llw/tDx5nlYP5vWn UFx/ZQn/XbhdnuofCrSAdS94QjQGF9WQ9YVF2e4/+ou3IoGWBrN4QGJZOsEEb3+Dob OMXBLRdRNUSm6kh3sbsq4zkAhrw5uQxEMDAqycp45artOzIuhfh15aknlSvnpuAy8R bNe3IDEnflLrA== From: deller@kernel.org To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson Subject: [PULL 11/11] hw/hppa: Add new HP C3700 machine Date: Fri, 20 Oct 2023 00:52:57 +0200 Message-ID: <20231019225257.383071-12-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019225257.383071-1-deller@kernel.org> References: <20231019225257.383071-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=145.40.73.55; envelope-from=deller@kernel.org; helo=sin.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1697756107160100005 Content-Type: text/plain; charset="utf-8" From: Helge Deller Add code to create an emulated C3700 machine. It includes the following components: - HP Powerbar SP2 Diva BMC card (serial port only) - PCI 4x serial card (for serial ports #1-#4) - USB OHCI controller with USB keyboard and USB mouse Signed-off-by: Helge Deller --- hw/hppa/machine.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 2bd02508a9..67d4d1b5e0 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -22,8 +22,10 @@ #include "hw/input/lasips2.h" #include "hw/net/lasi_82596.h" #include "hw/nmi.h" +#include "hw/usb.h" #include "hw/pci/pci.h" #include "hw/pci/pci_device.h" +#include "hw/pci-host/astro.h" #include "hw/pci-host/dino.h" #include "hw/misc/lasi.h" #include "hppa_hardware.h" @@ -300,6 +302,7 @@ static void machine_HP_common_init_tail(MachineState *m= achine, PCIBus *pci_bus) const char *initrd_filename =3D machine->initrd_filename; MachineClass *mc =3D MACHINE_GET_CLASS(machine); DeviceState *dev; + PCIDevice *pci_dev; char *firmware_filename; uint64_t firmware_low, firmware_high; long size; @@ -336,6 +339,36 @@ static void machine_HP_common_init_tail(MachineState *= machine, PCIBus *pci_bus) } } =20 + /* BMC board: HP Powerbar SP2 Diva (with console only) */ + pci_dev =3D pci_new(-1, "pci-serial"); + if (!lasi_dev) { + /* bind default keyboard/serial to Diva card */ + qdev_prop_set_chr(DEVICE(pci_dev), "chardev", serial_hd(0)); + } + qdev_prop_set_uint8(DEVICE(pci_dev), "prog_if", 0); + pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); + pci_config_set_vendor_id(pci_dev->config, PCI_VENDOR_ID_HP); + pci_config_set_device_id(pci_dev->config, 0x1048); + pci_set_word(&pci_dev->config[PCI_SUBSYSTEM_VENDOR_ID], PCI_VENDOR_ID_= HP); + pci_set_word(&pci_dev->config[PCI_SUBSYSTEM_ID], 0x1227); /* Powerbar = */ + + /* create a second serial PCI card when running Astro */ + if (!lasi_dev) { + pci_dev =3D pci_new(-1, "pci-serial-4x"); + qdev_prop_set_chr(DEVICE(pci_dev), "chardev1", serial_hd(1)); + qdev_prop_set_chr(DEVICE(pci_dev), "chardev2", serial_hd(2)); + qdev_prop_set_chr(DEVICE(pci_dev), "chardev3", serial_hd(3)); + qdev_prop_set_chr(DEVICE(pci_dev), "chardev4", serial_hd(4)); + pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); + } + + /* create USB OHCI controller for USB keyboard & mouse on Astro machin= es */ + if (!lasi_dev && machine->enable_graphics) { + pci_create_simple(pci_bus, -1, "pci-ohci"); + usb_create_simple(usb_bus_find(-1), "usb-kbd"); + usb_create_simple(usb_bus_find(-1), "usb-mouse"); + } + /* register power switch emulation */ qemu_register_powerdown_notifier(&hppa_system_powerdown_notifier); =20 @@ -520,6 +553,42 @@ static void machine_HP_B160L_init(MachineState *machin= e) machine_HP_common_init_tail(machine, pci_bus); } =20 +static AstroState *astro_init(void) +{ + DeviceState *dev; + + dev =3D qdev_new(TYPE_ASTRO_CHIP); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + + return ASTRO_CHIP(dev); +} + +/* + * Create HP C3700 workstation + */ +static void machine_HP_C3700_init(MachineState *machine) +{ + PCIBus *pci_bus; + AstroState *astro; + DeviceState *astro_dev; + MemoryRegion *addr_space =3D get_system_memory(); + + /* Create CPUs and RAM. */ + machine_HP_common_init_cpus(machine); + + /* Init Astro and the Elroys (PCI host bus chips). */ + astro =3D astro_init(); + astro_dev =3D DEVICE(astro); + memory_region_add_subregion(addr_space, ASTRO_HPA, + sysbus_mmio_get_region( + SYS_BUS_DEVICE(astro_dev), 0)); + pci_bus =3D PCI_BUS(qdev_get_child_bus(DEVICE(astro->elroy[0]), "pci")= ); + assert(pci_bus); + + /* Add SCSI discs, NICs, graphics & load firmware */ + machine_HP_common_init_tail(machine, pci_bus); +} + static void hppa_machine_reset(MachineState *ms, ShutdownCause reason) { unsigned int smp_cpus =3D ms->smp.cpus; @@ -599,9 +668,41 @@ static const TypeInfo HP_B160L_machine_init_typeinfo = =3D { }, }; =20 +static void HP_C3700_machine_init_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + NMIClass *nc =3D NMI_CLASS(oc); + + mc->desc =3D "HP C3700 workstation"; + mc->default_cpu_type =3D TYPE_HPPA_CPU; + mc->init =3D machine_HP_C3700_init; + mc->reset =3D hppa_machine_reset; + mc->block_default_type =3D IF_SCSI; + mc->max_cpus =3D HPPA_MAX_CPUS; + mc->default_cpus =3D 1; + mc->is_default =3D false; + mc->default_ram_size =3D 1024 * MiB; + mc->default_boot_order =3D "cd"; + mc->default_ram_id =3D "ram"; + mc->default_nic =3D "tulip"; + + nc->nmi_monitor_handler =3D hppa_nmi; +} + +static const TypeInfo HP_C3700_machine_init_typeinfo =3D { + .name =3D MACHINE_TYPE_NAME("C3700"), + .parent =3D TYPE_MACHINE, + .class_init =3D HP_C3700_machine_init_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_NMI }, + { } + }, +}; + static void hppa_machine_init_register_types(void) { type_register_static(&HP_B160L_machine_init_typeinfo); + type_register_static(&HP_C3700_machine_init_typeinfo); } =20 type_init(hppa_machine_init_register_types) --=20 2.41.0