Add explicit support YAMON firmware.
cover Add explicit support YAMON firmware.
From: "Steven J. Hill" <[email protected]>
YAMON support was implemented differently across a number of platforms. This change removes duplicated code and moves all of the YAMON firmware support into a single library.
Steven J. Hill (5):
MIPS: Add initial support for YAMON firmware.
MIPS: Clean up YAMON support for Alchemy platforms.
MIPS: Clean up YAMON support for PowerTV platform.
MIPS: Clean up YAMON support for PMC Sierra platforms.
MIPS: Clean up YAMON support for MIPS Malta and SEAD-3 platforms.
arch/mips/Kconfig | 8 ++ arch/mips/Makefile | 1 + arch/mips/alchemy/board-gpr.c | 2 +- arch/mips/alchemy/board-mtx1.c | 2 +- arch/mips/alchemy/board-xxs1500.c | 2 +- arch/mips/alchemy/common/prom.c | 39 ---------- arch/mips/alchemy/devboards/prom.c | 2 +- arch/mips/fw/yamon/Makefile | 5 ++ arch/mips/fw/yamon/cmdline.c | 68 ++++++++++++++++ arch/mips/include/asm/fw/yamon/yamon.h | 53 +++++++++++++ arch/mips/include/asm/mach-au1x00/prom.h | 12 --- arch/mips/include/asm/mips-boards/generic.h | 41 ++++------ arch/mips/include/asm/mips-boards/prom.h | 47 ----------- arch/mips/include/asm/mipsprom.h | 2 - .../mips/include/asm/pmc-sierra/msp71xx/msp_prom.h | 26 ------- arch/mips/mti-malta/Makefile | 2 +- arch/mips/mti-malta/malta-cmdline.c | 59 -------------- arch/mips/mti-malta/malta-display.c | 2 +- arch/mips/mti-malta/malta-init.c | 82 +------------------- arch/mips/mti-malta/malta-memory.c | 10 +-- arch/mips/mti-malta/malta-setup.c | 16 ++-- arch/mips/mti-malta/malta-time.c | 3 +- arch/mips/pmc-sierra/msp71xx/msp_prom.c | 76 +----------------- arch/mips/pmc-sierra/msp71xx/msp_setup.c | 2 +- arch/mips/powertv/init.c | 37 --------- 25 files changed, 174 insertions(+), 425 deletions(-) create mode 100644 arch/mips/fw/yamon/Makefile create mode 100644 arch/mips/fw/yamon/cmdline.c create mode 100644 arch/mips/include/asm/fw/yamon/yamon.h delete mode 100644 arch/mips/include/asm/mach-au1x00/prom.h delete mode 100644 arch/mips/include/asm/mips-boards/prom.h delete mode 100644 arch/mips/mti-malta/malta-cmdline.c
Signature · 1 line
1.7.10
PATCH 1/5 MIPS: Add initial support for YAMON firmware.
From: "Steven J. Hill" <[email protected]>
--- arch/mips/Kconfig | 8 ++++ arch/mips/Makefile | 1 + arch/mips/fw/yamon/Makefile | 5 +++ arch/mips/fw/yamon/cmdline.c | 68 ++++++++++++++++++++++++++++++++ arch/mips/include/asm/fw/yamon/yamon.h | 53 +++++++++++++++++++++++++ arch/mips/include/asm/mipsprom.h | 2 - 6 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 arch/mips/fw/yamon/Makefile create mode 100644 arch/mips/fw/yamon/cmdline.c create mode 100644 arch/mips/include/asm/fw/yamon/yamon.h
arch/mips/Kconfig +8 -0
@@ -58,6 +58,7 @@ config MIPS_ALCHEMY select SYS_SUPPORTS_ZBOOT select USB_ARCH_HAS_OHCI select USB_ARCH_HAS_EHCI + select YAMON config AR7 bool "Texas Instruments AR7"
@@ -299,6 +300,7 @@ config MIPS_MALTA select SYS_SUPPORTS_SMARTMIPS select SYS_SUPPORTS_ZBOOT select SYS_SUPPORTS_HIGHMEM + select YAMON help This enables support for the MIPS Technologies Malta evaluation board.
@@ -328,6 +330,7 @@ config MIPS_SEAD3 select USB_ARCH_HAS_EHCI select USB_EHCI_BIG_ENDIAN_DESC select USB_EHCI_BIG_ENDIAN_MMIO + select YAMON help This enables support for the MIPS Technologies SEAD3 evaluation board.
@@ -404,6 +407,7 @@ config PMC_MSP select IRQ_CPU select SERIAL_8250 select SERIAL_8250_CONSOLE + select YAMON help This adds support for the PMC-Sierra family of Multi-Service Processor System-On-A-Chips. These parts include a number
@@ -446,6 +450,7 @@ config POWERTV select SYS_SUPPORTS_BIG_ENDIAN select SYS_SUPPORTS_HIGHMEM select USB_OHCI_LITTLE_ENDIAN + select YAMON help This enables support for the Cisco PowerTV Platform.
@@ -974,6 +979,9 @@ config GPIO_TXX9 config CFE bool +config YAMON + bool + config ARCH_DMA_ADDR_T_64BIT def_bool (HIGHMEM && 64BIT_PHYS_ADDR) || 64BIT
arch/mips/Makefile +1 -0
@@ -177,6 +177,7 @@ endif libs-$(CONFIG_ARC) += arch/mips/fw/arc/ libs-$(CONFIG_CFE) += arch/mips/fw/cfe/ libs-$(CONFIG_SNIPROM) += arch/mips/fw/sni/ +libs-$(CONFIG_YAMON) += arch/mips/fw/yamon/ libs-y += arch/mips/fw/lib/ #
arch/mips/fw/yamon/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile for the YAMON prom monitor routines under Linux. +# + +lib-$(CONFIG_MIPS_BOARDS_GEN) += cmdline.o
arch/mips/fw/yamon/cmdline.c new file +68 -0
68 lines not on this page · raw message
arch/mips/include/asm/fw/yamon/yamon.h new file +53 -0
53 lines not on this page · raw message
arch/mips/include/asm/mipsprom.h +0 -2
@@ -71,6 +71,4 @@#define PROM_NV_GET 53/* XXX */ #define PROM_NV_SET 54/* XXX */ -extern char *prom_getenv (char *); -#endif /* __ASM_MIPSPROM_H */
Signature · 1 line
1.7.10
PATCH 2/5 MIPS: Clean up YAMON support for Alchemy platforms.
In reply to Steven J. HillFrom: "Steven J. Hill" <[email protected]>
--- arch/mips/alchemy/board-gpr.c | 2 +- arch/mips/alchemy/board-mtx1.c | 2 +- arch/mips/alchemy/board-xxs1500.c | 2 +- arch/mips/alchemy/common/prom.c | 39 ------------------------------ arch/mips/alchemy/devboards/prom.c | 2 +- arch/mips/include/asm/mach-au1x00/prom.h | 12 --------- 6 files changed, 4 insertions(+), 55 deletions(-) delete mode 100644 arch/mips/include/asm/mach-au1x00/prom.h
arch/mips/alchemy/board-gpr.c +1 -1
@@ -47,7 +47,7 @@ void __init prom_init(void) prom_argc = fw_arg0; prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; + _prom_envp = (int *)fw_arg2;prom_init_cmdline ();
arch/mips/alchemy/board-mtx1.c +1 -1
@@ -47,7 +47,7 @@ void __init prom_init(void) prom_argc = fw_arg0; prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; + _prom_envp = (int *)fw_arg2;prom_init_cmdline ();
arch/mips/alchemy/board-xxs1500.c +1 -1
@@ -44,7 +44,7 @@ void __init prom_init(void) prom_argc = fw_arg0; prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; + _prom_envp = (int *)fw_arg2;prom_init_cmdline ();
arch/mips/alchemy/common/prom.c +0 -39
@@ -36,47 +36,8 @@#include <linux/module.h> #include <linux/init.h> #include <linux/string.h> -#include <asm/bootinfo.h> -int prom_argc; -char **prom_argv; -char **prom_envp; - -void __init prom_init_cmdline (void ) -{ -int i; - -for (i =1 ; i < prom_argc; i++) { -strlcat (arcs_cmdline, prom_argv[i],COMMAND_LINE_SIZE ); -if (i < (prom_argc -1 )) -strlcat (arcs_cmdline," " ,COMMAND_LINE_SIZE ); - } -} - -char *prom_getenv (char *envname) -{ -/* -* Return a pointer to the given environment variable. -* YAMON uses "name", "value" pairs, while U-Boot uses "name=value". -*/ - -char **env = prom_envp; -int i =strlen (envname); -int yamon = (*env &&strchr (*env,'=' ) ==NULL ); - -while (*env) { -if (yamon) { -if (strcmp (envname, *env++) ==0 ) -return *env; - }else if (strncmp (envname, *env, i) ==0 && (*env)[i] =='=' ) -return *env + i +1 ; - env++; - } - -return NULL ; -} -static inline unsigned char str2hexnum (unsigned char c) {if (c >='0' && c <='9' )
arch/mips/alchemy/devboards/prom.c +1 -1
@@ -49,7 +49,7 @@ void __init prom_init(void) prom_argc = (int )fw_arg0; prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; + _prom_envp = (int *)fw_arg2;prom_init_cmdline (); memsize_str =prom_getenv ("memsize" );
arch/mips/include/asm/mach-au1x00/prom.h deleted +0 -12
@@ -1,12 +0,0 @@ -#ifndef __AU1X00_PROM_H -#define __AU1X00_PROM_H - -extern int prom_argc; -extern char **prom_argv; -extern char **prom_envp; - -extern void prom_init_cmdline (void ); -extern char *prom_getenv (char *envname); -extern int prom_get_ethernet_addr (char *ethernet_addr); - -#endif
Signature · 1 line
1.7.10
PATCH 3/5 MIPS: Clean up YAMON support for PowerTV platform.
In reply to Steven J. HillFrom: "Steven J. Hill" <[email protected]>
--- arch/mips/powertv/init.c | 37 ------------------------------------- 1 file changed, 37 deletions(-)
arch/mips/powertv/init.c +0 -37
@@ -33,42 +33,8 @@#include <asm/mips-boards/generic.h> #include <asm/mach-powertv/asic.h> -static int *_prom_envp;unsigned long _prom_memsize; -/* -* YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer. -* This macro take care of sign extension, if running in 64-bit mode. -*/ -#define prom_envp (index) ((char *)(long)_prom_envp[(index)]) - -char *prom_getenv (char *envname) -{ -char *result =NULL ; - -if (_prom_envp !=NULL ) { -/* -* Return a pointer to the given environment variable. -* In 64-bit mode: we're using 64-bit pointers, but all pointers -* in the PROM structures are only 32-bit, so we need some -* workarounds, if we are running in 64-bit mode. -*/ -int i, index =0 ; - - i =strlen (envname); - -while (prom_envp (index)) { -if (strncmp (envname,prom_envp (index), i) ==0 ) { - result =prom_envp (index +1 ); -break ; - } - index +=2 ; - } - } - -return result; -} -/* TODO: Verify on linux-mips mailing list that the following two */ /* functions are correct */ /* TODO: Copy NMI and EJTAG exception vectors to memory from the */
@@ -105,9 +71,6 @@ static void __init mips_ejtag_setup(void)void __init prom_init (void ) { -int prom_argc; -char *prom_argv; - prom_argc = fw_arg0; prom_argv = (char *) fw_arg1; _prom_envp = (int *) fw_arg2;
Signature · 1 line
1.7.10
PATCH 4/5 MIPS: Clean up YAMON support for PMC Sierra platforms.
In reply to Steven J. HillFrom: "Steven J. Hill" <[email protected]>
--- .../mips/include/asm/pmc-sierra/msp71xx/msp_prom.h | 26 ------- arch/mips/pmc-sierra/msp71xx/msp_prom.c | 76 +------------------- arch/mips/pmc-sierra/msp71xx/msp_setup.c | 2 +- 3 files changed, 3 insertions(+), 101 deletions(-)
arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h +0 -26
@@ -118,13 +118,6 @@#define ZSP_DUET 'D'/* one DUET zsp engine */ #define ZSP_TRIAD 'T'/* two TRIAD zsp engines */ -extern char *prom_getenv (char *name); -extern void prom_init_cmdline (void ); -extern void prom_meminit (void ); -extern void prom_fixup_mem_map (unsigned long start_mem, -unsigned long end_mem); - -extern int get_ethernet_addr (char *ethaddr_name,char *ethernet_addr);extern unsigned long get_deviceid (void );extern char identify_enet (unsigned long interface_num);extern char identify_enetTxD (unsigned long interface_num);
@@ -147,25 +140,6 @@ extern unsigned long identify_revision(void); printk(_f, ## x); \ } while (0) -/* Memory descriptor management. */ -#define PROM_MAX_PMEMBLOCKS 7/* 6 used */ - -enum yamon_memtypes { - yamon_dontuse, - yamon_prom, - yamon_free, -}; - -struct prom_pmemblock { -unsigned long base;/* Within KSEG0. */ -unsigned int size;/* In bytes. */ -unsigned int type;/* free or prom memory */ -}; - -extern int prom_argc; -extern char **prom_argv; -extern char **prom_envp;extern int *prom_vec; -extern struct prom_pmemblock *prom_getmdesc (void );#endif /* !_ASM_MSP_PROM_H */
arch/mips/pmc-sierra/msp71xx/msp_prom.c +2 -74
98 lines not on this page · raw message
arch/mips/pmc-sierra/msp71xx/msp_setup.c +1 -1
@@ -156,7 +156,7 @@ void __init prom_init(void) prom_argc = fw_arg0; prom_argv = (char **)fw_arg1; - prom_envp = (char **)fw_arg2; + _prom_envp = (int *)fw_arg2;/* * Someday we can use this with PMON2000 to get a
Signature · 1 line
1.7.10
PATCH 5/5 MIPS: Clean up YAMON support for MIPS Malta and SEAD-3 platforms.
In reply to Steven J. HillFrom: "Steven J. Hill" <[email protected]>
--- arch/mips/include/asm/mips-boards/generic.h | 41 ++++++-------- arch/mips/include/asm/mips-boards/prom.h | 47 --------------- arch/mips/mti-malta/Makefile | 2 +- arch/mips/mti-malta/malta-cmdline.c | 59 ------------------- arch/mips/mti-malta/malta-display.c | 2 +- arch/mips/mti-malta/malta-init.c | 82 +-------------------------- arch/mips/mti-malta/malta-memory.c | 10 +--- arch/mips/mti-malta/malta-setup.c | 16 +++--- arch/mips/mti-malta/malta-time.c | 3 +- 9 files changed, 32 insertions(+), 230 deletions(-) delete mode 100644 arch/mips/include/asm/mips-boards/prom.h delete mode 100644 arch/mips/mti-malta/malta-cmdline.c
arch/mips/include/asm/mips-boards/generic.h +17 -24
@@ -1,21 +1,10 @@/* -* Carsten Langgaard, [email protected] -* Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. -* -* This program is free software; you can distribute it and/or modify it -* under the terms of the GNU General Public License (Version 2) as -* published by the Free Software Foundation. -* -* This program is distributed in the hope it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive * for more details. * -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. -* -* Defines of the MIPS boards specific address-MAP, registers, etc. +* Copyright (C) 2000-2012 MIPS Technologies, Inc. +* Copyright (C) 2000-2012 MIPS Technologies, Inc. */ #ifndef __ASM_MIPS_BOARDS_GENERIC_H#define __ASM_MIPS_BOARDS_GENERIC_H
@@ -30,18 +19,20 @@#define ASCII_DISPLAY_WORD_BASE 0x1f000410#define ASCII_DISPLAY_POS_BASE 0x1f000418 - -/* -* Yamon Prom print address. -*/ -#define YAMON_PROM_PRINT_ADDR 0x1fc00504 - -/* * Reset register. */ -#define SOFTRES_REG 0x1f000500 -#define GORESET 0x42 +#ifdef CONFIG_MIPS_MALTA +#define SOFTRES_REG 0x1f000500 +#define GORESET 0x42 +#else +#ifdef CONFIG_MIPS_SEAD3 +#define SOFTRES_REG 0x1f000050 +#define GORESET 0x4d +#else +#error No reset register defined for this platform. +#endif +#endif /* * Revision register.
@@ -97,4 +88,6 @@ extern void mips_pcibios_init(void);extern void kgdb_config (void );#endif +extern void mips_scroll_message (void ); +#endif /* __ASM_MIPS_BOARDS_GENERIC_H */
arch/mips/include/asm/mips-boards/prom.h deleted +0 -47
47 lines not on this page · raw message
arch/mips/mti-malta/Makefile +1 -1
@@ -5,7 +5,7 @@ # Copyright (C) 2008 Wind River Systems, Inc. # written by Ralf Baechle <[email protected]> # -obj-y := malta-amon.o malta-cmdline.o \ +obj-y := malta-amon.o \ malta-display.o malta-init.o malta-int.o \ malta-memory.o malta-platform.o \ malta-reset.o malta-setup.o malta-time.o
arch/mips/mti-malta/malta-cmdline.c deleted +0 -59
59 lines not on this page · raw message
arch/mips/mti-malta/malta-display.c +1 -1
@@ -22,7 +22,7 @@#include <linux/timer.h> #include <asm/io.h> #include <asm/mips-boards/generic.h> -#include <asm/mips-boards/prom.h> +#include <asm/fw/yamon/yamon.h> extern const char display_string[];static unsigned int display_count;
arch/mips/mti-malta/malta-init.c +2 -80
99 lines not on this page · raw message
arch/mips/mti-malta/malta-memory.c +2 -8
@@ -27,16 +27,10 @@#include <asm/bootinfo.h> #include <asm/page.h> #include <asm/sections.h> - -#include <asm/mips-boards/prom.h> +#include <asm/fw/yamon/yamon.h> /*#define DEBUG*/ -enum yamon_memtypes { - yamon_dontuse, - yamon_prom, - yamon_free, -};static struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS ];#ifdef DEBUG
@@ -50,7 +44,7 @@ static char *mtypes[3] = {/* determined physical memory size, not overridden by command line args */ unsigned long physical_memsize =0L ; -static struct prom_pmemblock *__init prom_getmdesc (void ) +struct prom_pmemblock *__init prom_getmdesc (void ) {char *memsize_str;unsigned int memsize;
arch/mips/mti-malta/malta-setup.c +8 -8
@@ -22,20 +22,20 @@#include <linux/ioport.h> #include <linux/irq.h> #include <linux/pci.h> -#include <linux/screen_info.h> #include <linux/time.h> +#ifdef CONFIG_VT +#include <linux/console.h> +#endif +#include <linux/screen_info.h> #include <asm/bootinfo.h> -#include <asm/mips-boards/generic.h> -#include <asm/mips-boards/prom.h> -#include <asm/mips-boards/malta.h> -#include <asm/mips-boards/maltaint.h> #include <asm/dma.h> #include <asm/traps.h> #include <asm/gcmpregs.h> -#ifdef CONFIG_VT -#include <linux/console.h> -#endif +#include <asm/mips-boards/generic.h> +#include <asm/mips-boards/malta.h> +#include <asm/mips-boards/maltaint.h> +#include <asm/fw/yamon/yamon.h> extern void malta_be_init (void );extern int malta_be_handler (struct pt_regs *regs,int is_fixup);
arch/mips/mti-malta/malta-time.c +1 -2
@@ -42,9 +42,8 @@#include <asm/gic.h> #include <asm/mips-boards/generic.h> -#include <asm/mips-boards/prom.h> -#include <asm/mips-boards/maltaint.h> +#include <asm/fw/yamon/yamon.h> unsigned long cpu_khz;
Signature · 1 line
1.7.10
Quoted 1 line · Steven J. Hill
25 files changed, 174 insertions(+), 425 deletions(-)
I like the diffstat. 251 lines less can't be that wrong :)
I'll leave that patch pending for a few days so the owners of that other board support code have a chance to comment.
Ralf
Quoted 3 lines · Ralf Baechle
Quoted 1 line
25 files changed, 174 insertions(+), 425 deletions(-)I like the diffstat. 251 lines less can't be that wrong :)
FWIW, I concur, good work!
Maciej
On Wed, May 30, 2012 at 05:10:50PM -0500, Steven J. Hill wrote:
Now for the nitpicking :-)
ar7_defconfig breaks with:
CC arch/mips/ar7/memory.o/home/ralf/src/linux/upstream-sfr/arch/mips/ar7/memory.c:33:34: fatal error: asm/mips-boards/prom.h: No such file or directory compilation terminated.
make[4]: *** [arch/mips/ar7/memory.o] Error 1
db1000_defconfig, db1200_defconfig, db1300_defconfig and db1550_defconfig breaks with:
CC arch/mips/alchemy/common/prom.o/home/ralf/src/linux/upstream-sfr/arch/mips/alchemy/common/prom.c: In function ‘prom_get_ethernet_addr’:/home/ralf/src/linux/upstream-sfr/arch/mips/alchemy/common/prom.c:73:2: error: implicit declaration of function ‘prom_getenv’ [-Werror=implicit-function-declaration] /home/ralf/src/linux/upstream-sfr/arch/mips/alchemy/common/prom.c:73:14: error: assignment makes pointer from integer without a cast [-Werror]
cc1: all warnings being treated as errors
make[4]: *** [arch/mips/alchemy/common/prom.o] Error 1
Test build still running - ENEEDMOREHORSEPOWER ;-) So far bcm63xx_defconfig, capcella_defconfig and cavium-octeon_defconfig build ok.
Quoted 1 line
arch/mips/include/asm/mipsprom.h | 2 -
This is the firmware used by the systems built by MIPS Computer Systems Inc. and a few very old SGI pre-ARC(S) systems, also some by Pyramid, Siemens-Nixdorf and others. It has nothing to do with YAMON.
Quoted 3 lines
.../mips/include/asm/pmc-sierra/msp71xx/msp_prom.h | 26 ------- arch/mips/pmc-sierra/msp71xx/msp_prom.c | 76 +----------------- arch/mips/pmc-sierra/msp71xx/msp_setup.c | 2 +-
And these use PMON 2000. That you found possibilities to share code beyond YAMON's realm is good but infecting non-YAMON platforms with YAMON headers isn't. I suggest to gather code that can kind of code in arch/mips/lib or a new directory arch/mips/fw/lib.
Ralf