From patchwork Tue Sep 22 18:45:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1369227 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=litZW5kb; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BwrCY2ldDz9sTS for ; Wed, 23 Sep 2020 04:57:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 05C3F826D8; Tue, 22 Sep 2020 20:49:28 +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="litZW5kb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 14B95823F9; Tue, 22 Sep 2020 20:47: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=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) (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 E611F823E6 for ; Tue, 22 Sep 2020 20:47: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=sjg@chromium.org Received: by mail-ot1-x342.google.com with SMTP id u25so16600589otq.6 for ; Tue, 22 Sep 2020 11:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rXxkFGxlwYeGiwCRVcIgXmXXyMztC8CgusmX79bYYfw=; b=litZW5kbkXsS4ZiZZFqEL4La23aVzzfNJKt3dV95aE97CsZN8hj+iywkSjsmTi7hrB LTe52SbLrybjFQTEv3L+ZC50wBWuY54lSEeSaW6vQBuc1GZ+DU4zDm8/aAx/t1GTQrZp uwLybtID5AFaAan9KHORgsFs/w6SEjgY4GSVE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rXxkFGxlwYeGiwCRVcIgXmXXyMztC8CgusmX79bYYfw=; b=kQ05E5X7lsTsg0RHSsvjOH7NMkbCq9yZvO3NDC/4t1dUbJgHMAO8Um0ek0NUpByMlB s83VkhyGCSnCGRWJZZ9pUK6SHd+ALO7G0FVhxaA94qn+7ZznEkA4aIMlT9FvgJg2TaYV prrWJp+CV8zqJ5Pdi08w6T8mAHeUHFoEF0xYJQaxCQUBclEwJYC/vw+nTTsRacDVqdFc oVMrPLPYnpZrgWh9z/ygDm/6hymL80HEgXsaNvn/2UZN608BoSJXmKZHeEDGYfW9Zafq GFOfEsbEp1azjdZDnHpp+1QjDKve/qL9mqLPuuYOFlq9MOUBUHga2wqQhFSfQbYxruX6 W/Jg== X-Gm-Message-State: AOAM5301rE9yJr6/jnHpIA319rrY8Ryr0BF3DnhFjdbwjM1dSseb8L4k LfnCy9bNZHz7kmRIjDFySKXeLUyxNKhAx910 X-Google-Smtp-Source: ABdhPJxlJj1W7oS6dCp5jIlnC+P8KJWrjD5gW1kiGCNxukByjbsDM4xfMWlQO9eT9bANgS5peu47QQ== X-Received: by 2002:a9d:6193:: with SMTP id g19mr3653144otk.108.1600800436226; Tue, 22 Sep 2020 11:47:16 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id q24sm7622663oij.19.2020.09.22.11.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 11:47:15 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Wolfgang Wallner , Bin Meng , Bernhard Messerklinger , Simon Glass Subject: [PATCH v4 53/59] x86: fsp: Show FSP-S or FSP-M address in fsp_get_header() Date: Tue, 22 Sep 2020 12:45:38 -0600 Message-Id: <20200922184544.2920969-24-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200922184544.2920969-1-sjg@chromium.org> References: <20200922184544.2920969-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present this function only supports FSP-M but it is also used to read FSP-S, in which case FSP-M may be zero. Add support for showing whichever address is present in the FSP binary. Also change the debug() statements to log_debug() while here. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v1) arch/x86/lib/fsp2/fsp_support.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/arch/x86/lib/fsp2/fsp_support.c b/arch/x86/lib/fsp2/fsp_support.c index 3f2ca840dc9..f220ef498b0 100644 --- a/arch/x86/lib/fsp2/fsp_support.c +++ b/arch/x86/lib/fsp2/fsp_support.c @@ -35,7 +35,8 @@ int fsp_get_header(ulong offset, ulong size, bool use_spi_flash, * * You are in a maze of twisty little headers all alike. */ - debug("offset=%x buf=%x\n", (uint)offset, (uint)buf); + log_debug("offset=%x buf=%x, use_spi_flash=%d\n", (uint)offset, + (uint)buf, use_spi_flash); if (use_spi_flash) { ret = uclass_first_device_err(UCLASS_SPI_FLASH, &dev); if (ret) @@ -52,16 +53,16 @@ int fsp_get_header(ulong offset, ulong size, bool use_spi_flash, fv = ptr; /* Check the FV signature, _FVH */ - debug("offset=%x sign=%x\n", (uint)offset, (uint)fv->sign); + log_debug("offset=%x sign=%x\n", (uint)offset, (uint)fv->sign); if (fv->sign != EFI_FVH_SIGNATURE) return log_msg_ret("Base FV signature", -EINVAL); /* Go to the end of the FV header and align the address */ - debug("fv->ext_hdr_off = %x\n", fv->ext_hdr_off); + log_debug("fv->ext_hdr_off = %x\n", fv->ext_hdr_off); ptr += fv->ext_hdr_off; exhdr = ptr; ptr += ALIGN(exhdr->ext_hdr_size, 8); - debug("ptr=%x\n", ptr - (void *)buf); + log_debug("ptr=%x\n", ptr - (void *)buf); /* Check the FFS GUID */ file_hdr = ptr; @@ -71,7 +72,7 @@ int fsp_get_header(ulong offset, ulong size, bool use_spi_flash, ptr = file_hdr + 1; raw = ptr; - debug("raw->type = %x\n", raw->type); + log_debug("raw->type = %x\n", raw->type); if (raw->type != EFI_SECTION_RAW) return log_msg_ret("Section type not RAW", -ENOEXEC); @@ -80,13 +81,18 @@ int fsp_get_header(ulong offset, ulong size, bool use_spi_flash, fsp = ptr; /* Check the FSPH header */ - debug("fsp %x\n", (uint)fsp); + log_debug("fsp %x, fsp-buf=%x, si=%x\n", (uint)fsp, ptr - (void *)buf, + (void *)&fsp->fsp_silicon_init - (void *)buf); if (fsp->sign != EFI_FSPH_SIGNATURE) return log_msg_ret("Base FSPH signature", -EACCES); base = (void *)fsp->img_base; - debug("Image base %x\n", (uint)base); - debug("Image addr %x\n", (uint)fsp->fsp_mem_init); + log_debug("image base %x\n", (uint)base); + if (fsp->fsp_mem_init) + log_debug("mem_init offset %x\n", (uint)fsp->fsp_mem_init); + else if (fsp->fsp_silicon_init) + log_debug("silicon_init offset %x\n", + (uint)fsp->fsp_silicon_init); if (use_spi_flash) { ret = spi_flash_read_dm(dev, offset, size, base); if (ret)