aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Orzel2022-10-10 09:29:47 +0200
committerStefano Stabellini2022-12-09 15:13:42 -0800
commit7b91dd6313163d309e61060b26e67b2c06585092 (patch)
tree9d20712870b0a7c39def3a088b672e90957b7394
parent232aa4cf51234218c3bb9b01e2b874513677daa8 (diff)
Add support for 64-bit addresses/sizes
At the moment, ImageBuilder assumes that all addresses/sizes are 32-bit max. It sets #{address,size}-cells to 0x2 and puts 0x0 as the value for the first cell. Because of that, we cannot specify MEMORY_START and MEMORY_END to be above 32-bits (e.g. to place the images in the upper memory bank). Add support to properly handle 64-bit addresses/sizes: - add function split_into_halves to split the value passed as a first argument into upper and lower halves. These are then set as values for variables passed respectively as the second and third argument, - add function split_addr_size to split address and size and form a string to be passed to dt_set as data argument for reg property. Signed-off-by: Michal Orzel <michal.orzel@amd.com> [stefano: simplify split_into_halves] Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
-rwxr-xr-xscripts/uboot-script-gen26
1 files changed, 21 insertions, 5 deletions
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index a5b4972..7e5cc08 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -22,6 +22,22 @@ function dt_mknode()
fi
}
+function split_value()
+{
+ local value=$1
+ printf "0x%X " "$(($value >> 32))"
+ printf "0x%X " "$(($value & 0xFFFFFFFF))"
+}
+
+function split_addr_size()
+{
+ local addr=$1
+ local size=$2
+
+ split_value $addr
+ split_value $size
+}
+
# data_type is either
# int
# hex
@@ -93,7 +109,7 @@ function add_device_tree_kernel()
dt_mknode "$path" "module$addr"
dt_set "$path/module$addr" "compatible" "str_a" "multiboot,kernel multiboot,module"
- dt_set "$path/module$addr" "reg" "hex" "0x0 $addr 0x0 $(printf "0x%x" $size)"
+ dt_set "$path/module$addr" "reg" "hex" "$(split_addr_size $addr $size)"
dt_set "$path/module$addr" "bootargs" "str" "$bootargs"
}
@@ -106,7 +122,7 @@ function add_device_tree_ramdisk()
dt_mknode "$path" "module$addr"
dt_set "$path/module$addr" "compatible" "str_a" "multiboot,ramdisk multiboot,module"
- dt_set "$path/module$addr" "reg" "hex" "0x0 $addr 0x0 $(printf "0x%x" $size)"
+ dt_set "$path/module$addr" "reg" "hex" "$(split_addr_size $addr $size)"
}
@@ -118,7 +134,7 @@ function add_device_tree_passthrough()
dt_mknode "$path" "module$addr"
dt_set "$path/module$addr" "compatible" "str_a" "multiboot,device-tree multiboot,module"
- dt_set "$path/module$addr" "reg" "hex" "0x0 $addr 0x0 $(printf "0x%x" $size)"
+ dt_set "$path/module$addr" "reg" "hex" "$(split_addr_size $addr $size)"
}
function add_device_tree_mem()
@@ -257,7 +273,7 @@ function xen_device_tree_editing()
then
dt_mknode "/chosen" "dom0"
dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module"
- dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)"
+ dt_set "/chosen/dom0" "reg" "hex" "$(split_addr_size $dom0_kernel_addr $dom0_kernel_size)"
dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD"
fi
@@ -265,7 +281,7 @@ function xen_device_tree_editing()
then
dt_mknode "/chosen" "dom0-ramdisk"
dt_set "/chosen/dom0-ramdisk" "compatible" "str_a" "xen,linux-initrd xen,multiboot-module multiboot,module"
- dt_set "/chosen/dom0-ramdisk" "reg" "hex" "0x0 $ramdisk_addr 0x0 $(printf "0x%x" $ramdisk_size)"
+ dt_set "/chosen/dom0-ramdisk" "reg" "hex" "$(split_addr_size $ramdisk_addr $ramdisk_size)"
fi
i=0