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