Index: branches/cparm/i386/libsaio/platform.c =================================================================== --- branches/cparm/i386/libsaio/platform.c (revision 1814) +++ branches/cparm/i386/libsaio/platform.c (revision 1815) @@ -24,17 +24,52 @@ PlatformInfo_t *Platform; /** Return if a CPU feature specified by feature is activated (true) or not (false) */ -inline bool platformCPUFeature(uint32_t feature) +bool platformCPUFeature(uint32_t feature) { - return (Platform->CPU.Features & feature); + return (Platform->CPU.Features & feature) ? true : false; } /** Return if a CPU Extended feature specified by feature is activated (true) or not (false) */ -inline bool platformCPUExtFeature(uint32_t feature) +bool platformCPUExtFeature(uint32_t feature) { - return (Platform->CPU.ExtFeatures & feature); + return (Platform->CPU.ExtFeatures & feature) ? true : false; } +bool platformIsIntel(void) +{ + return (Platform->CPU.Vendor == 0x756E6547) ? true : false; +} + +uint32_t getCPUnCores(void) +{ + return Platform->CPU.NoCores; +} + +uint32_t getCPUnThreads(void) +{ + return Platform->CPU.NoThreads; +} + +uint8_t getCPUModel(void) +{ + return Platform->CPU.Model; +} + +uint8_t getCPUFamily(void) +{ + return Platform->CPU.Family; +} + +bool platformIsServer(void) +{ + return (Platform->CPU.isServer) ? true : false; +} + +bool platformIsMobile(void) +{ + return (Platform->CPU.isMobile) ? true : false; +} + /** Scan platform hardware information, called by the main entry point (common_boot() ) _before_ bootConfig xml parsing settings are loaded Index: branches/cparm/i386/libsaio/platform.h =================================================================== --- branches/cparm/i386/libsaio/platform.h (revision 1814) +++ branches/cparm/i386/libsaio/platform.h (revision 1815) @@ -11,32 +11,11 @@ #include "cpuid.h" #include "cpu_data.h" -extern bool platformCPUExtFeature(uint32_t); -extern bool platformCPUFeature(uint32_t); -extern void scan_platform(void); - #define bitmask(h,l) ((_Bit(h)|(_Bit(h)-1)) & ~(_Bit(l)-1)) #define bitfield(x,h,l) (((x) & bitmask(h,l)) >> l) #define quad(hi,lo) (((uint64_t)(hi)) << 32 | (lo)) - -/* CPUID index into cpuid_raw */ -/* -#define CPUID_0 0 -#define CPUID_1 1 -#define CPUID_2 2 -#define CPUID_3 3 -#define CPUID_4 4 -#define CPUID_5 5 -#define CPUID_6 6 -#define CPUID_80 7 -#define CPUID_81 8 -#define CPUID_B0 9 -#define CPUID_B1 10 -#define CPUID_MAX 11 -*/ - /* Additional models supported by Chameleon (NOT SUPPORTED BY THE APPLE'S ORIGINAL KERNEL) */ #define CPUID_MODEL_BANIAS 0x09 #define CPUID_MODEL_DOTHAN 0x0D Index: branches/cparm/i386/libsaio/saio_internal.h =================================================================== --- branches/cparm/i386/libsaio/saio_internal.h (revision 1814) +++ branches/cparm/i386/libsaio/saio_internal.h (revision 1815) @@ -164,9 +164,19 @@ extern BVRef nbpScanBootVolumes(int biosdev, int *count); #endif +/* platform.h */ +extern bool platformCPUExtFeature(uint32_t); +extern bool platformCPUFeature(uint32_t); +extern void scan_platform(void); +extern bool platformIsIntel(void); +extern uint8_t getCPUModel(void); +extern uint8_t getCPUFamily(void); +extern uint32_t getCPUnCores(void); +extern uint32_t getCPUnThread(void); +extern bool platformIsMobile(void); +extern bool platformIsServer(void); - /* stringTable.c */ extern char * newStringFromList(char **list, int *size); extern int stringLength(const char *table, int compress); Index: branches/cparm/i386/modules/SMBiosGetters/mysmbios.c =================================================================== --- branches/cparm/i386/modules/SMBiosGetters/mysmbios.c (revision 1814) +++ branches/cparm/i386/modules/SMBiosGetters/mysmbios.c (revision 1815) @@ -635,17 +635,17 @@ const SMStrEntryPair* sm_defaults; const SMStrEntryPair* sm_chosen; - if (Platform->CPU.isServer == true) + if (platformIsServer() == true) { sm_defaults=sm_xserve_defaults; - } else if (Platform->CPU.isMobile == true) { - if (Platform->CPU.NoCores > 1) { + } else if (platformIsMobile() == true) { + if (getCPUnCores() > 1) { sm_defaults=sm_macbookpro_defaults; } else { sm_defaults=sm_macbook_defaults; } } else { - switch (Platform->CPU.NoCores) + switch (getCPUnCores()) { case 1: sm_defaults=sm_macmini_defaults; @@ -655,11 +655,11 @@ break; default: { - switch (Platform->CPU.Family) + switch (getCPUFamily()) { case 0x06: { - switch (Platform->CPU.Model) + switch (getCPUModel()) { case CPUID_MODEL_FIELDS: // Intel Core i5, i7 LGA1156 (45nm) case CPUID_MODEL_DALES: // Intel Core i5, i7 LGA1156 (45nm) ??? @@ -1012,11 +1012,11 @@ { SMBOemProcessorBusSpeed *p = (SMBOemProcessorBusSpeed *)structPtr->new; - switch (Platform->CPU.Family) + switch (getCPUFamily()) { case 0x06: { - switch (Platform->CPU.Model) + switch (getCPUModel()) { case 0x19: // Intel Core i5 650 @3.20 Ghz case CPUID_MODEL_FIELDS: // Intel Core i5, i7 LGA1156 (45nm) Index: branches/cparm/i386/modules/ACPICodec/acpi_codec.c =================================================================== --- branches/cparm/i386/modules/ACPICodec/acpi_codec.c (revision 1814) +++ branches/cparm/i386/modules/ACPICodec/acpi_codec.c (revision 1815) @@ -765,12 +765,12 @@ static bool is_sandybridge(void) { - return Platform->CPU.Model == CPUID_MODEL_SANDYBRIDGE; + return getCPUModel() == CPUID_MODEL_SANDYBRIDGE; } static bool is_jaketown(void) { - return Platform->CPU.Model == CPUID_MODEL_JAKETOWN; + return getCPUModel() == CPUID_MODEL_JAKETOWN; } static U32 get_bclk(void) @@ -1036,11 +1036,11 @@ #endif - switch (Platform->CPU.Family) + switch (getCPUFamily()) { case 0x06: { - switch (Platform->CPU.Model) + switch (getCPUModel()) { case CPUID_MODEL_DOTHAN: case CPUID_MODEL_YONAH: // Yonah @@ -1052,7 +1052,7 @@ cpu->core_c1_supported = ((Platform->CPU.sub_Cstates >> 4) & 0xf) ? 1 : 0; cpu->core_c4_supported = ((Platform->CPU.sub_Cstates >> 16) & 0xf) ? 1 : 0; - if (Platform->CPU.Model == CPUID_MODEL_ATOM) + if (getCPUModel() == CPUID_MODEL_ATOM) { cpu->core_c2_supported = cpu->core_c3_supported = ((Platform->CPU.sub_Cstates >> 8) & 0xf) ? 1 : 0; cpu->core_c6_supported = ((Platform->CPU.sub_Cstates >> 12) & 0xf) ? 1 : 0; @@ -2426,11 +2426,11 @@ } // Create buffer for MADT - U8 memory_for_madt[2 * 1024]; + //U8 memory_for_madt[2 * 1024]; // seems to bug with xcode4, need to found out what is going on (not enough memory in the stack ?) + U8 *memory_for_madt = (U8*)AllocateKernelMemory(2 * 1024); - // Build the new MADT - if ( (ProcessMadt(MadtPointer, madt_info, memory_for_madt, sizeof(memory_for_madt), cpu_map_count))== 0) + if ( (ProcessMadt(MadtPointer, madt_info, memory_for_madt, 2 * 1024, cpu_map_count))== 0) { printf("Error: Failed to build MADT table\n"); return (0); @@ -2491,10 +2491,11 @@ } // Create buffer for SSDT - U8 memory_for_ssdt[20 * 1024]; + //U8 memory_for_ssdt[20 * 1024]; // seems to bug with xcode4, need to found out what is going on (not enough memory in the stack ?) + U8 *memory_for_ssdt =(U8*)AllocateKernelMemory(20 * 1024); // Build the SSDT - if ( (BuildSsdt(madt_info, dsdt, memory_for_ssdt, sizeof(memory_for_ssdt), enable_cstates, enable_pstates, enable_tstates)) == 0) + if ( (BuildSsdt(madt_info, dsdt, memory_for_ssdt, 20 * 1024 /*sizeof(memory_for_ssdt)*/, enable_cstates, enable_pstates, enable_tstates)) == 0) { printf("Error: Failed to build SSDT table\n"); return (0); @@ -3978,7 +3979,7 @@ const char * value; // Restart Fix - if (Platform->CPU.Vendor == 0x756E6547) /* Intel */ + if (platformIsIntel()) /* Intel */ { fix_restart = true; getBoolForKey(kRestartFix, &fix_restart, &bootInfo->bootConfig); @@ -4124,7 +4125,7 @@ bool val = false; getBoolForKey("PreferInternalProfileDetect", &val, &bootInfo->bootConfig); // if true Give prior to the profile resolved trought the CPU model - val = Platform->CPU.isServer ; + val = platformIsServer() ; if (fadt_mod->PreferredProfile <= MaxSupportedPMProfile && !val) {