xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xensource.com
Cc: David Vrabel <david.vrabel@citrix.com>
Subject: [PATCH 4/8] arm: link a device tree blob into the xen image
Date: Mon, 13 Feb 2012 13:18:47 +0000	[thread overview]
Message-ID: <1329139131-27554-5-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1329139131-27554-1-git-send-email-david.vrabel@citrix.com>

From: David Vrabel <david.vrabel@citrix.com>

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>
---
 config/arm.mk          |    6 ++++++
 xen/arch/arm/Makefile  |    9 ++++++++-
 xen/arch/arm/dtb.S     |    2 ++
 xen/arch/arm/head.S    |    6 ++++++
 xen/arch/arm/xen.lds.S |    4 ++++
 5 files changed, 26 insertions(+), 1 deletions(-)
 create mode 100644 xen/arch/arm/dtb.S

diff --git a/config/arm.mk b/config/arm.mk
index f64f0c1..f20fd2d 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 9bc2fc8..b4dd3b1 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 0000000..c703aef
--- /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 57b990d..ea557c2 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 5a62e2c..6fb7662 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)
-- 
1.7.2.5

  parent reply	other threads:[~2012-02-13 13:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-13 13:18 [PATCH 0/8] arm: initial device tree support (#3) David Vrabel
2012-02-13 13:18 ` [PATCH 1/8] libfdt: add version 1.3.0 David Vrabel
2012-02-13 13:18 ` [PATCH 2/8] libfdt: fixup libfdt_env.h for xen David Vrabel
2012-02-13 13:18 ` [PATCH 3/8] libfdt: add to build David Vrabel
2012-02-13 13:18 ` David Vrabel [this message]
2012-02-17 17:13   ` [PATCH 4/8] arm: link a device tree blob into the xen image Ian Campbell
2012-02-17 17:22     ` David Vrabel
2012-02-20 17:20       ` Ian Campbell
2012-02-22 14:34         ` Ian Campbell
2012-02-13 13:18 ` [PATCH 5/8] arm: map device tree blob in initial page tables David Vrabel
2012-02-13 13:18 ` [PATCH 6/8] arm: add early_printk() David Vrabel
2012-02-13 13:18 ` [PATCH 7/8] arm, device tree: parse the DTB for RAM location and size David Vrabel
2012-02-13 14:51   ` Ian Campbell
2012-02-13 15:46     ` David Vrabel
2012-02-13 16:53       ` Ian Campbell
2012-02-13 17:41         ` Ian Jackson
2012-03-14 10:53           ` Ian Campbell
2012-02-13 13:18 ` [PATCH 8/8] arm: setup MM using information from the device tree David Vrabel
2012-02-13 15:27 ` [PATCH 0/8] arm: initial device tree support (#3) Ian Campbell
2012-02-13 15:49   ` David Vrabel
  -- strict thread matches above, loose matches on Subject: below --
2012-02-10 13:03 [PATCH 0/8] arm: initial device tree support (#2) David Vrabel
2012-02-10 13:03 ` [PATCH 4/8] arm: link a device tree blob into the xen image David Vrabel
2012-02-10 13:35   ` Ian Campbell
2012-02-10 13:40     ` David Vrabel
2012-02-10 13:52       ` Ian Campbell
2012-02-10 16:50         ` Tim Deegan
2012-02-10 17:38           ` David Vrabel
2012-02-10 17:46             ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329139131-27554-5-git-send-email-david.vrabel@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).