/trunk/boot/arch/sparc64/loader/ofwarch.h |
---|
29,9 → 29,13 |
#ifndef BOOT_sparc64_OFWARCH_H_ |
#define BOOT_sparc64_OFWARCH_H_ |
#include "main.h" |
#define OFW_ADDRESS_CELLS 2 |
#define OFW_SIZE_CELLS 2 |
extern int bpp2align[]; |
extern int ofw_cpu(cpu_t *cpu); |
#endif |
/trunk/boot/arch/sparc64/loader/main.c |
---|
66,7 → 66,11 |
if (!ofw_keyboard(&bootinfo.keyboard)) |
printf("Error: unable to get keyboard properties\n"); |
if (!ofw_cpu(&bootinfo.cpu)) |
printf("Error: unable to get cpu properties\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(" keyboard at %P (size %d bytes)\n", (uintptr_t) bootinfo.keyboard.addr, bootinfo.keyboard.size); |
/trunk/boot/arch/sparc64/loader/main.h |
---|
45,10 → 45,15 |
} taskmap_t; |
typedef struct { |
uint32_t clock_frequency; |
} cpu_t; |
typedef struct { |
taskmap_t taskmap; |
memmap_t memmap; |
screen_t screen; |
keyboard_t keyboard; |
cpu_t cpu; |
} bootinfo_t; |
extern void start(void); |
/trunk/boot/arch/sparc64/loader/ofwarch.c |
---|
34,6 → 34,8 |
#include <ofwarch.h> |
#include <ofw.h> |
#include <printf.h> |
#include <string.h> |
#include "main.h" |
int bpp2align[] = { |
[0] = 0, /** Invalid bpp. */ |
79,3 → 81,31 |
return true; |
} |
int ofw_cpu(cpu_t *cpu) |
{ |
char type_name[BUF_SIZE]; |
phandle node; |
node = ofw_get_child_node(ofw_root); |
if (node == 0 || node == -1) { |
printf("Could not find any child nodes of the root node.\n"); |
return; |
} |
for (; node != 0 && node != -1; node = ofw_get_peer_node(node)) { |
if (ofw_get_property(node, "device_type", type_name, sizeof(type_name)) > 0) { |
if (strncmp(type_name, "cpu", 3) == 0) { |
uint32_t mhz; |
if (ofw_get_property(node, "clock-frequency", &mhz, sizeof(mhz)) <= 0) |
continue; |
cpu->clock_frequency = mhz; |
return 1; |
} |
} |
}; |
return 0; |
} |
/trunk/boot/arch/sparc64/loader/Makefile |
---|
51,6 → 51,7 |
SOURCES = \ |
main.c \ |
../../../generic/printf.c \ |
../../../generic/string.c \ |
../../../genarch/ofw.c \ |
ofwarch.c \ |
asm.S \ |