svn commit: r345777 - head/sys/dev/pci

Tycho Nightingale tychon at FreeBSD.org
Tue Sep 3 14:06:08 UTC 2019


Author: tychon
Date: Mon Apr  1 19:08:05 2019
New Revision: 345777
URL: https://svnweb.freebsd.org/changeset/base/345777

Log:
  Devices behind downstream bridges should still get DMAR protection.
  
  Reviewed by:	kib
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D19717

Modified:
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Mon Apr  1 18:54:15 2019	(r345776)
+++ head/sys/dev/pci/pci.c	Mon Apr  1 19:08:05 2019	(r345777)
@@ -31,6 +31,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_acpi.h"
 #include "opt_bus.h"
 
 #include <sys/param.h>
@@ -5693,13 +5694,34 @@ pci_get_resource_list (device_t dev, device_t child)
 	return (&dinfo->resources);
 }
 
+#ifdef ACPI_DMAR
+bus_dma_tag_t dmar_get_dma_tag(device_t dev, device_t child);
 bus_dma_tag_t
 pci_get_dma_tag(device_t bus, device_t dev)
 {
+	bus_dma_tag_t tag;
+	struct pci_softc *sc;
+
+	if (device_get_parent(dev) == bus) {
+		/* try dmar and return if it works */
+		tag = dmar_get_dma_tag(bus, dev);
+	} else
+		tag = NULL;
+	if (tag == NULL) {
+		sc = device_get_softc(bus);
+		tag = sc->sc_dma_tag;
+	}
+	return (tag);
+}
+#else
+bus_dma_tag_t
+pci_get_dma_tag(device_t bus, device_t dev)
+{
 	struct pci_softc *sc = device_get_softc(bus);
 
 	return (sc->sc_dma_tag);
 }
+#endif
 
 uint32_t
 pci_read_config_method(device_t dev, device_t child, int reg, int width)




More information about the svn-src-head mailing list