From nobody Mon May 15 15:46:02 2023 X-Original-To: dev-commits-src-branches@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 4QKkHH0Q6cz4Blp9; Mon, 15 May 2023 15:46:03 +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 4QKkHG6wq7z3JSJ; Mon, 15 May 2023 15:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684165563; 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=smaGi5mvxr8jcFScXU2/WmZ9BLK6Zl+fYgakhNHCoHQ=; b=NZkZgAasI19blsi+DP3qDwQ2tlFlPMQXosTsGzvAoV5Nuqv6T8BRKMyMNxbuf+5ue49Tsl J2ELujruA/vC2Kt5zxzcp3yMLQJGrvqkw6DigXIv2bP09G0dUABVVXHNTM5n3o491gW6pD dskliOgUc9utKqN7izEULpPmvT/5uC0E4dB2xDkeuBv5nSI0KTf3J6LNcYBzkE0xj0KAdd 4JiuajPOi5glIHXGmsbjRmW2vp08SgL9fJF/WjZQvD07xEr3BueBI6fW8PXgVNIqVesF9M I2dsIM5t2bWWwwfWVWgReZcFvBTQVWSlrgiOx7vZFpQnz+8IdAmWYRu9gHAi+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684165563; 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=smaGi5mvxr8jcFScXU2/WmZ9BLK6Zl+fYgakhNHCoHQ=; b=SBa3+yFs7whnisc3sRgMdZfpVwjKazWIhqCaHl9UDrACnyhskJSV382AgQ7iUwBgSu8iEi jZdv1Y0nFV5+SwKD0UNnCBZu3sjiiSR5upm2+YcETeLNV2OFcUYp6sIdjOTQfgkYVZAYU3 pgn2twFnIxPOxvXOIkH5kANDR0U3i1g5HKC4W04hG0vv+16nLqUO8uAVF2N30qMjOxX8La ae8hQE71NRSkmXwS574Ty5kNqUa3CzCQiXBsT4hT0aAFGUuV8MYLMR4hfI30ffcLzhtx0R mttzw51/qaOV+I97phO8h64qMR2TqF1fCRnwv19vLuYpP0vOSpoFPuv72yCK3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684165563; a=rsa-sha256; cv=none; b=Ij9643WBRpw7p98HaBEODdNG69xDezw0cO9MZgrWHnmcM+qvYxCTr6ChgW1aCVmwPY2Zll PdXDhCT0QT/NoyWGyYQVCcblIMcbOtW2YVDKcj2KliINOIr18CJpJf4z+d6K7J68tJFQrs 72OlinMa5VXwHayw1I8NoHBu0d9Fj1/YBs62FiiqRoegNR2OVYs5hYVy4DPNPC5kCTogcR ikhWg2rdCeKKiew+nR+OYxe2iP9GGT767skfmN41Zo5o1bcdrnEdLdB4Mfp/l7UJDhVTAH bqXdgCeoMeRtMoNW0kpeBrK6jr3L+aJ95R1faW3edgKnJb8nKvII1WJcUmhEXA== 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 4QKkHG61HdzmJ8; Mon, 15 May 2023 15:46:02 +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 34FFk2rU073513; Mon, 15 May 2023 15:46:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34FFk2JK073512; Mon, 15 May 2023 15:46:02 GMT (envelope-from git) Date: Mon, 15 May 2023 15:46:02 GMT Message-Id: <202305151546.34FFk2JK073512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 253e4c56c8a6 - stable/13 - Add the fixed memory type to the pci ecam driver List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 253e4c56c8a6d4cb0fff963d735852095580ee49 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=253e4c56c8a6d4cb0fff963d735852095580ee49 commit 253e4c56c8a6d4cb0fff963d735852095580ee49 Author: Andrew Turner AuthorDate: 2023-01-18 09:30:46 +0000 Commit: Andrew Turner CommitDate: 2023-05-15 10:55:19 +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 (cherry picked from commit 896f556205c8d87ef842dc844752daa7d2385336) --- 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 9628517813a9..074e81be9a88 100644 --- a/sys/dev/pci/pci_host_generic_acpi.c +++ b/sys/dev/pci/pci_host_generic_acpi.c @@ -143,26 +143,43 @@ pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *res, void *arg) struct generic_pcie_acpi_softc *sc; struct rman *rm; rman_res_t min, max, off; - int r; + int r, restype; rm = NULL; 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); } @@ -173,9 +190,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) {