linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Mark Salter <msalter@redhat.com>
Cc: linux-arch@vger.kernel.org
Subject: Re: [PATCH 05/24] C6X: early boot code
Date: Tue, 9 Aug 2011 21:26:47 +0200	[thread overview]
Message-ID: <20110809192647.GB18124@merkur.ravnborg.org> (raw)
In-Reply-To: <1312839879-13592-6-git-send-email-msalter@redhat.com>

> +;
> +#include <linux/linkage.h>
> +#include <linux/of_fdt.h>
> +#include <asm/asm-offsets.h>
> +

I would expect this code to be part of the head section:

Use __HEAD

> +ENTRY(_c_int00)
> +	;; Save magic and pointer
> +	MV	.S1	A4,A10
> +	MV	.S2	B4,B10
> +	MVKL	.S2	__bss_start,B5
> +	MVKH	.S2	__bss_start,B5
> +	MVKL	.S2	__bss_stop,B6
> +	MVKH	.S2	__bss_stop,B6
> +	SUB	.L2	B6,B5,B6 ; bss size
> +
> +	;; Set the stack pointer
> +	MVKL	.S2	current_ksp,B0
> +	MVKH	.S2	current_ksp,B0
> +	LDW	.D2T2	*B0,B15
> +
> +	;; clear bss
> +	SHR	.S2	B6,3,B0	  ; number of dwords to clear
> +	ZERO	.L2	B13
> +	ZERO	.L2	B12
> +bss_loop:
> +	BDEC	.S2	bss_loop,B0
> +	NOP	3
> +	CMPLT	.L2	B0,0,B1
> + [!B1]	STDW	.D2T2	B13:B12,*B5++[1]
> +
> +	NOP	4
> +	AND	.D2	~7,B15,B15
> +
> +	;; Clear GIE and PGIE
> +	MVC	.S2	CSR,B2
> +	CLR	.S2	B2,0,1,B2
> +	MVC	.S2	B2,CSR
> +	MVC	.S2	TSR,B2
> +	CLR	.S2	B2,0,1,B2
> +	MVC	.S2	B2,TSR
> +	MVC	.S2	ITSR,B2
> +	CLR	.S2	B2,0,1,B2
> +	MVC	.S2	B2,ITSR
> +	MVC	.S2	NTSR,B2
> +	CLR	.S2	B2,0,1,B2
> +	MVC	.S2	B2,NTSR
> +
> +	;; pass DTB pointer to machine_init (or zero if none)
> +	MVKL	.S1	OF_DT_HEADER,A0
> +	MVKH	.S1	OF_DT_HEADER,A0
> +	CMPEQ	.L1	A10,A0,A0
> +  [A0]	MV	.S1X	B10,A4
> +  [!A0] MVK	.S1	0,A4
> +
> +#ifdef CONFIG_BIG_KERNEL
> +	MVKL	.S1	machine_init,A0
> +	MVKH	.S1	machine_init,A0
> +	B	.S2X	A0
> +	ADDKPC  .S2     0f,B3,4
> +0:
> +#else
> +	CALLP	.S2	machine_init,B3
> +#endif
> +
> +	;; Jump to Linux init
> +#ifdef CONFIG_BIG_KERNEL
> +	MVKL	.S1	start_kernel,A0
> +	MVKH	.S1	start_kernel,A0
> +	B	.S2X	A0
> +#else
> +	B	.S2	start_kernel
> +#endif
> +	NOP	5
> +L1:	BNOP	.S2	L1,5
> diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c
> +#include <linux/of.h>
> +#include <linux/of_fdt.h>
> +#include <linux/kernel.h>
> +#include <linux/sched.h>
> +#include <linux/delay.h>
> +#include <linux/interrupt.h>
> +#include <linux/fs.h>
> +#include <linux/genhd.h>
> +#include <linux/errno.h>
> +#include <linux/console.h>
> +#include <linux/string.h>
> +#include <linux/delay.h>
> +#include <linux/bootmem.h>
> +#include <linux/seq_file.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/mm.h>
> +#include <linux/clk.h>
> +#include <linux/io.h>
> +#include <linux/cache.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/memblock.h>

For C files we sometimes use "inverse christmas tree" sort for include lists.
That is:
longest lines first.
And sorted alphabetically within blocks of equal length.

This would also make it obvious had you had two identical include files.

> +#include <asm/setup.h>
> +#include <asm/irq.h>
> +#include <asm/machdep.h>
> +#include <asm/sections.h>
> +#include <asm/soc.h>
> +
> +#ifdef CONFIG_BLK_DEV_INITRD
> +#include <linux/initrd.h>
> +#include <asm/pgtable.h>
> +#endif

Do these include really need to be guarded?


> +
> +#ifdef DEBUG
> +#define DBG(fmt...) printk(KERN_ERR fmt)
> +#else
> +#define DBG(fmt...)
> +#endif

Drop this. It is used in one place - which I think
is not a debug info anyway.

> +	/* What can we do if we didn't find ? */
> +	if (machine_id >= &__machine_desc_end) {
> +		DBG("No suitable machine found !\n");
> +		for (;;)
> +			;
We stop in a never ending loop.
So debug seems not appropriate...

> 

  parent reply	other threads:[~2011-08-09 19:26 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-08 21:44 [PATCH 00/24] C6X: New architecture patch set Mark Salter
2011-08-08 21:44 ` [PATCH 01/24] fix default __strnlen_user macro Mark Salter
2011-08-08 21:44 ` [PATCH 02/24] fixed generic page.h for non-zero PAGE_OFFSET Mark Salter
2011-08-09 15:11   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 03/24] add ELF machine define for TI C6X DSPs Mark Salter
2011-08-09 15:12   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 04/24] C6X: build infrastructure Mark Salter
2011-08-09 15:21   ` Arnd Bergmann
2011-08-09 15:56     ` Mark Salter
2011-08-09 19:17   ` Sam Ravnborg
2011-08-08 21:44 ` [PATCH 05/24] C6X: early boot code Mark Salter
2011-08-09 16:12   ` Arnd Bergmann
2011-08-09 19:26   ` Sam Ravnborg [this message]
2011-08-08 21:44 ` [PATCH 06/24] C6X: devicetree Mark Salter
2011-08-09 16:14   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 07/24] C6X: memory management Mark Salter
2011-08-09 16:27   ` Arnd Bergmann
2011-08-17 13:26     ` Mark Salter
2011-08-17 13:34       ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 08/24] C6X: process management Mark Salter
2011-08-09 16:31   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 09/24] C6X: signal management Mark Salter
2011-08-08 21:44 ` [PATCH 10/24] C6X: time management Mark Salter
2011-08-09 16:35   ` Arnd Bergmann
2011-08-17 13:15     ` Mark Salter
2011-08-17 13:31       ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 11/24] C6X: interrupt handling Mark Salter
2011-08-09 16:39   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 12/24] C6X: syscalls Mark Salter
2011-08-09 16:47   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 13/24] C6X: traps Mark Salter
2011-08-08 21:44 ` [PATCH 14/24] C6X: clocks Mark Salter
2011-08-08 21:44 ` [PATCH 15/24] C6X: cache control Mark Salter
2011-08-09 16:53   ` Arnd Bergmann
2011-08-09 17:03   ` David Howells
2011-08-10  9:38     ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 16/24] C6X: module support Mark Salter
2011-08-09 16:56   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 17/24] C6X: ptrace support Mark Salter
2011-08-09 16:58   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 18/24] C6X: headers Mark Salter
2011-08-08 21:44 ` [PATCH 19/24] C6X: library code Mark Salter
2011-08-08 21:44 ` [PATCH 20/24] C6X: general machine and SoC support Mark Salter
2011-08-08 21:44 ` [PATCH 21/24] C6X: specific " Mark Salter
2011-08-08 21:44 ` [PATCH 22/24] C6X: specific board support Mark Salter
2011-08-09 17:04   ` Arnd Bergmann
2011-08-09 17:16     ` Mark Salter
2011-08-10 14:26       ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 23/24] C6X: miscellaneous low-level SoC support Mark Salter
2011-08-09 17:10   ` Arnd Bergmann
2011-08-08 21:44 ` [PATCH 24/24] C6X: MAINTAINERS Mark Salter
  -- strict thread matches above, loose matches on Subject: below --
2011-08-22 20:09 [PATCH v2 00/24] C6X: New architecture patch set Mark Salter
2011-08-22 20:09 ` [PATCH 05/24] C6X: early boot code Mark Salter

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=20110809192647.GB18124@merkur.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=msalter@redhat.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).