aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorChris Smart <distroguy@gmail.com>2016-11-29 14:18:48 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-12-13 17:00:38 +1100
commitb7b5302af73764c659346ba90f4933bf4502b64a (patch)
tree6d39dd868e4f09f9170e5ec4e74d943eddd8bfec /external
parent67265323132888e8b12788542fc7b33b340cc28b (diff)
downloadskiboot-b7b5302af73764c659346ba90f4933bf4502b64a.zip
skiboot-b7b5302af73764c659346ba90f4933bf4502b64a.tar.gz
skiboot-b7b5302af73764c659346ba90f4933bf4502b64a.tar.bz2
mambo: fake NVRAM support
This re-configures the Mambo platform to use the new fake NVRAM introduced by Jack Miller <jack@codezen.org> in commit: mambo: Add Fake NVRAM driver An existing NVRAM file can be loaded by pointing SKIBOOT_NVRAM environment variable to the file when running Mambo. If no NVRAM file is provided, the default is set to 256Kb and will be formatted automatically by Skiboot on boot, e.g.: [ 0.000975501,5 ] NVRAM: Size is 256 KB [ 0.002292860,3 ] NVRAM: Partition at offset 0x0 has incorrect 0 length [ 0.002298792,3 ] NVRAM: Re-initializing (size: 0x00040000) This has been tested in Mambo, on bare metal Linux, as well as OpenPower BMC machines. Signed-off-by: Chris Smart <chris@distroguy.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/mambo/skiboot.tcl22
1 files changed, 21 insertions, 1 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 } {