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 <deller@gmx.de>
71da177e4SLinus Torvalds * Modifications copyright 1999 SuSE GmbH (Philipp Rumpf)
81da177e4SLinus Torvalds * Modifications copyright 2000 Martin K. Petersen <mkp@mkp.net>
91da177e4SLinus Torvalds * Modifications copyright 2000 Philipp Rumpf <prumpf@tux.org>
101da177e4SLinus Torvalds * Modifications copyright 2001 Ryan Bradetich <rbradetich@uswest.net>
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>
292c9227fdSHelge Deller #include <asm/smp.h>
301da177e4SLinus Torvalds #include <asm/pdcpat.h>
311da177e4SLinus Torvalds #include <asm/irq.h> /* for struct irq_region */
321da177e4SLinus Torvalds #include <asm/parisc-device.h>
331da177e4SLinus Torvalds
34d9888369SHelge Deller struct system_cpuinfo_parisc boot_cpu_data __ro_after_init;
351da177e4SLinus Torvalds EXPORT_SYMBOL(boot_cpu_data);
36fc632575SHelge Deller #ifdef CONFIG_PA8X00
37d9888369SHelge Deller int _parisc_requires_coherency __ro_after_init;
38fc632575SHelge Deller EXPORT_SYMBOL(_parisc_requires_coherency);
39fc632575SHelge Deller #endif
401da177e4SLinus Torvalds
41ef017bebSHelge Deller DEFINE_PER_CPU(struct cpuinfo_parisc, cpu_data);
421da177e4SLinus Torvalds
431da177e4SLinus Torvalds /*
441da177e4SLinus Torvalds ** PARISC CPU driver - claim "device" and initialize CPU data structures.
451da177e4SLinus Torvalds **
461da177e4SLinus Torvalds ** Consolidate per CPU initialization into (mostly) one module.
471da177e4SLinus Torvalds ** Monarch CPU will initialize boot_cpu_data which shouldn't
481da177e4SLinus Torvalds ** change once the system has booted.
491da177e4SLinus Torvalds **
501da177e4SLinus Torvalds ** The callback *should* do per-instance initialization of
511da177e4SLinus Torvalds ** everything including the monarch. "Per CPU" init code in
521da177e4SLinus Torvalds ** setup.c:start_parisc() has migrated here and start_parisc()
531da177e4SLinus Torvalds ** will call register_parisc_driver(&cpu_driver) before calling do_inventory().
541da177e4SLinus Torvalds **
551da177e4SLinus Torvalds ** The goal of consolidating CPU initialization into one place is
567022672eSSimon Arlott ** to make sure all CPUs get initialized the same way.
571da177e4SLinus Torvalds ** The code path not shared is how PDC hands control of the CPU to the OS.
581da177e4SLinus Torvalds ** The initialization of OS data structures is the same (done below).
591da177e4SLinus Torvalds */
601da177e4SLinus Torvalds
611da177e4SLinus Torvalds /**
625f0c791dSHelge Deller * init_percpu_prof - enable/setup per cpu profiling hooks.
63ef017bebSHelge Deller * @cpunum: The processor instance.
64ef017bebSHelge Deller *
65ef017bebSHelge Deller * FIXME: doesn't do much yet...
66ef017bebSHelge Deller */
6760ffef06SPaul Gortmaker static void
init_percpu_prof(unsigned long cpunum)68ef017bebSHelge Deller init_percpu_prof(unsigned long cpunum)
69ef017bebSHelge Deller {
70ef017bebSHelge Deller }
71ef017bebSHelge Deller
72ef017bebSHelge Deller
73ef017bebSHelge Deller /**
741da177e4SLinus Torvalds * processor_probe - Determine if processor driver should claim this device.
751da177e4SLinus Torvalds * @dev: The device which has been found.
761da177e4SLinus Torvalds *
771da177e4SLinus Torvalds * Determine if processor driver should claim this chip (return 0) or not
781da177e4SLinus Torvalds * (return 1). If so, initialize the chip and tell other partners in crime
791da177e4SLinus Torvalds * they have work to do.
801da177e4SLinus Torvalds */
processor_probe(struct parisc_device * dev)816c706b93SHelge Deller static int __init processor_probe(struct parisc_device *dev)
821da177e4SLinus Torvalds {
831da177e4SLinus Torvalds unsigned long txn_addr;
841da177e4SLinus Torvalds unsigned long cpuid;
851da177e4SLinus Torvalds struct cpuinfo_parisc *p;
86c8c37359SHelge Deller struct pdc_pat_cpu_num cpu_info = { };
871da177e4SLinus Torvalds
88f8b9e594SKyle McMartin #ifdef CONFIG_SMP
89bd071e1aSRusty Russell if (num_online_cpus() >= nr_cpu_ids) {
90bd071e1aSRusty Russell printk(KERN_INFO "num_online_cpus() >= nr_cpu_ids\n");
91f8b9e594SKyle McMartin return 1;
92f8b9e594SKyle McMartin }
93f8b9e594SKyle McMartin #else
941da177e4SLinus Torvalds if (boot_cpu_data.cpu_count > 0) {
951da177e4SLinus Torvalds printk(KERN_INFO "CONFIG_SMP=n ignoring additional CPUs\n");
961da177e4SLinus Torvalds return 1;
971da177e4SLinus Torvalds }
981da177e4SLinus Torvalds #endif
991da177e4SLinus Torvalds
1001da177e4SLinus Torvalds /* logical CPU ID and update global counter
1011da177e4SLinus Torvalds * May get overwritten by PAT code.
1021da177e4SLinus Torvalds */
1031da177e4SLinus Torvalds cpuid = boot_cpu_data.cpu_count;
10453f01bbaSMatthew Wilcox txn_addr = dev->hpa.start; /* for legacy PDC */
105c8c37359SHelge Deller cpu_info.cpu_num = cpu_info.cpu_loc = cpuid;
1061da177e4SLinus Torvalds
107a8f44e38SHelge Deller #ifdef CONFIG_64BIT
1081da177e4SLinus Torvalds if (is_pdc_pat()) {
1091da177e4SLinus Torvalds ulong status;
1101da177e4SLinus Torvalds unsigned long bytecnt;
11164a0cdb0SKyle McMartin pdc_pat_cell_mod_maddr_block_t *pa_pdc_cell;
1121da177e4SLinus Torvalds
11364a0cdb0SKyle McMartin pa_pdc_cell = kmalloc(sizeof (*pa_pdc_cell), GFP_KERNEL);
11464a0cdb0SKyle McMartin if (!pa_pdc_cell)
11564a0cdb0SKyle McMartin panic("couldn't allocate memory for PDC_PAT_CELL!");
11664a0cdb0SKyle McMartin
1171da177e4SLinus Torvalds status = pdc_pat_cell_module(&bytecnt, dev->pcell_loc,
11864a0cdb0SKyle McMartin dev->mod_index, PA_VIEW, pa_pdc_cell);
1191da177e4SLinus Torvalds
1201da177e4SLinus Torvalds BUG_ON(PDC_OK != status);
1211da177e4SLinus Torvalds
1221da177e4SLinus Torvalds /* verify it's the same as what do_pat_inventory() found */
12364a0cdb0SKyle McMartin BUG_ON(dev->mod_info != pa_pdc_cell->mod_info);
12464a0cdb0SKyle McMartin BUG_ON(dev->pmod_loc != pa_pdc_cell->mod_location);
1251da177e4SLinus Torvalds
12664a0cdb0SKyle McMartin txn_addr = pa_pdc_cell->mod[0]; /* id_eid for IO sapic */
12764a0cdb0SKyle McMartin
12864a0cdb0SKyle McMartin kfree(pa_pdc_cell);
1291da177e4SLinus Torvalds
130637250ccSHelge Deller /* get the cpu number */
131637250ccSHelge Deller status = pdc_pat_cpu_get_number(&cpu_info, dev->hpa.start);
132637250ccSHelge Deller BUG_ON(PDC_OK != status);
133637250ccSHelge Deller
134637250ccSHelge Deller pr_info("Logical CPU #%lu is physical cpu #%lu at location "
135637250ccSHelge Deller "0x%lx with hpa %pa\n",
136637250ccSHelge Deller cpuid, cpu_info.cpu_num, cpu_info.cpu_loc,
137637250ccSHelge Deller &dev->hpa.start);
138637250ccSHelge Deller
139637250ccSHelge Deller #undef USE_PAT_CPUID
1401da177e4SLinus Torvalds #ifdef USE_PAT_CPUID
1411da177e4SLinus Torvalds /* We need contiguous numbers for cpuid. Firmware's notion
1421da177e4SLinus Torvalds * of cpuid is for physical CPUs and we just don't care yet.
1431da177e4SLinus Torvalds * We'll care when we need to query PAT PDC about a CPU *after*
1441da177e4SLinus Torvalds * boot time (ie shutdown a CPU from an OS perspective).
1451da177e4SLinus Torvalds */
1461da177e4SLinus Torvalds if (cpu_info.cpu_num >= NR_CPUS) {
147637250ccSHelge Deller printk(KERN_WARNING "IGNORING CPU at %pa,"
1481da177e4SLinus Torvalds " cpu_slot_id > NR_CPUS"
1491da177e4SLinus Torvalds " (%ld > %d)\n",
150637250ccSHelge Deller &dev->hpa.start, cpu_info.cpu_num, NR_CPUS);
1511da177e4SLinus Torvalds /* Ignore CPU since it will only crash */
1521da177e4SLinus Torvalds boot_cpu_data.cpu_count--;
1531da177e4SLinus Torvalds return 1;
1541da177e4SLinus Torvalds } else {
1551da177e4SLinus Torvalds cpuid = cpu_info.cpu_num;
1561da177e4SLinus Torvalds }
1571da177e4SLinus Torvalds #endif
1581da177e4SLinus Torvalds }
1591da177e4SLinus Torvalds #endif
1601da177e4SLinus Torvalds
161ef017bebSHelge Deller p = &per_cpu(cpu_data, cpuid);
1621da177e4SLinus Torvalds boot_cpu_data.cpu_count++;
1631da177e4SLinus Torvalds
1647908a0c7SGrant Grundler /* initialize counters - CPU 0 gets it_value set in time_init() */
1657908a0c7SGrant Grundler if (cpuid)
1661da177e4SLinus Torvalds memset(p, 0, sizeof(struct cpuinfo_parisc));
1671da177e4SLinus Torvalds
1681da177e4SLinus Torvalds p->dev = dev; /* Save IODC data in case we need it */
16953f01bbaSMatthew Wilcox p->hpa = dev->hpa.start; /* save CPU hpa */
1701da177e4SLinus Torvalds p->cpuid = cpuid; /* save CPU id */
1711da177e4SLinus Torvalds p->txn_addr = txn_addr; /* save CPU IRQ address */
172c8c37359SHelge Deller p->cpu_num = cpu_info.cpu_num;
173c8c37359SHelge Deller p->cpu_loc = cpu_info.cpu_loc;
174bf7b4c1bSHelge Deller
175bf7b4c1bSHelge Deller store_cpu_topology(cpuid);
176bf7b4c1bSHelge Deller
1771da177e4SLinus Torvalds #ifdef CONFIG_SMP
1781da177e4SLinus Torvalds /*
1791da177e4SLinus Torvalds ** FIXME: review if any other initialization is clobbered
1801da177e4SLinus Torvalds ** for boot_cpu by the above memset().
1811da177e4SLinus Torvalds */
182ef017bebSHelge Deller init_percpu_prof(cpuid);
1831da177e4SLinus Torvalds #endif
1841da177e4SLinus Torvalds
1851da177e4SLinus Torvalds /*
1867022672eSSimon Arlott ** CONFIG_SMP: init_smp_config() will attempt to get CPUs into
1871da177e4SLinus Torvalds ** OS control. RENDEZVOUS is the default state - see mem_set above.
1881da177e4SLinus Torvalds ** p->state = STATE_RENDEZVOUS;
1891da177e4SLinus Torvalds */
1901da177e4SLinus Torvalds
1911da177e4SLinus Torvalds #if 0
1921da177e4SLinus Torvalds /* CPU 0 IRQ table is statically allocated/initialized */
1931da177e4SLinus Torvalds if (cpuid) {
1941da177e4SLinus Torvalds struct irqaction actions[];
1951da177e4SLinus Torvalds
1961da177e4SLinus Torvalds /*
1971da177e4SLinus Torvalds ** itimer and ipi IRQ handlers are statically initialized in
1981da177e4SLinus Torvalds ** arch/parisc/kernel/irq.c. ie Don't need to register them.
1991da177e4SLinus Torvalds */
2001da177e4SLinus Torvalds actions = kmalloc(sizeof(struct irqaction)*MAX_CPU_IRQ, GFP_ATOMIC);
2011da177e4SLinus Torvalds if (!actions) {
2021da177e4SLinus Torvalds /* not getting it's own table, share with monarch */
2031da177e4SLinus Torvalds actions = cpu_irq_actions[0];
2041da177e4SLinus Torvalds }
2051da177e4SLinus Torvalds
2061da177e4SLinus Torvalds cpu_irq_actions[cpuid] = actions;
2071da177e4SLinus Torvalds }
2081da177e4SLinus Torvalds #endif
2091da177e4SLinus Torvalds
2101da177e4SLinus Torvalds /*
2111da177e4SLinus Torvalds * Bring this CPU up now! (ignore bootstrap cpuid == 0)
2121da177e4SLinus Torvalds */
2131da177e4SLinus Torvalds #ifdef CONFIG_SMP
2141da177e4SLinus Torvalds if (cpuid) {
2159bc181d8SRusty Russell set_cpu_present(cpuid, true);
21602addaeaSQais Yousef add_cpu(cpuid);
2171da177e4SLinus Torvalds }
2181da177e4SLinus Torvalds #endif
2191da177e4SLinus Torvalds
2201da177e4SLinus Torvalds return 0;
2211da177e4SLinus Torvalds }
2221da177e4SLinus Torvalds
2231da177e4SLinus Torvalds /**
2241da177e4SLinus Torvalds * collect_boot_cpu_data - Fill the boot_cpu_data structure.
2251da177e4SLinus Torvalds *
2261da177e4SLinus Torvalds * This function collects and stores the generic processor information
2271da177e4SLinus Torvalds * in the boot_cpu_data structure.
2281da177e4SLinus Torvalds */
collect_boot_cpu_data(void)2291da177e4SLinus Torvalds void __init collect_boot_cpu_data(void)
2301da177e4SLinus Torvalds {
2311ed4714fSHelge Deller unsigned long cr16_seed;
2328207d4eeSHelge Deller char orig_prod_num[64], current_prod_num[64], serial_no[64];
2331ed4714fSHelge Deller
2341da177e4SLinus Torvalds memset(&boot_cpu_data, 0, sizeof(boot_cpu_data));
2351da177e4SLinus Torvalds
2361ed4714fSHelge Deller cr16_seed = get_cycles();
2371ed4714fSHelge Deller add_device_randomness(&cr16_seed, sizeof(cr16_seed));
2381ed4714fSHelge Deller
2391da177e4SLinus Torvalds boot_cpu_data.cpu_hz = 100 * PAGE0->mem_10msec; /* Hz of this PARISC */
2401da177e4SLinus Torvalds
2411da177e4SLinus Torvalds /* get CPU-Model Information... */
2421da177e4SLinus Torvalds #define p ((unsigned long *)&boot_cpu_data.pdc.model)
2431ed4714fSHelge Deller if (pdc_model_info(&boot_cpu_data.pdc.model) == PDC_OK) {
2441da177e4SLinus Torvalds printk(KERN_INFO
2451da177e4SLinus Torvalds "model %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
2461da177e4SLinus Torvalds p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]);
2471ed4714fSHelge Deller
2481ed4714fSHelge Deller add_device_randomness(&boot_cpu_data.pdc.model,
2491ed4714fSHelge Deller sizeof(boot_cpu_data.pdc.model));
2501ed4714fSHelge Deller }
2511da177e4SLinus Torvalds #undef p
2521da177e4SLinus Torvalds
2531ed4714fSHelge Deller if (pdc_model_versions(&boot_cpu_data.pdc.versions, 0) == PDC_OK) {
2541da177e4SLinus Torvalds printk(KERN_INFO "vers %08lx\n",
2551da177e4SLinus Torvalds boot_cpu_data.pdc.versions);
2561da177e4SLinus Torvalds
2571ed4714fSHelge Deller add_device_randomness(&boot_cpu_data.pdc.versions,
2581ed4714fSHelge Deller sizeof(boot_cpu_data.pdc.versions));
2591ed4714fSHelge Deller }
2601ed4714fSHelge Deller
2611ed4714fSHelge Deller if (pdc_model_cpuid(&boot_cpu_data.pdc.cpuid) == PDC_OK) {
2621da177e4SLinus Torvalds printk(KERN_INFO "CPUID vers %ld rev %ld (0x%08lx)\n",
2631da177e4SLinus Torvalds (boot_cpu_data.pdc.cpuid >> 5) & 127,
2641da177e4SLinus Torvalds boot_cpu_data.pdc.cpuid & 31,
2651da177e4SLinus Torvalds boot_cpu_data.pdc.cpuid);
2661da177e4SLinus Torvalds
2671ed4714fSHelge Deller add_device_randomness(&boot_cpu_data.pdc.cpuid,
2681ed4714fSHelge Deller sizeof(boot_cpu_data.pdc.cpuid));
2691ed4714fSHelge Deller }
2701ed4714fSHelge Deller
2711da177e4SLinus Torvalds if (pdc_model_capabilities(&boot_cpu_data.pdc.capabilities) == PDC_OK)
2721da177e4SLinus Torvalds printk(KERN_INFO "capabilities 0x%lx\n",
2731da177e4SLinus Torvalds boot_cpu_data.pdc.capabilities);
2741da177e4SLinus Torvalds
2754934fbfbSHelge Deller if (pdc_model_sysmodel(OS_ID_HPUX, boot_cpu_data.pdc.sys_model_name) == PDC_OK)
2764934fbfbSHelge Deller pr_info("HP-UX model name: %s\n",
2771da177e4SLinus Torvalds boot_cpu_data.pdc.sys_model_name);
2781da177e4SLinus Torvalds
2794934fbfbSHelge Deller serial_no[0] = 0;
2804934fbfbSHelge Deller if (pdc_model_sysmodel(OS_ID_MPEXL, serial_no) == PDC_OK &&
2814934fbfbSHelge Deller serial_no[0])
2824934fbfbSHelge Deller pr_info("MPE/iX model name: %s\n", serial_no);
2834934fbfbSHelge Deller
284dbf2a4b1SHelge Deller dump_stack_set_arch_desc("%s", boot_cpu_data.pdc.sys_model_name);
285dbf2a4b1SHelge Deller
2861da177e4SLinus Torvalds boot_cpu_data.hversion = boot_cpu_data.pdc.model.hversion;
2871da177e4SLinus Torvalds boot_cpu_data.sversion = boot_cpu_data.pdc.model.sversion;
2881da177e4SLinus Torvalds
2891da177e4SLinus Torvalds boot_cpu_data.cpu_type = parisc_get_cpu_type(boot_cpu_data.hversion);
2901da177e4SLinus Torvalds boot_cpu_data.cpu_name = cpu_name_version[boot_cpu_data.cpu_type][0];
2911da177e4SLinus Torvalds boot_cpu_data.family_name = cpu_name_version[boot_cpu_data.cpu_type][1];
2921da177e4SLinus Torvalds
293fc632575SHelge Deller #ifdef CONFIG_PA8X00
294fc632575SHelge Deller _parisc_requires_coherency = (boot_cpu_data.cpu_type == mako) ||
295fc632575SHelge Deller (boot_cpu_data.cpu_type == mako2);
296fc632575SHelge Deller #endif
2978207d4eeSHelge Deller
2988207d4eeSHelge Deller if (pdc_model_platform_info(orig_prod_num, current_prod_num, serial_no) == PDC_OK) {
2998207d4eeSHelge Deller printk(KERN_INFO "product %s, original product %s, S/N: %s\n",
3000e4db23eSHelge Deller current_prod_num[0] ? current_prod_num : "n/a",
3010e4db23eSHelge Deller orig_prod_num, serial_no);
3028207d4eeSHelge Deller add_device_randomness(orig_prod_num, strlen(orig_prod_num));
3038207d4eeSHelge Deller add_device_randomness(current_prod_num, strlen(current_prod_num));
3048207d4eeSHelge Deller add_device_randomness(serial_no, strlen(serial_no));
3058207d4eeSHelge Deller }
306fc632575SHelge Deller }
3071da177e4SLinus Torvalds
3081da177e4SLinus Torvalds
3091da177e4SLinus Torvalds /**
3101da177e4SLinus Torvalds * init_per_cpu - Handle individual processor initializations.
3111da177e4SLinus Torvalds * @cpunum: logical processor number.
3121da177e4SLinus Torvalds *
3131da177e4SLinus Torvalds * This function handles initialization for *every* CPU
3141da177e4SLinus Torvalds * in the system:
3151da177e4SLinus Torvalds *
3161da177e4SLinus Torvalds * o Set "default" CPU width for trap handlers
3171da177e4SLinus Torvalds *
3181da177e4SLinus Torvalds * o Enable FP coprocessor
3191da177e4SLinus Torvalds * REVISIT: this could be done in the "code 22" trap handler.
3201da177e4SLinus Torvalds * (frowands idea - that way we know which processes need FP
3211da177e4SLinus Torvalds * registers saved on the interrupt stack.)
3221da177e4SLinus Torvalds * NEWS FLASH: wide kernels need FP coprocessor enabled to handle
3231da177e4SLinus Torvalds * formatted printing of %lx for example (double divides I think)
3241da177e4SLinus Torvalds *
3251da177e4SLinus Torvalds * o Enable CPU profiling hooks.
3261da177e4SLinus Torvalds */
init_per_cpu(int cpunum)327beb48dfdSHelge Deller int init_per_cpu(int cpunum)
3281da177e4SLinus Torvalds {
3291da177e4SLinus Torvalds int ret;
3301da177e4SLinus Torvalds struct pdc_coproc_cfg coproc_cfg;
3311da177e4SLinus Torvalds
3321da177e4SLinus Torvalds set_firmware_width();
3331da177e4SLinus Torvalds ret = pdc_coproc_cfg(&coproc_cfg);
3341da177e4SLinus Torvalds
3351da177e4SLinus Torvalds if(ret >= 0 && coproc_cfg.ccr_functional) {
3361da177e4SLinus Torvalds mtctl(coproc_cfg.ccr_functional, 10); /* 10 == Coprocessor Control Reg */
3371da177e4SLinus Torvalds
3381da177e4SLinus Torvalds /* FWIW, FP rev/model is a more accurate way to determine
3391da177e4SLinus Torvalds ** CPU type. CPU rev/model has some ambiguous cases.
3401da177e4SLinus Torvalds */
341ef017bebSHelge Deller per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision;
342ef017bebSHelge Deller per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model;
3431da177e4SLinus Torvalds
3440032c088SHelge Deller if (cpunum == 0)
3451da177e4SLinus Torvalds printk(KERN_INFO "FP[%d] enabled: Rev %ld Model %ld\n",
3461da177e4SLinus Torvalds cpunum, coproc_cfg.revision, coproc_cfg.model);
3471da177e4SLinus Torvalds
3481da177e4SLinus Torvalds /*
3491da177e4SLinus Torvalds ** store status register to stack (hopefully aligned)
3501da177e4SLinus Torvalds ** and clear the T-bit.
3511da177e4SLinus Torvalds */
3521da177e4SLinus Torvalds asm volatile ("fstd %fr0,8(%sp)");
3531da177e4SLinus Torvalds
3541da177e4SLinus Torvalds } else {
3551da177e4SLinus Torvalds printk(KERN_WARNING "WARNING: No FP CoProcessor?!"
3561da177e4SLinus Torvalds " (coproc_cfg.ccr_functional == 0x%lx, expected 0xc0)\n"
357a8f44e38SHelge Deller #ifdef CONFIG_64BIT
3581da177e4SLinus Torvalds "Halting Machine - FP required\n"
3591da177e4SLinus Torvalds #endif
3601da177e4SLinus Torvalds , coproc_cfg.ccr_functional);
361a8f44e38SHelge Deller #ifdef CONFIG_64BIT
3621da177e4SLinus Torvalds mdelay(100); /* previous chars get pushed to console */
3631da177e4SLinus Torvalds panic("FP CoProc not reported");
3641da177e4SLinus Torvalds #endif
3651da177e4SLinus Torvalds }
3661da177e4SLinus Torvalds
3671da177e4SLinus Torvalds /* FUTURE: Enable Performance Monitor : ccr bit 0x20 */
3681da177e4SLinus Torvalds init_percpu_prof(cpunum);
3691da177e4SLinus Torvalds
370*e5ef93d0SHelge Deller btlb_init_per_cpu();
371*e5ef93d0SHelge Deller
3721da177e4SLinus Torvalds return ret;
3731da177e4SLinus Torvalds }
3741da177e4SLinus Torvalds
3751da177e4SLinus Torvalds /*
3767022672eSSimon Arlott * Display CPU info for all CPUs.
3771da177e4SLinus Torvalds */
3781da177e4SLinus Torvalds int
show_cpuinfo(struct seq_file * m,void * v)3791da177e4SLinus Torvalds show_cpuinfo (struct seq_file *m, void *v)
3801da177e4SLinus Torvalds {
381ef017bebSHelge Deller unsigned long cpu;
3829f5ba4b3SHelge Deller char cpu_name[60], *p;
3839f5ba4b3SHelge Deller
3849f5ba4b3SHelge Deller /* strip PA path from CPU name to not confuse lscpu */
3859f5ba4b3SHelge Deller strlcpy(cpu_name, per_cpu(cpu_data, 0).dev->name, sizeof(cpu_name));
3869f5ba4b3SHelge Deller p = strrchr(cpu_name, '[');
3879f5ba4b3SHelge Deller if (p)
3889f5ba4b3SHelge Deller *(--p) = 0;
3891da177e4SLinus Torvalds
390ef017bebSHelge Deller for_each_online_cpu(cpu) {
3911da177e4SLinus Torvalds #ifdef CONFIG_SMP
3929f5ba4b3SHelge Deller const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu);
3939f5ba4b3SHelge Deller
394ef017bebSHelge Deller if (0 == cpuinfo->hpa)
3951da177e4SLinus Torvalds continue;
3961da177e4SLinus Torvalds #endif
397ef017bebSHelge Deller seq_printf(m, "processor\t: %lu\n"
3981da177e4SLinus Torvalds "cpu family\t: PA-RISC %s\n",
399ef017bebSHelge Deller cpu, boot_cpu_data.family_name);
4001da177e4SLinus Torvalds
4011da177e4SLinus Torvalds seq_printf(m, "cpu\t\t: %s\n", boot_cpu_data.cpu_name );
4021da177e4SLinus Torvalds
4031da177e4SLinus Torvalds /* cpu MHz */
4041da177e4SLinus Torvalds seq_printf(m, "cpu MHz\t\t: %d.%06d\n",
4051da177e4SLinus Torvalds boot_cpu_data.cpu_hz / 1000000,
4061da177e4SLinus Torvalds boot_cpu_data.cpu_hz % 1000000 );
4071da177e4SLinus Torvalds
40862773112SHelge Deller #ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
409bf7b4c1bSHelge Deller seq_printf(m, "physical id\t: %d\n",
410bf7b4c1bSHelge Deller topology_physical_package_id(cpu));
411bf7b4c1bSHelge Deller seq_printf(m, "siblings\t: %d\n",
412bf7b4c1bSHelge Deller cpumask_weight(topology_core_cpumask(cpu)));
413bf7b4c1bSHelge Deller seq_printf(m, "core id\t\t: %d\n", topology_core_id(cpu));
414bf7b4c1bSHelge Deller #endif
415bf7b4c1bSHelge Deller
416445c088fSColin Watson seq_printf(m, "capabilities\t:");
417445c088fSColin Watson if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32)
41830a9f0b2SHelge Deller seq_puts(m, " os32");
419445c088fSColin Watson if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS64)
42030a9f0b2SHelge Deller seq_puts(m, " os64");
42130a9f0b2SHelge Deller if (boot_cpu_data.pdc.capabilities & PDC_MODEL_IOPDIR_FDC)
42230a9f0b2SHelge Deller seq_puts(m, " iopdir_fdc");
42330a9f0b2SHelge Deller switch (boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) {
42430a9f0b2SHelge Deller case PDC_MODEL_NVA_SUPPORTED:
42530a9f0b2SHelge Deller seq_puts(m, " nva_supported");
42630a9f0b2SHelge Deller break;
42730a9f0b2SHelge Deller case PDC_MODEL_NVA_SLOW:
42830a9f0b2SHelge Deller seq_puts(m, " nva_slow");
42930a9f0b2SHelge Deller break;
43030a9f0b2SHelge Deller case PDC_MODEL_NVA_UNSUPPORTED:
43130a9f0b2SHelge Deller seq_puts(m, " needs_equivalent_aliasing");
43230a9f0b2SHelge Deller break;
43330a9f0b2SHelge Deller }
43430a9f0b2SHelge Deller seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities);
435445c088fSColin Watson
4365b89966bSHelge Deller seq_printf(m, "model\t\t: %s - %s\n",
4371da177e4SLinus Torvalds boot_cpu_data.pdc.sys_model_name,
4389f5ba4b3SHelge Deller cpu_name);
4391da177e4SLinus Torvalds
4401da177e4SLinus Torvalds seq_printf(m, "hversion\t: 0x%08x\n"
4411da177e4SLinus Torvalds "sversion\t: 0x%08x\n",
4421da177e4SLinus Torvalds boot_cpu_data.hversion,
4431da177e4SLinus Torvalds boot_cpu_data.sversion );
4441da177e4SLinus Torvalds
4451da177e4SLinus Torvalds /* print cachesize info */
4461da177e4SLinus Torvalds show_cache_info(m);
4471da177e4SLinus Torvalds
4481da177e4SLinus Torvalds seq_printf(m, "bogomips\t: %lu.%02lu\n",
44993346da8SHelge Deller loops_per_jiffy / (500000 / HZ),
45093346da8SHelge Deller loops_per_jiffy / (5000 / HZ) % 100);
4511da177e4SLinus Torvalds
4521da177e4SLinus Torvalds seq_printf(m, "software id\t: %ld\n\n",
4531da177e4SLinus Torvalds boot_cpu_data.pdc.model.sw_id);
4541da177e4SLinus Torvalds }
4551da177e4SLinus Torvalds return 0;
4561da177e4SLinus Torvalds }
4571da177e4SLinus Torvalds
4586c706b93SHelge Deller static const struct parisc_device_id processor_tbl[] __initconst = {
4591da177e4SLinus Torvalds { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID },
4601da177e4SLinus Torvalds { 0, }
4611da177e4SLinus Torvalds };
4621da177e4SLinus Torvalds
4636c706b93SHelge Deller static struct parisc_driver cpu_driver __refdata = {
4641da177e4SLinus Torvalds .name = "CPU",
4651da177e4SLinus Torvalds .id_table = processor_tbl,
4661da177e4SLinus Torvalds .probe = processor_probe
4671da177e4SLinus Torvalds };
4681da177e4SLinus Torvalds
4691da177e4SLinus Torvalds /**
4707022672eSSimon Arlott * processor_init - Processor initialization procedure.
4711da177e4SLinus Torvalds *
4721da177e4SLinus Torvalds * Register this driver.
4731da177e4SLinus Torvalds */
processor_init(void)4741da177e4SLinus Torvalds void __init processor_init(void)
4751da177e4SLinus Torvalds {
47662773112SHelge Deller reset_cpu_topology();
4771da177e4SLinus Torvalds register_parisc_driver(&cpu_driver);
4781da177e4SLinus Torvalds }
479