From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web08.4397.1654159342484779390 for ; Thu, 02 Jun 2022 01:42:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HPLA+Cz1; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654159341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CMrCFU/zt/Nm9CTgcv45HDELFEE43dO1LYaxycoCIhw=; b=HPLA+Cz1BTeJuTOrV5FGVr0nopMDT+UpgiD2ciM7wVAUU5gS7sKqjNj9gYY70MvzQncp+C sSCa7mWasFWpaBVo77InF+LRDltgi2E1MEr6m+Vn14iFIWRIlB+ss4rZNdk603M5bvN8IW WOJ9E3G7Jfo6LoWRh5R3X5hLVEg35P8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-56-g4S2bb44PsqMx4JcDAjRLg-1; Thu, 02 Jun 2022 04:42:20 -0400 X-MC-Unique: g4S2bb44PsqMx4JcDAjRLg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 24720858F11; Thu, 2 Jun 2022 08:42:20 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6904140F06B; Thu, 2 Jun 2022 08:42:19 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6CC01180039D; Thu, 2 Jun 2022 10:42:16 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Hao A Wu , Pawel Polawski , Ard Biesheuvel , mateusz.albecki@intel.com, Abner Chang , Ray Ni , Leif Lindholm , Jiewen Yao , Oliver Steffen , Liming Gao , Gerd Hoffmann , Jian J Wang , Jordan Justen Subject: [PATCH v7 2/6] OvmfPkg/FdtPciHostBridgeLib: io range is not mandatory Date: Thu, 2 Jun 2022 10:42:12 +0200 Message-Id: <20220602084216.159028-3-kraxel@redhat.com> In-Reply-To: <20220602084216.159028-1-kraxel@redhat.com> References: <20220602084216.159028-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true io range is not mandatory according to pcie spec, so allow host bridges without io address space. Signed-off-by: Gerd Hoffmann --- .../FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c index 98828e0b262b..14b41a533e96 100644 --- a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c +++ b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c @@ -292,13 +292,8 @@ ProcessPciHost ( } } - if ((*IoSize == 0) || (*Mmio32Size == 0)) { - DEBUG (( - DEBUG_ERROR, - "%a: %a space empty\n", - __FUNCTION__, - (*IoSize == 0) ? "IO" : "MMIO32" - )); + if (*Mmio32Size == 0) { + DEBUG ((DEBUG_ERROR, "%a: MMIO32 space empty\n", __FUNCTION__)); return EFI_PROTOCOL_ERROR; } @@ -333,13 +328,15 @@ ProcessPciHost ( return Status; } - // - // Map the MMIO window that provides I/O access - the PCI host bridge code - // is not aware of this translation and so it will only map the I/O view - // in the GCD I/O map. - // - Status = MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize); - ASSERT_EFI_ERROR (Status); + if (*IoSize != 0) { + // + // Map the MMIO window that provides I/O access - the PCI host bridge code + // is not aware of this translation and so it will only map the I/O view + // in the GCD I/O map. + // + Status = MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize); + ASSERT_EFI_ERROR (Status); + } return Status; } @@ -413,17 +410,21 @@ PciHostBridgeGetRootBridges ( AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM; - Io.Base = IoBase; - Io.Limit = IoBase + IoSize - 1; + if (IoSize != 0) { + Io.Base = IoBase; + Io.Limit = IoBase + IoSize - 1; + } else { + Io.Base = MAX_UINT64; + Io.Limit = 0; + } + Mem.Base = Mmio32Base; Mem.Limit = Mmio32Base + Mmio32Size - 1; - if (sizeof (UINTN) == sizeof (UINT64)) { - MemAbove4G.Base = Mmio64Base; - MemAbove4G.Limit = Mmio64Base + Mmio64Size - 1; - if (Mmio64Size > 0) { - AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE; - } + if ((sizeof (UINTN) == sizeof (UINT64)) && (Mmio64Size != 0)) { + MemAbove4G.Base = Mmio64Base; + MemAbove4G.Limit = Mmio64Base + Mmio64Size - 1; + AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE; } else { // // UEFI mandates a 1:1 virtual-to-physical mapping, so on a 32-bit -- 2.36.1