- First stab at getting the ppc ports building and working.
[coreboot.git] / src / arch / ppc / lib / cpu.c
1 #include <console/console.h>
2 #include <arch/io.h>
3 #include <string.h>
4 #include <device/device.h>
5 #include <cpu/cpu.h>
6 #include <cpu/ppc/cpuid.h>
7 #include "ppc.h"
8 #include "ppcreg.h"
9
10 #if 0
11 static void set_cpu_ops(struct device *cpu)
12 {
13         struct cpu_driver *driver;
14         cpu->ops = 0;
15         for (driver = cpu_drivers; driver < ecpu_drivers; driver++) {
16                 struct cpu_device_id *id;
17                 for(id = driver->id_table; id->pvr != 0; id++) {
18                         if (cpu->device == id->pvr) 
19                         {
20                                 goto found;
21                         }
22                 }
23         }
24         die("Unknown cpu");
25         return;
26  found:
27         cpu->ops = driver->ops;
28 }
29 #endif
30
31 void cpu_initialize(void)
32 {
33         /* Because we busy wait at the printk spinlock.
34          * It is important to keep the number of printed messages
35          * from secondary cpus to a minimum, when debugging is
36          * disabled.
37          */
38         struct device *cpu;
39         struct cpu_info *info;
40         info = cpu_info();
41
42         printk_notice("Initializing CPU #%d\n", info->index);
43
44         cpu = info->cpu;
45         if (!cpu) {
46                 die("CPU: missing cpu device structure");
47         }
48         
49         /* Find what type of cpu we are dealing with */
50         cpu->vendor = 0; /* PPC cpus do not have a vendor field */
51         cpu->device = ppc_getpvr();
52         display_cpuid(cpu);
53
54 #if 0
55         /* Lookup the cpu's operations */
56         set_cpu_ops(cpu);
57
58         /* Initialize the cpu */
59         if (cpu->ops && cpu->ops->init) {
60                 cpu->enabled = 1;
61                 cpu->initialized = 1;
62                 cpu->ops->init();
63         }
64 #endif  
65         /* Turn on caching if we haven't already */
66
67         printk_info("CPU #%d Initialized\n", info->index);
68         return;
69 }