OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [armnommu/] [kernel/] [setup-ebsa110.c] - Diff between revs 1765 and 1782

Only display areas with differences | Details | Blame | View Log

Rev 1765 Rev 1782
/*
/*
 *  linux/arch/arm/kernel/setup-sa.c
 *  linux/arch/arm/kernel/setup-sa.c
 *
 *
 *  Copyright (C) 1995, 1996 Russell King
 *  Copyright (C) 1995, 1996 Russell King
 */
 */
 
 
/*
/*
 * This file obtains various parameters about the system that the kernel
 * This file obtains various parameters about the system that the kernel
 * is running on.
 * is running on.
 */
 */
 
 
#include <linux/config.h>
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/malloc.h>
#include <linux/ldt.h>
#include <linux/ldt.h>
#include <linux/user.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/tty.h>
#include <linux/ioport.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/major.h>
#include <linux/major.h>
#include <linux/utsname.h>
#include <linux/utsname.h>
 
 
#include <asm/segment.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <asm/system.h>
#include <asm/hardware.h>
#include <asm/hardware.h>
#include <asm/pgtable.h>
#include <asm/pgtable.h>
 
 
#define COMMAND_LINE_SIZE 256
#define COMMAND_LINE_SIZE 256
 
 
unsigned long arm_id;
unsigned long arm_id;
extern int root_mountflags;
extern int root_mountflags;
extern int _etext, _edata, _end;
extern int _etext, _edata, _end;
 
 
#ifdef CONFIG_BLK_DEV_RAM
#ifdef CONFIG_BLK_DEV_RAM
extern int rd_doload;           /* 1 = load ramdisk, 0 = don't load */
extern int rd_doload;           /* 1 = load ramdisk, 0 = don't load */
extern int rd_prompt;           /* 1 = prompt for ramdisk, 0 = don't prompt */
extern int rd_prompt;           /* 1 = prompt for ramdisk, 0 = don't prompt */
extern int rd_image_start;      /* starting block # of image */
extern int rd_image_start;      /* starting block # of image */
 
 
static inline void setup_ramdisk (void)
static inline void setup_ramdisk (void)
{
{
    rd_image_start      = 0;
    rd_image_start      = 0;
    rd_prompt           = 1;
    rd_prompt           = 1;
    rd_doload           = 1;
    rd_doload           = 1;
}
}
#else
#else
#define setup_ramdisk() 
#define setup_ramdisk() 
#endif
#endif
 
 
#ifndef CONFIG_CMDLINE
#ifndef CONFIG_CMDLINE
#define CONFIG_CMDLINE  "root=nfs rw"
#define CONFIG_CMDLINE  "root=nfs rw"
#endif
#endif
 
 
static char default_command_line[] = CONFIG_CMDLINE;
static char default_command_line[] = CONFIG_CMDLINE;
static char command_line[COMMAND_LINE_SIZE] = { 0, };
static char command_line[COMMAND_LINE_SIZE] = { 0, };
       char saved_command_line[COMMAND_LINE_SIZE];
       char saved_command_line[COMMAND_LINE_SIZE];
 
 
struct processor processor;
struct processor processor;
extern const struct processor sa110_processor_functions;
extern const struct processor sa110_processor_functions;
 
 
void setup_arch(char **cmdline_p,
void setup_arch(char **cmdline_p,
        unsigned long * memory_start_p, unsigned long * memory_end_p)
        unsigned long * memory_start_p, unsigned long * memory_end_p)
{
{
        unsigned long memory_start, memory_end;
        unsigned long memory_start, memory_end;
        char c = ' ', *to = command_line, *from;
        char c = ' ', *to = command_line, *from;
        int len = 0;
        int len = 0;
 
 
        memory_start = (unsigned long)&_end;
        memory_start = (unsigned long)&_end;
        memory_end = 0xc1000000;
        memory_end = 0xc1000000;
        from = default_command_line;
        from = default_command_line;
 
 
        processor = sa110_processor_functions;
        processor = sa110_processor_functions;
        processor._proc_init ();
        processor._proc_init ();
 
 
        ROOT_DEV                = 0x00ff;
        ROOT_DEV                = 0x00ff;
        setup_ramdisk();
        setup_ramdisk();
 
 
        init_task.mm->start_code = TASK_SIZE;
        init_task.mm->start_code = TASK_SIZE;
        init_task.mm->end_code   = TASK_SIZE + (unsigned long) &_etext;
        init_task.mm->end_code   = TASK_SIZE + (unsigned long) &_etext;
        init_task.mm->end_data   = TASK_SIZE + (unsigned long) &_edata;
        init_task.mm->end_data   = TASK_SIZE + (unsigned long) &_edata;
        init_task.mm->brk        = TASK_SIZE + (unsigned long) &_end;
        init_task.mm->brk        = TASK_SIZE + (unsigned long) &_end;
 
 
        /* Save unparsed command line copy for /proc/cmdline */
        /* Save unparsed command line copy for /proc/cmdline */
        memcpy(saved_command_line, from, COMMAND_LINE_SIZE);
        memcpy(saved_command_line, from, COMMAND_LINE_SIZE);
        saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
        saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
 
 
        for (;;) {
        for (;;) {
                if (c == ' ' &&
                if (c == ' ' &&
                    from[0] == 'm' &&
                    from[0] == 'm' &&
                    from[1] == 'e' &&
                    from[1] == 'e' &&
                    from[2] == 'm' &&
                    from[2] == 'm' &&
                    from[3] == '=') {
                    from[3] == '=') {
                        memory_end = simple_strtoul(from+4, &from, 0);
                        memory_end = simple_strtoul(from+4, &from, 0);
                        if ( *from == 'K' || *from == 'k' ) {
                        if ( *from == 'K' || *from == 'k' ) {
                                memory_end = memory_end << 10;
                                memory_end = memory_end << 10;
                                from++;
                                from++;
                        } else if ( *from == 'M' || *from == 'm' ) {
                        } else if ( *from == 'M' || *from == 'm' ) {
                                memory_end = memory_end << 20;
                                memory_end = memory_end << 20;
                                from++;
                                from++;
                        }
                        }
                        memory_end = memory_end + PAGE_OFFSET;
                        memory_end = memory_end + PAGE_OFFSET;
                }
                }
                c = *from++;
                c = *from++;
                if (!c)
                if (!c)
                        break;
                        break;
                if (COMMAND_LINE_SIZE <= ++len)
                if (COMMAND_LINE_SIZE <= ++len)
                        break;
                        break;
                *to++ = c;
                *to++ = c;
        }
        }
 
 
        *to = '\0';
        *to = '\0';
        *cmdline_p = command_line;
        *cmdline_p = command_line;
        *memory_start_p = memory_start;
        *memory_start_p = memory_start;
        *memory_end_p = memory_end;
        *memory_end_p = memory_end;
        strcpy (system_utsname.machine, "sa110");
        strcpy (system_utsname.machine, "sa110");
}
}
 
 
int get_cpuinfo(char * buffer)
int get_cpuinfo(char * buffer)
{
{
        int len;
        int len;
 
 
        len = sprintf (buffer,  "CPU:\n"
        len = sprintf (buffer,  "CPU:\n"
                                "Type\t\t: %s\n"
                                "Type\t\t: %s\n"
                                "Revision\t: %d\n"
                                "Revision\t: %d\n"
                                "Manufacturer\t: %s\n"
                                "Manufacturer\t: %s\n"
                                "32bit modes\t: %s\n"
                                "32bit modes\t: %s\n"
                                "BogoMips\t: %lu.%02lu\n",
                                "BogoMips\t: %lu.%02lu\n",
                                "sa110",
                                "sa110",
                                (int)arm_id & 15,
                                (int)arm_id & 15,
                                "DEC",
                                "DEC",
                                "yes",
                                "yes",
                                (loops_per_sec+2500) / 500000,
                                (loops_per_sec+2500) / 500000,
                                ((loops_per_sec+2500) / 5000) % 100);
                                ((loops_per_sec+2500) / 5000) % 100);
        return len;
        return len;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.