Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140180701
D14133.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D14133.diff
View Options
Index: head/stand/fdt/fdt_loader_cmd.c
===================================================================
--- head/stand/fdt/fdt_loader_cmd.c
+++ head/stand/fdt/fdt_loader_cmd.c
@@ -427,7 +427,10 @@
return (1);
}
-void
+/*
+ * Returns the number of overlays successfully applied
+ */
+int
fdt_apply_overlays()
{
struct preloaded_file *fp;
@@ -436,13 +439,13 @@
void *current_fdtp;
void *next_fdtp;
void *overlay;
- int rv;
+ int overlays_applied, rv;
if ((fdtp == NULL) || (fdtp_size == 0))
- return;
+ return (0);
if (fdt_overlays_applied)
- return;
+ return (0);
max_overlay_size = 0;
for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) {
@@ -452,15 +455,16 @@
/* Nothing to apply */
if (max_overlay_size == 0)
- return;
+ return (0);
overlay = malloc(max_overlay_size);
if (overlay == NULL) {
printf("failed to allocate memory for DTB blob with overlays\n");
- return;
+ return (0);
}
current_fdtp = fdtp;
current_fdtp_size = fdtp_size;
+ overlays_applied = 0;
for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) {
COPYOUT(fp->f_addr, overlay, fp->f_size);
/* Check compatible first to avoid unnecessary allocation */
@@ -493,7 +497,9 @@
if (current_fdtp != fdtp)
free(current_fdtp);
current_fdtp = next_fdtp;
- current_fdtp_size = next_fdtp_size;
+ fdt_pack(current_fdtp);
+ current_fdtp_size = fdt_totalsize(current_fdtp);
+ overlays_applied++;
} else {
/*
* Assume here that the base we tried to apply on is
@@ -513,6 +519,26 @@
}
free(overlay);
fdt_overlays_applied = 1;
+ return (overlays_applied);
+}
+
+int
+fdt_pad_dtb(size_t padding)
+{
+ void *padded_fdtp;
+ size_t padded_fdtp_size;
+
+ padded_fdtp_size = fdtp_size + padding;
+ padded_fdtp = malloc(padded_fdtp_size);
+ if (padded_fdtp == NULL)
+ return (1);
+ if (fdt_open_into(fdtp, padded_fdtp, padded_fdtp_size) != 0) {
+ free(padded_fdtp);
+ return (1);
+ }
+ fdtp = padded_fdtp;
+ fdtp_size = padded_fdtp_size;
+ return (0);
}
int
Index: head/stand/fdt/fdt_platform.h
===================================================================
--- head/stand/fdt/fdt_platform.h
+++ head/stand/fdt/fdt_platform.h
@@ -43,7 +43,8 @@
void fdt_fixup_ethernet(const char *, char *, int);
void fdt_fixup_memory(struct fdt_mem_region *, size_t);
void fdt_fixup_stdout(const char *);
-void fdt_apply_overlays(void);
+int fdt_apply_overlays(void);
+int fdt_pad_dtb(size_t);
int fdt_load_dtb_addr(struct fdt_header *);
int fdt_load_dtb_file(const char *);
void fdt_load_dtb_overlays(const char *);
Index: head/stand/uboot/fdt/uboot_fdt.c
===================================================================
--- head/stand/uboot/fdt/uboot_fdt.c
+++ head/stand/uboot/fdt/uboot_fdt.c
@@ -63,6 +63,8 @@
return (1);
}
+#define FDT_DTB_PADSZ 1024
+
int
fdt_platform_load_dtb(void)
{
@@ -127,7 +129,8 @@
ethstr = NULL;
/* Apply overlays before anything else */
- fdt_apply_overlays();
+ if (fdt_apply_overlays() > 0)
+ fdt_pad_dtb(FDT_DTB_PADSZ);
/* Acquire sys_info */
si = ub_get_sys_info();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 22, 4:24 AM (1 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27135188
Default Alt Text
D14133.diff (3 KB)
Attached To
Mode
D14133: stand/fdt: Scale blob size better as overlays apply
Attached
Detach File
Event Timeline
Log In to Comment