public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/9] openrisc: Add cpu files
Date: Sat, 19 Nov 2011 00:59:05 -0500	[thread overview]
Message-ID: <201111190059.06923.vapier@gentoo.org> (raw)
In-Reply-To: <1321680098-31121-4-git-send-email-stefan.kristiansson@saunalahti.fi>

On Saturday 19 November 2011 00:21:32 Stefan Kristiansson wrote:
> --- /dev/null
> +++ b/arch/openrisc/config.mk
>
> \ No newline at end of file

might want to fix that

> --- /dev/null
> +++ b/arch/openrisc/cpu/cache.c
>
> +int checkicache(void)
> +int checkdcache(void)

these should be static

> +void dcache_enable(void)
> +{
> +	mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_DCE);
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +}
> +
> +void icache_enable(void)
> +{
> +	mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_ICE);
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +	asm("l.nop");
> +}

the lack of volatile and the lack of any sort of constraints means gcc is free 
to throw that away ...

> --- /dev/null
> +++ b/arch/openrisc/cpu/cpu.c
>
> +void illegal_instruction_handler(void)
> +void checkinstructions(void)
> +int checkcpu(void)

looks like these should be static

> +extern void __reset(void);
> +
> +int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> +{
> +	disable_interrupts();
> +	__reset();
> +	return 0;
> +}

__reset() should not return

> --- /dev/null
> +++ b/arch/openrisc/cpu/exceptions.c
>
> +extern void hang(void);

common.h already has a prototype for this; delete it.

> +static void exception_hang(int vect)
> +{
> +	printf("Unhandled exception at 0x%x ", vect & 0xff00);
> +	switch (vect & 0xff00) {
> +	case 0x100:
> +		puts("(Reset)\n");
> +		break;
> +	case 0x200:
> +		puts("(Bus Error)\n");
> +		break;
> +	case 0x300:
> +		puts("(Data Page Fault)\n");
> +		break;
> +	case 0x400:
> +		puts("(Instruction Page Fault)\n");
> +		break;
> +	case 0x500:
> +		puts("(Tick Timer)\n");
> +		break;
> +	case 0x600:
> +		puts("(Alignment)\n");
> +		break;
> +	case 0x700:
> +		puts("(Illegal Instruction)\n");
> +		break;
> +	case 0x800:
> +		puts("(External Interrupt)\n");
> +		break;
> +	case 0x900:
> +		puts("(D-TLB Miss)\n");
> +		break;
> +	case 0xa00:
> +		puts("(I-TLB Miss)\n");
> +		break;
> +	case 0xb00:
> +		puts("(Range)\n");
> +		break;
> +	case 0xc00:
> +		puts("(System Call)\n");
> +		break;
> +	case 0xd00:
> +		puts("(Floating Point)\n");
> +		break;
> +	case 0xe00:
> +		puts("(Trap)\n");
> +		break;
> +	default:
> +		puts("(Unknown exception)\n");
> +		break;
> +	}

looks like this could easily be a table string lookup:
static const char * const excp_table[] = {
	"Reset",
	"Bus Error",
	...
};
printf("(%s)\n", excp_table[(vect >> 16) & 0xff]);

> --- /dev/null
> +++ b/arch/openrisc/cpu/interrupts.c
>
> +#include <asm/types.h>
> +#include <asm/ptrace.h>
> +#include <asm/system.h>
> +#include <asm/openrisc_exc.h>
> +#include <common.h>

asm/ includes should come after non-asm/ includes
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111119/411f2c20/attachment.pgp>

  reply	other threads:[~2011-11-19  5:59 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-19  5:21 [U-Boot] [PATCH 0/9] Add support for the OpenRISC architecture Stefan Kristiansson
2011-11-19  5:21 ` [U-Boot] [PATCH 1/9] openrisc: Add architecture header files Stefan Kristiansson
2011-11-19  6:06   ` Mike Frysinger
2011-11-19  5:21 ` [U-Boot] [PATCH 2/9] openrisc: Add architecture image support Stefan Kristiansson
2011-11-21 22:45   ` Marek Vasut
2011-11-22  9:43     ` [U-Boot] [PATCH] Fix clash between IH_ARCH_NDS32 and IH_ARCH_SANDBOX Stefan Kristiansson
2011-11-22 11:03       ` [U-Boot] 回覆: " macpaul at andestech.com
2011-11-22 14:15         ` Marek Vasut
2011-11-23  6:10         ` Macpaul Lin
2011-11-19  5:21 ` [U-Boot] [PATCH 3/9] openrisc: Add cpu files Stefan Kristiansson
2011-11-19  5:59   ` Mike Frysinger [this message]
2011-11-20  4:27     ` Stefan Kristiansson
2011-11-20  5:27       ` Mike Frysinger
2011-11-21 22:50   ` Marek Vasut
2011-11-22  3:51     ` Stefan Kristiansson
2011-11-22  4:46       ` Marek Vasut
2011-11-22  7:17         ` Stefan Kristiansson
2011-11-22 14:07           ` Marek Vasut
2011-11-22 20:29             ` Scott Wood
2011-11-22 20:54         ` Mike Frysinger
2011-11-19  5:21 ` [U-Boot] [PATCH 4/9] openrisc: Add library functions Stefan Kristiansson
2011-11-19  6:04   ` Mike Frysinger
2011-11-21 22:52   ` Marek Vasut
2011-11-22  4:19     ` Stefan Kristiansson
2011-11-22  4:48       ` Marek Vasut
2011-11-22  6:00         ` Stefan Kristiansson
2011-11-22 14:10           ` Marek Vasut
2011-11-19  5:21 ` [U-Boot] [PATCH 5/9] openrisc: Add board info printout to cmd_bdinfo Stefan Kristiansson
2011-11-21 22:53   ` Marek Vasut
2011-11-22  4:30     ` Stefan Kristiansson
2011-11-22  4:49       ` Marek Vasut
2011-11-19  5:21 ` [U-Boot] [PATCH 6/9] openrisc: Add support for standalone programs Stefan Kristiansson
2011-11-19  5:21 ` [U-Boot] [PATCH 7/9] openrisc: Add openrisc-generic example board Stefan Kristiansson
2011-11-19  5:21 ` [U-Boot] [PATCH 8/9] openrisc: Add architecture to MAKEALL Stefan Kristiansson
2011-11-19  5:21 ` [U-Boot] [PATCH 9/9] openrisc: Add MAINTAINERS entry Stefan Kristiansson
2011-11-21 22:54   ` Marek Vasut
2011-11-22  4:32     ` Stefan Kristiansson
2011-11-19  6:07 ` [U-Boot] [PATCH 0/9] Add support for the OpenRISC architecture Mike Frysinger
2011-11-19  7:23   ` Stefan Kristiansson

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=201111190059.06923.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /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