root/arch/sparc/kernel/devices.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. device_scan

   1 /* devices.c: Initial scan of the prom device tree for important
   2  *            Sparc device nodes which we need to find.
   3  *
   4  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
   5  */
   6 
   7 #include <linux/kernel.h>
   8 
   9 #include <asm/page.h>
  10 #include <asm/oplib.h>
  11 #include <asm/mp.h>
  12 #include <asm/system.h>
  13 
  14 struct prom_cpuinfo linux_cpus[NCPUS];
  15 int linux_num_cpus;
  16 
  17 extern void cpu_probe(void);
  18 extern void auxio_probe(void);
  19 
  20 unsigned long
  21 device_scan(unsigned long mem_start)
     /* [previous][next][first][last][top][bottom][index][help] */
  22 {
  23         char node_str[128];
  24         int nd, prom_node_cpu, thismid;
  25         int cpu_nds[NCPUS];  /* One node for each cpu */
  26         int cpu_ctr = 0;
  27 
  28         prom_getstring(prom_root_node, "device_type", node_str, sizeof(node_str));
  29         if(strcmp(node_str, "cpu") == 0) {
  30                 cpu_nds[0] = prom_root_node;
  31                 cpu_ctr++;
  32         } else {
  33                 int scan;
  34                 scan = prom_getchild(prom_root_node);
  35                 nd = 0;
  36                 while((scan = prom_getsibling(scan)) != 0) {
  37                         prom_getstring(scan, "device_type", node_str, sizeof(node_str));
  38                         if(strcmp(node_str, "cpu") == 0) {
  39                                 cpu_nds[cpu_ctr] = scan;
  40                                 linux_cpus[cpu_ctr].prom_node = scan;
  41                                 prom_getproperty(scan, "mid", (char *) &thismid, sizeof(thismid));
  42                                 linux_cpus[cpu_ctr].mid = thismid;
  43                                 cpu_ctr++;
  44                         }
  45                 };
  46                 if(cpu_ctr == 0) {
  47                         printk("No CPU nodes found, cannot continue.\n");
  48                         /* Probably a sun4d or sun4e, Sun is trying to trick us ;-) */
  49                         halt();
  50                 }
  51                 printk("Found %d CPU prom device tree node(s).\n", cpu_ctr);
  52         };
  53         prom_node_cpu = cpu_nds[0];
  54 
  55         linux_num_cpus = cpu_ctr;
  56 
  57         cpu_probe();
  58         auxio_probe();
  59 
  60         return mem_start;
  61 }

/* [previous][next][first][last][top][bottom][index][help] */