From: Stefan Markovic <stefan.markovic@rt-rk.com>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu, riku.voipio@iki.fi,
philippe.mathieu.daude@gmail.com, aurelien@aurel32.net,
richard.henderson@linaro.org, amarkovic@wavecomp.com,
smarkovic@wavecomp.com, pjovanovic@wavecomp.com,
pburton@wavecomp.com, arikalo@wavecomp.com
Subject: [Qemu-devel] [PATCH v6 56/77] mips_malta: Setup GT64120 BARs in nanoMIPS bootloader
Date: Thu, 2 Aug 2018 16:16:43 +0200 [thread overview]
Message-ID: <1533219424-7627-57-git-send-email-stefan.markovic@rt-rk.com> (raw)
In-Reply-To: <1533219424-7627-1-git-send-email-stefan.markovic@rt-rk.com>
From: Paul Burton <pburton@wavecomp.com>
Setup the GT64120 BARs in the nanoMIPS bootloader, in the same way that
they are setup in the MIPS32 bootloader. This is necessary for Linux to
be able to access peripherals, including the UART.
Signed-off-by: Paul Burton <pburton@wavecomp.com>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
hw/mips/mips_malta.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 4bc9036..d1a7c1f 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -664,6 +664,79 @@ static void write_bootloader_nanomips(uint8_t *base, int64_t run_addr,
/* lui a3,%hi(loaderparams.ram_low_size) */
stw_p(p++, 0x80e7); stw_p(p++, NM_LO(loaderparams.ram_low_size));
/* ori a3,a3,%lo(loaderparams.ram_low_size) */
+
+ /* Load BAR registers as done by YAMON */
+ stw_p(p++, 0xe040); stw_p(p++, 0x0681);
+ /* lui t1, %hi(0xb4000000) */
+#ifdef TARGET_WORDS_BIGENDIAN
+ stw_p(p++, 0xe020); stw_p(p++, 0x0be1);
+ /* lui t0, %hi(0xdf000000) */
+#else
+ stw_p(p++, 0x0020); stw_p(p++, 0x00df);
+ /* addiu[32] t0, $0, 0xdf */
+#endif
+ stw_p(p++, 0x8422); stw_p(p++, 0x9068);
+ /* sw t0, 0x68(t1) */
+
+ stw_p(p++, 0xe040); stw_p(p++, 0x077d);
+ /* lui t1, %hi(0xbbe00000) */
+#ifdef TARGET_WORDS_BIGENDIAN
+ stw_p(p++, 0xe020); stw_p(p++, 0x0801);
+ /* lui t0, %hi(0xc0000000) */
+#else
+ stw_p(p++, 0x0020); stw_p(p++, 0x00c0);
+ /* addiu[32] t0, $0, 0xc0 */
+#endif
+ stw_p(p++, 0x8422); stw_p(p++, 0x9048);
+ /* sw t0, 0x48(t1) */
+#ifdef TARGET_WORDS_BIGENDIAN
+ stw_p(p++, 0xe020); stw_p(p++, 0x0800);
+ /* lui t0, %hi(0x40000000) */
+#else
+ stw_p(p++, 0x0020); stw_p(p++, 0x0040);
+ /* addiu[32] t0, $0, 0x40 */
+#endif
+ stw_p(p++, 0x8422); stw_p(p++, 0x9050);
+ /* sw t0, 0x50(t1) */
+
+#ifdef TARGET_WORDS_BIGENDIAN
+ stw_p(p++, 0xe020); stw_p(p++, 0x0001);
+ /* lui t0, %hi(0x80000000) */
+#else
+ stw_p(p++, 0x0020); stw_p(p++, 0x0080);
+ /* addiu[32] t0, $0, 0x80 */
+#endif
+ stw_p(p++, 0x8422); stw_p(p++, 0x9058);
+ /* sw t0, 0x58(t1) */
+#ifdef TARGET_WORDS_BIGENDIAN
+ stw_p(p++, 0xe020); stw_p(p++, 0x07e0);
+ /* lui t0, %hi(0x3f000000) */
+#else
+ stw_p(p++, 0x0020); stw_p(p++, 0x003f);
+ /* addiu[32] t0, $0, 0x3f */
+#endif
+ stw_p(p++, 0x8422); stw_p(p++, 0x9060);
+ /* sw t0, 0x60(t1) */
+
+#ifdef TARGET_WORDS_BIGENDIAN
+ stw_p(p++, 0xe020); stw_p(p++, 0x0821);
+ /* lui t0, %hi(0xc1000000) */
+#else
+ stw_p(p++, 0x0020); stw_p(p++, 0x00c1);
+ /* addiu[32] t0, $0, 0xc1 */
+#endif
+ stw_p(p++, 0x8422); stw_p(p++, 0x9080);
+ /* sw t0, 0x80(t1) */
+#ifdef TARGET_WORDS_BIGENDIAN
+ stw_p(p++, 0xe020); stw_p(p++, 0x0bc0);
+ /* lui t0, %hi(0x5e000000) */
+#else
+ stw_p(p++, 0x0020); stw_p(p++, 0x005e);
+ /* addiu[32] t0, $0, 0x5e */
+#endif
+ stw_p(p++, 0x8422); stw_p(p++, 0x9088);
+ /* sw t0, 0x88(t1) */
+
stw_p(p++, 0xe320 | NM_HI1(kernel_entry));
stw_p(p++, NM_HI2(kernel_entry));
/* lui t9,%hi(kernel_entry) */
--
1.9.1
next prev parent reply other threads:[~2018-08-02 14:39 UTC|newest]
Thread overview: 94+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 14:15 [Qemu-devel] [PATCH v6 00/77] Add nanoMIPS support to QEMU Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 01/77] MAINTAINERS: Update target/mips maintainer's email addresses Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 02/77] target/mips: Avoid case statements formulated by ranges Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 03/77] target/mips: Mark switch fallthroughs with interpretable comments Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 04/77] target/mips: Fix two instances of shadow variables Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 05/77] target/mips: Update some CP0 registers bit definitions Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 06/77] target/mips: Add CP0 BadInstrX register Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 07/77] target/mips: Add gen_op_addr_addi() Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 08/77] target/mips: Don't update BadVAddr register in Debug Mode Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 09/77] target/mips: Check ELPA flag only in some cases of MFHC0 and MTHC0 Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 10/77] elf: Remove duplicate preprocessor constant definition Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 11/77] elf: Add ELF flags for MIPS machine variants Stefan Markovic
2018-08-02 14:15 ` [Qemu-devel] [PATCH v6 12/77] linux-user: Update MIPS syscall numbers up to kernel 4.18 headers Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 13/77] linux-user: Add preprocessor availability control to some syscalls Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 14/77] target/mips: Add preprocessor constants for nanoMIPS Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 15/77] target/mips: Add nanoMIPS base instruction set opcodes Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 16/77] target/mips: Add nanoMIPS DSP ASE opcodes Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 17/77] target/mips: Add placeholder and invocation of decode_nanomips_opc() Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 18/77] target/mips: Add nanoMIPS decoding and extraction utilities Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 19/77] target/mips: Add emulation of nanoMIPS 16-bit arithmetic instructions Stefan Markovic
2018-08-02 17:32 ` Richard Henderson
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 20/77] target/mips: Add emulation of nanoMIPS 16-bit branch instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 21/77] target/mips: Add emulation of nanoMIPS 16-bit shift instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 22/77] target/mips: Add emulation of nanoMIPS 16-bit misc instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 23/77] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions Stefan Markovic
2018-08-02 17:39 ` Richard Henderson
2018-08-03 12:30 ` Aleksandar Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 24/77] target/mips: Add emulation of nanoMIPS 16-bit logic instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 25/77] target/mips: Add emulation of nanoMIPS 16-bit save and restore instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 26/77] target/mips: Add emulation of some common nanoMIPS 32-bit instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 27/77] target/mips: Add emulation of nanoMIPS instructions MOVE.P and MOVE.PREV Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 28/77] target/mips: Add emulation of nanoMIPS 48-bit instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 29/77] target/mips: Add emulation of nanoMIPS FP instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 30/77] target/mips: Add emulation of misc nanoMIPS instructions (pool32a0) Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 31/77] target/mips: Add emulation of misc nanoMIPS instructions (pool32axf) Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 32/77] target/mips: Add emulation of misc nanoMIPS instructions (p_lsx) Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 33/77] target/mips: Implement emulation of nanoMIPS ROTX instruction Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 34/77] target/mips: Implement emulation of nanoMIPS EXTW instruction Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 35/77] target/mips: Add emulation of nanoMIPS 32-bit load and store instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 36/77] target/mips: Add emulation of nanoMIPS 32-bit branch instructions Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 37/77] target/mips: Implement MT ASE support for nanoMIPS Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 38/77] target/mips: Add emulation of DSP ASE for nanoMIPS - part 1 Stefan Markovic
2018-08-03 10:55 ` Aleksandar Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 39/77] target/mips: Add emulation of DSP ASE for nanoMIPS - part 2 Stefan Markovic
2018-08-03 11:20 ` Aleksandar Markovic
2018-08-03 14:06 ` Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 40/77] target/mips: Add emulation of DSP ASE for nanoMIPS - part 3 Stefan Markovic
2018-08-03 11:27 ` Aleksandar Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 41/77] target/mips: Add emulation of DSP ASE for nanoMIPS - part 4 Stefan Markovic
2018-08-03 11:31 ` Aleksandar Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 42/77] target/mips: Add emulation of DSP ASE for nanoMIPS - part 5 Stefan Markovic
2018-08-03 11:55 ` Aleksandar Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 43/77] target/mips: Add emulation of DSP ASE for nanoMIPS - part 6 Stefan Markovic
2018-08-03 12:00 ` Aleksandar Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 44/77] target/mips: Add handling of branch delay slots for nanoMIPS Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 45/77] target/mips: Implement emulation of nanoMIPS LLWP/SCWP pair Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 46/77] target/mips: Add updating BadInstr, BadInstrP, BadInstrX for nanoMIPS Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 47/77] target/mips: Implement CP0 Config1.WR bit functionality Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 48/77] target/mips: Adjust exception_resume_pc() for nanoMIPS Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 49/77] target/mips: Adjust set_hflags_for_handler() " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 50/77] target/mips: Adjust set_pc() " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 51/77] target/mips: Fix ERET/ERETNC behavior related to ADEL exception Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 52/77] elf: Add nanoMIPS specific variations in ELF header fields Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 53/77] elf: Relax MIPS' elf_check_arch() to accept EM_NANOMIPS too Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 54/77] elf: Don't check FCR31_NAN2008 bit for nanoMIPS Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 55/77] mips_malta: Add basic nanoMIPS boot code for MIPS' Malta Stefan Markovic
2018-08-02 14:16 ` Stefan Markovic [this message]
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 57/77] mips_malta: Fix semihosting argument passing for nanoMIPS bare metal Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 58/77] gdbstub: Disable handling of nanoMIPS ISA bit in the MIPS gdbstub Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 59/77] gdbstub: Add XML support for GDB for nanoMIPS Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 60/77] target/mips: Add definition of nanoMIPS I7200 CPU Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 61/77] linux-user: Add syscall numbers for nanoMIPS Stefan Markovic
2018-08-06 13:45 ` Aleksandar Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 62/77] linux-user: Add target_signal.h header " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 63/77] linux-user: Add termbits.h " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 64/77] linux-user: Update syscall_defs.h " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 65/77] linux-user: Add target_fcntl.h " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 66/77] linux-user: Add sockbits.h " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 67/77] linux-user: Add target_syscall.h " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 68/77] linux-user: Add target_cpu.h " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 69/77] linux-user: Add target_structs.h " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 70/77] linux-user: Add target_elf.h " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 71/77] linux-user: Add signal.c " Stefan Markovic
2018-08-02 14:16 ` [Qemu-devel] [PATCH v6 72/77] linux-user: Add support for nanoMIPS signal trampoline Stefan Markovic
2018-08-02 14:17 ` [Qemu-devel] [PATCH v6 73/77] linux-user: Add cpu_loop.c for nanoMIPS Stefan Markovic
2018-08-02 14:17 ` [Qemu-devel] [PATCH v6 74/77] linux-user: Amend support for sigaction() syscall " Stefan Markovic
2018-08-02 14:17 ` [Qemu-devel] [PATCH v6 75/77] linux-user: Add support for statx() syscall for all platforms Stefan Markovic
2018-08-02 14:17 ` [Qemu-devel] [PATCH v6 76/77] linux-user: Add nanoMIPS linux user mode configuration support Stefan Markovic
2018-08-02 14:17 ` [Qemu-devel] [PATCH v6 77/77] linux-user: Add nanoMIPS support in scripts/qemu-binfmt-conf.sh Stefan Markovic
2018-08-02 19:47 ` Laurent Vivier
2018-08-03 11:23 ` Aleksandar Rikalo
2018-08-03 11:57 ` Laurent Vivier
2018-08-02 18:02 ` [Qemu-devel] [PATCH v6 00/77] Add nanoMIPS support to QEMU no-reply
2018-08-03 12:42 ` Stefan Markovic
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=1533219424-7627-57-git-send-email-stefan.markovic@rt-rk.com \
--to=stefan.markovic@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=laurent@vivier.eu \
--cc=pburton@wavecomp.com \
--cc=philippe.mathieu.daude@gmail.com \
--cc=pjovanovic@wavecomp.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
--cc=smarkovic@wavecomp.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).