From patchwork Sat Jan 6 21:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13512802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C89A5C47074 for ; Sat, 6 Jan 2024 21:07:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMDru-0005kH-4F; Sat, 06 Jan 2024 16:06:10 -0500 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 1rMDrr-0005hh-E4; Sat, 06 Jan 2024 16:06:07 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMDrp-0001BU-NZ; Sat, 06 Jan 2024 16:06:07 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-555e07761acso716881a12.0; Sat, 06 Jan 2024 13:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704575163; x=1705179963; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=beCClsHMmqcMkMYgwQdfXIKn37AYMjOXEPxAk81UJRk=; b=DgPDNcF8drqPgAcBBrzGxS/dfz5BBaz1q9H35ny5BTx2wS283LHzK+xjX0pCRqa7Pp 0dRt9+4mSiDvWIft7HAJmIbJ3VeqOiT6XaJ7ZsRQH1s7RDnVHsLqlFhftFItELV2NqHl tkZF42/1HiKn8nwbvcxln1dvX1u0RcFHAsYARVq6/Lmld2Q0PbVywcr3bNYduhgsE8JH 3EE6CvBQRuHKm0u7KofGET4gCkWJ+BuueVoSCYnhXRoKw63z5Bri1M3tujEqn43ZlH+v YcQyGgfRJK/8U0rzdaY5uXUeR4PDuU3HUWrfWqfm6XcrELbXkmxD/bQy2lTAOah2F7lD MmsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704575163; x=1705179963; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=beCClsHMmqcMkMYgwQdfXIKn37AYMjOXEPxAk81UJRk=; b=O9sP9I5ykDPHLSez4kWQKo2bMTvjtf9H4i4EuYcIzE77GbjTV5DRIhjFNEvcnKj8HS DjlXug4NK0ks3G0z8SEwZem6jqp63wrV94rPhYgZbwu5LKWYlrjT9cZDsNMtJHoakYJ2 lkvBbNiPJLW+CwktDqQ3+OQsWKclUZ9FrMYkLBxBGxppbnu2XvIzo3cyEJl7xhaTP0tR 2vyw6NJJ1ojQEBUJHnBJFLoOfcgA/uGGkyLPsWli4z3Td69XJsaRM8yNxvxEbRCzn1J8 qCrqHGZsuBK6a6bSe/gZUvysIBz3PiBC7TSQSrlUojcGwNWn5rtX2UOgyW4HXb0QjyxE czPQ== X-Gm-Message-State: AOJu0YxNHaW+1zrZuIu5LHDWuzMVK+c0KOHR9ezqM1gJ5cVhLwbwRki+ 76XgUnRCwQOXzQn3Xx+ZrvkIymlRlSM= X-Google-Smtp-Source: AGHT+IFMwTHj4D+JHoC4lxMaM3UMO8U5yzCZNNCv0vBsKo6BEwB7nI6hVlmYOq3JaNqbyow8FiTg+A== X-Received: by 2002:a05:6402:1cab:b0:556:9ccb:33c9 with SMTP id cz11-20020a0564021cab00b005569ccb33c9mr480617edb.111.1704575163282; Sat, 06 Jan 2024 13:06:03 -0800 (PST) Received: from archlinux.. (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id f20-20020a056402195400b005576f4471besm624922edz.42.2024.01.06.13.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 13:06:02 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Artyom Tarasenko , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fabiano Rosas , Jiaxun Yang , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?b?RnLDqWTDqXJp?= =?utf-8?b?YyBCYXJyYXQ=?= , John Snow , qemu-block@nongnu.org, Kevin Wolf , Thomas Huth , Richard Henderson , Nicholas Piggin , Aleksandar Rikalo , Peter Xu , BALATON Zoltan , Leonardo Bras , Paolo Bonzini , "Michael S. Tsirkin" , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, David Hildenbrand , Marcel Apfelbaum , Sergio Lopez , Hanna Reitz , Mark Cave-Ayland , =?utf-8?q?Herv=C3=A9_Pous?= =?utf-8?q?sineau?= , Bernhard Beschow Subject: [PATCH v4 10/11] hw/ppc/pegasos2: Let pegasos2 machine configure SuperI/O functions Date: Sat, 6 Jan 2024 22:05:30 +0100 Message-ID: <20240106210531.140542-11-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106210531.140542-1-shentey@gmail.com> References: <20240106210531.140542-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=shentey@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This is a preparation for implementing relocation and toggling of SuperI/O functions in the VT8231 device model. Upon reset, all SuperI/O functions will be deactivated, so in case if no -bios is given, let the machine configure those functions the same way Pegasos II firmware would do. Signed-off-by: Bernhard Beschow Reviewed-by: BALATON Zoltan --- hw/ppc/pegasos2.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 3203a4a728..0a40ebd542 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -285,6 +285,15 @@ static void pegasos2_pci_config_write(Pegasos2MachineState *pm, int bus, pegasos2_mv_reg_write(pm, pcicfg + 4, len, val); } +static void pegasos2_superio_write(Pegasos2MachineState *pm, uint32_t addr, + uint32_t val) +{ + AddressSpace *as = CPU(pm->cpu)->as; + + stb_phys(as, PCI1_IO_BASE + 0x3f0, addr); + stb_phys(as, PCI1_IO_BASE + 0x3f1, val); +} + static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason) { Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine); @@ -310,6 +319,12 @@ static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason) pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | PCI_INTERRUPT_LINE, 2, 0x9); + pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | + 0x50, 1, 0x6); + pegasos2_superio_write(pm, 0xf4, 0xbe); + pegasos2_superio_write(pm, 0xf6, 0xef); + pegasos2_superio_write(pm, 0xf7, 0xfc); + pegasos2_superio_write(pm, 0xf2, 0x14); pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) | 0x50, 1, 0x2); pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |