Release 4.14 arch/sparc/kernel/devices.c
// SPDX-License-Identifier: GPL-2.0
/* devices.c: Initial scan of the prom device tree for important
* Sparc device nodes which we need to find.
*
* This is based on the sparc64 version, but sun4m doesn't always use
* the hardware MIDs, so be careful.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
*/
#include <linux/kernel.h>
#include <linux/threads.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <asm/page.h>
#include <asm/oplib.h>
#include <asm/prom.h>
#include <asm/smp.h>
#include <asm/cpudata.h>
#include <asm/cpu_type.h>
#include <asm/setup.h>
#include "kernel.h"
static char *cpu_mid_prop(void)
{
if (sparc_cpu_model == sun4d)
return "cpu-id";
return "mid";
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 20 | 95.24% | 1 | 50.00% |
Rob Radez | 1 | 4.76% | 1 | 50.00% |
Total | 21 | 100.00% | 2 | 100.00% |
static int check_cpu_node(phandle nd, int *cur_inst,
int (*compare)(phandle, int, void *), void *compare_arg,
phandle *prom_node, int *mid)
{
if (!compare(nd, *cur_inst, compare_arg)) {
if (prom_node)
*prom_node = nd;
if (mid) {
*mid = prom_getintdefault(nd, cpu_mid_prop(), 0);
if (sparc_cpu_model == sun4m)
*mid &= 3;
}
return 0;
}
(*cur_inst)++;
return -ENODEV;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 79 | 74.53% | 1 | 20.00% |
Linus Torvalds (pre-git) | 23 | 21.70% | 2 | 40.00% |
Andres Salomon | 3 | 2.83% | 1 | 20.00% |
Rob Radez | 1 | 0.94% | 1 | 20.00% |
Total | 106 | 100.00% | 5 | 100.00% |
static int __cpu_find_by(int (*compare)(phandle, int, void *),
void *compare_arg, phandle *prom_node, int *mid)
{
struct device_node *dp;
int cur_inst;
cur_inst = 0;
for_each_node_by_type(dp, "cpu") {
int err = check_cpu_node(dp->phandle, &cur_inst,
compare, compare_arg,
prom_node, mid);
if (!err) {
of_node_put(dp);
return 0;
}
}
return -ENODEV;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 61 | 66.30% | 1 | 12.50% |
David S. Miller | 13 | 14.13% | 1 | 12.50% |
Linus Torvalds (pre-git) | 8 | 8.70% | 3 | 37.50% |
Julia Lawall | 7 | 7.61% | 1 | 12.50% |
Andres Salomon | 2 | 2.17% | 1 | 12.50% |
Grant C. Likely | 1 | 1.09% | 1 | 12.50% |
Total | 92 | 100.00% | 8 | 100.00% |
static int cpu_instance_compare(phandle nd, int instance, void *_arg)
{
int desired_instance = (int) _arg;
if (instance == desired_instance)
return 0;
return -ENODEV;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 32 | 86.49% | 1 | 33.33% |
Linus Torvalds (pre-git) | 4 | 10.81% | 1 | 33.33% |
Andres Salomon | 1 | 2.70% | 1 | 33.33% |
Total | 37 | 100.00% | 3 | 100.00% |
int cpu_find_by_instance(int instance, phandle *prom_node, int *mid)
{
return __cpu_find_by(cpu_instance_compare, (void *)instance,
prom_node, mid);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 26 | 81.25% | 1 | 33.33% |
Linus Torvalds (pre-git) | 5 | 15.62% | 1 | 33.33% |
Andres Salomon | 1 | 3.12% | 1 | 33.33% |
Total | 32 | 100.00% | 3 | 100.00% |
static int cpu_mid_compare(phandle nd, int instance, void *_arg)
{
int desired_mid = (int) _arg;
int this_mid;
this_mid = prom_getintdefault(nd, cpu_mid_prop(), 0);
if (this_mid == desired_mid
|| (sparc_cpu_model == sun4m && (this_mid & 3) == desired_mid))
return 0;
return -ENODEV;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 59 | 89.39% | 1 | 33.33% |
Linus Torvalds (pre-git) | 6 | 9.09% | 1 | 33.33% |
Andres Salomon | 1 | 1.52% | 1 | 33.33% |
Total | 66 | 100.00% | 3 | 100.00% |
int cpu_find_by_mid(int mid, phandle *prom_node)
{
return __cpu_find_by(cpu_mid_compare, (void *)mid,
prom_node, NULL);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 20 | 71.43% | 1 | 33.33% |
Linus Torvalds (pre-git) | 7 | 25.00% | 1 | 33.33% |
Andres Salomon | 1 | 3.57% | 1 | 33.33% |
Total | 28 | 100.00% | 3 | 100.00% |
/* sun4m uses truncated mids since we base the cpuid on the ttable/irqset
* address (0-3). This gives us the true hardware mid, which might have
* some other bits set. On 4d hardware and software mids are the same.
*/
int cpu_get_hwmid(phandle prom_node)
{
return prom_getintdefault(prom_node, cpu_mid_prop(), -ENODEV);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 17 | 85.00% | 1 | 33.33% |
Linus Torvalds (pre-git) | 2 | 10.00% | 1 | 33.33% |
Andres Salomon | 1 | 5.00% | 1 | 33.33% |
Total | 20 | 100.00% | 3 | 100.00% |
void __init device_scan(void)
{
printk(KERN_NOTICE "Booting Linux...\n");
#ifndef CONFIG_SMP
{
phandle cpu_node;
int err;
err = cpu_find_by_instance(0, &cpu_node, NULL);
if (err) {
/* Probably a sun4e, Sun is trying to trick us ;-) */
prom_printf("No cpu nodes, cannot continue\n");
prom_halt();
}
cpu_data(0).clock_tick = prom_getintdefault(cpu_node,
"clock-frequency",
0);
}
#endif /* !CONFIG_SMP */
auxio_probe();
auxio_power_probe();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 41 | 53.25% | 1 | 14.29% |
Linus Torvalds (pre-git) | 30 | 38.96% | 3 | 42.86% |
Andres Salomon | 3 | 3.90% | 1 | 14.29% |
Sam Ravnborg | 2 | 2.60% | 1 | 14.29% |
David S. Miller | 1 | 1.30% | 1 | 14.29% |
Total | 77 | 100.00% | 7 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 362 | 69.48% | 1 | 4.76% |
Linus Torvalds (pre-git) | 107 | 20.54% | 8 | 38.10% |
David S. Miller | 17 | 3.26% | 2 | 9.52% |
Andres Salomon | 13 | 2.50% | 1 | 4.76% |
Sam Ravnborg | 8 | 1.54% | 3 | 14.29% |
Julia Lawall | 7 | 1.34% | 1 | 4.76% |
Rob Radez | 2 | 0.38% | 1 | 4.76% |
David Howells | 2 | 0.38% | 1 | 4.76% |
Linus Torvalds | 1 | 0.19% | 1 | 4.76% |
Grant C. Likely | 1 | 0.19% | 1 | 4.76% |
Greg Kroah-Hartman | 1 | 0.19% | 1 | 4.76% |
Total | 521 | 100.00% | 21 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.