From patchwork Tue Jun 12 09:16:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 928228 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 414mRF3gN1z9s1B for ; Tue, 12 Jun 2018 20:32:25 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 414mRD3hSzzF49R for ; Tue, 12 Jun 2018 20:32:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=kaod.org (client-ip=87.98.184.158; helo=11.mo3.mail-out.ovh.net; envelope-from=clg@kaod.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org X-Greylist: delayed 4204 seconds by postgrey-1.36 at bilbo; Tue, 12 Jun 2018 20:32:04 AEST Received: from 11.mo3.mail-out.ovh.net (11.mo3.mail-out.ovh.net [87.98.184.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 414mQr0pFfzF49x for ; Tue, 12 Jun 2018 20:32:03 +1000 (AEST) Received: from player688.ha.ovh.net (unknown [10.109.122.118]) by mo3.mail-out.ovh.net (Postfix) with ESMTP id 363821BD1E1 for ; Tue, 12 Jun 2018 11:16:49 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-TOU-1-49-10.w86-201.abo.wanadoo.fr [86.201.141.10]) (Authenticated sender: clg@kaod.org) by player688.ha.ovh.net (Postfix) with ESMTPSA id 65472200D7; Tue, 12 Jun 2018 11:16:40 +0200 (CEST) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: skiboot@lists.ozlabs.org Date: Tue, 12 Jun 2018 11:16:36 +0200 Message-Id: <20180612091636.8159-1-clg@kaod.org> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 X-Ovh-Tracer-Id: 10340546221719981017 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedthedrkeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Subject: [Skiboot] [PATCH v2] plat/qemu: add PNOR support X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stewart Smith , Andrew Jeffery Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" To access the PNOR, OPAL/skiboot drives the BMC SPI controller using the iLPC2AHB device of the BMC SuperIO controller and accesses the flash contents using the LPC FW address space on which the PNOR is remapped. The QEMU PowerNV machine now integrates such models (SuperIO controller, iLPC2AHB device) and also a pseudo Aspeed SoC AHB memory space populated with the SPI controller registers (same model as for ARM). The AHB window giving access to the contents of the BMC SPI controller flash modules is mapped on the LPC FW address space. The change should be compatible for machine without PNOR support. Signed-off-by: Cédric Le Goater --- The resulting machine is quite hybrid as it is mixing ARM and PPC models but it is a good way to validate their exactitude and completeness. We still need to work on model for the LPC bus. Changes since v1: - added the preload ops so that a QEMU PowerNV machine can be started without a kernel and an initrd : qemu-system-ppc64 -m 2G -machine powernv -cpu POWER8 \ -bios ./skiboot.lid \ -drive file=./palmetto.pnor,format=raw,if=mtd \ -serial mon:stdio -nographic -nodefaults -snapshot platforms/qemu/qemu.c | 8 ++++++++ platforms/qemu/qemu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) Index: skiboot.git/platforms/qemu/qemu.c =================================================================== --- skiboot.git.orig/platforms/qemu/qemu.c +++ skiboot.git/platforms/qemu/qemu.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include /* BT config */ #define BT_IO_BASE 0xe4 @@ -78,6 +80,9 @@ static void qemu_ipmi_setenables(void) static void qemu_init(void) { + /* Initialize PNOR/NVRAM */ + pnor_init(); + /* Setup UART console for use by Linux via OPAL API */ set_opal_console(&uart_opal_con); @@ -241,6 +246,9 @@ static bool qemu_probe(void) psi_set_external_irq_policy(EXTERNAL_IRQ_POLICY_SKIBOOT); + /* Initialize AHB accesses via AST2400 */ + ast_io_init(); + /* Setup UART and use it as console */ uart_init(); @@ -254,5 +262,7 @@ DECLARE_PLATFORM(qemu) = { .external_irq = qemu_ext_irq_serirq_cpld, .cec_power_down = qemu_ipmi_power_down, .cec_reboot = qemu_ipmi_reboot, + .start_preload_resource = flash_start_preload_resource, + .resource_loaded = flash_resource_loaded, .terminate = ipmi_terminate, };