* Clean up OpenFirmware machine detections
* Detect OpenBIOS used in QEMU and set machine flag (OpenBIOS isn't 1:1 Apple OpenFirmware) * Show at boot which machine type is detected git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42459 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -9,12 +9,15 @@
|
|||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Possible gMachine OpenFirmware platforms
|
||||||
#define MACHINE_UNKNOWN 0x0000
|
#define MACHINE_UNKNOWN 0x0000
|
||||||
|
|
||||||
#define MACHINE_CHRP 0x0001
|
#define MACHINE_CHRP 0x0001
|
||||||
#define MACHINE_MAC 0x0002
|
#define MACHINE_MAC 0x0002
|
||||||
|
|
||||||
#define MACHINE_PEGASOS 0x0100
|
#define MACHINE_PEGASOS 0x0100
|
||||||
|
#define MACHINE_QEMU 0x0200
|
||||||
|
#define MACHINE_SPARC 0x0300
|
||||||
|
|
||||||
|
|
||||||
extern uint32 gMachine;
|
extern uint32 gMachine;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2010, Axel Dörfler, [email protected].
|
* Copyright 2003-2010, Axel Dörfler, [email protected].
|
||||||
|
* Copyright 2011, Alexander von Gluck, [email protected]
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -61,26 +62,28 @@ determine_machine(void)
|
|||||||
|
|
||||||
int root = of_finddevice("/");
|
int root = of_finddevice("/");
|
||||||
char buffer[64];
|
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
|
// TODO : Probe other OpenFirmware platforms and set gMachine as needed
|
||||||
|
|
||||||
|
int length = of_getprop(root, "device_type", buffer, sizeof(buffer) - 1);
|
||||||
|
buffer[length] = '\0';
|
||||||
|
|
||||||
if (!strcasecmp("chrp", buffer))
|
if (!strcasecmp("chrp", buffer))
|
||||||
gMachine = MACHINE_CHRP;
|
gMachine = MACHINE_CHRP;
|
||||||
else if (!strcasecmp("bootrom", buffer))
|
else //(bootrom) + QEMU
|
||||||
gMachine = MACHINE_MAC;
|
gMachine = MACHINE_MAC;
|
||||||
|
|
||||||
if ((length = of_getprop(root, "model", buffer, sizeof(buffer) - 1))
|
length = of_getprop(root, "model", buffer, sizeof(buffer) - 1);
|
||||||
== OF_FAILED)
|
|
||||||
return;
|
|
||||||
buffer[length] = '\0';
|
buffer[length] = '\0';
|
||||||
|
|
||||||
if (!strcasecmp("pegasos", buffer))
|
if (!strcasecmp("pegasos", buffer))
|
||||||
gMachine |= MACHINE_PEGASOS;
|
gMachine |= MACHINE_PEGASOS;
|
||||||
|
|
||||||
|
length = of_getprop(root, "name", buffer, sizeof(buffer) - 1);
|
||||||
|
buffer[length] = '\0';
|
||||||
|
|
||||||
|
if (!strcasecmp("openbiosteam,openbios", buffer))
|
||||||
|
gMachine |= MACHINE_QEMU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -156,6 +159,13 @@ start(void *openFirmwareEntry)
|
|||||||
determine_machine();
|
determine_machine();
|
||||||
console_init();
|
console_init();
|
||||||
|
|
||||||
|
if (gMachine & MACHINE_QEMU)
|
||||||
|
dprintf("OpenBIOS (QEMU?) OpenFirmware machine detected\n");
|
||||||
|
else if (gMachine & MACHINE_PEGASOS)
|
||||||
|
dprintf("Pegasos PowerPC machine detected\n");
|
||||||
|
else
|
||||||
|
dprintf("Apple PowerPC machine assumed\n");
|
||||||
|
|
||||||
// Initialize and take over MMU and set the OpenFirmware callbacks - it
|
// Initialize and take over MMU and set the OpenFirmware callbacks - it
|
||||||
// will ask us for memory after that instead of maintaining it itself
|
// will ask us for memory after that instead of maintaining it itself
|
||||||
// (the kernel will need to adjust the callback later on as well)
|
// (the kernel will need to adjust the callback later on as well)
|
||||||
|
|||||||
Reference in New Issue
Block a user