Subversion Repositories HelenOS

Rev

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

Rev 1837 Rev 1881
Line 32... Line 32...
32
 */
32
 */
33
 
33
 
34
#include <ofwarch.h>  
34
#include <ofwarch.h>  
35
#include <ofw.h>
35
#include <ofw.h>
36
#include <printf.h>
36
#include <printf.h>
-
 
37
#include <string.h>
-
 
38
#include "main.h"
37
 
39
 
38
int bpp2align[] = {
40
int bpp2align[] = {
39
    [0] = 0,        /** Invalid bpp. */
41
    [0] = 0,        /** Invalid bpp. */
40
    [1] = 1,        /** 8bpp is not aligned. */
42
    [1] = 1,        /** 8bpp is not aligned. */
41
    [2] = 2,        /** 16bpp is naturally aligned. */
43
    [2] = 2,        /** 16bpp is naturally aligned. */
Line 77... Line 79...
77
    if (!(keyboard->addr = ofw_translate((void *) ((uintptr_t) virtaddr))))
79
    if (!(keyboard->addr = ofw_translate((void *) ((uintptr_t) virtaddr))))
78
        return false;
80
        return false;
79
 
81
 
80
    return true;
82
    return true;
81
}
83
}
-
 
84
 
-
 
85
int ofw_cpu(cpu_t *cpu)
-
 
86
{
-
 
87
    char type_name[BUF_SIZE];
-
 
88
 
-
 
89
    phandle node;
-
 
90
    node = ofw_get_child_node(ofw_root);
-
 
91
    if (node == 0 || node == -1) {
-
 
92
        printf("Could not find any child nodes of the root node.\n");
-
 
93
        return;
-
 
94
    }
-
 
95
   
-
 
96
    for (; node != 0 && node != -1; node = ofw_get_peer_node(node)) {
-
 
97
        if (ofw_get_property(node, "device_type", type_name, sizeof(type_name)) > 0) {
-
 
98
            if (strncmp(type_name, "cpu", 3) == 0) {
-
 
99
                uint32_t mhz;
-
 
100
               
-
 
101
                if (ofw_get_property(node, "clock-frequency", &mhz, sizeof(mhz)) <= 0)
-
 
102
                    continue;
-
 
103
                   
-
 
104
                cpu->clock_frequency = mhz;
-
 
105
                return 1;
-
 
106
            }
-
 
107
        }
-
 
108
    };
-
 
109
 
-
 
110
    return 0;
-
 
111
}