summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/arch.c
blob: 536e614ffbb436be3ada5924a63bbecc60eb7288 (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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/*
 * linux/arch/arm/kernel/arch.c
 *
 * Architecture specifics
 */
#include <linux/config.h>
#include <linux/tty.h>
#include <linux/init.h>

#include <asm/elf.h>
#include <asm/setup.h>
#include <asm/system.h>

#include "arch.h"

extern unsigned int system_rev;
extern unsigned int system_serial_low;
extern unsigned int system_serial_high;

unsigned int vram_size;
#ifdef CONFIG_ARCH_ACORN
unsigned int memc_ctrl_reg;
unsigned int number_mfm_drives;
#endif

/*
 * Architecture specific fixups.  This is where any
 * parameters in the params struct are fixed up, or
 * any additional architecture specific information
 * is pulled from the params struct.
 */
static void __init
fixup_acorn(struct machine_desc *desc, struct param_struct *params,
	    char **cmdline, struct meminfo *mi)
{
#ifdef CONFIG_ARCH_ACORN
	int i;

	if (machine_is_riscpc()) {
		/*
		 * RiscPC can't handle half-word loads and stores
		 */
		elf_hwcap &= ~HWCAP_HALF;

		switch (params->u1.s.pages_in_vram) {
		case 512:
			vram_size += PAGE_SIZE * 256;
		case 256:
			vram_size += PAGE_SIZE * 256;
		default:
			break;
		}

		if (vram_size) {
			desc->video_start = 0x02000000;
			desc->video_end   = 0x02000000 + vram_size;
		}

		for (i = 0; i < 4; i++) {
			mi->bank[i].start = PHYS_OFFSET + (i << 26);
			mi->bank[i].size  =
				params->u1.s.pages_in_bank[i] *
				params->u1.s.page_size;
		}
		mi->nr_banks = 4;
	}
	memc_ctrl_reg	  = params->u1.s.memc_control_reg;
	number_mfm_drives = (params->u1.s.adfsdrives >> 3) & 3;
#endif
}

static void __init
fixup_ebsa285(struct machine_desc *desc, struct param_struct *params,
	      char **cmdline, struct meminfo *mi)
{
	ORIG_X		 = params->u1.s.video_x;
	ORIG_Y		 = params->u1.s.video_y;
	ORIG_VIDEO_COLS  = params->u1.s.video_num_cols;
	ORIG_VIDEO_LINES = params->u1.s.video_num_rows;
}

/*
 * Older NeTTroms either do not provide a parameters
 * page, or they don't supply correct information in
 * the parameter page.
 */
static void __init
fixup_netwinder(struct machine_desc *desc, struct param_struct *params,
		char **cmdline, struct meminfo *mi)
{
	if (params->u1.s.nr_pages != 0x2000 &&
	    params->u1.s.nr_pages != 0x4000) {
		printk(KERN_WARNING "Warning: bad NeTTrom parameters "
		       "detected, using defaults\n");

		params->u1.s.nr_pages = 0x2000;	/* 32MB */
		params->u1.s.ramdisk_size = 0;
		params->u1.s.flags = FLAG_READONLY;
		params->u1.s.initrd_start = 0;
		params->u1.s.initrd_size = 0;
		params->u1.s.rd_start = 0;
	}
}

/*
 * CATS uses soft-reboot by default, since
 * hard reboots fail on early boards.
 */
static void __init
fixup_cats(struct machine_desc *desc, struct param_struct *params,
	   char **cmdline, struct meminfo *mi)
{
	ORIG_VIDEO_LINES  = 25;
	ORIG_VIDEO_POINTS = 16;
	ORIG_Y = 24;
}

static void __init
fixup_coebsa285(struct machine_desc *desc, struct param_struct *params,
		char **cmdline, struct meminfo *mi)
{
#if 0
	extern unsigned long boot_memory_end;
	extern char boot_command_line[];

	mi->nr_banks      = 1;
	mi->bank[0].start = PHYS_OFFSET;
	mi->bank[0].size  = boot_memory_end;

	*cmdline = boot_command_line;
#endif
}

static void __init
fixup_sa1100(struct machine_desc *desc, struct param_struct *params,
	     char **cmdline, struct meminfo *mi)
{
#ifdef CONFIG_ARCH_SA1100
	int i;
	extern struct mem_desc {
		unsigned long phys_start;
		unsigned long length;
	} mem_desc[];
	extern unsigned int mem_desc_size;

	for( i = 0; i < mem_desc_size; i++ ) {
		if( i >= NR_BANKS ) {
			printk( __FUNCTION__ 
				": mem_desc too large for meminfo structure\n");
			break;
		}
		mi->bank[i].start = mem_desc[i].phys_start;
		mi->bank[i].size = mem_desc[i].length;
	}
	mi->nr_banks = i;

#if defined(CONFIG_SA1100_BRUTUS)
	ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
	setup_ramdisk( 1, 0, 0, 8192 );
	setup_initrd( __phys_to_virt(0xd8000000), 0x00400000 );
#elif defined(CONFIG_SA1100_EMPEG)
	ROOT_DEV = MKDEV( 3, 1 );  /* /dev/hda1 */
	setup_ramdisk( 1, 0, 0, 4096 );
	setup_initrd( 0xd0000000+((1024-320)*1024), (320*1024) );
#elif defined(CONFIG_SA1100_TIFON)
	ROOT_DEV = MKDEV(UNNAMED_MAJOR, 0);
	setup_ramdisk(1, 0, 0, 4096);
	setup_initrd( 0xd0000000 + 0x1100004, 0x140000 );
#elif defined(CONFIG_SA1100_VICTOR)
	ROOT_DEV = MKDEV( 60, 2 );

	/* Get command line parameters passed from the loader (if any) */
	if( *((char*)0xc0000000) )
		strcpy( default_command_line, ((char *)0xc0000000) );

	/* power off if any problem */
	strcat( default_command_line, " panic=1" );
#elif defined(CONFIG_SA1100_LART)
	ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
	setup_ramdisk(1, 0, 0, 8192);
	setup_initrd(0xc0400000, 0x00400000);
#endif
#endif
}

#define NO_PARAMS	0
#define NO_VIDEO	0, 0

/*
 * This is the list of all architectures supported by
 * this kernel.  This should be integrated with the list
 * in head-armv.S.
 */
static struct machine_desc machine_desc[] __attribute__ ((__section__ (".arch.info"))) = {
#ifdef CONFIG_ARCH_EBSA110
	{
		MACH_TYPE_EBSA110,
		"EBSA110",	/* RMK			*/
		0x00000400,
		NO_VIDEO,
		1, 0, 1, 1, 1,
		NULL
	},
#endif
#ifdef CONFIG_ARCH_RPC
	{
		MACH_TYPE_RISCPC,
		"Acorn-RiscPC",	/* RMK			*/
		0x10000100,
		NO_VIDEO,
		1, 1, 0, 0, 0,
		fixup_acorn
	},
#endif
#ifdef CONFIG_ARCH_NEXUSPCI
	{
		MACH_TYPE_NEXUSPCI,
		"FTV/PCI",	/* Philip Blundell	*/
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		NULL
	},
#endif
#ifdef CONFIG_ARCH_EBSA285
	{
		MACH_TYPE_EBSA285,
		"EBSA285",		/* RMK			*/
		0x00000100,
		0x000a0000, 0x000bffff,
		0, 0, 0, 0, 0,
		fixup_ebsa285
	},
#endif
#ifdef CONFIG_ARCH_NETWINDER
	{
		MACH_TYPE_NETWINDER,
		"Rebel-NetWinder",	/* RMK			*/
		0x00000100,
		0x000a0000, 0x000bffff,
		1, 0, 1, 0, 0,
		fixup_netwinder
	},
#endif
#ifdef CONFIG_ARCH_CATS
	{
		MACH_TYPE_CATS,
		"Chalice-CATS",	/* Philip Blundell	*/
		NO_PARAMS,
		0x000a0000, 0x000bffff,
		0, 0, 0, 0, 1,
		fixup_cats
	},
#endif
#ifdef CONFIG_ARCH_TBOX
	{
		MACH_TYPE_TBOX,
		"unknown-TBOX",	/* Philip Blundell	*/
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		NULL
	},
#endif
#ifdef CONFIG_ARCH_CO285
	{
		MACH_TYPE_CO285,
		"co-EBSA285",	/* Mark van Doesburg	*/
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		fixup_coebsa285
	},
#endif
#ifdef CONFIG_ARCH_CLPS7110
	{
		MACH_TYPE_CLPS7110,
		"CL-PS7110",	/* Werner Almesberger	*/
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		NULL
	},
#endif
#ifdef CONFIG_ARCH_ARC
	{
		MACH_TYPE_ARCHIMEDES,
		"Acorn-Archimedes",/* RMK/DAG		*/
		0x0207c000,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		fixup_acorn
	},
#endif
#ifdef CONFIG_ARCH_A5K
	{
		MACH_TYPE_A5K,
		"Acorn-A5000",	/* RMK/PB		*/
		0x0207c000,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		fixup_acorn
	},
#endif
#ifdef CONFIG_ARCH_ETOILE
	{
		MACH_TYPE_ETOILE,
		"Etoile",		/* Alex de Vries	*/
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		NULL
	},
#endif
#ifdef CONFIG_ARCH_LACIE_NAS
	{
		MACH_TYPE_LACIE_NAS,
		"LaCie_NAS",	/* Benjamin Herrenschmidt */
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		NULL
	},
#endif
#ifdef CONFIG_ARCH_CLPS7500
	{
		MACH_TYPE_CLPS7500,
		"CL-PS7500",	/* Philip Blundell	*/
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		NULL
	},
#endif
#ifdef CONFIG_ARCH_SHARK
	{
		MACH_TYPE_SHARK,
		"Shark",		/* Alexander Schulz	*/
		NO_PARAMS,
		0x06000000, 0x06000000+0x001fffff,
		0, 0, 0, 0, 0,
		NULL
	},
#endif
#ifdef CONFIG_ARCH_SA1100
	{
		MACH_TYPE_SA1100,
		"SA1100-based",	/* Nicolas Pitre	*/
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		fixup_sa1100
	},
#endif
#ifdef CONFIG_ARCH_PERSONAL_SERVER
	{
		MACH_TYPE_PERSONAL_SERVER,
		"Compaq Personal Server",
		NO_PARAMS,
		NO_VIDEO,
		0, 0, 0, 0, 0,
		NULL
	}
#endif
};