From nobody Fri Apr 4 03:55:05 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741700814; cv=none; d=zohomail.com; s=zohoarc; b=hALQKpKhQeu1pRXNoYfHp1XhcZ5HrYHSOI8lcCxjRXRzoHED2uYYtMwvDiwBfUzmgMKIezkaPEccREL8nupkibY0VK/UWLHcedmVVdODGtI4nGAOe+RmjXXB1ZUmFoT9skLe/jzAoZU57nAeLwmEODMYJCZ+IyPxCInVICeFByA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741700814; 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=s/hwfz8W3nE/NCo2dN8T5chquYKvDoTqUnc1wA+QdPA=; b=OnptqLnwCk7KjuXrf8vciy5FBdnGRiCPC3ae2hHDV0hDO8bSMDX8/zx862Ar7tgjNVnrRMLseabTal15tt8lowCuOUdXcBldF9N8gJSZJNPWjqrvv31tkocxPlnZmZPTb/Zqy7O5so34koAdBpbh2G6d+oktt4vBn6oF3hM88Cw= 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 1741700814605940.5070134326189; Tue, 11 Mar 2025 06:46:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1trzKO-0007Py-LP; Tue, 11 Mar 2025 09:07:24 -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 1trzFD-0006Gz-S6; Tue, 11 Mar 2025 09:02:08 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1trzFB-0000NK-2c; Tue, 11 Mar 2025 09:02:03 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2f9b9c0088fso9069439a91.0; Tue, 11 Mar 2025 06:01:58 -0700 (PDT) Received: from wheely.local0.net ([118.208.151.101]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ff4e773dddsm11822318a91.12.2025.03.11.06.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 06:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741698115; x=1742302915; 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=s/hwfz8W3nE/NCo2dN8T5chquYKvDoTqUnc1wA+QdPA=; b=O/QuBAJs56ueGZj4zD8MuKojOmWcrp5l6QXRuxnZn/nTAyXUs1wjd6APbuyiNjdRQd solIe1mIl9LIfGrqDuyrnGUjjwYKxR67PwPAwvQuRg6V8ipwmr/BdstjSjpz8XXmb5EF JeLF5Pr2SBrFL0MRxCX0Q3s2iobFIZTBxLD5Tbp+aUp2Lg7iRFLShYTr3yTMaPimuKGD HtZa5nLuvULnZjHRmHVdtRfNTsh/CxX5j/HKWUbQbc6y1i0oJHx5Lqm08/skEPacs+A+ iPmgB0QAXYyHQ4KPU2WrAvXai4lNBh7qTi8dYo3oQIlu+Z0aEY143mczC5d8zNoxSmk7 V+Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741698115; x=1742302915; 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=s/hwfz8W3nE/NCo2dN8T5chquYKvDoTqUnc1wA+QdPA=; b=h+dQJEI3hCog9DQVtduQEK9Qw17eeNHg2xmS+sXqr6gNm/ixXEPesWZSj8VuG+ycX3 O+T7vbTaZlAWqVuMJTDo7jjtYJn5ipz4L51xRMHw2xsypFyFCmyA8/Dwg5/dEH4gg7M8 bo+MCeBtAm6VrBFEFCGkCpCPxYG+IYzlRVSTfmg7ohi7KWfcmoiTEeODRWiBpBr4qFm4 0o2E+5JqFezWoQG/t4sSL3Isbpqh5oXxxZK9TmOBKn2JEGE7wT1g456mtaQiaXrOpWdB X5F9bVMpBBVDUkSQEbIG0jVQf0r5QDR/DpVRjBdY/R3TTHUcJwK66NjsnShcSU86vFPJ aGkw== X-Forwarded-Encrypted: i=1; AJvYcCWYVe+ZYGJjCZ+inPdzPXHDvb6NksycyupyOCv8o0QrR5e0lqdbHy+Jt7bUtcPUbAsATkhPlU7QKQ==@nongnu.org X-Gm-Message-State: AOJu0YyabGuBYQ/ZemWWa/riuwo+yfXuhEB48Mm8PwP8fckfMX/7bRox iwRuuyvymTDMOCnvM3HGZwkmRYTVObObZlD35lX4MC5Fdbw+y4CiBhxifA== X-Gm-Gg: ASbGnctxMmqtSmHihD+qlX2672UbuL2Lskn6OESLcqfv7oaKqq/2daJUdjz9MCVA70Z +A5oX2g4qtUO5Ri9xyOX6c9SifSqEg0FcZMBQ+bihfSYsEYkxQ39Qd9vPfvd+G2Qdj6Aitq7tw1 tXYPEkb7iOuamMZ43iiGSMI6Rgs5/21tC3qMOkgmPzxjPUR8oP/ujGuguJhUt2UxGUu/9etIKXs 2cvPuPltq6b9jSPm44cZUUEzdKYHyP/7KjtYCFN+jhbu29btASLIT5Kk+CGT257NSFz/VBTwi1/ sKO2kE0wq8fE2I/Dbiu7xEU0MMtladdk8c9tXg8atoAUTtvNz85ppeTI/jw+LQ== X-Google-Smtp-Source: AGHT+IEfSr0Gudn4GDMIT4yBrRsINF1KjueLA3K/k+IuqK9TzELvKvXpXWwdPEKEfe5NbCoDvTjnCQ== X-Received: by 2002:a17:90b:528a:b0:2ee:5c9b:35c0 with SMTP id 98e67ed59e1d1-30100544832mr4123620a91.9.1741698115514; Tue, 11 Mar 2025 06:01:55 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, BALATON Zoltan Subject: [PULL 69/72] ppc/amigaone: Add default environment Date: Tue, 11 Mar 2025 22:58:03 +1000 Message-ID: <20250311125815.903177-70-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250311125815.903177-1-npiggin@gmail.com> References: <20250311125815.903177-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::1030; envelope-from=npiggin@gmail.com; helo=mail-pj1-x1030.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 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 @gmail.com) X-ZM-MESSAGEID: 1741700816155019000 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Initialise empty NVRAM with default values. This also enables IDE UDMA mode in AmigaOS that is faster but has to be enabled in environment due to problems with real hardware but that does not affect emulation so we can use faster defaults here. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin Message-ID: <4d63f88191612329e0ca8102c7c0d4fc626dc372.1740673173.git.balato= n@eik.bme.hu> Signed-off-by: Nicholas Piggin --- hw/ppc/amigaone.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c index feb2cf452c..1c6f2a944d 100644 --- a/hw/ppc/amigaone.c +++ b/hw/ppc/amigaone.c @@ -52,6 +52,28 @@ static const char dummy_fw[] =3D { #define NVRAM_ADDR 0xfd0e0000 #define NVRAM_SIZE (4 * KiB) =20 +static char default_env[] =3D + "baudrate=3D115200\0" + "stdout=3Dvga\0" + "stdin=3Dps2kbd\0" + "bootcmd=3Dboota; menu; run menuboot_cmd\0" + "boot1=3Dide\0" + "boot2=3Dcdrom\0" + "boota_timeout=3D3\0" + "ide_doreset=3Don\0" + "pci_irqa=3D9\0" + "pci_irqa_select=3Dlevel\0" + "pci_irqb=3D10\0" + "pci_irqb_select=3Dlevel\0" + "pci_irqc=3D11\0" + "pci_irqc_select=3Dlevel\0" + "pci_irqd=3D7\0" + "pci_irqd_select=3Dlevel\0" + "a1ide_irq=3D1111\0" + "a1ide_xfer=3DFFFF\0"; +#define CRC32_DEFAULT_ENV 0xb5548481 +#define CRC32_ALL_ZEROS 0x603b0489 + #define TYPE_A1_NVRAM "a1-nvram" OBJECT_DECLARE_SIMPLE_TYPE(A1NVRAMState, A1_NVRAM) =20 @@ -94,7 +116,7 @@ static void nvram_realize(DeviceState *dev, Error **errp) { A1NVRAMState *s =3D A1_NVRAM(dev); void *p; - uint32_t *c; + uint32_t crc, *c; =20 memory_region_init_rom_device(&s->mr, NULL, &nvram_ops, s, "nvram", NVRAM_SIZE, &error_fatal); @@ -113,12 +135,25 @@ static void nvram_realize(DeviceState *dev, Error **e= rrp) return; } } + crc =3D crc32(0, p + 4, NVRAM_SIZE - 4); + if (crc =3D=3D CRC32_ALL_ZEROS) { /* If env is uninitialized set defau= lt */ + *c =3D cpu_to_be32(CRC32_DEFAULT_ENV); + /* Also copies terminating \0 as env is terminated by \0\0 */ + memcpy(p + 4, default_env, sizeof(default_env)); + if (s->blk) { + blk_pwrite(s->blk, 0, sizeof(crc) + sizeof(default_env), p, 0); + } + return; + } if (*c =3D=3D 0) { *c =3D cpu_to_be32(crc32(0, p + 4, NVRAM_SIZE - 4)); if (s->blk) { blk_pwrite(s->blk, 0, 4, p, 0); } } + if (be32_to_cpu(*c) !=3D crc) { + warn_report("NVRAM checksum mismatch"); + } } =20 static const Property nvram_properties[] =3D { --=20 2.47.1