-/* $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 <patrick@blueri.se>
*
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_clock.h>
#include <dev/ofw/ofw_pinctrl.h>
+#include <dev/ofw/ofw_misc.h>
/* Assembling ECAM Configuration Address */
#define PCIE_BUS_SHIFT 20
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;
}
-/* $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 <kettenis@openbsd.org>
*
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;
}