Now uses the OF root node properties "model" and "device_type" to get
and idea about the underlying hardware (needed at other places). Calls arch_set_callback() right after MMU takeover. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5204 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6bf336d531
commit
c9593d2253
23
src/kernel/boot/platform/openfirmware/machine.h
Normal file
23
src/kernel/boot/platform/openfirmware/machine.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#ifndef MACHINE_H
|
||||
#define MACHINE_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#define MACHINE_UNKNOWN 0x0000
|
||||
|
||||
#define MACHINE_CHRP 0x0001
|
||||
#define MACHINE_MAC 0x0002
|
||||
|
||||
#define MACHINE_PEGASOS 0x0100
|
||||
|
||||
|
||||
extern uint32 gMachine;
|
||||
// stores the machine type
|
||||
|
||||
#endif /* MACHINE_H */
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "openfirmware.h"
|
||||
#include "console.h"
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
#define HEAP_SIZE 32768
|
||||
@ -27,6 +28,8 @@ extern void (*__ctor_end)(void);
|
||||
extern uint8 __bss_start;
|
||||
extern uint8 _end;
|
||||
|
||||
uint32 gMachine;
|
||||
|
||||
|
||||
static void
|
||||
call_ctors(void)
|
||||
@ -46,6 +49,34 @@ clear_bss(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
determine_machine(void)
|
||||
{
|
||||
int root = of_finddevice("/");
|
||||
char buffer[64];
|
||||
int length;
|
||||
if ((length = of_getprop(root, "device_type", buffer, sizeof(buffer) - 1)) == OF_FAILED)
|
||||
return;
|
||||
buffer[length] = '\0';
|
||||
|
||||
// ToDo: add more, and be as generic as possible
|
||||
|
||||
gMachine = MACHINE_UNKNOWN;
|
||||
|
||||
if (!strcasecmp("chrp", buffer))
|
||||
gMachine = MACHINE_CHRP;
|
||||
else if (!strcasecmp("bootrom", buffer))
|
||||
gMachine = MACHINE_MAC;
|
||||
|
||||
if ((length = of_getprop(root, "model", buffer, sizeof(buffer) - 1)) == OF_FAILED)
|
||||
return;
|
||||
buffer[length] = '\0';
|
||||
|
||||
if (!strcasecmp("pegasos", buffer))
|
||||
gMachine |= MACHINE_PEGASOS;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_start(uint32 _unused1, uint32 _unused3, void *openFirmwareEntry)
|
||||
{
|
||||
@ -68,8 +99,15 @@ start(void *openFirmwareEntry)
|
||||
args.heap_size = HEAP_SIZE;
|
||||
|
||||
of_init(openFirmwareEntry);
|
||||
|
||||
determine_machine();
|
||||
console_init();
|
||||
|
||||
// Initialize and take over MMU and set the OpenFirmware callbacks - it
|
||||
// will ask us for memory after that instead of maintaining it itself
|
||||
// (the kernel will need to adjust the callback later on as well)
|
||||
arch_mmu_init();
|
||||
arch_set_callback();
|
||||
|
||||
main(&args);
|
||||
// if everything wents fine, main() never returns
|
||||
|
Loading…
Reference in New Issue
Block a user