Index: trunk/i386/libsaio/fake_efi.h =================================================================== --- trunk/i386/libsaio/fake_efi.h (revision 2592) +++ trunk/i386/libsaio/fake_efi.h (revision 2593) @@ -29,7 +29,7 @@ #define __LIBSAIO_FAKE_EFI_H /* Set up space for up to 10 configuration table entries */ -#define MAX_CONFIGURATION_TABLE_ENTRIES 10 +#define MAX_CONFIGURATION_TABLE_ENTRIES (uint32_t)10 extern void setupFakeEfi(void); Index: trunk/i386/libsaio/xml.c =================================================================== --- trunk/i386/libsaio/xml.c (revision 2592) +++ trunk/i386/libsaio/xml.c (revision 2593) @@ -64,7 +64,7 @@ tmp = tmp->next; } //verbose("Unable to locate Ref String %d\n", id); - return ""; + return "Unknown"; } struct Module { Index: trunk/i386/libsaio/hfs.c =================================================================== --- trunk/i386/libsaio/hfs.c (revision 2592) +++ trunk/i386/libsaio/hfs.c (revision 2593) @@ -1000,7 +1000,7 @@ } // Return error if the file was not found. - if (result != 0) + if (result != 0 || !recordData) { free(nodeBuf); return -1; Index: trunk/i386/libsaio/spd.c =================================================================== --- trunk/i386/libsaio/spd.c (revision 2592) +++ trunk/i386/libsaio/spd.c (revision 2593) @@ -126,7 +126,7 @@ #define READ_SPD(spd, base, slot, x) spd[x] = smb_read_byte_intel(base, 0x50 + slot, x) /** Read from spd *used* values only*/ -static void init_spd(char * spd, uint32_t base, int slot) +static void init_spd(char *spd, uint32_t base, int slot) { int i; for (i = 0; i < SPD_INDEXES_SIZE; i++) @@ -232,7 +232,7 @@ #define SLST(a) ((uint8_t)(spd[a] & 0x0f)) /* Get DDR3 or DDR2 serial number, 0 most of the times, always return a valid ptr */ -const char *getDDRSerial(const char* spd) +const char *getDDRSerial(const char *spd) { static char asciiSerial[17]; @@ -296,7 +296,7 @@ int i, speed; uint8_t spd_size, spd_type; uint32_t base, mmio, hostc; - uint16_t cmd; // Command + uint16_t cmd; // bool dump = false; RamSlotInfo_t *slot; Index: trunk/i386/libsaio/device_inject.h =================================================================== --- trunk/i386/libsaio/device_inject.h (revision 2592) +++ trunk/i386/libsaio/device_inject.h (revision 2593) @@ -52,7 +52,7 @@ // ------------------------ uint8_t num_pci_devpaths; struct DevPropString *string; - // ------------------------ + // ------------------------ }; typedef struct DevPropDevice DevPropDevice; Index: trunk/i386/libsaio/disk.c =================================================================== --- trunk/i386/libsaio/disk.c (revision 2592) +++ trunk/i386/libsaio/disk.c (revision 2593) @@ -844,7 +844,7 @@ // same as Apple ZFS //EFI_GUID const GPT_ZFS_GUID = { 0x6A898CC3, 0x1DD2, 0x11B2, { 0x99, 0xA6, 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }; // 0xBF01 "Solaris /usr & Apple ZFS -BVRef newGPTBVRef( int biosdev, +static BVRef newGPTBVRef( int biosdev, int partno, unsigned int blkoff, const gpt_ent *part, Index: trunk/i386/libsaio/convert.c =================================================================== --- trunk/i386/libsaio/convert.c (revision 2592) +++ trunk/i386/libsaio/convert.c (revision 2593) @@ -8,7 +8,7 @@ #include "convert.h" /** Transform a 16 bytes hexadecimal value UUID to a string */ -const char * getStringFromUUID(const EFI_CHAR8* eUUID) +const char *getStringFromUUID(const EFI_CHAR8 *eUUID) { static char msg[UUID_LEN*2 + 8] = ""; if (!eUUID) return ""; @@ -21,8 +21,8 @@ return msg ; } -/** Parse an UUID string into an (EFI_CHAR8*) buffer */ -EFI_CHAR8* getUUIDFromString(const char *source) +/** Parse an UUID string into an (EFI_CHAR8 *) buffer */ +EFI_CHAR8 *getUUIDFromString(const char *source) { if (!source) { @@ -100,6 +100,12 @@ { // the resulting binary will be the half size of the input hex string binStr = malloc(len / 2); + if (!binStr) + { + *outLength = 0; + return NULL; + } + bzero(binStr,len / 2 ); binStrIdx = 0; hexNibbleIdx = 0; @@ -119,7 +125,7 @@ { binChar = 0; - for (hexNibbleIdx = 0; hexNibbleIdx < sizeof(hexByte); hexNibbleIdx++) + for (hexNibbleIdx = 0; (unsigned)hexNibbleIdx < sizeof(hexByte); hexNibbleIdx++) { if (hexNibbleIdx > 0) { @@ -149,7 +155,7 @@ // FIXME: can't use my original code here, // Ironically, trying to reuse convertHexStr2Binary() would RESET the system! /* -static EFI_CHAR8* getUUIDFromString2(const char * szInUUID) +static EFI_CHAR8 *getUUIDFromString2(const char * szInUUID) { char szUUID[UUID_LEN+1], *p=szUUID; int size=0; @@ -165,6 +171,6 @@ verbose("UUID: cannot convert string <%s> to valid UUID.\n", szUUID); return (EFI_CHAR8*) 0; } - return (EFI_CHAR8*) ret; // new allocated buffer containing the converted string to bin + return (EFI_CHAR8 *) ret; // new allocated buffer containing the converted string to bin } */ Index: trunk/i386/libsaio/convert.h =================================================================== --- trunk/i386/libsaio/convert.h (revision 2592) +++ trunk/i386/libsaio/convert.h (revision 2593) @@ -11,10 +11,10 @@ #define UUID_LEN 16 -const char * getStringFromUUID(const EFI_CHAR8* uuid); -EFI_CHAR8* getUUIDFromString(const char *source); -void *convertHexStr2Binary(const char *hexStr, int *outLength); -uint32_t ascii_hex_to_int(char *buff); +const char *getStringFromUUID(const EFI_CHAR8* uuid); +EFI_CHAR8 *getUUIDFromString(const char *source); +void *convertHexStr2Binary(const char *hexStr, int *outLength); +uint32_t ascii_hex_to_int(char *buff); static inline uint16_t dp_swap16(uint16_t toswap) { Index: trunk/i386/libsaio/saio_internal.h =================================================================== --- trunk/i386/libsaio/saio_internal.h (revision 2592) +++ trunk/i386/libsaio/saio_internal.h (revision 2593) @@ -134,7 +134,7 @@ /* memory.c */ long AllocateKernelMemory( long inSize ); -long AllocateMemoryRange(char * rangeName, long start, long length, long type); +long AllocateMemoryRange(char *rangeName, long start, long length, long type); /* misc.c */ extern void enableA20(void); Index: trunk/i386/boot2/modules.c =================================================================== --- trunk/i386/boot2/modules.c (revision 2592) +++ trunk/i386/boot2/modules.c (revision 2593) @@ -1069,7 +1069,6 @@ return 0; } - /* * execute_hook( const char* name ) * name - Name of the module hook @@ -1106,8 +1105,6 @@ } } - - /* * register_hook_callback( const char* name, void(*callback)()) * name - Name of the module hook to attach to. Index: trunk/i386/boot2/gui.c =================================================================== --- trunk/i386/boot2/gui.c (revision 2592) +++ trunk/i386/boot2/gui.c (revision 2593) @@ -538,7 +538,7 @@ gui.backbuffer = malloc(sizeof(pixmap_t)); if(!gui.backbuffer) { -// DBG("Unable to allocate memory for gui.backbuffer"); + DBG("Unable to allocate memory for gui.backbuffer"); return 1; } @@ -547,7 +547,7 @@ { free(gui.backbuffer); gui.backbuffer = 0; -// DBG("Unable to allocate memory for gui.backbuffer->pixels"); + DBG("Unable to allocate memory for gui.backbuffer->pixels"); return 1; } @@ -564,7 +564,7 @@ window->pixmap = malloc(sizeof(pixmap_t)); if(!window->pixmap) { -// DBG("Unable to allocate memory for window->pixmap"); + DBG("Unable to allocate memory for window->pixmap"); return 1; } @@ -573,7 +573,7 @@ { free(window->pixmap); window->pixmap = 0; -// DBG("Unable to allocate memory for window->pixmap->pixels"); + DBG("Unable to allocate memory for window->pixmap->pixels"); return 1; } @@ -935,7 +935,7 @@ } #else -// DBG("Unable to load %s theme plist.\n",theme_name); + DBG("Unable to load %s theme plist.\n",theme_name); return 1; @@ -1000,7 +1000,7 @@ DBG("Loading error occurred, reseting...\n",theme_name); - // not available memory, freeing resources + // Loading error occurred, freeing resources freeWindowBuffer(&gui.menu); freeWindowBuffer(&gui.infobox); freeWindowBuffer(&gui.bootprompt); Index: trunk/i386/modules/Keylayout/layouts/cham-mklayout.c =================================================================== --- trunk/i386/modules/Keylayout/layouts/cham-mklayout.c (revision 2592) +++ trunk/i386/modules/Keylayout/layouts/cham-mklayout.c (revision 2593) @@ -365,9 +365,9 @@ struct keyboard_layout* new_layout = create_keylayout(in); if (new_layout) { write_layout(new_layout, out); - free(new_layout); - new_layout = NULL; - } + free(new_layout); + new_layout = NULL; + } fclose(out); fclose(in); Index: trunk/i386/modules/Keylayout/Keylayout.c =================================================================== --- trunk/i386/modules/Keylayout/Keylayout.c (revision 2592) +++ trunk/i386/modules/Keylayout/Keylayout.c (revision 2593) @@ -145,8 +145,7 @@ if (!load_keyboard_layout_file(layoutPath)) { - DBG("Can't load %s keyboard layout file. Keylayout will not be used !\n", - layoutPath); + DBG("Can't load %s keyboard layout file. Keylayout will not be used !\n", layoutPath); sleep(2); } else if (!replace_function("_getchar", &getchar_replacement)) Index: trunk/i386/modules/AcpiCodec/acpi_codec.c =================================================================== --- trunk/i386/modules/AcpiCodec/acpi_codec.c (revision 2592) +++ trunk/i386/modules/AcpiCodec/acpi_codec.c (revision 2593) @@ -1005,21 +1005,22 @@ boolean_t fine_grain_clock_mod = 0; #if BUILD_ACPI_TSS || pstate_power_support - if (Platform.CPU.CPUID[CPUID_0][0] >= 0x5) { + if (Platform.CPU.CPUID[CPUID_0][0] >= 0x5) { /* * Extract the Monitor/Mwait Leaf info: */ sub_Cstates = Platform.CPU.CPUID[CPUID_5][3]; extensions = Platform.CPU.CPUID[CPUID_5][2]; } - - if (Platform.CPU.CPUID[CPUID_0][0] >= 6) { + + if (Platform.CPU.CPUID[CPUID_0][0] >= 6) + { dynamic_acceleration = bitfield(Platform.CPU.CPUID[CPUID_6][0], 1, 1); // "Dynamic Acceleration Technology (Turbo Mode)" invariant_APIC_timer = bitfield(Platform.CPU.CPUID[CPUID_6][0], 2, 2); // "Invariant APIC Timer" fine_grain_clock_mod = bitfield(Platform.CPU.CPUID[CPUID_6][0], 4, 4); } - cpu->turbo_available = (U32)dynamic_acceleration; - + cpu->turbo_available = (U32)dynamic_acceleration; + { U32 temp32 = 0; U64 temp64= 0; @@ -1027,18 +1028,18 @@ if (getIntForKey("TDP", &tdp, &bootInfo->chameleonConfig)) { temp32 = (U32) (tdp*8) ; - + int tdc; if (getIntForKey("TDC", &tdc, &bootInfo->chameleonConfig)) { - temp32 = (U32) (temp32) | tdc<<16 ; - + temp32 = (U32) (temp32) | tdc<<16 ; + } else if (tdp) { temp32 = (U32) (temp32) | ((tdp)*8)<<16 ; } - + } else if (!is_sandybridge() && !is_jaketown()) { @@ -1055,16 +1056,17 @@ // in your boot.plist temp32 = (U32)0x02a802f8; } - + } - if (temp32) { + if (temp32) + { cpu->tdp_limit = ( temp32 & 0x7fff ); cpu->tdc_limit = ( (temp32 >> 16) & 0x7fff ); } } - + #endif - + switch (Platform.CPU.Family) { case 0x06: @@ -1077,26 +1079,26 @@ case CPUID_MODEL_PENRYN: // Penryn case CPUID_MODEL_ATOM: // Intel Atom (45nm) { - + cpu->core_c1_supported = ((sub_Cstates >> 4) & 0xf) ? 1 : 0; cpu->core_c4_supported = ((sub_Cstates >> 16) & 0xf) ? 1 : 0; - + if (Platform.CPU.Model == CPUID_MODEL_ATOM) { cpu->core_c2_supported = cpu->core_c3_supported = ((sub_Cstates >> 8) & 0xf) ? 1 : 0; cpu->core_c6_supported = ((sub_Cstates >> 12) & 0xf) ? 1 : 0; - + } else { cpu->core_c3_supported = ((sub_Cstates >> 12) & 0xf) ? 1 : 0; cpu->core_c2_supported = ((sub_Cstates >> 8) & 0xf) ? 1 : 0; cpu->core_c6_supported = 0; - + } - + cpu->core_c7_supported = 0; - + #if BETA GetMaxRatio(&cpu->max_ratio_as_mfg); U64 msr = rdmsr64(MSR_IA32_PERF_STATUS); @@ -1104,7 +1106,7 @@ U16 idhi = (msr >> 32) & 0xffff; cpu->min_ratio = (U32) (idlo >> 8) & 0xff; cpu->max_ratio_as_cfg = (U32) (idhi >> 8) & 0xff; - + #else if (Platform.CPU.MaxCoef) { @@ -1118,7 +1120,7 @@ } } #endif - + break; } case CPUID_MODEL_FIELDS: @@ -1131,25 +1133,25 @@ case CPUID_MODEL_SANDYBRIDGE: case CPUID_MODEL_JAKETOWN: { - + cpu->core_c1_supported = ((sub_Cstates >> 4) & 0xf) ? 1 : 0; cpu->core_c3_supported = ((sub_Cstates >> 8) & 0xf) ? 1 : 0; cpu->core_c6_supported = ((sub_Cstates >> 12) & 0xf) ? 1 : 0; cpu->core_c7_supported = ((sub_Cstates >> 16) & 0xf) ? 1 : 0; cpu->core_c2_supported = 0; cpu->core_c4_supported = 0; - + GetMaxRatio(&cpu->max_ratio_as_mfg); U64 platform_info = rdmsr64(MSR_PLATFORM_INFO); cpu->max_ratio_as_cfg = (U32) ((U32)platform_info >> 8) & 0xff; cpu->min_ratio = (U32) ((platform_info >> 40) & 0xff); - + cpu->tdc_tdp_limits_for_turbo_flag = (platform_info & (1ULL << 29)) ? 1 : 0; cpu->ratio_limits_for_turbo_flag = (platform_info & (1ULL << 28)) ? 1 : 0; cpu->xe_available = cpu->tdc_tdp_limits_for_turbo_flag | cpu->ratio_limits_for_turbo_flag; - - + + if (is_sandybridge() || is_jaketown()) { cpu->package_power_limit = rdmsr64(MSR_PKG_RAPL_POWER_LIMIT); @@ -1166,11 +1168,11 @@ default: break; } - + cpu->mwait_supported = (extensions & (1UL << 0)) ? 1 : 0; + + cpu->invariant_apic_timer_flag = (U32)invariant_APIC_timer; - cpu->invariant_apic_timer_flag = (U32)invariant_APIC_timer; - #if DEBUG_ACPI printf("CPU INFO : \n"); #if BETA @@ -1178,29 +1180,28 @@ #endif printf("max_ratio_as_cfg : %d\n", cpu->max_ratio_as_cfg); printf("max_ratio_as_mfg : %d\n", cpu->max_ratio_as_mfg); - + printf("turbo_available : %d\n",cpu->turbo_available); - + printf("core_c1_supported : %d\n",cpu->core_c1_supported); printf("core_c2_supported : %d\n",cpu->core_c1_supported); printf("core_c3_supported : %d\n",cpu->core_c3_supported); printf("core_c6_supported : %d\n",cpu->core_c6_supported); printf("core_c7_supported : %d\n",cpu->core_c7_supported); printf("mwait_supported : %d\n",cpu->mwait_supported); - + #if BUILD_ACPI_TSS || pstate_power_support if (is_sandybridge() || is_jaketown()) { - + printf("package_power_limit : %d\n",cpu->package_power_limit); printf("package_power_sku_unit : %d\n",cpu->package_power_sku_unit); - + } #endif - + DBG("invariant_apic_timer_flag : %d\n",cpu->invariant_apic_timer_flag); - - + #endif } @@ -1311,19 +1312,18 @@ //----------------------------------------------------------------------------- static U32 BuildPstateInfo(CPU_DETAILS * cpu) { - struct p_state p_states[32]; U8 p_states_count = 0; - - if (!cpu) - { - return (0); - } - + + if (!cpu) { + return (0); + } + + { #if UNUSED struct p_state initial; -#endif +#endif struct p_state maximum, minimum; // Retrieving P-States, ported from code by superhai (c) switch (Platform.CPU.Family)