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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [ppc/] [kernel/] [setup.c] - Blame information for rev 1624

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
/*
2
 *  linux/arch/ppc/kernel/setup.c
3
 *
4
 *  Copyright (C) 1995  Linus Torvalds
5
 *  Adapted from 'alpha' version by Gary Thomas
6
 */
7
 
8
/*
9
 * bootup setup stuff..
10
 */
11
 
12
#include <linux/config.h> /* CONFIG_BLK_DEV_RAM */
13
#include <linux/errno.h>
14
#include <linux/sched.h>
15
#include <linux/kernel.h>
16
#include <linux/mm.h>
17
#include <linux/stddef.h>
18
#include <linux/unistd.h>
19
#include <linux/ptrace.h>
20
#include <linux/malloc.h>
21
#include <linux/ldt.h>
22
#include <linux/user.h>
23
#include <linux/a.out.h>
24
#include <linux/tty.h>
25
#include <linux/major.h>
26
 
27
#define SIO_CONFIG_RA   0x398
28
#define SIO_CONFIG_RD   0x399
29
 
30
#include <asm/pgtable.h>
31
 
32
extern unsigned long *end_of_DRAM;
33
extern PTE *Hash;
34
extern unsigned long Hash_size, Hash_mask;
35
 
36
char sda_root[] = "root=/dev/sda1";
37
extern int root_mountflags;
38
 
39
unsigned char aux_device_present;
40
#ifdef CONFIG_BLK_DEV_RAM
41
extern int rd_doload;           /* 1 = load ramdisk, 0 = don't load */
42
extern int rd_prompt;           /* 1 = prompt for ramdisk, 0 = don't prompt */
43
extern int rd_image_start;      /* starting block # of image */
44
#endif
45
 
46
/*
47
 * The format of "screen_info" is strange, and due to early
48
 * i386-setup code. This is just enough to make the console
49
 * code think we're on a EGA+ colour display.
50
 */
51
 /* this is changed only in minor ways from the original
52
        -- Cort
53
 */
54
struct screen_info screen_info = {
55
        0, 25,                   /* orig-x, orig-y */
56
        { 0, 0 },         /* unused */
57
        0,                       /* orig-video-page */
58
        0,                       /* orig-video-mode */
59
        80,                     /* orig-video-cols */
60
        0,0,0,                     /* ega_ax, ega_bx, ega_cx */
61
        25,                     /* orig-video-lines */
62
        1,                      /* orig-video-isVGA */
63
        16                      /* orig-video-points */
64
};
65
 
66
 
67
unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end)
68
{
69
        return memory_start;
70
}
71
 
72
unsigned long find_end_of_memory(void)
73
{
74
        unsigned char dram_size = inb(0x0804);
75
        unsigned long total;
76
        extern BAT BAT2;
77
printk("DRAM Size = %x\n", dram_size);
78
printk("Config registers = %x/%x/%x/%x\n", inb(0x0800), inb(0x0801), inb(0x0802), inb(0x0803));
79
        switch (dram_size & 0x07)
80
        {
81
                case 0:
82
                        total = 0x08000000;  /* 128M */
83
                        break;
84
                case 1:
85
                        total = 0x02000000;  /* 32M */
86
                        break;
87
                case 2:
88
                        total = 0x00800000;  /* 8M */
89
                        break;
90
                case 3:
91
                        total = 0x00400000;  /* 4M - can't happen! */
92
                        break;
93
                case 4:
94
                        total = 0x10000000;  /* 256M */
95
                        break;
96
                case 5:
97
                        total = 0x04000000;  /* 64M */
98
                        break;
99
                case 6:
100
                        total = 0x01000000;  /* 16M */
101
                        break;
102
                case 7:
103
                        total = 0x04000000;  /* Can't happen */
104
                        break;
105
        }
106
        switch ((dram_size>>4) & 0x07)
107
        {
108
                case 0:
109
                        total += 0x08000000;  /* 128M */
110
                        break;
111
                case 1:
112
                        total += 0x02000000;  /* 32M */
113
                        break;
114
                case 2:
115
                        total += 0x00800000;  /* 8M */
116
                        break;
117
                case 3:
118
                        total += 0x00000000;  /* Module not present */
119
                        break;
120
                case 4:
121
                        total += 0x10000000;  /* 256M */
122
                        break;
123
                case 5:
124
                        total += 0x04000000;  /* 64M */
125
                        break;
126
                case 6:
127
                        total += 0x01000000;  /* 16M */
128
                        break;
129
                case 7:
130
                        total += 0x00000000;  /* Module not present */
131
                        break;
132
        }
133
/* TEMP */ total = 0x01000000;
134
/* _cnpause();  */
135
/* CAUTION!! This can be done more elegantly! */
136
        if (total < 0x01000000)
137
        {
138
                Hash_size = HASH_TABLE_SIZE_64K;
139
                Hash_mask = HASH_TABLE_MASK_64K;
140
        } else
141
        {
142
                Hash_size = HASH_TABLE_SIZE_128K;
143
                Hash_mask = HASH_TABLE_MASK_128K;
144
        }
145
        switch(total)
146
        {
147
          case 0x01000000:
148
/*          BAT2[0][1] = BL_16M;*/
149
            break;
150
          default:
151
            printk("WARNING: setup.c: find_end_of_memory() unknown total ram size %x\n", total);
152
            break;
153
        }
154
 
155
        Hash = (PTE *)((total-Hash_size)+KERNELBASE);
156
        bzero(Hash, Hash_size);
157
        return ((unsigned long)Hash);
158
}
159
 
160
int size_memory;
161
 
162
/* #define DEFAULT_ROOT_DEVICE 0x0200   /* fd0 */
163
#define DEFAULT_ROOT_DEVICE 0x0801      /* sda1 */
164
 
165
void setup_arch(char **cmdline_p,
166
        unsigned long * memory_start_p, unsigned long * memory_end_p)
167
{
168
        extern int _end;
169
        extern char cmd_line[];
170
        unsigned char reg;
171
 
172
        /* Set up floppy in PS/2 mode */
173
        outb(0x09, SIO_CONFIG_RA);
174
        reg = inb(SIO_CONFIG_RD);
175
        reg = (reg & 0x3F) | 0x40;
176
        outb(reg, SIO_CONFIG_RD);
177
        outb(reg, SIO_CONFIG_RD);       /* Have to write twice to change! */
178
        ROOT_DEV = to_kdev_t(DEFAULT_ROOT_DEVICE);
179
        /*ROOT_DEV = MKDEV(UNNAMED_MAJOR, 255);*/       /* nfs */
180
        aux_device_present = 0xaa;
181
  /*nfsaddrs=myip:serverip:gateip:netmaskip:clientname*/
182
  strcpy(cmd_line,
183
    "nfsaddrs=129.138.6.13:129.138.6.90:129.138.6.1:255.255.255.0:pandora");
184
  /*  strcpy(cmd_line,"root=/dev/sda1");*/
185
        *cmdline_p = cmd_line;
186
        *memory_start_p = (unsigned long) &_end;
187
        *memory_end_p = (unsigned long *)end_of_DRAM;
188
        size_memory = *memory_end_p - KERNELBASE;  /* Relative size of memory */
189
 
190
#ifdef CONFIG_BLK_DEV_RAM
191
  rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK;
192
  rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
193
  rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0);
194
  rd_prompt = 0;
195
  rd_doload = 0;
196
  rd_image_start = 0;
197
#endif          
198
}
199
 
200
asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
201
{
202
        return -EIO;
203
}
204
#if 0
205
extern char builtin_ramdisk_image;
206
extern long builtin_ramdisk_size;
207
 
208
void
209
builtin_ramdisk_init(void)
210
{
211
        if ((ROOT_DEV == to_kdev_t(DEFAULT_ROOT_DEVICE)) && (builtin_ramdisk_size != 0))
212
        {
213
                rd_preloaded_init(&builtin_ramdisk_image, builtin_ramdisk_size);
214
        } else
215
        {  /* Not ramdisk - assume root needs to be mounted read only */
216
                root_mountflags |= MS_RDONLY;
217
        }
218
}
219
#endif
220
#define MAJOR(n) (((n)&0xFF00)>>8)
221
#define MINOR(n) ((n)&0x00FF)
222
 
223
int
224
get_cpuinfo(char *buffer)
225
{
226
        int pvr = _get_PVR();
227
        char *model;
228
        switch (pvr>>16)
229
        {
230
                case 3:
231
                        model = "603";
232
                        break;
233
                case 4:
234
                        model = "604";
235
                        break;
236
                case 6:
237
                        model = "603e";
238
                        break;
239
                case 7:
240
                        model = "603ev";
241
                        break;
242
                default:
243
                        model = "unknown";
244
                        break;
245
        }
246
        return sprintf(buffer, "PowerPC %s rev %d.%d\n", model, MAJOR(pvr), MINOR(pvr));
247
}

powered by: WebSVN 2.1.0

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