Module Name:    src
Committed By:   jmcneill
Date:           Tue Nov  5 23:27:23 UTC 2019

Modified Files:
        src/sys/external/bsd/drm2/include/drm: bus_dma_hacks.h

Log Message:
Arm DMA tags with _nranges=0 require no address translation. Handle this
in PHYS_TO_BUS_MEM and BUS_TO_PHYS_MEM instead of panicing.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
    src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h
diff -u src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.17 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.18
--- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.17	Mon Aug 27 15:32:39 2018
+++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h	Tue Nov  5 23:27:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma_hacks.h,v 1.17 2018/08/27 15:32:39 riastradh Exp $	*/
+/*	$NetBSD: bus_dma_hacks.h,v 1.18 2019/11/05 23:27:23 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -51,6 +51,9 @@ PHYS_TO_BUS_MEM(bus_dma_tag_t dmat, padd
 {
 	unsigned i;
 
+	if (dmat->_nranges == 0)
+		return (bus_addr_t)pa;
+
 	for (i = 0; i < dmat->_nranges; i++) {
 		const struct arm32_dma_range *dr = &dmat->_ranges[i];
 
@@ -64,6 +67,9 @@ BUS_MEM_TO_PHYS(bus_dma_tag_t dmat, bus_
 {
 	unsigned i;
 
+	if (dmat->_nranges == 0)
+		return (paddr_t)ba;
+
 	for (i = 0; i < dmat->_nranges; i++) {
 		const struct arm32_dma_range *dr = &dmat->_ranges[i];
 

Reply via email to