/* ** PARISC CPU driver - claim "device" and initialize CPU data structures. ** ** Consolidate per CPU initialization into (mostly) one module. ** Monarch CPU will initialize boot_cpu_data which shouldn't ** change once the system has booted. ** ** The callback *should* do per-instance initialization of ** everything including the monarch. "Per CPU" init code in ** setup.c:start_parisc() has migrated here and start_parisc() ** will call register_parisc_driver(&cpu_driver) before calling do_inventory(). ** ** The goal of consolidating CPU initialization into one place is ** to make sure all CPUs get initialized the same way. ** The code path not shared is how PDC hands control of the CPU to the OS. ** The initialization of OS data structures is the same (done below).
*/
/** * init_percpu_prof - enable/setup per cpu profiling hooks. * @cpunum: The processor instance. * * FIXME: doesn't do much yet...
*/ staticvoid
init_percpu_prof(unsignedlong cpunum)
{
}
/** * processor_probe - Determine if processor driver should claim this device. * @dev: The device which has been found. * * Determine if processor driver should claim this chip (return 0) or not * (return 1). If so, initialize the chip and tell other partners in crime * they have work to do.
*/ staticint __init processor_probe(struct parisc_device *dev)
{ unsignedlong txn_addr; unsignedlong cpuid; struct cpuinfo_parisc *p; struct pdc_pat_cpu_num cpu_info = { };
/* logical CPU ID and update global counter * May get overwritten by PAT code.
*/
cpuid = boot_cpu_data.cpu_count;
txn_addr = dev->hpa.start; /* for legacy PDC */
cpu_info.cpu_num = cpu_info.cpu_loc = cpuid;
pa_pdc_cell = kmalloc(sizeof (*pa_pdc_cell), GFP_KERNEL); if (!pa_pdc_cell)
panic("couldn't allocate memory for PDC_PAT_CELL!");
status = pdc_pat_cell_module(&bytecnt, dev->pcell_loc,
dev->mod_index, PA_VIEW, pa_pdc_cell);
BUG_ON(PDC_OK != status);
/* verify it's the same as what do_pat_inventory() found */
BUG_ON(dev->mod_info != pa_pdc_cell->mod_info);
BUG_ON(dev->pmod_loc != pa_pdc_cell->mod_location);
txn_addr = pa_pdc_cell->mod[0]; /* id_eid for IO sapic */
kfree(pa_pdc_cell);
/* get the cpu number */
status = pdc_pat_cpu_get_number(&cpu_info, dev->hpa.start);
BUG_ON(PDC_OK != status);
pr_info("Logical CPU #%lu is physical cpu #%lu at location " "0x%lx with hpa %pa\n",
cpuid, cpu_info.cpu_num, cpu_info.cpu_loc,
&dev->hpa.start);
#undef USE_PAT_CPUID #ifdef USE_PAT_CPUID /* We need contiguous numbers for cpuid. Firmware's notion * of cpuid is for physical CPUs and we just don't care yet. * We'll care when we need to query PAT PDC about a CPU *after* * boot time (ie shutdown a CPU from an OS perspective).
*/ if (cpu_info.cpu_num >= NR_CPUS) {
printk(KERN_WARNING "IGNORING CPU at %pa," " cpu_slot_id > NR_CPUS" " (%ld > %d)\n",
&dev->hpa.start, cpu_info.cpu_num, NR_CPUS); /* Ignore CPU since it will only crash */
boot_cpu_data.cpu_count--; return 1;
} else {
cpuid = cpu_info.cpu_num;
} #endif
} #endif
p = &per_cpu(cpu_data, cpuid);
boot_cpu_data.cpu_count++;
/* initialize counters - CPU 0 gets it_value set in time_init() */ if (cpuid)
memset(p, 0, sizeof(struct cpuinfo_parisc));
p->dev = dev; /* Save IODC data in case we need it */
p->hpa = dev->hpa.start; /* save CPU hpa */
p->cpuid = cpuid; /* save CPU id */
p->txn_addr = txn_addr; /* save CPU IRQ address */
p->cpu_num = cpu_info.cpu_num;
p->cpu_loc = cpu_info.cpu_loc;
store_cpu_topology(cpuid);
#ifdef CONFIG_SMP /* ** FIXME: review if any other initialization is clobbered ** for boot_cpu by the above memset().
*/
init_percpu_prof(cpuid); #endif
/* ** CONFIG_SMP: init_smp_config() will attempt to get CPUs into ** OS control. RENDEZVOUS is the default state - see mem_set above. ** p->state = STATE_RENDEZVOUS;
*/
#if 0 /* CPU 0 IRQ table is statically allocated/initialized */ if (cpuid) { struct irqaction actions[];
/* ** itimer and ipi IRQ handlers are statically initialized in ** arch/parisc/kernel/irq.c. ie Don't need to register them.
*/
actions = kmalloc(sizeof(struct irqaction)*MAX_CPU_IRQ, GFP_ATOMIC); if (!actions) { /* not getting it's own table, share with monarch */
actions = cpu_irq_actions[0];
}
cpu_irq_actions[cpuid] = actions;
} #endif
/* * Bring this CPU up now! (ignore bootstrap cpuid == 0)
*/ #ifdef CONFIG_SMP if (cpuid) {
set_cpu_present(cpuid, true);
add_cpu(cpuid);
} #endif
return 0;
}
/** * collect_boot_cpu_data - Fill the boot_cpu_data structure. * * This function collects and stores the generic processor information * in the boot_cpu_data structure.
*/ void __init collect_boot_cpu_data(void)
{ unsignedlong cr16_seed; char orig_prod_num[64], current_prod_num[64], serial_no[64];
/** * init_per_cpu - Handle individual processor initializations. * @cpunum: logical processor number. * * This function handles initialization for *every* CPU * in the system: * * o Set "default" CPU width for trap handlers * * o Enable FP coprocessor * REVISIT: this could be done in the "code 22" trap handler. * (frowands idea - that way we know which processes need FP * registers saved on the interrupt stack.) * NEWS FLASH: wide kernels need FP coprocessor enabled to handle * formatted printing of %lx for example (double divides I think) * * o Enable CPU profiling hooks.
*/ int init_per_cpu(int cpunum)
{ int ret; struct pdc_coproc_cfg coproc_cfg;
set_firmware_width();
ret = pdc_coproc_cfg(&coproc_cfg);
/* FWIW, FP rev/model is a more accurate way to determine ** CPU type. CPU rev/model has some ambiguous cases.
*/
per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision;
per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model;
if (cpunum == 0)
printk(KERN_INFO "FP[%d] enabled: Rev %ld Model %ld\n",
cpunum, coproc_cfg.revision, coproc_cfg.model);
/* ** store status register to stack (hopefully aligned) ** and clear the T-bit.
*/ asmvolatile ("fstd %fr0,8(%sp)");
/* * Display CPU info for all CPUs.
*/ int
show_cpuinfo (struct seq_file *m, void *v)
{ unsignedlong cpu; char cpu_name[60], *p;
/* strip PA path from CPU name to not confuse lscpu */
strscpy(cpu_name, per_cpu(cpu_data, 0).dev->name, sizeof(cpu_name));
p = strrchr(cpu_name, '['); if (p)
*(--p) = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.