Rev 1881 | Rev 1903 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1881 | Rev 1899 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <arch/asm.h> |
35 | #include <arch/asm.h> |
36 | #include <cpu.h> |
36 | #include <cpu.h> |
37 | #include <arch.h> |
37 | #include <arch.h> |
38 | #include <arch/register.h> |
- | |
39 | #include <print.h> |
38 | #include <print.h> |
- | 39 | #include <arch/register.h> |
|
- | 40 | #include <genarch/ofw/ofw_tree.h> |
|
40 | #include <arch/boot/boot.h> |
41 | #include <arch/types.h> |
- | 42 | #include <arch/drivers/tick.h> |
|
41 | 43 | ||
- | 44 | /** Perform sparc64 specific initialization of the processor structure for the current processor. */ |
|
42 | void cpu_arch_init(void) |
45 | void cpu_arch_init(void) |
43 | { |
46 | { |
- | 47 | ofw_tree_node_t *node; |
|
- | 48 | uint32_t mid; |
|
- | 49 | uint32_t clock_frequency = 0; |
|
- | 50 | upa_config_t upa_config; |
|
- | 51 | ||
- | 52 | upa_config.value = upa_config_read(); |
|
- | 53 | node = ofw_tree_find_child_by_device_type(ofw_tree_lookup("/"), "cpu"); |
|
- | 54 | while (node) { |
|
- | 55 | ofw_tree_property_t *prop; |
|
- | 56 | ||
- | 57 | prop = ofw_tree_getprop(node, "upa-portid"); |
|
- | 58 | if (prop && prop->value) { |
|
- | 59 | mid = *((uint32_t *) prop->value); |
|
- | 60 | if (mid == upa_config.mid) { |
|
- | 61 | prop = ofw_tree_getprop(node, "clock-frequency"); |
|
- | 62 | if (prop && prop->value) |
|
- | 63 | clock_frequency = *((uint32_t *) prop->value); |
|
- | 64 | } |
|
- | 65 | } |
|
- | 66 | node = ofw_tree_find_peer_by_device_type(node, "cpu"); |
|
- | 67 | } |
|
- | 68 | ||
44 | CPU->arch.clock_frequency = bootinfo.processor.clock_frequency; |
69 | CPU->arch.clock_frequency = clock_frequency; |
- | 70 | tick_init(); |
|
45 | } |
71 | } |
46 | 72 | ||
- | 73 | /** Read version information from the current processor. */ |
|
47 | void cpu_identify(void) |
74 | void cpu_identify(void) |
48 | { |
75 | { |
49 | CPU->arch.ver.value = ver_read(); |
76 | CPU->arch.ver.value = ver_read(); |
50 | } |
77 | } |
51 | 78 | ||
- | 79 | /** Print version information for a processor. |
|
- | 80 | * |
|
- | 81 | * @param m Processor structure of the CPU for which version information is to be printed. |
|
- | 82 | */ |
|
52 | void cpu_print_report(cpu_t *m) |
83 | void cpu_print_report(cpu_t *m) |
53 | { |
84 | { |
54 | char *manuf, *impl; |
85 | char *manuf, *impl; |
55 | 86 | ||
56 | switch (CPU->arch.ver.manuf) { |
87 | switch (CPU->arch.ver.manuf) { |