Module Name: src
Committed By: skrll
Date: Fri Jun 26 08:42:01 UTC 2020
Modified Files:
src/sys/arch/arm/broadcom: bcm283x_platform.c
Log Message:
Avoid large stack usage with kmem_alloc - we're in device_register so
there is no problem doing this.
To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/broadcom/bcm283x_platform.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/broadcom/bcm283x_platform.c
diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.38 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.39
--- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.38 Sun Jun 21 07:17:25 2020
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c Fri Jun 26 08:42:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm283x_platform.c,v 1.38 2020/06/21 07:17:25 skrll Exp $ */
+/* $NetBSD: bcm283x_platform.c,v 1.39 2020/06/26 08:42:01 skrll Exp $ */
/*-
* Copyright (c) 2017 Jared D. McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.38 2020/06/21 07:17:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.39 2020/06/26 08:42:01 skrll Exp $");
#include "opt_arm_debug.h"
#include "opt_bcm283x.h"
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: bcm283x_plat
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/device.h>
+#include <sys/kmem.h>
#include <sys/termios.h>
#include <net/if_ether.h>
@@ -881,11 +882,12 @@ rpi_fb_parse_mode(const char *s, uint32_
return true;
}
+#define RPI_EDIDSIZE 1024
+
static bool
rpi_fb_get_edid_mode(uint32_t *pwidth, uint32_t *pheight)
{
struct edid_info ei;
- uint8_t edid_data[1024];
uint32_t res;
int error;
@@ -901,7 +903,9 @@ rpi_fb_get_edid_mode(uint32_t *pwidth, u
vb_edid.vbt_edid.status != 0)
return false;
- memset(edid_data, 0, sizeof(edid_data));
+ uint8_t *edid_data = kmem_alloc(RPI_EDIDSIZE, KM_SLEEP);
+
+ memset(edid_data, 0, RPI_EDIDSIZE);
memcpy(edid_data, vb_edid.vbt_edid.data,
sizeof(vb_edid.vbt_edid.data));
edid_parse(edid_data, &ei);
@@ -914,6 +918,8 @@ rpi_fb_get_edid_mode(uint32_t *pwidth, u
*pheight = ei.edid_preferred_mode->vdisplay;
}
+ kmem_free(edid_data, RPI_EDIDSIZE);
+
return true;
}