From nobody Wed Jan 18 09:39:51 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nxghl72zhz2sjCj; Wed, 18 Jan 2023 09:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nxghl64Lxz40Zd; Wed, 18 Jan 2023 09:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674034791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fSDHDYE9QnSKsJGkhZ9BFaSn9WI4yr0+r7esrI75GIA=; b=NnxwlcCZFox3aUX0TsYF+EDIEoln8WDXC6HOUEigZhx92/l3jhqoi1QDbdzBWzhDrpyKY5 U+qqZYRxtMC443ywbiDHERU4lm2sDdJ8mpjSL5bMkvd97YRHqPcWLiiKM10S4RSt0BOkdD E7GJPy4ogjmUfxNPl1E4vJje4GB79KSIvQsyxH7BS/QnG+9H09ALNi+0EtnQTJ+W2c+9C2 NWwT1rwak18gfV6T05SLlqipgcXcROPGGxLsJcOwkdog9aEg4J95YMwY2PuuHrEDJPhCsb AIm2706TrJpWAGc6L6k7GJr8dy974NwcsO13jgZ/O6jBK3dosU9MO7Yv/QoboQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674034791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fSDHDYE9QnSKsJGkhZ9BFaSn9WI4yr0+r7esrI75GIA=; b=I7f3b00+0DvqIkVmJsJ6xVMk9Bxkzad5WBw2slalJ8u3mI7kQoZs3+G9UHQx73+8aSll42 /ohlDmXx7vgiEW74/kCP/z1MdVPIanwINTn9GdGVnmLvTYs7XCuXSYTkXOcY807viS2k1I Ju3U2F1R0QdGOxXH+kNiGJYaGIvNzeIb8uwPA5nY84nvJQvzlYfc4Smiadu0d5C+7ThkEK mkwJVBhvUYuSZ+7YL+mQutRnqJYe0lC02fgdv7tvR3WjsVGh6LlCYj+Xt5djlZ5k8GoMAH tJ8rAveX+fd7UA6rB3xiXM4XN4oxLYQc09dOoXW4Wl/nLVdcYByOvN3vRO0HLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674034791; a=rsa-sha256; cv=none; b=CKOFLa4/hl1GlmTP1q5o9IRIrZHejYwoeKnqjAvhjffx83b6vnGrhZPuBtirRF/RZhv1bF ygfj49HvVnkXk01aw/XedcVmEkvw1i1n9jfJrxaQGONDCfMHGUgl6vL6a+VMBoBL4y30b1 XV26rmCxY8ZNPPfCgW8BEwuurcmXnA/rjSOU5idu705M214kX4fbo4+2Pz39Ihwfbwg2QW ay4gp/PZgVJ2Ea70bOeC7ZAOVDtLcr1OCN97ru/d1vXzp6kJA7ZprYXDQ3Et+JtAAy9DCV bQnZJVWr8Tfx+BGw/ksI9CVM7GLl5WLUxBHPnIwQJiKJPpaW5tIyUnFCCKkgTw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Nxghl5BLRz166N; Wed, 18 Jan 2023 09:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30I9dpYS053125; Wed, 18 Jan 2023 09:39:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30I9dpJ3053124; Wed, 18 Jan 2023 09:39:51 GMT (envelope-from git) Date: Wed, 18 Jan 2023 09:39:51 GMT Message-Id: <202301180939.30I9dpJ3053124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 896f556205c8 - main - Add the fixed memory type to the pci ecam driver List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 896f556205c8d87ef842dc844752daa7d2385336 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=896f556205c8d87ef842dc844752daa7d2385336 commit 896f556205c8d87ef842dc844752daa7d2385336 Author: Andrew Turner AuthorDate: 2023-01-18 09:30:46 +0000 Commit: Andrew Turner CommitDate: 2023-01-18 09:31:50 +0000 Add the fixed memory type to the pci ecam driver Add ACPI_RESOURCE_TYPE_FIXED_MEMORY32 to the PCI ECAM driver. This is used on the Microsoft Dev Kit 2023 and reportedly the Lenovo x13s. Reviewed by: Robert Clausecker (Earlier version) Tested by: Robert Clausecker (Earlier version) Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D38031 --- sys/dev/pci/pci_host_generic_acpi.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/pci_host_generic_acpi.c b/sys/dev/pci/pci_host_generic_acpi.c index 4a565c846339..8ef97a3ae1ae 100644 --- a/sys/dev/pci/pci_host_generic_acpi.c +++ b/sys/dev/pci/pci_host_generic_acpi.c @@ -142,25 +142,42 @@ pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *res, void *arg) device_t dev = (device_t)arg; struct generic_pcie_acpi_softc *sc; rman_res_t min, max, off; - int r; + int r, restype; sc = device_get_softc(dev); r = sc->base.nranges; switch (res->Type) { case ACPI_RESOURCE_TYPE_ADDRESS16: + restype = res->Data.Address16.ResourceType; min = res->Data.Address16.Address.Minimum; max = res->Data.Address16.Address.Maximum; break; case ACPI_RESOURCE_TYPE_ADDRESS32: + restype = res->Data.Address32.ResourceType; min = res->Data.Address32.Address.Minimum; max = res->Data.Address32.Address.Maximum; off = res->Data.Address32.Address.TranslationOffset; break; case ACPI_RESOURCE_TYPE_ADDRESS64: + restype = res->Data.Address64.ResourceType; min = res->Data.Address64.Address.Minimum; max = res->Data.Address64.Address.Maximum; off = res->Data.Address64.Address.TranslationOffset; break; + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: + /* + * The Microsoft Dev Kit 2023 uses a fixed memory region + * for some PCI controllers. For this memory the + * ResourceType is ACPI_IO_RANGE meaning we create an IO + * resource. As drivers expect it to be a memory resource + * force the type here. + */ + restype = ACPI_MEMORY_RANGE; + min = res->Data.FixedMemory32.Address; + max = res->Data.FixedMemory32.Address + + res->Data.FixedMemory32.AddressLength - 1; + off = 0; + break; default: return (AE_OK); } @@ -171,9 +188,9 @@ pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *res, void *arg) sc->base.ranges[r].pci_base = min; sc->base.ranges[r].phys_base = min + off; sc->base.ranges[r].size = max - min + 1; - if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE) + if (restype == ACPI_MEMORY_RANGE) sc->base.ranges[r].flags |= FLAG_TYPE_MEM; - else if (res->Data.Address.ResourceType == ACPI_IO_RANGE) + else if (restype == ACPI_IO_RANGE) sc->base.ranges[r].flags |= FLAG_TYPE_IO; sc->base.nranges++; } else if (res->Data.Address.ResourceType == ACPI_BUS_NUMBER_RANGE) {