From 19800b49477abc7e4c7112b3baecafcf009ff243 Mon Sep 17 00:00:00 2001 From: patrick Date: Sun, 28 Feb 2021 21:06:58 +0000 Subject: [PATCH] Issue call to IOMMU OFW API to collect an IOMMU-sprinkled DMA tag. ok kettenis@ --- sys/arch/arm64/dev/pciecam.c | 9 ++++++++- sys/dev/fdt/dwpcie.c | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/arch/arm64/dev/pciecam.c b/sys/arch/arm64/dev/pciecam.c index 4acd26611c9..c5f03544cdd 100644 --- a/sys/arch/arm64/dev/pciecam.c +++ b/sys/arch/arm64/dev/pciecam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciecam.c,v 1.12 2021/02/25 23:07:48 patrick Exp $ */ +/* $OpenBSD: pciecam.c,v 1.13 2021/02/28 21:06:58 patrick Exp $ */ /* * Copyright (c) 2013,2017 Patrick Wildt * @@ -35,6 +35,7 @@ #include #include #include +#include /* Assembling ECAM Configuration Address */ #define PCIE_BUS_SHIFT 20 @@ -324,6 +325,12 @@ pciecam_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data) int pciecam_probe_device_hook(void *v, struct pci_attach_args *pa) { + struct pciecam_softc *sc = (struct pciecam_softc *)v; + uint16_t rid; + + rid = pci_requester_id(pa->pa_pc, pa->pa_tag); + pa->pa_dmat = iommu_device_map_pci(sc->sc_node, rid, pa->pa_dmat); + return 0; } diff --git a/sys/dev/fdt/dwpcie.c b/sys/dev/fdt/dwpcie.c index 70637fc9b4c..9da14732dbc 100644 --- a/sys/dev/fdt/dwpcie.c +++ b/sys/dev/fdt/dwpcie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwpcie.c,v 1.25 2021/02/25 23:07:49 patrick Exp $ */ +/* $OpenBSD: dwpcie.c,v 1.26 2021/02/28 21:06:58 patrick Exp $ */ /* * Copyright (c) 2018 Mark Kettenis * @@ -1135,6 +1135,12 @@ dwpcie_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data) int dwpcie_probe_device_hook(void *v, struct pci_attach_args *pa) { + struct dwpcie_softc *sc = v; + uint16_t rid; + + rid = pci_requester_id(pa->pa_pc, pa->pa_tag); + pa->pa_dmat = iommu_device_map_pci(sc->sc_node, rid, pa->pa_dmat); + return 0; } -- 2.20.1