diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/x86/mtrr/xip_cache.c | 4 | ||||
-rw-r--r-- | src/drivers/intel/fsp2_0/silicon_init.c | 5 | ||||
-rw-r--r-- | src/drivers/intel/fsp2_0/util.c | 5 | ||||
-rw-r--r-- | src/include/program_loading.h | 34 | ||||
-rw-r--r-- | src/soc/amd/common/block/pi/refcode_loader.c | 5 |
5 files changed, 25 insertions, 28 deletions
diff --git a/src/cpu/x86/mtrr/xip_cache.c b/src/cpu/x86/mtrr/xip_cache.c index d3fbfcb6b5..cd82e4fc71 100644 --- a/src/cpu/x86/mtrr/xip_cache.c +++ b/src/cpu/x86/mtrr/xip_cache.c @@ -29,8 +29,8 @@ static uint32_t max_cache_used(void) void platform_prog_run(struct prog *prog) { - const uint32_t base = region_device_offset(&prog->rdev); - const uint32_t size = region_device_sz(&prog->rdev); + const uint32_t base = (uintptr_t)prog_start(prog); + const uint32_t size = prog_size(prog); const uint32_t end = base + size; const uint32_t cache_used = max_cache_used(); /* This will accumulate MTRR's as XIP stages are run. diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c index 3975a96111..c9898f5ce3 100644 --- a/src/drivers/intel/fsp2_0/silicon_init.c +++ b/src/drivers/intel/fsp2_0/silicon_init.c @@ -210,7 +210,10 @@ void fsps_load(void) if (resume_from_stage_cache()) { printk(BIOS_DEBUG, "Loading FSPS from stage_cache\n"); stage_cache_load_stage(STAGE_REFCODE, fsps); - if (fsp_validate_component(&fsps_hdr, prog_rdev(fsps)) != CB_SUCCESS) + + struct region_device prog_rdev; + prog_chain_rdev(fsps, &prog_rdev); + if (fsp_validate_component(&fsps_hdr, &prog_rdev) != CB_SUCCESS) die("On resume fsps header is invalid\n"); load_done = 1; return; diff --git a/src/drivers/intel/fsp2_0/util.c b/src/drivers/intel/fsp2_0/util.c index 24097f8120..9831e64517 100644 --- a/src/drivers/intel/fsp2_0/util.c +++ b/src/drivers/intel/fsp2_0/util.c @@ -180,7 +180,7 @@ enum cb_err fsp_load_component(struct fsp_load_descriptor *fspld, struct fsp_hea uint32_t compression_algo; size_t output_size; void *dest; - struct region_device source_rdev; + struct region_device source_rdev, prog_rdev; struct prog *fsp_prog = &fspld->fsp_prog; if (fspld->get_destination == NULL) @@ -201,7 +201,8 @@ enum cb_err fsp_load_component(struct fsp_load_descriptor *fspld, struct fsp_hea prog_set_area(fsp_prog, dest, output_size); - if (fsp_validate_component(hdr, prog_rdev(fsp_prog)) != CB_SUCCESS) { + prog_chain_rdev(fsp_prog, &prog_rdev); + if (fsp_validate_component(hdr, &prog_rdev) != CB_SUCCESS) { printk(BIOS_ERR, "Invalid FSP header after load!\n"); return CB_ERR; } diff --git a/src/include/program_loading.h b/src/include/program_loading.h index bb4f6ea1d2..d01eff64d8 100644 --- a/src/include/program_loading.h +++ b/src/include/program_loading.h @@ -41,17 +41,13 @@ void arch_segment_loaded(uintptr_t start, size_t size, int flags); /* Representation of a program. */ struct prog { - /* The region_device represents the memory region of the stages and - * payload. For architectures that use a bounce buffer - * then it would represent the bounce buffer. */ enum prog_type type; enum cbfs_type cbfs_type; const char *name; - struct region_device rdev; - /* Entry to program with optional argument. It's up to the architecture - * to decide if argument is passed. */ - void (*entry)(void *); - void *arg; + void *start; /* Program start in memory. */ + size_t size; /* Program size in memory (including BSS). */ + void (*entry)(void *); /* Function pointer to entry point. */ + void *arg; /* Optional argument (only valid for some archs). */ }; #define PROG_INIT(type_, name_) \ @@ -75,21 +71,14 @@ static inline enum cbfs_type prog_cbfs_type(const struct prog *prog) return prog->cbfs_type; } -static inline struct region_device *prog_rdev(struct prog *prog) -{ - return &prog->rdev; -} - -/* Only valid for loaded programs. */ static inline size_t prog_size(const struct prog *prog) { - return region_device_sz(&prog->rdev); + return prog->size; } -/* Only valid for loaded programs. */ static inline void *prog_start(const struct prog *prog) { - return rdev_mmap_full(&prog->rdev); + return prog->start; } static inline void *prog_entry(const struct prog *prog) @@ -105,15 +94,18 @@ static inline void *prog_entry_arg(const struct prog *prog) /* region_device representing the 32-bit flat address space. */ extern const struct mem_region_device addrspace_32bit; -static inline void prog_memory_init(struct prog *prog, uintptr_t ptr, - size_t size) +/* Can be used to get an rdev representation of program area in memory. */ +static inline void prog_chain_rdev(const struct prog *prog, + struct region_device *rdev_out) { - rdev_chain(&prog->rdev, &addrspace_32bit.rdev, ptr, size); + rdev_chain(rdev_out, &addrspace_32bit.rdev, + (uintptr_t)prog->start, prog->size); } static inline void prog_set_area(struct prog *prog, void *start, size_t size) { - prog_memory_init(prog, (uintptr_t)start, size); + prog->start = start; + prog->size = size; } static inline void prog_set_entry(struct prog *prog, void *e, void *arg) diff --git a/src/soc/amd/common/block/pi/refcode_loader.c b/src/soc/amd/common/block/pi/refcode_loader.c index 1d8db89440..fe2df5b972 100644 --- a/src/soc/amd/common/block/pi/refcode_loader.c +++ b/src/soc/amd/common/block/pi/refcode_loader.c @@ -57,8 +57,9 @@ static int agesa_locate_stage_file_ramstage(const char *name, stage_cache_add(STAGE_REFCODE, &prog); } - return rdev_chain(rdev, prog_rdev(&prog), 0, - region_device_sz(prog_rdev(&prog))); + prog_chain_rdev(&prog, rdev); + + return 0; } static int agesa_locate_stage_file(const char *name, struct region_device *rdev) |