2004-02-26 22:29:31 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* (c) 2004 Laurent Vivier <LaurentVivier@wanadoo.fr>
|
|
|
|
*
|
2004-02-26 23:38:05 +00:00
|
|
|
* some parts from BootX, (c) Benjamin Herrenschmidt
|
|
|
|
*
|
2004-02-26 22:29:31 +00:00
|
|
|
*/
|
|
|
|
|
2004-06-02 17:38:24 +00:00
|
|
|
#include "misc.h"
|
2004-02-26 20:10:41 +00:00
|
|
|
#include "glue.h"
|
|
|
|
#include "arch.h"
|
2004-07-10 01:28:27 +00:00
|
|
|
#include "lowmem.h"
|
2004-02-26 20:10:41 +00:00
|
|
|
|
2004-05-25 23:30:31 +00:00
|
|
|
unsigned long cpu_type;
|
|
|
|
unsigned long mmu_type;
|
|
|
|
unsigned long fpu_type;
|
|
|
|
unsigned long machine_id;
|
|
|
|
unsigned long arch_type;
|
|
|
|
unsigned long bus_type;
|
2004-02-26 20:10:41 +00:00
|
|
|
|
|
|
|
void arch_init()
|
|
|
|
{
|
2004-07-10 01:28:27 +00:00
|
|
|
/* System prior to 6.0.4 doesn't support Gestalt() */
|
|
|
|
|
|
|
|
if (ROMBase[4] == 0x0178) {
|
|
|
|
|
|
|
|
/* Macintosh SE/30 */
|
|
|
|
|
|
|
|
/* Doesn't support Gestalt(), nor SysEnvirons() (why ?) */
|
|
|
|
|
|
|
|
/* http://docs.info.apple.com/article.html?artnum=112170 */
|
|
|
|
|
|
|
|
cpu_type = gestalt68030;
|
|
|
|
mmu_type = gestalt68030MMU;
|
|
|
|
fpu_type = gestalt68882;
|
|
|
|
machine_id = gestaltMacSE030;
|
|
|
|
arch_type = gestalt68k;
|
|
|
|
bus_type = busNUBUS;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-02-26 20:10:41 +00:00
|
|
|
/* get processor type */
|
|
|
|
|
|
|
|
Gestalt(gestaltProcessorType, &cpu_type);
|
|
|
|
|
|
|
|
/* check FPU */
|
|
|
|
|
|
|
|
if (Gestalt('FPUE', &fpu_type) == noErr)
|
|
|
|
fpu_type = 0;
|
|
|
|
else
|
|
|
|
Gestalt(gestaltFPUType, &fpu_type);
|
|
|
|
|
|
|
|
/* check MMU */
|
|
|
|
|
|
|
|
Gestalt(gestaltMMUType, &mmu_type);
|
|
|
|
|
2004-06-02 21:11:21 +00:00
|
|
|
/* I'v got a 'noMMU' with my 68030, not cool... */
|
|
|
|
|
|
|
|
if (mmu_type == gestaltNoMMU)
|
|
|
|
{
|
|
|
|
switch(cpu_type)
|
|
|
|
{
|
|
|
|
case gestalt68030:
|
|
|
|
mmu_type = gestalt68030MMU;
|
|
|
|
break;
|
|
|
|
case gestalt68040:
|
|
|
|
mmu_type = gestalt68040MMU;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-26 23:38:05 +00:00
|
|
|
/* get architecture type: powerPC or m68k */
|
2004-02-26 20:10:41 +00:00
|
|
|
|
2004-02-26 23:38:05 +00:00
|
|
|
if (Gestalt(gestaltSysArchitecture, &arch_type) != noErr)
|
|
|
|
arch_type = gestalt68k;
|
2004-02-26 20:10:41 +00:00
|
|
|
|
2004-02-26 23:38:05 +00:00
|
|
|
/* check machine type */
|
2004-02-26 20:10:41 +00:00
|
|
|
|
|
|
|
Gestalt(gestaltMachineType, &machine_id);
|
2004-02-26 22:29:31 +00:00
|
|
|
|
|
|
|
/* check bus type */
|
|
|
|
|
2004-02-26 23:38:05 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2004-02-26 20:10:41 +00:00
|
|
|
}
|