From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by mx.groups.io with SMTP id smtpd.web12.746.1615573923143092106 for ; Fri, 12 Mar 2021 10:32:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@measite-de.20150623.gappssmtp.com header.s=20150623 header.b=Q3fk4cpU; spf=none, err=permanent DNS error (domain: measite.de, ip: 209.85.208.48, mailfrom: treffer@measite.de) Received: by mail-ed1-f48.google.com with SMTP id bx7so9310590edb.12 for ; Fri, 12 Mar 2021 10:32:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=measite-de.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=rjcZnW913GpH05Ag/eHwcdzbHjauFZexpduxnAT/ei8=; b=Q3fk4cpUzfX9AENbjKxV57jYuTVivpe0J9dm2W852voAUupOlePvLWvLL7CvtS+KOX eLrilT9/J0E3ZG6OPfKGp13bBLSImpFLNM16XTC3hf6k0dhys9eavvdQf/7Dcs6RkK5v qFRvycP2Vre8+r79wn12oe3DQmMrH8At28sS4qyh8gFEL+KSbLbk0KvJjLuD/fJ9hthf g3XQS0ITWVm5ARA7JQzjr4SBcWSK58v1CpurTodUQWv2qP03O8LxYErNStD3RdvUAIHz odBIixHtg4C4GWmXTvDIEE7ZELCwXVaPvhCgf3q2U7b9XAKZUyAqEaxrJatXNv/VE9ze 9Ayg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=rjcZnW913GpH05Ag/eHwcdzbHjauFZexpduxnAT/ei8=; b=lpdze9ijdbCXiMPgVvZwKcw4FVYDvEfLUat3TCwW/ITaQKhqAym6lzDc62yBE9BAnh IfBp4ZxS7NGZTxTzrV0u0N0sfDkQapmX/0cCa1aKx8zO4cWm7wQiAJ+DfiC18IL4lC96 BavREFdIozt6wFR9V5rshOMSMfqYayGtkpi0iBuv+t/O4u/pvaz2fOekhv9ArBvyIuAM aBP1wGI2+6m2LXSyptN+VfxchH9RgH9MM7IXWM7ilrLZyfDtGOeh6JwVlhGavdTyp18P R98f0PQ+/dza5e7SoBfF/F1XRhAYqcndoYWWuTUyBLFWFPW6yUHw4uDUCHBL7JrAj3sT ievA== X-Gm-Message-State: AOAM532k3mUe7JY+uF1hoWCxxLqaqmIevm4OjM8M2es1A8UKI/QfjbiL Y8QIjo1uhbL+3MXXCiLecj7+kA== X-Google-Smtp-Source: ABdhPJxSrv/af2+xhh6neFQpnzDXP7DWL9BcNOa0huTfVl/WPw6puGLaDYMkIaZHpL37mo+2GxmBig== X-Received: by 2002:a05:6402:104c:: with SMTP id e12mr15384612edu.108.1615573921620; Fri, 12 Mar 2021 10:32:01 -0800 (PST) Return-Path: Received: from [192.168.2.198] (p54ac52d9.dip0.t-ipconnect.de. [84.172.82.217]) by smtp.gmail.com with ESMTPSA id a22sm3228810ejr.89.2021.03.12.10.32.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Mar 2021 10:32:01 -0800 (PST) Subject: [edk2-platforms][PATCH 1/1] Silicon/Broadcom/Bcm27xx: Allow more than one device on pcie busses >1 To: devel@edk2.groups.io Cc: Pete Batard , Leif Lindholm , Ard Biesheuvel , "Andrei Warkentin (awarkentin@vmware.com)" , Jeremy Linton , Samer El-Haj-Mahmoud References: From: =?UTF-8?Q?Ren=c3=a9_Treffer?= Message-ID: Date: Fri, 12 Mar 2021 19:32:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US There is only a single pcie port on the bcm2711 so limiting the number of devices to 1 worked as long as there is no way to add a pcie switch. On the compute module 4 it is possible to add a pcie switch (tested with asm1184e) which adds 5 new pcie busses. In the current state the pci enumeration fails for the pcie switch internal bus (bus 2, device 1,3,5,7). The root port gets configured with subordniate=0x2, blocking e.g. a booting linux from discovering devices behind the switch. Devices behind the switch work after lifting the device limit on busses other than 0 and 1. Signed-off-by: René Treffer ---  .../Library/Bcm2711PciSegmentLib/PciSegmentLib.c   | 14 +++++++-------  1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c index 44ce3b4b99..4af9374d23 100644 --- a/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c +++ b/Silicon/Broadcom/Bcm27xx/Library/Bcm2711PciSegmentLib/PciSegmentLib.c @@ -78,6 +78,7 @@ PciSegmentLibGetConfigBase (    UINT64        Base;    UINT64        Offset;    UINT32        Dev; +  UINT32        Bus;      Base = PCIE_REG_BASE;    Offset = Address & 0xFFF;         /* Pick off the 4k register offset */ @@ -89,17 +90,16 @@ PciSegmentLibGetConfigBase (      Base += PCIE_EXT_CFG_DATA;      if (mPciSegmentLastAccess != Address) {        Dev = EFI_PCI_ADDR_DEV (Address); +      Bus = EFI_PCI_ADDR_BUS (Address);        /* -       * Scan things out directly rather than translating the "bus" to a device, etc.. -       * only we need to limit each bus to a single device. +       * There can only be a single device on bus 1 (downstream of root). +       * Subsequent busses (behind a PCIe switch) could have more.         */ -      if (Dev < 1) { -          MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address); -          mPciSegmentLastAccess = Address; -      } else { -          mPciSegmentLastAccess = 0; +      if (Dev > 0 && (Bus == 1 || Bus == 0)) {            return 0xFFFFFFFF;        } +      MmioWrite32 (PCIE_REG_BASE + PCIE_EXT_CFG_INDEX, Address); +      mPciSegmentLastAccess = Address;      }    }    return Base + Offset; -- 2.27.0