13 #include <linux/sched.h>
14 #include <linux/kernel.h>
16 #include <linux/stddef.h>
18 #include <linux/ptrace.h>
19 #include <linux/slab.h>
21 #include <linux/screen_info.h>
26 #include <linux/errno.h>
28 #include <linux/string.h>
32 #include <linux/pci.h>
38 #ifdef CONFIG_MAGIC_SYSRQ
40 #include <linux/reboot.h>
43 #include <asm/setup.h>
46 #include <linux/export.h>
49 static int alpha_panic_event(
struct notifier_block *,
unsigned long,
void *);
56 #include <asm/uaccess.h>
57 #include <asm/pgtable.h>
60 #include <asm/mmu_context.h>
76 #ifdef CONFIG_VERBOSE_MCHECK
79 unsigned long alpha_verbose_mcheck = CONFIG_VERBOSE_MCHECK_ON;
116 #ifdef CONFIG_ALPHA_GENERIC
117 struct alpha_machine_vector alpha_mv;
122 static struct alpha_machine_vector *get_sysvec(
unsigned long,
unsigned long,
124 static struct alpha_machine_vector *get_sysvec_byname(
const char *);
125 static void get_sysnames(
unsigned long,
unsigned long,
unsigned long,
127 static void determine_cpu_caches (
unsigned int);
140 .orig_video_cols = 80,
141 .orig_video_lines = 25,
142 .orig_video_isVGA = 1,
143 .orig_video_points = 16
167 extern struct alpha_machine_vector X; \
187 WEAK(mikasa_primo_mv);
192 WEAK(noritake_primo_mv);
200 WEAK(sable_gamma_mv);
221 reserve_std_resources(
void)
224 { .name =
"rtc", .start = -1, .end = -1 },
225 { .name =
"dma1", .start = 0x00, .end = 0x1f },
226 { .name =
"pic1", .start = 0x20, .end = 0x3f },
227 { .name =
"timer", .start = 0x40, .end = 0x5f },
228 { .name =
"keyboard", .start = 0x60, .end = 0x6f },
229 { .name =
"dma page reg", .start = 0x80, .end = 0x8f },
230 { .name =
"pic2", .start = 0xa0, .end = 0xbf },
231 { .name =
"dma2", .start = 0xc0, .end = 0xdf },
239 for (hose =
hose_head; hose; hose = hose->next)
240 if (hose->
index == 0) {
250 for (i = 0; i <
ARRAY_SIZE(standard_io_resources); ++
i)
254 #define PFN_MAX PFN_DOWN(0x80000000)
255 #define for_each_mem_cluster(memdesc, _cluster, i) \
256 for ((_cluster) = (memdesc)->cluster, (i) = 0; \
257 (i) < (memdesc)->numclusters; (i)++, (_cluster)++)
259 static unsigned long __init
260 get_mem_size_limit(
char *
s)
262 unsigned long end = 0;
266 if ( *from ==
'K' || *from ==
'k' ) {
269 }
else if ( *from ==
'M' || *from ==
'm' ) {
272 }
else if ( *from ==
'G' || *from ==
'g' ) {
279 #ifdef CONFIG_BLK_DEV_INITRD
281 move_initrd(
unsigned long mem_limit)
288 if (!start ||
__pa(start) + size > mem_limit) {
292 memmove(start, (
void *)initrd_start, size);
293 initrd_start = (
unsigned long)start;
295 printk(
"initrd moved to %p\n", start);
300 #ifndef CONFIG_DISCONTIGMEM
302 setup_memory(
void *kernel_end)
306 unsigned long start_kernel_pfn, end_kernel_pfn;
316 printk(
"memcluster %lu, usage %01lx, start %8lu, end %8lu\n",
323 if (cluster->
usage & 3)
351 printk(
"setup: forcing memory size to %ldK (from %ldK).\n",
364 panic(
"not enough memory to boot");
372 if (cluster->
usage & 3)
381 if (start < start_kernel_pfn) {
382 if (end > end_kernel_pfn
383 && end - end_kernel_pfn >= bootmap_pages) {
384 bootmap_start = end_kernel_pfn;
386 }
else if (end > start_kernel_pfn)
387 end = start_kernel_pfn;
388 }
else if (start < end_kernel_pfn)
389 start = end_kernel_pfn;
390 if (end - start >= bootmap_pages) {
391 bootmap_start =
start;
396 if (bootmap_start == ~0
UL) {
406 if (cluster->
usage & 3)
415 if (start < start_kernel_pfn) {
416 if (end > end_kernel_pfn) {
420 printk(
"freeing pages %ld:%ld\n",
421 start, start_kernel_pfn);
422 start = end_kernel_pfn;
423 }
else if (end > start_kernel_pfn)
424 end = start_kernel_pfn;
425 }
else if (start < end_kernel_pfn)
426 start = end_kernel_pfn;
431 printk(
"freeing pages %ld:%ld\n", start, end);
437 printk(
"reserving pages %ld:%ld\n", bootmap_start, bootmap_start+
PFN_UP(bootmap_size));
439 #ifdef CONFIG_BLK_DEV_INITRD
443 printk(
"Initial ramdisk at: 0x%p (%lu bytes)\n",
444 (
void *) initrd_start, INITRD_SIZE);
448 printk(
"initrd extends beyond end of memory "
449 "(0x%08lx > 0x%p)\ndisabling initrd\n",
460 extern void setup_memory(
void *);
475 pfn < cluster->start_pfn + cluster->
numpages) {
476 return (cluster->
usage & 3) ? 0 : 1;
504 struct alpha_machine_vector *vec =
NULL;
506 char *type_name, *var_name, *
p;
507 void *kernel_end = _end;
508 char *
args = command_line;
525 hwrpb_update_checksum(hwrpb);
532 #ifdef CONFIG_ALPHA_GENERIC
535 alpha_using_srm =
strncmp((
const char *)hwrpb->
ssn,
"MILO", 4) != 0;
551 strlcpy(command_line,
"root=/dev/fd0 load_ramdisk=1",
sizeof command_line);
556 *cmdline_p = command_line;
563 if (
strncmp(p,
"alpha_mv=", 9) == 0) {
564 vec = get_sysvec_byname(p+9);
567 if (
strncmp(p,
"cycle=", 6) == 0) {
571 if (
strncmp(p,
"mem=", 4) == 0) {
575 if (
strncmp(p,
"srmcons", 7) == 0) {
579 if (
strncmp(p,
"console=srm", 11) == 0) {
583 if (
strncmp(p,
"gartsize=", 9) == 0) {
588 #ifdef CONFIG_VERBOSE_MCHECK
589 if (
strncmp(p,
"verbose_mcheck=", 15) == 0) {
611 #ifdef CONFIG_MAGIC_SYSRQ
614 if (alpha_using_srm) {
626 cpu->
type, &type_name, &var_name);
627 if (*var_name ==
'0')
636 panic(
"Unsupported system type: %s%s%s (%ld %ld)\n",
637 type_name, (*var_name ?
" variation " :
""), var_name,
640 if (vec != &alpha_mv) {
645 #ifdef CONFIG_ALPHA_GENERIC
648 "on %s%s%s using machine vector %s from %s\n",
649 type_name, (*var_name ?
" variation " :
""),
650 var_name, alpha_mv.vector_name,
651 (alpha_using_srm ?
"SRM" :
"MILO"));
657 #ifdef CONFIG_ALPHA_EV56
660 #ifdef CONFIG_ALPHA_EV67
663 #ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
666 #ifdef CONFIG_VERBOSE_MCHECK
670 #ifdef CONFIG_DISCONTIGMEM
677 #ifdef CONFIG_DEBUG_SPINLOCK
680 #ifdef CONFIG_MAGIC_SYSRQ
685 printk(
"Command line: %s\n", command_line);
691 srm_hae = *alpha_mv.hae_register;
692 __set_hae(alpha_mv.hae_cache);
698 setup_memory(kernel_end);
701 determine_cpu_caches(cpu->
type);
705 if (alpha_mv.init_arch)
706 alpha_mv.init_arch();
709 reserve_std_resources();
717 #if defined(CONFIG_VGA_CONSOLE)
719 #elif defined(CONFIG_DUMMY_CONSOLE)
739 printk(
"Max ASN from HWRPB is bad (0x%lx)\n", hwrpb->
max_asn);
752 static char sys_unknown[] =
"Unknown";
753 static char systype_names[][16] = {
755 "ADU",
"Cobra",
"Ruby",
"Flamingo",
"Mannequin",
"Jensen",
756 "Pelican",
"Morgan",
"Sable",
"Medulla",
"Noname",
757 "Turbolaser",
"Avanti",
"Mustang",
"Alcor",
"Tradewind",
758 "Mikasa",
"EB64",
"EB66",
"EB64+",
"AlphaBook1",
759 "Rawhide",
"K2",
"Lynx",
"XL",
"EB164",
"Noritake",
760 "Cortex",
"29",
"Miata",
"XXM",
"Takara",
"Yukon",
761 "Tsunami",
"Wildfire",
"CUSCO",
"Eiger",
"Titan",
"Marvel"
764 static char unofficial_names[][8] = {
"100",
"Ruffian"};
766 static char api_names[][16] = {
"200",
"Nautilus"};
768 static char eb164_names[][8] = {
"EB164",
"PC164",
"LX164",
"SX164",
"RX164"};
769 static int eb164_indices[] = {0,0,0,1,1,1,1,1,2,2,2,2,3,3,3,3,4};
771 static char alcor_names[][16] = {
"Alcor",
"Maverick",
"Bret"};
772 static int alcor_indices[] = {0,0,0,1,1,1,0,0,0,0,0,0,2,2,2,2,2,2};
774 static char eb64p_names[][16] = {
"EB64+",
"Cabriolet",
"AlphaPCI64"};
775 static int eb64p_indices[] = {0,0,1,2};
777 static char eb66_names[][8] = {
"EB66",
"EB66+"};
778 static int eb66_indices[] = {0,0,1};
780 static char marvel_names[][16] = {
783 static int marvel_indices[] = { 0 };
785 static char rawhide_names[][16] = {
786 "Dodge",
"Wrangler",
"Durango",
"Tincup",
"DaVinci"
788 static int rawhide_indices[] = {0,0,0,1,1,2,2,3,3,4,4};
790 static char titan_names[][16] = {
791 "DEFAULT",
"Privateer",
"Falcon",
"Granite"
793 static int titan_indices[] = {0,1,2,2,3};
795 static char tsunami_names[][16] = {
796 "0",
"DP264",
"Warhol",
"Windjammer",
"Monet",
"Clipper",
797 "Goldrush",
"Webbrick",
"Catamaran",
"Brisbane",
"Melbourne",
798 "Flying Clipper",
"Shark"
800 static int tsunami_indices[] = {0,1,2,3,4,5,6,7,8,9,10,11,12};
802 static struct alpha_machine_vector *
__init
803 get_sysvec(
unsigned long type,
unsigned long variation,
unsigned long cpu)
805 static struct alpha_machine_vector *systype_vecs[]
__initdata =
849 static struct alpha_machine_vector *unofficial_vecs[] __initdata =
855 static struct alpha_machine_vector *api_vecs[] __initdata =
861 static struct alpha_machine_vector *alcor_vecs[] __initdata =
863 &alcor_mv, &xlt_mv, &xlt_mv
866 static struct alpha_machine_vector *eb164_vecs[] __initdata =
868 &eb164_mv, &pc164_mv, &lx164_mv, &sx164_mv, &rx164_mv
871 static struct alpha_machine_vector *eb64p_vecs[] __initdata =
878 static struct alpha_machine_vector *eb66_vecs[] __initdata =
884 static struct alpha_machine_vector *marvel_vecs[] __initdata =
889 static struct alpha_machine_vector *titan_vecs[] __initdata =
897 static struct alpha_machine_vector *tsunami_vecs[] __initdata =
916 struct alpha_machine_vector *vec;
921 vec = systype_vecs[
type];
934 unsigned long member = (variation >> 10) & 0x3f;
941 vec = alcor_vecs[alcor_indices[member]];
945 vec = eb164_vecs[eb164_indices[member]];
948 if (vec == &eb164_mv && cpu ==
EV56_CPU)
953 vec = eb64p_vecs[eb64p_indices[member]];
957 vec = eb66_vecs[eb66_indices[member]];
961 vec = marvel_vecs[marvel_indices[member]];
966 vec = titan_vecs[titan_indices[member]];
970 vec = tsunami_vecs[tsunami_indices[member]];
974 vec = &mikasa_primo_mv;
980 vec = &noritake_primo_mv;
986 vec = &sable_gamma_mv;
995 static struct alpha_machine_vector *
__init
996 get_sysvec_byname(
const char *
name)
998 static struct alpha_machine_vector *all_vecs[] __initdata =
1042 struct alpha_machine_vector *mv = all_vecs[
i];
1050 get_sysnames(
unsigned long type,
unsigned long variation,
unsigned long cpu,
1051 char **type_name,
char **variation_name)
1053 unsigned long member;
1058 *type_name = systype_names[
type];
1066 *type_name = sys_unknown;
1067 *variation_name = sys_unknown;
1072 *variation_name = systype_names[0];
1073 if (variation == 0) {
1077 member = (variation >> 10) & 0x3f;
1086 *variation_name = eb164_names[eb164_indices[member]];
1089 if (eb164_indices[member] == 0 && cpu ==
EV56_CPU)
1090 *variation_name = eb164_names[1];
1094 *variation_name = alcor_names[alcor_indices[member]];
1098 *variation_name = eb64p_names[eb64p_indices[member]];
1102 *variation_name = eb66_names[eb66_indices[member]];
1106 *variation_name = marvel_names[marvel_indices[member]];
1110 *variation_name = rawhide_names[rawhide_indices[member]];
1113 *variation_name = titan_names[0];
1115 *variation_name = titan_names[titan_indices[member]];
1119 *variation_name = tsunami_names[tsunami_indices[member]];
1139 platform_string(
void)
1142 static char unk_system_string[] =
"N/A";
1149 return (unk_system_string);
1163 get_nr_processors(
struct percpu_struct *cpubase,
unsigned long num)
1169 for (i = 0; i < num; i++) {
1172 if ((cpu->
flags & 0x1cc) == 0x1cc)
1179 show_cache_size (
struct seq_file *
f,
const char *which,
int shape)
1183 else if (shape == 0)
1186 seq_printf (f,
"%s\t\t: %dK, %d-way, %db line\n",
1187 which, shape >> 10, shape & 15,
1188 1 << ((shape >> 4) & 15));
1198 static char cpu_names[][8] = {
1199 "EV3",
"EV4",
"Simulate",
"LCA4",
"EV5",
"EV45",
"EV56",
1200 "EV6",
"PCA56",
"PCA57",
"EV67",
"EV68CB",
"EV68AL",
1201 "EV68CX",
"EV7",
"EV79",
"EV69"
1208 char *sysvariation_name;
1211 cpu_index = (unsigned) (cpu->
type - 1);
1212 cpu_name =
"Unknown";
1214 cpu_name = cpu_names[cpu_index];
1217 cpu->
type, &systype_name, &sysvariation_name);
1219 nr_processors = get_nr_processors(cpu, hwrpb->
nr_processors);
1222 "cpu model\t\t: %s\n"
1223 "cpu variation\t\t: %ld\n"
1224 "cpu revision\t\t: %ld\n"
1225 "cpu serial number\t: %s\n"
1226 "system type\t\t: %s\n"
1227 "system variation\t: %s\n"
1228 "system revision\t\t: %ld\n"
1229 "system serial number\t: %s\n"
1230 "cycle frequency [Hz]\t: %lu %s\n"
1231 "timer frequency [Hz]\t: %lu.%02lu\n"
1232 "page size [bytes]\t: %ld\n"
1233 "phys. address bits\t: %ld\n"
1234 "max. addr. space #\t: %ld\n"
1235 "BogoMIPS\t\t: %lu.%02lu\n"
1236 "kernel unaligned acc\t: %ld (pc=%lx,va=%lx)\n"
1237 "user unaligned acc\t: %ld (pc=%lx,va=%lx)\n"
1238 "platform string\t\t: %s\n"
1239 "cpus detected\t\t: %d\n",
1255 platform_string(), nr_processors);
1259 "cpu active mask\t\t: %016lx\n",
1272 read_mem_block(
int *
addr,
int stride,
int size)
1274 long nloads = size / stride,
cnt,
tmp;
1289 :
"=&r" (cnt),
"=&r" (nloads),
"=&r" (addr),
"=&r" (tmp)
1290 :
"r" (stride),
"1" (nloads),
"2" (addr));
1292 return cnt / (size / stride);
1295 #define CSHAPE(totalsize, linesize, assoc) \
1296 ((totalsize & ~0xff) | (linesize << 4) | assoc)
1300 #define MAX_BCACHE_SIZE 16*1024*1024
1306 int cycles, prev_cycles = 1000000;
1307 int stride = 1 <<
width;
1314 read_mem_block(
__va(0), stride, size);
1316 while (size < maxsize) {
1318 cycles = read_mem_block(
__va(0), stride, size);
1319 if (cycles > prev_cycles * 2) {
1321 printk(
"%ldK Bcache detected; load hit latency %d "
1322 "cycles, load miss latency %d cycles\n",
1323 size >> 11, prev_cycles, cycles);
1324 return CSHAPE(size >> 1, width, 1);
1327 read_mem_block(
__va(size), stride, size);
1328 prev_cycles = cycles;
1335 determine_cpu_caches (
unsigned int cpu_type)
1337 int L1I, L1D,
L2,
L3;
1344 L1I =
CSHAPE(8*1024, 5, 1);
1346 L1I =
CSHAPE(16*1024, 5, 1);
1360 L2 = external_cache_probe(128*1024, 5);
1366 unsigned long car,
size;
1368 L1I = L1D =
CSHAPE(8*1024, 5, 1);
1372 size = 64*1024 * (1 << ((car >> 5) & 7));
1374 L2 = (car & 1 ?
CSHAPE (size, 3, 1) : -1);
1381 unsigned long sc_ctl,
width;
1383 L1I = L1D =
CSHAPE(8*1024, 5, 1);
1387 width = sc_ctl & 0x1000 ? 6 : 5;
1388 L2 =
CSHAPE (96*1024, width, 3);
1400 L3 = external_cache_probe(1024*1024, width);
1408 L1I =
CSHAPE(16*1024, 6, 1);
1409 L1D =
CSHAPE(8*1024, 5, 1);
1411 L1I =
CSHAPE(32*1024, 6, 2);
1412 L1D =
CSHAPE(16*1024, 5, 1);
1417 unsigned long cbox_config,
size;
1420 size = 512*1024 * (1 << ((cbox_config >> 12) & 3));
1422 L2 = ((cbox_config >> 31) & 1 ?
CSHAPE (size, 6, 1) : -1);
1424 L2 = external_cache_probe(512*1024, 6);
1435 L1I = L1D =
CSHAPE(64*1024, 6, 2);
1436 L2 = external_cache_probe(1024*1024, 6);
1442 L1I = L1D =
CSHAPE(64*1024, 6, 2);
1443 L2 =
CSHAPE(7*1024*1024/4, 6, 7);
1449 L1I = L1D = L2 = L3 = 0;
1483 .show = show_cpuinfo,
1499 static __init int add_pcspkr(
void)