1/* 2 * linux/arch/alpha/kernel/setup.c 3 * 4 * Copyright (C) 1995 Linus Torvalds 5 */ 6 7/* 2.3.x bootmem, 1999 Andrea Arcangeli <andrea@suse.de> */ 8 9/* 10 * Bootup setup stuff. 11 */ 12 13#include <linux/sched.h> 14#include <linux/kernel.h> 15#include <linux/mm.h> 16#include <linux/stddef.h> 17#include <linux/unistd.h> 18#include <linux/ptrace.h> 19#include <linux/slab.h> 20#include <linux/user.h> 21#include <linux/a.out.h> 22#include <linux/screen_info.h> 23#include <linux/delay.h> 24#include <linux/mc146818rtc.h> 25#include <linux/console.h> 26#include <linux/cpu.h> 27#include <linux/errno.h> 28#include <linux/init.h> 29#include <linux/string.h> 30#include <linux/ioport.h> 31#include <linux/platform_device.h> 32#include <linux/bootmem.h> 33#include <linux/pci.h> 34#include <linux/seq_file.h> 35#include <linux/root_dev.h> 36#include <linux/initrd.h> 37#include <linux/eisa.h> 38#include <linux/pfn.h> 39#ifdef CONFIG_MAGIC_SYSRQ 40#include <linux/sysrq.h> 41#include <linux/reboot.h> 42#endif 43#include <linux/notifier.h> 44#include <asm/setup.h> 45#include <asm/io.h> 46#include <linux/log2.h> 47 48extern struct atomic_notifier_head panic_notifier_list; 49static int alpha_panic_event(struct notifier_block *, unsigned long, void *); 50static struct notifier_block alpha_panic_block = { 51 alpha_panic_event, 52 NULL, 53 INT_MAX /* try to do it first */ 54}; 55 56#include <asm/uaccess.h> 57#include <asm/pgtable.h> 58#include <asm/system.h> 59#include <asm/hwrpb.h> 60#include <asm/dma.h> 61#include <asm/io.h> 62#include <asm/mmu_context.h> 63#include <asm/console.h> 64 65#include "proto.h" 66#include "pci_impl.h" 67 68 69struct hwrpb_struct *hwrpb; 70EXPORT_SYMBOL(hwrpb); 71unsigned long srm_hae; 72 73int alpha_l1i_cacheshape; 74int alpha_l1d_cacheshape; 75int alpha_l2_cacheshape; 76int alpha_l3_cacheshape; 77 78#ifdef CONFIG_VERBOSE_MCHECK 79/* 0=minimum, 1=verbose, 2=all */ 80/* These can be overridden via the command line, ie "verbose_mcheck=2") */ 81unsigned long alpha_verbose_mcheck = CONFIG_VERBOSE_MCHECK_ON; 82#endif 83 84/* Which processor we booted from. */ 85int boot_cpuid; 86 87/* 88 * Using SRM callbacks for initial console output. This works from 89 * setup_arch() time through the end of time_init(), as those places 90 * are under our (Alpha) control. 91 92 * "srmcons" specified in the boot command arguments allows us to 93 * see kernel messages during the period of time before the true 94 * console device is "registered" during console_init(). 95 * As of this version (2.5.59), console_init() will call 96 * disable_early_printk() as the last action before initializing 97 * the console drivers. That's the last possible time srmcons can be 98 * unregistered without interfering with console behavior. 99 * 100 * By default, OFF; set it with a bootcommand arg of "srmcons" or 101 * "console=srm". The meaning of these two args is: 102 * "srmcons" - early callback prints 103 * "console=srm" - full callback based console, including early prints 104 */ 105int srmcons_output = 0; 106 107/* Enforce a memory size limit; useful for testing. By default, none. */ 108unsigned long mem_size_limit = 0; 109 110/* Set AGP GART window size (0 means disabled). */ 111unsigned long alpha_agpgart_size = DEFAULT_AGP_APER_SIZE; 112 113#ifdef CONFIG_ALPHA_GENERIC 114struct alpha_machine_vector alpha_mv; 115int alpha_using_srm; 116EXPORT_SYMBOL(alpha_using_srm); 117#endif 118 119static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long, 120 unsigned long); 121static struct alpha_machine_vector *get_sysvec_byname(const char *); 122static void get_sysnames(unsigned long, unsigned long, unsigned long, 123 char **, char **); 124static void determine_cpu_caches (unsigned int); 125 126static char __initdata command_line[COMMAND_LINE_SIZE]; 127 128/* 129 * The format of "screen_info" is strange, and due to early 130 * i386-setup code. This is just enough to make the console 131 * code think we're on a VGA color display. 132 */ 133 134struct screen_info screen_info = { 135 .orig_x = 0, 136 .orig_y = 25, 137 .orig_video_cols = 80, 138 .orig_video_lines = 25, 139 .orig_video_isVGA = 1, 140 .orig_video_points = 16 141}; 142 143EXPORT_SYMBOL(screen_info); 144 145/* 146 * The direct map I/O window, if any. This should be the same 147 * for all busses, since it's used by virt_to_bus. 148 */ 149 150unsigned long __direct_map_base; 151unsigned long __direct_map_size; 152EXPORT_SYMBOL(__direct_map_base); 153EXPORT_SYMBOL(__direct_map_size); 154 155/* 156 * Declare all of the machine vectors. 157 */ 158 159/* GCC 2.7.2 (on alpha at least) is lame. It does not support either 160 __attribute__((weak)) or #pragma weak. Bypass it and talk directly 161 to the assembler. */ 162 163#define WEAK(X) \ 164 extern struct alpha_machine_vector X; \ 165 asm(".weak "#X) 166 167WEAK(alcor_mv); 168WEAK(alphabook1_mv); 169WEAK(avanti_mv); 170WEAK(cabriolet_mv); 171WEAK(clipper_mv); 172WEAK(dp264_mv); 173WEAK(eb164_mv); 174WEAK(eb64p_mv); 175WEAK(eb66_mv); 176WEAK(eb66p_mv); 177WEAK(eiger_mv); 178WEAK(jensen_mv); 179WEAK(lx164_mv); 180WEAK(lynx_mv); 181WEAK(marvel_ev7_mv); 182WEAK(miata_mv); 183WEAK(mikasa_mv); 184WEAK(mikasa_primo_mv); 185WEAK(monet_mv); 186WEAK(nautilus_mv); 187WEAK(noname_mv); 188WEAK(noritake_mv); 189WEAK(noritake_primo_mv); 190WEAK(p2k_mv); 191WEAK(pc164_mv); 192WEAK(privateer_mv); 193WEAK(rawhide_mv); 194WEAK(ruffian_mv); 195WEAK(rx164_mv); 196WEAK(sable_mv); 197WEAK(sable_gamma_mv); 198WEAK(shark_mv); 199WEAK(sx164_mv); 200WEAK(takara_mv); 201WEAK(titan_mv); 202WEAK(webbrick_mv); 203WEAK(wildfire_mv); 204WEAK(xl_mv); 205WEAK(xlt_mv); 206 207#undef WEAK 208 209/* 210 * I/O resources inherited from PeeCees. Except for perhaps the 211 * turbochannel alphas, everyone has these on some sort of SuperIO chip. 212 * 213 * ??? If this becomes less standard, move the struct out into the 214 * machine vector. 215 */ 216 217static void __init 218reserve_std_resources(void) 219{ 220 static struct resource standard_io_resources[] = { 221 { .name = "rtc", .start = -1, .end = -1 }, 222 { .name = "dma1", .start = 0x00, .end = 0x1f }, 223 { .name = "pic1", .start = 0x20, .end = 0x3f }, 224 { .name = "timer", .start = 0x40, .end = 0x5f }, 225 { .name = "keyboard", .start = 0x60, .end = 0x6f }, 226 { .name = "dma page reg", .start = 0x80, .end = 0x8f }, 227 { .name = "pic2", .start = 0xa0, .end = 0xbf }, 228 { .name = "dma2", .start = 0xc0, .end = 0xdf }, 229 }; 230 231 struct resource *io = &ioport_resource; 232 size_t i; 233 234 if (hose_head) { 235 struct pci_controller *hose; 236 for (hose = hose_head; hose; hose = hose->next) 237 if (hose->index == 0) { 238 io = hose->io_space; 239 break; 240 } 241 } 242 243 /* Fix up for the Jensen's queer RTC placement. */ 244 standard_io_resources[0].start = RTC_PORT(0); 245 standard_io_resources[0].end = RTC_PORT(0) + 0x10; 246 247 for (i = 0; i < ARRAY_SIZE(standard_io_resources); ++i) 248 request_resource(io, standard_io_resources+i); 249} 250 251#define PFN_MAX PFN_DOWN(0x80000000) 252#define for_each_mem_cluster(memdesc, cluster, i) \ 253 for ((cluster) = (memdesc)->cluster, (i) = 0; \ 254 (i) < (memdesc)->numclusters; (i)++, (cluster)++) 255 256static unsigned long __init 257get_mem_size_limit(char *s) 258{ 259 unsigned long end = 0; 260 char *from = s; 261 262 end = simple_strtoul(from, &from, 0); 263 if ( *from == 'K' || *from == 'k' ) { 264 end = end << 10; 265 from++; 266 } else if ( *from == 'M' || *from == 'm' ) { 267 end = end << 20; 268 from++; 269 } else if ( *from == 'G' || *from == 'g' ) { 270 end = end << 30; 271 from++; 272 } 273 return end >> PAGE_SHIFT; /* Return the PFN of the limit. */ 274} 275 276#ifdef CONFIG_BLK_DEV_INITRD 277void * __init 278move_initrd(unsigned long mem_limit) 279{ 280 void *start; 281 unsigned long size; 282 283 size = initrd_end - initrd_start; 284 start = __alloc_bootmem(PAGE_ALIGN(size), PAGE_SIZE, 0); 285 if (!start || __pa(start) + size > mem_limit) { 286 initrd_start = initrd_end = 0; 287 return NULL; 288 } 289 memmove(start, (void *)initrd_start, size); 290 initrd_start = (unsigned long)start; 291 initrd_end = initrd_start + size; 292 printk("initrd moved to %p\n", start); 293 return start; 294} 295#endif 296 297#ifndef CONFIG_DISCONTIGMEM 298static void __init 299setup_memory(void *kernel_end) 300{ 301 struct memclust_struct * cluster; 302 struct memdesc_struct * memdesc; 303 unsigned long start_kernel_pfn, end_kernel_pfn; 304 unsigned long bootmap_size, bootmap_pages, bootmap_start; 305 unsigned long start, end; 306 unsigned long i; 307 308 /* Find free clusters, and init and free the bootmem accordingly. */ 309 memdesc = (struct memdesc_struct *) 310 (hwrpb->mddt_offset + (unsigned long) hwrpb); 311 312 for_each_mem_cluster(memdesc, cluster, i) { 313 printk("memcluster %lu, usage %01lx, start %8lu, end %8lu\n", 314 i, cluster->usage, cluster->start_pfn, 315 cluster->start_pfn + cluster->numpages); 316 317 /* Bit 0 is console/PALcode reserved. Bit 1 is 318 non-volatile memory -- we might want to mark 319 this for later. */ 320 if (cluster->usage & 3) 321 continue; 322 323 end = cluster->start_pfn + cluster->numpages; 324 if (end > max_low_pfn) 325 max_low_pfn = end; 326 } 327 328 /* 329 * Except for the NUMA systems (wildfire, marvel) all of the 330 * Alpha systems we run on support 32GB of memory or less. 331 * Since the NUMA systems introduce large holes in memory addressing, 332 * we can get into a situation where there is not enough contiguous 333 * memory for the memory map. 334 * 335 * Limit memory to the first 32GB to limit the NUMA systems to 336 * memory on their first node (wildfire) or 2 (marvel) to avoid 337 * not being able to produce the memory map. In order to access 338 * all of the memory on the NUMA systems, build with discontiguous 339 * memory support. 340 * 341 * If the user specified a memory limit, let that memory limit stand. 342 */ 343 if (!mem_size_limit) 344 mem_size_limit = (32ul * 1024 * 1024 * 1024) >> PAGE_SHIFT; 345 346 if (mem_size_limit && max_low_pfn >= mem_size_limit) 347 { 348 printk("setup: forcing memory size to %ldK (from %ldK).\n", 349 mem_size_limit << (PAGE_SHIFT - 10), 350 max_low_pfn << (PAGE_SHIFT - 10)); 351 max_low_pfn = mem_size_limit; 352 } 353 354 /* Find the bounds of kernel memory. */ 355 start_kernel_pfn = PFN_DOWN(KERNEL_START_PHYS); 356 end_kernel_pfn = PFN_UP(virt_to_phys(kernel_end)); 357 bootmap_start = -1; 358 359 try_again: 360 if (max_low_pfn <= end_kernel_pfn) 361 panic("not enough memory to boot"); 362 363 /* We need to know how many physically contiguous pages 364 we'll need for the bootmap. */ 365 bootmap_pages = bootmem_bootmap_pages(max_low_pfn); 366 367 /* Now find a good region where to allocate the bootmap. */ 368 for_each_mem_cluster(memdesc, cluster, i) { 369 if (cluster->usage & 3) 370 continue; 371 372 start = cluster->start_pfn; 373 end = start + cluster->numpages; 374 if (start >= max_low_pfn) 375 continue; 376 if (end > max_low_pfn) 377 end = max_low_pfn; 378 if (start < start_kernel_pfn) { 379 if (end > end_kernel_pfn 380 && end - end_kernel_pfn >= bootmap_pages) { 381 bootmap_start = end_kernel_pfn; 382 break; 383 } else if (end > start_kernel_pfn) 384 end = start_kernel_pfn; 385 } else if (start < end_kernel_pfn) 386 start = end_kernel_pfn; 387 if (end - start >= bootmap_pages) { 388 bootmap_start = start; 389 break; 390 } 391 } 392 393 if (bootmap_start == ~0UL) { 394 max_low_pfn >>= 1; 395 goto try_again; 396 } 397 398 /* Allocate the bootmap and mark the whole MM as reserved. */ 399 bootmap_size = init_bootmem(bootmap_start, max_low_pfn); 400 401 /* Mark the free regions. */ 402 for_each_mem_cluster(memdesc, cluster, i) { 403 if (cluster->usage & 3) 404 continue; 405 406 start = cluster->start_pfn; 407 end = cluster->start_pfn + cluster->numpages; 408 if (start >= max_low_pfn) 409 continue; 410 if (end > max_low_pfn) 411 end = max_low_pfn; 412 if (start < start_kernel_pfn) { 413 if (end > end_kernel_pfn) { 414 free_bootmem(PFN_PHYS(start), 415 (PFN_PHYS(start_kernel_pfn) 416 - PFN_PHYS(start))); 417 printk("freeing pages %ld:%ld\n", 418 start, start_kernel_pfn); 419 start = end_kernel_pfn; 420 } else if (end > start_kernel_pfn) 421 end = start_kernel_pfn; 422 } else if (start < end_kernel_pfn) 423 start = end_kernel_pfn; 424 if (start >= end) 425 continue; 426 427 free_bootmem(PFN_PHYS(start), PFN_PHYS(end) - PFN_PHYS(start)); 428 printk("freeing pages %ld:%ld\n", start, end); 429 } 430 431 /* Reserve the bootmap memory. */ 432 reserve_bootmem(PFN_PHYS(bootmap_start), bootmap_size); 433 printk("reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size)); 434 435#ifdef CONFIG_BLK_DEV_INITRD 436 initrd_start = INITRD_START; 437 if (initrd_start) { 438 initrd_end = initrd_start+INITRD_SIZE; 439 printk("Initial ramdisk at: 0x%p (%lu bytes)\n", 440 (void *) initrd_start, INITRD_SIZE); 441 442 if ((void *)initrd_end > phys_to_virt(PFN_PHYS(max_low_pfn))) { 443 if (!move_initrd(PFN_PHYS(max_low_pfn))) 444 printk("initrd extends beyond end of memory " 445 "(0x%08lx > 0x%p)\ndisabling initrd\n", 446 initrd_end, 447 phys_to_virt(PFN_PHYS(max_low_pfn))); 448 } else { 449 reserve_bootmem(virt_to_phys((void *)initrd_start), 450 INITRD_SIZE); 451 } 452 } 453#endif /* CONFIG_BLK_DEV_INITRD */ 454} 455#else 456extern void setup_memory(void *); 457#endif /* !CONFIG_DISCONTIGMEM */ 458 459int __init 460page_is_ram(unsigned long pfn) 461{ 462 struct memclust_struct * cluster; 463 struct memdesc_struct * memdesc; 464 unsigned long i; 465 466 memdesc = (struct memdesc_struct *) 467 (hwrpb->mddt_offset + (unsigned long) hwrpb); 468 for_each_mem_cluster(memdesc, cluster, i) 469 { 470 if (pfn >= cluster->start_pfn && 471 pfn < cluster->start_pfn + cluster->numpages) { 472 return (cluster->usage & 3) ? 0 : 1; 473 } 474 } 475 476 return 0; 477} 478 479static int __init 480register_cpus(void) 481{ 482 int i; 483 484 for_each_possible_cpu(i) { 485 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); 486 if (!p) 487 return -ENOMEM; 488 register_cpu(p, i); 489 } 490 return 0; 491} 492 493arch_initcall(register_cpus); 494 495void __init 496setup_arch(char **cmdline_p) 497{ 498 extern char _end[]; 499 500 struct alpha_machine_vector *vec = NULL; 501 struct percpu_struct *cpu; 502 char *type_name, *var_name, *p; 503 void *kernel_end = _end; /* end of kernel */ 504 char *args = command_line; 505 506 hwrpb = (struct hwrpb_struct*) __va(INIT_HWRPB->phys_addr); 507 boot_cpuid = hard_smp_processor_id(); 508 509 /* 510 * Pre-process the system type to make sure it will be valid. 511 * 512 * This may restore real CABRIO and EB66+ family names, ie 513 * EB64+ and EB66. 514 * 515 * Oh, and "white box" AS800 (aka DIGITAL Server 3000 series) 516 * and AS1200 (DIGITAL Server 5000 series) have the type as 517 * the negative of the real one. 518 */ 519 if ((long)hwrpb->sys_type < 0) { 520 hwrpb->sys_type = -((long)hwrpb->sys_type); 521 hwrpb_update_checksum(hwrpb); 522 } 523 524 /* Register a call for panic conditions. */ 525 atomic_notifier_chain_register(&panic_notifier_list, 526 &alpha_panic_block); 527 528#ifdef CONFIG_ALPHA_GENERIC 529 /* Assume that we've booted from SRM if we haven't booted from MILO. 530 Detect the later by looking for "MILO" in the system serial nr. */ 531 alpha_using_srm = strncmp((const char *)hwrpb->ssn, "MILO", 4) != 0; 532#endif 533 534 /* If we are using SRM, we want to allow callbacks 535 as early as possible, so do this NOW, and then 536 they should work immediately thereafter. 537 */ 538 kernel_end = callback_init(kernel_end); 539 540 /* 541 * Locate the command line. 542 */ 543 /* Hack for Jensen... since we're restricted to 8 or 16 chars for 544 boot flags depending on the boot mode, we need some shorthand. 545 This should do for installation. */ 546 if (strcmp(COMMAND_LINE, "INSTALL") == 0) { 547 strlcpy(command_line, "root=/dev/fd0 load_ramdisk=1", sizeof command_line); 548 } else { 549 strlcpy(command_line, COMMAND_LINE, sizeof command_line); 550 } 551 strcpy(boot_command_line, command_line); 552 *cmdline_p = command_line; 553 554 /* 555 * Process command-line arguments. 556 */ 557 while ((p = strsep(&args, " \t")) != NULL) { 558 if (!*p) continue; 559 if (strncmp(p, "alpha_mv=", 9) == 0) { 560 vec = get_sysvec_byname(p+9); 561 continue; 562 } 563 if (strncmp(p, "cycle=", 6) == 0) { 564 est_cycle_freq = simple_strtol(p+6, NULL, 0); 565 continue; 566 } 567 if (strncmp(p, "mem=", 4) == 0) { 568 mem_size_limit = get_mem_size_limit(p+4); 569 continue; 570 } 571 if (strncmp(p, "srmcons", 7) == 0) { 572 srmcons_output |= 1; 573 continue; 574 } 575 if (strncmp(p, "console=srm", 11) == 0) { 576 srmcons_output |= 2; 577 continue; 578 } 579 if (strncmp(p, "gartsize=", 9) == 0) { 580 alpha_agpgart_size = 581 get_mem_size_limit(p+9) << PAGE_SHIFT; 582 continue; 583 } 584#ifdef CONFIG_VERBOSE_MCHECK 585 if (strncmp(p, "verbose_mcheck=", 15) == 0) { 586 alpha_verbose_mcheck = simple_strtol(p+15, NULL, 0); 587 continue; 588 } 589#endif 590 } 591 592 /* Replace the command line, now that we've killed it with strsep. */ 593 strcpy(command_line, boot_command_line); 594 595 /* If we want SRM console printk echoing early, do it now. */ 596 if (alpha_using_srm && srmcons_output) { 597 register_srm_console(); 598 599 /* 600 * If "console=srm" was specified, clear the srmcons_output 601 * flag now so that time.c won't unregister_srm_console 602 */ 603 if (srmcons_output & 2) 604 srmcons_output = 0; 605 } 606 607#ifdef CONFIG_MAGIC_SYSRQ 608 /* If we're using SRM, make sysrq-b halt back to the prom, 609 not auto-reboot. */ 610 if (alpha_using_srm) { 611 struct sysrq_key_op *op = __sysrq_get_key_op('b'); 612 op->handler = (void *) machine_halt; 613 } 614#endif 615 616 /* 617 * Identify and reconfigure for the current system. 618 */ 619 cpu = (struct percpu_struct*)((char*)hwrpb + hwrpb->processor_offset); 620 621 get_sysnames(hwrpb->sys_type, hwrpb->sys_variation, 622 cpu->type, &type_name, &var_name); 623 if (*var_name == '0') 624 var_name = ""; 625 626 if (!vec) { 627 vec = get_sysvec(hwrpb->sys_type, hwrpb->sys_variation, 628 cpu->type); 629 } 630 631 if (!vec) { 632 panic("Unsupported system type: %s%s%s (%ld %ld)\n", 633 type_name, (*var_name ? " variation " : ""), var_name, 634 hwrpb->sys_type, hwrpb->sys_variation); 635 } 636 if (vec != &alpha_mv) { 637 alpha_mv = *vec; 638 } 639 640 printk("Booting " 641#ifdef CONFIG_ALPHA_GENERIC 642 "GENERIC " 643#endif 644 "on %s%s%s using machine vector %s from %s\n", 645 type_name, (*var_name ? " variation " : ""), 646 var_name, alpha_mv.vector_name, 647 (alpha_using_srm ? "SRM" : "MILO")); 648 649 printk("Major Options: " 650#ifdef CONFIG_SMP 651 "SMP " 652#endif 653#ifdef CONFIG_ALPHA_EV56 654 "EV56 " 655#endif 656#ifdef CONFIG_ALPHA_EV67 657 "EV67 " 658#endif 659#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS 660 "LEGACY_START " 661#endif 662#ifdef CONFIG_VERBOSE_MCHECK 663 "VERBOSE_MCHECK " 664#endif 665 666#ifdef CONFIG_DISCONTIGMEM 667 "DISCONTIGMEM " 668#ifdef CONFIG_NUMA 669 "NUMA " 670#endif 671#endif 672 673#ifdef CONFIG_DEBUG_SPINLOCK 674 "DEBUG_SPINLOCK " 675#endif 676#ifdef CONFIG_MAGIC_SYSRQ 677 "MAGIC_SYSRQ " 678#endif 679 "\n"); 680 681 printk("Command line: %s\n", command_line); 682 683 /* 684 * Sync up the HAE. 685 * Save the SRM's current value for restoration. 686 */ 687 srm_hae = *alpha_mv.hae_register; 688 __set_hae(alpha_mv.hae_cache); 689 690 /* Reset enable correctable error reports. */ 691 wrmces(0x7); 692 693 /* Find our memory. */ 694 setup_memory(kernel_end); 695 696 /* First guess at cpu cache sizes. Do this before init_arch. */ 697 determine_cpu_caches(cpu->type); 698 699 /* Initialize the machine. Usually has to do with setting up 700 DMA windows and the like. */ 701 if (alpha_mv.init_arch) 702 alpha_mv.init_arch(); 703 704 /* Reserve standard resources. */ 705 reserve_std_resources(); 706 707 /* 708 * Give us a default console. TGA users will see nothing until 709 * chr_dev_init is called, rather late in the boot sequence. 710 */ 711 712#ifdef CONFIG_VT 713#if defined(CONFIG_VGA_CONSOLE) 714 conswitchp = &vga_con; 715#elif defined(CONFIG_DUMMY_CONSOLE) 716 conswitchp = &dummy_con; 717#endif 718#endif 719 720 /* Default root filesystem to sda2. */ 721 ROOT_DEV = Root_SDA2; 722 723#ifdef CONFIG_EISA 724 EISA_bus = 1; 725#endif 726 727 728 if (hwrpb->max_asn != MAX_ASN) { 729 printk("Max ASN from HWRPB is bad (0x%lx)\n", hwrpb->max_asn); 730 } 731 732 /* 733 * Identify the flock of penguins. 734 */ 735 736#ifdef CONFIG_SMP 737 setup_smp(); 738#endif 739 paging_init(); 740} 741 742static char sys_unknown[] = "Unknown"; 743static char systype_names[][16] = { 744 "0", 745 "ADU", "Cobra", "Ruby", "Flamingo", "Mannequin", "Jensen", 746 "Pelican", "Morgan", "Sable", "Medulla", "Noname", 747 "Turbolaser", "Avanti", "Mustang", "Alcor", "Tradewind", 748 "Mikasa", "EB64", "EB66", "EB64+", "AlphaBook1", 749 "Rawhide", "K2", "Lynx", "XL", "EB164", "Noritake", 750 "Cortex", "29", "Miata", "XXM", "Takara", "Yukon", 751 "Tsunami", "Wildfire", "CUSCO", "Eiger", "Titan", "Marvel" 752}; 753 754static char unofficial_names[][8] = {"100", "Ruffian"}; 755 756static char api_names[][16] = {"200", "Nautilus"}; 757 758static char eb164_names[][8] = {"EB164", "PC164", "LX164", "SX164", "RX164"}; 759static int eb164_indices[] = {0,0,0,1,1,1,1,1,2,2,2,2,3,3,3,3,4}; 760 761static char alcor_names[][16] = {"Alcor", "Maverick", "Bret"}; 762static int alcor_indices[] = {0,0,0,1,1,1,0,0,0,0,0,0,2,2,2,2,2,2}; 763 764static char eb64p_names[][16] = {"EB64+", "Cabriolet", "AlphaPCI64"}; 765static int eb64p_indices[] = {0,0,1,2}; 766 767static char eb66_names[][8] = {"EB66", "EB66+"}; 768static int eb66_indices[] = {0,0,1}; 769 770static char marvel_names[][16] = { 771 "Marvel/EV7" 772}; 773static int marvel_indices[] = { 0 }; 774 775static char rawhide_names[][16] = { 776 "Dodge", "Wrangler", "Durango", "Tincup", "DaVinci" 777}; 778static int rawhide_indices[] = {0,0,0,1,1,2,2,3,3,4,4}; 779 780static char titan_names[][16] = { 781 "DEFAULT", "Privateer", "Falcon", "Granite" 782}; 783static int titan_indices[] = {0,1,2,2,3}; 784 785static char tsunami_names[][16] = { 786 "0", "DP264", "Warhol", "Windjammer", "Monet", "Clipper", 787 "Goldrush", "Webbrick", "Catamaran", "Brisbane", "Melbourne", 788 "Flying Clipper", "Shark" 789}; 790static int tsunami_indices[] = {0,1,2,3,4,5,6,7,8,9,10,11,12}; 791 792static struct alpha_machine_vector * __init 793get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu) 794{ 795 static struct alpha_machine_vector *systype_vecs[] __initdata = 796 { 797 NULL, /* 0 */ 798 NULL, /* ADU */ 799 NULL, /* Cobra */ 800 NULL, /* Ruby */ 801 NULL, /* Flamingo */ 802 NULL, /* Mannequin */ 803 &jensen_mv, 804 NULL, /* Pelican */ 805 NULL, /* Morgan */ 806 NULL, /* Sable -- see below. */ 807 NULL, /* Medulla */ 808 &noname_mv, 809 NULL, /* Turbolaser */ 810 &avanti_mv, 811 NULL, /* Mustang */ 812 NULL, /* Alcor, Bret, Maverick. HWRPB inaccurate? */ 813 NULL, /* Tradewind */ 814 NULL, /* Mikasa -- see below. */ 815 NULL, /* EB64 */ 816 NULL, /* EB66 -- see variation. */ 817 NULL, /* EB64+ -- see variation. */ 818 &alphabook1_mv, 819 &rawhide_mv, 820 NULL, /* K2 */ 821 &lynx_mv, /* Lynx */ 822 &xl_mv, 823 NULL, /* EB164 -- see variation. */ 824 NULL, /* Noritake -- see below. */ 825 NULL, /* Cortex */ 826 NULL, /* 29 */ 827 &miata_mv, 828 NULL, /* XXM */ 829 &takara_mv, 830 NULL, /* Yukon */ 831 NULL, /* Tsunami -- see variation. */ 832 &wildfire_mv, /* Wildfire */ 833 NULL, /* CUSCO */ 834 &eiger_mv, /* Eiger */ 835 NULL, /* Titan */ 836 NULL, /* Marvel */ 837 }; 838 839 static struct alpha_machine_vector *unofficial_vecs[] __initdata = 840 { 841 NULL, /* 100 */ 842 &ruffian_mv, 843 }; 844 845 static struct alpha_machine_vector *api_vecs[] __initdata = 846 { 847 NULL, /* 200 */ 848 &nautilus_mv, 849 }; 850 851 static struct alpha_machine_vector *alcor_vecs[] __initdata = 852 { 853 &alcor_mv, &xlt_mv, &xlt_mv 854 }; 855 856 static struct alpha_machine_vector *eb164_vecs[] __initdata = 857 { 858 &eb164_mv, &pc164_mv, &lx164_mv, &sx164_mv, &rx164_mv 859 }; 860 861 static struct alpha_machine_vector *eb64p_vecs[] __initdata = 862 { 863 &eb64p_mv, 864 &cabriolet_mv, 865 &cabriolet_mv /* AlphaPCI64 */ 866 }; 867 868 static struct alpha_machine_vector *eb66_vecs[] __initdata = 869 { 870 &eb66_mv, 871 &eb66p_mv 872 }; 873 874 static struct alpha_machine_vector *marvel_vecs[] __initdata = 875 { 876 &marvel_ev7_mv, 877 }; 878 879 static struct alpha_machine_vector *titan_vecs[] __initdata = 880 { 881 &titan_mv, /* default */ 882 &privateer_mv, /* privateer */ 883 &titan_mv, /* falcon */ 884 &privateer_mv, /* granite */ 885 }; 886 887 static struct alpha_machine_vector *tsunami_vecs[] __initdata = 888 { 889 NULL, 890 &dp264_mv, /* dp264 */ 891 &dp264_mv, /* warhol */ 892 &dp264_mv, /* windjammer */ 893 &monet_mv, /* monet */ 894 &clipper_mv, /* clipper */ 895 &dp264_mv, /* goldrush */ 896 &webbrick_mv, /* webbrick */ 897 &dp264_mv, /* catamaran */ 898 NULL, /* brisbane? */ 899 NULL, /* melbourne? */ 900 NULL, /* flying clipper? */ 901 &shark_mv, /* shark */ 902 }; 903 904 /* ??? Do we need to distinguish between Rawhides? */ 905 906 struct alpha_machine_vector *vec; 907 908 /* Search the system tables first... */ 909 vec = NULL; 910 if (type < ARRAY_SIZE(systype_vecs)) { 911 vec = systype_vecs[type]; 912 } else if ((type > ST_API_BIAS) && 913 (type - ST_API_BIAS) < ARRAY_SIZE(api_vecs)) { 914 vec = api_vecs[type - ST_API_BIAS]; 915 } else if ((type > ST_UNOFFICIAL_BIAS) && 916 (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_vecs)) { 917 vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS]; 918 } 919 920 /* If we've not found one, try for a variation. */ 921 922 if (!vec) { 923 /* Member ID is a bit-field. */ 924 unsigned long member = (variation >> 10) & 0x3f; 925 926 cpu &= 0xffffffff; /* make it usable */ 927 928 switch (type) { 929 case ST_DEC_ALCOR: 930 if (member < ARRAY_SIZE(alcor_indices)) 931 vec = alcor_vecs[alcor_indices[member]]; 932 break; 933 case ST_DEC_EB164: 934 if (member < ARRAY_SIZE(eb164_indices)) 935 vec = eb164_vecs[eb164_indices[member]]; 936 /* PC164 may show as EB164 variation with EV56 CPU, 937 but, since no true EB164 had anything but EV5... */ 938 if (vec == &eb164_mv && cpu == EV56_CPU) 939 vec = &pc164_mv; 940 break; 941 case ST_DEC_EB64P: 942 if (member < ARRAY_SIZE(eb64p_indices)) 943 vec = eb64p_vecs[eb64p_indices[member]]; 944 break; 945 case ST_DEC_EB66: 946 if (member < ARRAY_SIZE(eb66_indices)) 947 vec = eb66_vecs[eb66_indices[member]]; 948 break; 949 case ST_DEC_MARVEL: 950 if (member < ARRAY_SIZE(marvel_indices)) 951 vec = marvel_vecs[marvel_indices[member]]; 952 break; 953 case ST_DEC_TITAN: 954 vec = titan_vecs[0]; /* default */ 955 if (member < ARRAY_SIZE(titan_indices)) 956 vec = titan_vecs[titan_indices[member]]; 957 break; 958 case ST_DEC_TSUNAMI: 959 if (member < ARRAY_SIZE(tsunami_indices)) 960 vec = tsunami_vecs[tsunami_indices[member]]; 961 break; 962 case ST_DEC_1000: 963 if (cpu == EV5_CPU || cpu == EV56_CPU) 964 vec = &mikasa_primo_mv; 965 else 966 vec = &mikasa_mv; 967 break; 968 case ST_DEC_NORITAKE: 969 if (cpu == EV5_CPU || cpu == EV56_CPU) 970 vec = &noritake_primo_mv; 971 else 972 vec = &noritake_mv; 973 break; 974 case ST_DEC_2100_A500: 975 if (cpu == EV5_CPU || cpu == EV56_CPU) 976 vec = &sable_gamma_mv; 977 else 978 vec = &sable_mv; 979 break; 980 } 981 } 982 return vec; 983} 984 985static struct alpha_machine_vector * __init 986get_sysvec_byname(const char *name) 987{ 988 static struct alpha_machine_vector *all_vecs[] __initdata = 989 { 990 &alcor_mv, 991 &alphabook1_mv, 992 &avanti_mv, 993 &cabriolet_mv, 994 &clipper_mv, 995 &dp264_mv, 996 &eb164_mv, 997 &eb64p_mv, 998 &eb66_mv, 999 &eb66p_mv, 1000 &eiger_mv, 1001 &jensen_mv, 1002 &lx164_mv, 1003 &lynx_mv, 1004 &miata_mv, 1005 &mikasa_mv, 1006 &mikasa_primo_mv, 1007 &monet_mv, 1008 &nautilus_mv, 1009 &noname_mv, 1010 &noritake_mv, 1011 &noritake_primo_mv, 1012 &p2k_mv, 1013 &pc164_mv, 1014 &privateer_mv, 1015 &rawhide_mv, 1016 &ruffian_mv, 1017 &rx164_mv, 1018 &sable_mv, 1019 &sable_gamma_mv, 1020 &shark_mv, 1021 &sx164_mv, 1022 &takara_mv, 1023 &webbrick_mv, 1024 &wildfire_mv, 1025 &xl_mv, 1026 &xlt_mv 1027 }; 1028 1029 size_t i; 1030 1031 for (i = 0; i < ARRAY_SIZE(all_vecs); ++i) { 1032 struct alpha_machine_vector *mv = all_vecs[i]; 1033 if (strcasecmp(mv->vector_name, name) == 0) 1034 return mv; 1035 } 1036 return NULL; 1037} 1038 1039static void 1040get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu, 1041 char **type_name, char **variation_name) 1042{ 1043 unsigned long member; 1044 1045 /* If not in the tables, make it UNKNOWN, 1046 else set type name to family */ 1047 if (type < ARRAY_SIZE(systype_names)) { 1048 *type_name = systype_names[type]; 1049 } else if ((type > ST_API_BIAS) && 1050 (type - ST_API_BIAS) < ARRAY_SIZE(api_names)) { 1051 *type_name = api_names[type - ST_API_BIAS]; 1052 } else if ((type > ST_UNOFFICIAL_BIAS) && 1053 (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_names)) { 1054 *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS]; 1055 } else { 1056 *type_name = sys_unknown; 1057 *variation_name = sys_unknown; 1058 return; 1059 } 1060 1061 /* Set variation to "0"; if variation is zero, done. */ 1062 *variation_name = systype_names[0]; 1063 if (variation == 0) { 1064 return; 1065 } 1066 1067 member = (variation >> 10) & 0x3f; /* member ID is a bit-field */ 1068 1069 cpu &= 0xffffffff; /* make it usable */ 1070 1071 switch (type) { /* select by family */ 1072 default: /* default to variation "0" for now */ 1073 break; 1074 case ST_DEC_EB164: 1075 if (member < ARRAY_SIZE(eb164_indices)) 1076 *variation_name = eb164_names[eb164_indices[member]]; 1077 /* PC164 may show as EB164 variation, but with EV56 CPU, 1078 so, since no true EB164 had anything but EV5... */ 1079 if (eb164_indices[member] == 0 && cpu == EV56_CPU) 1080 *variation_name = eb164_names[1]; /* make it PC164 */ 1081 break; 1082 case ST_DEC_ALCOR: 1083 if (member < ARRAY_SIZE(alcor_indices)) 1084 *variation_name = alcor_names[alcor_indices[member]]; 1085 break; 1086 case ST_DEC_EB64P: 1087 if (member < ARRAY_SIZE(eb64p_indices)) 1088 *variation_name = eb64p_names[eb64p_indices[member]]; 1089 break; 1090 case ST_DEC_EB66: 1091 if (member < ARRAY_SIZE(eb66_indices)) 1092 *variation_name = eb66_names[eb66_indices[member]]; 1093 break; 1094 case ST_DEC_MARVEL: 1095 if (member < ARRAY_SIZE(marvel_indices)) 1096 *variation_name = marvel_names[marvel_indices[member]]; 1097 break; 1098 case ST_DEC_RAWHIDE: 1099 if (member < ARRAY_SIZE(rawhide_indices)) 1100 *variation_name = rawhide_names[rawhide_indices[member]]; 1101 break; 1102 case ST_DEC_TITAN: 1103 *variation_name = titan_names[0]; /* default */ 1104 if (member < ARRAY_SIZE(titan_indices)) 1105 *variation_name = titan_names[titan_indices[member]]; 1106 break; 1107 case ST_DEC_TSUNAMI: 1108 if (member < ARRAY_SIZE(tsunami_indices)) 1109 *variation_name = tsunami_names[tsunami_indices[member]]; 1110 break; 1111 } 1112} 1113 1114/* 1115 * A change was made to the HWRPB via an ECO and the following code 1116 * tracks a part of the ECO. In HWRPB versions less than 5, the ECO 1117 * was not implemented in the console firmware. If it's revision 5 or 1118 * greater we can get the name of the platform as an ASCII string from 1119 * the HWRPB. That's what this function does. It checks the revision 1120 * level and if the string is in the HWRPB it returns the address of 1121 * the string--a pointer to the name of the platform. 1122 * 1123 * Returns: 1124 * - Pointer to a ASCII string if it's in the HWRPB 1125 * - Pointer to a blank string if the data is not in the HWRPB. 1126 */ 1127 1128static char * 1129platform_string(void) 1130{ 1131 struct dsr_struct *dsr; 1132 static char unk_system_string[] = "N/A"; 1133 1134 /* Go to the console for the string pointer. 1135 * If the rpb_vers is not 5 or greater the rpb 1136 * is old and does not have this data in it. 1137 */ 1138 if (hwrpb->revision < 5) 1139 return (unk_system_string); 1140 else { 1141 /* The Dynamic System Recognition struct 1142 * has the system platform name starting 1143 * after the character count of the string. 1144 */ 1145 dsr = ((struct dsr_struct *) 1146 ((char *)hwrpb + hwrpb->dsr_offset)); 1147 return ((char *)dsr + (dsr->sysname_off + 1148 sizeof(long))); 1149 } 1150} 1151 1152static int 1153get_nr_processors(struct percpu_struct *cpubase, unsigned long num) 1154{ 1155 struct percpu_struct *cpu; 1156 unsigned long i; 1157 int count = 0; 1158 1159 for (i = 0; i < num; i++) { 1160 cpu = (struct percpu_struct *) 1161 ((char *)cpubase + i*hwrpb->processor_size); 1162 if ((cpu->flags & 0x1cc) == 0x1cc) 1163 count++; 1164 } 1165 return count; 1166} 1167 1168static void 1169show_cache_size (struct seq_file *f, const char *which, int shape) 1170{ 1171 if (shape == -1) 1172 seq_printf (f, "%s\t\t: n/a\n", which); 1173 else if (shape == 0) 1174 seq_printf (f, "%s\t\t: unknown\n", which); 1175 else 1176 seq_printf (f, "%s\t\t: %dK, %d-way, %db line\n", 1177 which, shape >> 10, shape & 15, 1178 1 << ((shape >> 4) & 15)); 1179} 1180 1181static int 1182show_cpuinfo(struct seq_file *f, void *slot) 1183{ 1184 extern struct unaligned_stat { 1185 unsigned long count, va, pc; 1186 } unaligned[2]; 1187 1188 static char cpu_names[][8] = { 1189 "EV3", "EV4", "Simulate", "LCA4", "EV5", "EV45", "EV56", 1190 "EV6", "PCA56", "PCA57", "EV67", "EV68CB", "EV68AL", 1191 "EV68CX", "EV7", "EV79", "EV69" 1192 }; 1193 1194 struct percpu_struct *cpu = slot; 1195 unsigned int cpu_index; 1196 char *cpu_name; 1197 char *systype_name; 1198 char *sysvariation_name; 1199 int nr_processors; 1200 1201 cpu_index = (unsigned) (cpu->type - 1); 1202 cpu_name = "Unknown"; 1203 if (cpu_index < ARRAY_SIZE(cpu_names)) 1204 cpu_name = cpu_names[cpu_index]; 1205 1206 get_sysnames(hwrpb->sys_type, hwrpb->sys_variation, 1207 cpu->type, &systype_name, &sysvariation_name); 1208 1209 nr_processors = get_nr_processors(cpu, hwrpb->nr_processors); 1210 1211 seq_printf(f, "cpu\t\t\t: Alpha\n" 1212 "cpu model\t\t: %s\n" 1213 "cpu variation\t\t: %ld\n" 1214 "cpu revision\t\t: %ld\n" 1215 "cpu serial number\t: %s\n" 1216 "system type\t\t: %s\n" 1217 "system variation\t: %s\n" 1218 "system revision\t\t: %ld\n" 1219 "system serial number\t: %s\n" 1220 "cycle frequency [Hz]\t: %lu %s\n" 1221 "timer frequency [Hz]\t: %lu.%02lu\n" 1222 "page size [bytes]\t: %ld\n" 1223 "phys. address bits\t: %ld\n" 1224 "max. addr. space #\t: %ld\n" 1225 "BogoMIPS\t\t: %lu.%02lu\n" 1226 "kernel unaligned acc\t: %ld (pc=%lx,va=%lx)\n" 1227 "user unaligned acc\t: %ld (pc=%lx,va=%lx)\n" 1228 "platform string\t\t: %s\n" 1229 "cpus detected\t\t: %d\n", 1230 cpu_name, cpu->variation, cpu->revision, 1231 (char*)cpu->serial_no, 1232 systype_name, sysvariation_name, hwrpb->sys_revision, 1233 (char*)hwrpb->ssn, 1234 est_cycle_freq ? : hwrpb->cycle_freq, 1235 est_cycle_freq ? "est." : "", 1236 hwrpb->intr_freq / 4096, 1237 (100 * hwrpb->intr_freq / 4096) % 100, 1238 hwrpb->pagesize, 1239 hwrpb->pa_bits, 1240 hwrpb->max_asn, 1241 loops_per_jiffy / (500000/HZ), 1242 (loops_per_jiffy / (5000/HZ)) % 100, 1243 unaligned[0].count, unaligned[0].pc, unaligned[0].va, 1244 unaligned[1].count, unaligned[1].pc, unaligned[1].va, 1245 platform_string(), nr_processors); 1246 1247#ifdef CONFIG_SMP 1248 seq_printf(f, "cpus active\t\t: %d\n" 1249 "cpu active mask\t\t: %016lx\n", 1250 num_online_cpus(), cpus_addr(cpu_possible_map)[0]); 1251#endif 1252 1253 show_cache_size (f, "L1 Icache", alpha_l1i_cacheshape); 1254 show_cache_size (f, "L1 Dcache", alpha_l1d_cacheshape); 1255 show_cache_size (f, "L2 cache", alpha_l2_cacheshape); 1256 show_cache_size (f, "L3 cache", alpha_l3_cacheshape); 1257 1258 return 0; 1259} 1260 1261static int __init 1262read_mem_block(int *addr, int stride, int size) 1263{ 1264 long nloads = size / stride, cnt, tmp; 1265 1266 __asm__ __volatile__( 1267 " rpcc %0\n" 1268 "1: ldl %3,0(%2)\n" 1269 " subq %1,1,%1\n" 1270 /* Next two XORs introduce an explicit data dependency between 1271 consecutive loads in the loop, which will give us true load 1272 latency. */ 1273 " xor %3,%2,%2\n" 1274 " xor %3,%2,%2\n" 1275 " addq %2,%4,%2\n" 1276 " bne %1,1b\n" 1277 " rpcc %3\n" 1278 " subl %3,%0,%0\n" 1279 : "=&r" (cnt), "=&r" (nloads), "=&r" (addr), "=&r" (tmp) 1280 : "r" (stride), "1" (nloads), "2" (addr)); 1281 1282 return cnt / (size / stride); 1283} 1284 1285#define CSHAPE(totalsize, linesize, assoc) \ 1286 ((totalsize & ~0xff) | (linesize << 4) | assoc) 1287 1288/* ??? EV5 supports up to 64M, but did the systems with more than 1289 16M of BCACHE ever exist? */ 1290#define MAX_BCACHE_SIZE 16*1024*1024 1291 1292/* Note that the offchip caches are direct mapped on all Alphas. */ 1293static int __init 1294external_cache_probe(int minsize, int width) 1295{ 1296 int cycles, prev_cycles = 1000000; 1297 int stride = 1 << width; 1298 long size = minsize, maxsize = MAX_BCACHE_SIZE * 2; 1299 1300 if (maxsize > (max_low_pfn + 1) << PAGE_SHIFT) 1301 maxsize = 1 << (ilog2(max_low_pfn + 1) + PAGE_SHIFT); 1302 1303 /* Get the first block cached. */ 1304 read_mem_block(__va(0), stride, size); 1305 1306 while (size < maxsize) { 1307 /* Get an average load latency in cycles. */ 1308 cycles = read_mem_block(__va(0), stride, size); 1309 if (cycles > prev_cycles * 2) { 1310 /* Fine, we exceed the cache. */ 1311 printk("%ldK Bcache detected; load hit latency %d " 1312 "cycles, load miss latency %d cycles\n", 1313 size >> 11, prev_cycles, cycles); 1314 return CSHAPE(size >> 1, width, 1); 1315 } 1316 /* Try to get the next block cached. */ 1317 read_mem_block(__va(size), stride, size); 1318 prev_cycles = cycles; 1319 size <<= 1; 1320 } 1321 return -1; /* No BCACHE found. */ 1322} 1323 1324static void __init 1325determine_cpu_caches (unsigned int cpu_type) 1326{ 1327 int L1I, L1D, L2, L3; 1328 1329 switch (cpu_type) { 1330 case EV4_CPU: 1331 case EV45_CPU: 1332 { 1333 if (cpu_type == EV4_CPU) 1334 L1I = CSHAPE(8*1024, 5, 1); 1335 else 1336 L1I = CSHAPE(16*1024, 5, 1); 1337 L1D = L1I; 1338 L3 = -1; 1339 1340 /* BIU_CTL is a write-only Abox register. PALcode has a 1341 shadow copy, and may be available from some versions 1342 of the CSERVE PALcall. If we can get it, then 1343 1344 unsigned long biu_ctl, size; 1345 size = 128*1024 * (1 << ((biu_ctl >> 28) & 7)); 1346 L2 = CSHAPE (size, 5, 1); 1347 1348 Unfortunately, we can't rely on that. 1349 */ 1350 L2 = external_cache_probe(128*1024, 5); 1351 break; 1352 } 1353 1354 case LCA4_CPU: 1355 { 1356 unsigned long car, size; 1357 1358 L1I = L1D = CSHAPE(8*1024, 5, 1); 1359 L3 = -1; 1360 1361 car = *(vuip) phys_to_virt (0x120000078UL); 1362 size = 64*1024 * (1 << ((car >> 5) & 7)); 1363 /* No typo -- 8 byte cacheline size. Whodathunk. */ 1364 L2 = (car & 1 ? CSHAPE (size, 3, 1) : -1); 1365 break; 1366 } 1367 1368 case EV5_CPU: 1369 case EV56_CPU: 1370 { 1371 unsigned long sc_ctl, width; 1372 1373 L1I = L1D = CSHAPE(8*1024, 5, 1); 1374 1375 /* Check the line size of the Scache. */ 1376 sc_ctl = *(vulp) phys_to_virt (0xfffff000a8UL); 1377 width = sc_ctl & 0x1000 ? 6 : 5; 1378 L2 = CSHAPE (96*1024, width, 3); 1379 1380 /* BC_CONTROL and BC_CONFIG are write-only IPRs. PALcode 1381 has a shadow copy, and may be available from some versions 1382 of the CSERVE PALcall. If we can get it, then 1383 1384 unsigned long bc_control, bc_config, size; 1385 size = 1024*1024 * (1 << ((bc_config & 7) - 1)); 1386 L3 = (bc_control & 1 ? CSHAPE (size, width, 1) : -1); 1387 1388 Unfortunately, we can't rely on that. 1389 */ 1390 L3 = external_cache_probe(1024*1024, width); 1391 break; 1392 } 1393 1394 case PCA56_CPU: 1395 case PCA57_CPU: 1396 { 1397 unsigned long cbox_config, size; 1398 1399 if (cpu_type == PCA56_CPU) { 1400 L1I = CSHAPE(16*1024, 6, 1); 1401 L1D = CSHAPE(8*1024, 5, 1); 1402 } else { 1403 L1I = CSHAPE(32*1024, 6, 2); 1404 L1D = CSHAPE(16*1024, 5, 1); 1405 } 1406 L3 = -1; 1407 1408 cbox_config = *(vulp) phys_to_virt (0xfffff00008UL); 1409 size = 512*1024 * (1 << ((cbox_config >> 12) & 3)); 1410 1411 L2 = external_cache_probe(512*1024, 6); 1412 break; 1413 } 1414 1415 case EV6_CPU: 1416 case EV67_CPU: 1417 case EV68CB_CPU: 1418 case EV68AL_CPU: 1419 case EV68CX_CPU: 1420 case EV69_CPU: 1421 L1I = L1D = CSHAPE(64*1024, 6, 2); 1422 L2 = external_cache_probe(1024*1024, 6); 1423 L3 = -1; 1424 break; 1425 1426 case EV7_CPU: 1427 case EV79_CPU: 1428 L1I = L1D = CSHAPE(64*1024, 6, 2); 1429 L2 = CSHAPE(7*1024*1024/4, 6, 7); 1430 L3 = -1; 1431 break; 1432 1433 default: 1434 /* Nothing known about this cpu type. */ 1435 L1I = L1D = L2 = L3 = 0; 1436 break; 1437 } 1438 1439 alpha_l1i_cacheshape = L1I; 1440 alpha_l1d_cacheshape = L1D; 1441 alpha_l2_cacheshape = L2; 1442 alpha_l3_cacheshape = L3; 1443} 1444 1445/* 1446 * We show only CPU #0 info. 1447 */ 1448static void * 1449c_start(struct seq_file *f, loff_t *pos) 1450{ 1451 return *pos ? NULL : (char *)hwrpb + hwrpb->processor_offset; 1452} 1453 1454static void * 1455c_next(struct seq_file *f, void *v, loff_t *pos) 1456{ 1457 return NULL; 1458} 1459 1460static void 1461c_stop(struct seq_file *f, void *v) 1462{ 1463} 1464 1465struct seq_operations cpuinfo_op = { 1466 .start = c_start, 1467 .next = c_next, 1468 .stop = c_stop, 1469 .show = show_cpuinfo, 1470}; 1471 1472 1473static int 1474alpha_panic_event(struct notifier_block *this, unsigned long event, void *ptr) 1475{ 1476 /* If we are using SRM and serial console, just hard halt here. */ 1477 if (alpha_using_srm && srmcons_output) 1478 __halt(); 1479 return NOTIFY_DONE; 1480} 1481 1482static __init int add_pcspkr(void) 1483{ 1484 struct platform_device *pd; 1485 int ret; 1486 1487 pd = platform_device_alloc("pcspkr", -1); 1488 if (!pd) 1489 return -ENOMEM; 1490 1491 ret = platform_device_add(pd); 1492 if (ret) 1493 platform_device_put(pd); 1494 1495 return ret; 1496} 1497device_initcall(add_pcspkr); 1498