1de6cc651SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later 2071327ecSAlexander Beregalov /* 31da177e4SLinus Torvalds * Initial setup-routines for HP 9000 based hardware. 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * Copyright (C) 1991, 1992, 1995 Linus Torvalds 6ef017bebSHelge Deller * Modifications for PA-RISC (C) 1999-2008 Helge Deller <[email protected]> 71da177e4SLinus Torvalds * Modifications copyright 1999 SuSE GmbH (Philipp Rumpf) 81da177e4SLinus Torvalds * Modifications copyright 2000 Martin K. Petersen <[email protected]> 91da177e4SLinus Torvalds * Modifications copyright 2000 Philipp Rumpf <[email protected]> 101da177e4SLinus Torvalds * Modifications copyright 2001 Ryan Bradetich <[email protected]> 111da177e4SLinus Torvalds * 121da177e4SLinus Torvalds * Initial PA-RISC Version: 04-23-1999 by Helge Deller 131da177e4SLinus Torvalds */ 141da177e4SLinus Torvalds #include <linux/delay.h> 151da177e4SLinus Torvalds #include <linux/init.h> 161da177e4SLinus Torvalds #include <linux/mm.h> 171da177e4SLinus Torvalds #include <linux/module.h> 181da177e4SLinus Torvalds #include <linux/seq_file.h> 191ed4714fSHelge Deller #include <linux/random.h> 201da177e4SLinus Torvalds #include <linux/slab.h> 211da177e4SLinus Torvalds #include <linux/cpu.h> 2262773112SHelge Deller #include <asm/topology.h> 23e8edc6e0SAlexey Dobriyan #include <asm/param.h> 241da177e4SLinus Torvalds #include <asm/cache.h> 251da177e4SLinus Torvalds #include <asm/hardware.h> /* for register_parisc_driver() stuff */ 261da177e4SLinus Torvalds #include <asm/processor.h> 271da177e4SLinus Torvalds #include <asm/page.h> 281da177e4SLinus Torvalds #include <asm/pdc.h> 291da177e4SLinus Torvalds #include <asm/pdcpat.h> 301da177e4SLinus Torvalds #include <asm/irq.h> /* for struct irq_region */ 311da177e4SLinus Torvalds #include <asm/parisc-device.h> 321da177e4SLinus Torvalds 33d9888369SHelge Deller struct system_cpuinfo_parisc boot_cpu_data __ro_after_init; 341da177e4SLinus Torvalds EXPORT_SYMBOL(boot_cpu_data); 35fc632575SHelge Deller #ifdef CONFIG_PA8X00 36d9888369SHelge Deller int _parisc_requires_coherency __ro_after_init; 37fc632575SHelge Deller EXPORT_SYMBOL(_parisc_requires_coherency); 38fc632575SHelge Deller #endif 391da177e4SLinus Torvalds 40ef017bebSHelge Deller DEFINE_PER_CPU(struct cpuinfo_parisc, cpu_data); 411da177e4SLinus Torvalds 421da177e4SLinus Torvalds /* 431da177e4SLinus Torvalds ** PARISC CPU driver - claim "device" and initialize CPU data structures. 441da177e4SLinus Torvalds ** 451da177e4SLinus Torvalds ** Consolidate per CPU initialization into (mostly) one module. 461da177e4SLinus Torvalds ** Monarch CPU will initialize boot_cpu_data which shouldn't 471da177e4SLinus Torvalds ** change once the system has booted. 481da177e4SLinus Torvalds ** 491da177e4SLinus Torvalds ** The callback *should* do per-instance initialization of 501da177e4SLinus Torvalds ** everything including the monarch. "Per CPU" init code in 511da177e4SLinus Torvalds ** setup.c:start_parisc() has migrated here and start_parisc() 521da177e4SLinus Torvalds ** will call register_parisc_driver(&cpu_driver) before calling do_inventory(). 531da177e4SLinus Torvalds ** 541da177e4SLinus Torvalds ** The goal of consolidating CPU initialization into one place is 557022672eSSimon Arlott ** to make sure all CPUs get initialized the same way. 561da177e4SLinus Torvalds ** The code path not shared is how PDC hands control of the CPU to the OS. 571da177e4SLinus Torvalds ** The initialization of OS data structures is the same (done below). 581da177e4SLinus Torvalds */ 591da177e4SLinus Torvalds 601da177e4SLinus Torvalds /** 61ef017bebSHelge Deller * init_cpu_profiler - enable/setup per cpu profiling hooks. 62ef017bebSHelge Deller * @cpunum: The processor instance. 63ef017bebSHelge Deller * 64ef017bebSHelge Deller * FIXME: doesn't do much yet... 65ef017bebSHelge Deller */ 6660ffef06SPaul Gortmaker static void 67ef017bebSHelge Deller init_percpu_prof(unsigned long cpunum) 68ef017bebSHelge Deller { 69ef017bebSHelge Deller } 70ef017bebSHelge Deller 71ef017bebSHelge Deller 72ef017bebSHelge Deller /** 731da177e4SLinus Torvalds * processor_probe - Determine if processor driver should claim this device. 741da177e4SLinus Torvalds * @dev: The device which has been found. 751da177e4SLinus Torvalds * 761da177e4SLinus Torvalds * Determine if processor driver should claim this chip (return 0) or not 771da177e4SLinus Torvalds * (return 1). If so, initialize the chip and tell other partners in crime 781da177e4SLinus Torvalds * they have work to do. 791da177e4SLinus Torvalds */ 806c706b93SHelge Deller static int __init processor_probe(struct parisc_device *dev) 811da177e4SLinus Torvalds { 821da177e4SLinus Torvalds unsigned long txn_addr; 831da177e4SLinus Torvalds unsigned long cpuid; 841da177e4SLinus Torvalds struct cpuinfo_parisc *p; 85c8c37359SHelge Deller struct pdc_pat_cpu_num cpu_info = { }; 861da177e4SLinus Torvalds 87f8b9e594SKyle McMartin #ifdef CONFIG_SMP 88bd071e1aSRusty Russell if (num_online_cpus() >= nr_cpu_ids) { 89bd071e1aSRusty Russell printk(KERN_INFO "num_online_cpus() >= nr_cpu_ids\n"); 90f8b9e594SKyle McMartin return 1; 91f8b9e594SKyle McMartin } 92f8b9e594SKyle McMartin #else 931da177e4SLinus Torvalds if (boot_cpu_data.cpu_count > 0) { 941da177e4SLinus Torvalds printk(KERN_INFO "CONFIG_SMP=n ignoring additional CPUs\n"); 951da177e4SLinus Torvalds return 1; 961da177e4SLinus Torvalds } 971da177e4SLinus Torvalds #endif 981da177e4SLinus Torvalds 991da177e4SLinus Torvalds /* logical CPU ID and update global counter 1001da177e4SLinus Torvalds * May get overwritten by PAT code. 1011da177e4SLinus Torvalds */ 1021da177e4SLinus Torvalds cpuid = boot_cpu_data.cpu_count; 10353f01bbaSMatthew Wilcox txn_addr = dev->hpa.start; /* for legacy PDC */ 104c8c37359SHelge Deller cpu_info.cpu_num = cpu_info.cpu_loc = cpuid; 1051da177e4SLinus Torvalds 106a8f44e38SHelge Deller #ifdef CONFIG_64BIT 1071da177e4SLinus Torvalds if (is_pdc_pat()) { 1081da177e4SLinus Torvalds ulong status; 1091da177e4SLinus Torvalds unsigned long bytecnt; 11064a0cdb0SKyle McMartin pdc_pat_cell_mod_maddr_block_t *pa_pdc_cell; 1111da177e4SLinus Torvalds 11264a0cdb0SKyle McMartin pa_pdc_cell = kmalloc(sizeof (*pa_pdc_cell), GFP_KERNEL); 11364a0cdb0SKyle McMartin if (!pa_pdc_cell) 11464a0cdb0SKyle McMartin panic("couldn't allocate memory for PDC_PAT_CELL!"); 11564a0cdb0SKyle McMartin 1161da177e4SLinus Torvalds status = pdc_pat_cell_module(&bytecnt, dev->pcell_loc, 11764a0cdb0SKyle McMartin dev->mod_index, PA_VIEW, pa_pdc_cell); 1181da177e4SLinus Torvalds 1191da177e4SLinus Torvalds BUG_ON(PDC_OK != status); 1201da177e4SLinus Torvalds 1211da177e4SLinus Torvalds /* verify it's the same as what do_pat_inventory() found */ 12264a0cdb0SKyle McMartin BUG_ON(dev->mod_info != pa_pdc_cell->mod_info); 12364a0cdb0SKyle McMartin BUG_ON(dev->pmod_loc != pa_pdc_cell->mod_location); 1241da177e4SLinus Torvalds 12564a0cdb0SKyle McMartin txn_addr = pa_pdc_cell->mod[0]; /* id_eid for IO sapic */ 12664a0cdb0SKyle McMartin 12764a0cdb0SKyle McMartin kfree(pa_pdc_cell); 1281da177e4SLinus Torvalds 129637250ccSHelge Deller /* get the cpu number */ 130637250ccSHelge Deller status = pdc_pat_cpu_get_number(&cpu_info, dev->hpa.start); 131637250ccSHelge Deller BUG_ON(PDC_OK != status); 132637250ccSHelge Deller 133637250ccSHelge Deller pr_info("Logical CPU #%lu is physical cpu #%lu at location " 134637250ccSHelge Deller "0x%lx with hpa %pa\n", 135637250ccSHelge Deller cpuid, cpu_info.cpu_num, cpu_info.cpu_loc, 136637250ccSHelge Deller &dev->hpa.start); 137637250ccSHelge Deller 138637250ccSHelge Deller #undef USE_PAT_CPUID 1391da177e4SLinus Torvalds #ifdef USE_PAT_CPUID 1401da177e4SLinus Torvalds /* We need contiguous numbers for cpuid. Firmware's notion 1411da177e4SLinus Torvalds * of cpuid is for physical CPUs and we just don't care yet. 1421da177e4SLinus Torvalds * We'll care when we need to query PAT PDC about a CPU *after* 1431da177e4SLinus Torvalds * boot time (ie shutdown a CPU from an OS perspective). 1441da177e4SLinus Torvalds */ 1451da177e4SLinus Torvalds if (cpu_info.cpu_num >= NR_CPUS) { 146637250ccSHelge Deller printk(KERN_WARNING "IGNORING CPU at %pa," 1471da177e4SLinus Torvalds " cpu_slot_id > NR_CPUS" 1481da177e4SLinus Torvalds " (%ld > %d)\n", 149637250ccSHelge Deller &dev->hpa.start, cpu_info.cpu_num, NR_CPUS); 1501da177e4SLinus Torvalds /* Ignore CPU since it will only crash */ 1511da177e4SLinus Torvalds boot_cpu_data.cpu_count--; 1521da177e4SLinus Torvalds return 1; 1531da177e4SLinus Torvalds } else { 1541da177e4SLinus Torvalds cpuid = cpu_info.cpu_num; 1551da177e4SLinus Torvalds } 1561da177e4SLinus Torvalds #endif 1571da177e4SLinus Torvalds } 1581da177e4SLinus Torvalds #endif 1591da177e4SLinus Torvalds 160ef017bebSHelge Deller p = &per_cpu(cpu_data, cpuid); 1611da177e4SLinus Torvalds boot_cpu_data.cpu_count++; 1621da177e4SLinus Torvalds 1637908a0c7SGrant Grundler /* initialize counters - CPU 0 gets it_value set in time_init() */ 1647908a0c7SGrant Grundler if (cpuid) 1651da177e4SLinus Torvalds memset(p, 0, sizeof(struct cpuinfo_parisc)); 1661da177e4SLinus Torvalds 1671da177e4SLinus Torvalds p->dev = dev; /* Save IODC data in case we need it */ 16853f01bbaSMatthew Wilcox p->hpa = dev->hpa.start; /* save CPU hpa */ 1691da177e4SLinus Torvalds p->cpuid = cpuid; /* save CPU id */ 1701da177e4SLinus Torvalds p->txn_addr = txn_addr; /* save CPU IRQ address */ 171c8c37359SHelge Deller p->cpu_num = cpu_info.cpu_num; 172c8c37359SHelge Deller p->cpu_loc = cpu_info.cpu_loc; 173bf7b4c1bSHelge Deller 174bf7b4c1bSHelge Deller store_cpu_topology(cpuid); 175bf7b4c1bSHelge Deller 1761da177e4SLinus Torvalds #ifdef CONFIG_SMP 1771da177e4SLinus Torvalds /* 1781da177e4SLinus Torvalds ** FIXME: review if any other initialization is clobbered 1791da177e4SLinus Torvalds ** for boot_cpu by the above memset(). 1801da177e4SLinus Torvalds */ 181ef017bebSHelge Deller init_percpu_prof(cpuid); 1821da177e4SLinus Torvalds #endif 1831da177e4SLinus Torvalds 1841da177e4SLinus Torvalds /* 1857022672eSSimon Arlott ** CONFIG_SMP: init_smp_config() will attempt to get CPUs into 1861da177e4SLinus Torvalds ** OS control. RENDEZVOUS is the default state - see mem_set above. 1871da177e4SLinus Torvalds ** p->state = STATE_RENDEZVOUS; 1881da177e4SLinus Torvalds */ 1891da177e4SLinus Torvalds 1901da177e4SLinus Torvalds #if 0 1911da177e4SLinus Torvalds /* CPU 0 IRQ table is statically allocated/initialized */ 1921da177e4SLinus Torvalds if (cpuid) { 1931da177e4SLinus Torvalds struct irqaction actions[]; 1941da177e4SLinus Torvalds 1951da177e4SLinus Torvalds /* 1961da177e4SLinus Torvalds ** itimer and ipi IRQ handlers are statically initialized in 1971da177e4SLinus Torvalds ** arch/parisc/kernel/irq.c. ie Don't need to register them. 1981da177e4SLinus Torvalds */ 1991da177e4SLinus Torvalds actions = kmalloc(sizeof(struct irqaction)*MAX_CPU_IRQ, GFP_ATOMIC); 2001da177e4SLinus Torvalds if (!actions) { 2011da177e4SLinus Torvalds /* not getting it's own table, share with monarch */ 2021da177e4SLinus Torvalds actions = cpu_irq_actions[0]; 2031da177e4SLinus Torvalds } 2041da177e4SLinus Torvalds 2051da177e4SLinus Torvalds cpu_irq_actions[cpuid] = actions; 2061da177e4SLinus Torvalds } 2071da177e4SLinus Torvalds #endif 2081da177e4SLinus Torvalds 2091da177e4SLinus Torvalds /* 2101da177e4SLinus Torvalds * Bring this CPU up now! (ignore bootstrap cpuid == 0) 2111da177e4SLinus Torvalds */ 2121da177e4SLinus Torvalds #ifdef CONFIG_SMP 2131da177e4SLinus Torvalds if (cpuid) { 2149bc181d8SRusty Russell set_cpu_present(cpuid, true); 21502addaeaSQais Yousef add_cpu(cpuid); 2161da177e4SLinus Torvalds } 2171da177e4SLinus Torvalds #endif 2181da177e4SLinus Torvalds 2191da177e4SLinus Torvalds return 0; 2201da177e4SLinus Torvalds } 2211da177e4SLinus Torvalds 2221da177e4SLinus Torvalds /** 2231da177e4SLinus Torvalds * collect_boot_cpu_data - Fill the boot_cpu_data structure. 2241da177e4SLinus Torvalds * 2251da177e4SLinus Torvalds * This function collects and stores the generic processor information 2261da177e4SLinus Torvalds * in the boot_cpu_data structure. 2271da177e4SLinus Torvalds */ 2281da177e4SLinus Torvalds void __init collect_boot_cpu_data(void) 2291da177e4SLinus Torvalds { 2301ed4714fSHelge Deller unsigned long cr16_seed; 2318207d4eeSHelge Deller char orig_prod_num[64], current_prod_num[64], serial_no[64]; 2321ed4714fSHelge Deller 2331da177e4SLinus Torvalds memset(&boot_cpu_data, 0, sizeof(boot_cpu_data)); 2341da177e4SLinus Torvalds 2351ed4714fSHelge Deller cr16_seed = get_cycles(); 2361ed4714fSHelge Deller add_device_randomness(&cr16_seed, sizeof(cr16_seed)); 2371ed4714fSHelge Deller 2381da177e4SLinus Torvalds boot_cpu_data.cpu_hz = 100 * PAGE0->mem_10msec; /* Hz of this PARISC */ 2391da177e4SLinus Torvalds 2401da177e4SLinus Torvalds /* get CPU-Model Information... */ 2411da177e4SLinus Torvalds #define p ((unsigned long *)&boot_cpu_data.pdc.model) 2421ed4714fSHelge Deller if (pdc_model_info(&boot_cpu_data.pdc.model) == PDC_OK) { 2431da177e4SLinus Torvalds printk(KERN_INFO 2441da177e4SLinus Torvalds "model %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", 2451da177e4SLinus Torvalds p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); 2461ed4714fSHelge Deller 2471ed4714fSHelge Deller add_device_randomness(&boot_cpu_data.pdc.model, 2481ed4714fSHelge Deller sizeof(boot_cpu_data.pdc.model)); 2491ed4714fSHelge Deller } 2501da177e4SLinus Torvalds #undef p 2511da177e4SLinus Torvalds 2521ed4714fSHelge Deller if (pdc_model_versions(&boot_cpu_data.pdc.versions, 0) == PDC_OK) { 2531da177e4SLinus Torvalds printk(KERN_INFO "vers %08lx\n", 2541da177e4SLinus Torvalds boot_cpu_data.pdc.versions); 2551da177e4SLinus Torvalds 2561ed4714fSHelge Deller add_device_randomness(&boot_cpu_data.pdc.versions, 2571ed4714fSHelge Deller sizeof(boot_cpu_data.pdc.versions)); 2581ed4714fSHelge Deller } 2591ed4714fSHelge Deller 2601ed4714fSHelge Deller if (pdc_model_cpuid(&boot_cpu_data.pdc.cpuid) == PDC_OK) { 2611da177e4SLinus Torvalds printk(KERN_INFO "CPUID vers %ld rev %ld (0x%08lx)\n", 2621da177e4SLinus Torvalds (boot_cpu_data.pdc.cpuid >> 5) & 127, 2631da177e4SLinus Torvalds boot_cpu_data.pdc.cpuid & 31, 2641da177e4SLinus Torvalds boot_cpu_data.pdc.cpuid); 2651da177e4SLinus Torvalds 2661ed4714fSHelge Deller add_device_randomness(&boot_cpu_data.pdc.cpuid, 2671ed4714fSHelge Deller sizeof(boot_cpu_data.pdc.cpuid)); 2681ed4714fSHelge Deller } 2691ed4714fSHelge Deller 2701da177e4SLinus Torvalds if (pdc_model_capabilities(&boot_cpu_data.pdc.capabilities) == PDC_OK) 2711da177e4SLinus Torvalds printk(KERN_INFO "capabilities 0x%lx\n", 2721da177e4SLinus Torvalds boot_cpu_data.pdc.capabilities); 2731da177e4SLinus Torvalds 2741da177e4SLinus Torvalds if (pdc_model_sysmodel(boot_cpu_data.pdc.sys_model_name) == PDC_OK) 2751da177e4SLinus Torvalds printk(KERN_INFO "model %s\n", 2761da177e4SLinus Torvalds boot_cpu_data.pdc.sys_model_name); 2771da177e4SLinus Torvalds 278dbf2a4b1SHelge Deller dump_stack_set_arch_desc("%s", boot_cpu_data.pdc.sys_model_name); 279dbf2a4b1SHelge Deller 2801da177e4SLinus Torvalds boot_cpu_data.hversion = boot_cpu_data.pdc.model.hversion; 2811da177e4SLinus Torvalds boot_cpu_data.sversion = boot_cpu_data.pdc.model.sversion; 2821da177e4SLinus Torvalds 2831da177e4SLinus Torvalds boot_cpu_data.cpu_type = parisc_get_cpu_type(boot_cpu_data.hversion); 2841da177e4SLinus Torvalds boot_cpu_data.cpu_name = cpu_name_version[boot_cpu_data.cpu_type][0]; 2851da177e4SLinus Torvalds boot_cpu_data.family_name = cpu_name_version[boot_cpu_data.cpu_type][1]; 2861da177e4SLinus Torvalds 287fc632575SHelge Deller #ifdef CONFIG_PA8X00 288fc632575SHelge Deller _parisc_requires_coherency = (boot_cpu_data.cpu_type == mako) || 289fc632575SHelge Deller (boot_cpu_data.cpu_type == mako2); 290fc632575SHelge Deller #endif 2918207d4eeSHelge Deller 2928207d4eeSHelge Deller if (pdc_model_platform_info(orig_prod_num, current_prod_num, serial_no) == PDC_OK) { 2938207d4eeSHelge Deller printk(KERN_INFO "product %s, original product %s, S/N: %s\n", 2940e4db23eSHelge Deller current_prod_num[0] ? current_prod_num : "n/a", 2950e4db23eSHelge Deller orig_prod_num, serial_no); 2968207d4eeSHelge Deller add_device_randomness(orig_prod_num, strlen(orig_prod_num)); 2978207d4eeSHelge Deller add_device_randomness(current_prod_num, strlen(current_prod_num)); 2988207d4eeSHelge Deller add_device_randomness(serial_no, strlen(serial_no)); 2998207d4eeSHelge Deller } 300fc632575SHelge Deller } 3011da177e4SLinus Torvalds 3021da177e4SLinus Torvalds 3031da177e4SLinus Torvalds /** 3041da177e4SLinus Torvalds * init_per_cpu - Handle individual processor initializations. 3051da177e4SLinus Torvalds * @cpunum: logical processor number. 3061da177e4SLinus Torvalds * 3071da177e4SLinus Torvalds * This function handles initialization for *every* CPU 3081da177e4SLinus Torvalds * in the system: 3091da177e4SLinus Torvalds * 3101da177e4SLinus Torvalds * o Set "default" CPU width for trap handlers 3111da177e4SLinus Torvalds * 3121da177e4SLinus Torvalds * o Enable FP coprocessor 3131da177e4SLinus Torvalds * REVISIT: this could be done in the "code 22" trap handler. 3141da177e4SLinus Torvalds * (frowands idea - that way we know which processes need FP 3151da177e4SLinus Torvalds * registers saved on the interrupt stack.) 3161da177e4SLinus Torvalds * NEWS FLASH: wide kernels need FP coprocessor enabled to handle 3171da177e4SLinus Torvalds * formatted printing of %lx for example (double divides I think) 3181da177e4SLinus Torvalds * 3191da177e4SLinus Torvalds * o Enable CPU profiling hooks. 3201da177e4SLinus Torvalds */ 321*beb48dfdSHelge Deller int init_per_cpu(int cpunum) 3221da177e4SLinus Torvalds { 3231da177e4SLinus Torvalds int ret; 3241da177e4SLinus Torvalds struct pdc_coproc_cfg coproc_cfg; 3251da177e4SLinus Torvalds 3261da177e4SLinus Torvalds set_firmware_width(); 3271da177e4SLinus Torvalds ret = pdc_coproc_cfg(&coproc_cfg); 3281da177e4SLinus Torvalds 329bf7b4c1bSHelge Deller store_cpu_topology(cpunum); 330bf7b4c1bSHelge Deller 3311da177e4SLinus Torvalds if(ret >= 0 && coproc_cfg.ccr_functional) { 3321da177e4SLinus Torvalds mtctl(coproc_cfg.ccr_functional, 10); /* 10 == Coprocessor Control Reg */ 3331da177e4SLinus Torvalds 3341da177e4SLinus Torvalds /* FWIW, FP rev/model is a more accurate way to determine 3351da177e4SLinus Torvalds ** CPU type. CPU rev/model has some ambiguous cases. 3361da177e4SLinus Torvalds */ 337ef017bebSHelge Deller per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision; 338ef017bebSHelge Deller per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model; 3391da177e4SLinus Torvalds 3400032c088SHelge Deller if (cpunum == 0) 3411da177e4SLinus Torvalds printk(KERN_INFO "FP[%d] enabled: Rev %ld Model %ld\n", 3421da177e4SLinus Torvalds cpunum, coproc_cfg.revision, coproc_cfg.model); 3431da177e4SLinus Torvalds 3441da177e4SLinus Torvalds /* 3451da177e4SLinus Torvalds ** store status register to stack (hopefully aligned) 3461da177e4SLinus Torvalds ** and clear the T-bit. 3471da177e4SLinus Torvalds */ 3481da177e4SLinus Torvalds asm volatile ("fstd %fr0,8(%sp)"); 3491da177e4SLinus Torvalds 3501da177e4SLinus Torvalds } else { 3511da177e4SLinus Torvalds printk(KERN_WARNING "WARNING: No FP CoProcessor?!" 3521da177e4SLinus Torvalds " (coproc_cfg.ccr_functional == 0x%lx, expected 0xc0)\n" 353a8f44e38SHelge Deller #ifdef CONFIG_64BIT 3541da177e4SLinus Torvalds "Halting Machine - FP required\n" 3551da177e4SLinus Torvalds #endif 3561da177e4SLinus Torvalds , coproc_cfg.ccr_functional); 357a8f44e38SHelge Deller #ifdef CONFIG_64BIT 3581da177e4SLinus Torvalds mdelay(100); /* previous chars get pushed to console */ 3591da177e4SLinus Torvalds panic("FP CoProc not reported"); 3601da177e4SLinus Torvalds #endif 3611da177e4SLinus Torvalds } 3621da177e4SLinus Torvalds 3631da177e4SLinus Torvalds /* FUTURE: Enable Performance Monitor : ccr bit 0x20 */ 3641da177e4SLinus Torvalds init_percpu_prof(cpunum); 3651da177e4SLinus Torvalds 3661da177e4SLinus Torvalds return ret; 3671da177e4SLinus Torvalds } 3681da177e4SLinus Torvalds 3691da177e4SLinus Torvalds /* 3707022672eSSimon Arlott * Display CPU info for all CPUs. 3711da177e4SLinus Torvalds */ 3721da177e4SLinus Torvalds int 3731da177e4SLinus Torvalds show_cpuinfo (struct seq_file *m, void *v) 3741da177e4SLinus Torvalds { 375ef017bebSHelge Deller unsigned long cpu; 3761da177e4SLinus Torvalds 377ef017bebSHelge Deller for_each_online_cpu(cpu) { 378ef017bebSHelge Deller const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu); 3791da177e4SLinus Torvalds #ifdef CONFIG_SMP 380ef017bebSHelge Deller if (0 == cpuinfo->hpa) 3811da177e4SLinus Torvalds continue; 3821da177e4SLinus Torvalds #endif 383ef017bebSHelge Deller seq_printf(m, "processor\t: %lu\n" 3841da177e4SLinus Torvalds "cpu family\t: PA-RISC %s\n", 385ef017bebSHelge Deller cpu, boot_cpu_data.family_name); 3861da177e4SLinus Torvalds 3871da177e4SLinus Torvalds seq_printf(m, "cpu\t\t: %s\n", boot_cpu_data.cpu_name ); 3881da177e4SLinus Torvalds 3891da177e4SLinus Torvalds /* cpu MHz */ 3901da177e4SLinus Torvalds seq_printf(m, "cpu MHz\t\t: %d.%06d\n", 3911da177e4SLinus Torvalds boot_cpu_data.cpu_hz / 1000000, 3921da177e4SLinus Torvalds boot_cpu_data.cpu_hz % 1000000 ); 3931da177e4SLinus Torvalds 39462773112SHelge Deller #ifdef CONFIG_GENERIC_ARCH_TOPOLOGY 395bf7b4c1bSHelge Deller seq_printf(m, "physical id\t: %d\n", 396bf7b4c1bSHelge Deller topology_physical_package_id(cpu)); 397bf7b4c1bSHelge Deller seq_printf(m, "siblings\t: %d\n", 398bf7b4c1bSHelge Deller cpumask_weight(topology_core_cpumask(cpu))); 399bf7b4c1bSHelge Deller seq_printf(m, "core id\t\t: %d\n", topology_core_id(cpu)); 400bf7b4c1bSHelge Deller #endif 401bf7b4c1bSHelge Deller 402445c088fSColin Watson seq_printf(m, "capabilities\t:"); 403445c088fSColin Watson if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32) 40430a9f0b2SHelge Deller seq_puts(m, " os32"); 405445c088fSColin Watson if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS64) 40630a9f0b2SHelge Deller seq_puts(m, " os64"); 40730a9f0b2SHelge Deller if (boot_cpu_data.pdc.capabilities & PDC_MODEL_IOPDIR_FDC) 40830a9f0b2SHelge Deller seq_puts(m, " iopdir_fdc"); 40930a9f0b2SHelge Deller switch (boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) { 41030a9f0b2SHelge Deller case PDC_MODEL_NVA_SUPPORTED: 41130a9f0b2SHelge Deller seq_puts(m, " nva_supported"); 41230a9f0b2SHelge Deller break; 41330a9f0b2SHelge Deller case PDC_MODEL_NVA_SLOW: 41430a9f0b2SHelge Deller seq_puts(m, " nva_slow"); 41530a9f0b2SHelge Deller break; 41630a9f0b2SHelge Deller case PDC_MODEL_NVA_UNSUPPORTED: 41730a9f0b2SHelge Deller seq_puts(m, " needs_equivalent_aliasing"); 41830a9f0b2SHelge Deller break; 41930a9f0b2SHelge Deller } 42030a9f0b2SHelge Deller seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities); 421445c088fSColin Watson 4221da177e4SLinus Torvalds seq_printf(m, "model\t\t: %s\n" 4231da177e4SLinus Torvalds "model name\t: %s\n", 4241da177e4SLinus Torvalds boot_cpu_data.pdc.sys_model_name, 425ef017bebSHelge Deller cpuinfo->dev ? 426ef017bebSHelge Deller cpuinfo->dev->name : "Unknown"); 4271da177e4SLinus Torvalds 4281da177e4SLinus Torvalds seq_printf(m, "hversion\t: 0x%08x\n" 4291da177e4SLinus Torvalds "sversion\t: 0x%08x\n", 4301da177e4SLinus Torvalds boot_cpu_data.hversion, 4311da177e4SLinus Torvalds boot_cpu_data.sversion ); 4321da177e4SLinus Torvalds 4331da177e4SLinus Torvalds /* print cachesize info */ 4341da177e4SLinus Torvalds show_cache_info(m); 4351da177e4SLinus Torvalds 4361da177e4SLinus Torvalds seq_printf(m, "bogomips\t: %lu.%02lu\n", 43793346da8SHelge Deller loops_per_jiffy / (500000 / HZ), 43893346da8SHelge Deller loops_per_jiffy / (5000 / HZ) % 100); 4391da177e4SLinus Torvalds 4401da177e4SLinus Torvalds seq_printf(m, "software id\t: %ld\n\n", 4411da177e4SLinus Torvalds boot_cpu_data.pdc.model.sw_id); 4421da177e4SLinus Torvalds } 4431da177e4SLinus Torvalds return 0; 4441da177e4SLinus Torvalds } 4451da177e4SLinus Torvalds 4466c706b93SHelge Deller static const struct parisc_device_id processor_tbl[] __initconst = { 4471da177e4SLinus Torvalds { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID }, 4481da177e4SLinus Torvalds { 0, } 4491da177e4SLinus Torvalds }; 4501da177e4SLinus Torvalds 4516c706b93SHelge Deller static struct parisc_driver cpu_driver __refdata = { 4521da177e4SLinus Torvalds .name = "CPU", 4531da177e4SLinus Torvalds .id_table = processor_tbl, 4541da177e4SLinus Torvalds .probe = processor_probe 4551da177e4SLinus Torvalds }; 4561da177e4SLinus Torvalds 4571da177e4SLinus Torvalds /** 4587022672eSSimon Arlott * processor_init - Processor initialization procedure. 4591da177e4SLinus Torvalds * 4601da177e4SLinus Torvalds * Register this driver. 4611da177e4SLinus Torvalds */ 4621da177e4SLinus Torvalds void __init processor_init(void) 4631da177e4SLinus Torvalds { 46462773112SHelge Deller reset_cpu_topology(); 4651da177e4SLinus Torvalds register_parisc_driver(&cpu_driver); 4661da177e4SLinus Torvalds } 467