Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 375197
b: refs/heads/master
c: b431f09
h: refs/heads/master
i:
  375195: 8d0d8f5
v: v3
  • Loading branch information
Steven J. Hill authored and Ralf Baechle committed May 8, 2013
1 parent 00bf4e9 commit 14a7b75
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 200 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0be2abbceeb837bf938c85db03142b5b0e4675f4
refs/heads/master: b431f09d552cc85b19ee1d029eb1d3a992b73166
5 changes: 2 additions & 3 deletions trunk/arch/mips/mti-malta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
# Copyright (C) 2008 Wind River Systems, Inc.
# written by Ralf Baechle <ralf@linux-mips.org>
#
obj-y := malta-amon.o malta-cmdline.o \
malta-display.o malta-init.o malta-int.o \
malta-memory.o malta-platform.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

obj-$(CONFIG_EARLY_PRINTK) += malta-console.o
Expand Down
59 changes: 0 additions & 59 deletions trunk/arch/mips/mti-malta/malta-cmdline.c

This file was deleted.

94 changes: 6 additions & 88 deletions trunk/arch/mips/mti-malta/malta-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@
#include <linux/string.h>
#include <linux/kernel.h>

#include <asm/bootinfo.h>
#include <asm/gt64120.h>
#include <asm/io.h>
#include <asm/cacheflush.h>
#include <asm/smp-ops.h>
#include <asm/traps.h>

#include <asm/fw/fw.h>
#include <asm/gcmpregs.h>
#include <asm/mips-boards/prom.h>
#include <asm/mips-boards/generic.h>
Expand All @@ -38,15 +37,6 @@

#include <asm/mips-boards/malta.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;

static int mips_revision_corid;
Expand All @@ -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)
{
Expand All @@ -138,8 +60,8 @@ static void __init console_config(void)
char parity = '\0', bits = '\0', flow = '\0';
char *s;

if ((strstr(prom_getcmdline(), "console=")) == NULL) {
s = prom_getenv("modetty0");
if ((strstr(fw_getcmdline(), "console=")) == NULL) {
s = fw_getenv("modetty0");
if (s) {
while (*s >= '0' && *s <= '9')
baud = baud*10 + *s++ - '0';
Expand All @@ -159,7 +81,7 @@ static void __init console_config(void)
if (flow == '\0')
flow = 'r';
sprintf(console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow);
strcat(prom_getcmdline(), console_string);
strcat(fw_getcmdline(), console_string);
pr_info("Config serial console:%s\n", console_string);
}
}
Expand Down Expand Up @@ -193,10 +115,6 @@ extern struct plat_smp_ops msmtc_smp_ops;

void __init prom_init(void)
{
prom_argc = fw_arg0;
_prom_argv = (int *) fw_arg1;
_prom_envp = (int *) fw_arg2;

mips_display_message("LINUX");

/*
Expand Down Expand Up @@ -353,8 +271,8 @@ void __init prom_init(void)
board_nmi_handler_setup = mips_nmi_setup;
board_ejtag_handler_setup = mips_ejtag_setup;

prom_init_cmdline();
prom_meminit();
fw_init_cmdline();
fw_meminit();
#ifdef CONFIG_SERIAL_8250_CONSOLE
console_config();
#endif
Expand Down
60 changes: 16 additions & 44 deletions trunk/arch/mips/mti-malta/malta-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,29 @@
#include <asm/bootinfo.h>
#include <asm/page.h>
#include <asm/sections.h>
#include <asm/fw/fw.h>

#include <asm/mips-boards/prom.h>

/*#define DEBUG*/

enum yamon_memtypes {
yamon_dontuse,
yamon_prom,
yamon_free,
};
static struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];

#ifdef DEBUG
static char *mtypes[3] = {
"Dont use memory",
"YAMON PROM memory",
"Free memory",
};
#endif
static fw_memblock_t mdesc[FW_MAX_MEMBLOCKS];

/* determined physical memory size, not overridden by command line args */
unsigned long physical_memsize = 0L;

static struct prom_pmemblock * __init prom_getmdesc(void)
fw_memblock_t * __init fw_getmdesc(void)
{
char *memsize_str;
unsigned int memsize;
char *ptr;
static char cmdline[COMMAND_LINE_SIZE] __initdata;

/* otherwise look in the environment */
memsize_str = prom_getenv("memsize");
memsize_str = fw_getenv("memsize");
if (!memsize_str) {
printk(KERN_WARNING
"memsize not set in boot prom, set to default (32Mb)\n");
physical_memsize = 0x02000000;
} else {
#ifdef DEBUG
pr_debug("prom_memsize = %s\n", memsize_str);
#endif
physical_memsize = simple_strtol(memsize_str, NULL, 0);
}

Expand All @@ -90,11 +73,11 @@ static struct prom_pmemblock * __init prom_getmdesc(void)

memset(mdesc, 0, sizeof(mdesc));

mdesc[0].type = yamon_dontuse;
mdesc[0].type = fw_dontuse;
mdesc[0].base = 0x00000000;
mdesc[0].size = 0x00001000;

mdesc[1].type = yamon_prom;
mdesc[1].type = fw_code;
mdesc[1].base = 0x00001000;
mdesc[1].size = 0x000ef000;

Expand All @@ -105,55 +88,44 @@ static struct prom_pmemblock * __init prom_getmdesc(void)
* This mean that this area can't be used as DMA memory for PCI
* devices.
*/
mdesc[2].type = yamon_dontuse;
mdesc[2].type = fw_dontuse;
mdesc[2].base = 0x000f0000;
mdesc[2].size = 0x00010000;

mdesc[3].type = yamon_dontuse;
mdesc[3].type = fw_dontuse;
mdesc[3].base = 0x00100000;
mdesc[3].size = CPHYSADDR(PFN_ALIGN((unsigned long)&_end)) - mdesc[3].base;

mdesc[4].type = yamon_free;
mdesc[4].type = fw_free;
mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end));
mdesc[4].size = memsize - mdesc[4].base;

return &mdesc[0];
}

static int __init prom_memtype_classify(unsigned int type)
static int __init fw_memtype_classify(unsigned int type)
{
switch (type) {
case yamon_free:
case fw_free:
return BOOT_MEM_RAM;
case yamon_prom:
case fw_code:
return BOOT_MEM_ROM_DATA;
default:
return BOOT_MEM_RESERVED;
}
}

void __init prom_meminit(void)
void __init fw_meminit(void)
{
struct prom_pmemblock *p;
fw_memblock_t *p;

#ifdef DEBUG
pr_debug("YAMON MEMORY DESCRIPTOR dump:\n");
p = prom_getmdesc();
while (p->size) {
int i = 0;
pr_debug("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n",
i, p, p->base, p->size, mtypes[p->type]);
p++;
i++;
}
#endif
p = prom_getmdesc();
p = fw_getmdesc();

while (p->size) {
long type;
unsigned long base, size;

type = prom_memtype_classify(p->type);
type = fw_memtype_classify(p->type);
base = p->base;
size = p->size;

Expand Down
9 changes: 4 additions & 5 deletions trunk/arch/mips/mti-malta/malta-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
#include <linux/screen_info.h>
#include <linux/time.h>

#include <asm/bootinfo.h>
#include <asm/fw/fw.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>
Expand Down Expand Up @@ -176,7 +175,7 @@ static void __init pci_clock_check(void)
33, 20, 25, 30, 12, 16, 37, 10
};
int pciclock = pciclocks[jmpr];
char *argptr = prom_getcmdline();
char *argptr = fw_getcmdline();

if (pciclock != 33 && !strstr(argptr, "idebus=")) {
printk(KERN_WARNING "WARNING: PCI clock is %dMHz, "
Expand Down Expand Up @@ -214,7 +213,7 @@ static void __init bonito_quirks_setup(void)
{
char *argptr;

argptr = prom_getcmdline();
argptr = fw_getcmdline();
if (strstr(argptr, "debug")) {
BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
printk(KERN_INFO "Enabled Bonito debug mode\n");
Expand All @@ -226,7 +225,7 @@ static void __init bonito_quirks_setup(void)
BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
printk(KERN_INFO "Enabled Bonito CPU coherency\n");

argptr = prom_getcmdline();
argptr = fw_getcmdline();
if (strstr(argptr, "iobcuncached")) {
BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
Expand Down

0 comments on commit 14a7b75

Please sign in to comment.