summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/setup.c
blob: f5037fbd71f5e40b611bed719359ca76265702b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
 *  linux/arch/mips/kernel/setup.c
 *
 *  Copyright (C) 1995  Linus Torvalds
 *  Copyright (C) 1995  Ralf Baechle
 */

#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/ldt.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/tty.h>

#include <asm/asm.h>
#include <asm/bootinfo.h>
#include <asm/vector.h>
#include <asm/segment.h>
#include <asm/stackframe.h>
#include <asm/system.h>

/*
 * How to handle the machine's features
 */
struct feature *feature;

#ifdef CONFIG_ACER_PICA_61
void acer_pica_61_handle_int(void);
struct feature acer_pica_61_feature = {
	acer_pica_61_handle_int
};
#endif
#ifdef CONFIG_DECSTATION
void decstation_handle_handle_int(void);
struct feature decstation_feature = {
	decstation_handle_handle_int
};
#endif
#ifdef CONFIG_DESKSTATION_RPC44
void deskstation_rpc44_handle_int(void);
struct feature deskstation_rpc44_feature = {
	deskstation_rpc44_handle_int
};
#endif
#ifdef CONFIG_DESKSTATION_TYNE
void deskstation_tyne_handle_int(void);
struct feature deskstation_tyne_feature = {
	deskstation_tyne_handle_int
};
#endif
#ifdef CONFIG_MIPS_MAGNUM_4000
void mips_magnum_4000_handle_int(void);
struct feature mips_magnum_4000_feature = {
	mips_magnum_4000_handle_int
};
#endif

/*
 * Tell us the machine setup..
 */
char wait_available;		/* set if the "wait" instruction available */

/*
 * Bus types ..
 */
int EISA_bus = 0;

/*
 * Setup options
 */
struct drive_info_struct drive_info;
struct screen_info screen_info = SCREEN_INFO;

unsigned char aux_device_present;
extern int ramdisk_size;
extern int root_mountflags;
extern int _end;

extern char empty_zero_page[PAGE_SIZE];

/*
 * Initialise this structure so that it will be placed in the
 * .data section of the object file
 */
struct bootinfo boot_info = BOOT_INFO;

/*
 * This is set up by the setup-routine at boot-time
 */
#define PARAM	empty_zero_page
#if 0
#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
#endif

static char command_line[CL_SIZE] = { 0, };

#if 0
/*
 * Code for easy access to new style bootinfo
 *
 * Parameter:  tag      -- taglist entry
 *
 * returns  :  (tag *) -- pointer to taglist entry, NULL for not found
 */
tag *
bi_TagFind(enum bi_tag tag)
{
	/* TBD */
	return 0;
}

/*
 * Only for taglist creators (bootloaders)
 *
 * Parameter:  tag       -- (enum bi_tag) taglist entry
 *
 * returns  :  1         -- success
 *             0         -- failure
 */
int
bi_TagAdd(enum bi_tag tag, unsigned long size, void *tagdata)
{
	/* TBD */
	return 0;
}
#endif /* 0 */

void setup_arch(char **cmdline_p,
	unsigned long * memory_start_p, unsigned long * memory_end_p)
{
	unsigned long memory_start, memory_end;

	switch(boot_info.machtype)
	{
#ifdef CONFIG_ACER_PICA_61
	case MACH_ACER_PICA_61:
		feature = &acer_pica_61_feature;
		break;
#endif
#ifdef CONFIG_DECSTATION
	case MACH_DECSTATION:
		feature = &decstation_feature;
		break;
#endif
#ifdef CONFIG_DESKSTATION_RPC
	case MACH_DESKSTATION_RPC:
		feature = &deskstation_rpc44_feature;
		break;
#endif
#ifdef CONFIG_DESKSTATION_TYNE
	case MACH_DESKSTATION_TYNE:
		feature = &deskstation_tyne_feature;
		break;
#endif
#ifdef CONFIG_MIPS_MAGNUM_4000
	case MACH_MIPS_MAGNUM_4000:
		feature = &mips_magnum_4000_feature;
		break;
#endif
	default:
		panic("Unsupported architecture");
	}

#if 0
 	ROOT_DEV = ORIG_ROOT_DEV;
#else
	ROOT_DEV = 0x021c;	/* fd0H1440 */
/*	ROOT_DEV = 0x0101; */	/* ram */ 
/*	ROOT_DEV = 0x00ff; */	/* NFS */
#endif
 	memcpy(&drive_info, &boot_info.drive_info, sizeof(drive_info));
#if 0
	aux_device_present = AUX_DEVICE_INFO;
#endif
	memory_end = boot_info.memupper;
	memory_end &= PAGE_MASK;
	ramdisk_size = boot_info.ramdisk_size;
	if (boot_info.mount_root_rdonly)
		root_mountflags |= MS_RDONLY;

	memory_start = (unsigned long) &_end;
	memory_start += (ramdisk_size << 10);

	*cmdline_p = command_line;
	*memory_start_p = memory_start;
	*memory_end_p = memory_end;

#if 0
	/*
	 * Check that struct pt_regs is defined properly
	 * (Should be optimized away, but gcc 2.6.3 is too bad..)
	 */
	if (FR_SIZE != sizeof(struct pt_regs) ||
	    FR_SIZE & 7)
	{
		panic("Check_definition_of_struct_pt_regs\n");
	}
#endif
}