From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>, barebox@lists.infradead.org
Subject: Re: [PATCH 1/9] RISC-V: make it possible to run nmon from PBL C code
Date: Wed, 5 May 2021 12:27:14 +0200 [thread overview]
Message-ID: <8f9f9b43-7506-0eca-b337-7d4f8aef4020@pengutronix.de> (raw)
In-Reply-To: <20210505100900.88141-2-antonynpavlov@gmail.com>
Hello,
On 05.05.21 12:08, Antony Pavlov wrote:
> After migrating to PBL we can't use nmon assembler macro
> in C code anymore. Some changes are introduced to invoke
> nmon from PBL C code:
>
> * use 'lla' macro instruction instead of 'la';
> * don't touch the 'ra' register, use 'a2' instead;
> * add wrapper C function for nmon.
>
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
> arch/riscv/boot/Makefile | 1 +
> arch/riscv/boot/nmon_entry.S | 13 ++++++++++++
> arch/riscv/include/asm/riscv_nmon.h | 33 ++++++++++++++---------------
> 3 files changed, 30 insertions(+), 17 deletions(-)
>
> diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
> index 968a826d16..80f63a4a0a 100644
> --- a/arch/riscv/boot/Makefile
> +++ b/arch/riscv/boot/Makefile
> @@ -1,4 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> obj-y += start.o
> pbl-y += entry.o uncompress.o
> +pbl-y += nmon_entry.o
> pbl-$(CONFIG_BOARD_GENERIC_DT) += board-dt-2nd.o
> diff --git a/arch/riscv/boot/nmon_entry.S b/arch/riscv/boot/nmon_entry.S
> new file mode 100644
> index 0000000000..9b30b50627
> --- /dev/null
> +++ b/arch/riscv/boot/nmon_entry.S
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#include <linux/linkage.h>
> +#include <asm/sections.h>
> +
> +#include "mach/debug_ll.h"
> +#include "asm/riscv_nmon.h"
> +
> +.section .text_bare_init
> +
> +ENTRY(__barebox_nmon_entry)
Perhaps drop the __? __ makes me think I should
not call this or that there is a non __-prefixed
versions, but both don't seem to be true as boards
do directly call this.
> + riscv_nmon
> + ret
> +ENDPROC(__barebox_nmon_entry)
> diff --git a/arch/riscv/include/asm/riscv_nmon.h b/arch/riscv/include/asm/riscv_nmon.h
> index caf213cdd8..11b19ab35b 100644
> --- a/arch/riscv/include/asm/riscv_nmon.h
> +++ b/arch/riscv/include/asm/riscv_nmon.h
> @@ -20,9 +20,8 @@
Please add
#ifndef __ASSEMBLY__
void __barebox_nmon_entry(void);
#endif
here.
With that addressed:
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>
> .macro nmon_outs msg
>
> - la a1, \msg
> -
> - jal _nmon_outs
> + lla a1, \msg
> + jal a2, _nmon_outs
>
> .endm
>
> @@ -73,7 +72,7 @@ nmon_main:
> li a0, 'q'
> bne s0, a0, 3f
>
> - jal _nmon_outc_a0
> + jal a2, _nmon_outc_a0
>
> j nmon_exit
>
> @@ -90,12 +89,12 @@ nmon_main:
> j nmon_main_help
>
> nmon_cmd_d:
> - jal _nmon_outc_a0
> + jal a2, _nmon_outc_a0
>
> li a0, ' '
> - jal _nmon_outc_a0
> + jal a2, _nmon_outc_a0
>
> - jal _nmon_gethexw
> + jal a2, _nmon_gethexw
>
> nmon_outs msg_nl
>
> @@ -105,28 +104,28 @@ nmon_cmd_d:
> j nmon_main
>
> nmon_cmd_w:
> - jal _nmon_outc_a0
> + jal a2, _nmon_outc_a0
>
> li a0, ' '
> - jal _nmon_outc_a0
> + jal a2, _nmon_outc_a0
>
> - jal _nmon_gethexw
> + jal a2, _nmon_gethexw
> move s2, s0
>
> li a0, ' '
> - jal _nmon_outc_a0
> - jal _nmon_gethexw
> + jal a2, _nmon_outc_a0
> + jal a2, _nmon_gethexw
>
> sw s0, 0(s2)
> j nmon_main
>
> nmon_cmd_g:
> - jal _nmon_outc_a0
> + jal a2, _nmon_outc_a0
>
> li a0, ' '
> - jal _nmon_outc_a0
> + jal a2, _nmon_outc_a0
>
> - jal _nmon_gethexw
> + jal a2, _nmon_gethexw
> move s2, s0
>
> nmon_outs msg_nl
> @@ -136,7 +135,7 @@ nmon_cmd_g:
>
> _nmon_outc_a0:
> debug_ll_outc_a0
> - jr ra
> + jr a2
>
> _nmon_outs:
>
> @@ -202,7 +201,7 @@ _get_hex_digit:
> move s0, t2
>
> _nmon_jr_ra_exit:
> - jr ra
> + jr a2
>
> msg_prompt:
> .asciz "\r\nnmon> "
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-05-05 10:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 10:08 [PATCH 0/9] RISC-V: add LiteX SoC support; resurrect nmon Antony Pavlov
2021-05-05 10:08 ` [PATCH 1/9] RISC-V: make it possible to run nmon from PBL C code Antony Pavlov
2021-05-05 10:27 ` Ahmad Fatoum [this message]
2021-05-05 10:08 ` [PATCH 2/9] RISC-V: boards: erizo: make it possible to use nmon Antony Pavlov
2021-05-05 10:28 ` Ahmad Fatoum
2021-05-05 10:08 ` [PATCH 3/9] serial: add litex UART driver Antony Pavlov
2021-05-05 10:32 ` Ahmad Fatoum
2021-05-05 10:08 ` [PATCH 4/9] gpio: add driver for 74xx-ICs with MMIO access Antony Pavlov
2021-05-05 10:35 ` Ahmad Fatoum
2021-05-05 10:08 ` [PATCH 5/9] spi: add litex spiflash driver Antony Pavlov
2021-05-05 10:39 ` Ahmad Fatoum
2021-05-05 15:10 ` Antony Pavlov
2021-05-05 10:08 ` [PATCH 6/9] net: add LiteEth driver Antony Pavlov
2021-05-06 10:10 ` Roland Hieber
2021-05-06 11:33 ` Antony Pavlov
2021-05-05 10:08 ` [PATCH 7/9] RISC-V: add initial LiteX SoC support Antony Pavlov
2021-05-05 10:16 ` Ahmad Fatoum
2021-05-05 10:45 ` Jan Lübbe
2021-05-05 15:23 ` Antony Pavlov
2021-05-05 10:08 ` [PATCH 8/9] RISC-V: add litex-linux board support Antony Pavlov
2021-05-05 10:19 ` Ahmad Fatoum
2021-05-05 10:36 ` Antony Pavlov
2021-05-05 10:09 ` [PATCH 9/9] RISC-V: add litex_linux_defconfig Antony Pavlov
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=8f9f9b43-7506-0eca-b337-7d4f8aef4020@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.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