Subversion Repositories HelenOS

Rev

Rev 1903 | Rev 2009 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1903 Rev 1917
Line 38... Line 38...
38
#include <print.h>
38
#include <print.h>
39
#include <arch/register.h>
39
#include <arch/register.h>
40
#include <genarch/ofw/ofw_tree.h>
40
#include <genarch/ofw/ofw_tree.h>
41
#include <arch/types.h>
41
#include <arch/types.h>
42
#include <arch/drivers/tick.h>
42
#include <arch/drivers/tick.h>
-
 
43
#include <arch/mm/page.h>
-
 
44
#include <arch/mm/tlb.h>
-
 
45
#include <macros.h>
43
 
46
 
44
/** Perform sparc64 specific initialization of the processor structure for the current processor. */
47
/** Perform sparc64 specific initialization of the processor structure for the current processor. */
45
void cpu_arch_init(void)
48
void cpu_arch_init(void)
46
{
49
{
47
    ofw_tree_node_t *node;
50
    ofw_tree_node_t *node;
Line 50... Line 53...
50
    upa_config_t upa_config;
53
    upa_config_t upa_config;
51
   
54
   
52
    upa_config.value = upa_config_read();
55
    upa_config.value = upa_config_read();
53
    CPU->arch.mid = upa_config.mid;
56
    CPU->arch.mid = upa_config.mid;
54
   
57
   
-
 
58
    /*
-
 
59
     * Detect processor frequency.
-
 
60
     */
55
    node = ofw_tree_find_child_by_device_type(ofw_tree_lookup("/"), "cpu");
61
    node = ofw_tree_find_child_by_device_type(ofw_tree_lookup("/"), "cpu");
56
    while (node) {
62
    while (node) {
57
        ofw_tree_property_t *prop;
63
        ofw_tree_property_t *prop;
58
       
64
       
59
        prop = ofw_tree_getprop(node, "upa-portid");
65
        prop = ofw_tree_getprop(node, "upa-portid");
Line 68... Line 74...
68
        node = ofw_tree_find_peer_by_device_type(node, "cpu");
74
        node = ofw_tree_find_peer_by_device_type(node, "cpu");
69
    }
75
    }
70
 
76
 
71
    CPU->arch.clock_frequency = clock_frequency;
77
    CPU->arch.clock_frequency = clock_frequency;
72
    tick_init();
78
    tick_init();
-
 
79
   
-
 
80
    /*
-
 
81
     * Lock CPU stack in DTLB.
-
 
82
     */
-
 
83
    uintptr_t base = ALIGN_DOWN(config.base, 1<<KERNEL_PAGE_WIDTH);
-
 
84
         
-
 
85
    if (!overlaps((uintptr_t) CPU->stack, PAGE_SIZE, base, (1<<KERNEL_PAGE_WIDTH))) {
-
 
86
        /*
-
 
87
         * Kernel stack of this processor is not locked in DTLB.
-
 
88
         * First, demap any already existing mappings.
-
 
89
         * Second, create a locked mapping for it.
-
 
90
         */
-
 
91
        dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) CPU->stack);
-
 
92
        dtlb_insert_mapping((uintptr_t) CPU->stack, KA2PA(CPU->stack), PAGESIZE_8K, true, true);
-
 
93
    }
-
 
94
 
73
}
95
}
74
 
96
 
75
/** Read version information from the current processor. */
97
/** Read version information from the current processor. */
76
void cpu_identify(void)
98
void cpu_identify(void)
77
{
99
{