diff options
author | kib <kib@FreeBSD.org> | 2017-04-02 07:11:15 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2017-04-02 07:11:15 +0000 |
commit | 1175886037d66118604f4430f50da9809c6f709e (patch) | |
tree | 6c37f5523b50e099ff91fa1506b54ebfa8ac0084 /sys | |
parent | 4c155c1e6323e7a54f3fd89e8c4f769de7a4b337 (diff) | |
download | FreeBSD-src-1175886037d66118604f4430f50da9809c6f709e.zip FreeBSD-src-1175886037d66118604f4430f50da9809c6f709e.tar.gz |
MFC r315968:
Provide less laborius way to enable busdma DMAR to only short list of devices.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/x86/iommu/busdma_dmar.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sys/x86/iommu/busdma_dmar.c b/sys/x86/iommu/busdma_dmar.c index 434ae82..73bf8b2 100644 --- a/sys/x86/iommu/busdma_dmar.c +++ b/sys/x86/iommu/busdma_dmar.c @@ -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); } /* |