More bus type info

This commit is contained in:
Laurent Vivier 2004-02-26 23:38:05 +00:00
parent f133bfe8b7
commit fbfde9d37e
2 changed files with 60 additions and 9 deletions

View File

@ -2,6 +2,8 @@
*
* (c) 2004 Laurent Vivier <LaurentVivier@wanadoo.fr>
*
* some parts from BootX, (c) Benjamin Herrenschmidt
*
*/
#include "glue.h"
@ -11,7 +13,7 @@ unsigned long cpu_type = 0;
unsigned long mmu_type = 0;
unsigned long fpu_type = 0;
unsigned long machine_id = 0;
unsigned long arch_type = gestalt68k;
unsigned long arch_type = 0;
unsigned long bus_type = 0;
void arch_init()
@ -31,19 +33,58 @@ void arch_init()
Gestalt(gestaltMMUType, &mmu_type);
/* get architecture type */
/* get architecture type: powerPC or m68k */
Gestalt(gestaltSysArchitecture, &arch_type);
if (Gestalt(gestaltSysArchitecture, &arch_type) != noErr)
arch_type = gestalt68k;
/* check machine type: powerPC or m68k */
/* check machine type */
Gestalt(gestaltMachineType, &machine_id);
#if 0
/* check bus type */
if (Gestalt(gestaltOpenFirmwareInfo, &response) == noErr)
if (Gestalt(gestaltNameRegistryVersion, &response) == noErr)
arch_pci = true;
#endif
if (arch_type == gestalt68k)
{
bus_type = busNUBUS;
}
else
{
unsigned long response;
/* OpenFirmware implies PCI */
if ( (Gestalt('opfw', &response) == noErr) &&
(Gestalt('nreg', &response) == noErr) )
bus_type = busPCI;
else
bus_type = busNUBUS;
switch(machine_id)
{
case gestaltPowerMac6100_60:
case gestaltPowerMac6100_66:
case gestaltPowerMac6100_80:
case gestaltPowerMac7100_66:
case gestaltPowerMac7100_80:
case gestaltPowerMac7100_80_chipped:
case gestaltPowerMac8100_80:
case gestaltPowerMac8100_100:
case gestaltPowerMac8100_110:
case gestaltPowerMac8100_120:
case gestaltAWS9150_80:
case gestaltAWS9150_120:
bus_type |= busPDM;
break;
case gestaltPowerMac5200:
case gestaltPowerMac6200:
bus_type |= busPERFORMA;
break;
case gestaltPowerBook1400:
case gestaltPowerBook5300:
case gestaltPowerBookDuo2300:
bus_type |= busPOWERBOOK;
break;
}
}
}

View File

@ -133,6 +133,7 @@ enum {
gestaltPerforma580 = gestaltMacLC580,
gestaltPowerMac6100_66 = 100,
gestaltAWS6150_66 = gestaltPowerMac6100_66,
gestaltPowerMac6100_80 = 101,
gestaltPowerBookDuo280 = 102,
gestaltPowerBookDuo280c = 103,
gestaltPowerMacLC475 = 104,
@ -145,6 +146,7 @@ enum {
gestaltPowerMac7200 = 108,
gestaltPowerMac7300 = 109,
gestaltPowerMac7100_66 = 112,
gestaltPowerMac7100_80_chipped= 113,
gestaltPowerBook150 = 115,
gestaltPowerMacQuadra700 = 116,
gestaltPowerMacQuadra900 = 117,
@ -173,6 +175,14 @@ enum {
gestaltMacOSCompatibility = 1206
};
enum {
busNUBUS = 0x01,
busPCI = 0x02,
busPDM = 0x04,
busPERFORMA = 0x08,
busPOWERBOOK = 0x10
};
extern unsigned long cpu_type;
extern unsigned long mmu_type;
extern unsigned long fpu_type;