From patchwork Mon Jan 9 12:08:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640631 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2104996pvb; Mon, 9 Jan 2023 04:30:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXuOj7M+9wBcT5ONucW3X59v9RFUKkbRQb8aG0TmWB1Qu8EfpSmy7WHtjLUsCMoxpCUL9KGL X-Received: by 2002:ac8:4d42:0:b0:3a8:5d1:aaca with SMTP id x2-20020ac84d42000000b003a805d1aacamr82558640qtv.11.1673267411689; Mon, 09 Jan 2023 04:30:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267411; cv=none; d=google.com; s=arc-20160816; b=SQl44VNQKCXvwJ7rvCDqGni6UmwfxCaLEGD78B0X5fD/nfeU2+SvfijqAs9Cl1Irdn ewXv/w1+LklwFP5dv5mtunEG/x/GmpdDJJzZ7CiK9p61coFYEriEEmQD4YEdu8fbcAT8 DR+2K0YB3dHVKvH6OvfOpqNTU0x6vC/e4KRVQqxvTJwRuGqCYcpTJmIiNYKF6uwdHSF8 d89X5ZEPan22okiTSy9uc5PBRwFpBZbAx/5IwTXzmwqTQvXWx3G2OTRjB0HboXflZsDi 8KSyYDkZ7NINas9iUK3CStS21YJVhYCnDiyZHIMDnRiFhVdAs+QSJNcC1eCFxL8XCNSt 3foA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nfl9vSICdKM0NyWoDAVGk3SRqJjMJWSIIowMTStBvnw=; b=lDexHgt/G4rDUdJ5kOopqgFqO8H2sCCB8ASrUOF7uxQp5PAMnMmsOh1NxjyvbjKEYw +U1qAwfXVYD3B95Ww4Z7qdYmXCAU6rbQWV813WBiozUQo0hg9GfSQQ34XgTB7+K34u/r 0fVhaRU4ASATbOhZYWShsGdcfII+byqDh8L4eYFTyreeWyF4vRfRzUR08QUJoAKII16t 5zmBs9ffJoHt5MNTMpW/yOYAnkaDDY708gywEmibEzxMPv9seClcsMPbtsR49q2u1vl3 M7NOoEWG2P3DEM4/SLoz4+h+okTWGPQmYJEybmGXJ7aZF53Qq/WpcT/QX2YzSg3xHoOr sOVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="om2W/3DD"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bn11-20020a05622a1dcb00b003ab93dd883fsi4524339qtb.243.2023.01.09.04.30.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:30:11 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="om2W/3DD"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEqxw-0000Ba-EB; Mon, 09 Jan 2023 07:09:24 -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 1pEqxv-0000B9-99 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:23 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEqxs-00061W-5l for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:23 -0500 Received: by mail-wm1-x32a.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so6508757wms.4 for ; Mon, 09 Jan 2023 04:09:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=nfl9vSICdKM0NyWoDAVGk3SRqJjMJWSIIowMTStBvnw=; b=om2W/3DDStD8FxqLQespwo5dTpdpCesXi31T0xbE9BOX12rQOPigt4M+75N/gV6++i yjp6Cv9osl6uhgz/oF3VyxG6T+gPv07+mnQan951HGHSrqVlYqHF0G4acdQgJGQdndDU SfNwI9xNx/lWo1yvzI5HADM7FjCwcspqg52/4sIunGur9QI3STX0nGONGHgZy1NzN/nf QPzlYkasVt72u2kIiiM/qCAJvquEdzK5KiU9VUMPq+IdSCQPzDixVPT0kkm4Wa/lvzlK 9/CCp4ba6InAHzN1oBmJ28wmgf4Q77YJPSvTNy/tq1dRW+SJMO3QnphKrxYCpZScC1kX C58Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=nfl9vSICdKM0NyWoDAVGk3SRqJjMJWSIIowMTStBvnw=; b=jC5z29G4k9ofb6atSjA+6T/n34AUHnOAU3+SchNkQBTfVLOldp+PWJTfdveBFWX+A5 m6vXEVGD7D59eTWdmGWGPS0GVTm2cAuH9us0+J+HVZUC8PgGuuEjr+rPC2s4GvoylZ9e AuCHmWapVmYHN3ib0+TVbIttY1FuyhcIWXurrSrlJJcwfL/J5YpD6NoRdWt9IcdthKzG 9unHc94R8EmGE5HC/BNHm1EFeRjiqRVt7geTwj9QAQHZ4XfaxW6lUIf2Mu0HvpwpYSN5 lF70W5eHFSZgvQCugmakJ2P7sVrUgyyaHTYtlz0lbMPNq49QcmSALkEbiguVGOahJV97 ns9w== X-Gm-Message-State: AFqh2krcuGNog0R73WQ4uCpzRpVcDtMBIx/Gl+rJps5A1fbprgFQNeGa 7TPnpWMHTl6m2tDxVjRcHLffzYsSyWHenH19 X-Received: by 2002:a05:600c:4b1b:b0:3d2:1d51:2477 with SMTP id i27-20020a05600c4b1b00b003d21d512477mr56304360wmp.11.1673266158265; Mon, 09 Jan 2023 04:09:18 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id h15-20020a5d548f000000b002425dc49024sm8343577wrv.43.2023.01.09.04.09.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 09/21] hw/xtensa: Use generic DeviceState instead of PFlashCFI01 Date: Mon, 9 Jan 2023 13:08:21 +0100 Message-Id: <20230109120833.3330-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Nothing here requires access to PFlashCFI01 internal fields: use the inherited generic DeviceState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/xtensa/xtfpga.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index bce3a543b0..b039416fde 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -165,7 +165,7 @@ static void xtfpga_net_init(MemoryRegion *address_space, memory_region_add_subregion(address_space, buffers, ram); } -static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space, +static DeviceState *xtfpga_flash_init(MemoryRegion *address_space, const XtfpgaBoardDesc *board, DriveInfo *dinfo, int be) { @@ -183,7 +183,7 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space, sysbus_realize_and_unref(s, &error_fatal); memory_region_add_subregion(address_space, board->flash->base, sysbus_mmio_get_region(s, 0)); - return PFLASH_CFI01(dev); + return dev; } static uint64_t translate_phys_addr(void *opaque, uint64_t addr) @@ -231,7 +231,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) XtensaMxPic *mx_pic = NULL; qemu_irq *extints; DriveInfo *dinfo; - PFlashCFI01 *flash = NULL; + DeviceState *flash = NULL; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *dtb_filename = machine->dtb; @@ -459,7 +459,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) } } else { if (flash) { - MemoryRegion *flash_mr = pflash_cfi01_get_memory(DEVICE(flash)); + MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash); MemoryRegion *flash_io = g_malloc(sizeof(*flash_io)); uint32_t size = env->config->sysrom.location[0].size;