From: Thierry Reding
Support multiple reserved memory regions per device to support platforms
that use both a framebuffer and color conversion lookup table for early
boot display splash.
While at it, also pass along the name, compatible strings and flags of
the carveouts.
Signed-off-by: Thierry Reding
---
board/nvidia/p2371-2180/p2371-2180.c | 55 +---
board/nvidia/p2771-/p2771-.c | 55 +---
board/nvidia/p3450-/p3450-.c | 55 +---
3 files changed, 126 insertions(+), 39 deletions(-)
diff --git a/board/nvidia/p2371-2180/p2371-2180.c
b/board/nvidia/p2371-2180/p2371-2180.c
index 137c7d3b12c3..f5126c552b00 100644
--- a/board/nvidia/p2371-2180/p2371-2180.c
+++ b/board/nvidia/p2371-2180/p2371-2180.c
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -125,24 +126,52 @@ static void ft_mac_address_setup(void *fdt)
static int ft_copy_carveout(void *dst, const void *src, const char *node)
{
- struct fdt_memory fb;
+ unsigned int index = 0;
int err;
- err = fdtdec_get_carveout(src, node, "memory-region", 0, , NULL,
- NULL, NULL, NULL);
- if (err < 0) {
- if (err != -FDT_ERR_NOTFOUND)
- printf("failed to get carveout for %s: %d\n", node,
+ while (true) {
+ const char **compatibles = NULL;
+ unsigned int num_compatibles;
+ struct fdt_memory carveout;
+ unsigned long flags;
+ char *copy = NULL;
+ const char *name;
+
+ err = fdtdec_get_carveout(src, node, "memory-region", index,
+ , , ,
+ _compatibles, );
+ if (err < 0) {
+ if (err != -FDT_ERR_NOTFOUND)
+ printf("failed to get carveout for %s: %d\n",
+ node, err);
+
+ return err;
+ }
+
+ if (name) {
+ const char *ptr = strchr(name, '@');
+
+ if (ptr) {
+ copy = strndup(name, ptr - name);
+ name = copy;
+ }
+ } else {
+ name = "carveout";
+ }
+
+ err = fdtdec_set_carveout(dst, node, "memory-region", index,
+ , name, compatibles,
+ num_compatibles, flags);
+ if (err < 0) {
+ printf("failed to set carveout for %s: %d\n", node,
err);
+ return err;
+ }
- return err;
- }
+ if (copy)
+ free(copy);
- err = fdtdec_set_carveout(dst, node, "memory-region", 0, ,
- "framebuffer", NULL, 0, 0);
- if (err < 0) {
- printf("failed to set carveout for %s: %d\n", node, err);
- return err;
+ index++;
}
return 0;
diff --git a/board/nvidia/p2771-/p2771-.c
b/board/nvidia/p2771-/p2771-.c
index 3d2653d1f075..46c36a22db5e 100644
--- a/board/nvidia/p2771-/p2771-.c
+++ b/board/nvidia/p2771-/p2771-.c
@@ -9,6 +9,7 @@
#include
#include
#include
+#include
#include
#include
#include "../p2571/max77620_init.h"
@@ -101,24 +102,52 @@ static void ft_mac_address_setup(void *fdt)
static int ft_copy_carveout(void *dst, const void *src, const char *node)
{
- struct fdt_memory fb;
+ unsigned int index = 0;
int err;
- err = fdtdec_get_carveout(src, node, "memory-region", 0, , NULL,
- NULL, NULL, NULL);
- if (err < 0) {
- if (err != -FDT_ERR_NOTFOUND)
- printf("failed to get carveout for %s: %d\n", node,
+ while (true) {
+ const char **compatibles = NULL;
+ unsigned int num_compatibles;
+ struct fdt_memory carveout;
+ unsigned long flags;
+ char *copy = NULL;
+ const char *name;
+
+ err = fdtdec_get_carveout(src, node, "memory-region", index,
+ , , ,
+ _compatibles, );
+ if (err < 0) {
+ if (err != -FDT_ERR_NOTFOUND)
+ printf("failed to get carveout for %s: %d\n",
+ node, err);
+
+ return err;
+ }
+
+ if (name) {
+ const char *ptr = strchr(name, '@');
+
+ if (ptr) {
+