Subversion Repositories HelenOS-historic

Rev

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

Rev 1075 Rev 1130
Line 29... Line 29...
29
#include "ofw.h"
29
#include "ofw.h"
30
#include "asm.h"
30
#include "asm.h"
31
#include "printf.h"
31
#include "printf.h"
32
 
32
 
33
#define MAX_OFW_ARGS    10
33
#define MAX_OFW_ARGS    10
-
 
34
#define STRING_SIZE     1024
34
 
35
 
35
typedef unsigned int ofw_arg_t;
36
typedef unsigned int ofw_arg_t;
36
typedef unsigned int ihandle;
37
typedef unsigned int ihandle;
37
typedef unsigned int phandle;
38
typedef unsigned int phandle;
38
 
39
 
Line 50... Line 51...
50
 
51
 
51
 
52
 
52
ofw_entry ofw;
53
ofw_entry ofw;
53
 
54
 
54
phandle ofw_chosen;
55
phandle ofw_chosen;
-
 
56
phandle ofw_aliases;
55
ihandle ofw_mmu;
57
ihandle ofw_mmu;
56
ihandle ofw_stdout;
58
ihandle ofw_stdout;
57
 
59
 
58
 
60
 
59
static int ofw_call(const char *service, const int nargs, const int nret, ...)
61
static int ofw_call(const char *service, const int nargs, const int nret, ...)
Line 104... Line 106...
104
        halt();
106
        halt();
105
   
107
   
106
    if (ofw_get_property(ofw_chosen, "stdout",  &ofw_stdout, sizeof(ofw_stdout)) <= 0) 
108
    if (ofw_get_property(ofw_chosen, "stdout",  &ofw_stdout, sizeof(ofw_stdout)) <= 0) 
107
        ofw_stdout = 0;
109
        ofw_stdout = 0;
108
   
110
   
-
 
111
    ofw_aliases = ofw_find_device("/aliases");
-
 
112
    if (ofw_aliases == -1) {
-
 
113
        puts("\nUnable to find /aliases device\n");
-
 
114
        halt();
-
 
115
    }
-
 
116
   
109
    ofw_mmu = ofw_open("/mmu");
117
    ofw_mmu = ofw_open("/mmu");
110
    if (ofw_mmu == -1) {
118
    if (ofw_mmu == -1) {
111
        puts("Unable to open /mmu node\n");
119
        puts("\nUnable to open /mmu node\n");
112
        halt();
120
        halt();
113
    }
121
    }
114
}
122
}
115
 
123
 
116
 
124
 
Line 155... Line 163...
155
            break;
163
            break;
156
        map->count++;
164
        map->count++;
157
        map->total += map->zones[i].size;
165
        map->total += map->zones[i].size;
158
    }
166
    }
159
}
167
}
-
 
168
 
-
 
169
 
-
 
170
int ofw_screen(screen_t *screen)
-
 
171
{
-
 
172
    char device_name[STRING_SIZE];
-
 
173
   
-
 
174
    if (ofw_get_property(ofw_aliases, "screen", device_name, STRING_SIZE) <= 0)
-
 
175
        return false;
-
 
176
   
-
 
177
    phandle device = ofw_find_device(device_name);
-
 
178
    if (device == -1)
-
 
179
        return false;
-
 
180
   
-
 
181
    if (ofw_get_property(device, "address", &screen->addr, sizeof(screen->addr)) <= 0)
-
 
182
        return false;
-
 
183
   
-
 
184
    if (ofw_get_property(device, "width", &screen->width, sizeof(screen->width)) <= 0)
-
 
185
        return false;
-
 
186
   
-
 
187
    if (ofw_get_property(device, "height", &screen->height, sizeof(screen->height)) <= 0)
-
 
188
        return false;
-
 
189
   
-
 
190
    if (ofw_get_property(device, "depth", &screen->bpp, sizeof(screen->bpp)) <= 0)
-
 
191
        return false;
-
 
192
   
-
 
193
    if (ofw_get_property(device, "linebytes", &screen->scanline, sizeof(screen->scanline)) <= 0)
-
 
194
        return false;
-
 
195
   
-
 
196
    return true;
-
 
197
}