Module Name:    src
Committed By:   jmcneill
Date:           Wed Jan 22 07:53:45 UTC 2020

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

Log Message:
Fix PHYS_TO_BUS_MEM and BUS_MEM_TO_PHYS on arm and aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
    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.18 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.19
--- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.18	Tue Nov  5 23:27:23 2019
+++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h	Wed Jan 22 07:53:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma_hacks.h,v 1.18 2019/11/05 23:27:23 jmcneill Exp $	*/
+/*	$NetBSD: bus_dma_hacks.h,v 1.19 2020/01/22 07:53:45 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@ PHYS_TO_BUS_MEM(bus_dma_tag_t dmat, padd
 		const struct arm32_dma_range *dr = &dmat->_ranges[i];
 
 		if (dr->dr_sysbase <= pa && pa - dr->dr_sysbase <= dr->dr_len)
-			return dr->dr_busbase + (dr->dr_sysbase - pa);
+			return pa - dr->dr_sysbase + dr->dr_busbase;
 	}
 	panic("paddr has no bus address in dma tag %p: %"PRIxPADDR, dmat, pa);
 }
@@ -74,7 +74,7 @@ BUS_MEM_TO_PHYS(bus_dma_tag_t dmat, bus_
 		const struct arm32_dma_range *dr = &dmat->_ranges[i];
 
 		if (dr->dr_busbase <= ba && ba - dr->dr_busbase <= dr->dr_len)
-			return dr->dr_sysbase + (dr->dr_busbase - ba);
+			return ba - dr->dr_busbase + dr->dr_sysbase;
 	}
 	panic("bus addr has no bus address in dma tag %p: %"PRIxPADDR, dmat,
 	    ba);

Reply via email to