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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
/*
2
 *  linux/arch/mips/kernel/setup.c
3
 *
4
 *  Copyright (C) 1995  Linus Torvalds
5
 *  Copyright (C) 1995  Ralf Baechle
6
 */
7
#include <linux/config.h>
8
#include <linux/delay.h>
9
#include <linux/errno.h>
10
#include <linux/sched.h>
11
#include <linux/kernel.h>
12
#include <linux/mm.h>
13
#include <linux/stddef.h>
14
#include <linux/string.h>
15
#include <linux/unistd.h>
16
#include <linux/ptrace.h>
17
#include <linux/malloc.h>
18
#include <linux/ldt.h>
19
#include <linux/user.h>
20
#include <linux/a.out.h>
21
#include <linux/tty.h>
22
 
23
#include <asm/asm.h>
24
#include <asm/bootinfo.h>
25
#include <asm/vector.h>
26
#include <asm/segment.h>
27
#include <asm/stackframe.h>
28
#include <asm/system.h>
29
 
30
/*
31
 * How to handle the machine's features
32
 */
33
struct feature *feature;
34
 
35
#ifdef CONFIG_ACER_PICA_61
36
void acer_pica_61_handle_int(void);
37
/*
38
 * How to access the floppy controller's ports
39
 */
40
unsigned char jazz_fd_inb(unsigned int port);
41
void jazz_fd_outb(unsigned char value, unsigned int port);
42
/*
43
 * How to access the floppy DMA functions.
44
 */
45
void jazz_fd_enable_dma(void);
46
void jazz_fd_disable_dma(void);
47
int jazz_fd_request_dma(void);
48
void jazz_fd_free_dma(void);
49
void jazz_fd_clear_dma_ff(void);
50
void jazz_fd_set_dma_mode(char mode);
51
void jazz_fd_set_dma_addr(unsigned int a);
52
void jazz_fd_set_dma_count(unsigned int count);
53
int jazz_fd_get_dma_residue(void);
54
void jazz_fd_enable_irq(void);
55
void jazz_fd_disable_irq(void);
56
void jazz_fd_cacheflush(unsigned char *addr, unsigned int size);
57
/*
58
 * How to access the RTC functions.
59
 */
60
unsigned char jazz_rtc_read_data(void);
61
void jazz_rtc_write_data(unsigned char data);
62
 
63
struct feature acer_pica_61_feature = {
64
        acer_pica_61_handle_int,
65
        /*
66
         * How to access the floppy controller's ports
67
         */
68
        jazz_fd_inb,
69
        jazz_fd_outb,
70
        /*
71
         * How to access the floppy DMA functions.
72
         */
73
        jazz_fd_enable_dma,
74
        jazz_fd_disable_dma,
75
        jazz_fd_request_dma,
76
        jazz_fd_free_dma,
77
        jazz_fd_clear_dma_ff,
78
        jazz_fd_set_dma_mode,
79
        jazz_fd_set_dma_addr,
80
        jazz_fd_set_dma_count,
81
        jazz_fd_get_dma_residue,
82
        jazz_fd_enable_irq,
83
        jazz_fd_disable_irq,
84
        jazz_fd_cacheflush,
85
        /*
86
         * How to access the RTC functions.
87
         */
88
        jazz_rtc_read_data,
89
        jazz_rtc_write_data
90
};
91
#endif
92
#ifdef CONFIG_DECSTATION
93
void decstation_handle_handle_int(void);
94
void isa_outb(unsigned char value, unsigned int port);
95
unsigned char isa_inb(unsigned int port);
96
struct feature decstation_feature = {
97
        decstation_handle_handle_int,
98
        isa_inb /* Dummy - dunno how to handle this yet */
99
        isa_outb, /* Dummy - dunno how to handle this yet */
100
};
101
#endif
102
#ifdef CONFIG_DESKSTATION_RPC44
103
void deskstation_rpc44_handle_int(void);
104
void isa_outb(unsigned char value, unsigned int port);
105
unsigned char isa_inb(unsigned int port);
106
struct feature deskstation_rpc44_feature = {
107
        deskstation_rpc44_handle_int,
108
        isa_inb
109
        isa_outb,
110
};
111
#endif
112
#ifdef CONFIG_DESKSTATION_TYNE
113
void deskstation_tyne_handle_int(void);
114
void isa_outb(unsigned char value, unsigned int port);
115
unsigned char isa_inb(unsigned int port);
116
struct feature deskstation_tyne_feature = {
117
        deskstation_tyne_handle_int,
118
        isa_inb,
119
        isa_outb,
120
};
121
#endif
122
#ifdef CONFIG_MIPS_MAGNUM_4000
123
void mips_magnum_4000_handle_int(void);
124
/*
125
 * How to access the floppy controller's ports
126
 */
127
unsigned char jazz_fd_inb(unsigned int port);
128
void jazz_fd_outb(unsigned char value, unsigned int port);
129
/*
130
 * How to access the floppy DMA functions.
131
 */
132
void jazz_fd_enable_dma(void);
133
void jazz_fd_disable_dma(void);
134
int jazz_fd_request_dma(void);
135
void jazz_fd_free_dma(void);
136
void jazz_fd_clear_dma_ff(void);
137
void jazz_fd_set_dma_mode(char mode);
138
void jazz_fd_set_dma_addr(unsigned int a);
139
void jazz_fd_set_dma_count(unsigned int count);
140
int jazz_fd_get_dma_residue(void);
141
void jazz_fd_enable_irq(void);
142
void jazz_fd_disable_irq(void);
143
void jazz_fd_cacheflush(unsigned char *addr, unsigned int size);
144
/*
145
 * How to access the RTC functions.
146
 */
147
unsigned char jazz_rtc_read_data(void);
148
void jazz_rtc_write_data(unsigned char data);
149
 
150
struct feature mips_magnum_4000_feature = {
151
        mips_magnum_4000_handle_int,
152
        /*
153
         * How to access the floppy controller's ports
154
         */
155
        jazz_fd_inb,
156
        jazz_fd_outb,
157
        /*
158
         * How to access the floppy DMA functions.
159
         */
160
        jazz_fd_enable_dma,
161
        jazz_fd_disable_dma,
162
        jazz_fd_request_dma,
163
        jazz_fd_free_dma,
164
        jazz_fd_clear_dma_ff,
165
        jazz_fd_set_dma_mode,
166
        jazz_fd_set_dma_addr,
167
        jazz_fd_set_dma_count,
168
        jazz_fd_get_dma_residue,
169
        jazz_fd_enable_irq,
170
        jazz_fd_disable_irq,
171
        jazz_fd_cacheflush,
172
        /*
173
         * How to access the RTC functions.
174
         */
175
        jazz_rtc_read_data,
176
        jazz_rtc_write_data
177
};
178
#endif
179
 
180
/*
181
 * Tell us the machine setup..
182
 */
183
char wait_available;            /* set if the "wait" instruction available */
184
 
185
/*
186
 * Bus types ..
187
 */
188
int EISA_bus = 0;
189
 
190
/*
191
 * Setup options
192
 */
193
struct drive_info_struct drive_info;
194
struct screen_info screen_info = SCREEN_INFO;
195
 
196
unsigned char aux_device_present;
197
extern int ramdisk_size;
198
extern int root_mountflags;
199
extern int _end;
200
 
201
extern char empty_zero_page[PAGE_SIZE];
202
 
203
/*
204
 * Initialise this structure so that it will be placed in the
205
 * .data section of the object file
206
 */
207
struct bootinfo boot_info = BOOT_INFO;
208
 
209
/*
210
 * This is set up by the setup-routine at boot-time
211
 */
212
#define PARAM   empty_zero_page
213
#if 0
214
#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
215
#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
216
#endif
217
 
218
static char command_line[CL_SIZE] = { 0, };
219
       char saved_command_line[CL_SIZE];
220
 
221
#if 0
222
/*
223
 * Code for easy access to new style bootinfo
224
 *
225
 * Parameter:  tag      -- taglist entry
226
 *
227
 * returns  :  (tag *) -- pointer to taglist entry, NULL for not found
228
 */
229
tag *
230
bi_TagFind(enum bi_tag tag)
231
{
232
        /* TBD */
233
        return 0;
234
}
235
 
236
/*
237
 * Only for taglist creators (bootloaders)
238
 *
239
 * Parameter:  tag       -- (enum bi_tag) taglist entry
240
 *
241
 * returns  :  1         -- success
242
 *             0         -- failure
243
 */
244
int
245
bi_TagAdd(enum bi_tag tag, unsigned long size, void *tagdata)
246
{
247
        /* TBD */
248
        return 0;
249
}
250
#endif /* 0 */
251
 
252
void setup_arch(char **cmdline_p,
253
        unsigned long * memory_start_p, unsigned long * memory_end_p)
254
{
255
        unsigned long memory_start, memory_end;
256
 
257
        switch(boot_info.machtype)
258
        {
259
#ifdef CONFIG_ACER_PICA_61
260
        case MACH_ACER_PICA_61:
261
                feature = &acer_pica_61_feature;
262
                break;
263
#endif
264
#ifdef CONFIG_DECSTATION
265
        case MACH_DECSTATION:
266
                feature = &decstation_feature;
267
                break;
268
#endif
269
#ifdef CONFIG_DESKSTATION_RPC
270
        case MACH_DESKSTATION_RPC:
271
                feature = &deskstation_rpc44_feature;
272
                break;
273
#endif
274
#ifdef CONFIG_DESKSTATION_TYNE
275
        case MACH_DESKSTATION_TYNE:
276
                feature = &deskstation_tyne_feature;
277
                break;
278
#endif
279
#ifdef CONFIG_MIPS_MAGNUM_4000
280
        case MACH_MIPS_MAGNUM_4000:
281
                feature = &mips_magnum_4000_feature;
282
                break;
283
#endif
284
        default:
285
                panic("Unsupported architecture");
286
        }
287
 
288
#if 0
289
        ROOT_DEV = to_kdev_t(ORIG_ROOT_DEV);
290
#else
291
#ifdef CONFIG_BLK_DEV_FD
292
        ROOT_DEV = to_kdev_t(0x021c);   /* fd0H1440 */
293
#else
294
        ROOT_DEV = to_kdev_t(0x0101);   /* ram */
295
#endif
296
/*      ROOT_DEV = to_kdev_t(0x00ff); */        /* NFS */
297
#endif
298
        memcpy(&drive_info, &boot_info.drive_info, sizeof(drive_info));
299
#if 0
300
        aux_device_present = AUX_DEVICE_INFO;
301
#endif
302
        memory_end = boot_info.memupper;
303
        memory_end &= PAGE_MASK;
304
        ramdisk_size = boot_info.ramdisk_size;
305
        if (boot_info.mount_root_rdonly)
306
                root_mountflags |= MS_RDONLY;
307
 
308
        memory_start = (unsigned long) &_end;
309
        memory_start += (ramdisk_size << 10);
310
 
311
        memcpy(saved_command_line, command_line, CL_SIZE);
312
        saved_command_line[CL_SIZE-1] = '\0';
313
 
314
        *cmdline_p = command_line;
315
        *memory_start_p = memory_start;
316
        *memory_end_p = memory_end;
317
 
318
#if 0
319
        /*
320
         * Check that struct pt_regs is defined properly
321
         * (Should be optimized away, but gcc 2.6.3 is too bad..)
322
         */
323
        if (FR_SIZE != sizeof(struct pt_regs) ||
324
            FR_SIZE & 7)
325
        {
326
                panic("Check_definition_of_struct_pt_regs\n");
327
        }
328
#endif
329
}
330
 
331
#ifdef CONFIG_PROC_FS
332
/*
333
 * BUFFER is PAGE_SIZE bytes long.
334
 */
335
int get_cpuinfo(char *buffer)
336
{
337
        const char *cpu_name[] = CPU_NAMES;
338
        const char *mach_name[] = MACH_NAMES;
339
 
340
        return sprintf(buffer,
341
                       "cpu\t\t\t: MIPS\n"
342
                       "cpu model\t\t: %s\n"
343
                       "system type\t\t: %s\n"
344
                       "BogoMIPS\t\t: %lu.%02lu\n",
345
 
346
                       cpu_name[boot_info.cputype < CPU_LAST ? boot_info.cputype : CPU_UNKNOWN],
347
                       mach_name[boot_info.machtype < CPU_LAST ? boot_info.machtype : CPU_UNKNOWN],
348
                       loops_per_sec / 500000, (loops_per_sec / 5000) % 100);
349
}
350
#endif /* CONFIG_PROC_FS */

powered by: WebSVN 2.1.0

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