From patchwork Thu Jul 11 16:46:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 812090 Delivered-To: patch@linaro.org Received: by 2002:adf:fac3:0:b0:367:895a:4699 with SMTP id a3csp316128wrs; Thu, 11 Jul 2024 09:47:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVIWZrqGQVst/CjlTf8Wt++BesSKOz6NuLopWzpuE5b+VtvHFDyLjgSQUkjjVAsJvmS5jTOJr2h4aPM5VNBuyse X-Google-Smtp-Source: AGHT+IHDbcVIiFuoxUDMMsJ9XBVlYv0PoWzmmlE2hoqm/hbSbNL+U2LL4zwxtvEj+ckGE3xnzcrM X-Received: by 2002:a05:6512:3dab:b0:52c:8342:6699 with SMTP id 2adb3069b0e04-52eb99d27d7mr9271835e87.55.1720716477327; Thu, 11 Jul 2024 09:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720716477; cv=none; d=google.com; s=arc-20160816; b=Td2hx6ebehLUWhcy1A8O/UCAxEvY7geZy/5555NIJQ12ULhgDtrbk0iUCtGQfzFp1G vI5G3qqsqMp4/UKDs+FRepQylIzCADw/2GIGjtHWnJpIgL3qIp+epaVFZP7VEDbmryKT 9kGL853WSaNkHLcAuAuXM4dGyyi24YZuS/GjX/o/TNWSLgsL7n6Cb9FD7zlgRawlhYzD QURUy4jWlCDc2vH7MtWk6Hn44Sq6ddPRCa+YU4h9mkzgxzeHHFmKNkyP0+EbKA8fNYru b0OpQ6Flte8VUaB8GzQcAKJs8Wg2oY677JmmWzvzmB0iYp0dCq9XmdnPV2m0Fy3H+ujC 1bCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=scgzXm1AFccc+odGtwAyR3nKXWaw45pRwxsCPyCBhv4=; fh=/XivWHF+vo8fEJZkIifbJJS5exQ4Pz1Cdxakj2MFy4s=; b=M3byihvohRHjiqJXTQfrAhYzj9YSyLbESVsuAF+cUV7AKVGCnpEdikCpFoDAKm7nHs 5qj7T96SM+pvVyJy34hDsiQQCW/JfU4ITl694nC3fzfOcNJgatAyTh0dIF1SLKXutbrG dN4I6Y93ANRz+G1bnsPwHd6MC5940G0Q3mlKoW7qd6gBNFA+bgxVw32O1LBUfZ9q9kTx BCK/hTidIrGm8cOO9+KNMO4NU9dwpx5dJgDJeUqWR+RfKHbxp0suIePM8l48lAZSYB5k iGuAhTcnx98ulSusIUMbplOBrJmAr5UkWiPRjVZrva26JQ16ddE2QTYCpn/bXoHRyFjM D3Bg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7nWkY+a; 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 Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a780aae1675si344304066b.277.2024.07.11.09.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 09:47:57 -0700 (PDT) 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=V7nWkY+a; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 07400885EC; Thu, 11 Jul 2024 18:46:54 +0200 (CEST) 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="V7nWkY+a"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6BF92886E2; Thu, 11 Jul 2024 18:46:52 +0200 (CEST) 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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) (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 3C50188452 for ; Thu, 11 Jul 2024 18:46:50 +0200 (CEST) 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-x129.google.com with SMTP id 2adb3069b0e04-52e97e5a84bso1591460e87.2 for ; Thu, 11 Jul 2024 09:46:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720716409; x=1721321209; 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=scgzXm1AFccc+odGtwAyR3nKXWaw45pRwxsCPyCBhv4=; b=V7nWkY+aXwJgioCSSljl3ghCcUUlJLQYKS+Ec2eWGwfc+c04zVpydQAVxkmwQGaXwM lYaIHrPBnJHuAFPEjBNL8WUfc3GZOzeCJaxlrBY84ZSWKBVvGKe097pMGGqVcm26LJkv SitY7JyDEvMzGVs/rl6kkQSFVKd60ruVxpMUyILbCcUAKAL7ihgZGd578aAhntkxpxRK Zf3IfHFP93/Pka9sO8WBg/JzcF3KY/O26/tx6Oaw9JrzsrC6iuPk0E/r+8XZhlALt2LQ 7qe/804mlrEA2QQBdmzzxjbD3XRulxNJKH7GX/TkQYtDIKWkQYSACeBbrkEZs6pk9KBi barA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720716409; x=1721321209; 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=scgzXm1AFccc+odGtwAyR3nKXWaw45pRwxsCPyCBhv4=; b=E35/WWIzz3pR13ffNOUR6gNqqmitr3AdvLy2Hfo2EilMZe6SdXaGKtKPW8hhCk6Xoy UW1gkl1ChphLwpkAunmxbEMEWPWxKE8bs82HTqA7nK/2S0wrsYyloSbDAgTxPecNebxG lyuBsRpuRkD9r5wv8kGcBgeE4UltyaHnvfORUC+aOUZCaAxVkfJ3JmxaZ30Q0S8b7Rf5 MEMwMtN5V7QwkvSRek1ILh/EC6RU08LVU5FsGFJTLLETvjEYyD0RTcA0NM+AL/AV2TgU 7sVyIouR0kuUOb15050ecl1e1J9hJ6wOiEoWBsPJZGLD39YBrfB+cU5BPB2/8uTn8pZp Tr2Q== X-Gm-Message-State: AOJu0Yyad9Rn3ZFeq/jXJnQX8v+DZ+LlRVEBVOYJxgfZA+uv2756Q1kE kWgkjK9otn+OO6PuV5dWoC4LUtE+UtZXTUnHmdQWdZHYXzU+hRMX4QDAa1k72/eAgm5DLPfx51N W X-Received: by 2002:a05:6512:6c3:b0:52c:e10b:cb33 with SMTP id 2adb3069b0e04-52eb99d2722mr7395538e87.50.1720716409474; Thu, 11 Jul 2024 09:46:49 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::7424]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a8545adsm268454166b.159.2024.07.11.09.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 09:46:48 -0700 (PDT) From: Caleb Connolly Date: Thu, 11 Jul 2024 18:46:38 +0200 Subject: [PATCH v5 06/23] soc: qcom: cmd-db: adjust for U-Boot API MIME-Version: 1.0 Message-Id: <20240711-b4-qcom-rpmh-v5-6-fbf04ce6a7e8@linaro.org> References: <20240711-b4-qcom-rpmh-v5-0-fbf04ce6a7e8@linaro.org> In-Reply-To: <20240711-b4-qcom-rpmh-v5-0-fbf04ce6a7e8@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Jaehoon Chung 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=1646; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=TCF1Mvv0YTlcfm0lKGwE5XqQlDbsIfxOAnvqwxvsS9w=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmkAxu6IqmwSfHw4WybnRZgCCY+tUYlx5CUgnIE GqJBpr42/OJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZpAMbgAKCRAFgzErGV9k tvLkD/9ku4STpIpxWQz3Os4rEOFUIN14K1+CbV0qrwj1lQrCVrffQ+W8Uqcsa/NrfK4CTVyV5DH b9WSFA4/GJbxRbfABBXWMZVJ1sefz7SwUznfk84KlRvBRbt1sa1ECuWGYgFHo/+3e2JPbL/Z6sP oplCxBJef01wC8AvhwlY6ogr7EhRobmoPOdVCq1DvNnd3bLERqxvQtmuZVBz4G1KzKTa5sAsy5I 4a0z6QluvSJ4rRTZ7GZ9SA/oCVHnN0ynTNbxJIPvqy9we5zEtdISqV5hy5m27p5AD+9hy+zPVb4 2AM+hUeuuuk1qVE1RT7Y8J+1Jon4yjKkN25ipmorzv5FyLBYUZPvw1mf9kLmWxvd22bAjzvcjdm eHR/CK9HNZeqD6xRfLpx/Sc4e1GAVrq4CkBuK83WCk/sJUleomif1gF3ADiECankzKrv0x99MiQ sd1iBN+MMQkhbjIh6LdvvPek6XrC2jpHBKTXR2pTEYycEGETDaS5iZ+svcZCQ79a9qe7sfVU8Ym lXbuDVmhFvSV+uEZk/92rSz7DM+jbHW2kw1JfiT2kh7b28YvRjZpAabsW2VyRb80RXwPTrfyME4 YWny5OE9XDHJhNcxwKsWioYlQcvi0x+pR+dx/i7Py3gFSeLU1liLvGM9uNU8dl/f2wPdbGOsFho KEqsnkjMzS8I0cA== 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 Keep the header pointer in the .data section so we don't initialize it again after relocation, adjust cmd_db_get_header() to work with the U-Boot API, and skip validating the header since all cmd-db users are children of the rpmh-rsc and those children will only probe if cmd-db initializes successfully. Acked-by: Sumit Garg Signed-off-by: Caleb Connolly --- drivers/soc/qcom/cmd-db.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c index 4d3fd4db8852..b852a269ae12 100644 --- a/drivers/soc/qcom/cmd-db.c +++ b/drivers/soc/qcom/cmd-db.c @@ -104,9 +104,9 @@ static bool cmd_db_magic_matches(const struct cmd_db_header *header) return memcmp(magic, CMD_DB_MAGIC, ARRAY_SIZE(CMD_DB_MAGIC)) == 0; } -static struct cmd_db_header *cmd_db_header; +static struct cmd_db_header *cmd_db_header __section(".data") = NULL; static inline const void *rsc_to_entry_header(const struct rsc_hdr *hdr) { u16 offset = le16_to_cpu(hdr->header_offset); @@ -127,16 +127,12 @@ static int cmd_db_get_header(const char *id, const struct entry_header **eh, const struct rsc_hdr **rh) { const struct rsc_hdr *rsc_hdr; const struct entry_header *ent; - int ret, i, j; + int i, j; u8 query[sizeof(ent->id)] __nonstring; - ret = cmd_db_ready(); - if (ret) - return ret; - - strtomem_pad(query, id, 0); + strncpy(query, id, sizeof(query)); for (i = 0; i < MAX_SLV_ID; i++) { rsc_hdr = &cmd_db_header->header[i]; if (!rsc_hdr->slv_id)