From patchwork Sun Nov 24 20:26:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845213 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861455wru; Sun, 24 Nov 2024 12:27:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVK+1jIre2T6oRYU8Eh61BYXzrrNEUuwLLyw0fUtndJEB9st4rU4mSjlK+ZYko8GZ1230L+3Q==@linaro.org X-Google-Smtp-Source: AGHT+IHS+0ePfy0vAhSEFSjWL9AHiv5Xp+H5ht9HsyjImkwt9j3fBUgfkyTAkYA8xGTB2tgUmTSs X-Received: by 2002:a17:906:2192:b0:aa5:1a39:943e with SMTP id a640c23a62f3a-aa51a399a68mr735337666b.14.1732480068336; Sun, 24 Nov 2024 12:27:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480068; cv=none; d=google.com; s=arc-20240605; b=W1/zR0PQ1aXzX9B5NKwdd6Gg+JwRpwe0o3yuGmZmWXw/jRxqtHBF8xsitOkJkRCvNW aKQ69Zm8K6HlfqflGA6IqvqiGJDYmH8o4c7AYWQs7GFyZw2y6iA9f1VBLkT64Fq8S09N 7dQz9zvtrDajzVZYTsasz/JCxg+S+skzAm5V+Ug7ozdYAE8P9B3x81nySfnVoCf3dQNT ypFuWVmi0guz0d3HQPLA2fPc7m1TqBSLn5y7nwfcIF4zdXw2Id1mUvMAHng6A0zEbRvQ JF8YZqeeFvWM69SgXJZyCzByEMNlGhnYWA+NAR+l2scRvbJZ05WcLW/FdR9r1Cn0gVsv BlFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=wGD1GhtXJ8F866zgykZp3dszLanF5/yeU0imZRiMy5o=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=FC13XrxtJJ2mekDK0zbH2GFfF2r8pMUr5tsVJ/PBUOvfOPqAKF7K18jrmd6JbWi+2Z fbbP4Y4vGyFT7H8BZh7gn6ljhbubCdvbN9Jf1qjcuoCczTzXw/pmOhoC+dvoKOaKo2j8 6SF72BHPsSdcJIXTSLdJ8p5FYXwij3oCmnj9Wb8VZE6HYQJsHYtz/Yq9XCnKr5EO3IUl eTyDlL+ki4Z0rzAoaF3t6B2f+0a+nCbymKYchLRwJOL2+MSv700CWbz6EJZpfj5fWd55 yWL9jzg45eh12FzxBNVSc2pkktHAiOycKWqyxsX8wfAgPId2jAUzdVTGnUOR6RkBbkXF geCg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VLC60njb; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aa50b55727asi396825466b.551.2024.11.24.12.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:48 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VLC60njb; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3DC498954C; Sun, 24 Nov 2024 21:27:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VLC60njb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B3CFB895A0; Sun, 24 Nov 2024 21:27:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 54C4389559 for ; Sun, 24 Nov 2024 21:27:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-382423f4082so2676585f8f.3 for ; Sun, 24 Nov 2024 12:27:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480054; x=1733084854; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wGD1GhtXJ8F866zgykZp3dszLanF5/yeU0imZRiMy5o=; b=VLC60njbyB2SLCK50ibFSCiovPVeTBegcULJi2hagx20MVJCT6dKmXnEmBtleYmpoL 5x7AzN9eygaI8GtOK4OgNLdtVJ6b85jy8K5NIAIUPjbw/OByTLh1CMdtFjuQSkMJjftr ZZ+zUHbg89l0xCUE+Pzj1WSyMKXneKNMQn0xm8Q6La3fq1XQP6E07kvb6jDPXgKErsdD qhQ3NKkzw2c+acblq9DJZ8o5CGlRndvVmEC2a5+9YlmNbbvyotj/4qu/Q+nCT1+w0IjK aDg4UEfNxeTIdZICfb52o8tHy9OwTaJDHbl81TXHSwjoe1+onI2yYR6ZrHEl9N9NzmXB ICPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480054; x=1733084854; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wGD1GhtXJ8F866zgykZp3dszLanF5/yeU0imZRiMy5o=; b=PfTrdncWVXqHFJuS4JPfLvDnjRNe5Y624B5lDIEEX5ENUYEF1lgs+MNwcxO0Ejtxzn Wl1NNXWe0TCT355RD2bmkRFRN4hdV9ESqR+rvCfYKxvxpa+2ZCbqaYnjJ+IBxzZh9Wn/ Wco3FDcfPXvd7KpBpjeE5dIsHEz15AdUEt09IrJBNPcVrODdjguk6B7aZCf1uFZGf8Af ggmm03eX5YCtEBf+dCWxa2iBj0GybrOnpUJtUkyFUncHSRuva4qVi8dnT8EtO6NpDFPY Bic8FDk1qYtSHisDt7qAU9vhebcGNfjwO8mDkqoT9Vl8EsTHnWq8r+yW2A7JTbwHS0al Vsig== X-Gm-Message-State: AOJu0YxAzJ62w29jK6pefo1OuKh7beTEiDyfHQZXEAGyqwOuWg3vilzv LNqMlVkdKr7vvOdZ1crNuD6/d/dpJaOpO47A6rH0Mk/KeLr4kZrA5gY/Y78JZes= X-Gm-Gg: ASbGncvOKzgAv3vsy3Tv3HmVB3Y6gUCXagLwY5dtll8Ff8Wqv9R7kogDeLdDx12xQGC a6DWgqiHrAkvprbT7l90FL6jAo8mvw8KVxobhrgaT0EOvMZc+O/OFMa/9Dc34syMMTvB9AZCih4 qJXuTx4xK7mpw9k/7ZqBMSpYBXRKcxpkS8ngLpn3jsdFX3lg0Zh0NXuXE7Cst741y7u5r3L054n AZ9ZNmgwncYnA1qijnpwjt+cDI+T/0tE9T63/3iE4jFmnPNOZPcMUxooCqdgYyz8AIG X-Received: by 2002:a5d:5f53:0:b0:381:c5ee:9c00 with SMTP id ffacd0b85a97d-38260bcfc1fmr7891222f8f.47.1732480053822; Sun, 24 Nov 2024 12:27:33 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:32 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:26:57 +0100 Subject: [PATCH RFC 01/14] cmd: efi: avoid unitialized read MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-1-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=704; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=Nl+qdbCV4NoH9Kp6TULnfzVf2H4fibQxu7HWLZvEIG8=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHsPZgunblgnGVHC3tn46ffaLgdaDydViZ6VUSsImH N9S/mZ3RykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZjIYnaGfxrTnnuw9LH6ttmX Tn68ee+idKlttr4pEwT0ZnLOXuOyXJPhv/fvFeZPlvNf2xt1R2GtAndn/f75/s7RnItPSD11lJ1 tOhEA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The key variable might be unitialised when accessed for the printf(). Zero initialise it to avoid this. Signed-off-by: Caleb Connolly Reviewed-by: Ilias Apalodimas --- cmd/efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/efi.c b/cmd/efi.c index 687ccb520428..1fb67a83aae5 100644 --- a/cmd/efi.c +++ b/cmd/efi.c @@ -220,9 +220,9 @@ static void efi_print_mem_table(struct efi_mem_desc *desc, int desc_size, static int do_efi_mem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct efi_mem_desc *orig, *desc; - uint version, key; + uint version, key = 0; int desc_size; int size, ret; bool skip_bs; From patchwork Sun Nov 24 20:26:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845214 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861505wru; Sun, 24 Nov 2024 12:27:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX4uCm+T4Oq6MdUiNb/xbLvsQfXFjJ7bGXmtdyXYkraSA6cl6BkGjCN8hP0zxTmjD7kG3S3xQ==@linaro.org X-Google-Smtp-Source: AGHT+IEObvolhSeSPUqZahEglHMzxqlOR2I9ZzH4RYSRdU6ZlQ1Z5hSDgXV7vR9hSlsGpLX/4S3d X-Received: by 2002:a17:907:7809:b0:aa5:11fa:6271 with SMTP id a640c23a62f3a-aa511fa6405mr864156466b.49.1732480077785; Sun, 24 Nov 2024 12:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480077; cv=none; d=google.com; s=arc-20240605; b=KVA1Vb0MhDwzuPtrr1EXHeApUcpRO1xxMP93o6Wg8r0IhToG47YWE1zX4slUo5lih8 PUPSTQ9loh9Wumo/PJp7HVa2FV4eXLBdVMZb39RBm4JE9AFOp6joM7ecr4h08buwu3Pe R5Mxj8UV92EmX2qkINVhSTNJgmwTAINoeO9d85AxY2+5SfwW1qE/PYnS5HfZFKmHzx2o 7CZ/QqXWRQjGHe2naRPcAlSJw4RHmliXpkzeIUYog7g96dZC3e/TYIBsDm2dRQuiBbfe SGhH+7gmlQmns+FmA26mi1czapnPMCUt1W/fT1TAtRzkSuMxfXnCFz+qqbSMLCfH+t0g XlDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=CQ5Y5hBnuh3OHccVB+2889/FscgqQ4h3wZqGOAgHYKg=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=UiN9BFmZDslFbGCVVt3HntGCjJP+/pmx/K2GmOElFtdibz/EhHK1kd6cl1bOBS5Nr1 x/FpSaGpQ7c0I4xpJp3GZoHJFNDqT9Q4j6jPJsCWBe6GTsnE7tqIEr6d3ER4u+7EeO9Q xT6hYGJ2KVuz/XzjhQd9fZBitkT3mWM72aPsOePZaSzZ9Ve4Yh/N7Hd2OBU4YHkxoGnK hSndNUNJUvYSG9RFQddsdIJxU1Jb/WGXEm86c6A4MeoP6pP7mX/zWvTdWFPOIBASmA5t 5M+QTB4Bt/cOmZIEwr7Evz1u46FNiJdrfp1HGgf/Q8aMpj0FXXq+QFU8mHq9D/+nmtJN vnTg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aTXP3vHg; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa53b29eec2si188500866b.837.2024.11.24.12.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:57 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aTXP3vHg; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 924FC89507; Sun, 24 Nov 2024 21:27:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="aTXP3vHg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED6B0896E6; Sun, 24 Nov 2024 21:27:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2869589507 for ; Sun, 24 Nov 2024 21:27:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-aa52bb7beceso212517666b.3 for ; Sun, 24 Nov 2024 12:27:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480055; x=1733084855; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=CQ5Y5hBnuh3OHccVB+2889/FscgqQ4h3wZqGOAgHYKg=; b=aTXP3vHggvRXuIBCA7JRjH500fz6PTzGGJ6jUpkXs4rffB2c09Z7uHKrl8GrGqh2K6 T8VlKEshhlsdmXA0jO50wTBY7/n8GiTT9lcZg1utn1RlA7BhbNdoND0qlWxj4wpoovac 7GW2PtxTAy0C37HJ7dulY9x0hZffJccLKljX4B2NdQtcRwiHWrgEsJho0H1OXCGm9bl3 tx6UQOfLcLrEeuPlCtoXL8MmyCi4Pf0TrBE8YNXhONJ7l9wtxCWFcPF7t4xlzeLeUZ9G WODOjbaqnRCazh8KLGm/qCAxJCGwqulxnQdDUm6seAOJm/ky5Aui/37QrieX4kIjKLaO eRIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480055; x=1733084855; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CQ5Y5hBnuh3OHccVB+2889/FscgqQ4h3wZqGOAgHYKg=; b=wEoxvxBWP8X9Wn7vqcNb6c7FZO16i1kz4tSOhJ4Zag6jQlpc7jgtF7uMKZdLvFL46G 3D1Mztve5/4CQFWDoBVTrxZFfhbS6z28qPPlXB+e/Fn0sDfjpNjtp8TlvEvj8I/D8QfJ HpxdjQ2lWvO9POU8u/T17xVQEuVoem2ODC7TsYUHyO5nGJa949e+mAM928XzF9v6E7gt M8jWQ1Phig45tS6NeecgDR6LEzhxKZLuSf6BtkS3MNOjESc8us5OUKzp4y6Y47UvRUKV r0SQULYbSXYlway03DnS1wS/xYLZ/TGAdT45EoBl7NJT5BtkWOIZ+tTEA+rC3DqHpvks Wqqw== X-Gm-Message-State: AOJu0YyQ1Aq7yCgYfyC9wZ+BDKIXfykQciatpmk8oxc8rlZzjI4yLgYI rEgFsap+VJ/iFWbEeCVetJI26VbGqUYn7q3mgD0rR89tYkv7GFHExIEobf/2gziOPK84TiXFyYn GzdI= X-Gm-Gg: ASbGncubH7R5AA21zBhsO/SXcGu2SSkTUhnti8NA80S66e6F589dwJ5QN+8k9tQ94xl aoqFa2GuwC1aWUbyGozO0aTWVxJtU2BTl5FXwpOm7bCwgqPkV7pm+wXkpS3SuXz7f8xQKDve6pH weDZRM/e2wXwC3VhageMrrERGCGk6HLmiyPuW/cF/GNIQJaSwzDS31fh8EOCrX0UJ3zvxbsAwJf kLKsdodwI7DfRkaedxwIGT/Rbzk1QqPCF0k1RR9yi4MaqhampUn9g+h+iQpCyQlzGD2 X-Received: by 2002:a17:906:32cb:b0:aa5:52db:eebd with SMTP id a640c23a62f3a-aa552dbeeffmr97687266b.26.1732480055600; Sun, 24 Nov 2024 12:27:35 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:35 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:26:58 +0100 Subject: [PATCH RFC 02/14] efi: stub: support running U-Boot as an EFI payload on ARM64 MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-2-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=15393; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=k3WUy1eVrp84M7BzsIREhASHHRi6D3EBoNV3dwvT5QQ=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHsMoj8cPev1snAwb569LsP1wZ/W67MduF/Pn1/29J Z0lvNqwo5SFQZCDQVZMkUX8xDLLprWX7TW2L7gAM4eVCWQIAxenAEwk2ZHhr9Cxw7sZzuv0zvR7 8uqvX1L/pPt713G8nMLj3KKWuJal3p7hn3LEzUNn5l4K5Tm2aor7W5/MOWVbHlzYeWDK4p9vt16 PsnwFAA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Implement support for launching U-Boot via an EFI stub app on ARM64. This is more or less a straight port of the x86 implementation, but due to the highly x86/qemu specific nature of that implementation I decided to just split it out to its own file. Unlike the x86 implementation, there is no debug UART here since ARM platforms don't have a standard UART interface. However it is usually possible to port over the debug uart implementation for you platform for bringup purposes. Currently this implementation doesn't provide a DTB to U-Boot and expects U-Boot to use a built-in one, however this ought to be a fairly trivial addition in the future. The other significant difference to the x86 version is that rather than copying U-Boot to CONFIG_TEXT_OFFSET, we require that U-Boot is built position independent and copy it to EFI allocated memory. Signed-off-by: Caleb Connolly --- Makefile | 15 ++- arch/arm/cpu/armv8/config.mk | 11 ++ arch/arm/include/asm/global_data.h | 3 + arch/arm/lib/Makefile | 2 + include/efi.h | 2 +- lib/efi/Kconfig | 9 +- lib/efi/Makefile | 28 ++-- lib/efi/efi_info.c | 4 +- lib/efi/efi_stub_arm64.c | 236 +++++++++++++++++++++++++++++++++ lib/efi/{efi_stub.c => efi_stub_x86.c} | 0 10 files changed, 294 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index da742ceae76e..8d0340622d7c 100644 --- a/Makefile +++ b/Makefile @@ -1681,21 +1681,32 @@ u-boot.bin.o: u-boot.bin FORCE u-boot-payload.lds: $(LDSCRIPT_EFI) FORCE $(call if_changed_dep,cpp_lds) +# Determine the file suffix for the efi stub implementation +EFI_STUB_ARCH := $(if $(CONFIG_ARM64),arm64,$(if $(CONFIG_X86_64),x86,$(ARCH))) + # Rule to link the EFI payload which contains a stub and a U-Boot binary quiet_cmd_u-boot_payload ?= LD $@ cmd_u-boot_payload ?= $(LD) $(LDFLAGS_EFI_PAYLOAD) -o $@ \ - -T u-boot-payload.lds arch/x86/cpu/call32.o \ - lib/efi/efi.o lib/efi/efi_stub.o u-boot.bin.o \ + -T u-boot-payload.lds $(if $(CONFIG_X86),arch/x86/cpu/call32.o,) \ + lib/efi/efi.o lib/efi/efi_stub_$(EFI_STUB_ARCH).o u-boot.bin.o \ $(addprefix arch/$(ARCH)/lib/,$(EFISTUB)) +quiet_cmd_u-boot_payload_arm64.efi ?= OBJCOPY $@ + cmd_u-boot_payload_arm64.efi ?= $(OBJCOPY) -O binary u-boot-payload $@ + u-boot-payload: u-boot.bin.o u-boot-payload.lds FORCE $(call if_changed,u-boot_payload) OBJCOPYFLAGS_u-boot-payload.efi := $(OBJCOPYFLAGS_EFI) +ifeq ($(CONFIG_X86),y) u-boot-payload.efi: u-boot-payload FORCE $(call if_changed,zobjcopy) +else +u-boot-payload.efi: u-boot-payload FORCE + $(call if_changed,u-boot_payload_$(EFI_STUB_ARCH).efi) +endif u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE $(call if_changed,cat) diff --git a/arch/arm/cpu/armv8/config.mk b/arch/arm/cpu/armv8/config.mk index 4d74b2a533e0..1ee316801064 100644 --- a/arch/arm/cpu/armv8/config.mk +++ b/arch/arm/cpu/armv8/config.mk @@ -9,4 +9,15 @@ PLATFORM_CPPFLAGS += $(PF_NO_UNALIGNED) EFI_LDS := elf_aarch64_efi.lds EFI_CRT0 := crt0_aarch64_efi.o EFI_RELOC := reloc_aarch64_efi.o + +LDSCRIPT_EFI := $(srctree)/arch/arm/lib/elf_aarch64_efi.lds +EFISTUB := crt0_aarch64_efi.o reloc_aarch64_efi.o +OBJCOPYFLAGS_EFI += --target=pei-aarch64-little +EFIPAYLOAD_BFDTARGET := pei-aarch64-little +EFIPAYLOAD_BFDARCH := aarch64 +LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined \ + -s -zexecstack + +CPPFLAGS_REMOVE_crt0-efi-aarch64.o += $(CFLAGS_NON_EFI) +CPPFLAGS_crt0-efi-aarch64.o += $(CFLAGS_EFI) diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 45401d5e3c8a..6e4471662a38 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -107,8 +107,11 @@ struct arch_global_data { #endif #ifdef CONFIG_SMBIOS ulong smbios_start; /* Start address of SMBIOS table */ #endif +#ifdef CONFIG_EFI_STUB + ulong table; +#endif }; #include diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 1c95dd6fed21..14e3990925a7 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -130,4 +130,6 @@ CFLAGS_$(EFI_CRT0) := $(CFLAGS_EFI) CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI) CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI) CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI) + +extra-$(CONFIG_EFI_STUB) += $(EFI_CRT0) $(EFI_RELOC) diff --git a/include/efi.h b/include/efi.h index c559fda3004c..a6eff13a6bbb 100644 --- a/include/efi.h +++ b/include/efi.h @@ -496,9 +496,9 @@ struct efi_media_plat { /* Base address of the EFI image */ extern char image_base[]; /* Start and end of U-Boot image (for payload) */ -extern char _binary_u_boot_bin_start[], _binary_u_boot_bin_end[]; +extern char _binary_u_boot_bin_start[], _binary_u_boot_bin_end[], _binary_u_boot_bin_size[]; /* * Variable Attributes */ diff --git a/lib/efi/Kconfig b/lib/efi/Kconfig index 81ed3e66b34d..18f69bdcfbec 100644 --- a/lib/efi/Kconfig +++ b/lib/efi/Kconfig @@ -1,10 +1,10 @@ menu "U-Boot as UEFI application" - depends on X86 + depends on X86 || ARM config EFI bool "Support running U-Boot from EFI" - depends on X86 + depends on X86 || ARM imply X86_TSC_READ_BASE help U-Boot can be started from EFI on certain platforms. This allows EFI to perform most of the system init and then jump to U-Boot for @@ -12,12 +12,13 @@ config EFI application, with U-Boot using EFI's drivers instead of its own. choice prompt "Select EFI mode to use" - depends on X86 && EFI + depends on EFI config EFI_APP bool "Support running as an EFI application" + depends on !ARM select CHARSET help Build U-Boot as an application which can be started from EFI. This is useful for examining a platform in the early stages of porting @@ -25,8 +26,9 @@ config EFI_APP command prompt and memory and I/O functions. Use 'reset' to return to EFI. config EFI_STUB + select POSITION_INDEPENDENT if ARM bool "Support running as an EFI payload" endchoice @@ -58,8 +60,9 @@ choice 32-bit EFI, select 32-bit here, else select 64-bit. Failure to do this may produce no error message - it just won't start! config EFI_STUB_32BIT + depends on !ARM bool "Produce a stub for running with 32-bit EFI" config EFI_STUB_64BIT bool "Produce a stub for running with 64-bit EFI" diff --git a/lib/efi/Makefile b/lib/efi/Makefile index 232fa684360e..bf65bacf47e7 100644 --- a/lib/efi/Makefile +++ b/lib/efi/Makefile @@ -4,14 +4,24 @@ obj-$(CONFIG_EFI_APP) += efi_app.o efi.o efi_app_init.o obj-$(CONFIG_EFI_STUB) += efi_info.o -CFLAGS_REMOVE_efi_stub.o := -mregparm=3 \ - $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) -CFLAGS_efi_stub.o := -fpic -fshort-wchar \ - $(if $(CONFIG_EFI_STUB_64BIT),-m64) -CFLAGS_REMOVE_efi.o := -mregparm=3 \ - $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) -CFLAGS_efi.o := -fpic -fshort-wchar \ - $(if $(CONFIG_EFI_STUB_64BIT),-m64) +ifeq ($(CONFIG_ARM64),y) +efi_stub.o := efi_stub_arm64.o +else +efi_stub.o := efi_stub_x86.o -extra-$(CONFIG_EFI_STUB) += efi_stub.o efi.o +ifeq ($(CONFIG_EFI_STUB_64BIT),y) # && !CONFIG_ARM64 +CFLAGS_REMOVE_$(efi_stub.o) := -march=i386 -m32 +CFLAGS_$(efi_stub.o) := -m64 +CFLAGS_REMOVE_efi.o := -march=i386 -m32 +CFLAGS_efi.o := -fpic -m64 +endif +endif + +CFLAGS_REMOVE_$(efi_stub.o) += -mregparm=3 +CFLAGS_$(efi_stub.o) += -fpic -fshort-wchar +CFLAGS_REMOVE_efi.o += -mregparm=3 +CFLAGS_efi.o += -fpic -fshort-wchar + +$(info removing flags $(CFLAGS_REMOVE_$(efi_stub.o))) +extra-$(CONFIG_EFI_STUB) += $(efi_stub.o) efi.o diff --git a/lib/efi/efi_info.c b/lib/efi/efi_info.c index 5b564c5651d5..5fa4baeec635 100644 --- a/lib/efi/efi_info.c +++ b/lib/efi/efi_info.c @@ -9,8 +9,10 @@ #include #include #include +DECLARE_GLOBAL_DATA_PTR; + int efi_info_get(enum efi_entry_t type, void **datap, int *sizep) { struct efi_entry_hdr *entry; struct efi_info_hdr *info; @@ -41,6 +43,6 @@ int efi_info_get(enum efi_entry_t type, void **datap, int *sizep) ret = -ENOENT; err: unmap_sysmem(info); - return ret; + return -ENOSYS; } diff --git a/lib/efi/efi_stub_arm64.c b/lib/efi/efi_stub_arm64.c new file mode 100644 index 000000000000..54bee6c55d7e --- /dev/null +++ b/lib/efi/efi_stub_arm64.c @@ -0,0 +1,236 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2015 Google, Inc + * Copyright (c) 2024 Linaro, Ltd. + * + * EFI information obtained here: + * http://wiki.phoenix.com/wiki/index.php/EFI_BOOT_SERVICES + * + * Call ExitBootServices() and launch U-Boot from an EFI environment. + */ + +#include +#include +#include +#include +#include +#include +#include + +static bool ebs_called; + +void _debug_uart_putc(int ch) +{ + struct efi_priv *priv = efi_get_priv(); + + if (ch == '\n') + _debug_uart_putc('\r'); + /* + * After calling EBS we can't log anywhere. + * NOTE: for development it is possible to re-implement + * your boards debug uart here like in efi_stub.c for x86. + */ + if (!ebs_called) + efi_putc(priv, ch); +} + +void _debug_uart_init(void) {} + +DEBUG_UART_FUNCS; + +void putc(const char ch) +{ + _debug_uart_putc(ch); +} + +void puts(const char *str) +{ + while (*str) + putc(*str++); +} + + +void *memcpy(void *dest, const void *src, size_t size) +{ + unsigned char *dptr = dest; + const unsigned char *ptr = src; + const unsigned char *end = src + size; + + while (ptr < end) + *dptr++ = *ptr++; + + return dest; +} + +void *memset(void *inptr, int ch, size_t size) +{ + char *ptr = inptr; + char *end = ptr + size; + + while (ptr < end) + *ptr++ = ch; + + return ptr; +} + +/** + * setup_info_table() - sets up a table containing information from EFI + * + * We must call exit_boot_services() before jumping out of the stub into U-Boot + * proper, so that U-Boot has full control of peripherals, memory, etc. + * + * Once we do this, we cannot call any boot-services functions so we must find + * out everything we need to before doing that. + * + * Set up a struct efi_info_hdr table which can hold various records (e.g. + * struct efi_entry_memmap) with information obtained from EFI. + * + * @priv: Pointer to our private information which contains the list + * @size: Size of the table to allocate + * Return: 0 if OK, non-zero on error + */ +static int setup_info_table(struct efi_priv *priv, int size) +{ + struct efi_info_hdr *info; + efi_status_t ret; + + /* Get some memory for our info table */ + priv->info_size = size; + info = efi_malloc(priv, priv->info_size, &ret); + if (ret) { + printhex2(ret); + puts(" No memory for info table: "); + return ret; + } + + memset(info, '\0', sizeof(*info)); + info->version = EFI_TABLE_VERSION; + info->hdr_size = sizeof(*info); + priv->info = info; + priv->next_hdr = (char *)info + info->hdr_size; + + return 0; +} + +/** + * add_entry_addr() - Add a new entry to the efi_info list + * + * This adds an entry, consisting of a tag and two lots of data. This avoids the + * caller having to coalesce the data first + * + * @priv: Pointer to our private information which contains the list + * @type: Type of the entry to add + * @ptr1: Pointer to first data block to add + * @size1: Size of first data block in bytes (can be 0) + * @ptr2: Pointer to second data block to add + * @size2: Size of second data block in bytes (can be 0) + */ +static void add_entry_addr(struct efi_priv *priv, enum efi_entry_t type, + void *ptr1, int size1, void *ptr2, int size2) +{ + struct efi_entry_hdr *hdr = priv->next_hdr; + + hdr->type = type; + hdr->size = size1 + size2; + hdr->addr = 0; + hdr->link = ALIGN(sizeof(*hdr) + hdr->size, 16); + priv->next_hdr += hdr->link; + memcpy(hdr + 1, ptr1, size1); + memcpy((void *)(hdr + 1) + size1, ptr2, size2); + priv->info->total_size = (ulong)priv->next_hdr - (ulong)priv->info; +} + +/** + * efi_main() - Start an EFI image + * + * This function is called by our EFI start-up code. It handles running + * U-Boot. If it returns, EFI will continue. + */ +efi_status_t EFIAPI efi_main(efi_handle_t image, + struct efi_system_table *sys_table) +{ + struct efi_priv local_priv, *priv = &local_priv; + struct efi_boot_services *boot = sys_table->boottime; + struct efi_entry_memmap map; + struct efi_gop *gop; + struct efi_entry_gopmode mode; + struct efi_entry_systable table; + efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; + efi_status_t ret; + + ebs_called = false; + + ret = efi_init(priv, "Payload", image, sys_table); + if (ret) { + printhex2(ret); + puts(" efi_init() failed\n"); + return ret; + } + efi_set_priv(priv); + + phys_addr_t reloc_addr = ULONG_MAX; + ret = boot->allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_LOADER_CODE, + (phys_addr_t)_binary_u_boot_bin_size / EFI_PAGE_SIZE, + &reloc_addr); + if (ret != EFI_SUCCESS) { + puts("Failed to allocate memory for U-Boot: "); + printhex2(ret); + putc('\n'); + return ret; + } + + ret = efi_store_memory_map(priv); + if (ret) + return ret; + + ret = setup_info_table(priv, priv->memmap_size + 128); + if (ret) + return ret; + + ret = boot->locate_protocol(&efi_gop_guid, NULL, (void **)&gop); + if (ret) { + puts(" GOP unavailable\n"); + } else { + mode.fb_base = gop->mode->fb_base; + mode.fb_size = gop->mode->fb_size; + mode.info_size = gop->mode->info_size; + add_entry_addr(priv, EFIET_GOP_MODE, &mode, sizeof(mode), + gop->mode->info, + sizeof(struct efi_gop_mode_info)); + } + + table.sys_table = (ulong)sys_table; + add_entry_addr(priv, EFIET_SYS_TABLE, &table, sizeof(table), NULL, 0); + + ret = efi_call_exit_boot_services(); + if (ret) + return ret; + + /* The EFI console won't work now :( */ + ebs_called = true; + + map.version = priv->memmap_version; + map.desc_size = priv->memmap_desc_size; + add_entry_addr(priv, EFIET_MEMORY_MAP, &map, sizeof(map), + priv->memmap_desc, priv->memmap_size); + add_entry_addr(priv, EFIET_END, NULL, 0, 0, 0); + + memcpy((void *)reloc_addr, _binary_u_boot_bin_start, + (ulong)_binary_u_boot_bin_end - + (ulong)_binary_u_boot_bin_start); + +/* This will only work if you patched your own debug uart into this file. */ +#ifdef DEBUG + puts("EFI table at "); + printhex8((ulong)priv->info); + puts(" size "); + printhex8(priv->info->total_size); + putc('\n'); +#endif + typedef void (*func_t)(u64 x0, u64 x1, u64 x2, u64 x3); + + puts("Jumping to U-Boot\n"); + ((func_t)reloc_addr)((phys_addr_t)priv->info, 0, 0, 0); + + return EFI_LOAD_ERROR; +} diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub_x86.c similarity index 100% rename from lib/efi/efi_stub.c rename to lib/efi/efi_stub_x86.c From patchwork Sun Nov 24 20:26:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845215 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861536wru; Sun, 24 Nov 2024 12:28:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXMnBDpBW43tzRfitcbwIzeF6lhuGArSeR8aI7/ZPFurz5zKHFfUYw/8JuGdF3XySEDr97FuQ==@linaro.org X-Google-Smtp-Source: AGHT+IHnOb6HN0AQkeShRI4pRcvG6iid1tRe7msycwF9MvoXsLOASeX6AFVdOqU01Vlvdpj4IoYo X-Received: by 2002:a05:6402:538b:b0:5cf:cc4c:76ff with SMTP id 4fb4d7f45d1cf-5d0206339aemr10182021a12.18.1732480087284; Sun, 24 Nov 2024 12:28:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480087; cv=none; d=google.com; s=arc-20240605; b=RlQMK6ufEI/1sDp9XF5Y6BTYUsCuwld22DCYAqbvXCH8VZQq0DY+V+e0JlW5sqdHSJ zaQBfyp0HVPv4fKWokxSo9ULJHufA2JooAeLS/NXsOnI8cmouUv2t5b+sKIp6D5hdLUz XB/qjSNa2Gceiz+W+pUIlVuTsZV3NWzcD7t7nsVDPWggsM4xfu7pOZSwnbppDEpi+r1y Xl9+3S7XI941j1c21emV05umZfmHP6iLmbiVubjxtb1SqK0ZPh+uOXf+49eUWVdHWWUx PYzcUQNpL3utlCjwuq1AiNqTFplyFoqwQSSF5x6xUjhJTxKhkbBwTYnO8mvL2sGNBSIt 7Ufw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=g24thDeGzFqn4fR2qRDSIk9ZZg63dpkzDzU0hMVE3gE=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=XIKo1WofCID50DFUB/aYyyZz2FUcbU1QK5/COLQIp0ybgLXDwOSeOvYqCsc5TmGgsU rm+0R+g+/nYrY3q6ReZAQgZkxSn8KIAIblvEKZhD3gUXfAjsDZZ/F+zBZ76O37TMKUPv XGc3t3h7TnJXX2gfUm29WEwOAg/6JuE0TMFwodoEgoxHHdrZJRGmyGm/wBF03/B7nFw+ QPWq5hQMik1vu8cxo/kCvy9t0Lhq48ERXNk+6QP77fvvIf9B9cMzM2ZlCkZfKrUBbTQA 3k3iZGGuP2PGVQCF0d+YMQpIheTzBWu2R5wriJjJCb6R25GjcIe61gRxDsEHtLICGcWV PLog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dtGddXLU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d01d54a5d9si4046010a12.529.2024.11.24.12.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:28:07 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dtGddXLU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 55950899BE; Sun, 24 Nov 2024 21:27:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="dtGddXLU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE86F895AD; Sun, 24 Nov 2024 21:27:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8F25C895B0 for ; Sun, 24 Nov 2024 21:27:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a9f1d76dab1so628299866b.0 for ; Sun, 24 Nov 2024 12:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480057; x=1733084857; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=g24thDeGzFqn4fR2qRDSIk9ZZg63dpkzDzU0hMVE3gE=; b=dtGddXLUVyQNsvWbOBHgiZVNsVx+8wGGKFNDXYuE3N0jbdi8d6kcvogLVMPxwxfDE5 G55amY92IHprKlUkQGJgeN8H54CkKoS7miY5Br46WAL34Xjr+XHk0SPyzQ3AZ3NvinHy PGvRsLtgY6BAyqOhkIL4/NVBR/7TrCw8uvXd9AFoMGx0eFBdgL5PxtoVNNlCGbGYnqL0 HP4DiPLpnrA0PRNs2N59Hu852MkhDD+O3eUmhTjsSEy0Ou04VgTs640BeqXyZoxLqWrx igB8dQqJrTDFAu38w+mkzqKQO4N8Nty4w+AkWOYsg5q5PpMjXEXqGVREnUpCWaw2gjAz L4lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480057; x=1733084857; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g24thDeGzFqn4fR2qRDSIk9ZZg63dpkzDzU0hMVE3gE=; b=clVaMRCcEkz5vyqhumYaL/+0Ir5Tm1rFh3mc7mUhZgDv0YpuT6tQXnrxPRuEue4dlu ZcIHBAzNLR19iMaMdNg8qTFV5hKnnRM+PEthbsPFPzLv7nw/rmXFiwvVF4b1pl6GdLLU p7hQNC2FD6z8X1hYG6hfdm0Xq62GIK+fP4ehozscnlUQ8jKu/LsVWl9TOVbZCYWt3Lg3 IxmtCYZeRDIk6DaUxFaHBTu03/T7xL8vdUteKKupsM1CGA3+oIk3ix7D4kZLq9q5N0Jm ZsbYtLPqnGm7bOhWbnqJwPeMPl7mx3CDkCX9/ZTHo9Qwpu7yjl2Bg1ZfnLdrEohHsQ4V Wr7w== X-Gm-Message-State: AOJu0YzkF2zWHMV+Rqy12sOP4aTYY2hnLnHs0gIKjUMZnRpTZVwSVk6m Fx2kpie9e8s8YJHbSL9j1gEwErbJXkxFWKhHSAWqaGQIxQN1sElxqekyjaw2lNQ= X-Gm-Gg: ASbGncsypCJf6ifSwmoCCgccsZDfF3bhGcFBEWhG5JALNE5HeeWwrwYuqi8U6Nz82Rl nBoVnJNk0nJ9b2G7bG25SmYmiaJY5+kOPTNrI9bjDpnHCaZG1DEgBJuOurFPofCXpDebEwHrexg GNEjw4RQeVSwC+YYWlfaldbVdQI+4lrZPlrrUMq5oGuGHbFWt+fX09+xPP2V3PN1ehe2qn7NkUu v2B9aw5GT1iPPuXJtKT0KketAmut0HpzlDRbdtZFmodOOlW2BtZdFc8EL0GFVG11ki0 X-Received: by 2002:a17:907:77c5:b0:aa5:11fa:626d with SMTP id a640c23a62f3a-aa511fa6426mr722776166b.3.1732480056956; Sun, 24 Nov 2024 12:27:36 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:36 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:26:59 +0100 Subject: [PATCH RFC 03/14] efi: move efi_info_get() to a new header file MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-3-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=5761; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=GxRiPAPfDI3V0zydS7anqZn5E0A6kCpt5AK9398JmAk=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHsPPn9/ul+2Sfq440VMu/Wpzc9iSwIUpehMtWTUdr k83ucTXUcrCIMjBICumyCJ+Ypll09rL9hrbF1yAmcPKBDKEgYtTACZyWJSRYbOj+qtJMuw//7wy bc2pC9U8r3l8W/3T58ocspsPlEsnLmH4K1B1+fGO2SrGzAsO+6693FW2xCpu14I8y5XzzraXW23 fqwEA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Split out the EFI stub specific code to a new efi_stub.h header file. Signed-off-by: Caleb Connolly --- arch/x86/cpu/efi/payload.c | 1 + cmd/efi.c | 1 + drivers/video/efi.c | 1 + include/efi.h | 25 ------------------------- include/efi_stub.h | 38 ++++++++++++++++++++++++++++++++++++++ lib/efi/efi_app.c | 1 + lib/efi/efi_info.c | 1 + lib/efi/efi_stub_arm64.c | 1 + lib/efi/efi_stub_x86.c | 1 + 9 files changed, 45 insertions(+), 25 deletions(-) diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index 6845ce72ff94..68cda25aca63 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -6,8 +6,9 @@ #include #include #include +#include #include #include #include #include diff --git a/cmd/efi.c b/cmd/efi.c index 1fb67a83aae5..53213be0a2fa 100644 --- a/cmd/efi.c +++ b/cmd/efi.c @@ -6,8 +6,9 @@ #include #include #include +#include #include #include #include #include diff --git a/drivers/video/efi.c b/drivers/video/efi.c index 78d123fad4be..a7b6d47f9a15 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -8,8 +8,9 @@ #define LOG_CATEGORY LOGC_EFI #include #include +#include #include #include #include diff --git a/include/efi.h b/include/efi.h index a6eff13a6bbb..933be35852df 100644 --- a/include/efi.h +++ b/include/efi.h @@ -321,18 +321,8 @@ struct efi_open_protocol_info_entry { u32 attributes; u32 open_count; }; -enum efi_entry_t { - EFIET_END, /* Signals this is the last (empty) entry */ - EFIET_MEMORY_MAP, - EFIET_GOP_MODE, - EFIET_SYS_TABLE, - - /* Number of entries */ - EFIET_MEMORY_COUNT, -}; - #define EFI_TABLE_VERSION 1 /** * struct efi_info_hdr - Header for the EFI info table @@ -609,23 +599,8 @@ void efi_puts(struct efi_priv *priv, const char *str); * @ch: Character to write (note this is not unicode) */ void efi_putc(struct efi_priv *priv, const char ch); -/** - * efi_info_get() - get an entry from an EFI table - * - * This function is called from U-Boot proper to read information set up by the - * EFI stub. It can only be used when running from the EFI stub, not when U-Boot - * is running as an app. - * - * @type: Entry type to search for - * @datap: Returns pointer to entry data - * @sizep: Returns entry size - * Return: 0 if OK, -ENODATA if there is no table, -ENOENT if there is no entry - * of the requested type, -EPROTONOSUPPORT if the table has the wrong version - */ -int efi_info_get(enum efi_entry_t type, void **datap, int *sizep); - /** * efi_store_memory_map() - Collect the memory-map info from EFI * * Collect the memory info and store it for later use, e.g. in calling diff --git a/include/efi_stub.h b/include/efi_stub.h new file mode 100644 index 000000000000..4780badd3ac4 --- /dev/null +++ b/include/efi_stub.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Helpers for U-Boot running as an EFI payload. + * + * Copyright (c) 2024 Linaro, Ltd + */ + +#ifndef _EFI_STUB_H +#define _EFI_STUB_H + +#include + +enum efi_entry_t { + EFIET_END, /* Signals this is the last (empty) entry */ + EFIET_MEMORY_MAP, + EFIET_GOP_MODE, + EFIET_SYS_TABLE, + + /* Number of entries */ + EFIET_MEMORY_COUNT, +}; + +/** + * efi_info_get() - get an entry from an EFI table + * + * This function is called from U-Boot proper to read information set up by the + * EFI stub. It can only be used when running from the EFI stub, not when U-Boot + * is running as an app. + * + * @type: Entry type to search for + * @datap: Returns pointer to entry data + * @sizep: Returns entry size + * Return: 0 if OK, -ENODATA if there is no table, -ENOENT if there is no entry + * of the requested type, -EPROTONOSUPPORT if the table has the wrong version + */ +int efi_info_get(enum efi_entry_t type, void **datap, int *sizep); + +#endif /* _EFI_STUB_H */ diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 9b94a93ee4f1..2c66133648e4 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -12,8 +12,9 @@ #include #include #include #include +#include #include #include #include #include diff --git a/lib/efi/efi_info.c b/lib/efi/efi_info.c index 5fa4baeec635..32ba7e499c57 100644 --- a/lib/efi/efi_info.c +++ b/lib/efi/efi_info.c @@ -5,8 +5,9 @@ * Access to the EFI information table */ #include +#include #include #include #include diff --git a/lib/efi/efi_stub_arm64.c b/lib/efi/efi_stub_arm64.c index 54bee6c55d7e..2cabb16f2414 100644 --- a/lib/efi/efi_stub_arm64.c +++ b/lib/efi/efi_stub_arm64.c @@ -11,8 +11,9 @@ #include #include #include +#include #include #include #include #include diff --git a/lib/efi/efi_stub_x86.c b/lib/efi/efi_stub_x86.c index 40fc29d9adf7..ea1993f745d3 100644 --- a/lib/efi/efi_stub_x86.c +++ b/lib/efi/efi_stub_x86.c @@ -11,8 +11,9 @@ #include #include #include +#include #include #include #include #include From patchwork Sun Nov 24 20:27:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845216 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861562wru; Sun, 24 Nov 2024 12:28:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXX4zOxmcUagpnskTS/EblV8f5YrmlKCP2VNCQRPaSI7btG1zeyyjiooHJ0XOtyUWFJeguQqA==@linaro.org X-Google-Smtp-Source: AGHT+IG6scUk4irPzWgFfSXIIyNFbYJkmzq9gualkyhZZog9llHRlNbv4IEx6kpqCyMLsFyUeQE/ X-Received: by 2002:a17:906:2192:b0:aa5:1a42:460 with SMTP id a640c23a62f3a-aa51a420814mr839287866b.22.1732480095540; Sun, 24 Nov 2024 12:28:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480095; cv=none; d=google.com; s=arc-20240605; b=kgcBwc+c2udf1I2O59SP/xsdKjJxrVxI674PjdtVr6oRYMLNv573d7F83uFnJL+G3t saSygT/Qp2VXwVkEqM/oqUWRIQElHcVNUDVXF9TZ4e5LLNDzu9CQpeJtLfqf8x9Slr+X dRwu2XmKF2sd6UZODCKO/w4QPyV86kfBwYVB3Yu8+WLSuh0OP7jeBOOu/Hxotn+Qg9KM P68xI3R5AcFdHaWesLxLRfBBL16eTHkyVI9Z2hKOD+C5D4KwFhCeOwsJmn465Qzg4xmK Qila5MkdmOOagpmoRp4JSOQQtwsitT1izSXrO9UqrJTDk/xiw2XjV0WxXV3myRAWGzUs 3uog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=t/PbdUuyyMB+2vDC/D4lmQfpGBwk36cNcf834S6sHQ8=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=brLxrADar5wy6gzZClQmWbbrN/8kWK310A76Pd3IXAV4Dy6MI/sP2DZZNjdHKM5uT1 N0dFMk8wgHwcnoNEmZxvDbxPJso1xhzOUvWQK614n2DZ7TFAw1eyUag/kitn8azOD9ET k1P079FyJTMycwJZJ+yzLHmHj65GxN60fml+kX6Y2H0C0k8zdyCQabeSMxZWxHuhYQKf EMq0oHzsGAIisZS6EIrWIyTv5iPLJEKoEEye+ugxZC3hvj+6Dzp+GuvzPYSEG4RauXwj jME4oyeoQAnLUGphWsEsDB0SN9KUJWfaBwDIA38PE42CAb32IChrQBGTcZsSZlaYCDPr in9A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MtGBQJqm; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa50b249ed5si383523766b.12.2024.11.24.12.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:28:15 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MtGBQJqm; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B6AD489595; Sun, 24 Nov 2024 21:27:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="MtGBQJqm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 16357895A4; Sun, 24 Nov 2024 21:27:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A189589595 for ; Sun, 24 Nov 2024 21:27:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5d01db666ceso3308873a12.0 for ; Sun, 24 Nov 2024 12:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480058; x=1733084858; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=t/PbdUuyyMB+2vDC/D4lmQfpGBwk36cNcf834S6sHQ8=; b=MtGBQJqmV2T95HWexxCFE4KSEKOE0yyVFZ/7tSuYtYFrszNgGjgf52z0XE7IKut6dK Vg46buLqM7ld51nwVzdECOEXlB3JGZZVwPIPduxfvCb5nTQhbkQ89Fj32hrzzhL9AdCW 8EuAuhtiUonsLPL918t9x68eEIPVELVljj4wxlnvlMFaq1fa0RTxEOFPDltAjrQyAL45 AR8YexYmpclcHDx4dVv7uHMXc3em1v/lAptA6CDOGyyRsw006YZjlbeWqAA7an+wtL5Y A/xLHd5RoKDKbxvvp7vwUmtf5UxS1h3q0GGHF1eBnPlEKSENLyA4a1xNzsd1g+jd+p9+ Btcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480058; x=1733084858; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t/PbdUuyyMB+2vDC/D4lmQfpGBwk36cNcf834S6sHQ8=; b=YhGQrMrqflDnZnu7Dnrw20YHYhIVvoAU9wtmqRCCBvExuj8hJzfTEpADwyAYL1W4eT CzMPaXj0RpQxFh4MZjevkHF0DujoFx0fGk1t/W5UwkAQF1Qbomp+vDJirjMAoJEp6jLm Ql35z8BIMx09n1GbMaRdAssAEIi3s/CceK+3AlKob2lflS+R/hnIWWAQqR/m7A+XT3B2 yMXeT+3vPTWF7ljYBJVyz+kvmmTJYrG762QAZ7S4iKP2N00RIxxVFoqPp5oZuL0ta5Co EcwVQtFHvXZO0E/naVfrwxhdn4EhkMctqc8NHZ9GN4quWjxvOdL8hD1y0eFh4viMq6JR YpNw== X-Gm-Message-State: AOJu0YwVkYYEAjC7/JTA2urRq5cZmWhU8LC7+KT8tIxxpidrv9VK2W3c 3pyOazvuZZ6AUPxVOqtjWTSwjv5JfS2oWNPbkf2dBhgQXtnsuX/cqYB1d1eEG6s= X-Gm-Gg: ASbGncuYYSpwvQTY3MsdK27PrdijsPzpqQPuPaK5G0O+T/1Tz0BFcM9L4LFAhVBkpRP RJH1yl0BLHwuC4FXFJXsE62Ium656H6Sa4LKC2BDw3skXfvTLvDhvd0V4XZVHGJaS/h8xaXvU4h 6NZbLwYW+lAh6UI6s2ANf7B7n5VwdFlIPttNAH+6+oM1LK06c0Qi0YZX7iQ/5cHiUZ00Zyg2biH 08bQr624lLxkbaRYo7Wgu+R6ZJwCTbTHFWE9jRedBnB+6GBbRsoLasLW71bBz3CrrZp X-Received: by 2002:a17:906:309a:b0:aa5:39d0:845a with SMTP id a640c23a62f3a-aa539d0b069mr445279566b.15.1732480058060; Sun, 24 Nov 2024 12:27:38 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:37 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:00 +0100 Subject: [PATCH RFC 04/14] efi: stub: add helpers to populate memory map and framebuffer MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-4-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=7609; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=DFfkuzxS+aC+qf3YS3hKZDlY6hipiZn6l+MnJwx2yuo=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHqPqzYyuMZsYzf5f5H2Y0+hbt/clywrmsisLTu5ZO d23VeZ/RykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZjIayuG/9462op3kiNaSv4G HviR+ES7+vvHs/lmrFqLgplmyHKtOMHwV3rWZ+nvjHFXhd3WOQdoyb/2vHSs1UpbftbEpphrHnN WMwMA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Introduce two new helpers dram_init_banksize_from_efi() and of_populate_from_efi(). These populate the DRAM bank info and simplefb framebuffer OF node respectively using the EFI table populated by the EFI stub. dram_init_banksize_from_efi() is directly moved from the x86 payload code to make it available for other boards. Populating the simplefb node allows for an easy way to bring up video without the full heft of VIDEO_EFI which is not particularly well-suited to ARM. Signed-off-by: Caleb Connolly --- arch/x86/cpu/efi/payload.c | 31 +------------ include/efi_stub.h | 22 ++++++++++ lib/efi/efi_info.c | 107 +++++++++++++++++++++++++++++++++++++++++++++ lib/of_live.c | 9 ++++ 4 files changed, 139 insertions(+), 30 deletions(-) diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index 68cda25aca63..b71917615d13 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -100,38 +100,9 @@ int dram_init(void) } int dram_init_banksize(void) { - struct efi_mem_desc *desc, *end; - struct efi_entry_memmap *map; - int ret, size; - int num_banks; - - ret = efi_info_get(EFIET_MEMORY_MAP, (void **)&map, &size); - if (ret) { - /* We should have stopped in dram_init(), something is wrong */ - debug("%s: Missing memory map\n", __func__); - return -ENXIO; - } - end = (struct efi_mem_desc *)((ulong)map + size); - desc = map->desc; - for (num_banks = 0; - desc < end && num_banks < CONFIG_NR_DRAM_BANKS; - desc = efi_get_next_mem_desc(desc, map->desc_size)) { - /* - * We only use conventional memory and ignore - * anything less than 1MB. - */ - if (desc->type != EFI_CONVENTIONAL_MEMORY || - (desc->num_pages << EFI_PAGE_SHIFT) < 1 << 20) - continue; - gd->bd->bi_dram[num_banks].start = desc->physical_start; - gd->bd->bi_dram[num_banks].size = desc->num_pages << - EFI_PAGE_SHIFT; - num_banks++; - } - - return 0; + return dram_init_banksize_from_efi(); } int arch_cpu_init(void) { diff --git a/include/efi_stub.h b/include/efi_stub.h index 4780badd3ac4..ff3befd4830b 100644 --- a/include/efi_stub.h +++ b/include/efi_stub.h @@ -34,5 +34,27 @@ enum efi_entry_t { * of the requested type, -EPROTONOSUPPORT if the table has the wrong version */ int efi_info_get(enum efi_entry_t type, void **datap, int *sizep); +struct device_node; + +/** + * of_populate_from_efi() - Populate the live tree from EFI tables + * + * @root: Root node of tree to populate + * + * This function populates the live tree with information from EFI tables + * it is only applicable when running U-Boot as an EFI payload with + * CONFIG_EFI_STUB enabled. + */ +int of_populate_from_efi(struct device_node *root); + +/** + * dram_init_banksize_from_efi() - Initialize the memory banks from EFI tables + * + * This function initializes the memory banks from the EFI memory map table we + * stashed from the EFI stub. It is only applicable when running U-Boot as an + * EFI payload with CONFIG_EFI_STUB enabled. + */ +int dram_init_banksize_from_efi(void); + #endif /* _EFI_STUB_H */ diff --git a/lib/efi/efi_info.c b/lib/efi/efi_info.c index 32ba7e499c57..3fa594b34b42 100644 --- a/lib/efi/efi_info.c +++ b/lib/efi/efi_info.c @@ -9,8 +9,13 @@ #include #include #include #include +#include +#include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; int efi_info_get(enum efi_entry_t type, void **datap, int *sizep) @@ -46,4 +51,106 @@ err: unmap_sysmem(info); return -ENOSYS; } + +#ifdef CONFIG_OF_LIVE +static int of_populate_framebuffer(struct device_node *root) +{ + struct device_node *chosen, *fb; + struct efi_entry_gopmode *mode; + ofnode node; + int ret, size; + u64 reg[2]; + char fb_node_name[50] = { 0 }; + + ret = efi_info_get(EFIET_GOP_MODE, (void **)&mode, &size); + if (ret) { + printf("EFI graphics output entry not found\n"); + return ret; + } + + fb = of_find_node_opts_by_path(root, "/chosen/framebuffer", NULL); + /* framebuffer already defined */ + if (fb) + return 0; + + chosen = of_find_node_opts_by_path(root, "/chosen", NULL); + if (!chosen) { + ret = of_add_subnode(root, "chosen", -1, &chosen); + if (ret) { + debug("Failed to add chosen node\n"); + return ret; + } + } + node = np_to_ofnode(chosen); + ofnode_write_u32(node, "#address-cells", 2); + ofnode_write_u32(node, "#size-cells", 2); + /* + * In order for of_translate_one() to correctly detect an empty ranges property, the value + * pointer has to be non-null even though the length is 0. + */ + of_write_prop(chosen, "ranges", 0, (void *)FDT_ADDR_T_NONE); + + snprintf(fb_node_name, sizeof(fb_node_name), "framebuffer@%llx", mode->fb_base); + ret = of_add_subnode(chosen, fb_node_name, -1, &fb); + if (ret) { + debug("Failed to add framebuffer node\n"); + return ret; + } + node = np_to_ofnode(fb); + ofnode_write_string(node, "compatible", "simple-framebuffer"); + reg[0] = cpu_to_fdt64(mode->fb_base); + reg[1] = cpu_to_fdt64(mode->fb_size); + ofnode_write_prop(node, "reg", reg, sizeof(reg), true); + ofnode_write_u32(node, "width", mode->info->width); + ofnode_write_u32(node, "height", mode->info->height); + ofnode_write_u32(node, "stride", mode->info->pixels_per_scanline * 4); + ofnode_write_string(node, "format", "a8r8g8b8"); + + return 0; +} +#endif + +int of_populate_from_efi(struct device_node *root) +{ + int ret = 0; + + if (CONFIG_IS_ENABLED(VIDEO_SIMPLE) && CONFIG_IS_ENABLED(OF_LIVE)) + ret = of_populate_framebuffer(root); + + return ret; +} + +int dram_init_banksize_from_efi(void) +{ + struct efi_mem_desc *desc, *end; + struct efi_entry_memmap *map; + int ret, size; + int num_banks; + + ret = efi_info_get(EFIET_MEMORY_MAP, (void **)&map, &size); + if (ret) { + /* We should have stopped in dram_init(), something is wrong */ + debug("%s: Missing memory map\n", __func__); + return -ENXIO; + } + end = (struct efi_mem_desc *)((ulong)map + size); + desc = map->desc; + for (num_banks = 0; + desc < end && num_banks < CONFIG_NR_DRAM_BANKS; + desc = efi_get_next_mem_desc(desc, map->desc_size)) { + /* + * We only use conventional memory and ignore + * anything less than 1MB. + */ + if (desc->type != EFI_CONVENTIONAL_MEMORY || + (desc->num_pages << EFI_PAGE_SHIFT) < 1 << 20) + continue; + gd->bd->bi_dram[num_banks].start = desc->physical_start; + gd->bd->bi_dram[num_banks].size = desc->num_pages << + EFI_PAGE_SHIFT; + num_banks++; + } + + return 0; +} diff --git a/lib/of_live.c b/lib/of_live.c index 90b9459ede31..572ae09d377b 100644 --- a/lib/of_live.c +++ b/lib/of_live.c @@ -10,8 +10,9 @@ #define LOG_CATEGORY LOGC_DT #include +#include #include #include #include #include @@ -334,8 +335,16 @@ int of_live_build(const void *fdt_blob, struct device_node **rootp) return ret; } debug("%s: stop\n", __func__); + /* + * When booting with EFI_STUB we can automatically generate a framebuffer + * node based on the EFI data. + */ + ret = of_populate_from_efi(*rootp); + if (ret) + debug("Failed to populate live tree nodes from EFI: err=%d\n", ret); + return ret; } void of_live_free(struct device_node *root) From patchwork Sun Nov 24 20:27:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845217 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861586wru; Sun, 24 Nov 2024 12:28:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXmAxDxmUKLt+yVtuvZtw57/E92LZdNmH3p7uLDkk8Klb9S5qNW9wxzQGg6dibpAfAFt2+IOQ==@linaro.org X-Google-Smtp-Source: AGHT+IENWGTttqw08C91NRve/gfG21diRynrDMoNgKszejcGB9+sdfvXQPtZngvMWZQvWYlEEKrh X-Received: by 2002:a05:6402:354e:b0:5cf:f241:f26c with SMTP id 4fb4d7f45d1cf-5d0205ae5a6mr7768128a12.4.1732480104154; Sun, 24 Nov 2024 12:28:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480104; cv=none; d=google.com; s=arc-20240605; b=CNvrTSv5bnlWPEBa0fkwcLxqepbYOVrv9Q9K/ZvRkYkL5AYAVMgmOECxf9hVEcHT+W 7E24MPQYBDS9VZdMpIooW61IFoTchI8gg+lu1MeC6xDA9y7Ai/mO0jWt7b1yvT+bnoyi txWGtMTLgpHnGSWA7BCi72EPTS1Juwij4RVRHww5j6SyGeAIzieoC5cvBqPtnJHUytEi PfM/Bafv2X4RXwe5CHEYN89STzE7Sisl14FmZaD1ZUfA4OafGj5h3z/ZIRbbhmQgXRds IBvge4HZ3Tz5PDAwgViQALy3vJGWHdeZpmzZ37apnE1zes7uqg5lNg785Iy80bznFxIb dDaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=BUiPXKDK9YoTJrG3p5ijnusGnV83eQAGGVjIEnS3214=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=cUXgh+m2sWlvDVVzKZx3ufOz/Z8OfVuiIWSOQHimNNuA6RWh5418dw3stkKti6UwKC jDUjgCPwT3SxI8HZwxkUZSPF2q+gHjPjERj0mJ6VezNHpBgD6pl41dMNzuE0VWT6Ou/1 i5V5zkPiYndzO2tpC+aCtrLVYpC1dsKAcY5mL1xSTc8KpGtKW0vO4VxaNvYmOkQr+iyN PPyqSUJVDZmPZFdLGIFYl5Q0Q2Y+572zVZTrF2no8YHZSc8T2anLIWW2JHHN2F8E4iDK f2Yxwhwdzk7RZRFarjmD89iblI0B5tJf5IanHzZjO3ZAfT7MVQyGoevE8d2uBcAcLR/q aHDg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZwwxkIdt; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d01d53cf4bsi4019984a12.429.2024.11.24.12.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:28:24 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZwwxkIdt; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D122899BF; Sun, 24 Nov 2024 21:27:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ZwwxkIdt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D1DD896BB; Sun, 24 Nov 2024 21:27:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6EE3B89812 for ; Sun, 24 Nov 2024 21:27:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-aa5366d3b47so159659066b.0 for ; Sun, 24 Nov 2024 12:27:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480059; x=1733084859; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BUiPXKDK9YoTJrG3p5ijnusGnV83eQAGGVjIEnS3214=; b=ZwwxkIdtlJTGSe4uYKq+Mf0TId335lZevUJFAge8enl5At7BmT9TyBQz6LuMZIKTLZ I27mqRI0Fj0ln8bXPZbTf6HU+WVmILriXdEXkese9QcPHg85OBOwuwPJT0ZsqITSaJFG F0WZIK/LOV7obACkr0Abnz5ikG16ElSk9Il9QXhHMUwj2xTORFZdXwgL8AckJCv+TmEQ LE+FK45gOPD4iueYcuoGyUZzvRs35zi+lctrETYJf0BiOVlxgcTEUQvNdTnZMxFhknRr 1AfY35t6Y9jCNu6LFPsPmrPb6OfuUGqXyVTV8nR579fNrxUFESjhj4lSRpEdNUN0tZAo un9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480059; x=1733084859; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BUiPXKDK9YoTJrG3p5ijnusGnV83eQAGGVjIEnS3214=; b=g+aYdsuweF2xTLZQt5+rWNezDGdvxfPc7MJwYRk4+FYTc5xta27MUfUcG7/pbyoRyU kXoPw9WE64OFhYyeDYvRr/jH5UbkbEX1R5smw/3qWaWBsARZAgsNEnqHDXWvEq8Tlsfx koLfXCPk6+yAyCvcckTqKxfBFEAMkqZAZ40UcOHcpOZgN7+kVNgeFGQLgbIYd3wjJ+IL GwrH7+TvTlwvMmReiPR+581GNa9awIGlb6SUfRloY92yO3vkbaPFiPMEiQR9TfX1YpDG ByDEcd+K2VTyTgnrgqM5SyhZMNhWlQdDKIpWfHg0BMhgCMH+G01aFYGzrGMU5xZc9hra nAHw== X-Gm-Message-State: AOJu0YzHNEGzqG0NRZYXoDY7vvog3RcJppQIOynUfEKjFQ0niQmOAwyk 3EwMpZ2zr7DHjmOyLnhLgM4sm0Ori+l0q9nJdX01c9+J3dcLg3GYiqjOe74x5fw= X-Gm-Gg: ASbGnct7efz88D0Zy0aS80h19Jh0B5YbQYysLkrFRHU5f1doHHl9Ys9JbFDTQQXapfY ipr6nv9/xe0toIik0g2S4F66GH/TwdnxTavLgEGs8NHAnHakF0mpv8Qa9yUnrhmW7FXi9aP26Ae PRb7wnFFroucqUexBhofNXU2r5h0YIGeuXXNBxZNXYMxRRacqWWwTl9w+7IdwT1A4pc73hrlyo8 viIx967Rv4fwAjhxoTktx8Z42ndO1UuZDeQbbEVt9b/PpnLM3zssHtRfsRDAZP1aIf/ X-Received: by 2002:a17:907:7854:b0:a9a:6bc2:c0a3 with SMTP id a640c23a62f3a-aa50990b2c0mr905056466b.7.1732480058958; Sun, 24 Nov 2024 12:27:38 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:38 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:01 +0100 Subject: [PATCH RFC 05/14] efi: stub: add additional types of memory MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-5-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1754; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=KzexS3NkiLi6IZ5rQRehRZxDo6WqSeW5w7WZKu8hW5Q=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHqP1V3+edTDrz+2Rdrm0bOuzyG03ZCOUdY3vBOce5 5zlJ7+uo5SFQZCDQVZMkUX8xDLLprWX7TW2L7gAM4eVCWQIAxenAExE9g0jw55Mr09Hbu8rrGm8 2VSZ5uDvsyRIUCLXIPZSmkrcOvYp+gz/1I9eOc0ott+v/3TRj4WfBPV+vL/zaFPHZ7+D0Us7n96 /swgA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean U-Boot itself might be mapped as LOADER_CODE, there's also no reason not to make additional pages accessible to the OS. This fixes an issue where U-Boot can't run EFI apps because it gets relocated somewhere outside of its own memory map. Signed-off-by: Caleb Connolly --- lib/efi/efi_info.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/efi/efi_info.c b/lib/efi/efi_info.c index 3fa594b34b42..3754c913b54d 100644 --- a/lib/efi/efi_info.c +++ b/lib/efi/efi_info.c @@ -120,8 +120,28 @@ int of_populate_from_efi(struct device_node *root) return ret; } +static bool efi_mem_type_is_usable(u32 type) +{ + switch (type) { + case EFI_CONVENTIONAL_MEMORY: + case EFI_LOADER_DATA: + case EFI_LOADER_CODE: + case EFI_BOOT_SERVICES_CODE: + return true; + case EFI_RESERVED_MEMORY_TYPE: + case EFI_UNUSABLE_MEMORY: + case EFI_UNACCEPTED_MEMORY_TYPE: + case EFI_RUNTIME_SERVICES_DATA: + case EFI_MMAP_IO: + case EFI_MMAP_IO_PORT: + case EFI_PERSISTENT_MEMORY_TYPE: + default: + return false; + } +} + int dram_init_banksize_from_efi(void) { struct efi_mem_desc *desc, *end; struct efi_entry_memmap *map; @@ -142,10 +162,9 @@ int dram_init_banksize_from_efi(void) /* * We only use conventional memory and ignore * anything less than 1MB. */ - if (desc->type != EFI_CONVENTIONAL_MEMORY || - (desc->num_pages << EFI_PAGE_SHIFT) < 1 << 20) + if (!efi_mem_type_is_usable(desc->type) || (desc->num_pages << EFI_PAGE_SHIFT) < 1 << 20) continue; gd->bd->bi_dram[num_banks].start = desc->physical_start; gd->bd->bi_dram[num_banks].size = desc->num_pages << EFI_PAGE_SHIFT; From patchwork Sun Nov 24 20:27:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845218 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861632wru; Sun, 24 Nov 2024 12:28:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVlUhTnOqI06ig4JUh/XbDaLQ8BwleEobECjuoiKfUr+37xGMsBCyMYnYopa3ljuJOAXLW+0g==@linaro.org X-Google-Smtp-Source: AGHT+IE/yGDWTutIzWf9goI9sQjnrJ1QmsdDpxhNqOAOKuwVSL1aADfShcgGwGgGDGqRy++6D7GR X-Received: by 2002:a05:6512:3e1f:b0:53d:d4eb:ef43 with SMTP id 2adb3069b0e04-53dd4ebef5bmr5720040e87.2.1732480113045; Sun, 24 Nov 2024 12:28:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480113; cv=none; d=google.com; s=arc-20240605; b=UybuizMsrdigq0ogXXXn2/z+JIDRooCxDjQyxMXcdOhkUXQrZl6R7365SPrS0AV1su XNKHb5glARCf7XgweqIEMCl6QIY41U+2868xOfk2u50GQVe7z1vwPbHdhVYrpRkwYIbp lHBY3y2JeHIwdCFIEplhJ3rkNnxm5/jrOcJi95Qn3UQ6hKA/2HS40cv2TkymYvwccUM5 2SMDWXmEF9Thj3LmmyCm2+CRH4j0/epKptOMshmo0mrcBRtS68RojrcDKLC1p5f7t4ym ybss93Sg+fF8fWJQhDjVGeXABJxwkBef43MaR5remq/BrccSMDyiQfyVyO1CoM1dATSG A3LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=pBsw40Vvg6/1/y2tFaUT0TBQaovEQgqkPeMJz2m2Rp0=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=OcoJaFll5rKL+QQ3Rf0duXDNfA40vBUqaMp1mp+G8W/4d8BlxcbrwXFsoq/RdJh/EU JvBfaEX9I9TiBoJDjzGcR8A8/GkyvXWrlvYfLTB2RDu5SRl8bBS+T2g7lQE7HxbczuZ/ qK2QlkGIeLKLLfixPD0oTcUhpRRqUgyZuIgzRFZAO1VYqwBetDP7+w0qwHU0LtnNrvNS 5aLCGJ3kegdRpX8MAQ9sk496Evy8CBsl7l/Zn3gIMO69A5NuWdol3A5UmHIZt7+7i4aQ Vqa4RKKJ7uk28LJ4bBv4JjWrLmgj2CnXEhBst4SLrkJjTJZmsov2Vp42hrGHgH155kaO w9HQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iC3zMgzD; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa50b242a59si396782266b.63.2024.11.24.12.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:28:33 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iC3zMgzD; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7B5E689524; Sun, 24 Nov 2024 21:27:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iC3zMgzD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7307789920; Sun, 24 Nov 2024 21:27:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A25EE89923 for ; Sun, 24 Nov 2024 21:27:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-53ddeef9e4aso1298354e87.1 for ; Sun, 24 Nov 2024 12:27:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480060; x=1733084860; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pBsw40Vvg6/1/y2tFaUT0TBQaovEQgqkPeMJz2m2Rp0=; b=iC3zMgzDyymGsWtRzoeSFuBcTzcq7WrVcLlpIorxa9134Fo/r2Nj/i/ypSNHo9gudm kfpiFnkpvGa/WVyThtGb35XcneCwp+/i/I7Fs8+4tg6lIBYLhDldbynTTewJNFXWB44W dcT3/uYbsZZwrNYU8W96FweYsvmkpxYiOm2NMMllzhSX3/qOtRfZNugRP5yuy7hCEs3B uixK9dVzMJw9aTW4q5XDVU35AJ2qplxtCgX80xCa2BhpFGKRY174YUDaqAT4OJhzBTNi SW7DIYYwoCsMZLfSHNz+OABJZtCuB2i5eguIS8LmOAma+pVF5k8UkLcouCjw/FzMAQVw wLAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480060; x=1733084860; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pBsw40Vvg6/1/y2tFaUT0TBQaovEQgqkPeMJz2m2Rp0=; b=u+kVjxORf/Kv21TGtoHLl0OKua84JDf4EVjXDX/E1lCs6QzjHUg0wE70Wa+48uaQQ1 bne4PfHfDl8CqW4L0vIREn5Z2zxAMEzOzFwq6Dtw0Tja6cWijcRwIvrEQfq1NNnpPN0m dTHhpf7pEvHNsFgzS931WrgYGXhuBs/MUCAbOMCzCwRWhTAq4e/pMPmmulwhl94hKZb8 k+BqrybiuWI/CBsbl6oNnoTzbvLw2LzBbXPOwu1dRdAXSf3VFKI+9FHdpg/fBIsqEqpW VH0CzsSVIbuE4aw2N+OCFqYcxA/ytYR3BAldP9AKEWH9S+UQ4tZYvyI9Pm0iwphowSuM 23Zw== X-Gm-Message-State: AOJu0YzgZNaqg+gc1APgoUI6FTe21RrhnI1hXoipg205uK2i3TB6cdOy vZRuhVAyCD82JARbHH3ubfrq1Uhfvf+gJ5EKNtHxg4zCA754TNB0ovFeEdVPM+0= X-Gm-Gg: ASbGncvztA1tE7hQBEH0iHihQLSbrLDIsgJy6r1R/L5DqkFZ/xBgs/MQZobLMTCkht3 jWeQwnDrzbNWPYCdEVkIo2Qdb58rP3T8LStUXs/VW/o6x4cN5JjlS84TC10nzd2zrpSE/iRqaRi l4LumsFD0CQMCB2LLwcUVkKBiFO2ZyihW995L/senjhIA3sqnPHTEkdihu6q3eezmpaZWD9ROuf GJGXaTVHm062LipGpqJ2b+IxPtDty2hLfmwILJY/9bqTV30Hc7yhR+8t+qqPcyeuxX0 X-Received: by 2002:a05:6512:3994:b0:53d:e4cc:f5f2 with SMTP id 2adb3069b0e04-53de4ccf8cbmr264463e87.56.1732480059912; Sun, 24 Nov 2024 12:27:39 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:39 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:02 +0100 Subject: [PATCH RFC 06/14] efi: stub: log EFI memory banks MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-6-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1419; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=bE5NHg78oOMxBfMsM0CuOr8IHdICyKDFCxa2bUEcku8=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHqPXRqqnFr9dYmSk4drDGFEaLnzT+GbRelWp/fOns sn3B87sKGVhEORgkBVTZBE/scyyae1le43tCy7AzGFlAhnCwMUpABNZUsjwP+fN71XX44OjFm1b 2Ryw/MFujp70L/2/77MqPPtU/rE9RZmRodPPaDrPwSvfPn9jl1wjt+17o93N79IHsw/5vgsSPuS zIA8A X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add a debug log for these since its often useful to inspect the memory map from the EFI we're jumping from. Signed-off-by: Caleb Connolly --- lib/efi/efi_info.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/efi/efi_info.c b/lib/efi/efi_info.c index 3754c913b54d..f9743a3e7fad 100644 --- a/lib/efi/efi_info.c +++ b/lib/efi/efi_info.c @@ -144,9 +144,9 @@ static bool efi_mem_type_is_usable(u32 type) int dram_init_banksize_from_efi(void) { struct efi_mem_desc *desc, *end; struct efi_entry_memmap *map; - int ret, size; + int ret, size, bank = 0; int num_banks; ret = efi_info_get(EFIET_MEMORY_MAP, (void **)&map, &size); if (ret) { @@ -162,9 +162,14 @@ int dram_init_banksize_from_efi(void) /* * We only use conventional memory and ignore * anything less than 1MB. */ - if (!efi_mem_type_is_usable(desc->type) || (desc->num_pages << EFI_PAGE_SHIFT) < 1 << 20) + log_debug("EFI bank #%d: start %llx, size %llx type %u\n", + bank, desc->physical_start, + desc->num_pages << EFI_PAGE_SHIFT, desc->type); + bank++; + if (!efi_mem_type_is_usable(desc->type) || + (desc->num_pages << EFI_PAGE_SHIFT) < 1 << 20) continue; gd->bd->bi_dram[num_banks].start = desc->physical_start; gd->bd->bi_dram[num_banks].size = desc->num_pages << EFI_PAGE_SHIFT; From patchwork Sun Nov 24 20:27:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845219 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861668wru; Sun, 24 Nov 2024 12:28:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUEWGohcwWrl2CV0n5Itx2ZXSjFpjFV9PRrWPZM6/WCm5QuPl4UnUKkKtVSChHYrs9zIA4iYQ==@linaro.org X-Google-Smtp-Source: AGHT+IFM0RfZl4wpSJFP+XAeYL95hjUJU8y7x+JNIvp0OI3BAZUrc/OXk5nyq/VH1HPmkdscX7zj X-Received: by 2002:a05:6402:5242:b0:5cf:d8ea:42f5 with SMTP id 4fb4d7f45d1cf-5d0205fc3e1mr7993667a12.10.1732480122199; Sun, 24 Nov 2024 12:28:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480122; cv=none; d=google.com; s=arc-20240605; b=bO04HUws47ej1JnhI33eDcTSArLNxZ68fx12DV3DYn9D9LkkBGTp2Jx4Fhgp74tDSU U207pGWqzRz8dP95tTc1Yl4AwJhu+BdDxth2cfZLORpL93YvZNhuFmjRMZ8JuZapHVXU 6Qqb9C1qVOj9Wn2u7pwUW56c7HUrKw5OCqeKXgB290Nyx/zE1dYSkRaSA5OMXXPHAie9 r6K2F3xVuyeIfECr2mPIMMAhP5vmIblmj60d6twTi6ahUANGJhHFPxVg9aimRv70iXVh emKrfgu9yc8CZWyLKzWqG6aDT1YnfHjmd9W3CUp04uH5FoZAJ9cA/nkYcxoZ0fXl9yio XLLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=lpUxQwwmFw9bFeiYwkmIFnE5Thzcl48LnnV2hQz+scM=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=aD1JLv3CHRy1HsxMmcvkVWh91ElAZIxeHGXF274uYf2VMfX6sSB5EfxJkWlBskx/Yr Kfj7Cn570usl3KwEj1bJAMa0NBNDiSOfat/hFgNfeepP5hYZnNgAZcjWqs1nsUIXD3Tq /5fsgsFwUrFIztLXdWRKr9An74smRoogxyUTyk+dKuEx71r4gCtjlOv5NKIFfvzh0He/ MjVE/mKb9KxNKR+z62nSbk953NWZEvOnX+28e4kb329nIYFlSea/4W5FppoZtOiS8fu6 xZueTvV7gT6WC8oWoIjN2YepJ3IHMsVqdCAH0JKTydoFC9AgP28jZ8Zu7PFUeZUWlZ2r nFxw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ca50aFmA; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa50b5086d8si377862966b.382.2024.11.24.12.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:28:42 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ca50aFmA; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE79889559; Sun, 24 Nov 2024 21:27:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Ca50aFmA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC42189920; Sun, 24 Nov 2024 21:27:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2E40889550 for ; Sun, 24 Nov 2024 21:27:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-aa51bf95ce1so343427866b.3 for ; Sun, 24 Nov 2024 12:27:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480061; x=1733084861; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lpUxQwwmFw9bFeiYwkmIFnE5Thzcl48LnnV2hQz+scM=; b=Ca50aFmAm4s+J+rfsnQ8GJXaL6ggfKh0v5F/mXJ5Hrk56cs5msxxSX0B1l3ToGZnYQ vIni8HgKC2Odw7DmMoXIT7zF3gEKxc+b40qQHQl5ps7P60LOAzG1sG1WItQY+Idr6bYL yn3jO0i5GUpAsuu4BUwdfeCLlDTfvHCN7fhdyGlKh4H3SsYjBa6Hb1duYL+GkoKuPTc4 YKVslKtJjQG6XPWNS7St9Un0yvhST02ALQSBgMw245HxCjsmAIfz5+avMtsWx1r9G84f aGd2pCOL0Lp8Lf0HJZNs5XvxSoXFZzZFetPLLaYRjLxcgF9ue79y8r/WsBQ1Eku9M6vO 1rsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480061; x=1733084861; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lpUxQwwmFw9bFeiYwkmIFnE5Thzcl48LnnV2hQz+scM=; b=hS0wW6vvf8mj1IbSVAPaUtr2hz/Bgdmji47npV40HOIGrmbklaS+z762NDKeEp9p+9 78B29nsWt5LDrVeerXwZ0NRISJ+hoeKk0GbUPq3Hif3GzqyKJUpHQhmM9Hgr4iqPk6le XMYTT6nVE/LTktXO+FYJc2a08bpSCDuviXHTBGbR8JI374pn9w+I4o996+x+HkJ9CXcA SDbHm53DtCQhMRpuV9xNzY1JUy8b91C959eKOnBUf5j3qrltiqpANk7L78QJZ3Ealv9t x+zcJ2Q7bDH/BVRtNj2+bKa02iARofTXrxtypi8hoWZg+RqNkYIJNW5EJLteavqlih0P 3BQw== X-Gm-Message-State: AOJu0Yxbxq2Up/QC0iaRPBzugGPRzYDyqvZorj6sezN5AIRDmbnO1e1o 65+NiN137UkiLokLRr8iIesMznIdgfUblUNfpCYPmS4tZ0oyJAAUIP77G5Djz5A= X-Gm-Gg: ASbGncucR8nYnvLT68Zs+rdTejjzpAi7tav4WF2ie2EcSJYjd0hO7kx3nvx2gf7qbK9 pfDGR6F9xqtQ5vznFqmbzDBZSoDR7LzffvHDjdjkBlEoeOrRl611j7XyVp6LbpEvZSOa3afXQPa SxBr4mxhEMoR4ISCyNjf8zDg3A5bkRrpP8qBJRa4VMhcV+hxkhXwuL8GFomW5Y/y/E4+CeNP266 mA92n1r08YJErDW1t9VxNPh/Fo9nWPzsQ+US3u8T32cjL6JBzkBVIjnVHMMUj4b2PzC X-Received: by 2002:a17:906:319a:b0:aa5:1957:3431 with SMTP id a640c23a62f3a-aa5195742demr843942366b.1.1732480061661; Sun, 24 Nov 2024 12:27:41 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:41 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:03 +0100 Subject: [PATCH RFC 07/14] efi: stub: add known memory to U-Boot's EFI memory map MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-7-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3219; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=82PHdaNRpiJtg6jlRroX7Blcj1PA8ll6Md2RMXHogzk=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHqMuzetZmp/+Fj7yYVT4vHB5TqDmxlNxEm2MAiv5d 3UzLtzaUcrCIMjBICumyCJ+Ypll09rL9hrbF1yAmcPKBDKEgYtTACbSYsXwv3aZ/kyO6dNXM/zk Wr+It+Zuc/LB594+DeXJs2eyJgYxb2Fk2FW94qVC4bucmFklvI/WBD69Gtrpp5G/9jRPyHXZ1Jr 4XQA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When running U-Boot as an EFI payload with CONFIG_EFI_STUB, the reserved regions from the previous stage EFI bootloader should be carried over since they may not fully align with the reserved-memory regions in devicetree. Implement a helper to map these pages when the EFI subsystem starts up. Signed-off-by: Caleb Connolly --- include/efi_stub.h | 7 +++++++ lib/efi/efi_info.c | 31 +++++++++++++++++++++++++++++++ lib/efi_loader/efi_memory.c | 5 +++++ 3 files changed, 43 insertions(+) diff --git a/include/efi_stub.h b/include/efi_stub.h index ff3befd4830b..343c84435970 100644 --- a/include/efi_stub.h +++ b/include/efi_stub.h @@ -56,5 +56,12 @@ int of_populate_from_efi(struct device_node *root); * EFI payload with CONFIG_EFI_STUB enabled. */ int dram_init_banksize_from_efi(void); +/** + * efi_add_known_memory_from_efi() - Add known memory pages from the memory map + * of the EFI bootloader that booted U-Boot. This is only applicable when running + * U-Boot as an EFI payload with CONFIG_EFI_STUB enabled. + */ +void efi_add_known_memory_from_efi(void); + #endif /* _EFI_STUB_H */ diff --git a/lib/efi/efi_info.c b/lib/efi/efi_info.c index f9743a3e7fad..ef4e646b082b 100644 --- a/lib/efi/efi_info.c +++ b/lib/efi/efi_info.c @@ -5,8 +5,9 @@ * Access to the EFI information table */ #include +#include #include #include #include #include @@ -177,4 +178,34 @@ int dram_init_banksize_from_efi(void) } return 0; } + +/* Called by U-Boot's EFI subsystem to add known memory. In our case + * we need to add some specific memory types from the original bootloaders + * EFI memory map + */ +void efi_add_known_memory_from_efi(void) +{ + struct efi_mem_desc *desc, *end; + struct efi_entry_memmap *map; + int ret, size; + + EFI_PRINT("Adding known memory from previous stage EFI bootloader\n"); + + ret = efi_info_get(EFIET_MEMORY_MAP, (void **)&map, &size); + if (ret) { + EFI_PRINT("%s: Missing memory map\n", __func__); + return; + } + end = (struct efi_mem_desc *)((ulong)map + size); + + for (desc = map->desc; desc < end; desc = efi_get_next_mem_desc(desc, map->desc_size)) { + switch (desc->type) { + case EFI_RESERVED_MEMORY_TYPE: + efi_add_memory_map_pg(desc->physical_start, desc->num_pages, desc->type, false); + break; + default: + continue; + } + } +} diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index d2f5d563f2a0..50b0010608e7 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -7,8 +7,9 @@ #define LOG_CATEGORY LOGC_EFI #include +#include #include #include #include #include @@ -834,8 +835,12 @@ static void add_u_boot_and_runtime(void) int efi_memory_init(void) { efi_add_known_memory(); +#ifdef CONFIG_EFI_STUB + efi_add_known_memory_from_efi(); +#endif + add_u_boot_and_runtime(); #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER /* Request a 32bit 64MB bounce buffer region */ From patchwork Sun Nov 24 20:27:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845220 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861701wru; Sun, 24 Nov 2024 12:28:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX5u1FEo8GT9SQB6/DVmI5X45S8QvBj+Ai9bPUYjVE8HEi9wTPji1kd+8YIWtS4sIilEBdIXQ==@linaro.org X-Google-Smtp-Source: AGHT+IEVtApRjYdn3QFRxT0/ljbObglk5yy6vnBaY/yygBWMj/C4SroabvCl/RcuODDitQUhLEg6 X-Received: by 2002:a05:6402:1ec9:b0:5cf:d2ab:6bf3 with SMTP id 4fb4d7f45d1cf-5d01d367034mr10498680a12.0.1732480133042; Sun, 24 Nov 2024 12:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480133; cv=none; d=google.com; s=arc-20240605; b=g/FA51t748IZNQ07GiZgTOatEfJ91bIIYIYv7Cd8YyUcnUPiN5uRzEvn9K/Xdv3AtX Zi/roqxG0JIeFUoENA+1ysnExvncQWnwsbaUY72xlhldaFwzfJRFnHsUcQL0uVYUBRmg G6rRIASJ37Ny/08/F/iIJKzka1FzPAi5AAiWW/fCt9PkTOUABywodO7WGGWIyMqtl02I MDWCB2LaXUcaY1Kfw9XUsgM4Z44wJC2KKr74nF5Vuwr+ihejDdDb3bZcFW4lAPghchS+ k/9Nw5bhxuZH/lGorxY0YgYzH8NcwMlbMGXBmgPI42AIbE394yY6GgjfeLskEPEzlYUl UIiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=tMiqRhrEmexn1JVPb8Plej2ovd5t/ZqG05OkUd4Q8OE=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=S3C5BtHo8wIKUohC4zLBTwXadkWsx5KxQkE5zW8L3t27uY5N71rzJLyrk2A0HmI2QR XiKagaKTIY9C6J/+s8vPk81Y0X3KdHBrJNanNqugJTBliFC54hE9yPfuEgmD9wbE+AV7 EB4vzP8avl7XIf5lOJajoxgdMkpRLnlzELQd2ZVucj9ztBiAeWXQ0lNw42ZVSyW1BgeU blHX7gbfYnnrsHMpQ9dE6BNeAqn2VGQOlabgPvnS5khOHGRuPfCYW8uB5InIS6lieLNv ScdSdpirk3yIA746ZTKuYt+Zqka4oD0upMYkTsXQAw01QP6PytZA06rfilbqeRFbOA+O WoVA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H3aBMjGy; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d01d41d4f5si4038846a12.209.2024.11.24.12.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H3aBMjGy; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 321FC899CD; Sun, 24 Nov 2024 21:27:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="H3aBMjGy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7AD618951A; Sun, 24 Nov 2024 21:27:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 32AB28999A for ; Sun, 24 Nov 2024 21:27:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-aa539d2b4b2so171728366b.1 for ; Sun, 24 Nov 2024 12:27:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480062; x=1733084862; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tMiqRhrEmexn1JVPb8Plej2ovd5t/ZqG05OkUd4Q8OE=; b=H3aBMjGyo5JHzFkW0ckkLmaQzartccui0IwoSBT2fg33/wzEHwjzi0ZoiD8Da8GC7F Mege6zXmHU9jnG9ElTNWlma9Ir7i+rq6TiDPfzAkjQOqgVm2+XB3jd16/i7PqHCoZ/Zj yS9KBDN3GS811ZztxHQu9xibrQ4hyB+CZg+vdDjQY6FtxiFCppvkVjs7oW2gU0gvaMZx 8y0Id75eZFgsBbAeiIGMwOEKh1B0Z9lCwbI1hE9/WK3pjHzxG+5QU58wQaRSuYkkN944 iWx9nNg+QfCPDEoTReaxRVS4catTqsb4qORksdbvv5M0nvWyDhJT9Hw2pw0fKm7R4xX4 JWbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480062; x=1733084862; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tMiqRhrEmexn1JVPb8Plej2ovd5t/ZqG05OkUd4Q8OE=; b=UQz4VtKHF2yw13oas8n+pQxFuF0xHtaWe/zSg4wYvC/F61mVSIF4y/dorjrBX0hmcz 5ytRoPZmdULPoRbYzB+kABhKKgMIR8HmCpiZnC/W1V+2b5b9muzDScfobggDx+v9aGqv zdx7lDvDFDeLhXZ2Nt2/koStBFA67NGAM+b9/WzDJVRrx0XFr3mybuYKcg5Bl8yTTklb rSfCc9AvSMl30jWgia0BeX9ybVKDqfwcocUDsJLfrJhdo11YKfhiBZs2F7+YUEMMGiVM a/Ght7jCXKTayIo9+mK1BqROeyCORwTWwkGvZL1PcCUQ2oG9os7ysy6YQahkopsVXrp7 LASg== X-Gm-Message-State: AOJu0YxN71M8EjhBxgxqEvrSCV7xHX3wH6DqguywFn9i0XqXJk2OysPn d6Nk901VKEpWDCWQ+LIa9PPWckpZl9Z6LUqoVJhhx1YljfHOeUmKsmGgeosTMGM= X-Gm-Gg: ASbGnctiUguKGAa0H9ml89sFjTnjfivZhl5utifUEc7xWWLTiotdrDGGz+caSeQ/vzs 6tH0wePASWorHvZQ+zuJVlmS2+N0baJZW32SjVrvl+5p7JUxBEdHqHKQW9h0SzELZpO11USVkie abN75nUvD4pikVv0bTbNbJSyNKT1k4KvZxKEr9g9W5EUSwpm3aKCpU6nmd7+v/BDCy7M9sAjQ3J Nxe9plsUCCaxWK6515foGkPxkag5XUZhMwUJOVxIa4QtuxV6lrYZnF9D1qmyA5pkdCj X-Received: by 2002:a17:906:3cb1:b0:aa5:1d09:2083 with SMTP id a640c23a62f3a-aa51d0920c0mr931769066b.13.1732480062651; Sun, 24 Nov 2024 12:27:42 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:42 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:04 +0100 Subject: [PATCH RFC 08/14] mach-snapdragon: support booting with EFISTUB MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-8-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3413; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=bnXyHbJrrjUj8gai5xh1lap2MF28gSjtPXd4TM2v+Og=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHiN25jZOkR9t6wyOa9wJU8qXmT73RmzCqivJ3y50v 2bZ5ajVUcrCIMjBICumyCJ+Ypll09rL9hrbF1yAmcPKBDKEgYtTACbyuY/hf0rzv0Oy8mHbXymk 33D58vojb/4LrzDFDpZdnhWBhYHTmBj+WVcZtMueOb1wWnvyetu0RLn9Vu/ypu6tjO1KPbLkvcg WbgA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Retrieve the EFI info header passed in via x0 and use it to populate the memory banks when booting with CONFIG_EFI_STUB. Signed-off-by: Caleb Connolly --- arch/arm/mach-snapdragon/board.c | 15 +++++++++++++++ arch/arm/mach-snapdragon/dram.c | 15 ++++++++++++++- arch/arm/mach-snapdragon/qcom-priv.h | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c index dbac8aa2709a..f92b26c88d46 100644 --- a/arch/arm/mach-snapdragon/board.c +++ b/arch/arm/mach-snapdragon/board.c @@ -41,8 +41,10 @@ DECLARE_GLOBAL_DATA_PTR; static struct mm_region rbx_mem_map[CONFIG_NR_DRAM_BANKS + 2] = { { 0 } }; struct mm_region *mem_map = rbx_mem_map; +struct efi_info_hdr *efi_info __section(".data") = NULL; + static void show_psci_version(void) { struct arm_smccc_res res; @@ -59,15 +61,28 @@ static void show_psci_version(void) */ void *board_fdt_blob_setup(int *err) { struct fdt_header *fdt; + struct efi_info_hdr *info = NULL; bool internal_valid, external_valid; *err = 0; fdt = (struct fdt_header *)get_prev_bl_fdt_addr(); external_valid = fdt && !fdt_check_header(fdt); internal_valid = !fdt_check_header(gd->fdt_blob); + /* + * If EFI_STUB is enabled, we got handed a pointer and it's NOT + * a valid FDT, then it might be the efi_info table! + */ + if (CONFIG_IS_ENABLED(EFI_STUB) && fdt && !external_valid) + info = (struct efi_info_hdr *)fdt; + + if (info->version == 1) { + debug("Got EFI info header!\n"); + efi_info = info; + } + /* * There is no point returning an error here, U-Boot can't do anything useful in this situation. * Bail out while we can still print a useful error message. */ diff --git a/arch/arm/mach-snapdragon/dram.c b/arch/arm/mach-snapdragon/dram.c index ef226e000858..0493653e432b 100644 --- a/arch/arm/mach-snapdragon/dram.c +++ b/arch/arm/mach-snapdragon/dram.c @@ -7,12 +7,15 @@ #define pr_fmt(fmt) "QCOM-DRAM: " fmt #include #include +#include #include #include #include +#include "qcom-priv.h" + #define SMEM_USABLE_RAM_PARTITION_TABLE 402 #define RAM_PART_NAME_LENGTH 16 #define RAM_NUM_PART_ENTRIES 32 #define CATEGORY_SDRAM 0x0E @@ -89,9 +92,19 @@ static void qcom_configure_bi_dram(void) } int dram_init_banksize(void) { - qcom_configure_bi_dram(); +#ifdef CONFIG_EFI_STUB + gd->arch.table = (phys_addr_t)efi_info; + /* We actually parsed a memory map from SMEM (and used it to + * set ram_base/ram_top), but it's better to respect the table + * from the EFI bootloader. + */ + if (efi_info) + dram_init_banksize_from_efi(); + else +#endif + qcom_configure_bi_dram(); return 0; } diff --git a/arch/arm/mach-snapdragon/qcom-priv.h b/arch/arm/mach-snapdragon/qcom-priv.h index 690557463642..58b8cb497482 100644 --- a/arch/arm/mach-snapdragon/qcom-priv.h +++ b/arch/arm/mach-snapdragon/qcom-priv.h @@ -4,8 +4,10 @@ #define __QCOM_PRIV_H__ #include +extern struct efi_info_hdr *efi_info; + #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) void qcom_configure_capsule_updates(void); #else void qcom_configure_capsule_updates(void) {} From patchwork Sun Nov 24 20:27:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845221 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861731wru; Sun, 24 Nov 2024 12:29:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUM8+Ehlf8sJsefSor9kSOhhhQbOWYJR5pnuIN40LS5/2oabNmhKGTegTiHiVbqpEMvphEL3A==@linaro.org X-Google-Smtp-Source: AGHT+IG8GXhWuSDD1yGCfaLoaDDLCN0A9DTfCo47AZvMV/85fgKPFq+kIj784ne55J1k9M1gfauG X-Received: by 2002:a05:6402:350f:b0:5cf:c198:e510 with SMTP id 4fb4d7f45d1cf-5d01d3de70emr10438664a12.1.1732480144654; Sun, 24 Nov 2024 12:29:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480144; cv=none; d=google.com; s=arc-20240605; b=RdmDDPAIgapmUfkQmEY8PgQ/jUitGpId/a7o2Ema+vx0HY1WPZ3/PwkEYCcTQer859 FDFna542KXZN+tY1cDspZXKM0fAPib0JwPwilPv2dwUofTuhK/jFa4gP4khJm6UWQ6JK bkXyhAvaRKxe714Do/lxcSruXBBeEZrM78HolTTgAk1jJt4KwEwqgfTpnPuKtJjVx2Q+ o6zSKPB0i0+tTrrGxOLm7/dSiR9tENtaymQ161s4CHFMW8OWl1lfuidUGudVZDoUCBWW ymrHUlU1Bmkbk+T6a8BoqSb8SopCIG2rzCaMtEUa/9M8WzfzNKOMIYRjskmoQ0Q6XGiv RJDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=xddMWgdhIA943YyfjJXuDDfnCAKdDdvEQznM/dPME+Y=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=iHatE1xz60JBoLjZhjQBaxZsuJVr1FFru4YymoK4N8QanWJUf5Z97E5fHp7e5YDQsl vicgCBBLuehNG4cc+Cijej6DYAyyo+//F6vHqA+cExAOwmGXZYlntAs5HfcjaHyCh+Nl 0cSCK9REj0kNPAt2AMtZliyi/Peoeniz+F/zmyrpOtCJexSte/VHiUoe8Iy17V4ytCz3 MtC+tHMZ3c23NwcMMdKasyUtTO8LkO2OUupx7rO0zZ7RJFo9yD45DMiNa6LpFm4l0OVQ eUMI32ipNjcBp2yMcdYpBCHh+NmZKPuhp1UQ8p1Ekp29mnzh9pEzlXYjngTFOma9M0YJ H9Cg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uX+CQiLr; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d01d41dea5si3841395a12.259.2024.11.24.12.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:29:04 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uX+CQiLr; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 87FCB89903; Sun, 24 Nov 2024 21:27:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="uX+CQiLr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51546899D0; Sun, 24 Nov 2024 21:27:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D6390895B1 for ; Sun, 24 Nov 2024 21:27:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5cfcb7183deso8220339a12.0 for ; Sun, 24 Nov 2024 12:27:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480064; x=1733084864; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xddMWgdhIA943YyfjJXuDDfnCAKdDdvEQznM/dPME+Y=; b=uX+CQiLrmHyG0NhvtY/jqWEyrKaFW7NbJjRP6aN3YwWzAOnTngFZXv/EI1cBmSajMq k6Q+dL6ezskUgz5fP07TMhow17uiVINT7IEC0HCYmwOdTuYYN5BppWuIzNut4TTfe13v xB2dW3uSFm8ncRadxJGW0M/sgTRoN6BUZkBxUpTTW76O1FeLKPYV0MoBmwujEpihPTjP scVhZdOWovNiUz+5aKwCx430T98KUvLfUGeg/HN10zTFTt/yY4WyXq+gesRUU8Ny3lzl Kjv84W4u7yV2LbK5rSA//xwMobwXrOMDKUwPeyyjs5apMIgYqvBPKHEApqaV8bA6pFd7 Uqqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480064; x=1733084864; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xddMWgdhIA943YyfjJXuDDfnCAKdDdvEQznM/dPME+Y=; b=mWUmPdC/J686jAQuRm3vCHoUI/yFuZgfmOu8tmwvnHGEocIbn8iuBisLfTxV4ahR6S 3agAQX4xh1BXCEsbDlnGaUDFeVut+viEq9LDhOL9qfBKW70fGB9VB7LUrjFzpLYxxD2U Ux3Oyu7xTjUWxQgeiCJ49RDPmULvtM87kTeaJBjsNMXwIn2OIzEJhLaHY6zPyl4/93WR JzDA0Nsy0Pzou0RWuTmO3d/ILeFR9tt/2dhCBEPtAexuxAhYDn4pzS2FE4QUTGzexNVM T8/h9qIc8ZOZuqTtDHKERxc/zvAG+Zht15LAKFA3D2hO74YdtLH3VA6BjN3oreru436E xpLQ== X-Gm-Message-State: AOJu0YwPXRpyrs81MKXLgfRUgpOXP1SkhiyIweuIqksD0pnf2Ak4boFz c6iNBrbAxH2enMWavnhMkovMhsmJMxvgVjL42t+eyHOMB7/EuUozETux2Fu72do= X-Gm-Gg: ASbGncuQ1SAZRaE2RaEPvXcLXxTwhCy+KfudZuz21dKvTLmhsdCLg1T92YpC9hpucli qnziF1x1kfRsaozopKfM7P5cV0GlqBV2JSohoF6PbjInEupQWtzyZRZG9gsuhdL9Ra16c74rxPV pmpujS3eSIIxkrYNowVEly08yq5cEh3JCI4DcSebxs77QnibQbpnhWwtgd8bIoOd0OS4z7VTPdj ppWDJEieFLoVnTupqWUp00rqG2VLNeCjpqhgCh6phXderfwB4VGHIti90cmmOAYpWsw X-Received: by 2002:a17:907:d23:b0:a9a:170d:67b2 with SMTP id a640c23a62f3a-aa509d5c3e0mr1261638166b.29.1732480064345; Sun, 24 Nov 2024 12:27:44 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:43 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:05 +0100 Subject: [PATCH RFC 09/14] common/board_f: init malloc earlier MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-9-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1324; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=TdQaHg2gZo8/a+Qm8OtrnXXmL8zMHHJSf56iwUc+Lfc=; b=kA0DAAgReTBFn7kwMhcByyZiAGdDjDKiuBiefUhk/AZCqh4hfQttzWhFCqcyKkYKRvMs6En3b oh1BAARCAAdFiEEF8imOYKt0z8ot6DQeTBFn7kwMhcFAmdDjDIACgkQeTBFn7kwMhefjgEAuLCM 70oEUioBeQ6jRwHbferbCV0L82RSQfaJ7jCMmgYA+wTg8J3mo+qVzMxwEzTFXReUccfZOR7r5Qv 59uuyXjoH X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Currently the early malloc initialisation is done partially in board_init_f_init_reserve() (on arm64 at least), which configures gd->malloc_base. But it isn't actually usable until initf_malloc() is called which doesn't happen until after fdtdec_setup(). This causes problems in a few scenarios: 1. when using MULTI_DTB_FIT as this needs a working malloc (especially for compressed FIT). 2. Some platforms may need to allocate memory as part of memory map initialisation (e.g. Qualcomm will need this to parse the memory map from SMEM). Move the initf_malloc() call earlier so that malloc is available during fdtdec_setup(). Signed-off-by: Caleb Connolly --- common/board_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/board_f.c b/common/board_f.c index 98dc2591e1d0..bddfa6b992b9 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -867,15 +867,15 @@ static int initf_upl(void) } static const init_fnc_t init_sequence_f[] = { setup_mon_len, + initf_malloc, #ifdef CONFIG_OF_CONTROL fdtdec_setup, #endif #ifdef CONFIG_TRACE_EARLY trace_early_init, #endif - initf_malloc, initf_upl, log_init, initf_bootstage, /* uses its own timer, so does not need DM */ event_init, From patchwork Sun Nov 24 20:27:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845222 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861785wru; Sun, 24 Nov 2024 12:29:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWiix0YuJvCzkXVBQsrhhdf0tG7mmy3df7ZIHzrlFHtz26B6cve8EheE1oWm9NpksupEoDeLA==@linaro.org X-Google-Smtp-Source: AGHT+IF067huPbj7wLZ3DsOCTUnQgYjZfnxqziZbHX47oBeqjxr+TqGedpJl0/8Vw5SPWvCsDw8j X-Received: by 2002:a05:6402:1e93:b0:5cf:de89:9364 with SMTP id 4fb4d7f45d1cf-5d0205f4b61mr8437947a12.10.1732480154568; Sun, 24 Nov 2024 12:29:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480154; cv=none; d=google.com; s=arc-20240605; b=VaeVcTg52ypYJ7eqKTugwWwkx4A8HGhuVrFPC3zg/BKe2LoSM6Ke/MCeVf/+AfwSx1 BT/juTE1+Gu39zCl9NwIOS57o3BWVfqpPWNsbxo0UAn9EzuXV2QYRxOTjKPWGi59p6Kd WFOsXImeHDeZvK+ATp20TpooasbeAl9Nwdaof26CoZUaMfUbhH+nfI9B9By+amj1Et5L Hw+hA14U9bVp1R6kW+mM0ptVTnuil4E8P3XWAqS2F4lqhGlDJID3yFo40AMVccfCTcW0 8Soik/cSHoUFR1mOaYdwcSgrUS3kdE999cPUDfuOoW3WssMy30KYjaFLn+gFdBabG0br CN8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=7Kbcc3xKL6dcJJPYbXXhKwt8rVws9CmiA1f0GSAEP1Y=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=Eqgq5TuGTdkoyrS47GpDIGhfAYFKW5+HauPtDe7RxpDDT4KTJOE1aEkFRXcwhp0y9Q BORgPUIZBfoOdbwuhj7u3Sv1+9x6WQK2HNm6KFexboiG2P0edU9RckAt4tBOf0fyDJuV ZHUCTEg5jdWXRS+fI0+Sefzm26BlfeySJp0Ts/f74ETyfBMlHYLAzZLyf1Pbh19KGCQY 6KDs3+BHsMY4Gliq8UOAJHDvYIR5G57OzHNaLX77KseLzi3HoJUKZtUN3jEzUJ+M2co8 Xu7wTBXZXhVknMptqaEsjqJ0aRK2Kjc8M2wlreQv68t7BbsfyguCfYyObzB3KQ7IFi2k 64mQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FVZQs/YV"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d01d5499b9si3868991a12.468.2024.11.24.12.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:29:14 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FVZQs/YV"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D81CE89939; Sun, 24 Nov 2024 21:27:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FVZQs/YV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E3666895AD; Sun, 24 Nov 2024 21:27:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E42DF8975F for ; Sun, 24 Nov 2024 21:27:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a9f1c590ecdso630979266b.1 for ; Sun, 24 Nov 2024 12:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480065; x=1733084865; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7Kbcc3xKL6dcJJPYbXXhKwt8rVws9CmiA1f0GSAEP1Y=; b=FVZQs/YVhEr8YuNXi9OgIRLnwe0r2PdwUhHQXhEsHpKbdghn2Uxp+D7MHjvISIhYPQ VDbYsPsjIiDOvuL9Ach8srUlqg4llhg0SLaRFwAjxx2meOfBMx/UP9rM04pzC63xLwqa jSTMibLSSHLmma3HGcHvvUuRfYpdrz2iwFGYGj2TrJmSiSud3SEkRBB0KlALwT+l6Pzw Rwyb7DtN7bb1W0AODFYM8qrL3Onqv+NxAOpNvDjfbpkxhLqGIrH0ZQ+XoF+J0q5hf8N+ BpEPcNcIgSRfvskZYFSkep4yB+4lV6fJrqZwrGoq2JjjNlyu6Hf5a2j9CAsGzw5qZY3U CbWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480065; x=1733084865; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7Kbcc3xKL6dcJJPYbXXhKwt8rVws9CmiA1f0GSAEP1Y=; b=aY9o/lmMqy66nU4fCMgkVrOPumSDLpABuekQB07JuPVi0d7f6kejlhZtJiyqUjUyXf 4090XXuMbVacfqtCkCJlVtaJA2f5jpNobQhoW1GQ37MwTL9gDdlDCrnc0GVYhfSp9D85 OP8SIWsha1jomqa6RRnuB2PuyNIKzpDyvfO7faHlL+xvXhkICNdfYrdWmz4Y15M369jP T2TvFoeG9gmDfrDCoY2xjb4v5VBLiiMJ9koZphE6/ShmzLo+8DvS/Rb9f6C17SE2ftpj 1FXY6EnP+eTw7ulGZGbd9RDP1DB4gJAs72Aa5dsqPMKrZTZLbhfFTqFGwMusDD/TIIiP bxqA== X-Gm-Message-State: AOJu0YxsMjwnWh8yKm+EuMJH+pta1jts6VPM1weIyC554+Ttv5NvNKeM oA0PG2inAvWD/nIcRQ4QztwO/I9UUiFXQWR463AuR9pNbpAQtTXYyRdeMxPoVgs= X-Gm-Gg: ASbGncudjokOeZHqFbR+/QrIYrfkLr2SJEL0rRJG3TUVkqHvosJcj1E1KCX6jo3PlBd wGDeim94g9BoAt8VSjfZ27UZdqMgf7PdXKK7WtlJqHPjLiGILLfaGqyvKi8TL240j+1BjWW6Ex5 LaclXEhMfQgWaa0uX8iJsuSdA0LuCI5BSgI2wCTsySqwqNwUbOsN337IKfSqwX7O4nHbTPDPW+0 aNW3eSJaKKIz5VXGqFUqO0CzxefznXNNgnjkpCiDO3WRSx7zbJ4wkzsTbF8vCGBfobI X-Received: by 2002:a17:907:7701:b0:aa5:2706:c3f with SMTP id a640c23a62f3a-aa52706112emr645278366b.47.1732480065373; Sun, 24 Nov 2024 12:27:45 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:44 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:06 +0100 Subject: [PATCH RFC 10/14] clk: qcom: Add X1E80100 clock driver MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-10-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=14063; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=L9l5gf4cpWXGwXM60opUTqHhRRmfIxeLOaHHLgd/jFY=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHiOunRsu7NyR4bD1Q9jxf31FDys/qPc9m+tvHhy5O 0x3d/7RjlIWBkEOBlkxRRbxE8ssm9ZettfYvuACzBxWJpAhDFycAjCR6Y8YGRo1Fv5KkPl/TCrp SWbgy4dt0xJbPN6eXG2ySzNApzJp4WWGf1r/fC0tM5sUi4NEnjyVPFg+Z5fOyd9bJmikKlukSr9 PvQMA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Neil Armstrong Add Clock driver for the GCC block found in the X1E80100 SoC. Signed-off-by: Neil Armstrong --- drivers/clk/qcom/Kconfig | 8 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clock-x1e80100.c | 348 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 357 insertions(+) diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index d76fca5dba41..c69eb7d11679 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -102,7 +102,15 @@ config CLK_QCOM_SC7280 Say Y here to enable support for the Global Clock Controller on the Snapdragon SC7280 SoC. This driver supports the clocks and resets exposed by the GCC hardware block. +config CLK_QCOM_X1E80100 + bool "Qualcomm X1E80100 GCC" + select CLK_QCOM + help + Say Y here to enable support for the Global Clock Controller + on the Snapdragon X1E80100 SoC. This driver supports the clocks + and resets exposed by the GCC hardware block. + endmenu endif diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile index ab33f1c5faf9..0189e053f23c 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile @@ -14,4 +14,5 @@ obj-$(CONFIG_CLK_QCOM_SM6115) += clock-sm6115.o obj-$(CONFIG_CLK_QCOM_SM8150) += clock-sm8150.o obj-$(CONFIG_CLK_QCOM_SM8250) += clock-sm8250.o obj-$(CONFIG_CLK_QCOM_SM8550) += clock-sm8550.o obj-$(CONFIG_CLK_QCOM_SM8650) += clock-sm8650.o +obj-$(CONFIG_CLK_QCOM_X1E80100) += clock-x1e80100.o diff --git a/drivers/clk/qcom/clock-x1e80100.c b/drivers/clk/qcom/clock-x1e80100.c new file mode 100644 index 000000000000..6bcd705f6c8d --- /dev/null +++ b/drivers/clk/qcom/clock-x1e80100.c @@ -0,0 +1,348 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * Clock drivers for Qualcomm x1e80100 + * + * (C) Copyright 2024 Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "clock-qcom.h" + +/* On-board TCXO, TOFIX get from DT */ +#define TCXO_RATE 38400000 + +/* bi_tcxo_div2 divided after RPMh output */ +#define TCXO_DIV2_RATE (TCXO_RATE / 2) + +static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s4_clk_src[] = { + F(7372800, CFG_CLK_SRC_GPLL0_EVEN, 1, 384, 15625), + F(14745600, CFG_CLK_SRC_GPLL0_EVEN, 1, 768, 15625), + F(19200000, CFG_CLK_SRC_CXO, 1, 0, 0), + F(29491200, CFG_CLK_SRC_GPLL0_EVEN, 1, 1536, 15625), + F(32000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 8, 75), + F(48000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 4, 25), + F(64000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 16, 75), + F(75000000, CFG_CLK_SRC_GPLL0_EVEN, 4, 0, 0), + F(80000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 4, 15), + F(96000000, CFG_CLK_SRC_GPLL0_EVEN, 1, 8, 25), + F(100000000, CFG_CLK_SRC_GPLL0, 6, 0, 0), + { } +}; + +static const struct freq_tbl ftbl_gcc_sdcc2_apps_clk_src[] = { + F(400000, CFG_CLK_SRC_CXO, 12, 1, 4), + F(25000000, CFG_CLK_SRC_GPLL0_EVEN, 12, 0, 0), + F(100000000, CFG_CLK_SRC_GPLL0_EVEN, 3, 0, 0), + /* TOFIX F(202000000, CFG_CLK_SRC_GPLL9, 4, 0, 0), */ + { } +}; + +static const struct freq_tbl ftbl_gcc_usb30_prim_master_clk_src[] = { + F(66666667, CFG_CLK_SRC_GPLL0_EVEN, 4.5, 0, 0), + F(133333333, CFG_CLK_SRC_GPLL0, 4.5, 0, 0), + F(200000000, CFG_CLK_SRC_GPLL0, 3, 0, 0), + F(240000000, CFG_CLK_SRC_GPLL0, 2.5, 0, 0), + { } +}; + +static ulong x1e80100_set_rate(struct clk *clk, ulong rate) +{ + struct msm_clk_priv *priv = dev_get_priv(clk->dev); + const struct freq_tbl *freq; + + switch (clk->id) { + case GCC_QUPV3_WRAP2_S5_CLK: /* UART21 */ + freq = qcom_find_freq(ftbl_gcc_qupv3_wrap0_s4_clk_src, rate); + clk_rcg_set_rate_mnd(priv->base, 0x1e500, + freq->pre_div, freq->m, freq->n, freq->src, 16); + return freq->freq; + case GCC_SDCC2_APPS_CLK: + freq = qcom_find_freq(ftbl_gcc_sdcc2_apps_clk_src, rate); + clk_rcg_set_rate_mnd(priv->base, 0x14018, + freq->pre_div, freq->m, freq->n, freq->src, 8); + return freq->freq; + case GCC_USB30_PRIM_MASTER_CLK: + freq = qcom_find_freq(ftbl_gcc_usb30_prim_master_clk_src, rate); + clk_rcg_set_rate_mnd(priv->base, 0x3902c, + freq->pre_div, freq->m, freq->n, freq->src, 8); + return freq->freq; + case GCC_USB30_PRIM_MOCK_UTMI_CLK: + clk_rcg_set_rate(priv->base, 0x39044, 0, 0); + return TCXO_DIV2_RATE; + default: + return 0; + } +} + +static const struct gate_clk x1e80100_clks[] = { + GATE_CLK(GCC_AGGRE_UFS_PHY_AXI_CLK, 0x770e4, BIT(0)), + GATE_CLK(GCC_CFG_NOC_USB3_PRIM_AXI_CLK, 0x3908c, BIT(0)), + GATE_CLK(GCC_QUPV3_WRAP2_CORE_2X_CLK, 0x52010, BIT(3)), + GATE_CLK(GCC_QUPV3_WRAP2_CORE_CLK, 0x52010, BIT(0)), + GATE_CLK(GCC_QUPV3_WRAP2_S0_CLK, 0x52010, BIT(4)), + GATE_CLK(GCC_QUPV3_WRAP2_S1_CLK, 0x52010, BIT(5)), + GATE_CLK(GCC_QUPV3_WRAP2_S2_CLK, 0x52010, BIT(6)), + GATE_CLK(GCC_QUPV3_WRAP2_S3_CLK, 0x52010, BIT(7)), + GATE_CLK(GCC_QUPV3_WRAP2_S4_CLK, 0x52010, BIT(8)), + GATE_CLK(GCC_QUPV3_WRAP2_S5_CLK, 0x52010, BIT(9)), + GATE_CLK(GCC_QUPV3_WRAP2_S6_CLK, 0x52010, BIT(10)), + GATE_CLK(GCC_QUPV3_WRAP2_S7_CLK, 0x52010, BIT(17)), + GATE_CLK(GCC_QUPV3_WRAP_2_M_AHB_CLK, 0x52010, BIT(2)), + GATE_CLK(GCC_QUPV3_WRAP_2_S_AHB_CLK, 0x52010, BIT(1)), + GATE_CLK(GCC_USB30_PRIM_MASTER_CLK, 0x39018, BIT(0)), + GATE_CLK(GCC_USB30_PRIM_MOCK_UTMI_CLK, 0x39028, BIT(0)), + GATE_CLK(GCC_USB30_PRIM_SLEEP_CLK, 0x39024, BIT(0)), + GATE_CLK(GCC_USB3_PRIM_PHY_AUX_CLK, 0x39060, BIT(0)), + GATE_CLK(GCC_USB3_PRIM_PHY_COM_AUX_CLK, 0x39064, BIT(0)), + GATE_CLK(GCC_USB3_PRIM_PHY_PIPE_CLK, 0x39068, BIT(0)), +}; + +static int x1e80100_enable(struct clk *clk) +{ + struct msm_clk_priv *priv = dev_get_priv(clk->dev); + + switch (clk->id) { + case GCC_AGGRE_USB3_PRIM_AXI_CLK: + qcom_gate_clk_en(priv, GCC_USB30_PRIM_MASTER_CLK); + fallthrough; + case GCC_USB30_PRIM_MASTER_CLK: + qcom_gate_clk_en(priv, GCC_USB3_PRIM_PHY_AUX_CLK); + qcom_gate_clk_en(priv, GCC_USB3_PRIM_PHY_COM_AUX_CLK); + break; + } + + qcom_gate_clk_en(priv, clk->id); + + return 0; +} + +static const struct qcom_reset_map x1e80100_gcc_resets[] = { + [GCC_AV1E_BCR] = { 0x4a000 }, + [GCC_CAMERA_BCR] = { 0x26000 }, + [GCC_DISPLAY_BCR] = { 0x27000 }, + [GCC_GPU_BCR] = { 0x71000 }, + [GCC_PCIE_0_LINK_DOWN_BCR] = { 0x6c014 }, + [GCC_PCIE_0_NOCSR_COM_PHY_BCR] = { 0x6c020 }, + [GCC_PCIE_0_PHY_BCR] = { 0x6c01c }, + [GCC_PCIE_0_PHY_NOCSR_COM_PHY_BCR] = { 0x6c028 }, + [GCC_PCIE_0_TUNNEL_BCR] = { 0xa0000 }, + [GCC_PCIE_1_LINK_DOWN_BCR] = { 0x8e014 }, + [GCC_PCIE_1_NOCSR_COM_PHY_BCR] = { 0x8e020 }, + [GCC_PCIE_1_PHY_BCR] = { 0x8e01c }, + [GCC_PCIE_1_PHY_NOCSR_COM_PHY_BCR] = { 0x8e024 }, + [GCC_PCIE_1_TUNNEL_BCR] = { 0x2c000 }, + [GCC_PCIE_2_LINK_DOWN_BCR] = { 0xa5014 }, + [GCC_PCIE_2_NOCSR_COM_PHY_BCR] = { 0xa5020 }, + [GCC_PCIE_2_PHY_BCR] = { 0xa501c }, + [GCC_PCIE_2_PHY_NOCSR_COM_PHY_BCR] = { 0xa5028 }, + [GCC_PCIE_2_TUNNEL_BCR] = { 0x13000 }, + [GCC_PCIE_3_BCR] = { 0x58000 }, + [GCC_PCIE_3_LINK_DOWN_BCR] = { 0xab014 }, + [GCC_PCIE_3_NOCSR_COM_PHY_BCR] = { 0xab020 }, + [GCC_PCIE_3_PHY_BCR] = { 0xab01c }, + [GCC_PCIE_3_PHY_NOCSR_COM_PHY_BCR] = { 0xab024 }, + [GCC_PCIE_4_BCR] = { 0x6b000 }, + [GCC_PCIE_4_LINK_DOWN_BCR] = { 0xb3014 }, + [GCC_PCIE_4_NOCSR_COM_PHY_BCR] = { 0xb3020 }, + [GCC_PCIE_4_PHY_BCR] = { 0xb301c }, + [GCC_PCIE_4_PHY_NOCSR_COM_PHY_BCR] = { 0xb3028 }, + [GCC_PCIE_5_BCR] = { 0x2f000 }, + [GCC_PCIE_5_LINK_DOWN_BCR] = { 0xaa014 }, + [GCC_PCIE_5_NOCSR_COM_PHY_BCR] = { 0xaa020 }, + [GCC_PCIE_5_PHY_BCR] = { 0xaa01c }, + [GCC_PCIE_5_PHY_NOCSR_COM_PHY_BCR] = { 0xaa028 }, + [GCC_PCIE_6A_BCR] = { 0x31000 }, + [GCC_PCIE_6A_LINK_DOWN_BCR] = { 0xac014 }, + [GCC_PCIE_6A_NOCSR_COM_PHY_BCR] = { 0xac020 }, + [GCC_PCIE_6A_PHY_BCR] = { 0xac01c }, + [GCC_PCIE_6A_PHY_NOCSR_COM_PHY_BCR] = { 0xac024 }, + [GCC_PCIE_6B_BCR] = { 0x8d000 }, + [GCC_PCIE_6B_LINK_DOWN_BCR] = { 0xb5014 }, + [GCC_PCIE_6B_NOCSR_COM_PHY_BCR] = { 0xb5020 }, + [GCC_PCIE_6B_PHY_BCR] = { 0xb501c }, + [GCC_PCIE_6B_PHY_NOCSR_COM_PHY_BCR] = { 0xb5024 }, + [GCC_PCIE_PHY_BCR] = { 0x6f000 }, + [GCC_PCIE_PHY_CFG_AHB_BCR] = { 0x6f00c }, + [GCC_PCIE_PHY_COM_BCR] = { 0x6f010 }, + [GCC_PCIE_RSCC_BCR] = { 0xa4000 }, + [GCC_PDM_BCR] = { 0x33000 }, + [GCC_QUPV3_WRAPPER_0_BCR] = { 0x42000 }, + [GCC_QUPV3_WRAPPER_1_BCR] = { 0x18000 }, + [GCC_QUPV3_WRAPPER_2_BCR] = { 0x1e000 }, + [GCC_QUSB2PHY_HS0_MP_BCR] = { 0x1200c }, + [GCC_QUSB2PHY_HS1_MP_BCR] = { 0x12010 }, + [GCC_QUSB2PHY_PRIM_BCR] = { 0x12000 }, + [GCC_QUSB2PHY_SEC_BCR] = { 0x12004 }, + [GCC_QUSB2PHY_TERT_BCR] = { 0x12008 }, + [GCC_QUSB2PHY_USB20_HS_BCR] = { 0x12014 }, + [GCC_SDCC2_BCR] = { 0x14000 }, + [GCC_SDCC4_BCR] = { 0x16000 }, + [GCC_UFS_PHY_BCR] = { 0x77000 }, + [GCC_USB20_PRIM_BCR] = { 0x29000 }, + [GCC_USB30_MP_BCR] = { 0x17000 }, + [GCC_USB30_PRIM_BCR] = { 0x39000 }, + [GCC_USB30_SEC_BCR] = { 0xa1000 }, + [GCC_USB30_TERT_BCR] = { 0xa2000 }, + [GCC_USB3_MP_SS0_PHY_BCR] = { 0x19008 }, + [GCC_USB3_MP_SS1_PHY_BCR] = { 0x54008 }, + [GCC_USB3_PHY_PRIM_BCR] = { 0x50000 }, + [GCC_USB3_PHY_SEC_BCR] = { 0x2a000 }, + [GCC_USB3_PHY_TERT_BCR] = { 0xa3000 }, + [GCC_USB3_UNIPHY_MP0_BCR] = { 0x19000 }, + [GCC_USB3_UNIPHY_MP1_BCR] = { 0x54000 }, + [GCC_USB3PHY_PHY_PRIM_BCR] = { 0x50004 }, + [GCC_USB3PHY_PHY_SEC_BCR] = { 0x2a004 }, + [GCC_USB3PHY_PHY_TERT_BCR] = { 0xa3004 }, + [GCC_USB3UNIPHY_PHY_MP0_BCR] = { 0x19004 }, + [GCC_USB3UNIPHY_PHY_MP1_BCR] = { 0x54004 }, + [GCC_USB4_0_BCR] = { 0x9f000 }, + [GCC_USB4_0_DP0_PHY_PRIM_BCR] = { 0x50010 }, + [GCC_USB4_1_DP0_PHY_SEC_BCR] = { 0x2a010 }, + [GCC_USB4_2_DP0_PHY_TERT_BCR] = { 0xa3010 }, + [GCC_USB4_1_BCR] = { 0x2b000 }, + [GCC_USB4_2_BCR] = { 0x11000 }, + [GCC_USB_0_PHY_BCR] = { 0x50020 }, + [GCC_USB_1_PHY_BCR] = { 0x2a020 }, + [GCC_USB_2_PHY_BCR] = { 0xa3020 }, + [GCC_VIDEO_BCR] = { 0x32000 }, +}; + +static const struct qcom_power_map x1e80100_gdscs[] = { + [GCC_PCIE_0_TUNNEL_GDSC] = { 0xa0004 }, + [GCC_PCIE_1_TUNNEL_GDSC] = { 0x2c004 }, + [GCC_PCIE_2_TUNNEL_GDSC] = { 0x13004 }, + [GCC_PCIE_3_GDSC] = { 0x58004 }, + [GCC_PCIE_3_PHY_GDSC] = { 0x3e000 }, + [GCC_PCIE_4_GDSC] = { 0x6b004 }, + [GCC_PCIE_4_PHY_GDSC] = { 0x6c000 }, + [GCC_PCIE_5_GDSC] = { 0x2f004 }, + [GCC_PCIE_5_PHY_GDSC] = { 0x30000 }, + [GCC_PCIE_6_PHY_GDSC] = { 0x8e000 }, + [GCC_PCIE_6A_GDSC] = { 0x31004 }, + [GCC_PCIE_6B_GDSC] = { 0x8d004 }, + [GCC_UFS_MEM_PHY_GDSC] = { 0x9e000 }, + [GCC_UFS_PHY_GDSC] = { 0x77004 }, + [GCC_USB20_PRIM_GDSC] = { 0x29004 }, + [GCC_USB30_MP_GDSC] = { 0x17004 }, + [GCC_USB30_PRIM_GDSC] = { 0x39004 }, + [GCC_USB30_SEC_GDSC] = { 0xa1004 }, + [GCC_USB30_TERT_GDSC] = { 0xa2004 }, + [GCC_USB3_MP_SS0_PHY_GDSC] = { 0x1900c }, + [GCC_USB3_MP_SS1_PHY_GDSC] = { 0x5400c }, + [GCC_USB4_0_GDSC] = { 0x9f004 }, + [GCC_USB4_1_GDSC] = { 0x2b004 }, + [GCC_USB4_2_GDSC] = { 0x11004 }, + [GCC_USB_0_PHY_GDSC] = { 0x50024 }, + [GCC_USB_1_PHY_GDSC] = { 0x2a024 }, + [GCC_USB_2_PHY_GDSC] = { 0xa3024 }, +}; + +static struct msm_clk_data x1e80100_gcc_data = { + .resets = x1e80100_gcc_resets, + .num_resets = ARRAY_SIZE(x1e80100_gcc_resets), + .clks = x1e80100_clks, + .num_clks = ARRAY_SIZE(x1e80100_clks), + .power_domains = x1e80100_gdscs, + .num_power_domains = ARRAY_SIZE(x1e80100_gdscs), + + .enable = x1e80100_enable, + .set_rate = x1e80100_set_rate, +}; + +static const struct udevice_id gcc_x1e80100_of_match[] = { + { + .compatible = "qcom,x1e80100-gcc", + .data = (ulong)&x1e80100_gcc_data, + }, + { } +}; + +U_BOOT_DRIVER(gcc_x1e80100) = { + .name = "gcc_x1e80100", + .id = UCLASS_NOP, + .of_match = gcc_x1e80100_of_match, + .bind = qcom_cc_bind, + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, +}; + +/* TCSRCC */ + +static const struct gate_clk x1e80100_tcsr_clks[] = { + GATE_CLK(TCSR_PCIE_2L_4_CLKREF_EN, 0x15100, BIT(0)), + GATE_CLK(TCSR_PCIE_2L_5_CLKREF_EN, 0x15104, BIT(0)), + GATE_CLK(TCSR_PCIE_8L_CLKREF_EN, 0x15108, BIT(0)), + GATE_CLK(TCSR_USB3_MP0_CLKREF_EN, 0x1510c, BIT(0)), + GATE_CLK(TCSR_USB3_MP1_CLKREF_EN, 0x15110, BIT(0)), + GATE_CLK(TCSR_USB2_1_CLKREF_EN, 0x15114, BIT(0)), + GATE_CLK(TCSR_UFS_PHY_CLKREF_EN, 0x15118, BIT(0)), + GATE_CLK(TCSR_USB4_1_CLKREF_EN, 0x15120, BIT(0)), + GATE_CLK(TCSR_USB4_2_CLKREF_EN, 0x15124, BIT(0)), + GATE_CLK(TCSR_USB2_2_CLKREF_EN, 0x15128, BIT(0)), + GATE_CLK(TCSR_PCIE_4L_CLKREF_EN, 0x1512c, BIT(0)), + GATE_CLK(TCSR_EDP_CLKREF_EN, 0x15130, BIT(0)), +}; + +static struct msm_clk_data x1e80100_tcsrcc_data = { + .clks = x1e80100_tcsr_clks, + .num_clks = ARRAY_SIZE(x1e80100_tcsr_clks), +}; + +static int tcsrcc_x1e80100_clk_enable(struct clk *clk) +{ + struct msm_clk_priv *priv = dev_get_priv(clk->dev); + + qcom_gate_clk_en(priv, clk->id); + + return 0; +} + +static ulong tcsrcc_x1e80100_clk_get_rate(struct clk *clk) +{ + return TCXO_RATE; +} + +static int tcsrcc_x1e80100_clk_probe(struct udevice *dev) +{ + struct msm_clk_data *data = (struct msm_clk_data *)dev_get_driver_data(dev); + struct msm_clk_priv *priv = dev_get_priv(dev); + + priv->base = dev_read_addr(dev); + if (priv->base == FDT_ADDR_T_NONE) + return -EINVAL; + + priv->data = data; + + return 0; +} + +static struct clk_ops tcsrcc_x1e80100_clk_ops = { + .enable = tcsrcc_x1e80100_clk_enable, + .get_rate = tcsrcc_x1e80100_clk_get_rate, +}; + +static const struct udevice_id tcsrcc_x1e80100_of_match[] = { + { + .compatible = "qcom,x1e80100-tcsr", + .data = (ulong)&x1e80100_tcsrcc_data, + }, + { } +}; + +U_BOOT_DRIVER(tcsrcc_x1e80100) = { + .name = "tcsrcc_x1e80100", + .id = UCLASS_CLK, + .of_match = tcsrcc_x1e80100_of_match, + .ops = &tcsrcc_x1e80100_clk_ops, + .priv_auto = sizeof(struct msm_clk_priv), + .probe = tcsrcc_x1e80100_clk_probe, + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, +}; From patchwork Sun Nov 24 20:27:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845223 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861835wru; Sun, 24 Nov 2024 12:29:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVevfZ2HVzxiuPcarcarjULvpRwUMDFwMI0TdylfclkMJgXRYGnf4gpP+kKnt/n7S6dvxG61A==@linaro.org X-Google-Smtp-Source: AGHT+IHsw0mzNev0pD9T9QPm4iPKebhZyv9b3+RUuthNFUyXcHh7ubzVMkjT0CDr9CBobrCIMxCB X-Received: by 2002:a17:907:7756:b0:aa5:46d3:4d88 with SMTP id a640c23a62f3a-aa546d37037mr297454566b.15.1732480163823; Sun, 24 Nov 2024 12:29:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480163; cv=none; d=google.com; s=arc-20240605; b=TzE/kcrhW6zDiE4+1NJ9EC1j6KsTofKehr0+Vlz7hI5QWpfY+8exjKh+0Z1cc1qvpU m53+02VZGWFivFhzV3mjfuFCZJgdR9i434fFlsBd4bjl2fH7x7Vjoy/Wy1Df/Tpk96rb 3/3LLRR7BF/yO11nCEdzk+yUUrkFT8vuPsdo966ExQkiefcEKNsfDZ1mBWy5RceCqDSI 8XNRVhzgnEcPgJEAMlI2tS4GadwcBxJUbtk70oKp5xifO3O6bBokpHhPG/thHOntKbPA BxsU8vXeDRDnZLa1wQaPXetsAn7VDuxBRRWKCYP0HRyAsnPQ1tdri9wlQZdWHuXzTkuZ 1F/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=2EcU1/WhYjSub51mghC2L/448jRXwuF7SafKgOB6eZQ=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=B8veMresg+Maod95AWcTJpOLBWadFlkYZWyDAbn4jdrnZRV1q9HeZTRX4GLXPrrKLq mqq8EVcD1DWPUoIdD36GqVJdAeL8HGe9HlDCoTbOI9xaDaktFBV995Ipj0GYF45h0INQ E0NOeNqGpX9QI8ZLHwl1NuYY4iGp0LhBHRYE5AdhxqRq9XU0F3dCfswR7hWOnn5hAO4t HTk9BoQyZbe5Jz74QEvtDb9Xi4QOMEJKa1gI8/IQE/axvCPPjx3SwpMFFayNM38B5fAY X6+EJzVwvKW7x86YU85X96IBCt70S8If3Xe0BPXqyt17v8dk15TKSZkWZ2LtrguL+OIX fMFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gi9IIX0L; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aa50b505ef1si398470566b.316.2024.11.24.12.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:29:23 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gi9IIX0L; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39D06899DF; Sun, 24 Nov 2024 21:27:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Gi9IIX0L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E93A089550; Sun, 24 Nov 2024 21:27:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E22BD89920 for ; Sun, 24 Nov 2024 21:27:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5cfadf851e2so5032671a12.2 for ; Sun, 24 Nov 2024 12:27:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480066; x=1733084866; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2EcU1/WhYjSub51mghC2L/448jRXwuF7SafKgOB6eZQ=; b=Gi9IIX0Ljf0icFhs+mNXQYxzYGJbp+MzL1h/pVpgHoIodfSG0LdLJS64KQD8/520sl vBE/HMfrm9rdpt7EOczMIHJHwL8P5GKdVYbI4caUF90oNeeU+fhs1qRTb7sok0tzSouv nVf7Ii9n7zvrNwFvUTz+iB+BzYyigQa2fkApyVOq2fAZlDXOWj2BDrFRC5Fmu83hw8iz hj4kcW4uRPhwnRnSoK/ZFcbjlgkvJmIbSZtw3KYokye3ZdY2PLam0pT2UfpqxNs3bTy+ l4kkqzy9YsAsnV5dCojNMkgVMKfF7Rst8TMG5Wvn2NKICXNKYcNvi5Bcu3DqhRnZK1ee 8Hxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480066; x=1733084866; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2EcU1/WhYjSub51mghC2L/448jRXwuF7SafKgOB6eZQ=; b=AqBAfXdoQn08lwJuh4RAgqvaTSNWZSk6cYVUj3c4kDOvWDB1QOQOvFKy7Yc517oQAh 6BG3mv/uc1FBKfspBo92FcCDQwyoZmC/IDyZYxGwsR48X+u5TOo7opAuvHSJHe7qy9x1 GL5HhglwyB3eoNpeIeV6Ncn8vnWV8QPBVi3Z71jAp6DGPrCMEN9kSPv43cKE9RDwNUha 4FyLM9UiKcQ5SOlghYbL2F6imjsBDOgSlvKDmJeQR3OlAqcpuhhOQvQLjOKvpmqkjYax zDEhfRoy33KISX6jbkNNcwHHmRoyfmdmJlbI40TBkfj2YsuKiUoi8WSbsYLAwLv4hG9E gWwA== X-Gm-Message-State: AOJu0Yy3SDjlsOdiV8s7jm2TlmNWfhhPIDwVmtm76cQbMoaMctYwobUT RAyb7uLxac+1LdaIYry3UvrslDMTAbM61XqeAI1Qi2wGBhbWd+9dlETpHW3Amo8= X-Gm-Gg: ASbGncs83ph+cia8POMc0AH5sAkCx5J+XzqZ4rGfUJwuiMFSGvmVeqW0fSW54gTyQEp op1SZxIHCJiJrYEvnFbGPv+ArgId0fzQvoCtaqUpKASBBiErPwL/Y1+9rmwOZUcgfPRL07yqdVB g2VFfekGo9UMmnH5IiOInMZiUg6l7pGMMhiIliRIBayz6dwgzxhD7Bc/vJTmjQUT+NZjTJOSdpx G56Z9Swm2ZLJ2XebvCJnuXanw1VaepACDekzIE+tsKOecVjAomjw6WGIUq0jV2jvs2j X-Received: by 2002:a17:907:7756:b0:aa5:46d3:4d88 with SMTP id a640c23a62f3a-aa546d37037mr297235366b.15.1732480066434; Sun, 24 Nov 2024 12:27:46 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:46 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:07 +0100 Subject: [PATCH RFC 11/14] qcom_defconfig: enable X1E80100 clock driver MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-11-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=658; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=dDJ2Cj/m1v/aGk08+LUmZbB2viS5ymnE60jdyIC9Pm8=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHqOXTyxet+ovK2Xn2v/is7ORy9VbTcyn1Cendrxt9 eRN4d7WUcrCIMjBICumyCJ+Ypll09rL9hrbF1yAmcPKBDKEgYtTACZiPJeRodE2fd6EtRH2/SXl 8WGzv5yfKmi7u3SV1SLl92p2s5R/vGL4H1hz/JLqMvF/x1YujDYsfGMvMC913y7bKVFXzi1OEzn llgcA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Neil Armstrong Enable the X1E80100 clock driver in the Qualcomm defconfig. Signed-off-by: Neil Armstrong --- configs/qcom_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/qcom_defconfig b/configs/qcom_defconfig index b49d897123c1..8e9cb3cddaa3 100644 --- a/configs/qcom_defconfig +++ b/configs/qcom_defconfig @@ -53,8 +53,9 @@ CONFIG_CLK_QCOM_SM6115=y CONFIG_CLK_QCOM_SM8150=y CONFIG_CLK_QCOM_SM8250=y CONFIG_CLK_QCOM_SM8550=y CONFIG_CLK_QCOM_SM8650=y +CONFIG_CLK_QCOM_X1E80100=y CONFIG_CLK_QCOM_SC7280=y CONFIG_DFU_MMC=y CONFIG_DFU_SCSI=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x200000 From patchwork Sun Nov 24 20:27:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845224 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861865wru; Sun, 24 Nov 2024 12:29:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUd0pp32zarazc+medQCaM1lBv3jip4y+kmllqE44b8wLjjWU1EKslB+6Xn1aVnu5N2TZa4pA==@linaro.org X-Google-Smtp-Source: AGHT+IEyZk7rcB6hbV9FDQ+yccaTNWLvpH9i1kypdaWIarCl9UQJHIkYP5ZetZVQeje4ZdSy4QlE X-Received: by 2002:a17:906:1baa:b0:aa5:308c:3489 with SMTP id a640c23a62f3a-aa5308c351cmr582734866b.58.1732480173579; Sun, 24 Nov 2024 12:29:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480173; cv=none; d=google.com; s=arc-20240605; b=EQFYKUOeMUn/yJTDuuYXC5jB9Fx+8Qmi+3r6LEoA+nPVIHElZ35lkrFDWt0Uc+zxY1 DgxhIsQItSie+7Uq0hh8QNKeEzB4sJTkC50OLHGl+huDPJcK7Y8H6X3FyDOnS24SQ9Bh ULbAgzbklHWCPp+JhnhCffDIU+bR7j6iSn5KxeG8440eJnniiCgnjrSGFmEAMuRsUf1J 9ZVj8xITalzGxLTIPKRFMDb5evYrSF5Vv5VKtae9Vf1Zd695AroDhQvFGisEbQCcb//d WUvRYwqfW2RcVmOn/TiNrUXeY8Mj+KEortkaXnkjUMF+33shfzq+RcMuBujXoHD+Utem oN9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=thN/khZQ9me8m+hpsVTJZeTK/Rz76hksTe+ynG5ko24=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=ZI7Yh2KWB36D3X1I+8/Ay1NoM6JHs4XoBLebbQcvurkHD+6HXRziHPBaCXZNl74CkL RO+S6VOBCpSI1gfQVVJFvXe5aQvTIUyy43yNFMf1ij1uU9zkw/J7oXicWOJoUIvUKXg0 463QwLysNj4nAP805wkYQqYoNaElPePauG3NkRI810TXThCb90ZgiMYT4uoWlcq/0hUL zw9K2OZ90ir6i0pGJ2XOnZRmklXCAFkbBvWs2slP0FTfFMC/OBvRYuer5qgZnQ10cbyt uQVSR0VqZmldypwP9fAqUKCv/iBffch42omLlh2Nt3S7ua8TOEdN8VqgfcybEvPuDn3V IH4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FR5GJZsY; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa52bb6c9a0si274180066b.535.2024.11.24.12.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:29:33 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FR5GJZsY; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9BB0B8975F; Sun, 24 Nov 2024 21:27:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FR5GJZsY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5C24C899F0; Sun, 24 Nov 2024 21:27:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B4C928984B for ; Sun, 24 Nov 2024 21:27:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-aa53a971480so160779566b.1 for ; Sun, 24 Nov 2024 12:27:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480068; x=1733084868; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=thN/khZQ9me8m+hpsVTJZeTK/Rz76hksTe+ynG5ko24=; b=FR5GJZsYEMnylmZ8M47rUAbqOJwHPdU1ifECUzctOqqtFE+UEwoaW2A0/1axadj+pz wS85Vyfc17dLF9PXJ5aKVU2voEWCLv7kuJMnUaS3/DXSk7/cbAL5hwvu4fyIBwnvadN6 6L73pi3NPokHNhbIx+fYd86l1crTuLJZ6x1+g1xUXXTaUbVqF08D/HjY2LDtNxgfnhIA 2LFUs79hdFpkz8xdBpYH/MCBGjvNvsQAAuFs17nf2xsqCdH/zdbxuDjCI82R3OezhKG6 voaNb6r0Xhbg99zk1Nyo3C6me+W7XnHExpHZYDijeC3Pi1QfSPEUwQhG1DB6ZG8TOQwP 8u7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480068; x=1733084868; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=thN/khZQ9me8m+hpsVTJZeTK/Rz76hksTe+ynG5ko24=; b=c+UzBqL+1JuvSZpe+zM/EvpncgRKZk1IGelwd2CxXX+iZn8x0tikN7hkaezbcojHL2 +rALCeqIXyrR63I3l34IZ5N+qPHRXcMoV0v5SGUU7UPgpQlJGxyBZf7xvfwvS9qSobG9 2vSyEq9MGAIgbU78lsYeJIjEmMz90W50lugVQ/A8zRogo9HYhz7SNvVDaVN4YfbU76T8 Xa3aOg+U2BEAhMkOjzAPpW54i67P6EDGYGPBHQMK3xp6rM+chzF2Yu4YcgQAY5iyfAs2 zNaY6+1WU1ZjcrcPSpcJhAw4d2/PMvF2nA7jj8F3NUs87hkgHvaNiIqzMNM5UnCJtthT zpwg== X-Gm-Message-State: AOJu0Yw69IYiSjUWMscC44z8TcG1UGiyoMR83HePoHuArPybVRO+qHeN ifPDVaFGkTMayq6gRM2HRQVbMMlBfsVJ+IAfVbaZCbpbi7B3RnP3J4LWSi+PjRA= X-Gm-Gg: ASbGncuK2TEWZa9VNzGZ/RYh1wWrctWUNjuBAhhJHg6TLndAfiwzMJqABMx/ifBTR8b WquVu7PNmxUeUY3ZQRsLyD/Sqbe4YX2wNtLc61ixIFZfAUlSpxwB0CaMZl9IMKiP+k3nFMh0p1p 1ceYjEsq6FZQu5D3fihPpbw2anfJP2CNa6BRNRGTLXmAva+woXhg4O5sD5+d8q//nYNwAaUIs8w LpHmNYJo8tXIcs54ekdgJCjaZ1FcdoguJbYsTE7pIdDzg0rte5p7g5WdxlOharb0HOj X-Received: by 2002:a17:906:2182:b0:aa5:391e:cad5 with SMTP id a640c23a62f3a-aa5391eccd8mr454386266b.33.1732480067556; Sun, 24 Nov 2024 12:27:47 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:47 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:08 +0100 Subject: [PATCH RFC 12/14] pinctrl: qcom: Add X1E80100 pinctrl driver MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-12-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=4374; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=65+jiBy/TyEPJUhmejdTXgoUM88VGiBPdFOD2CWResA=; b=kA0DAAgReTBFn7kwMhcByyZiAGdDjDKigTLC6rFPS9y1aa0DHpqm9H0KkVyBGw/8nzeGsC5FC Ih1BAARCAAdFiEEF8imOYKt0z8ot6DQeTBFn7kwMhcFAmdDjDIACgkQeTBFn7kwMhdpdAEAhGQw wXCh5uPW6EO2Y8tL5ui43f2MRpKF7kGjCZMgpR8A/0TSGx5L3Q50OgPKQ+09SYnGyfkG8u5WvBg kobE2GXOb X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Neil Armstrong Add pinctrl driver for the TLMM block found in the X1E80100 SoC. Signed-off-by: Neil Armstrong --- drivers/pinctrl/qcom/Kconfig | 7 +++ drivers/pinctrl/qcom/Makefile | 1 + drivers/pinctrl/qcom/pinctrl-x1e80100.c | 100 ++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig index 4f93a34281d5..d3eb69985510 100644 --- a/drivers/pinctrl/qcom/Kconfig +++ b/drivers/pinctrl/qcom/Kconfig @@ -82,7 +82,14 @@ config PINCTRL_QCOM_SM8650 help Say Y here to enable support for pinctrl on the Snapdragon SM8650 SoC, as well as the associated GPIO driver. +config PINCTRL_QCOM_X1E80100 + bool "Qualcomm X1E80100 GCC" + select PINCTRL_QCOM + help + Say Y here to enable support for pinctrl on the Snapdragon X1E80100 SoC, + as well as the associated GPIO driver. + endmenu endif diff --git a/drivers/pinctrl/qcom/Makefile b/drivers/pinctrl/qcom/Makefile index 43d0dd292225..06d3c95f93a6 100644 --- a/drivers/pinctrl/qcom/Makefile +++ b/drivers/pinctrl/qcom/Makefile @@ -13,4 +13,5 @@ obj-$(CONFIG_PINCTRL_QCOM_SM6115) += pinctrl-sm6115.o obj-$(CONFIG_PINCTRL_QCOM_SM8150) += pinctrl-sm8150.o obj-$(CONFIG_PINCTRL_QCOM_SM8250) += pinctrl-sm8250.o obj-$(CONFIG_PINCTRL_QCOM_SM8550) += pinctrl-sm8550.o obj-$(CONFIG_PINCTRL_QCOM_SM8650) += pinctrl-sm8650.o +obj-$(CONFIG_PINCTRL_QCOM_X1E80100) += pinctrl-x1e80100.o diff --git a/drivers/pinctrl/qcom/pinctrl-x1e80100.c b/drivers/pinctrl/qcom/pinctrl-x1e80100.c new file mode 100644 index 000000000000..2e2f5093272c --- /dev/null +++ b/drivers/pinctrl/qcom/pinctrl-x1e80100.c @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Qualcomm x1e80100 pinctrl + * + * (C) Copyright 2024 Linaro Ltd. + * + */ + +#include + +#include "pinctrl-qcom.h" + +#define MAX_PIN_NAME_LEN 32 +static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); + +static const struct pinctrl_function msm_pinctrl_functions[] = { + {"qup2_se5", 1}, + {"gpio", 0}, +}; + +#define SDC_QDSD_PINGROUP(pg_name, ctl, pull, drv) \ + { \ + .name = pg_name, \ + .ctl_reg = ctl, \ + .io_reg = 0, \ + .pull_bit = pull, \ + .drv_bit = drv, \ + .oe_bit = -1, \ + .in_bit = -1, \ + .out_bit = -1, \ + } + +#define UFS_RESET(pg_name, ctl) \ + { \ + .name = pg_name, \ + .ctl_reg = ctl, \ + .io_reg = ctl + 0x4, \ + .pull_bit = 3, \ + .drv_bit = 0, \ + .oe_bit = -1, \ + .in_bit = -1, \ + .out_bit = 0, \ + } + +static const struct msm_special_pin_data msm_special_pins_data[] = { + [0] = UFS_RESET("ufs_reset", 0xf9000), + [1] = SDC_QDSD_PINGROUP("sdc2_clk", 0xf2000, 14, 6), + [2] = SDC_QDSD_PINGROUP("sdc2_cmd", 0xf2000, 11, 3), + [3] = SDC_QDSD_PINGROUP("sdc2_data", 0xf2000, 9, 0), +}; + +static const char *x1e80100_get_function_name(struct udevice *dev, + unsigned int selector) +{ + return msm_pinctrl_functions[selector].name; +} + +static const char *x1e80100_get_pin_name(struct udevice *dev, + unsigned int selector) +{ + if (selector >= 238 && selector <= 241) + snprintf(pin_name, MAX_PIN_NAME_LEN, + msm_special_pins_data[selector - 238].name); + else + snprintf(pin_name, MAX_PIN_NAME_LEN, "gpio%u", selector); + + return pin_name; +} + +static unsigned int x1e80100_get_function_mux(__maybe_unused unsigned int pin, + unsigned int selector) +{ + return msm_pinctrl_functions[selector].val; +} + +static struct msm_pinctrl_data x1e80100_data = { + .pin_data = { + .pin_count = 242, + .special_pins_start = 238, + .special_pins_data = msm_special_pins_data, + }, + .functions_count = ARRAY_SIZE(msm_pinctrl_functions), + .get_function_name = x1e80100_get_function_name, + .get_function_mux = x1e80100_get_function_mux, + .get_pin_name = x1e80100_get_pin_name, +}; + +static const struct udevice_id msm_pinctrl_ids[] = { + { .compatible = "qcom,x1e80100-tlmm", .data = (ulong)&x1e80100_data }, + { /* Sentinel */ } +}; + +U_BOOT_DRIVER(pinctrl_x1e80100) = { + .name = "pinctrl_x1e80100", + .id = UCLASS_NOP, + .of_match = msm_pinctrl_ids, + .ops = &msm_pinctrl_ops, + .bind = msm_pinctrl_bind, +}; + From patchwork Sun Nov 24 20:27:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845225 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861898wru; Sun, 24 Nov 2024 12:29:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVTTiJbMC4JOz+5Jvfe2zaITC0OqbfQ3zyFIifMYM4nhyqgspWVLtI8+cUeKxL4o61k6aOFFw==@linaro.org X-Google-Smtp-Source: AGHT+IGmsTLYyo4PJIOmc+AbGnry4t4ID469JzxBuLIFpUroYeDfNtf9C8fT/NCsfEejsxMwaYxX X-Received: by 2002:a17:906:9ca:b0:aa5:35cc:f838 with SMTP id a640c23a62f3a-aa535ccfb35mr504835766b.36.1732480183349; Sun, 24 Nov 2024 12:29:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480183; cv=none; d=google.com; s=arc-20240605; b=JTaNVaNTMciWsUuvRmRgFmMz+3Mjdk+qloObwIk6ZlFTOBkg33I+9Vg/HvQM2s4ZY5 Au8RgUw7uqvU/1cNlDkHHc/iwB08iKlv728H76kipRRqs+6GBF4DjCaW7Rw15EVuBe75 tCQcsqc74JacUEarPgGjAW7xgu08rV4faclizjiQ3BQ0mfxwj9S1duQPgzdTfY309td0 cUWf7Y6dDGx3qSQQJASTW/Ng4xQJFBtQM0xKq4NxCoodMnjico9G7/b0WavHNasWU40f JsO7UFtIIENGNTeAQZTSLmClbaZnYX26iEHyR0UfNSiw7qFo4IlwTXkwj9lS2IiG+urq kdcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=fe8hsgm9j+tJkFel+8Ij9tGx+yPDSUwYvyvHQZyhCzE=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=gTt1JybO3Ksm2JDJpAMZ8XeH6vAQArmdQJluPkkZpE5QAzIc1t/MYUaAiiYNZ0i4ss X1pVH1ZzYc9f7phDW97uPPY5bTcxcZOyDp36HTEJM0C8MkOFHT+9Jrl4Fr5Oi7dAiCFD +JotQislQeClXSoYli3tmO8Rh1Cve1g2cWOaLyGtqbYe2/GByNa0AY8KCeepw6mSbmf4 ZavFgushcyNxfS9Vq5a2P9AUWKkBsXnOPiwoyPuSyRUub79DH//mc1s3mLqW5REMSRR5 3rB7u+26OiMb7RT42MYezMXW5Dk2e+Yd7gBG+Z47A1m+vGooUL6ZacdvTmu+UlEeN3hw 3BRw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CRyaQzBF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa50b552c07si386719666b.494.2024.11.24.12.29.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:29:43 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CRyaQzBF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB0B1899C3; Sun, 24 Nov 2024 21:27:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="CRyaQzBF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B9651899B1; Sun, 24 Nov 2024 21:27:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1B5A9899B1 for ; Sun, 24 Nov 2024 21:27:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-aa549d9dffdso93782066b.2 for ; Sun, 24 Nov 2024 12:27:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480068; x=1733084868; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fe8hsgm9j+tJkFel+8Ij9tGx+yPDSUwYvyvHQZyhCzE=; b=CRyaQzBFLLrEL6uN9Ehk92JT63leV7J5Sve0l1WcRichszQvGF7EBKOigG+yIxhguw 1b9+E+8Qstym6878LiuhdYbwxef+eXdDX1ZXQwoHu1UWH6MSq4DoFkzPpG/4FNN/XPjG 5RoXvZfMsc00NnOv5tR4L+S8r3wB0FSnO+30S5/3MICV0xwhdygOb9cewGpTuQ7lP8rx uELn3p/zAc0bmUwoPI/f1OOgB9UWswtLvm3t9AMH0rcRH/jO9/Yo7sZEIIeF950LdwiQ fvPaSxt7e83Dh049X2IPMBacQ6ZbjGK6EcCabBc5AEH1i55gSRyWMAXJpK5VedSeOsJI Kqdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480068; x=1733084868; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fe8hsgm9j+tJkFel+8Ij9tGx+yPDSUwYvyvHQZyhCzE=; b=nwEKy2UjX19SEyK0mmCzA+0TMyvAsMYqN6GHfc9d90Av0wp7Szxza2oPt7aEmuB9oj nPZr4calAa4Zz3WOhfAz0nXYkUIksmWJAnK6daLy3xLanQ370OQIcNN+eyHiSxnOHePk SvyXKsrMI2DepRGXyDSVb7/X/lYmNw8mT1sRIEGqhvBkh22nikYQZYjVgbtUquHDxX5n Ce6Ny0Qvt27b8WLAWqcvxG8pya/G1afWE6Yvh1FR+k1C/pdNvEjn+fIaneCA0+82oLSI 7Ne0Ts2IjbgD5jKkKMXqjcrgviINWnvkWTT5Hlm0IwVGqua088o1UCsa1mZmJCLeorfu jW5Q== X-Gm-Message-State: AOJu0YzrVqxOcyCnOYoSCiOvO3JsOoHoy66gbHfQeNcbQu3OwVXkbS0x inbDhMiS9c5R542hXQZG7pNYTuhed/RfgICWIXk/Aq8TIGC8e22MlVPcLCbX6yk= X-Gm-Gg: ASbGncu6kuj1NfuC9ETn6P/KxctSiNnmbENj3+Zhl0BwU+WNFhBksOWxSKqzOYH1Bol DR5LalmJSSuAjuEmFP0pjfwr1NvVxafeEnziamZK0VubpegOH2dhRkBtvVm8FHzSt/wZVgR6kvU KVGIPTxHgspFfyTt0EekLA4N11/1EAMeIjgW4DhykFltNotFVGD9ERBgEkYX9JSF/jjYe+mDHIo vSP8hjJm7dUI/Hqsj2SHLKfh5Vjm1BozEPRAQ3KSSKZqBd00bz+KEa8hExlJHVwj4lO X-Received: by 2002:a17:906:2931:b0:aa1:dd58:aebc with SMTP id a640c23a62f3a-aa521fdcdd3mr653204866b.39.1732480068542; Sun, 24 Nov 2024 12:27:48 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:48 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:09 +0100 Subject: [PATCH RFC 13/14] qcom_defconfig: enable X1E80100 pinctrl driver MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-13-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=672; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=kzNN57up+QIhcMiwGYOZjS1cr7Nr4YzcMPUc91iGM+E=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHqO7lk0LPxgwhNrcT77SV2PLYrxc1zNTnWWe6CMXf YZjbzQ7SlkYBDkYZMUUWcRPLLNsWnvZXmP7ggswc1iZQIYwcHEKwEQkfzL8r5CUVfiyYP6kP5vm 33br9lwRsPn2J8uFE4ukzmk4KG1mC2L4H7A+8ItulbP+xEj2yYzyW5cKGpZcuHQ2u5YpMPIAlwi fPQA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Neil Armstrong Enable the X1E80100 pinctrl driver in the Qualcomm defconfig. Signed-off-by: Neil Armstrong --- configs/qcom_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/qcom_defconfig b/configs/qcom_defconfig index 8e9cb3cddaa3..877c48b5684c 100644 --- a/configs/qcom_defconfig +++ b/configs/qcom_defconfig @@ -99,8 +99,9 @@ CONFIG_PINCTRL_QCOM_SM6115=y CONFIG_PINCTRL_QCOM_SM8150=y CONFIG_PINCTRL_QCOM_SM8250=y CONFIG_PINCTRL_QCOM_SM8550=y CONFIG_PINCTRL_QCOM_SM8650=y +CONFIG_PINCTRL_QCOM_X1E80100=y CONFIG_DM_PMIC=y CONFIG_PMIC_QCOM=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y From patchwork Sun Nov 24 20:27:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845226 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861930wru; Sun, 24 Nov 2024 12:29:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUexGpnbxhrwSQXizaPsCpsVshpOI32K1Ym/q+ewQxYqwoBipnctYXDNAWVgIVvcPTONjsMsg==@linaro.org X-Google-Smtp-Source: AGHT+IE7Gbr/Wy6PJ+Dw7ljWCmp09wvpX8h2Wqfn5AARZS/9mBMmaF7HhRVPtVlZRAXUXbfT9aDq X-Received: by 2002:a17:907:7b88:b0:aa5:500f:56b3 with SMTP id a640c23a62f3a-aa5500f7ad6mr162821866b.18.1732480192330; Sun, 24 Nov 2024 12:29:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480192; cv=none; d=google.com; s=arc-20240605; b=c+Cn39relthcgaEDLyEIt5LJhAgu0nlgnNVLBIDHJMDMPyE1ZzZo2zAU5aJ1FCOydK qiDXoq7jJmcD2HNqfP42AU9HMQaNy8D368/VXjsRNRstLmEoxD0/aVIXQ5ANB8QEeEge xupcadB8KkgEcfjfay5tclee0fDlnTbS/hHiLtpUZ2pTTsaYhGlecyDeLi2JpY97lZII VSllejN1tTf38qSYEZg9/2p8eN44LZ+07UU5lz7SiQZ0Uh4/mYSxQyiwf0lgodShNEIw suxHlSmgpnpPnbKW8CbmpsQ/wlrTpgl/hwWaOFXggG+lWKBJixBXiP65OMzOlpv7OrwR puQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=XTnj2V+fCGfjE3UXwJb+V6Ed8v35O0pP0mKPTMlEpv8=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=HQtwW/1d6iDlcpKPMO3pTIpeEkrC/8c+a8qg0zcq6m29+ia7/ZL4QsV8OfXatLlFnL bGl/MOXdCHBq4ifXMwXH+rj8EWhY9UILXrPOML7qZFYvwHVGyI7LE2035nJevN8NMGce 6GPTH2zcWy4snAKW0gEJjCoIofDyV7tmC9k1LRTpxdPYR6siOgVGVenX9uefmD6tx3GO XG0/1HS5ntPTErwjgcqMVBZ0SvaZaGFDrY3Nee5XGNO63Cl7AUmMyHJY+zc9d6NpbY+m ODFTbweYDP8H32WGpRDWkGGkeyrIY+30Sr7m1ogn0cgj+HSQ78lwEARoFF5cqG8HdZzM ZyHg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wYvsJsT8; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa50b505ee2si392274066b.402.2024.11.24.12.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:29:52 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wYvsJsT8; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 539688984B; Sun, 24 Nov 2024 21:27:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="wYvsJsT8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E95EA8995B; Sun, 24 Nov 2024 21:27:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F25B4895A4 for ; Sun, 24 Nov 2024 21:27:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-aa55171d73cso45088166b.0 for ; Sun, 24 Nov 2024 12:27:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480069; x=1733084869; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XTnj2V+fCGfjE3UXwJb+V6Ed8v35O0pP0mKPTMlEpv8=; b=wYvsJsT8iB8jk3O1eCc6nUjPtK6h4vreJlxHU3cJlD1xO3uA37JC3jjldHP6b9Wklf kQZK80gnpeHGuHVsSCisbfSho+kjb1wUfcV252PkDLZS04DOzawtVNhY22fWJXYWg4UH Cmn01FXWC8qz+1DA9vtHvw2cSXIEdBs0EkZSU/MGxMWUgQ8w/R+abM67Fl+0hXCUKHRc ZQQJ1AJtpiibibFd0gFQiagP66cuzQVdn6P3ekeWlCvmkCzhtODrZOimuZ0MxP+b//IQ sc5FOphvlRtiHK/i9Mq51ck6i6s1xNpLcC2HKeyoE/RC5xvUlYU7O3kUXz+W2Zs/wblR gTlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480069; x=1733084869; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XTnj2V+fCGfjE3UXwJb+V6Ed8v35O0pP0mKPTMlEpv8=; b=oOC/x9KW9b9QK4n8zlYNNtwtRTKMhM3rHC4UVqkPUmtzjj/NBJfjfkrvQWn+oe366e P+nle/5Bk16Buska3fPhyIsGel5e1kLd67Ge7hXIWIASH4sZ5ZOvzU0LkOsHahGegaY8 wtVT4T/kYNVe1Yk2O2txKSyZ/CAXWZ4ldKgkOpmLS5v8gAnA/1+RxP75oxz1W4AVBNYy ej4DSVGaTF8Ixu0Yagh+xQJp6CHQoi9JwPO9QljZjHoRInZlb7ZT+YssSqqA5JiGQUTo /wIDKybYAHrk6MEpI677TqBWAcSzwR6i185Hp6hAyLp4Zs9xSRPP5Vcg1jPMQoTWX0E0 lerw== X-Gm-Message-State: AOJu0YyMeV9jy+ITuY4e9OsjCHiJa4BciJcp/N7mECWRGptnKmaEytEE omFE6AAdYQKQ/YrywbLi9V+FnBx5/ceD8TjJRIt63ekks6md3Au0nZEoYAPjsvE= X-Gm-Gg: ASbGncsL/onFblD9uCxUUgL7axypC/AhewFbFjcao13oSrZoO+YSytr5Cx4a8wdFvCu fNrp+tLg97rHrhCqjniQ7Thjs+XFWdkIigeZ3QAEhrM/U33offPUIYlpfFtXb4n1H2VPFFYlL7w VmG+W+98GD4Zlfr2UYXU3Hmi0r94SQ2cIngxhwuHYfnre60tn99NNfDcC8U9/9Srs/3ryT7+Dsz goQ/Zzua66D4+e193fPC+9Nh60wH2xnlfxmdjIrBHjf5zxVvmmZ7rLgabqsaSQKh50Y X-Received: by 2002:a17:906:1daa:b0:aa5:37f1:ce63 with SMTP id a640c23a62f3a-aa537f1cef6mr487720866b.32.1732480069514; Sun, 24 Nov 2024 12:27:49 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:49 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:10 +0100 Subject: [PATCH RFC 14/14] configs: add x1e_defconfig MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-14-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1620; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=u5YEv9aLJ6aJE9FD/crDptwvK0hZP0TbWUtL5V+XcZU=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhnTnHuPDZ0MzK3bxVPAvCNGUUcqYd8yHWzq6jtHKjyN0w pdZ7z53lLIwCHIwyIopsoifWGbZtPayvcb2BRdg5rAygQxh4OIUgImczmf4X3eEISIxuExs2V+n ExI+fmVx/ZpZHO++79q/7oVGYN+dTIa/4jkm4kGMu5Y7f+uZMsVJuWZtrtsExdK+VzpC+/VqLbL 3AQA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add a defconfig for Qualcomm X1 Elite based devices. These boot U-Boot using EFISTUB from their stock EFI bootloader. Initially we support display and USB, keyboard will require i2c-hid, NVME will require PCIe support. Signed-off-by: Caleb Connolly --- board/qualcomm/efistub.env | 11 +++++++++++ configs/x1e_defconfig | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/board/qualcomm/efistub.env b/board/qualcomm/efistub.env new file mode 100644 index 000000000000..5264603556ad --- /dev/null +++ b/board/qualcomm/efistub.env @@ -0,0 +1,11 @@ +stdin=serial,button-kbd +stdout=serial,vidconsole +stderr=serial,vidconsole +preboot=usb start; pci enum; nvme scan; +fastboot=fastboot -l $fastboot_addr_r usb 0 +do_boot=bootefi bootmgr +bootmenu_0=Boot first available device=run do_boot +bootmenu_1=Enable fastboot mode=run fastboot +bootmenu_2=Reset device=reset +menucmd=bootmenu +bootcmd=run do_boot diff --git a/configs/x1e_defconfig b/configs/x1e_defconfig new file mode 100644 index 000000000000..d60210f2ca5b --- /dev/null +++ b/configs/x1e_defconfig @@ -0,0 +1,17 @@ +#include "qcom_defconfig" + +# Broken?? Probably an issue with mapping the memory +CONFIG_QCOM_COMMAND_DB=n + +CONFIG_EFI=y +CONFIG_EFI_STUB=y +CONFIG_EFI_STUB_64BIT=y + +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_DEBUG_UART_BASE=0x894000 +CONFIG_DEBUG_UART_MSM_GENI=y +CONFIG_DEBUG_UART_CLOCK=14745600 + +CONFIG_DEFAULT_ENV_FILE="board/qualcomm/efistub.env" +CONFIG_DEFAULT_DEVICE_TREE="qcom/x1e80100-crd"