From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5389CC433F5 for ; Thu, 7 Oct 2021 12:51:48 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7284E60FD9 for ; Thu, 7 Oct 2021 12:51:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7284E60FD9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 233DE834DB; Thu, 7 Oct 2021 14:51:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="ZGbQX0xJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3B425834CD; Thu, 7 Oct 2021 14:51:24 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B30ED834CF for ; Thu, 7 Oct 2021 14:51:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 3D559611AE; Thu, 7 Oct 2021 12:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633611074; bh=rl4kHcXbilTXowJ8jIb46w1hlhyGP3C5pyAAsnQUNgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZGbQX0xJ1mnBpuScXjki5D79EQXr22TBH8EMWx4GKkrIenEhOPqpitPbi7x0oRz1r ZTlzTM02M2NGNmglXUTjAip3WUYdiNWeJwYlgLu/9IkUMFm9bz2YXoXnZS6RDrd8e/ sPSW7A578oBuRSVR8p7F8peTz+a2VteXRJPcAKf9gyn6vktNWJe7Pr4DHtigp83qRG tuImCAImELqmuveBFcxjBjiMUln/9vZwe5a/BSmjoHPDmX1LMdjKWkii5w1TxhhIX3 q9lJqQFiNKARxWHQtX7l2ztuTDFxF5vSf7n/RSqSi/LUjTn7Q77Oz4Vf56DKGuVW+2 TGHER+tKHNrTg== Received: by pali.im (Postfix) id 6954D2820; Thu, 7 Oct 2021 14:51:12 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Vladimir Oltean , Bin Meng , Stefan Roese Cc: u-boot@lists.denx.de Subject: [PATCH 4/5] pci: Fix showing bars Date: Thu, 7 Oct 2021 14:51:00 +0200 Message-Id: <20211007125101.21811-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211007125101.21811-1-pali@kernel.org> References: <20211007125101.21811-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.103.2 at phobos.denx.de X-Virus-Status: Clean Header type is 7-bit number so properly clear upper 8th bit which indicates multifunction device. And do not try to show bars for unsupported header types. Signed-off-by: Pali Rohár --- cmd/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/pci.c b/cmd/pci.c index cfabdc0f3012..4a82854db7fa 100644 --- a/cmd/pci.c +++ b/cmd/pci.c @@ -71,10 +71,15 @@ static int pci_bar_show(struct udevice *dev) int prefetchable; dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type); + header_type &= 0x7f; if (header_type == PCI_HEADER_TYPE_CARDBUS) { printf("CardBus doesn't support BARs\n"); return -ENOSYS; + } else if (header_type != PCI_HEADER_TYPE_NORMAL && + header_type != PCI_HEADER_TYPE_BRIDGE) { + printf("unknown header type\n"); + return -ENOSYS; } bar_cnt = (header_type == PCI_HEADER_TYPE_NORMAL) ? 6 : 2; -- 2.20.1