From: Ahmad Fatoum <[email protected]> An initrd is not directly executable, so lets set the memory attributes to reflect that.
Signed-off-by: Ahmad Fatoum <[email protected]> --- common/bootm.c | 4 ++-- include/libfile.h | 6 +++--- lib/libfile.c | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index 1fafb2a5cd06..22796b3522ac 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -276,7 +276,7 @@ int bootm_load_os(struct image_data *data, unsigned long load_address) if (!data->os_file) return -EINVAL; - data->os_res = file_to_sdram(data->os_file, load_address); + data->os_res = file_to_sdram(data->os_file, load_address, MEMTYPE_LOADER_CODE); if (!data->os_res) return -ENOMEM; @@ -401,7 +401,7 @@ bootm_load_initrd(struct image_data *data, unsigned long load_address) goto done; } - data->initrd_res = file_to_sdram(data->initrd_file, load_address); + data->initrd_res = file_to_sdram(data->initrd_file, load_address, MEMTYPE_LOADER_DATA); if (!data->initrd_res) return ERR_PTR(-ENOMEM); diff --git a/include/libfile.h b/include/libfile.h index 26571945f678..cdcad4b173d0 100644 --- a/include/libfile.h +++ b/include/libfile.h @@ -4,10 +4,9 @@ #include <linux/types.h> #include <linux/compiler.h> +#include <linux/ioport.h> #include <linux/bits.h> -struct resource; - int pread_full(int fd, void *buf, size_t size, loff_t offset); int pwrite_full(int fd, const void *buf, size_t size, loff_t offset); int write_full(int fd, const void *buf, size_t size); @@ -55,6 +54,7 @@ char *make_temp(const char *template); int cache_file(const char *path, char **newpath); -struct resource *file_to_sdram(const char *filename, unsigned long adr); +struct resource *file_to_sdram(const char *filename, unsigned long adr, + enum resource_memtype memtype); #endif /* __LIBFILE_H */ diff --git a/lib/libfile.c b/lib/libfile.c index 7ca13a34b41d..a6690b0b904a 100644 --- a/lib/libfile.c +++ b/lib/libfile.c @@ -765,7 +765,8 @@ int cache_file(const char *path, char **newpath) #define BUFSIZ (PAGE_SIZE * 32) -struct resource *file_to_sdram(const char *filename, unsigned long adr) +struct resource *file_to_sdram(const char *filename, unsigned long adr, + enum resource_memtype memtype) { struct resource *res; unsigned memattrs; @@ -786,7 +787,7 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr) while (1) { res = request_sdram_region("image", adr, size, - MEMTYPE_LOADER_CODE, memattrs); + memtype, memattrs); if (!res) { printf("unable to request SDRAM 0x%08lx-0x%08lx\n", adr, adr + size - 1); @@ -816,7 +817,7 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr) if (now < BUFSIZ) { release_sdram_region(res); res = request_sdram_region("image", adr, ofs + now, - MEMTYPE_LOADER_CODE, memattrs); + memtype, memattrs); goto out; } -- 2.47.3
