diff options
author | Michael Neuling <mikey@neuling.org> | 2018-09-19 17:52:01 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-09-20 14:30:51 +1000 |
commit | 832cac15956cc9af32d0196da0dc82e7aeef9e19 (patch) | |
tree | 821c3f172a9153ea201f3e1da086f805aed45e84 | |
parent | 0f7868260709928e331e428995ffaf5dd9567b69 (diff) | |
download | skiboot-832cac15956cc9af32d0196da0dc82e7aeef9e19.zip skiboot-832cac15956cc9af32d0196da0dc82e7aeef9e19.tar.gz skiboot-832cac15956cc9af32d0196da0dc82e7aeef9e19.tar.bz2 |
mambo: Merge PMEM_DISK and PMEM_VOLATILE code
PMEM_VOLATILE and PMEM_DISK can't be used together and are basically
copies of the same code.
This merges the two and allows them used together. Same API is kept.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r-- | external/mambo/skiboot.tcl | 77 |
1 files changed, 31 insertions, 46 deletions
diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl index df4dda2..17561be 100644 --- a/external/mambo/skiboot.tcl +++ b/external/mambo/skiboot.tcl @@ -239,60 +239,45 @@ if { [info exists env(SKIBOOT_INITRD)] } { mysim of addprop $chosen_node int "linux,initrd-end" $cpio_end } + # Map persistent memory disks -if { [info exists env(PMEM_DISK)] } { +proc pmem_node_add { root start size } { + set start_hex [format %x $start] + set node [mysim of addchild $root "pmem@$start_hex" ""] + set reg [list [expr $start >> 32] [expr $start & 0xffffffff] [expr $size >> 32] [expr $size & 0xffffffff] ] + mysim of addprop $node array "reg" reg + mysim of addprop $node string "compatible" "pmem-region" + mysim of addprop $node empty "volatile" "1" + return [expr $start + $size] +} +set pmem_files "" +if { [info exists env(PMEM_DISK)] } { set pmem_files [split $env(PMEM_DISK) ","] - - set pmem_root [mysim of addchild $root_node "pmem" ""] - mysim of addprop $pmem_root int "#address-cells" 2 - mysim of addprop $pmem_root int "#size-cells" 2 - mysim of addprop $pmem_root empty "ranges" "" - - # Start above where XICS normally is at 0x1A0000000000 - set pmem_start [expr 0x20000000000] - foreach pmem_file $pmem_files { - set pmem_file [string trim $pmem_file] - set pmem_size [file size $pmem_file] - set pmem_start_hex [format %x $pmem_start] - set pmem_node [mysim of addchild $pmem_root "pmem@$pmem_start_hex" ""] - set reg [list [expr $pmem_start >> 32] [expr $pmem_start & 0xffffffff] [expr $pmem_size >> 32] [expr $pmem_size & 0xffffffff] ] - mysim of addprop $pmem_node array "reg" reg - mysim of addprop $pmem_node string "compatible" "pmem-region" - mysim of addprop $pmem_root empty "volatile" "" - if {[catch {mysim memory mmap $pmem_start $pmem_size $pmem_file rw}]} { - puts "ERROR: pmem: 'mysim mmap' command needs newer mambo" - exit - } - set pmem_start [expr $pmem_start + $pmem_size] - } } - +set pmem_sizes "" if { [info exists env(PMEM_VOLATILE)] } { - set pmem_sizes [split $env(PMEM_VOLATILE) ","] - - set pmem_root [mysim of addchild $root_node "pmem" ""] - mysim of addprop $pmem_root int "#address-cells" 2 - mysim of addprop $pmem_root int "#size-cells" 2 - mysim of addprop $pmem_root empty "ranges" "" - - # Start above where XICS normally is at 0x1A0000000000 - if (![info exists pmem_start]) { - set pmem_start [expr 0x20000000000] - } - - foreach pmem_size $pmem_sizes { - set pmem_size [string trim $pmem_size] - set pmem_start_hex [format %x $pmem_start] - set pmem_node [mysim of addchild $pmem_root "pmem@$pmem_start_hex" ""] - set reg [list [expr $pmem_start >> 32] [expr $pmem_start & 0xffffffff] [expr $pmem_size >> 32] [expr $pmem_size & 0xffffffff] ] - mysim of addprop $pmem_node array "reg" reg - mysim of addprop $pmem_node string "compatible" "pmem-region" - mysim of addprop $pmem_root int "volatile" 1 - set pmem_start [expr $pmem_start + $pmem_size] +} +set pmem_root [mysim of addchild $root_node "pmem" ""] +mysim of addprop $pmem_root int "#address-cells" 2 +mysim of addprop $pmem_root int "#size-cells" 2 +mysim of addprop $pmem_root empty "ranges" "" +# Start above where XICS normally is at 0x1A0000000000 +set pmem_start [expr 0x20000000000] +foreach pmem_file $pmem_files { # PMEM_DISK + set pmem_file [string trim $pmem_file] + set pmem_size [file size $pmem_file] + if {[catch {mysim memory mmap $pmem_start $pmem_size $pmem_file rw}]} { + puts "ERROR: pmem: 'mysim mmap' command needs newer mambo" + exit } + set pmem_start [pmem_node_add $pmem_root $pmem_start $pmem_size] } +foreach pmem_size $pmem_sizes { # PMEM_VOLATILE + set pmem_start [pmem_node_add $pmem_root $pmem_start $pmem_size] +} + # Default NVRAM is blank and will be formatted by Skiboot if no file is provided set fake_nvram_start $cpio_end |