40,6 → 40,8 |
#include <arch/drivers/tick.h> |
#include <print.h> |
#include <arch/cpu_node.h> |
#include <arch/sun4v/md.h> |
#include <arch/sun4v/hypercall.h> |
|
/** Perform sparc64 specific initialization of the processor structure for the |
* current processor. |
46,12 → 48,34 |
*/ |
void cpu_arch_init(void) |
{ |
// TODO: detect the real frequency as soon as MD walkthrough is implemented |
CPU->arch.clock_frequency = 5000; |
uint64_t myid; |
__hypercall_fast_ret1(0, 0, 0, 0, 0, CPU_MYID, &myid); |
|
md_node_t node = md_get_root(); |
|
/* walk through MD, find the current CPU node & its clock-frequency */ |
while (true) { |
|
if (!md_next_node(&node, "cpu")) { |
panic("Could not determine CPU frequency."); |
} |
|
uint64_t id = 0; |
md_get_integer_property(node, "id", &id); |
if (id == myid) { |
uint64_t clock_frequency = 0; |
md_get_integer_property(node, "clock-frequency", |
&clock_frequency); |
CPU->arch.clock_frequency = clock_frequency; |
break; |
} |
} |
|
tick_init(); |
} |
|
/** Implemented as an empty function as accessing the VER register is |
/** |
* Implemented as an empty function as accessing the VER register is |
* a hyperprivileged operation on sun4v. |
*/ |
void cpu_identify(void) |