Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Apr 2019 19:08:05 +0000 (UTC)
From:      Tycho Nightingale <tychon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345777 - head/sys/dev/pci
Message-ID:  <201904011908.x31J850N094861@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904011908.x31J850N094861>