From patchwork Wed Jul 31 04:58:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1966852 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ZiS5WyNn; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=Cojh/96J; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WYhKW2RhWz1yYq for ; Wed, 31 Jul 2024 16:00:45 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1Wvq5iioWqqrGhpzgnPYnNDzOcxkL4iualUDHnFsM5E=; b=ZiS5WyNndNNOaB 2cdDxiq7LLTZTrq7+l6vMei8RgF3RwIoNN2Pl4BBqNEjVpVXTkwk4VfC/jzPi8hMQWVA4gCDaJDCU yLdDow+BaJ3LWHrn4tumVFhFcgF/uaJHCEKNeDq+jwfLgqYSw6rzX283Ya60Z9Bwfhuu/zZ9h+jBq jo8oAuAtFMB8Wn93aNzi8Fo0mCmeyVfRlHvc2f7fogLw5UlgnQUybTHjkhkR2qU2t5p8cA+fLd9CM gDVNELqlw5apE+OWUmLHlGKmR2e6cBN3anxdlAgk3xCKWEezbq9N3l6frSbCkSWGlSZulONZcbksX g9J9VaqAoJ+23Z4As03w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZ2OA-0000000HRxp-05QD; Wed, 31 Jul 2024 06:00:42 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZ1RH-0000000HKXC-2zlV for opensbi@lists.infradead.org; Wed, 31 Jul 2024 05:00:02 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1fc6ee64512so36945415ad.0 for ; Tue, 30 Jul 2024 21:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1722401991; x=1723006791; darn=lists.infradead.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=HiiD3EAGwi0hOBdTfRXW/ecDTL8NjMm602GbRCUpQnc=; b=Cojh/96JrEDokcRyInhGGt7Y6v4D1KO2hK7WJBKcJ1fhO2nhHuz6YupkWd59k6S77Z D5pSNfZ66VWIeUm1YzRObfZvGrcg12hEcgMbuPZcQiBisKydStRRmruBJW28vh+hHYhM h+UPZCJtbP5l+26LBPVP7T5BlolIheG58XYMhCbuVvFjXBxABgHyk+BZKKLqN2BWu94v a2e1FBjX05aLJ4FbZoWJR10GgwkXK8mA3e17KcD4Lqqa84+Bypi4vAd4C8k7XICgp6nD Wb763A2quIQw+c31j0C2tew8s1L52KHE/LUTMNJb+0sXwZMVRipZ6/5ThglYmJDfPcF2 bKKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722401991; x=1723006791; 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=HiiD3EAGwi0hOBdTfRXW/ecDTL8NjMm602GbRCUpQnc=; b=jIBCFYdFB+Pk39+MyGDTGSagIRRzZVaQWGw2jmb6KfVH8AF79F1Hbc8EkB7NWWmMWl e32QmuvEoM93AEXYAj6/wCIGtiNwCCKRO9eS5E9LjONXBgQwo/s3hMMfe7Lwfuxmhot6 32cXC6u8XSoZ2Mw0i/BjtuR1wcdOl6Gop9IvJId5jDr90KshEIHZ7bpyWC9wJn3Zzx6Q 7jKTF4u3ak9b5F1IjLuX63IyE/Fp85Q4gDNowWovoR/IZWqfkXgMfkz67e4gPtkYUW0v WV5OEatO347nmkAo5cK2EoWn1jButMZvW/vfCutj6xorcO+E12iPrNqe9abIfNbyLR/y 7daQ== X-Gm-Message-State: AOJu0YwSNTQEjc7sZhBTJ6Pa5c306zA6uCllfbIWNSHDyZf+cPhXFXul RNcOxSg1ELPg+cUp0SSWLiHjo3tbCS2Zzd0GRO5Q+mZXfcJJJRyetJf0gwobsocHoqvJr58GUtp xHcXjacWiis3MJ/6VZZjkj7xo3iFZeNmodvcvijfTA361MrJpVoSwPe+al09aCGuTEN1KBQ112k kowMHEPYF4/qkVOAuTI0Zm+/g26yH6umcruF9x05Fn71ZnsSrS6As= X-Google-Smtp-Source: AGHT+IHCx1Bagw9naPT669BL899RpQnkdcZ6LvhHJcuE0WpHW/1RvOurN4bO2kGNzkNt4isVx5u+9A== X-Received: by 2002:a17:902:d2cd:b0:1fd:78dd:8578 with SMTP id d9443c01a7336-1ff0492d5ebmr120232985ad.55.1722401990615; Tue, 30 Jul 2024 21:59:50 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7ccd777sm110569535ad.75.2024.07.30.21.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 21:59:50 -0700 (PDT) From: Samuel Holland To: opensbi@lists.infradead.org Subject: [PATCH 15/16] lib: utils/serial: Pass the FDT to fdt_serial_init() Date: Tue, 30 Jul 2024 21:58:56 -0700 Message-ID: <20240731045931.2446799-16-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240731045931.2446799-1-samuel.holland@sifive.com> References: <20240731045931.2446799-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240730_215952_365519_D1125AB7 X-CRM114-Status: GOOD ( 14.09 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Indicate that this function does not modify the FDT blob, and deduplicate the call to fdt_get_address(). Signed-off-by: Samuel Holland --- include/sbi_utils/serial/fdt_serial.h | 4 ++-- lib/utils/serial/fdt_serial.c | 3 +-- platform/generic/platform.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:629 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Indicate that this function does not modify the FDT blob, and deduplicate the call to fdt_get_address(). Signed-off-by: Samuel Holland --- include/sbi_utils/serial/fdt_serial.h | 4 ++-- lib/utils/serial/fdt_serial.c | 3 +-- platform/generic/platform.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/sbi_utils/serial/fdt_serial.h b/include/sbi_utils/serial/fdt_serial.h index a0053a16..572475c9 100644 --- a/include/sbi_utils/serial/fdt_serial.h +++ b/include/sbi_utils/serial/fdt_serial.h @@ -19,11 +19,11 @@ struct fdt_serial { int (*init)(const void *fdt, int nodeoff, const struct fdt_match *match); }; -int fdt_serial_init(void); +int fdt_serial_init(const void *fdt); #else -static inline int fdt_serial_init(void) { return 0; } +static inline int fdt_serial_init(const void *fdt) { return 0; } #endif diff --git a/lib/utils/serial/fdt_serial.c b/lib/utils/serial/fdt_serial.c index 6f995cf7..a2a96cb2 100644 --- a/lib/utils/serial/fdt_serial.c +++ b/lib/utils/serial/fdt_serial.c @@ -17,13 +17,12 @@ extern struct fdt_serial *fdt_serial_drivers[]; extern unsigned long fdt_serial_drivers_size; -int fdt_serial_init(void) +int fdt_serial_init(const void *fdt) { const void *prop; struct fdt_serial *drv; const struct fdt_match *match; int pos, noff = -1, len, coff, rc; - const void *fdt = fdt_get_address(); /* Find offset of node pointed to by stdout-path */ coff = fdt_path_offset(fdt, "/chosen"); diff --git a/platform/generic/platform.c b/platform/generic/platform.c index 2850d55d..7c809b00 100644 --- a/platform/generic/platform.c +++ b/platform/generic/platform.c @@ -230,7 +230,7 @@ static int generic_early_init(bool cold_boot) if (semihosting_enabled()) rc = semihosting_init(); else - rc = fdt_serial_init(); + rc = fdt_serial_init(fdt); if (rc) return rc; }