/trunk/boot/arch/sparc64/loader/main.c |
---|
57,12 → 57,21 |
halt(); |
} |
if (!ofw_screen(&bootinfo.screen)) { |
printf("Error: unable to get screen properties, halting.\n"); |
halt(); |
} |
bootinfo.screen.addr = ofw_translate(bootinfo.screen.addr); |
/* transform scanline to bytes with respect to potential alignment */ |
bootinfo.screen.scanline = bootinfo.screen.scanline*bpp2align[bootinfo.screen.bpp >> 3]; |
if (!ofw_cpu(&bootinfo.cpu)) |
printf("Error: unable to get cpu properties\n"); |
printf("\nDevice info\n"); |
printf("\nDevice statistics\n"); |
printf(" cpu: %dMHz\n", bootinfo.cpu.clock_frequency/1000000); |
printf(" memory: %dM\n", bootinfo.memmap.total>>20); |
printf(" screen at %P, resolution %dx%d, %d bpp (scanline %d bytes)\n", (uintptr_t) bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); |
printf("\nMemory statistics\n"); |
printf(" kernel entry point at %P\n", KERNEL_VIRTUAL_ADDRESS); |
/trunk/boot/arch/sparc64/loader/main.h |
---|
53,6 → 53,7 |
typedef struct { |
taskmap_t taskmap; |
memmap_t memmap; |
screen_t screen; |
cpu_t cpu; |
ballocs_t ballocs; |
ofw_tree_node_t *ofw_root; |
/trunk/boot/arch/sparc64/loader/ofwarch.c |
---|
37,6 → 37,14 |
#include <string.h> |
#include "main.h" |
int bpp2align[] = { |
[0] = 0, /** Invalid bpp. */ |
[1] = 1, /** 8bpp is not aligned. */ |
[2] = 2, /** 16bpp is naturally aligned. */ |
[3] = 4, /** 24bpp is aligned on 4 byte boundary. */ |
[4] = 4, /** 32bpp is naturally aligned. */ |
}; |
void write(const char *str, const int len) |
{ |
int i; |
53,6 → 61,27 |
return flag != -1; |
} |
int ofw_keyboard(keyboard_t *keyboard) |
{ |
char device_name[BUF_SIZE]; |
uint32_t virtaddr; |
if (ofw_get_property(ofw_aliases, "keyboard", device_name, sizeof(device_name)) <= 0) |
return false; |
phandle device = ofw_find_device(device_name); |
if (device == -1) |
return false; |
if (ofw_get_property(device, "address", &virtaddr, sizeof(virtaddr)) <= 0) |
return false; |
if (!(keyboard->addr = ofw_translate((void *) ((uintptr_t) virtaddr)))) |
return false; |
return true; |
} |
int ofw_cpu(cpu_t *cpu) |
{ |
char type_name[BUF_SIZE]; |