Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Apr 2017 07:11:15 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r316392 - stable/11/sys/x86/iommu
Message-ID:  <201704020711.v327BFTh029000@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Apr  2 07:11:15 2017
New Revision: 316392
URL: https://svnweb.freebsd.org/changeset/base/316392

Log:
  MFC r315968:
  Provide less laborius way to enable busdma DMAR to only short list of devices.

Modified:
  stable/11/sys/x86/iommu/busdma_dmar.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/iommu/busdma_dmar.c
==============================================================================
--- stable/11/sys/x86/iommu/busdma_dmar.c	Sun Apr  2 03:08:25 2017	(r316391)
+++ stable/11/sys/x86/iommu/busdma_dmar.c	Sun Apr  2 07:11:15 2017	(r316392)
@@ -74,14 +74,34 @@ static bool
 dmar_bus_dma_is_dev_disabled(int domain, int bus, int slot, int func)
 {
 	char str[128], *env;
+	int default_bounce;
+	bool ret;
+	static const char bounce_str[] = "bounce";
+	static const char dmar_str[] = "dmar";
+
+	default_bounce = 0;
+	env = kern_getenv("hw.busdma.default");
+	if (env != NULL) {
+		if (strcmp(env, bounce_str) == 0)
+			default_bounce = 1;
+		else if (strcmp(env, dmar_str) == 0)
+			default_bounce = 0;
+		freeenv(env);
+	}
 
-	snprintf(str, sizeof(str), "hw.busdma.pci%d.%d.%d.%d.bounce",
+	snprintf(str, sizeof(str), "hw.busdma.pci%d.%d.%d.%d",
 	    domain, bus, slot, func);
 	env = kern_getenv(str);
 	if (env == NULL)
-		return (false);
+		return (default_bounce != 0);
+	if (strcmp(env, bounce_str) == 0)
+		ret = true;
+	else if (strcmp(env, dmar_str) == 0)
+		ret = false;
+	else
+		ret = default_bounce != 0;
 	freeenv(env);
-	return (true);
+	return (ret);
 }
 
 /*



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