From owner-svn-src-head@freebsd.org Fri Jul 17 14:51:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75E9F3671D2; Fri, 17 Jul 2020 14:51:52 +0000 (UTC) (envelope-from br@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B7Yx42Gj9z491Z; Fri, 17 Jul 2020 14:51:52 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 326811AF49; Fri, 17 Jul 2020 14:51:52 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06HEpqj3059857; Fri, 17 Jul 2020 14:51:52 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06HEppHc059792; Fri, 17 Jul 2020 14:51:51 GMT (envelope-from br@FreeBSD.org) Message-Id: <202007171451.06HEppHc059792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 17 Jul 2020 14:51:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363274 - in head/sys: arm64/acpica dev/acpica X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm64/acpica dev/acpica X-SVN-Commit-Revision: 363274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2020 14:51:52 -0000 Author: br Date: Fri Jul 17 14:51:51 2020 New Revision: 363274 URL: https://svnweb.freebsd.org/changeset/base/363274 Log: Add acpi_iort_map_pci_smmuv3(). This new function allows us to find the SMMU instance assigned for a particular PCI RID. Reviewed by: andrew Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D25687 Modified: head/sys/arm64/acpica/acpi_iort.c head/sys/dev/acpica/acpivar.h Modified: head/sys/arm64/acpica/acpi_iort.c ============================================================================== --- head/sys/arm64/acpica/acpi_iort.c Fri Jul 17 14:45:16 2020 (r363273) +++ head/sys/arm64/acpica/acpi_iort.c Fri Jul 17 14:51:51 2020 (r363274) @@ -160,7 +160,7 @@ iort_entry_lookup(struct iort_node *node, u_int id, u_ if (i == node->nentries) return (NULL); if ((entry->flags & ACPI_IORT_ID_SINGLE_MAPPING) == 0) - *outid = entry->outbase + (id - entry->base); + *outid = entry->outbase + (id - entry->base); else *outid = entry->outbase; return (entry->out_node); @@ -562,5 +562,24 @@ acpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xre /* return first node, we don't handle more than that now. */ *xref = node->entries.its[0].xref; + return (0); +} + +int +acpi_iort_map_pci_smmuv3(u_int seg, u_int rid, u_int *xref, u_int *sid) +{ + ACPI_IORT_SMMU_V3 *smmu; + struct iort_node *node; + + node = iort_pci_rc_map(seg, rid, ACPI_IORT_NODE_SMMU_V3, sid); + if (node == NULL) + return (ENOENT); + + /* This should be an SMMU node. */ + KASSERT(node->type == ACPI_IORT_NODE_SMMU_V3, ("bad node")); + + smmu = (ACPI_IORT_SMMU_V3 *)&node->data.smmu_v3; + *xref = smmu->BaseAddress; + return (0); } Modified: head/sys/dev/acpica/acpivar.h ============================================================================== --- head/sys/dev/acpica/acpivar.h Fri Jul 17 14:45:16 2020 (r363273) +++ head/sys/dev/acpica/acpivar.h Fri Jul 17 14:51:51 2020 (r363274) @@ -556,6 +556,7 @@ int acpi_get_domain(device_t dev, device_t child, int * ARM specific ACPI interfaces, relating to IORT table. */ int acpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xref, u_int *devid); +int acpi_iort_map_pci_smmuv3(u_int seg, u_int rid, u_int *xref, u_int *devid); int acpi_iort_its_lookup(u_int its_id, u_int *xref, int *pxm); #endif #endif /* _KERNEL */