40,6 → 40,9 |
#include <genarch/ofw/ofw_tree.h> |
#include <arch/types.h> |
#include <arch/drivers/tick.h> |
#include <arch/mm/page.h> |
#include <arch/mm/tlb.h> |
#include <macros.h> |
|
/** Perform sparc64 specific initialization of the processor structure for the current processor. */ |
void cpu_arch_init(void) |
52,6 → 55,9 |
upa_config.value = upa_config_read(); |
CPU->arch.mid = upa_config.mid; |
|
/* |
* Detect processor frequency. |
*/ |
node = ofw_tree_find_child_by_device_type(ofw_tree_lookup("/"), "cpu"); |
while (node) { |
ofw_tree_property_t *prop; |
70,6 → 76,22 |
|
CPU->arch.clock_frequency = clock_frequency; |
tick_init(); |
|
/* |
* Lock CPU stack in DTLB. |
*/ |
uintptr_t base = ALIGN_DOWN(config.base, 1<<KERNEL_PAGE_WIDTH); |
|
if (!overlaps((uintptr_t) CPU->stack, PAGE_SIZE, base, (1<<KERNEL_PAGE_WIDTH))) { |
/* |
* Kernel stack of this processor is not locked in DTLB. |
* First, demap any already existing mappings. |
* Second, create a locked mapping for it. |
*/ |
dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) CPU->stack); |
dtlb_insert_mapping((uintptr_t) CPU->stack, KA2PA(CPU->stack), PAGESIZE_8K, true, true); |
} |
|
} |
|
/** Read version information from the current processor. */ |