aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2012-02-13 14:24:48 +0000
committerDavid Vrabel <david.vrabel@citrix.com>2012-02-13 14:24:48 +0000
commit1a308e6a951208e02621b8e7c4be2cd582317a9f (patch)
tree9e15566192e646f007397309575a1d4663d5818f
parentdc8bd9d0697edff43cb8bfdc47f49a5af32bf4dc (diff)
downloadxen-1a308e6a951208e02621b8e7c4be2cd582317a9f.tar.gz
xen-1a308e6a951208e02621b8e7c4be2cd582317a9f.tar.bz2
xen-1a308e6a951208e02621b8e7c4be2cd582317a9f.zip
arm: link a device tree blob into the xen image
Link a device tree blob (DTB) into the xen image. This is loaded immediately after Xen and xen_start() is called with the correct address in atag_paddr. The DTB file must be supplied by setting the CONFIG_DTB_FILE variable in .config or on the make command line. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
-rw-r--r--config/arm.mk6
-rw-r--r--xen/arch/arm/Makefile9
-rw-r--r--xen/arch/arm/dtb.S2
-rw-r--r--xen/arch/arm/head.S6
-rw-r--r--xen/arch/arm/xen.lds.S4
5 files changed, 26 insertions, 1 deletions
diff --git a/config/arm.mk b/config/arm.mk
index f64f0c1c83..f20fd2db0b 100644
--- a/config/arm.mk
+++ b/config/arm.mk
@@ -16,3 +16,9 @@ LDFLAGS_DIRECT_Linux = _linux
LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
CONFIG_LOAD_ADDRESS ?= 0x80000000
+
+# XXX: When running on the model there is no bootloader to provide a
+# device tree. It must be linked into Xen.
+ifndef CONFIG_DTB_FILE
+$(error CONFIG_DTB_FILE must be set to the absolute filename of a DTB)
+endif
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 9bc2fc84db..b4dd3b1268 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -22,12 +22,17 @@ obj-y += vtimer.o
#obj-bin-y += ....o
+ifdef CONFIG_DTB_FILE
+obj-y += dtb.o
+AFLAGS += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
+endif
+
ALL_OBJS := head.o $(ALL_OBJS)
$(TARGET): $(TARGET)-syms
# XXX: VE model loads by VMA so instead of
# making a proper ELF we link with LMA == VMA and adjust crudely
- $(OBJCOPY) --change-addresses +0x7fe00000 $< $@
+ $(OBJCOPY) --change-addresses +0x80000000 $< $@
# XXX strip it
#$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
@@ -71,6 +76,8 @@ xen.lds: xen.lds.S
sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new
mv -f .xen.lds.d.new .xen.lds.d
+dtb.o: $(CONFIG_DTB_FILE)
+
.PHONY: clean
clean::
rm -f asm-offsets.s xen.lds
diff --git a/xen/arch/arm/dtb.S b/xen/arch/arm/dtb.S
new file mode 100644
index 0000000000..c703aef12b
--- /dev/null
+++ b/xen/arch/arm/dtb.S
@@ -0,0 +1,2 @@
+ .section .dtb,#alloc
+ .incbin CONFIG_DTB_FILE
diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S
index 57b990dc58..ea557c21cf 100644
--- a/xen/arch/arm/head.S
+++ b/xen/arch/arm/head.S
@@ -55,6 +55,12 @@ start:
adr r9, start /* r9 := paddr (start) */
sub r10, r9, r0 /* r10 := phys-offset */
+ /* Using the DTB in the .dtb section? */
+#ifdef CONFIG_DTB_FILE
+ ldr r8, =_sdtb
+ add r8, r10 /* r8 := paddr(DTB) */
+#endif
+
#ifdef EARLY_UART_ADDRESS
/* Say hello */
ldr r11, =EARLY_UART_ADDRESS /* r11 := UART base address */
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 5a62e2c696..6fb76628af 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -122,6 +122,10 @@ SECTIONS
} :text
_end = . ;
+ /* Section for the device tree blob (if any). */
+ _sdtb = .;
+ .dtb : { *(.dtb) } :text
+
/* Sections to be discarded */
/DISCARD/ : {
*(.exit.text)