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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DCA0FC433F5 for ; Thu, 25 Nov 2021 10:33:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB62E8306F; Thu, 25 Nov 2021 11:33:19 +0100 (CET) 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="DDS8tQGR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3AEF482F89; Thu, 25 Nov 2021 11:33:17 +0100 (CET) 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 52B478306F for ; Thu, 25 Nov 2021 11:33:13 +0100 (CET) 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 0B47461052; Thu, 25 Nov 2021 10:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637836391; bh=CC8R1JQTC0tUPF8p9M4leG0HnFc0L0PnnqI1zhxKcEM=; h=From:To:Cc:Subject:Date:From; b=DDS8tQGRL7N4De6zCz3LEO+weRNyXBnerQc2ClJMw4Gf4n62cjyw9JYbAKxGML+4p wbigNWg47mYbkLnIHW49QQSEWG4sbByTTgluVzRTPHCiDTMfW9G++lADUdAVDUM29R rPgLTeCvXiAYYoUpwuP8cOeL4SNL9lER3PhF9mmS4GSPBMhJNAvqCegBKfxU2EZZX6 wrXloBl4M74eQTwiWXfADlYm57B0fIJ7bTHNuwGEMfakT0RC/a/H6LxYN2L1fWvifF hOh9x+FJ6wyyoVvDyHfQXGrpTQHSFe+a/ArVTg4cYOE2/mSXdCuSMBpHi29joy5z5N zObkEotIcRMpw== Received: by pali.im (Postfix) id 6721E67E; Thu, 25 Nov 2021 11:33:08 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese , Simon Glass , Bin Meng Cc: u-boot@lists.denx.de Subject: [PATCH] pci: Disable I/O forwarding during autoconfiguration if unsupported Date: Thu, 25 Nov 2021 11:32:43 +0100 Message-Id: <20211125103243.23826-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 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.37 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 If U-Boot does not have any I/O resource for assignment then disable I/O forwarding in PCI bridge autoconfiguration code. Default initial state of PCI bridge IO registers is unspecified, therefore they can be in enabled if U-Boot does not touch them. Signed-off-by: Pali Rohár --- drivers/pci/pci_auto.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 7e6ee54be087..6e5ed194f247 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -265,6 +265,14 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) (pci_io->bus_lower & 0xffff0000) >> 16); cmdstat |= PCI_COMMAND_IO; + } else { + /* Disable I/O if unsupported */ + dm_pci_write_config8(dev, PCI_IO_BASE, 0xf0 | io_32); + dm_pci_write_config8(dev, PCI_IO_LIMIT, 0x0 | io_32); + if (io_32 == PCI_IO_RANGE_TYPE_32) { + dm_pci_write_config16(dev, PCI_IO_BASE_UPPER16, 0x0); + dm_pci_write_config16(dev, PCI_IO_LIMIT_UPPER16, 0x0); + } } /* Enable memory and I/O accesses, enable bus master */ -- 2.20.1