* [PATCH 1/5] MIPS: Add initial support for YAMON firmware.
2012-05-30 22:10 [PATCH 0/5] Add explicit support YAMON firmware Steven J. Hill
@ 2012-05-30 22:10 ` Steven J. Hill
2012-05-30 22:10 ` [PATCH 2/5] MIPS: Clean up YAMON support for Alchemy platforms Steven J. Hill
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Steven J. Hill @ 2012-05-30 22:10 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Steven J. Hill
From: "Steven J. Hill" <sjhill@mips.com>
Signed-off-by: Steven J. Hill <sjhill@mips.com>
---
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
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index df08343..143add4 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -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
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 363d8c8..0e468ad 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -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/
#
diff --git a/arch/mips/fw/yamon/Makefile b/arch/mips/fw/yamon/Makefile
new file mode 100644
index 0000000..bd934bd
--- /dev/null
+++ b/arch/mips/fw/yamon/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the YAMON prom monitor routines under Linux.
+#
+
+lib-$(CONFIG_MIPS_BOARDS_GEN) += cmdline.o
diff --git a/arch/mips/fw/yamon/cmdline.c b/arch/mips/fw/yamon/cmdline.c
new file mode 100644
index 0000000..6d62abf
--- /dev/null
+++ b/arch/mips/fw/yamon/cmdline.c
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2012 MIPS Technologies, Inc.
+ */
+#include <linux/init.h>
+#include <linux/string.h>
+#include <asm/bootinfo.h>
+#include <asm/fw/yamon/yamon.h>
+
+int prom_argc;
+int *_prom_argv;
+int *_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 * __init prom_getcmdline(void)
+{
+ return &(arcs_cmdline[0]);
+}
+
+char *prom_getenv(char *envname)
+{
+ char *result = NULL;
+
+ if (_prom_envp != NULL) {
+ /*
+ * Return a pointer to the given environment variable.
+ * YAMON uses "name", "value" pairs, while U-Boot uses
+ * "name=value".
+ */
+ int i, yamon, index = 0;
+
+ yamon = (strchr(prom_envp(index), '=') == NULL);
+ i = strlen(envname);
+
+ while (prom_envp(index)) {
+ if (strncmp(envname, prom_envp(index), i) == 0) {
+ if (yamon) {
+ result = prom_envp(index + 1);
+ break;
+ } else if (prom_envp(index)[i] == '=') {
+ result = (prom_envp(index + 1) + i);
+ break;
+ }
+ }
+
+ /* Increment array index. */
+ if (yamon)
+ index += 2;
+ else
+ index += 1;
+ }
+ }
+
+ return result;
+}
diff --git a/arch/mips/include/asm/fw/yamon/yamon.h b/arch/mips/include/asm/fw/yamon/yamon.h
new file mode 100644
index 0000000..f15d157
--- /dev/null
+++ b/arch/mips/include/asm/fw/yamon/yamon.h
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2012 MIPS Technologies, Inc.
+ */
+#ifndef _MIPS_YAMON_H_
+#define _MIPS_YAMON_H_
+
+enum yamon_memtypes {
+ yamon_dontuse,
+ yamon_prom,
+ yamon_free,
+};
+
+struct prom_pmemblock {
+ unsigned long base; /* Within KSEG0 */
+ unsigned int size; /* Bytes */
+ unsigned int type; /* yamon_memtypes */
+};
+
+/*
+ * YAMON print address.
+ */
+#define YAMON_PROM_PRINT_ADDR 0x1fc00504
+
+/* Memory descriptor management. */
+#ifdef CONFIG_PMC_MSP
+#define PROM_MAX_PMEMBLOCKS 7 /* Only 6 are actually used */
+#else
+#define PROM_MAX_PMEMBLOCKS 32 /* Default */
+#endif
+
+extern int prom_argc;
+extern int *_prom_argv;
+extern int *_prom_envp;
+
+/*
+ * YAMON (32-bit PROM) passes arguments and environment as a
+ * 32-bit pointer. This macro takes care of sign extension.
+ */
+#define prom_argv(index) ((char *)(long)_prom_argv[(index)])
+#define prom_envp(index) ((char *)(long)_prom_envp[(index)])
+
+extern void prom_init_cmdline(void);
+extern char *prom_getcmdline(void);
+extern struct prom_pmemblock *prom_getmdesc(void);
+extern void prom_meminit(void);
+extern void prom_init_early_console(char port);
+extern char *prom_getenv(char *name);
+
+#endif /* _MIPS_YAMON_H_ */
diff --git a/arch/mips/include/asm/mipsprom.h b/arch/mips/include/asm/mipsprom.h
index e93943f..406a866 100644
--- a/arch/mips/include/asm/mipsprom.h
+++ b/arch/mips/include/asm/mipsprom.h
@@ -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 */
--
1.7.10
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/5] MIPS: Clean up YAMON support for Alchemy platforms.
2012-05-30 22:10 [PATCH 0/5] Add explicit support YAMON firmware Steven J. Hill
2012-05-30 22:10 ` [PATCH 1/5] MIPS: Add initial support for " Steven J. Hill
@ 2012-05-30 22:10 ` Steven J. Hill
2012-05-30 22:10 ` [PATCH 3/5] MIPS: Clean up YAMON support for PowerTV platform Steven J. Hill
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Steven J. Hill @ 2012-05-30 22:10 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Steven J. Hill
From: "Steven J. Hill" <sjhill@mips.com>
Signed-off-by: Steven J. Hill <sjhill@mips.com>
---
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
diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c
index ba32590..942206d 100644
--- a/arch/mips/alchemy/board-gpr.c
+++ b/arch/mips/alchemy/board-gpr.c
@@ -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();
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c
index 295f1a9..40bc647 100644
--- a/arch/mips/alchemy/board-mtx1.c
+++ b/arch/mips/alchemy/board-mtx1.c
@@ -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();
diff --git a/arch/mips/alchemy/board-xxs1500.c b/arch/mips/alchemy/board-xxs1500.c
index bd55136..52a651d 100644
--- a/arch/mips/alchemy/board-xxs1500.c
+++ b/arch/mips/alchemy/board-xxs1500.c
@@ -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();
diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/prom.c
index 5340210..eeefd97 100644
--- a/arch/mips/alchemy/common/prom.c
+++ b/arch/mips/alchemy/common/prom.c
@@ -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')
diff --git a/arch/mips/alchemy/devboards/prom.c b/arch/mips/alchemy/devboards/prom.c
index 93a2210..b6e9e02 100644
--- a/arch/mips/alchemy/devboards/prom.c
+++ b/arch/mips/alchemy/devboards/prom.c
@@ -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");
diff --git a/arch/mips/include/asm/mach-au1x00/prom.h b/arch/mips/include/asm/mach-au1x00/prom.h
deleted file mode 100644
index 4c0e09c..0000000
--- a/arch/mips/include/asm/mach-au1x00/prom.h
+++ /dev/null
@@ -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
--
1.7.10
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 3/5] MIPS: Clean up YAMON support for PowerTV platform.
2012-05-30 22:10 [PATCH 0/5] Add explicit support YAMON firmware Steven J. Hill
2012-05-30 22:10 ` [PATCH 1/5] MIPS: Add initial support for " Steven J. Hill
2012-05-30 22:10 ` [PATCH 2/5] MIPS: Clean up YAMON support for Alchemy platforms Steven J. Hill
@ 2012-05-30 22:10 ` Steven J. Hill
2012-05-30 22:10 ` [PATCH 4/5] MIPS: Clean up YAMON support for PMC Sierra platforms Steven J. Hill
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Steven J. Hill @ 2012-05-30 22:10 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Steven J. Hill
From: "Steven J. Hill" <sjhill@mips.com>
Signed-off-by: Steven J. Hill <sjhill@mips.com>
---
arch/mips/powertv/init.c | 37 -------------------------------------
1 file changed, 37 deletions(-)
diff --git a/arch/mips/powertv/init.c b/arch/mips/powertv/init.c
index 1cf5abb..d8c6c0b 100644
--- a/arch/mips/powertv/init.c
+++ b/arch/mips/powertv/init.c
@@ -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;
--
1.7.10
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 4/5] MIPS: Clean up YAMON support for PMC Sierra platforms.
2012-05-30 22:10 [PATCH 0/5] Add explicit support YAMON firmware Steven J. Hill
` (2 preceding siblings ...)
2012-05-30 22:10 ` [PATCH 3/5] MIPS: Clean up YAMON support for PowerTV platform Steven J. Hill
@ 2012-05-30 22:10 ` Steven J. Hill
2012-05-30 22:10 ` [PATCH 5/5] MIPS: Clean up YAMON support for MIPS Malta and SEAD-3 platforms Steven J. Hill
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Steven J. Hill @ 2012-05-30 22:10 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Steven J. Hill
From: "Steven J. Hill" <sjhill@mips.com>
Signed-off-by: Steven J. Hill <sjhill@mips.com>
---
.../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(-)
diff --git a/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h b/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
index 786d82d..c9bc42f 100644
--- a/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
+++ b/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
@@ -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 */
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_prom.c b/arch/mips/pmc-sierra/msp71xx/msp_prom.c
index db00deb..a0f4fb6 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_prom.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_prom.c
@@ -46,13 +46,12 @@
#include <asm/bootinfo.h>
#include <asm-generic/sections.h>
#include <asm/page.h>
+#include <asm/fw/yamon/yamon.h>
#include <msp_prom.h>
#include <msp_regs.h>
-/* global PROM environment variables and pointers */
-int prom_argc;
-char **prom_argv, **prom_envp;
+/* Global PROM vector */
int *prom_vec;
/* debug flag */
@@ -137,35 +136,6 @@ const char *get_system_type(void)
#endif
}
-int get_ethernet_addr(char *ethaddr_name, char *ethernet_addr)
-{
- char *ethaddr_str;
-
- ethaddr_str = prom_getenv(ethaddr_name);
- if (!ethaddr_str) {
- printk(KERN_WARNING "%s not set in boot prom\n", ethaddr_name);
- return -1;
- }
-
- if (str2eaddr(ethernet_addr, ethaddr_str) == -1) {
- printk(KERN_WARNING "%s badly formatted-<%s>\n",
- ethaddr_name, ethaddr_str);
- return -1;
- }
-
- if (init_debug > 1) {
- int i;
- printk(KERN_DEBUG "get_ethernet_addr: for %s ", ethaddr_name);
- for (i = 0; i < 5; i++)
- printk(KERN_DEBUG "%02x:",
- (unsigned char)*(ethernet_addr+i));
- printk(KERN_DEBUG "%02x\n", *(ethernet_addr+i));
- }
-
- return 0;
-}
-EXPORT_SYMBOL(get_ethernet_addr);
-
static char *get_features(void)
{
char *feature = prom_getenv(FEATURES);
@@ -281,48 +251,6 @@ unsigned long identify_revision(void)
}
EXPORT_SYMBOL(identify_revision);
-/* PROM environment functions */
-char *prom_getenv(char *env_name)
-{
- /*
- * Return a pointer to the given environment variable. prom_envp
- * points to a null terminated array of pointers to variables.
- * Environment variables are stored in the form of "memsize=64"
- */
-
- char **var = prom_envp;
- int i = strlen(env_name);
-
- while (*var) {
- if (strncmp(env_name, *var, i) == 0) {
- return (*var + strlen(env_name) + 1);
- }
- var++;
- }
-
- return NULL;
-}
-
-/* PROM commandline functions */
-void __init prom_init_cmdline(void)
-{
- char *cp;
- int actr;
-
- actr = 1; /* Always ignore argv[0] */
-
- cp = &(arcs_cmdline[0]);
- while (actr < prom_argc) {
- strcpy(cp, prom_argv[actr]);
- cp += strlen(prom_argv[actr]);
- *cp++ = ' ';
- actr++;
- }
- if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
- --cp;
- *cp = '\0';
-}
-
/* memory allocation functions */
static int __init prom_memtype_classify(unsigned int type)
{
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_setup.c b/arch/mips/pmc-sierra/msp71xx/msp_setup.c
index 7a834b2..fce1cbf 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_setup.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_setup.c
@@ -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
--
1.7.10
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 5/5] MIPS: Clean up YAMON support for MIPS Malta and SEAD-3 platforms.
2012-05-30 22:10 [PATCH 0/5] Add explicit support YAMON firmware Steven J. Hill
` (3 preceding siblings ...)
2012-05-30 22:10 ` [PATCH 4/5] MIPS: Clean up YAMON support for PMC Sierra platforms Steven J. Hill
@ 2012-05-30 22:10 ` Steven J. Hill
2012-05-30 23:47 ` [PATCH 0/5] Add explicit support YAMON firmware Ralf Baechle
2012-05-31 8:29 ` Ralf Baechle
6 siblings, 0 replies; 9+ messages in thread
From: Steven J. Hill @ 2012-05-30 22:10 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Steven J. Hill
From: "Steven J. Hill" <sjhill@mips.com>
Signed-off-by: Steven J. Hill <sjhill@mips.com>
---
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
diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
index 46c0856..3afa531 100644
--- a/arch/mips/include/asm/mips-boards/generic.h
+++ b/arch/mips/include/asm/mips-boards/generic.h
@@ -1,21 +1,10 @@
/*
- * Carsten Langgaard, carstenl@mips.com
- * 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 */
diff --git a/arch/mips/include/asm/mips-boards/prom.h b/arch/mips/include/asm/mips-boards/prom.h
deleted file mode 100644
index a9db576..0000000
--- a/arch/mips/include/asm/mips-boards/prom.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Carsten Langgaard, carstenl@mips.com
- * 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
- * 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.
- *
- * ########################################################################
- *
- * MIPS boards bootprom interface for the Linux kernel.
- *
- */
-
-#ifndef _MIPS_PROM_H
-#define _MIPS_PROM_H
-
-extern char *prom_getcmdline(void);
-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 void mips_display_message(const char *str);
-extern void mips_display_word(unsigned int num);
-extern void mips_scroll_message(void);
-extern int get_ethernet_addr(char *ethernet_addr);
-
-/* Memory descriptor management. */
-#define PROM_MAX_PMEMBLOCKS 32
-struct prom_pmemblock {
- unsigned long base; /* Within KSEG0. */
- unsigned int size; /* In bytes. */
- unsigned int type; /* free or prom memory */
-};
-
-#endif /* !(_MIPS_PROM_H) */
diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile
index 6079ef3..8d64bd4 100644
--- a/arch/mips/mti-malta/Makefile
+++ b/arch/mips/mti-malta/Makefile
@@ -5,7 +5,7 @@
# Copyright (C) 2008 Wind River Systems, Inc.
# written by Ralf Baechle <ralf@linux-mips.org>
#
-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
diff --git a/arch/mips/mti-malta/malta-cmdline.c b/arch/mips/mti-malta/malta-cmdline.c
deleted file mode 100644
index 1871c30..0000000
--- a/arch/mips/mti-malta/malta-cmdline.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 1999,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
- * 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.
- *
- * Kernel command line creation using the prom monitor (YAMON) argc/argv.
- */
-#include <linux/init.h>
-#include <linux/string.h>
-
-#include <asm/bootinfo.h>
-
-extern int prom_argc;
-extern int *_prom_argv;
-
-/*
- * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
- * This macro take care of sign extension.
- */
-#define prom_argv(index) ((char *)(long)_prom_argv[(index)])
-
-char * __init prom_getcmdline(void)
-{
- return &(arcs_cmdline[0]);
-}
-
-
-void __init prom_init_cmdline(void)
-{
- char *cp;
- int actr;
-
- actr = 1; /* Always ignore argv[0] */
-
- cp = &(arcs_cmdline[0]);
- while(actr < prom_argc) {
- strcpy(cp, prom_argv(actr));
- cp += strlen(prom_argv(actr));
- *cp++ = ' ';
- actr++;
- }
- if (cp != &(arcs_cmdline[0])) {
- /* get rid of trailing space */
- --cp;
- *cp = '\0';
- }
-}
diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index 7c8828f..6139be0 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -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;
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index 27a6cdb..c47e83c 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -31,23 +31,13 @@
#include <asm/traps.h>
#include <asm/gcmpregs.h>
-#include <asm/mips-boards/prom.h>
#include <asm/mips-boards/generic.h>
#include <asm/mips-boards/bonito64.h>
#include <asm/mips-boards/msc01_pci.h>
-
#include <asm/mips-boards/malta.h>
+#include <asm/fw/yamon/yamon.h>
-int prom_argc;
-int *_prom_argv, *_prom_envp;
-
-/*
- * 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)])
-
-int init_debug;
+extern void mips_display_message(const char *str);
static int mips_revision_corid;
int mips_revision_sconid;
@@ -62,74 +52,6 @@ unsigned long _pcictrl_gt64120;
/* MIPS System controller register base */
unsigned long _pcictrl_msc;
-char *prom_getenv(char *envname)
-{
- /*
- * 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) {
- return(prom_envp(index+1));
- }
- index += 2;
- }
-
- return NULL;
-}
-
-static inline unsigned char str2hexnum(unsigned char c)
-{
- if (c >= '0' && c <= '9')
- return c - '0';
- if (c >= 'a' && c <= 'f')
- return c - 'a' + 10;
- return 0; /* foo */
-}
-
-static inline void str2eaddr(unsigned char *ea, unsigned char *str)
-{
- int i;
-
- for (i = 0; i < 6; i++) {
- unsigned char num;
-
- if((*str == '.') || (*str == ':'))
- str++;
- num = str2hexnum(*str++) << 4;
- num |= (str2hexnum(*str++));
- ea[i] = num;
- }
-}
-
-int get_ethernet_addr(char *ethernet_addr)
-{
- char *ethaddr_str;
-
- ethaddr_str = prom_getenv("ethaddr");
- if (!ethaddr_str) {
- printk("ethaddr not set in boot prom\n");
- return -1;
- }
- str2eaddr(ethernet_addr, ethaddr_str);
-
- if (init_debug > 1) {
- int i;
- printk("get_ethernet_addr: ");
- for (i=0; i<5; i++)
- printk("%02x:", (unsigned char)*(ethernet_addr+i));
- printk("%02x\n", *(ethernet_addr+i));
- }
-
- return 0;
-}
-
#ifdef CONFIG_SERIAL_8250_CONSOLE
static void __init console_config(void)
{
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index d57a233..370bfdf 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -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;
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index 4ca09bf..c83c681 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -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);
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c
index c9b2eaa..0d21d86 100644
--- a/arch/mips/mti-malta/malta-time.c
+++ b/arch/mips/mti-malta/malta-time.c
@@ -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;
--
1.7.10
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 0/5] Add explicit support YAMON firmware.
2012-05-30 22:10 [PATCH 0/5] Add explicit support YAMON firmware Steven J. Hill
` (4 preceding siblings ...)
2012-05-30 22:10 ` [PATCH 5/5] MIPS: Clean up YAMON support for MIPS Malta and SEAD-3 platforms Steven J. Hill
@ 2012-05-30 23:47 ` Ralf Baechle
2012-05-30 23:50 ` Maciej W. Rozycki
2012-05-31 8:29 ` Ralf Baechle
6 siblings, 1 reply; 9+ messages in thread
From: Ralf Baechle @ 2012-05-30 23:47 UTC (permalink / raw)
To: Steven J. Hill; +Cc: linux-mips
On Wed, May 30, 2012 at 05:10:50PM -0500, Steven J. Hill wrote:
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 0/5] Add explicit support YAMON firmware.
2012-05-30 22:10 [PATCH 0/5] Add explicit support YAMON firmware Steven J. Hill
` (5 preceding siblings ...)
2012-05-30 23:47 ` [PATCH 0/5] Add explicit support YAMON firmware Ralf Baechle
@ 2012-05-31 8:29 ` Ralf Baechle
6 siblings, 0 replies; 9+ messages in thread
From: Ralf Baechle @ 2012-05-31 8:29 UTC (permalink / raw)
To: Steven J. Hill; +Cc: linux-mips
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.
> 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.
> .../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
^ permalink raw reply [flat|nested] 9+ messages in thread