This source file includes following definitions.
- init_pit
- find_end_memory
- setup_arch
- get_cpuinfo
1
2
3
4
5
6
7
8
9
10
11 #include <linux/errno.h>
12 #include <linux/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/mm.h>
15 #include <linux/stddef.h>
16 #include <linux/unistd.h>
17 #include <linux/ptrace.h>
18 #include <linux/malloc.h>
19 #include <linux/ldt.h>
20 #include <linux/user.h>
21 #include <linux/a.out.h>
22 #include <linux/tty.h>
23 #include <linux/delay.h>
24 #include <linux/config.h>
25
26 #include <asm/segment.h>
27 #include <asm/pgtable.h>
28 #include <asm/system.h>
29 #include <asm/hwrpb.h>
30 #include <asm/dma.h>
31 #include <asm/io.h>
32
33 struct hae hae = {
34 0,
35 (unsigned long*) HAE_ADDRESS
36 };
37
38 struct hwrpb_struct *hwrpb;
39
40 unsigned char aux_device_present = 0xaa;
41
42
43
44
45
46
47
48 #define PARAM ZERO_PAGE
49 #define COMMAND_LINE ((char*)(PARAM + 0x0000))
50 #define COMMAND_LINE_SIZE 256
51
52 static char command_line[COMMAND_LINE_SIZE] = { 0, };
53 char saved_command_line[COMMAND_LINE_SIZE];
54
55
56
57
58
59
60 struct screen_info screen_info = {
61 0, 25,
62 { 0, 0 },
63 0,
64 0,
65 80,
66 0,0,0,
67 25,
68 1,
69 16
70 };
71
72
73
74
75
76 static void init_pit (void)
77 {
78 #if 0
79
80
81
82
83 outb(0x54, 0x43);
84 outb(0x18, 0x41);
85 #endif
86
87 outb(0x36, 0x43);
88 outb(0x00, 0x40);
89 outb(0x00, 0x40);
90
91 outb(0xb6, 0x43);
92 outb(0x31, 0x42);
93 outb(0x13, 0x42);
94 }
95
96 static unsigned long find_end_memory(void)
97 {
98 int i;
99 unsigned long high = 0;
100 struct memclust_struct * cluster;
101 struct memdesc_struct * memdesc;
102
103 memdesc = (struct memdesc_struct *)
104 (INIT_HWRPB->mddt_offset + (unsigned long) INIT_HWRPB);
105 cluster = memdesc->cluster;
106 for (i = memdesc->numclusters ; i > 0; i--, cluster++) {
107 unsigned long tmp;
108 tmp = (cluster->start_pfn + cluster->numpages) << PAGE_SHIFT;
109 if (tmp > high)
110 high = tmp;
111 }
112
113 high = (high + PAGE_SIZE) & (PAGE_MASK*2);
114 return PAGE_OFFSET + high;
115 }
116
117 void setup_arch(char **cmdline_p,
118 unsigned long * memory_start_p, unsigned long * memory_end_p)
119 {
120 extern int _end;
121
122 init_pit();
123
124 hwrpb = (struct hwrpb_struct*)(IDENT_ADDR + INIT_HWRPB->phys_addr);
125
126 set_hae(hae.cache);
127 wrmces(0x7);
128
129 ROOT_DEV = to_kdev_t(0x0802);
130 command_line[COMMAND_LINE_SIZE - 1] = '\0';
131
132
133
134
135
136
137
138 if(strcmp(COMMAND_LINE, "INSTALL") == 0) {
139 strcpy(command_line, "root=/dev/fd0 load_ramdisk=1");
140 strcpy(saved_command_line, command_line);
141 }
142 else {
143 strcpy(command_line, COMMAND_LINE);
144 strcpy(saved_command_line, COMMAND_LINE);
145 }
146 printk("Command line: %s\n", command_line);
147
148 *cmdline_p = command_line;
149 *memory_start_p = (unsigned long) &_end;
150 *memory_end_p = find_end_memory();
151
152 #if defined(CONFIG_ALPHA_LCA)
153 *memory_start_p = lca_init(*memory_start_p, *memory_end_p);
154 #elif defined(CONFIG_ALPHA_APECS)
155 *memory_start_p = apecs_init(*memory_start_p, *memory_end_p);
156 #elif defined(CONFIG_ALPHA_ALCOR)
157 *memory_start_p = alcor_init(*memory_start_p, *memory_end_p);
158 #endif
159 }
160
161
162
163
164 int get_cpuinfo(char *buffer)
165 {
166 const char *cpu_name[] = {
167 "EV3", "EV4", "Unknown 1", "LCA4", "EV5", "EV45"
168 };
169 # define SYSTYPE_NAME_BIAS 20
170 const char *systype_name[] = {
171 "Cabriolet", "EB66P", "-18", "-17", "-16", "-15",
172 "-14", "-13", "-12", "-11", "-10", "-9", "-8",
173 "-7", "-6", "-5", "-4", "-3", "-2", "-1", "0",
174 "ADU", "Cobra", "Ruby", "Flamingo", "5", "Jensen",
175 "Pelican", "8", "Sable", "AXPvme", "Noname",
176 "Turbolaser", "Avanti", "Mustang", "Alcor", "16",
177 "Mikasa", "18", "EB66", "EB64+", "21", "22", "23",
178 "24", "25", "EB164"
179 };
180 struct percpu_struct *cpu;
181 unsigned int cpu_index;
182 long sysname_index;
183 extern struct unaligned_stat {
184 unsigned long count, va, pc;
185 } unaligned[2];
186 # define N(a) (sizeof(a)/sizeof(a[0]))
187
188 cpu = (struct percpu_struct*)((char*)hwrpb + hwrpb->processor_offset);
189 cpu_index = (unsigned) (cpu->type - 1);
190 sysname_index = hwrpb->sys_type + SYSTYPE_NAME_BIAS;
191
192 return sprintf(buffer,
193 "cpu\t\t\t: Alpha\n"
194 "cpu model\t\t: %s\n"
195 "cpu variation\t\t: %ld\n"
196 "cpu revision\t\t: %ld\n"
197 "cpu serial number\t: %s\n"
198 "system type\t\t: %s\n"
199 "system variation\t: %ld\n"
200 "system revision\t\t: %ld\n"
201 "system serial number\t: %s\n"
202 "cycle frequency [Hz]\t: %lu\n"
203 "timer frequency [Hz]\t: %lu.%02lu\n"
204 "page size [bytes]\t: %ld\n"
205 "phys. address bits\t: %ld\n"
206 "max. addr. space #\t: %ld\n"
207 "BogoMIPS\t\t: %lu.%02lu\n"
208 "kernel unaligned acc\t: %ld (pc=%lx,va=%lx)\n"
209 "user unaligned acc\t: %ld (pc=%lx,va=%lx)\n",
210
211 (cpu_index < N(cpu_name)
212 ? cpu_name[cpu_index] : "Unknown"),
213 cpu->variation, cpu->revision, (char*)cpu->serial_no,
214 (sysname_index < N(systype_name)
215 ? systype_name[sysname_index] : "Unknown"),
216 hwrpb->sys_variation, hwrpb->sys_revision,
217 (char*)hwrpb->ssn,
218 hwrpb->cycle_freq,
219 hwrpb->intr_freq / 4096,
220 (100 * hwrpb->intr_freq / 4096) % 100,
221 hwrpb->pagesize,
222 hwrpb->pa_bits,
223 hwrpb->max_asn,
224 loops_per_sec / 500000, (loops_per_sec / 5000) % 100,
225 unaligned[0].count, unaligned[0].pc, unaligned[0].va,
226 unaligned[1].count, unaligned[1].pc, unaligned[1].va);
227 # undef N
228 }