From patchwork Mon Mar 27 04:15:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761343 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=FMCtvGgO; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKJJ5dxYz1yXq for ; Mon, 27 Mar 2023 15:16:32 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4519586068; Mon, 27 Mar 2023 06:16:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="FMCtvGgO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 22D0486071; Mon, 27 Mar 2023 06:16:28 +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,DKIMWL_WL_HIGH, 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-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (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 D49368604D for ; Mon, 27 Mar 2023 06:16:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x629.google.com with SMTP id c18so7168056ple.11 for ; Sun, 26 Mar 2023 21:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QNTiR9vsFgvBRZaRDzCG3IkgO+ZNEkTXX8yO03bzdHE=; b=FMCtvGgO+2oY5RMeHt9hOdaIsWw62P5XOeQlDsClwKxKDa1YdDBLwbOCNY4mZ3Di9Z /LUB6pn++6DzSTDGGKZ1njQNvK04cLeadnrNsx4lpcAvVfTeMQqEX4H9oWHlBaiEpQDu Ybf13L0278TNC7vp2aB/t23UV2XQT1wKEmxhU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QNTiR9vsFgvBRZaRDzCG3IkgO+ZNEkTXX8yO03bzdHE=; b=76dbbYbDr/dJRi25s7sMhE73DBUYnAmRJEXUkfIhmsBRNsL1Tx2Bu4Cfo/AFIn64nZ epMKmHKKUqQvcQvrbOQCFK5cq+UR3GJVd/wXlHYDQGXfr/k4lGyDON15tJQyrPy8RSnp UTGYwoKnCDBBogLNM7PCQotbl50e9J88cE960rOTII2HsYEQHPH1qfJjsXjmpMQdMCPA YT0PGrp79hz/G6nFWHiwSO7jtjeDu/nnCE4Y/UF1W9yvXHXiLLV3yJAPYRxamdnUJ3bD NaL4naAFGO7P8QSecPA7cUCu9W3pl27WrZAK5PF7W6H91e0YWq9Qqw0uvy0uk6l1YvgF vo9g== X-Gm-Message-State: AAQBX9cWu2DVM3OMovihsA7EBCO+rupbsUw0tnF81EPDyzByUL+Nf9ap AukJHCq+Ke4osa9lFHtSbEARed5+/IK/ok1VEP0= X-Google-Smtp-Source: AKy350YRjF5jz622kzDOA9ePSZ3tuQNtPSD0iK44X3K8bQ5YgWOksl6k+tF8FqSQZKjauixKkAlSlg== X-Received: by 2002:a17:902:bd05:b0:1a2:4921:f96f with SMTP id p5-20020a170902bd0500b001a24921f96fmr1910262pls.56.1679890582943; Sun, 26 Mar 2023 21:16:22 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 01/16] mtrr: Don't show an invalid CPU number Date: Mon, 27 Mar 2023 17:15:35 +1300 Message-Id: <20230327041551.1757316-2-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 U-Boot did not do the MP init, we don't get an actual CPU number here. Skip printing it in that case. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v2) Changes in v2: - Don't show an invalid CPU number on error cmd/x86/mtrr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/x86/mtrr.c b/cmd/x86/mtrr.c index b213a942fde4..ff4be6b7bf5b 100644 --- a/cmd/x86/mtrr.c +++ b/cmd/x86/mtrr.c @@ -145,10 +145,12 @@ static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc, for (; i >= 0; i = mp_next_cpu(cpu_select, i)) { if (!first) printf("\n"); - printf("CPU %d:\n", i); + if (i < MP_SELECT_ALL) + printf("CPU %d:\n", i); ret = do_mtrr_list(reg_count, i); if (ret) { - printf("Failed to read CPU %d (err=%d)\n", i, + printf("Failed to read CPU %s (err=%d)\n", + i < MP_SELECT_ALL ? simple_itoa(i) : "", ret); return CMD_RET_FAILURE; } From patchwork Mon Mar 27 04:15:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761344 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Tgkccfj5; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKJY5Cq0z1yXq for ; Mon, 27 Mar 2023 15:16:45 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3324385283; Mon, 27 Mar 2023 06:16:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Tgkccfj5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 568248607A; Mon, 27 Mar 2023 06:16:31 +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,DKIMWL_WL_HIGH, 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-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (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 C105586070 for ; Mon, 27 Mar 2023 06:16:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x102b.google.com with SMTP id j13so6486269pjd.1 for ; Sun, 26 Mar 2023 21:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890586; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tFpt+xj80NKBecCombSzB9BIi8V+qHVf7ZQw9BxZglE=; b=Tgkccfj5voHGnnaB26Jvv8GD83xbYKT4VrzYwmTeEame03LSerPECgZmhjwfARZSeY WrQ8J5WInZU311SxaNun4s2UEwA4p3adBC6LL0wd7gd+4qwQ/1nul1x24NkitZ9fyPtg Odoxj3ZiauCXdOBKoUiARmI/vnE9vXoNmvRiQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890586; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tFpt+xj80NKBecCombSzB9BIi8V+qHVf7ZQw9BxZglE=; b=XoVy/x8DPq5hvI5W6eQCB2TQ5ZdgM0EfoySY7MOCBD/RigRufFABLUNPu0Kx6M4TVx NbisCF8PumG3SA3JG0LJuz+6OohrVOH+uLUGOqi1kt8qlcRdb0QtL/sMruMwKAzKzSSl kJzn3YlAV4PJa+WH5tlbPd0yndLca9NF5shIk1kI91bZQ8hjN4c0nKIrpMuwzl0dVpL1 suqXKnkE6mZ8N54uQ0b8oZpzu8IHm/+UPp9FiPTEFZa3i+p7gz58Fiot0qT9Rz99nmzY qdlc0G5wimqNc4Ah7OUt6to2pQsD2WhtxF+OkGvTngxnOaimjWZupb0aSM+Wix2VG4cc s9og== X-Gm-Message-State: AAQBX9c0/aMYmQeQXpUTgNlc+e79C6mMDaYoo6jaqZAETLqhPwk1opzk DOnFj0NxXC2BxR9yP8VgM1QmCqDME8lz2dG9WUA= X-Google-Smtp-Source: AKy350Ytws3kXHIoeEqm4yF9YjvyeE7m9Uub6o0A06w/ntYTMe7fUUlERPeglFooQZPvYsgxaO2W8Q== X-Received: by 2002:a17:902:e5c2:b0:19c:fd9e:f88c with SMTP id u2-20020a170902e5c200b0019cfd9ef88cmr11807018plf.18.1679890585867; Sun, 26 Mar 2023 21:16:25 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 02/16] x86: Adjust search range for sysinfo table Date: Mon, 27 Mar 2023 17:15:36 +1300 Message-Id: <20230327171546.v3.2.I894e1ef2d49639682066ea6a4eb471619bb793fc@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 Avoid searching starting at 0 since this memory may not be available, e.g. if protection against NULL-pointer access is enabled. The table cannot be there anyway, since the first 1KB of memory was originally used for the interrupt table and coreboot avoids it. Start at 0x400 instead. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v2) Changes in v2: - Update commit message with more detail - Update code comment to mention that addresses <1KB are ignored arch/x86/cpu/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 6fe6eaf6c84e..dddd281e966c 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -351,8 +351,8 @@ long locate_coreboot_table(void) { long addr; - /* We look for LBIO in the first 4K of RAM and again at 960KB */ - addr = detect_coreboot_table_at(0x0, 0x1000); + /* We look for LBIO from addresses 1K-4K and again at 960KB */ + addr = detect_coreboot_table_at(0x400, 0xc00); if (addr < 0) addr = detect_coreboot_table_at(0xf0000, 0x1000); From patchwork Mon Mar 27 04:15:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761345 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ULGQnBOy; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKJr3hkxz1yXq for ; Mon, 27 Mar 2023 15:17:00 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7BF5885CD5; Mon, 27 Mar 2023 06:16:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ULGQnBOy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D89185283; Mon, 27 Mar 2023 06:16:35 +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,DKIMWL_WL_HIGH, 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-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (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 9502C8606B for ; Mon, 27 Mar 2023 06:16:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x629.google.com with SMTP id ja10so7192264plb.5 for ; Sun, 26 Mar 2023 21:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890589; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T/v6RrJkofF6xRslS+n6GSiDPrTuaA6ZdcubxVLlB4s=; b=ULGQnBOyfqbuQ7N3xxnVF/6Z8v6/6E8rl108tb81+633pD2BDknOFx9syUoieABPnA pYf0wsxccp0WzAAhsasXi9GjMOC7zcnJEOLOGC19uobuOt8vUy3MfmIjEUWj+7Oananh pmWFZRsn24p1i+JU75mqGBLtw0RmEf2dG7MVk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890589; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T/v6RrJkofF6xRslS+n6GSiDPrTuaA6ZdcubxVLlB4s=; b=wOLQlpHSkoLlIVTHbT3+sYL66AkcY2Q8HY7jOR3oPfwfQ2Qjx1zcL4p3eha/mXidDW RUjKXUrwR05+AjZCM5KfW+DFcnQgsfn3TQQ6/la3C1pRocie81xGI7S1LOLZuBO/guKS obuoJv4nfkSU/3uQGw/2jWw+/q3dR4qv4Lmri+/eiLYsMglQvcXk35c9gccYdOzHAOdr +M3VOg6ZSTnOmfLBxrDB+RNjKePVbSf47yumX9WYHOtgtzmRYg6jzZ3uG95ETKBf9oze Bn+PKZ3gXGsJFtBw84Qr3nCoCGeBKUfaxBxJdZyYXN8/Kn12ZvJVTsGfbqh7i6OtZvFp RrGg== X-Gm-Message-State: AAQBX9dP+KbyZ3rMO+kdvwSu5sYllbAlTCnWZ/1NrUn5JAIQ/damTOw0 b8sm8hLvH1IekAzuTBNCsbh6tYwc0GHP8nrsJfc= X-Google-Smtp-Source: AKy350bIsnEbueMM1uSSFbmnJ0Y5bvjK+p2g2E1f1cVF5ay5wDBw6l1n4sY3zAjCnyOJZW+Q8QA2ZA== X-Received: by 2002:a17:902:e882:b0:1a1:f413:70b1 with SMTP id w2-20020a170902e88200b001a1f41370b1mr13052261plg.18.1679890588786; Sun, 26 Mar 2023 21:16:28 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 03/16] input: Flush the keyboard buffer before resetting it Date: Mon, 27 Mar 2023 17:15:37 +1300 Message-Id: <20230327171546.v3.3.I44e9d40e4fed423edc8366af768c0b8872d71302@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 If U-Boot is not the first-stage bootloader the keyboard may already be set up. Make sure to flush any data before trying to reset it. This avoids a long timeout / hang. Add some comments and a log category while we are here. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v2) Changes in v2: - Flush the buffer instead of skipping the reset drivers/input/i8042.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c index 3563dc98838f..e6070ca01529 100644 --- a/drivers/input/i8042.c +++ b/drivers/input/i8042.c @@ -6,6 +6,8 @@ /* i8042.c - Intel 8042 keyboard driver routines */ +#define LOG_CATEGORY UCLASS_KEYBOARD + #include #include #include @@ -54,6 +56,14 @@ static unsigned char ext_key_map[] = { 0x00 /* map end */ }; +/** + * kbd_input_empty() - Wait until the keyboard is ready for a command + * + * Checks the IBF flag (input buffer full), waiting for it to indicate that + * any previous command has been processed. + * + * Return: true if ready, false if it timed out + */ static int kbd_input_empty(void) { int kbd_timeout = KBD_TIMEOUT * 1000; @@ -64,6 +74,12 @@ static int kbd_input_empty(void) return kbd_timeout != -1; } +/** + * kbd_output_full() - Wait until the keyboard has data available + * + * Checks the OBF flag (output buffer full), waiting for it to indicate that + * a response to a previous command is available + */ static int kbd_output_full(void) { int kbd_timeout = KBD_TIMEOUT * 1000; @@ -127,6 +143,9 @@ static int kbd_reset(int quirk) { int config; + if (!kbd_input_empty()) + goto err; + /* controller self test */ if (kbd_cmd_read(CMD_SELF_TEST) != KBC_TEST_OK) goto err; From patchwork Mon Mar 27 04:15:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761347 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=c1Za3y9k; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKKM15xBz1yXq for ; Mon, 27 Mar 2023 15:17:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 79F8485CD8; Mon, 27 Mar 2023 06:16:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="c1Za3y9k"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 41BBB85CC7; Mon, 27 Mar 2023 06:16:41 +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,DKIMWL_WL_HIGH, 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-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 B77368604D for ; Mon, 27 Mar 2023 06:16:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1036.google.com with SMTP id fy10-20020a17090b020a00b0023b4bcf0727so7337130pjb.0 for ; Sun, 26 Mar 2023 21:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fRsXqJ+uUSQTL/qmS2y99ffXJlhpdmVBa2VJT6GxA5Q=; b=c1Za3y9kMItGo90CNvLj1JVYJK88NHj2XDqqg7vn2ctGaing1tFwr8IKA1XV+dRCtl 7dPbINtQdFmOBIXQ4Xwx2Wclx/kLKMlZ48fOxPiOCg0PZ35uCupPFDUTaodueC1fSCtu kg6MB22QQwffrQyhY+6o47i8DhYFpZvSZTLAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fRsXqJ+uUSQTL/qmS2y99ffXJlhpdmVBa2VJT6GxA5Q=; b=yHespn26HGnIzQOEuuCTiE8WEPWwRX6AevxqFycNH1ZScnLWFQ2B2m/zH2E+/KN0/X KDxv/I6hSdE2QZ4CgzFqQGY46oUOBQvmsbKo213tPbGi6AFynIL6R9/cZoIlndwCWmqT MGmWaJpB05K2TDcvlw+iCfeCzYV0oT1iBPqjMQD3AL6/MD88qblkrhahwsI29GxX5ghN 7Y3bdLUs4E+Gujh32haCj8eO4reQdSauNNr2KRPGlB3BViQ7O2OLhJhg5QA58ky+aOIa 3/Dai0QeAJ6DzrZ7iUZP+rrRihQAGMoF2TWmwVglG/HWsNSgyZqp3hroeW9TS/0pLaV2 YmWQ== X-Gm-Message-State: AAQBX9ddDXw+iR/QdsMPcZDfR8N5xggNRXe8tSMhopt9yPshezTBmAm/ tYTt1QIgtmOJiiBoQY4pSnV5RtbtAGs1zAPYr48= X-Google-Smtp-Source: AKy350breP7dcC4gDRQjIqUXb6uVAtV8JN5mbV4mO51gy1jihLdzgwV9IHL1r1o0V/cnI2x15y0y/Q== X-Received: by 2002:a17:90b:3b42:b0:23f:81de:6a74 with SMTP id ot2-20020a17090b3b4200b0023f81de6a74mr11469155pjb.39.1679890591580; Sun, 26 Mar 2023 21:16:31 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 04/16] acpi: Create a new Kconfig for ACPI Date: Mon, 27 Mar 2023 17:15:38 +1300 Message-Id: <20230327171546.v3.4.Ia12891d0dc31972c1d1bd138bc7782213c0f371c@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 We have several Kconfig options for ACPI, but all relate to specific functions, such as generating tables and AML code. Add a new option which controls including basic ACPI library code, including the lib/acpi directory. This will allow us to add functions which are available even if table generation is not supported. Adjust the command to avoid a build error when ACPIGEN is not enabled. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v3: - Don't enable ACPI by default except on x86 and sandbox Changes in v2: - Add new patch to create a new Kconfig for ACPI arch/Kconfig | 2 ++ cmd/Kconfig | 2 +- cmd/acpi.c | 4 ++++ drivers/core/Kconfig | 1 + lib/Kconfig | 10 +++++++++- lib/Makefile | 2 +- lib/acpi/Makefile | 4 ++++ 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index d30676ae817b..e4831aeaa075 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -194,6 +194,7 @@ config SANDBOX imply PHYLIB imply DM_MDIO imply DM_MDIO_MUX + imply ACPI imply ACPI_PMC imply ACPI_PMC_SANDBOX imply CMD_PMC @@ -260,6 +261,7 @@ config X86 imply PCH imply PHYSMEM imply RTC_MC146818 + imply ACPI imply ACPIGEN if !QEMU && !EFI_APP imply SYSINFO if GENERATE_SMBIOS_TABLE imply SYSINFO_SMBIOS if GENERATE_SMBIOS_TABLE diff --git a/cmd/Kconfig b/cmd/Kconfig index ba5ec69293fd..1bffbe2e2ba0 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -109,7 +109,7 @@ menu "Info commands" config CMD_ACPI bool "acpi" - depends on ACPIGEN + depends on ACPI default y help List and dump ACPI tables. ACPI (Advanced Configuration and Power diff --git a/cmd/acpi.c b/cmd/acpi.c index d0fc062ef8cb..991b5235e289 100644 --- a/cmd/acpi.c +++ b/cmd/acpi.c @@ -162,6 +162,10 @@ static int do_acpi_items(struct cmd_tbl *cmdtp, int flag, int argc, bool dump_contents; dump_contents = argc >= 2 && !strcmp("-d", argv[1]); + if (!IS_ENABLED(CONFIG_ACPIGEN)) { + printf("Not supported (enable ACPIGEN)\n"); + return CMD_RET_FAILURE; + } acpi_dump_items(dump_contents ? ACPI_DUMP_CONTENTS : ACPI_DUMP_LIST); return 0; diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 0f755aa702ee..f0d848f45d8e 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -448,6 +448,7 @@ config OFNODE_MULTI_TREE_MAX config ACPIGEN bool "Support ACPI table generation in driver model" + depends on ACPI default y if SANDBOX || (GENERATE_ACPI_TABLE && !QEMU) select LIB_UUID help diff --git a/lib/Kconfig b/lib/Kconfig index 4278b2405546..475797d9b391 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -281,9 +281,17 @@ config SUPPORT_ACPI U-Boot can generate these tables and pass them to the Operating System. +config ACPI + bool "Enable support for ACPI libraries" + depends on SUPPORT_ACPI + help + Provides library functions for dealing with ACPI tables. This does + not necessarily include generation of tables + (see GENERATE_ACPI_TABLE), but allows for tables to be located. + config GENERATE_ACPI_TABLE bool "Generate an ACPI (Advanced Configuration and Power Interface) table" - depends on SUPPORT_ACPI + depends on ACPI select QFW if QEMU help The Advanced Configuration and Power Interface (ACPI) specification diff --git a/lib/Makefile b/lib/Makefile index 10aa7ac02985..8d8ccc8bbc39 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -66,7 +66,7 @@ obj-$(CONFIG_$(SPL_TPL_)CRC8) += crc8.o obj-y += crypto/ -obj-$(CONFIG_$(SPL_TPL_)GENERATE_ACPI_TABLE) += acpi/ +obj-$(CONFIG_$(SPL_TPL_)ACPI) += acpi/ obj-$(CONFIG_$(SPL_)MD5) += md5.o obj-$(CONFIG_ECDSA) += ecdsa/ obj-$(CONFIG_$(SPL_)RSA) += rsa/ diff --git a/lib/acpi/Makefile b/lib/acpi/Makefile index 956b5a0d7265..12337abaecfa 100644 --- a/lib/acpi/Makefile +++ b/lib/acpi/Makefile @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0+ # +ifdef CONFIG_$(SPL_TPL_)GENERATE_ACPI_TABLE + obj-$(CONFIG_$(SPL_)ACPIGEN) += acpigen.o obj-$(CONFIG_$(SPL_)ACPIGEN) += acpi_device.o obj-$(CONFIG_$(SPL_)ACPIGEN) += acpi_dp.o @@ -21,3 +23,5 @@ endif obj-y += facs.o obj-y += ssdt.o endif + +endif # GENERATE_ACPI_TABLE From patchwork Mon Mar 27 04:15:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761346 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ZzxuP/Uh; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKK63WGLz1yXq for ; Mon, 27 Mar 2023 15:17:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 36EEE85C70; Mon, 27 Mar 2023 06:16:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZzxuP/Uh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3F5FA85CB1; Mon, 27 Mar 2023 06:16:40 +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,DKIMWL_WL_HIGH, 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-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 7BDEC859BF for ; Mon, 27 Mar 2023 06:16:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1030.google.com with SMTP id p13-20020a17090a284d00b0023d2e945aebso10089080pjf.0 for ; Sun, 26 Mar 2023 21:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JJACwZ3+EjY1/RO0ZiHQEZbONF7NXQ06pEe39XTQYC4=; b=ZzxuP/UhkA0+jMZCPVQgQl717p7nMweiSIpiYZnO3XKTVYTCd16FXXAsAI+iyadWkK s6CEn9uTEqP1Srm7nQdhs9K+QXfCXXaZFnzN8KR9bx9Cv1VlzPpkbg7tp8hGvowFPRGR nPmsPcf35caDcyveRP7vGupgXw41nv8kbfKw0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JJACwZ3+EjY1/RO0ZiHQEZbONF7NXQ06pEe39XTQYC4=; b=Hc8ytfVLXKoQjp9w2SdYqSxVUlDfPdqwIEt1tewzKE+Qf98G8qJerkdAtD6IPHZ5mV VDqgW0SClUqUclrNn5stf1V/gN2fwWIdsFTTJ25GyNdAAenAUc7PFPQe2ZSc4/iwTUEr q3y4DYFwgsWZrG6ebjzjXhR015W+kZ4MhF4hW99jHLqnV9gQZjpShPa5QmIgd1RHMzV7 WSRSDfDrtbrwOUR9xW2yKtLiQHUj3FNGRrTLDpgP02gxPOfhC/80uq081SWSyzbp0edG kIYDCCFo+EC7r32lO1XnPUbfFCe9znlCL7v6Z2iXMROcGRa84avePAGGw3zsXh/vZRL5 X3Rw== X-Gm-Message-State: AAQBX9fbmB5bexNO/P5DZNHHtfXpzeHdvfka36QTHHLuWCv7xr/yJEMA Dq1t6XY7TjFbEnadDh/jk+jHroZ+gW/qmnuvahU= X-Google-Smtp-Source: AKy350ZIsgeclAbRCrS0gO6f6/ji1apKYST4z1fWIN4A+3gbgCpfo+xF2VHHo7NHavdVsgZw577lpw== X-Received: by 2002:a17:902:f548:b0:1a0:4341:4cd9 with SMTP id h8-20020a170902f54800b001a043414cd9mr13334005plf.31.1679890594480; Sun, 26 Mar 2023 21:16:34 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 05/16] acpi: Move the table-finding functions into the libary Date: Mon, 27 Mar 2023 17:15:39 +1300 Message-Id: <20230327171546.v3.5.I39bb26c09d8a85eb485a123564cefa35d0ad88be@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 This is useful for other features. Move the function into library code so it can be used outside just the 'acpi' command. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v3: - Avoid a build error with the ASL compiler Changes in v2: - Add new patch to move acpi-table-finding functions into the library cmd/acpi.c | 40 +--------------------------------- include/acpi/acpi_table.h | 8 +++++++ lib/acpi/Makefile | 2 ++ lib/acpi/acpi.c | 45 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 39 deletions(-) create mode 100644 lib/acpi/acpi.c diff --git a/cmd/acpi.c b/cmd/acpi.c index 991b5235e289..e70913e40bfe 100644 --- a/cmd/acpi.c +++ b/cmd/acpi.c @@ -36,49 +36,11 @@ static void dump_hdr(struct acpi_table_header *hdr) } } -/** - * find_table() - Look up an ACPI table - * - * @sig: Signature of table (4 characters, upper case) - * Return: pointer to table header, or NULL if not found - */ -struct acpi_table_header *find_table(const char *sig) -{ - struct acpi_rsdp *rsdp; - struct acpi_rsdt *rsdt; - int len, i, count; - - rsdp = map_sysmem(gd_acpi_start(), 0); - if (!rsdp) - return NULL; - rsdt = map_sysmem(rsdp->rsdt_address, 0); - len = rsdt->header.length - sizeof(rsdt->header); - count = len / sizeof(u32); - for (i = 0; i < count; i++) { - struct acpi_table_header *hdr; - - hdr = map_sysmem(rsdt->entry[i], 0); - if (!memcmp(hdr->signature, sig, ACPI_NAME_LEN)) - return hdr; - if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN)) { - struct acpi_fadt *fadt = (struct acpi_fadt *)hdr; - - if (!memcmp(sig, "DSDT", ACPI_NAME_LEN) && fadt->dsdt) - return map_sysmem(fadt->dsdt, 0); - if (!memcmp(sig, "FACS", ACPI_NAME_LEN) && - fadt->firmware_ctrl) - return map_sysmem(fadt->firmware_ctrl, 0); - } - } - - return NULL; -} - static int dump_table_name(const char *sig) { struct acpi_table_header *hdr; - hdr = find_table(sig); + hdr = acpi_find_table(sig); if (!hdr) return -ENOENT; printf("%.*s @ %08lx\n", ACPI_NAME_LEN, hdr->signature, diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h index 4030d25c66a0..7ed0443c821a 100644 --- a/include/acpi/acpi_table.h +++ b/include/acpi/acpi_table.h @@ -923,6 +923,14 @@ int acpi_fill_csrt(struct acpi_ctx *ctx); */ ulong write_acpi_tables(ulong start); +/** + * acpi_find_table() - Look up an ACPI table + * + * @sig: Signature of table (4 characters, upper case) + * Return: pointer to table header, or NULL if not found + */ +struct acpi_table_header *acpi_find_table(const char *sig); + #endif /* !__ACPI__*/ #include diff --git a/lib/acpi/Makefile b/lib/acpi/Makefile index 12337abaecfa..c1c9675b5d2a 100644 --- a/lib/acpi/Makefile +++ b/lib/acpi/Makefile @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-y += acpi.o + ifdef CONFIG_$(SPL_TPL_)GENERATE_ACPI_TABLE obj-$(CONFIG_$(SPL_)ACPIGEN) += acpigen.o diff --git a/lib/acpi/acpi.c b/lib/acpi/acpi.c new file mode 100644 index 000000000000..14b15754f492 --- /dev/null +++ b/lib/acpi/acpi.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Utility functions for ACPI + * + * Copyright 2023 Google LLC + */ + +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +struct acpi_table_header *acpi_find_table(const char *sig) +{ + struct acpi_rsdp *rsdp; + struct acpi_rsdt *rsdt; + int len, i, count; + + rsdp = map_sysmem(gd_acpi_start(), 0); + if (!rsdp) + return NULL; + rsdt = map_sysmem(rsdp->rsdt_address, 0); + len = rsdt->header.length - sizeof(rsdt->header); + count = len / sizeof(u32); + for (i = 0; i < count; i++) { + struct acpi_table_header *hdr; + + hdr = map_sysmem(rsdt->entry[i], 0); + if (!memcmp(hdr->signature, sig, ACPI_NAME_LEN)) + return hdr; + if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN)) { + struct acpi_fadt *fadt = (struct acpi_fadt *)hdr; + + if (!memcmp(sig, "DSDT", ACPI_NAME_LEN) && fadt->dsdt) + return map_sysmem(fadt->dsdt, 0); + if (!memcmp(sig, "FACS", ACPI_NAME_LEN) && + fadt->firmware_ctrl) + return map_sysmem(fadt->firmware_ctrl, 0); + } + } + + return NULL; +} From patchwork Mon Mar 27 04:15:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761348 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=G6xWcTFv; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKKc4TKGz1yXq for ; Mon, 27 Mar 2023 15:17:40 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 84FB38605F; Mon, 27 Mar 2023 06:16:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="G6xWcTFv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDB4485CAD; Mon, 27 Mar 2023 06:16:43 +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,DKIMWL_WL_HIGH, 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-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 5A09185C2B for ; Mon, 27 Mar 2023 06:16:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1029.google.com with SMTP id x15so6484546pjk.2 for ; Sun, 26 Mar 2023 21:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9zxdoTuqaSHVnb48NEkaz7EMqQDjPfhARk6byKAVTUg=; b=G6xWcTFvuf76MqqpbVZiqXA8rrnf0/jvOjRKmBYBNzTlT82YmrMSulfTDQ+L6dtara C5rejeC2kDeat0pj30IUT6SLFFfTz8wddpGxzfdrKTBVZ7QLBnrCK+ORJk8EvF5A/IE8 3lwCX/MqwI58kFoR1E/ngUfGhIqgpHfUjngYc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9zxdoTuqaSHVnb48NEkaz7EMqQDjPfhARk6byKAVTUg=; b=43/nS75DpovaeeN4n4iIDTH0xsvP3nHzz3zsI50WRTzdYxINnC/YEqv3b4QVjlA4sC 2zLxC05cdxjSD8gwV8Sq29Lj0SBOKNt4YtGr46M2oNSneNlTK3xoqVSm+/2OwiiK9g1a RqEDSxu8YAitTJmzIZc3cbqMQJ1o8Oet0SZozemuy9v9ld8JVuNS4AyViO5LJ3kr1ZQS A+ca2v+rwg4OM+OOrTsMw1d5fxbBlJgTlW6Nlhuig55kiya3wpDnC1WHbX3HZmMixBsu cRuLVFSGarHYTHTyY+Ye5t+NmcK4Ux7F6nMITOmoCqW8z9Le4WWDHIQmTf5pQqfqjmQ/ YIYA== X-Gm-Message-State: AAQBX9eMQcevVZWEDP6lSb5SsDBcgxmlsH4lZub+6QuSsWRm6jkC4doX GqemB8Pyn9SewcNTCvoCoxdfjVmashTAo3B1eps= X-Google-Smtp-Source: AKy350aOafxR+l19RZxLkH0RP5BUfpl99kr1R7iC27l2RXjom5ix37RXXprBrhZ2cXGkvCXP4YjZGg== X-Received: by 2002:a17:902:ec82:b0:1a1:8d4e:a71d with SMTP id x2-20020a170902ec8200b001a18d4ea71dmr15063771plg.46.1679890597379; Sun, 26 Mar 2023 21:16:37 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:37 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 06/16] x86: coreboot: Collect the address of the ACPI tables Date: Mon, 27 Mar 2023 17:15:40 +1300 Message-Id: <20230327041551.1757316-3-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 At present any ACPI tables created by prior-stage firmware are ignored. It is useful to be able to view these in U-Boot. Pick this up from the sysinfo tables and display it with the cbsysinfo command. This allows the 'acpi list' command to work when booting from coreboot. Adjust the global_data condition so that acpi_start is available even if table-generation is disabled. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v2) Changes in v2: - Use tab instead of space in header file - Refactor two patches into one arch/x86/include/asm/cb_sysinfo.h | 2 ++ arch/x86/include/asm/coreboot_tables.h | 2 ++ arch/x86/lib/coreboot/cb_sysinfo.c | 11 +++++++++++ cmd/x86/cbsysinfo.c | 1 + include/asm-generic/global_data.h | 4 ++-- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/cb_sysinfo.h b/arch/x86/include/asm/cb_sysinfo.h index 0201ac6b03a9..6b266149cf65 100644 --- a/arch/x86/include/asm/cb_sysinfo.h +++ b/arch/x86/include/asm/cb_sysinfo.h @@ -133,6 +133,7 @@ * @mtc_size: Size of MTC region * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning * not used + * @rsdp: Pointer to ACPI RSDP table */ struct sysinfo_t { unsigned int cpu_khz; @@ -211,6 +212,7 @@ struct sysinfo_t { u64 mtc_start; u32 mtc_size; void *chromeos_vpd; + void *rsdp; }; extern struct sysinfo_t lib_sysinfo; diff --git a/arch/x86/include/asm/coreboot_tables.h b/arch/x86/include/asm/coreboot_tables.h index f131de56a405..4de137fbab9d 100644 --- a/arch/x86/include/asm/coreboot_tables.h +++ b/arch/x86/include/asm/coreboot_tables.h @@ -422,6 +422,8 @@ struct cb_tsc_info { #define CB_TAG_SERIALNO 0x002a #define CB_MAX_SERIALNO_LENGTH 32 +#define CB_TAG_ACPI_RSDP 0x0043 + #define CB_TAG_CMOS_OPTION_TABLE 0x00c8 struct cb_cmos_option_table { diff --git a/arch/x86/lib/coreboot/cb_sysinfo.c b/arch/x86/lib/coreboot/cb_sysinfo.c index 748fa4ee53bb..a11a2587f66b 100644 --- a/arch/x86/lib/coreboot/cb_sysinfo.c +++ b/arch/x86/lib/coreboot/cb_sysinfo.c @@ -264,6 +264,13 @@ static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info) info->mrc_cache = map_sysmem(cbmem->cbmem_tab, 0); } +static void cb_parse_acpi_rsdp(void *ptr, struct sysinfo_t *info) +{ + struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr; + + info->rsdp = map_sysmem(cbmem->cbmem_tab, 0); +} + __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr) { } @@ -428,6 +435,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info) case CB_TAG_MRC_CACHE: cb_parse_mrc_cache(rec, info); break; + case CB_TAG_ACPI_RSDP: + cb_parse_acpi_rsdp(rec, info); + break; default: cb_parse_unhandled(rec->tag, ptr); break; @@ -454,6 +464,7 @@ int get_coreboot_info(struct sysinfo_t *info) if (!ret) return -ENOENT; gd->arch.coreboot_table = addr; + gd_set_acpi_start(map_to_sysmem(info->rsdp)); gd->flags |= GD_FLG_SKIP_LL_INIT; return 0; diff --git a/cmd/x86/cbsysinfo.c b/cmd/x86/cbsysinfo.c index 34fdaf5b1b1c..07570b00c9a0 100644 --- a/cmd/x86/cbsysinfo.c +++ b/cmd/x86/cbsysinfo.c @@ -363,6 +363,7 @@ static void show_table(struct sysinfo_t *info, bool verbose) print_hex("MTC size", info->mtc_size); print_ptr("Chrome OS VPD", info->chromeos_vpd); + print_ptr("RSDP", info->rsdp); } static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc, diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 987fb66c17a3..422e0cf4720f 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -457,7 +457,7 @@ struct global_data { */ fdt_addr_t translation_offset; #endif -#ifdef CONFIG_GENERATE_ACPI_TABLE +#ifdef CONFIG_ACPI /** * @acpi_ctx: ACPI context pointer */ @@ -536,7 +536,7 @@ static_assert(sizeof(struct global_data) == GD_SIZE); #define gd_dm_priv_base() NULL #endif -#ifdef CONFIG_GENERATE_ACPI_TABLE +#ifdef CONFIG_ACPI #define gd_acpi_ctx() gd->acpi_ctx #define gd_acpi_start() gd->acpi_start #define gd_set_acpi_start(addr) gd->acpi_start = addr From patchwork Mon Mar 27 04:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761350 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=fFpHrKeb; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKL70XnTz1yXq for ; Mon, 27 Mar 2023 15:18:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 67F7386082; Mon, 27 Mar 2023 06:17:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fFpHrKeb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6FA1785CB6; Mon, 27 Mar 2023 06:16:47 +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,DKIMWL_WL_HIGH, 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-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (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 3AC5985B61 for ; Mon, 27 Mar 2023 06:16:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x630.google.com with SMTP id kc4so7168269plb.10 for ; Sun, 26 Mar 2023 21:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fB3CzvicXoaRTz71Gu90gis8Tlrp1gCWlV0E8gp8P1c=; b=fFpHrKeb/Xd5Y6mA3Q4pzlAVLj6yyaj4kqU6SnUkSsnxdop3+eJnOkR3XZQiuEDYUA d0oWLId8f8qIKZG9lPINWopKzcS1/dssf0UrPB/OUXYCkRUy/QENwAoAAz7I5Riowxjx aAxpTBKVYHGSOb3k+sE0a6/B/KLm4MMzeJZ1o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fB3CzvicXoaRTz71Gu90gis8Tlrp1gCWlV0E8gp8P1c=; b=x9auZoVRtjuU96XlCOsCp5PPA3X1vVa3fuenEv+tC/gPVZcFNLH7iDmDI0x1lVQkoO 5qKpXtyS7Rc2u4nKA/JBSsiVDDY4cmc80e6L8Y7roLiBK3ao7mRynVDtDgJYO2sBLtG4 jLb4iUDkw5UDkCVG0mOTrTsQt6zumoUjcb9OjWeGbd7Mg5CkNOMWZQtY14XQjQGeoomD ajxPKqpXUOq9uhMKnHjSZdE3J20n1EdYv3aAiwTcxJmZIx4IcQNiAdYS+awk1atH673O XLeVT/ZzVDOI17n2MewYGPNmsd0YjgA3YDVdGqPQDZRyZUj3jVmTYoedMtlL17nZWZDq gfYA== X-Gm-Message-State: AAQBX9fZZDiaUUP2SPNsKtoo3lw+AVGLz8q6Qm4O8+K7zPxol97+quaD jCdyyHDFIzsenFjVFe1gsmSTWxU4Zx47Yri6ruc= X-Google-Smtp-Source: AKy350Y6KiOJaK8Nhbs3XKI9+ZopjymhOC1SrM5fd9B168v7a6U/gL2oLvXqZQLhjRHJuQqsSB0Xdw== X-Received: by 2002:a17:903:187:b0:19f:188c:3e34 with SMTP id z7-20020a170903018700b0019f188c3e34mr12627034plg.53.1679890600383; Sun, 26 Mar 2023 21:16:40 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 07/16] x86: Allow locating the UART from ACPI tables Date: Mon, 27 Mar 2023 17:15:41 +1300 Message-Id: <20230327171546.v3.7.Id2a743860c950cfa77a82918bf5cc1e38060fd39@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 coreboot does not pass a UART in its sysinfo struct, there is no easy way to find it out. Since coreboot does not actually init the serial device when serial is disabled, it is not possible to make it add this information to the sysinfo table. Add a way to obtain this information from the DBG2 ACPI table, which is normally set up by coreboot. For now this only supports a memory-mapped 16550-style UART. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v3: - Disable for coreboot64 since ACPI is not available Changes in v2: - Add new patch to allow locating the UART from ACPI tables drivers/serial/Kconfig | 10 +++ drivers/serial/serial_coreboot.c | 114 ++++++++++++++++++++++++++++--- 2 files changed, 116 insertions(+), 8 deletions(-) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 10d07daf2777..08f6559c1579 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -669,6 +669,16 @@ config COREBOOT_SERIAL a serial console on any platform without needing to change the device tree, etc. +config COREBOOT_SERIAL_FROM_DBG2 + bool "Obtain UART from ACPI tables" + depends on COREBOOT_SERIAL + default y if !SPL + help + Select this to try to find a DBG2 record in the ACPI tables, in the + event that coreboot does not provide information about the UART in the + normal sysinfo tables. This provides a useful fallback when serial + is not enabled in coreboot. + config CORTINA_UART bool "Cortina UART support" depends on DM_SERIAL diff --git a/drivers/serial/serial_coreboot.c b/drivers/serial/serial_coreboot.c index de09c8681f5c..23066e4d0543 100644 --- a/drivers/serial/serial_coreboot.c +++ b/drivers/serial/serial_coreboot.c @@ -5,25 +5,123 @@ * Copyright 2019 Google LLC */ +#define LOG_CATGEGORY UCLASS_SERIAL + #include #include +#include #include #include +#include #include +DECLARE_GLOBAL_DATA_PTR; + +static int read_dbg2(struct ns16550_plat *plat) +{ + struct acpi_table_header *tab; + struct acpi_dbg2_header *hdr; + struct acpi_dbg2_device *dbg; + struct acpi_gen_regaddr *addr; + u32 *addr_size; + + log_debug("Looking for DBG2 in ACPI tables\n"); + if (!gd->acpi_start) { + log_debug("No ACPI tables\n"); + return -ENOENT; + } + + tab = acpi_find_table("DBG2"); + if (!tab) { + log_debug("No DBG2 table\n"); + return -ENOENT; + } + hdr = container_of(tab, struct acpi_dbg2_header, header); + + /* We only use the first device, but check that there is at least one */ + if (!hdr->devices_count) { + log_debug("No devices\n"); + return -ENOENT; + } + if (hdr->devices_offset >= tab->length) { + log_debug("Invalid offset\n"); + return -EINVAL; + } + dbg = (void *)hdr + hdr->devices_offset; + if (dbg->revision) { + log_debug("Invalid revision %d\n", dbg->revision); + return -EINVAL; + } + if (!dbg->address_count) { + log_debug("No addresses\n"); + return -EINVAL; + } + if (dbg->port_type != ACPI_DBG2_SERIAL_PORT) { + log_debug("Not a serial port\n"); + return -EPROTOTYPE; + } + if (dbg->port_subtype != ACPI_DBG2_16550_COMPATIBLE) { + log_debug("Incompatible serial port\n"); + return -EPROTOTYPE; + } + if (dbg->base_address_offset >= dbg->length || + dbg->address_size_offset >= dbg->length) { + log_debug("Invalid base address/size offsets %d, %d\n", + dbg->base_address_offset, dbg->address_size_offset); + return -EINVAL; + } + addr_size = (void *)dbg + dbg->address_size_offset; + if (!*addr_size) { + log_debug("Zero address size\n"); + return -EINVAL; + } + addr = (void *)dbg + dbg->base_address_offset; + if (addr->space_id != ACPI_ADDRESS_SPACE_MEMORY) { + log_debug("Incompatible space %d\n", addr->space_id); + return -EPROTOTYPE; + } + + plat->base = addr->addrl; + + /* ACPI_ACCESS_SIZE_DWORD_ACCESS is 3; we want 2 */ + plat->reg_shift = addr->access_size - 1; + plat->reg_width = 4; /* coreboot sets bit_width to 0 */ + plat->clock = 1843200; + plat->fcr = UART_FCR_DEFVAL; + plat->flags = 0; + log_debug("Collected UART from ACPI DBG2 table\n"); + + return 0; +} + static int coreboot_of_to_plat(struct udevice *dev) { struct ns16550_plat *plat = dev_get_plat(dev); struct cb_serial *cb_info = lib_sysinfo.serial; + int ret = -ENOENT; - plat->base = cb_info->baseaddr; - plat->reg_shift = cb_info->regwidth == 4 ? 2 : 0; - plat->reg_width = cb_info->regwidth; - plat->clock = cb_info->input_hertz; - plat->fcr = UART_FCR_DEFVAL; - plat->flags = 0; - if (cb_info->type == CB_SERIAL_TYPE_IO_MAPPED) - plat->flags |= NS16550_FLAG_IO; + if (cb_info) { + plat->base = cb_info->baseaddr; + plat->reg_shift = cb_info->regwidth == 4 ? 2 : 0; + plat->reg_width = cb_info->regwidth; + plat->clock = cb_info->input_hertz; + plat->fcr = UART_FCR_DEFVAL; + plat->flags = 0; + if (cb_info->type == CB_SERIAL_TYPE_IO_MAPPED) + plat->flags |= NS16550_FLAG_IO; + ret = 0; + } else if (IS_ENABLED(CONFIG_COREBOOT_SERIAL_FROM_DBG2)) { + ret = read_dbg2(plat); + } + + if (ret) { + /* + * Returning an error will cause U-Boot to complain that + * there is no UART, which may panic. So stay silent and + * pray that the video console will work. + */ + log_debug("Cannot detect UART\n"); + } return 0; } From patchwork Mon Mar 27 04:15:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761349 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=A8msGWht; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKKt33Rpz1yXq for ; Mon, 27 Mar 2023 15:17:54 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B6C8285CCA; Mon, 27 Mar 2023 06:17:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="A8msGWht"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF2F785CAD; Mon, 27 Mar 2023 06:16:46 +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,DKIMWL_WL_HIGH, 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-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 DF34585AB1 for ; Mon, 27 Mar 2023 06:16:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1036.google.com with SMTP id fy10-20020a17090b020a00b0023b4bcf0727so7337489pjb.0 for ; Sun, 26 Mar 2023 21:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=86RIpqP6CSM4gXMAI70sBH5+s6B8wQ9LQFIbXBusMtg=; b=A8msGWhtU8/tCif8HaxaeW6K6K9OiMAFgAM3NP/ZqgleoX/yQqh1A8S6YOAcoeWCoO TLFkkdWf2YlwboliVjSe+wvqAL5GGvlX0ruozMGqpbKnOYdgz4zSfCKjmeT3t0Vv7maS Bga7CtYrdt3G0wFWYQ6u2bbnhjB3ca85ANQgw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=86RIpqP6CSM4gXMAI70sBH5+s6B8wQ9LQFIbXBusMtg=; b=LBqFzMOzRGR7/uc3EatIE2Gu/2qfMEIOvKeBpcQqmhmQyESVYpLmMHH/G2tTKbQe7g zjYzRaSwLONWr+hoeqZ6FJdy0S9BK+CyJvNMuia5uZqYPxf6GRNn7CIHu59HH3G4QGeA eMoiU/M0gyqfMQFIFxbbp+AGLg8047sk8w3hMRXWhklZpZTV0WCGuo0Q5Z+c68FcbT7S Ak1n3IC2m98DtLIKUrH6denEM4QGn+RH0qF0G1XUa7f0B5mVtkDCqVsuWEcF33Ml5zRP HpC0SBXgRd05wytu8iUjb1IbCXp6W7JMAx3MBnAE4+zEpQ8TEOjSz3HiNKMZEALDSQaG N5WQ== X-Gm-Message-State: AAQBX9epk0SrQ7rYOGd35i0eUEplExL2e5x7pO7yo1rbs2y4obDhtRsG N1/z1ehAcK0iwdvHANV69XmFXz+UKXe08ZmYCAA= X-Google-Smtp-Source: AKy350bt22BdoosPzBaFRlSQJzZTAjenAfO5S7OmxL8Ecc3YjCphRllbsfdBfCUS4cjXAt65XTyA0w== X-Received: by 2002:a17:902:ec91:b0:1a1:ee8c:eef7 with SMTP id x17-20020a170902ec9100b001a1ee8ceef7mr13059234plg.48.1679890603232; Sun, 26 Mar 2023 21:16:43 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:43 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 08/16] pci: coreboot: Don't read regions when booting Date: Mon, 27 Mar 2023 17:15:42 +1300 Message-Id: <20230327041551.1757316-4-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 U-Boot is the second-stage bootloader, PCI is already set up. We cannot read the regions from the device tree. There is no point anyway, since PCI devices have already been allocated according to the regions and it is not safe for U-Boot to make any changes. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Christian Gmeiner --- (no changes since v1) drivers/pci/pci-uclass.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 9343cfc62a96..8d27e40338cf 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -973,6 +973,10 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node, int len; int i; + /* handle booting from coreboot, etc. */ + if (!ll_boot_init()) + return 0; + prop = ofnode_get_property(node, "ranges", &len); if (!prop) { debug("%s: Cannot decode regions\n", __func__); From patchwork Mon Mar 27 04:15:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761351 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ejFEJ4WQ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKLM6Lvtz1yXq for ; Mon, 27 Mar 2023 15:18:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1E3108605B; Mon, 27 Mar 2023 06:17:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ejFEJ4WQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5016185CCA; Mon, 27 Mar 2023 06:16: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,DKIMWL_WL_HIGH, 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-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (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 3F98A85CAD for ; Mon, 27 Mar 2023 06:16:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1034.google.com with SMTP id om3-20020a17090b3a8300b0023efab0e3bfso10516993pjb.3 for ; Sun, 26 Mar 2023 21:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890606; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lr6wdBVbgP97z7np+5R2qKpqXAyjP+romZZshjxVRqg=; b=ejFEJ4WQQMt0Z7TI5sRW9NdWgoIJjoiFOhyNJLm11XAdJk+71IYrueyMpoRqFKnh9Y 9uzC5pJ1Vh/XVAl242Pc9+axv8dCcZEOHMvQ9Q9ybDB9ltjTRtjhTO1SG+VJ1xloKEaB 0SYlPTNT0+gaehVK0T+p2eCa72uVQeiAMXZAI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890606; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lr6wdBVbgP97z7np+5R2qKpqXAyjP+romZZshjxVRqg=; b=qAkgZ9UHQBaEHyXZwij1HgKVTbb1x32jgDwHro6OzprnurubG64htMDqHbrv0dmPym OCVly7GyluStts/5GjveEKlvwAqAxpxndj2Bs1u3DSwGZmKqxLOtW/CtnB0DuY8k+O4N uRR14k2AzhgGXmuPaRMTlbRlaNmkFfm6njfmU1HcfetiG6Yaj9ISNMVuDewzF5/VGcds Hm3ShMre2x53k9zPL24qwRdUSbXcqEeD/7AELZjaaMJ8bUMEBT7xxOPl8rXDJxMAryZK VBr5vxCQQCswegfKbQjUnjnUXDYP3gIfE5ogkyWd2p0Srnre3amYswOVVI0mam6OSo7X cB+Q== X-Gm-Message-State: AAQBX9d0DxLp+K5t5ugEZsIbUiUtzSeIErLpePFksV8uUwyr87JaPc7y hSkg5ajQqj2hGhRTo7aDvyRILsUhng6Y1UfccY8= X-Google-Smtp-Source: AKy350YCHLo0WALPtZRsvwcTLTCIZAIo1zHFup19uBOCU+zXyF3noN5peeAD0CWJb28Y71HG9B3Jcg== X-Received: by 2002:a17:902:f213:b0:19e:2869:7793 with SMTP id m19-20020a170902f21300b0019e28697793mr8506676plc.16.1679890606168; Sun, 26 Mar 2023 21:16:46 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 09/16] x86: coreboot: Use a memory-mapped UART Date: Mon, 27 Mar 2023 17:15:43 +1300 Message-Id: <20230327171546.v3.9.I2f4becc722773cde995be22e05d8f6036f9ee041@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 This is much more common on modern hardware, so default to using it. This does not affect the normal UART, but does allow the debug UART to work, since it uses serial_out_shift(), etc. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v2) Changes in v2: - Expand commit message to explain this is for the debug UART - Update the defconfig instead configs/coreboot64_defconfig | 1 - configs/coreboot_defconfig | 1 - 2 files changed, 2 deletions(-) diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig index ec672e59e898..60a1924e9e53 100644 --- a/configs/coreboot64_defconfig +++ b/configs/coreboot64_defconfig @@ -62,7 +62,6 @@ CONFIG_ATAPI=y CONFIG_LBA48=y CONFIG_SYS_64BIT_LBA=y # CONFIG_PCI_PNP is not set -CONFIG_SYS_NS16550_PORT_MAPPED=y CONFIG_SOUND=y CONFIG_SOUND_I8254=y CONFIG_CONSOLE_SCROLL_LINES=5 diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 4db728991692..fb4d1751108f 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -56,7 +56,6 @@ CONFIG_ATAPI=y CONFIG_LBA48=y CONFIG_SYS_64BIT_LBA=y # CONFIG_PCI_PNP is not set -CONFIG_SYS_NS16550_PORT_MAPPED=y CONFIG_SOUND=y CONFIG_SOUND_I8254=y CONFIG_CONSOLE_SCROLL_LINES=5 From patchwork Mon Mar 27 04:15:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761352 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=QB4ww/38; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKLd15PQz1yXq for ; Mon, 27 Mar 2023 15:18:33 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 72B0C8606A; Mon, 27 Mar 2023 06:17:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="QB4ww/38"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A1E4E8604D; Mon, 27 Mar 2023 06:16:55 +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,DKIMWL_WL_HIGH, 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-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (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 595F085CB6 for ; Mon, 27 Mar 2023 06:16:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x62b.google.com with SMTP id le6so7163788plb.12 for ; Sun, 26 Mar 2023 21:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xj4k5CnGWEt52L+/5OBTrslLIN9fq+iuo3L9l+mpUJc=; b=QB4ww/38tR08djZbFQEd1CDLtG0Nclub0FWFA8Vwmne7kijXW0C+2jVAI8q1uydf+N 4PxSzKzeTjjRRR40/RTpRvd42FnR0LmuLSByKemA3hGULOVxCm0WG4wEOn4mNPHkgEFo gGs2d6mBVNlOqlItPBsEwWtPxTnFtSIeaqcTk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xj4k5CnGWEt52L+/5OBTrslLIN9fq+iuo3L9l+mpUJc=; b=pozektYFaNZq11W71x/8h49C2sKKLRznkLr5whUNlrxZ1UfbROdeF3XH8bTCp77TL5 lqeIqzM8MAIgNpyxPwa+CN0HnQ0eaDK2HE++2vb05ORTfFc+mDG78Wkf+fH2Y4Ep73v9 yqEBcDeZ1bhe1Ii6ipttSAkSM3H5HtIIuSTiS/tJWjQVyw4lll0KbDbI/kQKbmIoMA+/ Qpgw5x+XXqs48OQsy0oZ23CbnMRhCgb8TSi3jHvb0SHFrXyYebIXiS8lO8Bu7PKBJB/+ 6AyKklCG9fqPKb9CQQ6qz1YRwTV7ia+rw5YP+ukZbjmZsA4dhk4O+wZPH46iPGzLoFpW 0ujw== X-Gm-Message-State: AAQBX9ejGeHwZQjckjo9qRDMHsvPE3QH2Q5jUpf+ZOes6dqANZpv8qEz qnZAvobGKcvKnqshN1YKx1Nk+gtZO1SIZUOy658= X-Google-Smtp-Source: AKy350ZNCZ8leZW/rX3enRpz6nebOTxLzIs4siNPRJmNkkEK4BLB9Jkm++7PFgXnQPUWrx1ivhOp0w== X-Received: by 2002:a17:903:8cf:b0:19e:500b:517a with SMTP id lk15-20020a17090308cf00b0019e500b517amr7832234plb.69.1679890609193; Sun, 26 Mar 2023 21:16:49 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:48 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 10/16] x86: coreboot: Document how to enable the debug UART Date: Mon, 27 Mar 2023 17:15:44 +1300 Message-Id: <20230327041551.1757316-5-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 This is not obvious so add a little note about how it works. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v1) doc/board/coreboot/coreboot.rst | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst index 4a5f101cad2e..0fe95af56d2d 100644 --- a/doc/board/coreboot/coreboot.rst +++ b/doc/board/coreboot/coreboot.rst @@ -71,3 +71,32 @@ Memory map (typically redirects to 7ab10030 or similar) 500 Location of coreboot sysinfo table, used during startup ========== ================================================================== + + +Debug UART +---------- + +It is possible to enable the debug UART with coreboot. To do this, use the +info from the cbsysinfo command to locate the UART base. For example:: + + => cbsysinfo + ... + Serial I/O port: 00000000 + base : 00000000 + pointer : 767b51bc + type : 2 + base : fe03e000 + baud : 0d115200 + regwidth : 4 + input_hz : 0d1843200 + PCI addr : 00000010 + ... + +Here you can see that the UART base is fe03e000, regwidth is 4 (1 << 2) and the +input clock is 1843200. So you can add the following CONFIG options:: + + CONFIG_DEBUG_UART=y + CONFIG_DEBUG_UART_BASE=fe03e000 + CONFIG_DEBUG_UART_CLOCK=1843200 + CONFIG_DEBUG_UART_SHIFT=2 + CONFIG_DEBUG_UART_ANNOUNCE=y From patchwork Mon Mar 27 04:15:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761353 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Uo3PIDyB; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKLt6Lzdz1yXq for ; Mon, 27 Mar 2023 15:18:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4D2D085CF7; Mon, 27 Mar 2023 06:17:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Uo3PIDyB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6AAA885CF8; Mon, 27 Mar 2023 06:17:00 +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,DKIMWL_WL_HIGH, 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-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0: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 1995885CF3 for ; Mon, 27 Mar 2023 06:16:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x632.google.com with SMTP id w4so7171500plg.9 for ; Sun, 26 Mar 2023 21:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gF4qkGrY/0fL6Tqj/DGiOFUehJ9PFArizLrbKqPEcLY=; b=Uo3PIDyBO8yemTucN53BB19/CiHM+p/4Ns9Dq+z/il/fwEjAURGna/Bt39mLis2erM 5w0I8WOpKngwu+YApbLF1XIR6aTa6STXDXH9do2EnnmtYhf2GeYisfg3o9jklKqGS38/ fj8DIDGPykqD71p01bJqk7QqVechMIW2X1f6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gF4qkGrY/0fL6Tqj/DGiOFUehJ9PFArizLrbKqPEcLY=; b=TkHX2cOvta/4ZMnsr3tbLvEVs0In8YzvLDtj7mGDVrD/n4rAnZcVxHqu0a/So8Go6U DFJ919RBE0GaFxWLMuMD3JQjs7JVkMePysR/gQSIrTQsj6SKjCl/89AwjVGdBPhlM+KH awOk89m2XbFTYkdk3EqoSw2UEYubg2PmV3m1yBYPJGekZvhKKdNqeIbWIxCfrj18q3eD eiGqwmF7GTn4h20/dzbt+t87LXTP+sN78N5EuqeeitvpjJ2LivgGp1LjbML3UImcYddR 2TA166meQwpaTpmqk4s9JsmPsWt7M3K+Cv5LcxZHweCpuDGdgXcBZPzoZCF202m3mDTb nY6A== X-Gm-Message-State: AAQBX9cBiQ8kj4Tps3OIm9aKQcpeggtacsY4wmTyz5T8XNRcNmg96JHB hkq7kh+uf9NfDJWHm8PEkmVyVYUJzBogQ6N2nus= X-Google-Smtp-Source: AKy350bmbF9XEcYYr4mH1vUMdVUsRsUbRp3V4YdTn148ce8X+Z6Nms9SaiUCvER+BXOEpenvJEX6Qw== X-Received: by 2002:a17:902:e5c8:b0:19f:8bbf:9c56 with SMTP id u8-20020a170902e5c800b0019f8bbf9c56mr12346466plf.3.1679890612195; Sun, 26 Mar 2023 21:16:52 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:51 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 11/16] x86: coreboot: Scan PCI after relocation Date: Mon, 27 Mar 2023 17:15:45 +1300 Message-Id: <20230327041551.1757316-6-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 Enable this so that PCI devices can be used correctly without needing to do a manual scan. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v1) configs/coreboot_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index fb4d1751108f..1bbb358a0220 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -18,6 +18,7 @@ CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y +CONFIG_PCI_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 CONFIG_CMD_IDE=y From patchwork Mon Mar 27 04:15:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761355 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=MNuYeA2W; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKMN0P6Gz1yXq for ; Mon, 27 Mar 2023 15:19:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F02686096; Mon, 27 Mar 2023 06:17:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="MNuYeA2W"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2983985CF3; Mon, 27 Mar 2023 06:17:03 +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,DKIMWL_WL_HIGH, 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-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 E95978605B for ; Mon, 27 Mar 2023 06:16:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x102d.google.com with SMTP id a16so6463324pjs.4 for ; Sun, 26 Mar 2023 21:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890615; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n7Bufd+MSg2WeQdsWdRyc8lVAKm5+HoNA6H9tfhIjM8=; b=MNuYeA2WvRHnV+xsk/nI6AeFlFuxIW3WCWOWDWbDQc2TOQutIySydvAKDz96TJiG63 vSZIiemlZJrCHWhx8xRMLBDvSS+ROlZkwbvFT6/+ijCCUGXv9nWPs3JXvUu8TfUAo7ea bbE4lq2S9UStGTzBVUCzJTjFfVa82y3BogsOQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890615; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n7Bufd+MSg2WeQdsWdRyc8lVAKm5+HoNA6H9tfhIjM8=; b=MUth9EX4VEKDCSxnFHKFUAqYVzki69CUvMtPN3TPXzhn7r+pHORdIBPAyJf2qh6YX4 Zisi4OsgA4hRng8URGY/fZGUw/t7QXfpXf9fFGps7ip3KnnOMTVJ7Q87prBBC+36vQtj Zbgv7HzBLc1uDUucSdLjRC9tqIOEnl+tqtmTLLdx9QK9k74CdduWhk2DXmEoKtVgOyxo vbqreUNGPDg3dUoONdKWgxke6PpN5loPjvTmkRqUABe+YDT1nC+2O7aTsGt4fpXp+5XI klisePAnrqbdRmppbVFH4Glo5+IfKx2EbIzfvRAU8GFOQciheEA++LyXWnVH7isFmuf6 yJoA== X-Gm-Message-State: AAQBX9dW2lKvVx6jjNd3F9EsjgntZ4ZDXZtHsISt4pWPCOeeWLXAdOCC WGewpHG8ER/rE0NgOGs+AE2/NE3RCS5ieg757Q8= X-Google-Smtp-Source: AKy350Ybh8BTF5cy/Iid47Fl91UXCCgTvJaNxe6q5BV25hh3t0L9q6dvaugsqP59afHLxK/tuQjnSQ== X-Received: by 2002:a17:903:2309:b0:1a1:b5e3:7db4 with SMTP id d9-20020a170903230900b001a1b5e37db4mr12374121plh.18.1679890615089; Sun, 26 Mar 2023 21:16:55 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 12/16] x86: coreboot: Log function names and line numbers Date: Mon, 27 Mar 2023 17:15:46 +1300 Message-Id: <20230327041551.1757316-7-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 Turn these options on to make it easier to debug things. Also enable dhrystone so we can get some measure of performance. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v1) configs/coreboot_defconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 1bbb358a0220..3030e5bf93b4 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -16,6 +16,9 @@ CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_LOG=y +CONFIG_LOGF_LINE=y +CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_PCI_INIT_R=y @@ -60,5 +63,6 @@ CONFIG_SYS_64BIT_LBA=y CONFIG_SOUND=y CONFIG_SOUND_I8254=y CONFIG_CONSOLE_SCROLL_LINES=5 +CONFIG_CMD_DHRYSTONE=y # CONFIG_GZIP is not set CONFIG_SMBIOS_PARSER=y From patchwork Mon Mar 27 04:15:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761354 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=U8FgIY+U; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKM74nNQz1yXq for ; Mon, 27 Mar 2023 15:18:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F1EC78608C; Mon, 27 Mar 2023 06:17:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="U8FgIY+U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 55BE185CF4; Mon, 27 Mar 2023 06:17:05 +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,DKIMWL_WL_HIGH, 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-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (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 CDBD085CF7 for ; Mon, 27 Mar 2023 06:16:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x629.google.com with SMTP id kq3so7160493plb.13 for ; Sun, 26 Mar 2023 21:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wUe9Z0o8bezFRoYVdzKi2lSmmSYochiFhFYN5X8T674=; b=U8FgIY+UOqGdiaDQU89nUr3vBUQxG0X1iPuCLRT+9dxvTFpMvYo6c92wwfmA/s7gz/ aMZWcAl0ema+x+z08jfSwyKM4AxDhVZ15P7Q9tb+2RR1Ik8Q/I1G9jgKvxedoV9Iiv1w IJXw+w2DvmR+2WeE/AtrPSKi2SIrraRffSnY8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wUe9Z0o8bezFRoYVdzKi2lSmmSYochiFhFYN5X8T674=; b=syM4KULdkMG3KB70OVOsq0zopUcyWcZeRIq1WH/HirIO+toCL9Kkxex8Qj98k5lzwX V/ELYphnO08nNhTCf/Amgqg/qUDinMH2qe0qknZU9K8a8YyBdJrdg5H8Eafs6LwioSSN wu22g+ovXA2QCDfRG82i/kDKwzgJEMMwIDTgMQ1G3qLYSqbyIlWNBc3/94dJddCFwieq YwuYGVXHIqkMvUMn3BdjXM0eU7ABsG8els66Wxa54C+J0rnHYGPcO4Wk3NyYppGtVp2z X0JfCfUUjWu1EKFUxv339f3XINny4U4UR3gQrKeZtDSDUgm8Ql1k/Cl0c2MsDU5EN3IV Fg+A== X-Gm-Message-State: AAQBX9dyzcRLcgEK4zUMnnDqumqlbrcH+kyQj6EWusQzrG5/D8pmVWll mtjMFlJeqUKvUXRrj2+WZ9Yefkq8Tw+/1Z1J9Js= X-Google-Smtp-Source: AKy350bkACYNlBq4EJ/beOHiJ7tzlRKumadqI6Ell9U0hy6jZW1utbJG9BxF68BMB1uAr3fLUgHqKA== X-Received: by 2002:a17:902:eecc:b0:1a0:6bd4:ea78 with SMTP id h12-20020a170902eecc00b001a06bd4ea78mr9151026plb.31.1679890617968; Sun, 26 Mar 2023 21:16:57 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:16:57 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 13/16] x86: coreboot: Show unimplemented sysinfo tags Date: Mon, 27 Mar 2023 17:15:47 +1300 Message-Id: <20230327171546.v3.13.I446361a6584562e9b817126ddb4d78a363bd1633@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 Sometimes coreboot adds new tags that U-Boot does not know about. These are silently ignored, but it is useful to at least know what we are missing. Add a way to collect this information. For Brya it shows: Unimpl. 38 41 37 34 42 40 These are: LB_TAG_PLATFORM_BLOB_VERSION LB_TAG_ACPI_CNVS LB_TAG_FMAP LB_TAG_VBOOT_WORKBUF LB_TAG_TYPE_C_INFO LB_TAG_BOARD_CONFIG Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v1) arch/x86/include/asm/cb_sysinfo.h | 6 ++++++ arch/x86/lib/coreboot/cb_sysinfo.c | 2 ++ cmd/x86/cbsysinfo.c | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/arch/x86/include/asm/cb_sysinfo.h b/arch/x86/include/asm/cb_sysinfo.h index 6b266149cf65..2c78b22d0d22 100644 --- a/arch/x86/include/asm/cb_sysinfo.h +++ b/arch/x86/include/asm/cb_sysinfo.h @@ -16,6 +16,8 @@ #define SYSINFO_MAX_GPIOS 8 /* Up to 10 MAC addresses */ #define SYSINFO_MAX_MACS 10 +/* Track the first 32 unimplemented tags */ +#define SYSINFO_MAX_UNIMPL 32 /** * struct sysinfo_t - Information passed to U-Boot from coreboot @@ -134,6 +136,8 @@ * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning * not used * @rsdp: Pointer to ACPI RSDP table + * @unimpl_count: Number of entries in unimpl_map[] + * @unimpl: List of unimplemented IDs (bottom 8 bits only) */ struct sysinfo_t { unsigned int cpu_khz; @@ -213,6 +217,8 @@ struct sysinfo_t { u32 mtc_size; void *chromeos_vpd; void *rsdp; + u32 unimpl_count; + u8 unimpl[SYSINFO_MAX_UNIMPL]; }; extern struct sysinfo_t lib_sysinfo; diff --git a/arch/x86/lib/coreboot/cb_sysinfo.c b/arch/x86/lib/coreboot/cb_sysinfo.c index a11a2587f66b..42cc3a128d93 100644 --- a/arch/x86/lib/coreboot/cb_sysinfo.c +++ b/arch/x86/lib/coreboot/cb_sysinfo.c @@ -439,6 +439,8 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info) cb_parse_acpi_rsdp(rec, info); break; default: + if (info->unimpl_count < SYSINFO_MAX_UNIMPL) + info->unimpl[info->unimpl_count++] = rec->tag; cb_parse_unhandled(rec->tag, ptr); break; } diff --git a/cmd/x86/cbsysinfo.c b/cmd/x86/cbsysinfo.c index 07570b00c9a0..2b8d3b0a4356 100644 --- a/cmd/x86/cbsysinfo.c +++ b/cmd/x86/cbsysinfo.c @@ -364,6 +364,14 @@ static void show_table(struct sysinfo_t *info, bool verbose) print_ptr("Chrome OS VPD", info->chromeos_vpd); print_ptr("RSDP", info->rsdp); + printf("%-12s: ", "Unimpl."); + if (info->unimpl_count) { + for (i = 0; i < info->unimpl_count; i++) + printf("%02x ", info->unimpl[i]); + printf("\n"); + } else { + printf("(none)\n"); + } } static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc, From patchwork Mon Mar 27 04:15:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761356 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=RnM9hXg8; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKMb2bnpz1yXq for ; Mon, 27 Mar 2023 15:19:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 26C5C8609D; Mon, 27 Mar 2023 06:17:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="RnM9hXg8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D85986070; Mon, 27 Mar 2023 06:17:09 +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,DKIMWL_WL_HIGH, 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-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 7C40285CB6 for ; Mon, 27 Mar 2023 06:17:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x102d.google.com with SMTP id a16so6463460pjs.4 for ; Sun, 26 Mar 2023 21:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ppgVJnE7VWgR0UTLVWLJxPo+Yys6e0gHmQjLqp+wsA4=; b=RnM9hXg80psoPbFRVwri54h+sZ4NhragUH1oZ9W3dLc7kqAF4K53NlzVkYOwg9mjmG ZqaZG4b1d7y0gLhTURQ80wbPJkLXPhjcUthDoHFjTTp8IurVBikL3Jg+9Kj56p0S7/Nr RvCoypGotkjPz1yQgmgwC1KmPA3E9a9tExZb4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ppgVJnE7VWgR0UTLVWLJxPo+Yys6e0gHmQjLqp+wsA4=; b=Qyj3XGR66nLoa7oYe68dZ1VOlmMqvoPq76DxRVVbdID4STJceTCFGGHMKM0t7nE2qo wFsO3k0aTffEDR5GtMsKuZQY8jbiwEzqV3DH5TN7Fa75k5oLSbYbhJWpZhDJ4Za1fN8f WmThaNTzjJgVh62gFPj9Q7o/idytyxwry4fk5DTRTJMsYZzDFzfwS0tagoT9AOs5Mk71 QJ2N6Ku0DmDr+IDp1JBCokbFfGaRodTp/xDbtVZn1RApE/lnmHMzA94pK2GIZ6kxxcfy 18XDAtmaawzrhhy7Mo1jz+1x8pbnEBzHr6DtFNPkSXKxiVfnF6JIH2uKuMwGxP77Upmi 2d9A== X-Gm-Message-State: AAQBX9dJ9UQ5Z6rn0dCfjGOTID2mXj2nOTPXdX+pW5kgckyc9n6yEie3 W1u0zH/5wsGSMlLxvTZgZ9u4MhKQaSij0zsjWWQ= X-Google-Smtp-Source: AKy350YFiZcEb3v3R02fVVT15KeJ0P0NVf8XMkCwW1mY6s8Xm5iZe5V3h5iwr22gmndR2CrxRxQ3Bg== X-Received: by 2002:a17:903:2015:b0:1a2:2091:ee8b with SMTP id s21-20020a170903201500b001a22091ee8bmr6516872pla.10.1679890620844; Sun, 26 Mar 2023 21:17:00 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:17:00 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 14/16] x86: nvme: coreboot: Enable NVMe Date: Mon, 27 Mar 2023 17:15:48 +1300 Message-Id: <20230327171546.v3.14.I2b371d07ceb0f9911293c39fe2d716341847560f@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 Enable support for NVMe storage devices. Update the driver to enable the bus master bit, since coreboot does not do that automatically. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Drop patch 'usb: Quieten a debug message' since it was fixed elsewhere - Drop patch 'x86: coreboot: Use a memory-mapped UART' (not needed) configs/coreboot_defconfig | 3 +++ drivers/nvme/nvme_pci.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 3030e5bf93b4..8bb744e6e84d 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -59,6 +59,9 @@ CONFIG_SYS_ATA_ALT_OFFSET=0 CONFIG_ATAPI=y CONFIG_LBA48=y CONFIG_SYS_64BIT_LBA=y +CONFIG_MISC=y +CONFIG_NVMEM=y +CONFIG_NVME_PCI=y # CONFIG_PCI_PNP is not set CONFIG_SOUND=y CONFIG_SOUND_I8254=y diff --git a/drivers/nvme/nvme_pci.c b/drivers/nvme/nvme_pci.c index 36bf9c5ffb73..dff19317943c 100644 --- a/drivers/nvme/nvme_pci.c +++ b/drivers/nvme/nvme_pci.c @@ -6,6 +6,7 @@ #include #include +#include #include #include "nvme.h" @@ -30,6 +31,13 @@ static int nvme_probe(struct udevice *udev) ndev->instance = trailing_strtol(udev->name); ndev->bar = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM); + + if (!ll_boot_init()) { + /* Turn on bus-mastering */ + dm_pci_clrset_config16(udev, PCI_COMMAND, 0, + PCI_COMMAND_MASTER); + } + return nvme_init(udev); } From patchwork Mon Mar 27 04:15:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761357 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=elwSeoV8; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKMq24R6z1yXq for ; Mon, 27 Mar 2023 15:19:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6312186087; Mon, 27 Mar 2023 06:17:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="elwSeoV8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0CDD38606A; Mon, 27 Mar 2023 06:17:13 +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,DKIMWL_WL_HIGH, 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-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 F21E185CF7 for ; Mon, 27 Mar 2023 06:17:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1029.google.com with SMTP id f6-20020a17090ac28600b0023b9bf9eb63so7298151pjt.5 for ; Sun, 26 Mar 2023 21:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890624; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CcLaWTonsevpz7hLFp+fR7vsivqwEx4QJRvNkBNARQs=; b=elwSeoV8Raqd/+TiBh2EzbXYxHskN3+0KOuY5ONgWSzzIfdVjxv3Z0wv3joWJlL+dM 4NDC8n/frb4sawXpP64GPkHL3AP/5Bq9besfdT4b/xrSto2rAz3YEKoVH9xotDOQdZhi NNngCmUN0iUQP7kUsSebdRpXJFl0unJr1J81I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890624; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CcLaWTonsevpz7hLFp+fR7vsivqwEx4QJRvNkBNARQs=; b=HBPFU7ZVfRVGIpc6VHJGufjslIEaHo2btDLPCKreYk4qWj5gn+o7B65bAnj7JFkmUG KYLJ+GhX5LH5IeIRDgwyeRlCkW3cYcrR4Sr4jvc4sqR4NCORUv52ma+hbav+spM6JD8O WtlcypiI2604EbHq791h1kjLBhEcTSXUszfLL4GMbd36nBPRkJEl94CZhJDRnfGA1rnT ps1opad2U78VpHa22ATk3L9LThuVG/U7BRbLb2ePhlOA6Zm5vnePMs8hV5XuG7iVY5Vj ac2+N6WtNFyQuMcnrZAC1zWFNQqUK5XubFZkTB9Jqt3ug9VUPXMSo2G8XciKe8RoGB3K xjIg== X-Gm-Message-State: AAQBX9canniY1WcETrgl2S6mjX7Xxs9ySHV7YirDlDIq7pPYk54Ly07/ LVnc3OwPOS9WHsPx+zjWpmtZNsZFrLKY6462veY= X-Google-Smtp-Source: AKy350YgD/FM1t4g1u7thrgTiURCuLuhB5PQIdWbjlNU6vCkR3yNKkl0Ba3q9nxOp4woJ4gkDOVANg== X-Received: by 2002:a17:902:f08c:b0:1a1:a8eb:d33e with SMTP id p12-20020a170902f08c00b001a1a8ebd33emr8326360pla.8.1679890623985; Sun, 26 Mar 2023 21:17:03 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:17:03 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 15/16] coreboot: Enable ms command Date: Mon, 27 Mar 2023 17:15:49 +1300 Message-Id: <20230327171546.v3.15.I624d98d9258a1da9bffefab2fb3fe9ed0f3399da@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 This is useful when looking for tables in memory. Enable it for coreboot. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v2) Changes in v2: - Add new patch to enable ms command configs/coreboot_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 8bb744e6e84d..cf0c9590e98d 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -24,6 +24,7 @@ CONFIG_LAST_STAGE_INIT=y CONFIG_PCI_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PBSIZE=532 +CONFIG_CMD_MEM_SEARCH=y CONFIG_CMD_IDE=y CONFIG_CMD_MMC=y CONFIG_CMD_PART=y From patchwork Mon Mar 27 04:15:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1761358 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=OSqqYzkW; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PlKN33ZHfz1yXq for ; Mon, 27 Mar 2023 15:19:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A044286098; Mon, 27 Mar 2023 06:17:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OSqqYzkW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1545985CF7; Mon, 27 Mar 2023 06:17:16 +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,DKIMWL_WL_HIGH, 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-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) (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 129BA8606B for ; Mon, 27 Mar 2023 06:17:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x102c.google.com with SMTP id e15-20020a17090ac20f00b0023d1b009f52so10534790pjt.2 for ; Sun, 26 Mar 2023 21:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679890627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ja6iVeV1Kyt+scC0dd+tBFMHz/1xIq55pa+ncgVGEz4=; b=OSqqYzkWeMDvJliEMx3b27hgyJtESuQGYfAYj3gzrnwGbdPetgnHjQGA1sxBP5J4bx XbLH74mEfi8ThUc7GqU5Facat+8RwGdPEXTuJ6VRCIRwuq4ErnrXAJrIHk1qXuCp6aQD BZXT+3j0OvupdKsyml9ZmF+uS+YL41Q40pEM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679890627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ja6iVeV1Kyt+scC0dd+tBFMHz/1xIq55pa+ncgVGEz4=; b=FZs2ZL6sEMKSLYqZh1nNaLlVEBzbfe+XlHim4smY+ANjEkuPGSJxHdGNCLNY6Vou9s BcUbaIeBZI1rsZH3CXoQ7/OBLMBYa+p5yHiU3brQ5qPkAQ/hELZB740uea3uWr4seBtg ehkUKrQd7gGvrK9Bg7HBXG6F5ydtAhTh2O7JUR7Yd8q1d7Xsbma4dr+A75g15UJMZER4 goZq+fUMAvbkGittqgXzwrIUrUW/UOPxU0CvLxNHCixZz8IK3JzeOR1JqN5Yk/gKCg2g dP7nXlq9hXMamkv9NhtG948Tjg543Xi0jv1exJq0RTiGi4aGclj1MPfc7XHUz0oJmb5c 7Zsg== X-Gm-Message-State: AAQBX9fA3BWtMklUxDO2UyKn2oQyeoWa528Z6DuSIskqn7ufH456sPjW NtJ+4E6h85dBeQyPFdh8l9mHkECKVLp9rea3lJk= X-Google-Smtp-Source: AKy350Z5fiOouXl2jeh20LDKjtOt6mRcIxqLxT9QfQgt7VUOAt2I2OmLRkD3ihq2PD8wsDnFyX00Xw== X-Received: by 2002:a17:903:52:b0:19d:1c6e:d31e with SMTP id l18-20020a170903005200b0019d1c6ed31emr9047166pla.60.1679890627075; Sun, 26 Mar 2023 21:17:07 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b001a064282ce5sm17992077plb.294.2023.03.26.21.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 21:17:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH v3 16/16] x86: Allow locating UARTs by device ID Date: Mon, 27 Mar 2023 17:15:50 +1300 Message-Id: <20230327171546.v3.16.I00095fb6a52abfda4447281cc13a5c5b76902dda@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230327041551.1757316-1-sjg@chromium.org> References: <20230327041551.1757316-1-sjg@chromium.org> MIME-Version: 1.0 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 coreboot does not pass a UART in its sysinfo struct, there is no easy way to find it out. Add a way to specify known UARTs so we can find them without needing help from coreboot. Since coreboot does not actually init the serial device when serial is disabled, it is not possible to make it add this information to the sysinfo table. Also, we cannot use the class information, since we don't know which UART is being used. For example, with Alder Lake there are two: 00.16.00 0x8086 0x51e0 Simple comm. controller 0x80 00.1e.00 0x8086 0x51a8 Simple comm. controller 0x80 In our case the second one is the right one, but thre is no way to distinguish it from the first one without using the device ID. If we have Adler Lake hardware which uses a different UART, we could perhaps look at the ACPI tables, or the machine information passed in the SMBIOS tables. This was discussed previously before: [1] [1] https://patchwork.ozlabs.org/project/uboot/patch/20210407163159.3.I967ea8c85e009f870c7aa944372d32c990f1b14a@changeid/ Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Move this patch to last in the series, so it can be dropped if needed arch/x86/dts/coreboot.dts | 4 ++++ drivers/serial/serial_coreboot.c | 41 ++++++++++++++++++++++++++++++++ include/pci_ids.h | 3 +++ 3 files changed, 48 insertions(+) diff --git a/arch/x86/dts/coreboot.dts b/arch/x86/dts/coreboot.dts index f9ff5346a79b..1abd3fddd15c 100644 --- a/arch/x86/dts/coreboot.dts +++ b/arch/x86/dts/coreboot.dts @@ -14,6 +14,8 @@ /include/ "rtc.dtsi" #include "tsc_timer.dtsi" +#include +#include / { model = "coreboot x86 payload"; @@ -34,6 +36,8 @@ pci { compatible = "pci-x86"; bootph-all; + u-boot,pci-pre-reloc = < + PCI_VENDEV(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ADP_P_UART0) >; }; serial: serial { diff --git a/drivers/serial/serial_coreboot.c b/drivers/serial/serial_coreboot.c index 23066e4d0543..bb3a5362dfaf 100644 --- a/drivers/serial/serial_coreboot.c +++ b/drivers/serial/serial_coreboot.c @@ -17,6 +17,12 @@ DECLARE_GLOBAL_DATA_PTR; +static const struct pci_device_id ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL_UART2) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ADP_P_UART0) }, + {}, +}; + static int read_dbg2(struct ns16550_plat *plat) { struct acpi_table_header *tab; @@ -94,6 +100,39 @@ static int read_dbg2(struct ns16550_plat *plat) return 0; } +/* + * Coreboot only sets up the UART if it uses it and doesn't bother to put the + * details in sysinfo if it doesn't. Try to guess in that case, using devices + * we know about + * + * @plat: Platform data to fill in + * @return 0 if found, -ve if no UART was found + */ +static int guess_uart(struct ns16550_plat *plat) +{ + struct udevice *bus, *dev; + ulong addr; + int index; + int ret; + + ret = uclass_first_device_err(UCLASS_PCI, &bus); + if (ret) + return ret; + index = 0; + ret = pci_bus_find_devices(bus, ids, &index, &dev); + if (ret) + return ret; + addr = dm_pci_read_bar32(dev, 0); + plat->base = addr; + plat->reg_shift = 2; + plat->reg_width = 4; + plat->clock = 1843200; + plat->fcr = UART_FCR_DEFVAL; + plat->flags = 0; + + return 0; +} + static int coreboot_of_to_plat(struct udevice *dev) { struct ns16550_plat *plat = dev_get_plat(dev); @@ -113,6 +152,8 @@ static int coreboot_of_to_plat(struct udevice *dev) } else if (IS_ENABLED(CONFIG_COREBOOT_SERIAL_FROM_DBG2)) { ret = read_dbg2(plat); } + if (ret && CONFIG_IS_ENABLED(PCI)) + ret = guess_uart(plat); if (ret) { /* diff --git a/include/pci_ids.h b/include/pci_ids.h index 88b0a6404585..5ae1b9b7fb6e 100644 --- a/include/pci_ids.h +++ b/include/pci_ids.h @@ -2992,6 +2992,9 @@ #define PCI_DEVICE_ID_INTEL_UNC_R3QPI1 0x3c45 #define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0 #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f +#define PCI_DEVICE_ID_INTEL_ADP_P_UART0 0x51a8 +#define PCI_DEVICE_ID_INTEL_ADP_P_UART1 0x51a9 +#define PCI_DEVICE_ID_INTEL_APL_UART2 0x5ac0 #define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 #define PCI_DEVICE_ID_INTEL_5100_19 0x65f3 #define PCI_DEVICE_ID_INTEL_5100_21 0x65f5