diff options
-rw-r--r-- | external/mambo/skiboot.tcl | 22 | ||||
-rw-r--r-- | platforms/mambo/mambo.c | 20 |
2 files changed, 24 insertions, 18 deletions
diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl index 02a5ba9..fdcf14d 100644 --- a/external/mambo/skiboot.tcl +++ b/external/mambo/skiboot.tcl @@ -171,17 +171,37 @@ lappend compat "ibm,power8-xscom" set compat [of::encode_compat $compat] mysim of addprop $xscom_node byte_array "compatible" $compat +# Load any initramfs +set cpio_start 0x80000000 +set cpio_end $cpio_start if { [info exists env(SKIBOOT_INITRD)] } { set cpio_file $env(SKIBOOT_INITRD) set chosen_node [mysim of find_device /chosen] set cpio_size [file size $cpio_file] - set cpio_start 0x80000000 set cpio_end [expr $cpio_start + $cpio_size] mysim of addprop $chosen_node int "linux,initrd-start" $cpio_start mysim of addprop $chosen_node int "linux,initrd-end" $cpio_end mysim mcm 0 memory fread $cpio_start $cpio_size $cpio_file } +# Default NVRAM is blank and will be formatted by Skiboot if no file is provided +set fake_nvram_start $cpio_end +set fake_nvram_size 0x40000 +# Load any fake NVRAM file if provided +if { [info exists env(SKIBOOT_NVRAM)] } { + # Set up and write NVRAM file + set fake_nvram_file $env(SKIBOOT_NVRAM) + set fake_nvram_size [file size $fake_nvram_file] + mysim mcm 0 memory fread $fake_nvram_start $fake_nvram_size $fake_nvram_file +} + +# Add device tree entry for NVRAM +set reserved_memory [mysim of addchild $root_node "reserved-memory" ""] +set fake_nvram_node [mysim of addchild $reserved_memory "ibm,fake-nvram" ""] +set reg [list $fake_nvram_start $fake_nvram_size ] +mysim of addprop $fake_nvram_node array64 "reg" reg +mysim of addprop $fake_nvram_node empty "name" "ibm,fake-nvram" + # Init CPUs set pir 0 for { set c 0 } { $c < $mconf(cpus) } { incr c } { diff --git a/platforms/mambo/mambo.c b/platforms/mambo/mambo.c index 8d4820f..663164d 100644 --- a/platforms/mambo/mambo.c +++ b/platforms/mambo/mambo.c @@ -281,21 +281,6 @@ static void __attribute__((noreturn)) mambo_terminate(const char *msg __unused) for (;;) ; } -static int mambo_nvram_info(uint32_t *total_size) -{ - *total_size = 0x100000; - return OPAL_SUCCESS; -} - -static int mambo_nvram_start_read(void *dst, uint32_t src, uint32_t len) -{ - memset(dst+src, 0, len); - - nvram_read_complete(true); - - return OPAL_SUCCESS; -} - static int mambo_heartbeat_time(void) { /* @@ -311,9 +296,10 @@ DECLARE_PLATFORM(mambo) = { .init = mambo_platform_init, .cec_power_down = mambo_cec_power_down, .terminate = mambo_terminate, - .nvram_info = mambo_nvram_info, - .nvram_start_read = mambo_nvram_start_read, .start_preload_resource = flash_start_preload_resource, .resource_loaded = flash_resource_loaded, .heartbeat_time = mambo_heartbeat_time, + .nvram_info = fake_nvram_info, + .nvram_start_read = fake_nvram_start_read, + .nvram_write = fake_nvram_write, }; |