Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/arch/arm/sunxi Pull up following revision(s) (request...
details: https://anonhg.NetBSD.org/src/rev/4ac07a2f2365
branches: netbsd-9
changeset: 466304:4ac07a2f2365
user: martin <martin%NetBSD.org@localhost>
date: Tue Dec 17 12:39:33 2019 +0000
description:
Pull up following revision(s) (requested by jmcneill in ticket #562):
sys/arch/arm/sunxi/sunxi_drm.c: revision 1.11
Make sure memory stolen from simplefb is page aligned.
diffstat:
sys/arch/arm/sunxi/sunxi_drm.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diffs (60 lines):
diff -r 6406e0027962 -r 4ac07a2f2365 sys/arch/arm/sunxi/sunxi_drm.c
--- a/sys/arch/arm/sunxi/sunxi_drm.c Tue Dec 17 12:38:16 2019 +0000
+++ b/sys/arch/arm/sunxi/sunxi_drm.c Tue Dec 17 12:39:33 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_drm.c,v 1.7.6.3 2019/12/17 12:35:12 martin Exp $ */
+/* $NetBSD: sunxi_drm.c,v 1.7.6.4 2019/12/17 12:39:33 martin Exp $ */
/*-
* Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_drm.c,v 1.7.6.3 2019/12/17 12:35:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_drm.c,v 1.7.6.4 2019/12/17 12:39:33 martin Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -53,6 +53,14 @@
#define SUNXI_DRM_MAX_WIDTH 3840
#define SUNXI_DRM_MAX_HEIGHT 2160
+/*
+ * The DRM headers break trunc_page/round_page macros with a redefinition
+ * of PAGE_MASK. Use our own macros instead.
+ */
+#define SUNXI_PAGE_MASK (PAGE_SIZE - 1)
+#define SUNXI_TRUNC_PAGE(x) ((x) & ~SUNXI_PAGE_MASK)
+#define SUNXI_ROUND_PAGE(x) (((x) + SUNXI_PAGE_MASK) & ~SUNXI_PAGE_MASK)
+
static TAILQ_HEAD(, sunxi_drm_endpoint) sunxi_drm_endpoints =
TAILQ_HEAD_INITIALIZER(sunxi_drm_endpoints);
@@ -299,7 +307,8 @@
sunxi_drm_simplefb_lookup(bus_addr_t *paddr, bus_size_t *psize)
{
static const char * compat[] = { "simple-framebuffer", NULL };
- int chosen, child;
+ int chosen, child, error;
+ bus_addr_t addr_end;
chosen = OF_finddevice("/chosen");
if (chosen == -1)
@@ -310,7 +319,15 @@
continue;
if (!of_match_compatible(child, compat))
continue;
- return fdtbus_get_reg(child, 0, paddr, psize);
+ error = fdtbus_get_reg(child, 0, paddr, psize);
+ if (error != 0)
+ return error;
+
+ /* Reclaim entire pages used by the simplefb */
+ addr_end = *paddr + *psize;
+ *paddr = SUNXI_TRUNC_PAGE(*paddr);
+ *psize = SUNXI_ROUND_PAGE(addr_end - *paddr);
+ return 0;
}
return ENOENT;
Home |
Main Index |
Thread Index |
Old Index