qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Bellows <greg.bellows@linaro.org>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: Greg Bellows <greg.bellows@linaro.org>
Subject: [Qemu-devel] [PATCH] target-arm: add second UART to virt
Date: Wed,  8 Oct 2014 13:25:43 -0500	[thread overview]
Message-ID: <1412792743-30906-2-git-send-email-greg.bellows@linaro.org> (raw)
In-Reply-To: <1412792743-30906-1-git-send-email-greg.bellows@linaro.org>

Added UART1 to virt to enable separate UARTs for secure/nonsecure worlds.

Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
---
 hw/arm/virt.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 8c6b171..0740cdc 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -64,7 +64,8 @@ enum {
     VIRT_CPUPERIPHS,
     VIRT_GIC_DIST,
     VIRT_GIC_CPU,
-    VIRT_UART,
+    VIRT_UART0,
+    VIRT_UART1,
     VIRT_MMIO,
     VIRT_RTC,
 };
@@ -104,8 +105,9 @@ static const MemMapEntry a15memmap[] = {
     /* GIC distributor and CPU interfaces sit inside the CPU peripheral space */
     [VIRT_GIC_DIST] =   { 0x08000000, 0x00010000 },
     [VIRT_GIC_CPU] =    { 0x08010000, 0x00010000 },
-    [VIRT_UART] =       { 0x09000000, 0x00001000 },
-    [VIRT_RTC] =        { 0x09010000, 0x00001000 },
+    [VIRT_UART0] =      { 0x09000000, 0x00001000 },
+    [VIRT_UART1] =      { 0x09010000, 0x00001000 },
+    [VIRT_RTC] =        { 0x09020000, 0x00001000 },
     [VIRT_MMIO] =       { 0x0a000000, 0x00000200 },
     /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */
     /* 0x10000000 .. 0x40000000 reserved for PCI */
@@ -113,8 +115,9 @@ static const MemMapEntry a15memmap[] = {
 };
 
 static const int a15irqmap[] = {
-    [VIRT_UART] = 1,
-    [VIRT_RTC] = 2,
+    [VIRT_UART0] = 1,
+    [VIRT_UART1] = 2,
+    [VIRT_RTC] = 3,
     [VIRT_MMIO] = 16, /* ...to 16 + NUM_VIRTIO_TRANSPORTS - 1 */
 };
 
@@ -352,12 +355,12 @@ static void create_gic(const VirtBoardInfo *vbi, qemu_irq *pic)
     fdt_add_gic_node(vbi);
 }
 
-static void create_uart(const VirtBoardInfo *vbi, qemu_irq *pic)
+static void create_uart(const VirtBoardInfo *vbi, qemu_irq *pic, int uart)
 {
     char *nodename;
-    hwaddr base = vbi->memmap[VIRT_UART].base;
-    hwaddr size = vbi->memmap[VIRT_UART].size;
-    int irq = vbi->irqmap[VIRT_UART];
+    hwaddr base = vbi->memmap[uart].base;
+    hwaddr size = vbi->memmap[uart].size;
+    int irq = vbi->irqmap[uart];
     const char compat[] = "arm,pl011\0arm,primecell";
     const char clocknames[] = "uartclk\0apb_pclk";
 
@@ -589,7 +592,8 @@ static void machvirt_init(MachineState *machine)
 
     create_gic(vbi, pic);
 
-    create_uart(vbi, pic);
+    create_uart(vbi, pic, VIRT_UART0);
+    create_uart(vbi, pic, VIRT_UART1);
 
     create_rtc(vbi, pic);
 
-- 
1.8.3.2

      reply	other threads:[~2014-10-08 18:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 18:25 [Qemu-devel] [PATCH] target-arm: add second UART to virt Greg Bellows
2014-10-08 18:25 ` Greg Bellows [this message]

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=1412792743-30906-2-git-send-email-greg.bellows@linaro.org \
    --to=greg.bellows@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).