Subversion Repositories HelenOS

Rev

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

Rev 3467 Rev 3479
Line 54... Line 54...
54
int ofw_translate_failed(ofw_arg_t flag)
54
int ofw_translate_failed(ofw_arg_t flag)
55
{
55
{
56
    return flag != -1;
56
    return flag != -1;
57
}
57
}
58
 
58
 
59
/*
-
 
60
 * Node among whose children the CPU nodes are located.
-
 
61
 */
-
 
62
#if defined (OPEN_BOOT)
-
 
63
#define CPUS_PARENT_NODE    ofw_root
-
 
64
#elif defined (SMART_FIRMWARE)
-
 
65
#define CPUS_PARENT_NODE    ofw_find_device("/ssm@0,0")
-
 
66
#endif
-
 
67
 
-
 
68
 
-
 
69
int ofw_cpu(void)
59
int ofw_cpu(void)
70
{
60
{
71
    char type_name[BUF_SIZE];
61
    char type_name[BUF_SIZE];
72
 
-
 
73
    phandle node;
62
    phandle node;
-
 
63
    phandle ssm;
-
 
64
 
-
 
65
    ssm = ofw_find_device("/ssm@0,0");
-
 
66
    if (ssm == -1) {
74
    node = ofw_get_child_node(CPUS_PARENT_NODE);
67
        node = ofw_get_child_node(ofw_root);
-
 
68
    } else {
-
 
69
        node = ofw_get_child_node(ssm);
-
 
70
    }
75
 
71
 
76
    if (node == 0 || node == -1) {
72
    if (node == 0 || node == -1) {
77
        printf("Could not find any child nodes of the root node.\n");
73
        printf("Could not find any child nodes of the root node.\n");
78
        return 0;
74
        return 0;
79
    }
75
    }
80
   
76
   
81
    uint64_t current_mid;
77
    uint64_t current_mid;
82
   
78
   
83
    asm volatile ("ldxa [%1] %2, %0\n"
79
    asm volatile ("ldxa [%1] %2, %0\n"
84
        : "=r" (current_mid)
80
        : "=r" (current_mid)
85
        : "r" (0), "i" (ASI_UPA_CONFIG));
81
        : "r" (0), "i" (ASI_ICBUS_CONFIG));
86
    current_mid >>= UPA_CONFIG_MID_SHIFT;
82
    current_mid >>= ICBUS_CONFIG_MID_SHIFT;
87
    current_mid &= UPA_CONFIG_MID_MASK;
83
    current_mid &= ICBUS_CONFIG_MID_MASK;
88
 
84
 
89
    int cpus;
85
    int cpus;
90
   
86
   
91
    for (cpus = 0; node != 0 && node != -1; node = ofw_get_peer_node(node),
87
    for (cpus = 0; node != 0 && node != -1; node = ofw_get_peer_node(node),
92
        cpus++) {
88
        cpus++) {