File: bootparse.c

package info (click to toggle)
kernel-source-2.4.14 2.4.14-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 139,160 kB
  • ctags: 428,423
  • sloc: ansic: 2,435,554; asm: 141,119; makefile: 8,258; sh: 3,099; perl: 2,561; yacc: 1,177; cpp: 755; tcl: 577; lex: 352; awk: 251; lisp: 218; sed: 72
file content (122 lines) | stat: -rw-r--r-- 2,988 bytes parent folder | download | duplicates (14)
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
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/irq.h>
#include <asm/setup.h>
#include <asm/bootinfo.h>
#include <asm/macintosh.h>

/*
 *	Booter vars
 */
 
int boothowto;
int _boothowto;
 
/*
 *	Called early to parse the environment (passed to us from the booter)
 *	into a bootinfo struct. Will die as soon as we have our own booter
 */

#define atol(x)	simple_strtoul(x,NULL,0)
 
void parse_booter(char *env)
{
 	char *name;
 	char *value;
#if 0
 	while(0 && *env)
#else
 	while(*env)
#endif
 	{
 		name=env;
 		value=name;
 		while(*value!='='&&*value)
 			value++;
 		if(*value=='=')
 			*value++=0;
 		env=value;
 		while(*env)
 			env++;
 		env++;
#if 0 			
 		if(strcmp(name,"VIDEO_ADDR")==0)
 			mac_mch.videoaddr=atol(value);
 		if(strcmp(name,"ROW_BYTES")==0)
 			mac_mch.videorow=atol(value); 			
 		if(strcmp(name,"SCREEN_DEPTH")==0)
 			mac_mch.videodepth=atol(value);
 		if(strcmp(name,"DIMENSIONS")==0)
 			mac_mch.dimensions=atol(value);
#endif 			
 		if(strcmp(name,"BOOTTIME")==0)
 			mac_bi_data.boottime=atol(value);
 		if(strcmp(name,"GMTBIAS")==0)
 			mac_bi_data.gmtbias=atol(value);
 		if(strcmp(name,"BOOTERVER")==0)
 			mac_bi_data.bootver=atol(value);
 		if(strcmp(name,"MACOS_VIDEO")==0)
 			mac_bi_data.videological=atol(value);
 		if(strcmp(name,"MACOS_SCC")==0)
 			mac_bi_data.sccbase=atol(value);
 		if(strcmp(name,"MACHINEID")==0)
 			mac_bi_data.id=atol(value);
 		if(strcmp(name,"MEMSIZE")==0)
 			mac_bi_data.memsize=atol(value);
 		if(strcmp(name,"SERIAL_MODEM_FLAGS")==0)
 			mac_bi_data.serialmf=atol(value);
 		if(strcmp(name,"SERIAL_MODEM_HSKICLK")==0)
 			mac_bi_data.serialhsk=atol(value);
 		if(strcmp(name,"SERIAL_MODEM_GPICLK")==0)
 			mac_bi_data.serialgpi=atol(value);
 		if(strcmp(name,"SERIAL_PRINT_FLAGS")==0)
 			mac_bi_data.printmf=atol(value);
 		if(strcmp(name,"SERIAL_PRINT_HSKICLK")==0)
 			mac_bi_data.printhsk=atol(value);
 		if(strcmp(name,"SERIAL_PRINT_GPICLK")==0)
 			mac_bi_data.printgpi=atol(value);
 		if(strcmp(name,"PROCESSOR")==0)
 			mac_bi_data.cpuid=atol(value);
 		if(strcmp(name,"ROMBASE")==0)
 			mac_bi_data.rombase=atol(value);
 		if(strcmp(name,"TIMEDBRA")==0)
 			mac_bi_data.timedbra=atol(value);
 		if(strcmp(name,"ADBDELAY")==0)
 			mac_bi_data.adbdelay=atol(value);
 	}
#if 0	/* XXX: TODO with m68k_mach_* */
 	/* Fill in the base stuff */
 	boot_info.machtype=MACH_MAC;
 	/* Read this from the macinfo we got ! */
/*	boot_info.cputype=CPU_68020|FPUB_68881;*/
/* 	boot_info.memory[0].addr=0;*/
/* 	boot_info.memory[0].size=((mac_bi_data.id>>7)&31)<<20;*/
 	boot_info.num_memory=1;		/* On a MacII */
 	boot_info.ramdisk_size=0;	/* For now */
 	*boot_info.command_line=0;
#endif
 }
 

void print_booter(char *env)
{
 	char *name;
 	char *value;
 	while(*env)
 	{
 		name=env;
 		value=name;
 		while(*value!='='&&*value)
 			value++;
 		if(*value=='=')
 			*value++=0;
 		env=value;
 		while(*env)
 			env++;
 		env++;
 		printk("%s=%s\n", name,value);
 	}
 }