From patchwork Sat Jun 8 03:14:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ken kuo X-Patchwork-Id: 249916 X-Patchwork-Delegate: macpaul@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 78F962C02C9 for ; Sat, 8 Jun 2013 13:20:32 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C6A8B4A03A; Sat, 8 Jun 2013 05:20:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cu9QF3BWqcFI; Sat, 8 Jun 2013 05:20:29 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CCDE44A02E; Sat, 8 Jun 2013 05:20:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 158B34A030 for ; Sat, 8 Jun 2013 05:20:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6XiCHjqw9e3H for ; Sat, 8 Jun 2013 05:20:15 +0200 (CEST) X-Greylist: delayed 324 seconds by postgrey-1.27 at theia; Sat, 08 Jun 2013 05:20:12 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=SKIP(-1.5) (only DNSBL check requested) Received: from mail-pb0-f48.google.com (mail-pb0-f48.google.com [209.85.160.48]) by theia.denx.de (Postfix) with ESMTPS id 6C38D4A02C for ; Sat, 8 Jun 2013 05:20:12 +0200 (CEST) Received: by mail-pb0-f48.google.com with SMTP id md4so5343974pbc.21 for ; Fri, 07 Jun 2013 20:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=a729QtoIWHDtQeLIbhcrH+vb8SaQFw5HsYBrxZ/M+S8=; b=Y3I5gjZ6Fj92anxLQwzaIvtau6NR32cO/spAEipCjHCK2PuMQ/Vje9/EqBNcPjUT3f DV+b9LOfjfO0DTlFSiMAs0EROwyZcvTXlY6CP0BxECSruS8gV7KX0VN7JBSruVB+tL27 rIyF7akeNUVKXYrZt6/55E7ddm95D467j+YvQw6gSai1OQ0Uaw+z7NKvQc4ep/BhxlH8 0itKZckX1EHc91Ohx+VrRAqkMnZD5Qwo2IR2+AHGzNqch8TZz1/DFJ5w/ORFW4QZ+DqN 1rmRveKaIK1nRkPlo3XHDnIqy2carjv05QhdT8Ctth6wquKxyIb4wG6QpnSoKku97gpH VWWQ== X-Received: by 10.68.44.169 with SMTP id f9mr1456270pbm.29.1370661293252; Fri, 07 Jun 2013 20:14:53 -0700 (PDT) Received: from localhost.localdomain (114-44-53-234.dynamic.hinet.net. [114.44.53.234]) by mx.google.com with ESMTPSA id xn5sm5120242pab.0.2013.06.07.20.14.50 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Jun 2013 20:14:52 -0700 (PDT) From: Kuan-Yu Kuo To: u-boot@lists.denx.de, wd@denx.de, dzu@denx.de Date: Sat, 8 Jun 2013 11:14:12 +0800 Message-Id: <1370661252-12156-4-git-send-email-ken.kuoky@gmail.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1370661252-12156-1-git-send-email-ken.kuoky@gmail.com> References: <1370661252-12156-1-git-send-email-ken.kuoky@gmail.com> Cc: uboot@andestech.com Subject: [U-Boot] [PATCH 4/4] nds32: Enable the function of passing parameters to Linux X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add a header file, setup.h, which copy from Linux source code, this file contain structures are used to pass initialisation parameters to Linux. Enable this function on adp-ag101/adp-ag101p target Signed-off-by: Kuan-Yu Kuo Cc: Macpaul Lin --- arch/nds32/include/asm/setup.h | 192 ++++++++++++++++++++++++++++++++++++++++ include/common.h | 1 + include/configs/adp-ag101.h | 7 ++ include/configs/adp-ag101p.h | 7 ++ 4 files changed, 207 insertions(+) create mode 100644 arch/nds32/include/asm/setup.h diff --git a/arch/nds32/include/asm/setup.h b/arch/nds32/include/asm/setup.h new file mode 100644 index 0000000..0a14ea0 --- /dev/null +++ b/arch/nds32/include/asm/setup.h @@ -0,0 +1,192 @@ +/* + * linux/arch/nds32/include/asm/setup.h + * + * Copyright (C) 1997-1999 Russell King + * Copyright (C) 2008 Andes Technology Corporation + * Copyright (C) 2013 Ken Kuo (ken_kuo@andestech.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Structure passed to kernel to tell it about the + * hardware it's running on. See Documentation/arm/Setup + * for more info. + */ +#ifndef __ASMNDS32_SETUP_H +#define __ASMNDS32_SETUP_H + +#define COMMAND_LINE_SIZE 256 + +/* The list ends with an ATAG_NONE node. */ +#define ATAG_NONE 0x00000000 + +struct tag_header { + u32 size; + u32 tag; +}; + +/* The list must start with an ATAG_CORE node */ +#define ATAG_CORE 0x54410001 + +struct tag_core { + u32 flags; /* bit 0 = read-only */ + u32 pagesize; + u32 rootdev; +}; + +/* it is allowed to have multiple ATAG_MEM nodes */ +#define ATAG_MEM 0x54410002 + +struct tag_mem32 { + u32 size; + u32 start; /* physical start address */ +}; + +/* VGA text type displays */ +#define ATAG_VIDEOTEXT 0x54410003 + +struct tag_videotext { + u8 x; + u8 y; + u16 video_page; + u8 video_mode; + u8 video_cols; + u16 video_ega_bx; + u8 video_lines; + u8 video_isvga; + u16 video_points; +}; + +/* describes how the ramdisk will be used in kernel */ +#define ATAG_RAMDISK 0x54410004 + +struct tag_ramdisk { + u32 flags; /* bit 0 = load, bit 1 = prompt */ + u32 size; /* decompressed ramdisk size in _kilo_ bytes */ + u32 start; /* starting block of floppy-based RAM disk image */ +}; + +/* + * this one accidentally used virtual addresses - as such, + * it's deprecated. + * describes where the compressed ramdisk image lives (virtual address) + */ +#define ATAG_INITRD 0x54410005 + +/* describes where the compressed ramdisk image lives (physical address) */ +#define ATAG_INITRD2 0x54420005 + +struct tag_initrd { + u32 start; /* physical start address */ + u32 size; /* size of compressed ramdisk image in bytes */ +}; + +/* board serial number. "64 bits should be enough for everybody" */ +#define ATAG_SERIAL 0x54410006 + +struct tag_serialnr { + u32 low; + u32 high; +}; + +/* board revision */ +#define ATAG_REVISION 0x54410007 + +struct tag_revision { + u32 rev; +}; + +/* initial values for vesafb-type framebuffers. see struct screen_info + * in include/linux/tty.h + */ +#define ATAG_VIDEOLFB 0x54410008 + +struct tag_videolfb { + u16 lfb_width; + u16 lfb_height; + u16 lfb_depth; + u16 lfb_linelength; + u32 lfb_base; + u32 lfb_size; + u8 red_size; + u8 red_pos; + u8 green_size; + u8 green_pos; + u8 blue_size; + u8 blue_pos; + u8 rsvd_size; + u8 rsvd_pos; +}; + +/* command line: \0 terminated string */ +#define ATAG_CMDLINE 0x54410009 + +struct tag_cmdline { + char cmdline[COMMAND_LINE_SIZE]; +}; + +struct tag { + struct tag_header hdr; + union { + struct tag_core core; + struct tag_mem32 mem; + struct tag_videotext videotext; + struct tag_ramdisk ramdisk; + struct tag_initrd initrd; + struct tag_serialnr serialnr; + struct tag_revision revision; + struct tag_videolfb videolfb; + struct tag_cmdline cmdline; + } u; +}; + +struct tagtable { + u32 tag; + int (*parse)(const struct tag *); +}; + +#define tag_member_present(tag, member) \ + ((unsigned long)(&((struct tag *)0L)->member + 1) \ + <= (tag)->hdr.size * 4) + +#define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) +#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) + +#define for_each_tag(t, base) \ + for (t = base; t->hdr.size; t = tag_next(t)) + +#ifdef __KERNEL__ + +#define __tag __used __attribute__((__section__(".taglist"))) +#define __tagtable(tag, fn) \ +static struct tagtable __tagtable_##fn __tag = { tag, fn } + +/* + * Memory map description + */ +#define NR_BANKS 8 + +struct meminfo { + int nr_banks; + struct { + unsigned long start; + unsigned long size; + int node; + } bank[NR_BANKS]; +}; + +/* + * Early command line parameters. + */ +struct early_params { + const char *arg; + void (*fn)(char **p); +}; + +#define __early_param(name, fn) \ +static struct early_params __early_##fn __used \ +__attribute__((__section__("__early_param"))) = { name, fn } + +#endif +#endif diff --git a/include/common.h b/include/common.h index 126891d..e130785 100644 --- a/include/common.h +++ b/include/common.h @@ -421,6 +421,7 @@ static inline int setenv_addr(const char *varname, const void *addr) #endif #ifdef CONFIG_NDS32 # include +# include # include #endif /* CONFIG_NDS32 */ #ifdef CONFIG_MIPS diff --git a/include/configs/adp-ag101.h b/include/configs/adp-ag101.h index 85dbad2..1c380ea 100644 --- a/include/configs/adp-ag101.h +++ b/include/configs/adp-ag101.h @@ -35,6 +35,13 @@ #define CONFIG_SKIP_LOWLEVEL_INIT +/* + * Definitions related to passing arguments to kernel. + */ +#define CONFIG_CMDLINE_TAG /* send commandline to Kernel */ +#define CONFIG_SETUP_MEMORY_TAGS /* send memory definition to kernel */ +#define CONFIG_INITRD_TAG /* send initrd params */ + #ifndef CONFIG_SKIP_LOWLEVEL_INIT #define CONFIG_MEM_REMAP #endif diff --git a/include/configs/adp-ag101p.h b/include/configs/adp-ag101p.h index 6085208..8748134 100644 --- a/include/configs/adp-ag101p.h +++ b/include/configs/adp-ag101p.h @@ -35,6 +35,13 @@ #define CONFIG_SKIP_LOWLEVEL_INIT +/* + * Definitions related to passing arguments to kernel. + */ +#define CONFIG_CMDLINE_TAG /* send commandline to Kernel */ +#define CONFIG_SETUP_MEMORY_TAGS /* send memory definition to kernel */ +#define CONFIG_INITRD_TAG /* send initrd params */ + #ifndef CONFIG_SKIP_LOWLEVEL_INIT #define CONFIG_MEM_REMAP #endif