Index: branches/Chimera/i386/libsaio/smbios_getters.h =================================================================== --- branches/Chimera/i386/libsaio/smbios_getters.h (revision 2657) +++ branches/Chimera/i386/libsaio/smbios_getters.h (revision 2658) @@ -17,8 +17,8 @@ kSMBString, kSMBByte, kSMBWord, - kSMBDWord -// kSMBQWord + kSMBDWord, + kSMBQWord } SMBValueType; typedef union @@ -27,7 +27,7 @@ uint8_t byte; uint16_t word; uint32_t dword; -// uint64_t qword; + uint64_t qword; } returnType; extern bool getProcessorInformationExternalClock(returnType *value); Index: branches/Chimera/i386/libsaio/console.c =================================================================== --- branches/Chimera/i386/libsaio/console.c (revision 2657) +++ branches/Chimera/i386/libsaio/console.c (revision 2658) @@ -91,8 +91,7 @@ msgbuf = malloc(BOOTER_LOG_SIZE); bzero(msgbuf, BOOTER_LOG_SIZE); cursor = msgbuf; -// msglog("%s\n", "Chimera 4.0.0 Branch of " "Chameleon " I386BOOT_CHAMELEONVERSION " (svn-r" I386BOOT_CHAMELEONREVISION ")" " [" I386BOOT_BUILDDATE "]"); - msglog("%s\n", "Chimera 4.0.1 Branch of Chameleon" " [" I386BOOT_BUILDDATE "]"); + msglog("%s\n", "Chimera 4.1.0 Branch of Chameleon" " [" I386BOOT_BUILDDATE "]"); } void msglog(const char * fmt, ...) @@ -186,11 +185,13 @@ // Kabyl: BooterLog struct putc_info pi; - if (!msgbuf) { + if (!msgbuf) + { return 0; } - if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) { + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) + { return 0; } pi.str = cursor; @@ -220,11 +221,13 @@ // Kabyl: BooterLog struct putc_info pi; - if (!msgbuf) { + if (!msgbuf) + { return 0; } - if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) { + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) + { return 0; } pi.str = cursor; Index: branches/Chimera/i386/libsaio/bootstruct.c =================================================================== --- branches/Chimera/i386/libsaio/bootstruct.c (revision 2657) +++ branches/Chimera/i386/libsaio/bootstruct.c (revision 2658) @@ -47,7 +47,7 @@ Node *node; int nameLen; static int init_done = 0; - + if ( !init_done ) { bootArgs = (boot_args *)malloc(sizeof(boot_args)); @@ -55,34 +55,34 @@ bootInfo = (PrivateBootInfo_t *)malloc(sizeof(PrivateBootInfo_t)); if (bootArgs == 0 || bootInfo == 0) stop("Couldn't allocate boot info\n"); - + bzero(bootArgs, sizeof(boot_args)); bzero(bootArgsPreLion, sizeof(boot_args_pre_lion)); bzero(bootInfo, sizeof(PrivateBootInfo_t)); - + // Get system memory map. Also update the size of the // conventional/extended memory for backwards compatibility. - + bootInfo->memoryMapCount = getMemoryMap( bootInfo->memoryMap, kMemoryMapCountMax, (unsigned long *) &bootInfo->convmem, (unsigned long *) &bootInfo->extmem ); - + if ( bootInfo->memoryMapCount == 0 ) { // BIOS did not provide a memory map, systems with // discontiguous memory or unusual memory hole locations // may have problems. - + bootInfo->convmem = getConventionalMemorySize(); bootInfo->extmem = getExtendedMemorySize(); } bootInfo->configEnd = bootInfo->config; bootArgs->Video.v_display = VGA_TEXT_MODE; - + DT__Initialize(); - + node = DT__FindNode("/", true); if (node == 0) { stop("Couldn't create root node"); @@ -91,20 +91,19 @@ nameLen = strlen(platformName) + 1; DT__AddProperty(node, "compatible", nameLen, platformName); DT__AddProperty(node, "model", nameLen, platformName); - + gMemoryMapNode = DT__FindNode("/chosen/memory-map", true); - + bootArgs->Version = kBootArgsVersion; bootArgs->Revision = kBootArgsRevision; - + bootArgsPreLion->Version = kBootArgsPreLionVersion; bootArgsPreLion->Revision = kBootArgsPreLionRevision; - + init_done = 1; } } - /* Copy boot args after kernel and record address. */ void @@ -115,17 +114,16 @@ void *oldAddr = bootArgs; bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args)); bcopy(oldAddr, bootArgs, sizeof(boot_args)); - } - else - { + } else { void *oldAddr = bootArgsPreLion; bootArgsPreLion = (boot_args_pre_lion *)AllocateKernelMemory(sizeof(boot_args_pre_lion)); bcopy(oldAddr, bootArgsPreLion, sizeof(boot_args_pre_lion)); } } -void -finalizeBootStruct(void) +//============================================================================== + +void finalizeBootStruct(void) { uint32_t size; void *addr; @@ -133,36 +131,45 @@ EfiMemoryRange *memoryMap; MemoryRange *range; int memoryMapCount = bootInfo->memoryMapCount; - - if (memoryMapCount == 0) { + + if (memoryMapCount == 0) + { // XXX could make a two-part map here stop("Unable to convert memory map into proper format\n"); } - + // convert memory map to boot_args memory map memoryMap = (EfiMemoryRange *)AllocateKernelMemory(sizeof(EfiMemoryRange) * memoryMapCount); + bootArgs->MemoryMap = (uint32_t)memoryMap; bootArgs->MemoryMapSize = sizeof(EfiMemoryRange) * memoryMapCount; bootArgs->MemoryMapDescriptorSize = sizeof(EfiMemoryRange); bootArgs->MemoryMapDescriptorVersion = 0; - - for (i = 0; i < memoryMapCount; i++, memoryMap++) { + + for (i = 0; i < memoryMapCount; i++, memoryMap++) + { range = &bootInfo->memoryMap[i]; - switch(range->type) { + switch(range->type) + { case kMemoryRangeACPI: memoryMap->Type = kEfiACPIReclaimMemory; break; + case kMemoryRangeNVS: memoryMap->Type = kEfiACPIMemoryNVS; break; + case kMemoryRangeUsable: memoryMap->Type = kEfiConventionalMemory; break; + case kMemoryRangeReserved: + default: memoryMap->Type = kEfiReservedMemoryType; break; } + memoryMap->PhysicalStart = range->base; memoryMap->VirtualStart = range->base; memoryMap->NumberOfPages = range->length >> I386_PGSHIFT; @@ -171,43 +178,45 @@ // copy bootFile into device tree // XXX - + // add PCI info somehow into device tree // XXX - + // Flatten device tree DT__FlattenDeviceTree(0, &size); addr = (void *)AllocateKernelMemory(size); - if (addr == 0) { + + if (addr == 0) + { stop("Couldn't allocate device tree\n"); } - + DT__FlattenDeviceTree((void **)&addr, &size); bootArgs->deviceTreeP = (uint32_t)addr; bootArgs->deviceTreeLength = size; // Copy BootArgs values to older structure - + memcpy(&bootArgsPreLion->CommandLine, &bootArgs->CommandLine, BOOT_LINE_LENGTH); memcpy(&bootArgsPreLion->Video, &bootArgs->Video, sizeof(Boot_Video)); - + bootArgsPreLion->MemoryMap = bootArgs->MemoryMap; bootArgsPreLion->MemoryMapSize = bootArgs->MemoryMapSize; bootArgsPreLion->MemoryMapDescriptorSize = bootArgs->MemoryMapDescriptorSize; bootArgsPreLion->MemoryMapDescriptorVersion = bootArgs->MemoryMapDescriptorVersion; - + bootArgsPreLion->deviceTreeP = bootArgs->deviceTreeP; bootArgsPreLion->deviceTreeLength = bootArgs->deviceTreeLength; - + bootArgsPreLion->kaddr = bootArgs->kaddr; bootArgsPreLion->ksize = bootArgs->ksize; - + bootArgsPreLion->efiRuntimeServicesPageStart = bootArgs->efiRuntimeServicesPageStart; bootArgsPreLion->efiRuntimeServicesPageCount = bootArgs->efiRuntimeServicesPageCount; bootArgsPreLion->efiSystemTable = bootArgs->efiSystemTable; - + bootArgsPreLion->efiMode = bootArgs->efiMode; - + bootArgsPreLion->performanceDataStart = bootArgs->performanceDataStart; bootArgsPreLion->performanceDataSize = bootArgs->performanceDataSize; bootArgsPreLion->efiRuntimeServicesVirtualPageStart = bootArgs->efiRuntimeServicesVirtualPageStart; Index: branches/Chimera/i386/libsaio/efi.h =================================================================== --- branches/Chimera/i386/libsaio/efi.h (revision 2657) +++ branches/Chimera/i386/libsaio/efi.h (revision 2658) @@ -231,7 +231,7 @@ // range requires a runtime mapping #define EFI_MEMORY_RUNTIME 0x8000000000000000ULL - +#define EFI_MEMORY_KERN_RESERVED (1ULL << 59) typedef EFI_UINT64 EFI_PHYSICAL_ADDRESS; typedef EFI_UINT64 EFI_VIRTUAL_ADDRESS; @@ -254,7 +254,7 @@ IN EFI_UINTN DescriptorSize, IN EFI_UINT32 DescriptorVersion, IN EFI_MEMORY_DESCRIPTOR * VirtualMap - ) __attribute__((regparm(0))); + ); typedef EFI_RUNTIMESERVICE @@ -262,7 +262,7 @@ (EFIAPI *EFI_CONVERT_POINTER) ( IN EFI_UINTN DebugDisposition, IN OUT VOID **Address - ) __attribute__((regparm(0))); + ); // Variable attributes @@ -281,7 +281,7 @@ OUT EFI_UINT32 * Attributes OPTIONAL, IN OUT EFI_UINTN * DataSize, OUT VOID * Data - ) __attribute__((regparm(0))); + ); typedef EFI_RUNTIMESERVICE @@ -290,7 +290,7 @@ IN OUT EFI_UINTN * VariableNameSize, IN OUT EFI_CHAR16 * VariableName, IN OUT EFI_GUID * VendorGuid - ) __attribute__((regparm(0))); + ); typedef EFI_RUNTIMESERVICE @@ -301,7 +301,7 @@ IN EFI_UINT32 Attributes, IN EFI_UINTN DataSize, IN VOID * Data - ) __attribute__((regparm(0))); + ); // EFI Time @@ -318,14 +318,14 @@ (EFIAPI *EFI_GET_TIME) ( OUT EFI_TIME * Time, OUT EFI_TIME_CAPABILITIES * Capabilities OPTIONAL - ) __attribute__((regparm(0))); + ); typedef EFI_RUNTIMESERVICE EFI_STATUS (EFIAPI *EFI_SET_TIME) ( IN EFI_TIME * Time - ) __attribute__((regparm(0))); + ); typedef EFI_RUNTIMESERVICE @@ -334,7 +334,7 @@ OUT EFI_BOOLEAN * Enabled, OUT EFI_BOOLEAN * Pending, OUT EFI_TIME * Time - ) __attribute__((regparm(0))); + ); typedef EFI_RUNTIMESERVICE @@ -342,7 +342,7 @@ (EFIAPI *EFI_SET_WAKEUP_TIME) ( IN EFI_BOOLEAN Enable, IN EFI_TIME * Time OPTIONAL - ) __attribute((regparm(0))); + ); typedef enum { EfiResetCold, @@ -363,7 +363,7 @@ IN EFI_STATUS ResetStatus, IN EFI_UINTN DataSize, IN EFI_CHAR16 * ResetData OPTIONAL - ) __attribute__((regparm(0))); + ); typedef EFI_RUNTIMESERVICE @@ -391,7 +391,7 @@ IN EFI_UINT32 Instance, IN EFI_GUID * CallerId OPTIONAL, IN EFI_STATUS_CODE_DATA * Data OPTIONAL - ) __attribute__((regparm(0))); + ); #endif // Index: branches/Chimera/i386/libsaio/vbe.c =================================================================== --- branches/Chimera/i386/libsaio/vbe.c (revision 2657) +++ branches/Chimera/i386/libsaio/vbe.c (revision 2658) @@ -34,7 +34,7 @@ static biosBuf_t bb; //============================================================================== - +#if UNUSED static inline void outi (int port, int index, int val) { @@ -66,7 +66,7 @@ outb (port, index); outb (port + 1, (inb (port + 1) & ~clear) | set); } - +#endif /* UNUSED */ //============================================================================== int getVBEInfo( void * infoBlock ) Index: branches/Chimera/i386/libsaio/bootstruct.h =================================================================== --- branches/Chimera/i386/libsaio/bootstruct.h (revision 2657) +++ branches/Chimera/i386/libsaio/bootstruct.h (revision 2658) @@ -47,7 +47,7 @@ /* * Maximum number of boot drivers that can be loaded. */ -#define NDRIVERS 500 +#define NDRIVERS 500 #define CONFIG_SIZE (40 * 4096) @@ -74,7 +74,9 @@ unsigned char BIOSPresent; } PCI_bus_info_t; -typedef struct { + +typedef struct +{ unsigned long address; // address where driver was loaded unsigned long size; // number of bytes unsigned long type; // driver type @@ -90,7 +92,8 @@ /* * ACPI defined memory range types. */ -enum { +enum +{ kMemoryRangeUsable = 1, // RAM usable by the OS. kMemoryRangeReserved = 2, // Reserved. (Do not use) kMemoryRangeACPI = 3, // ACPI tables. Can be reclaimed. Index: branches/Chimera/i386/libsaio/device_tree.c =================================================================== --- branches/Chimera/i386/libsaio/device_tree.c (revision 2657) +++ branches/Chimera/i386/libsaio/device_tree.c (revision 2658) @@ -398,7 +398,25 @@ } //============================================================================== +// Bungo +Property * +DT__GetProperty(Node *node, const char *name) +{ + Property *prop; + + for (prop = node->properties; prop; prop = prop->next) + { + if (strcmp(prop->name, name) == 0) + { + return prop; + } + } + + return NULL; +} +//============================================================================== + Node * DT__FindNode(const char *path, bool createIfMissing) { Index: branches/Chimera/i386/libsaio/acpi_patcher.c =================================================================== --- branches/Chimera/i386/libsaio/acpi_patcher.c (revision 2657) +++ branches/Chimera/i386/libsaio/acpi_patcher.c (revision 2658) @@ -23,7 +23,7 @@ #elif DEBUG_ACPI==1 #define DBG(x...) printf(x) #else -#define DBG(x...) +#define DBG(x...) msglog(x) #endif // Slice: New signature compare function @@ -112,7 +112,7 @@ fd = open(dirSpec, 0); if (fd < 0) { // NOT FOUND: - verbose("ACPI Table not found: %s\n", filename); + DBG("ACPI Table not found: %s\n", filename); *dirSpec = '\0'; } } @@ -136,7 +136,7 @@ { if (read (fd, tableAddr, file_size (fd))!=file_size (fd)) { - printf("Couldn't read table %s\n",dirspec); + DBG("Couldn't read table %s\n",dirspec); free (tableAddr); close (fd); return NULL; @@ -147,7 +147,7 @@ return tableAddr; } close (fd); - printf("Couldn't allocate memory for table \n", dirspec); + DBG("Couldn't allocate memory for table \n", dirspec); } //printf("Couldn't find table %s\n", filename); return NULL; @@ -161,13 +161,13 @@ { uint32_t i; - DBG("start finding cpu names. length %d\n", length); + DBG("Start finding cpu names. length %d\n", length); for (i=0; i> 6); @@ -182,7 +182,7 @@ if (!aml_isvalidchar(c)) { add_name = false; - verbose("Invalid character found in ProcessorOP 0x%x!\n", c); + DBG("Invalid character found in ProcessorOP 0x%x!\n", c); break; } } @@ -196,7 +196,7 @@ if (acpi_cpu_count == 0) acpi_cpu_p_blk = dsdt[i] | (dsdt[i+1] << 8); - verbose("Found ACPI CPU: %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]); + DBG("Found ACPI CPU: %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]); if (++acpi_cpu_count == 32) { return; @@ -205,7 +205,7 @@ } } - DBG("end finding cpu names: cpu names found: %d\n", acpi_cpu_count); + DBG("End finding cpu names: cpu names found: %d\n", acpi_cpu_count); } struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt) @@ -234,19 +234,19 @@ }; if (Platform.CPU.Vendor != 0x756E6547) { - verbose ("Not an Intel platform: C-States will not be generated !!!\n"); + DBG("Not an Intel platform: C-States will not be generated !!!\n"); return NULL; } if (fadt == NULL) { - verbose ("FACP not exists: C-States will not be generated !!!\n"); + DBG("FACP not exists: C-States will not be generated !!!\n"); return NULL; } struct acpi_2_dsdt* dsdt = (void*)fadt->DSDT; if (dsdt == NULL) { - verbose ("DSDT not found: C-States will not be generated !!!\n"); + DBG("DSDT not found: C-States will not be generated !!!\n"); return NULL; } @@ -397,11 +397,11 @@ // dumpPhysAddr("C-States SSDT content: ", ssdt, ssdt->Length); - verbose ("SSDT with CPU C-States generated successfully\n"); + DBG("SSDT with CPU C-States generated successfully\n"); return ssdt; } else { - verbose ("ACPI CPUs not found: C-States not generated !!!\n"); + DBG("ACPI CPUs not found: C-States not generated !!!\n"); } return NULL; @@ -419,12 +419,12 @@ }; if (Platform.CPU.Vendor != 0x756E6547) { - verbose ("Not an Intel platform: P-States will not be generated !!!\n"); + DBG("Not an Intel platform: P-States will not be generated !!!\n"); return NULL; } if (!(Platform.CPU.Features & CPU_FEATURE_MSR)) { - verbose ("Unsupported CPU: P-States will not be generated !!! No MSR support\n"); + DBG("Unsupported CPU: P-States will not be generated !!! No MSR support\n"); return NULL; } @@ -587,7 +587,7 @@ minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff; - verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control); + DBG("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control); // Sanity check if (maximum.Control < minimum.Control) { @@ -608,7 +608,7 @@ break; } default: - verbose ("Unsupported CPU (0x%X): P-States not generated !!!\n", Platform.CPU.Family); + DBG("Unsupported CPU (0x%X): P-States not generated !!!\n", Platform.CPU.Family); break; } } @@ -658,12 +658,12 @@ //dumpPhysAddr("P-States SSDT content: ", ssdt, ssdt->Length); - verbose ("SSDT with CPU P-States generated successfully\n"); + DBG("SSDT with CPU P-States generated successfully\n"); return ssdt; } } else { - verbose ("ACPI CPUs not found: P-States not generated !!!\n"); + DBG("ACPI CPUs not found: P-States not generated !!!\n"); } return NULL; @@ -689,7 +689,7 @@ getBoolForKey(kRestartFix, &fix_restart, &bootInfo->chameleonConfig); } } else { - verbose ("Not an Intel platform: Restart Fix not applied !!!\n"); + DBG("Not an Intel platform: Restart Fix not applied !!!\n"); fix_restart = false; } @@ -717,7 +717,7 @@ } else { Platform.Type = 1; /* Set a fixed value (Desktop) */ } - verbose("Error: system-type must be 0..6. Defaulting to %d !\n", Platform.Type); + DBG("Error: system-type must be 0..6. Defaulting to %d !\n", Platform.Type); } else { Platform.Type = (unsigned char) strtoul(value, NULL, 10); } @@ -726,7 +726,7 @@ if (fadt_mod->PM_Profile != Platform.Type) { if (value) { // user has overriden the SystemType so take care of it in FACP - verbose("FADT: changing PM_Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, Platform.Type); + DBG("FADT: changing PM_Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, Platform.Type); fadt_mod->PM_Profile = Platform.Type; } else { // PM_Profile has a different value and no override has been set, so reflect the user value to ioregs @@ -734,7 +734,7 @@ } } // We now have to write the systemm-type in ioregs: we cannot do it before in setupDeviceTree() - // because we need to take care of facp original content, if it is correct. + // because we need to take care of FACP original content, if it is correct. setupSystemType(); // Patch FADT to fix restart @@ -747,7 +747,7 @@ fadt_mod->Reset_AccessWidth = 0x01; // Byte access fadt_mod->Reset_Address = 0x64; // Address of the register fadt_mod->Reset_Value = 0xfe; // Value to write to reset the system - msglog("FADT: PS2 Restart Fix applied!\n"); + DBG("FADT: PS2 Restart Fix applied!\n"); } else { fadt_mod->Flags|= 0x400; fadt_mod->Reset_SpaceID = 0x01; // System I/O @@ -756,7 +756,7 @@ fadt_mod->Reset_AccessWidth = 0x01; // Byte access fadt_mod->Reset_Address = 0x0cf9; // Address of the register fadt_mod->Reset_Value = 0x06; // Value to write to reset the system - verbose("FADT: ACPI Restart Fix applied!\n"); + DBG("FADT: ACPI Restart Fix applied!\n"); } } @@ -772,7 +772,7 @@ DBG("New @%x,%x\n",fadt_mod->DSDT,fadt_mod->X_DSDT); - verbose("FADT: Using custom DSDT!\n"); + DBG("FADT: Using custom DSDT!\n"); } // Correct the checksum @@ -794,7 +794,7 @@ if(acpi20_p) { addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20"); } else { - verbose("No ACPI 2.\n"); + DBG("No ACPI 2.\n"); } return 1; } @@ -803,7 +803,7 @@ int setupAcpi(void) { int version; - void *new_dsdt; + void *new_dsdt = NULL; const char *filename; @@ -823,6 +823,7 @@ // Load replacement DSDT new_dsdt = loadACPITable(dirSpec); + // Mozodojo: going to patch FACP and load SSDT's even if DSDT.aml is not present /*if (!new_dsdt) { @@ -840,8 +841,8 @@ getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->chameleonConfig); getBoolForKey(kGenerateCStates, &generate_cstates, &bootInfo->chameleonConfig); - DBG("Generating P-States config: %d\n", generate_pstates); - DBG("Generating C-States config: %d\n", generate_cstates); + DBG("Generating P-States config: %s\n", generate_pstates ? "YES" : "NO"); + DBG("Generating C-States config: %s\n", generate_cstates ? "YES" : "NO"); { int i; @@ -849,7 +850,7 @@ for (i = 0; i < 30; i++) { char filename[512]; - sprintf(filename, i > 0?"SSDT-%d.aml":"SSDT.aml", i); + sprintf(filename, i > 0 ? "SSDT-%d.aml" : "SSDT.aml", i); if ( (new_ssdt[ssdt_count] = loadACPITable(filename)) ) { ssdt_count++; @@ -866,7 +867,7 @@ int rsdplength; // Find original rsdp - rsdp=(struct acpi_2_rsdp *)(version?getAddressOfAcpi20Table():getAddressOfAcpiTable()); + rsdp=(struct acpi_2_rsdp *)(version ? getAddressOfAcpi20Table() : getAddressOfAcpiTable()); if (!rsdp) { DBG("No ACPI version %d found. Ignoring\n", version+1); if (version) { @@ -876,7 +877,7 @@ } continue; } - rsdplength=version?rsdp->Length:20; + rsdplength=version ? rsdp->Length : 20; DBG("RSDP version %d found @%x. Length=%d\n",version+1,rsdp,rsdplength); @@ -914,17 +915,17 @@ rsdt_entries[i-dropoffset]=rsdt_entries[i]; if (drop_ssdt && tableSign(table, "SSDT")) { - verbose("OEM SSDT tables was dropped\n"); + DBG("OEM SSDT tables was dropped\n"); dropoffset++; continue; } + if (tableSign(table, "DSDT")) { DBG("DSDT found\n"); verbose("Custom DSDT table was found\n"); if(new_dsdt) { rsdt_entries[i-dropoffset]=(uint32_t)new_dsdt; } - continue; } @@ -935,7 +936,7 @@ DBG("FADT found @%x, Length %d\n",fadt, fadt->Length); if (!fadt || (uint32_t)fadt == 0xffffffff || fadt->Length>0x10000) { - printf("FADT incorrect. Not modified\n"); + DBG("FADT incorrect. Not modified\n"); continue; } @@ -955,7 +956,6 @@ generate_pstates = false; // Generate SSDT only once! ssdt_count++; } - continue; } } @@ -971,15 +971,14 @@ rsdt_entries=(uint32_t *)(rsdt_mod+1); // Mozodojo: Insert additional SSDTs into RSDT - if(ssdt_count>0) { + if(ssdt_count > 0) { int j; for (j=0; jChecksum,rsdt_mod); } else { rsdp_mod->RsdtAddress=0; - printf("RSDT not found or RSDT incorrect\n"); + DBG("RSDT not found or RSDT incorrect\n"); } + DBG("\n"); if (version) { struct acpi_2_xsdt *xsdt, *xsdt_mod; @@ -1022,7 +1022,7 @@ xsdt_entries[i-dropoffset]=xsdt_entries[i]; if (drop_ssdt && tableSign(table, "SSDT")) { - verbose("OEM SSDT tables was dropped\n"); + DBG("OEM SSDT tables was dropped\n"); dropoffset++; continue; } @@ -1031,10 +1031,11 @@ if (new_dsdt) { xsdt_entries[i-dropoffset]=(uint32_t)new_dsdt; + DBG("Custom Table Added\n"); } DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]); - + continue; } if (tableSign(table, "FACP")) { @@ -1045,32 +1046,33 @@ fadt->Length); if (!fadt || (uint64_t)xsdt_entries[i] >= 0xffffffff || fadt->Length>0x10000) { - verbose("FADT incorrect or after 4GB. Dropping XSDT\n"); + DBG("FADT incorrect or after 4GB. Dropping XSDT\n"); goto drop_xsdt; } fadt_mod = patch_fadt(fadt, new_dsdt); xsdt_entries[i-dropoffset]=(uint32_t)fadt_mod; - DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]); + // DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]); // Generate _CST SSDT if (generate_cstates && (new_ssdt[ssdt_count] = generate_cst_ssdt(fadt_mod))) { + DBG("C-States generated\n"); generate_cstates = false; // Generate SSDT only once! ssdt_count++; } // Generating _PSS SSDT if (generate_pstates && (new_ssdt[ssdt_count] = generate_pss_ssdt((void*)fadt_mod->DSDT))) { + DBG("P-States generated\n"); generate_pstates = false; // Generate SSDT only once! ssdt_count++; } continue; } - - DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]); - + DBG("copied (OEM)\n"); + // DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]); } // Allocate xsdt in Kernel memory area @@ -1109,26 +1111,22 @@ verbose("XSDT not found or XSDT incorrect\n"); } } + DBG("\n"); - // Correct the checksum of RSDP + // Correct the checksum of RSDP DBG("RSDP: Original checksum %d, ", rsdp_mod->Checksum); - rsdp_mod->Checksum=0; rsdp_mod->Checksum=256-checksum8(rsdp_mod,20); - DBG("New checksum %d\n", rsdp_mod->Checksum); if (version) { - DBG("RSDP: Original extended checksum %d", rsdp_mod->ExtendedChecksum); - + DBG("RSDP: Original extended checksum %d, ", rsdp_mod->ExtendedChecksum); rsdp_mod->ExtendedChecksum=0; rsdp_mod->ExtendedChecksum=256-checksum8(rsdp_mod,rsdp_mod->Length); - DBG("New extended checksum %d\n", rsdp_mod->ExtendedChecksum); } - //verbose("Patched ACPI version %d DSDT\n", version+1); if (version) { /* XXX aserebln why uint32 cast if pointer is uint64 ? */ acpi20_p = (uint64_t)(uint32_t)rsdp_mod; @@ -1138,6 +1136,7 @@ acpi10_p = (uint64_t)(uint32_t)rsdp_mod; addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI"); } + DBG("ACPI version %d patching finished\n\n", version+1); } #if DEBUG_ACPI printf("Press a key to continue... (DEBUG_ACPI)\n"); Index: branches/Chimera/i386/libsaio/device_tree.h =================================================================== --- branches/Chimera/i386/libsaio/device_tree.h (revision 2657) +++ branches/Chimera/i386/libsaio/device_tree.h (revision 2658) @@ -67,6 +67,9 @@ extern char * DT__GetName(Node *node); +extern Property * +DT__GetProperty(Node *node, const char *name); + void DT__Initialize(void); Index: branches/Chimera/i386/libsaio/bootargs.h =================================================================== --- branches/Chimera/i386/libsaio/bootargs.h (revision 2657) +++ branches/Chimera/i386/libsaio/bootargs.h (revision 2658) @@ -109,14 +109,14 @@ /* Snapshot constants of previous revisions that are supported */ -#define kBootArgsEfiMode32 32 -#define kBootArgsEfiMode64 64 +#define kBootArgsEfiMode32 32 +#define kBootArgsEfiMode64 64 typedef struct boot_args { uint16_t Revision; /* Revision of boot_args structure */ uint16_t Version; /* Version of boot_args structure */ - uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */ + uint8_t efiMode; /* 32 means 32-bit mode, 64 means 64-bit mode */ uint8_t debugMode; /* Bit field with behavior changes */ uint8_t __reserved1[2]; @@ -178,7 +178,7 @@ uint32_t efiRuntimeServicesPageCount; uint32_t efiSystemTable; /* physical address of system table in runtime area */ - uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */ + uint8_t efiMode; /* 32 means 32-bit mode, 64 means 64-bit mode */ uint8_t __reserved1[3]; uint32_t __reserved2[1]; uint32_t performanceDataStart; /* physical address of log */ Index: branches/Chimera/i386/libsaio/spd.c =================================================================== --- branches/Chimera/i386/libsaio/spd.c (revision 2657) +++ branches/Chimera/i386/libsaio/spd.c (revision 2658) @@ -30,14 +30,14 @@ "RAM", /* 00h Undefined */ "FPM", /* 01h FPM */ "EDO", /* 02h EDO */ - "", /* 03h PIPELINE NIBBLE */ + "", /* 03h PIPELINE NIBBLE */ "SDRAM", /* 04h SDRAM */ - "", /* 05h MULTIPLEXED ROM */ + "", /* 05h MULTIPLEXED ROM */ "DDR SGRAM", /* 06h SGRAM DDR */ "DDR SDRAM", /* 07h SDRAM DDR */ "DDR2 SDRAM", /* 08h SDRAM DDR 2 */ - "", /* 09h Undefined */ - "", /* 0Ah Undefined */ + "", /* 09h Undefined */ + "", /* 0Ah Undefined */ "DDR3 SDRAM" /* 0Bh SDRAM DDR 3 */ }; @@ -382,32 +382,84 @@ static struct smbus_controllers_t smbus_controllers[] = { - {0x8086, 0x1C22, "6 Series", read_smb_intel }, - {0x8086, 0x1D22, "C600/X79 Series", read_smb_intel }, - {0x8086, 0x1D70, "C600/X79 Series", read_smb_intel }, - {0x8086, 0x1D71, "C608/C606/X79 Series", read_smb_intel }, - {0x8086, 0x1D72, "C608", read_smb_intel }, - {0x8086, 0x1E22, "7 Series/C210 Series", read_smb_intel }, - {0x8086, 0x2330, "DH89xxCC", read_smb_intel }, - {0x8086, 0x2413, "82801AA", read_smb_intel }, - {0x8086, 0x2423, "82801BA/BAM", read_smb_intel }, - {0x8086, 0x2443, "82801BA/BAM", read_smb_intel }, - {0x8086, 0x2483, "82801CA/CAM", read_smb_intel }, - {0x8086, 0x24C3, "82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M)", read_smb_intel }, - {0x8086, 0x24D3, "82801EB/ER (ICH5/ICH5R)", read_smb_intel }, - {0x8086, 0x25A4, "6300ESB", read_smb_intel }, - {0x8086, 0x266A, "82801FB/FBM/FR/FW/FRW (ICH6 Family)", read_smb_intel }, - {0x8086, 0x269B, "631xESB/632xESB/3100", read_smb_intel }, - {0x8086, 0x27DA, "N10/ICH 7 Family", read_smb_intel }, - {0x8086, 0x283E, "82801H (ICH8 Family) ", read_smb_intel }, - {0x8086, 0x2930, "82801I (ICH9 Family)", read_smb_intel }, - {0x8086, 0x3A30, "82801JI (ICH10 Family)", read_smb_intel }, - {0x8086, 0x3A60, "82801JD/DO (ICH10 Family)", read_smb_intel }, - {0x8086, 0x3B30, "5 Series/3400 Series", read_smb_intel }, - {0x8086, 0x5032, "EP80579", read_smb_intel }, - {0x8086, 0x8C22, "8 Series/C220", read_smb_intel }, - {0x8086, 0x9C22, "Lynx Point-LP", read_smb_intel } - + {0x8086, 0x1C22, "6 Series/C200 Series", read_smb_intel }, + {0x8086, 0x1C41, "Mobile 6 Series", read_smb_intel }, + {0x8086, 0x1C42, "6 Series/C200 Series", read_smb_intel }, + {0x8086, 0x1C43, "Mobile 6 Series", read_smb_intel }, + {0x8086, 0x1C44, "6 Series", read_smb_intel }, + {0x8086, 0x1C46, "6 Series", read_smb_intel }, + {0x8086, 0x1C47, "6 Series", read_smb_intel }, + {0x8086, 0x1C49, "Mobile 6 Series", read_smb_intel }, + {0x8086, 0x1C4A, "6 Series", read_smb_intel }, + {0x8086, 0x1C4B, "Mobile 6 Series", read_smb_intel }, + {0x8086, 0x1C4C, "6 Series", read_smb_intel }, + {0x8086, 0x1C4D, "6 Series", read_smb_intel }, + {0x8086, 0x1C4E, "6 Series", read_smb_intel }, + {0x8086, 0x1C4F, "Mobile 6 Series", read_smb_intel }, + {0x8086, 0x1C50, "6 Series", read_smb_intel }, + {0x8086, 0x1C52, "6 Series/C202 Series", read_smb_intel }, + {0x8086, 0x1C54, "6 Series/C204 Series", read_smb_intel }, + {0x8086, 0x1C56, "6 Series/C206 Series", read_smb_intel }, + {0x8086, 0x1C5C, "6 Series", read_smb_intel }, + {0x8086, 0x1D22, "C600/X79 Series", read_smb_intel }, + {0x8086, 0x1D41, "C600/X79 Series", read_smb_intel }, + {0x8086, 0x1D70, "C600/X79 Series", read_smb_intel }, + {0x8086, 0x1D71, "C608/C606/X79 series", read_smb_intel }, + {0x8086, 0x1D72, "C608", read_smb_intel }, + {0x8086, 0x1E22, "7 Series/C210 Series", read_smb_intel }, + {0x8086, 0x1E42, "7 Series", read_smb_intel }, + {0x8086, 0x1E43, "7 Series", read_smb_intel }, + {0x8086, 0x1E44, "7 Series", read_smb_intel }, + {0x8086, 0x1E55, "Mobile 7 Series", read_smb_intel }, + {0x8086, 0x1E56, "7 Series", read_smb_intel }, + {0x8086, 0x1E57, "Mobile 7 Series", read_smb_intel }, + {0x8086, 0x1E58, "Mobile 7 Series", read_smb_intel }, + {0x8086, 0x1E59, "Mobile 7 Series", read_smb_intel }, + {0x8086, 0x1E5D, "Mobile 7 Series", read_smb_intel }, + {0x8086, 0x2330, "DH89xxCC", read_smb_intel }, + {0x8086, 0x2413, "82801AA", read_smb_intel }, + {0x8086, 0x2423, "82801AB", read_smb_intel }, + {0x8086, 0x2443, "82801BA/BAM", read_smb_intel }, + {0x8086, 0x2483, "82801CA/CAM", read_smb_intel }, + {0x8086, 0x24C3, "82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M)", read_smb_intel }, + {0x8086, 0x24D3, "82801EB/ER (ICH5/ICH5R)", read_smb_intel }, + {0x8086, 0x25A4, "6300ESB", read_smb_intel }, + {0x8086, 0x266A, "82801FB/FBM/FR/FW/FRW (ICH6 Family)", read_smb_intel }, + {0x8086, 0x2670, "631xESB/632xESB/3100", read_smb_intel }, + {0x8086, 0x269B, "631xESB/632xESB/3100", read_smb_intel }, + {0x8086, 0x27B9, "82801GBM (ICH7-M)", read_smb_intel }, + {0x8086, 0x27BD, "82801GHM (ICH7-M DH)", read_smb_intel }, + {0x8086, 0x27DA, "82801GB/GBM/GR/GH/GHM (ICH7 Family)", read_smb_intel }, + {0x8086, 0x2811, "82801HEM (ICH8M-E)", read_smb_intel }, + {0x8086, 0x2815, "82801HM (ICH8M)", read_smb_intel }, + {0x8086, 0x283E, "82801H (ICH8 Family) ", read_smb_intel }, + {0x8086, 0x2916, "82801IR (ICH9R)", read_smb_intel }, + {0x8086, 0x2930, "82801I (ICH9 Family)", read_smb_intel }, + {0x8086, 0x3A18, "82801JIB (ICH10)", read_smb_intel }, + {0x8086, 0x3A30, "82801JI (ICH10 Family)", read_smb_intel }, + {0x8086, 0x3A60, "82801JD/DO (ICH10 Family)", read_smb_intel }, + {0x8086, 0x3B00, "5 Series/3400 Series", read_smb_intel }, + {0x8086, 0x3B01, "Mobile 5 Series", read_smb_intel }, + {0x8086, 0x3B02, "5 Series", read_smb_intel }, + {0x8086, 0x3B09, "Mobile 5 Series", read_smb_intel }, + {0x8086, 0x3B30, "5 Series/3400 Series", read_smb_intel }, + {0x8086, 0x5032, "EP80579", read_smb_intel }, + {0x8086, 0x8119, "6 Series/C200 Series", read_smb_intel }, + {0x8086, 0x8119, "US15W", read_smb_intel }, + {0x8086, 0x8C22, "8 Series/C220 Series", read_smb_intel }, + {0x8086, 0x8C44, "8 Series", read_smb_intel }, + {0x8086, 0x8C4B, "Mobile 8 Series", read_smb_intel }, + {0x8086, 0x8CA2, "9 Series", read_smb_intel }, + {0x8086, 0x8D22, "X99/C610 Series", read_smb_intel }, + {0x8086, 0x9C22, "8 Series", read_smb_intel }, + {0x8086, 0x9C43, "8 Series", read_smb_intel }, + {0x8086, 0x9CC1, "9 Series", read_smb_intel }, + {0x8086, 0x9CC2, "9 Series", read_smb_intel }, + {0x8086, 0x9CC3, "9 Series", read_smb_intel }, + {0x8086, 0x9CC5, "9 Series", read_smb_intel }, + {0x8086, 0x9CC6, "9 Series", read_smb_intel }, + {0x8086, 0x9CC7, "9 Series", read_smb_intel }, + {0x8086, 0x9CC9, "9 Series", read_smb_intel } }; // initial call : pci_dt = root_pci_dev; Index: branches/Chimera/i386/libsaio/gma.c =================================================================== --- branches/Chimera/i386/libsaio/gma.c (revision 2657) +++ branches/Chimera/i386/libsaio/gma.c (revision 2658) @@ -333,7 +333,33 @@ {GMA_HASWELL_CRW_E_GT1, HD_GRAPHICS }, /* ??? */ {GMA_HASWELL_CRW_E_GT2, HD_GRAPHICS }, /* ??? */ {GMA_HASWELL_CRW_E_GT3, IRIS_5200 }, - {GMA_HASWELL_CRW_M_GT2_PLUS_IG, HD_GRAPHICS } + {GMA_HASWELL_CRW_M_GT2_PLUS_IG, HD_GRAPHICS }, + + /* Brodwell */ + {GMA_BRODWELL_BDW_M_GT1, HD_GRAPHICS }, /* 1602 */ + {GMA_BRODWELL_BDW_M_GT2, HD_GRAPHICS_5600}, /* 1612 */ + {GMA_BRODWELL_BDW_M_GT3e, IRIS_Pro_6200}, /* 1622 */ + {GMA_BRODWELL_BDW_M_1632, HD_GRAPHICS }, /* 1632 */ + {GMA_BRODWELL_ULT_M_GT1, HD_GRAPHICS }, /* 1606 */ + {GMA_BRODWELL_ULT_M_GT2, HD_GRAPHICS_5500}, /* 1616 */ + {GMA_BRODWELL_ULT_M_GT3, HD_GRAPHICS_6000}, /* 1626 */ + {GMA_BRODWELL_ULT_M_1636, HD_GRAPHICS }, /* 1636 */ + {GMA_BRODWELL_BDW_S_GT1, HD_GRAPHICS }, /* 160a */ + {GMA_BRODWELL_BDW_S_GT2, HD_GRAPHICS }, /* 161a */ + {GMA_BRODWELL_BDW_S_GT3e, IRIS_Pro_P6300}, /* 162a */ + {GMA_BRODWELL_BDW_S_163A, HD_GRAPHICS }, /* 163a */ + {GMA_BRODWELL_LVT_M_GT1, HD_GRAPHICS }, /* 160b */ + {GMA_BRODWELL_LVT_M_GT2, HD_GRAPHICS }, /* 161b */ + {GMA_BRODWELL_LVT_M_GT3, IRIS_6100 }, /* 162b */ + {GMA_BRODWELL_LVT_M_163B, HD_GRAPHICS }, /* 163b */ + {GMA_BRODWELL_BDW_D_GT1, HD_GRAPHICS }, /* 160d */ + {GMA_BRODWELL_BDW_D_GT2, HD_GRAPHICS }, /* 161d */ + {GMA_BRODWELL_BDW_D_GT3, HD_GRAPHICS }, /* 162d */ + {GMA_BRODWELL_BDW_D_163D, HD_GRAPHICS }, /* 163d */ + {GMA_BRODWELL_ULX_M_GT1, HD_GRAPHICS }, /* 160e */ + {GMA_BRODWELL_ULX_M_GT2, HD_GRAPHICS_5300}, /* 161e */ + {GMA_BRODWELL_ULX_M_GT3, HD_GRAPHICS }, /* 162e */ + {GMA_BRODWELL_ULX_M_163E, HD_GRAPHICS } /* 163e */ }; #define GFX_DEVICES_LEN (sizeof(intel_gfx_chipsets) / sizeof(intel_gfx_chipsets[0])) @@ -384,6 +410,7 @@ uint8_t ig_id_4k_mobile[4] = { 0x03, 0x00, 0x66, 0x01 }; // MacMan uint8_t ig_id_4600[4] = { 0x03, 0x00, 0x22, 0x0D }; // MacMan uint8_t ig_id_4600_mobile[4] = { 0x06, 0x00, 0x26, 0x0A }; // MacMan + uint8_t ig_id_5500_mobile[4] = { 0x00, 0x00, 0x16, 0x16 }; // MacMan uint8_t ig_platform_id[4] = { 0x00, 0x00, 0x00, 0x00 }; // MacMan devicepath = get_pci_dev_path(gma_dev); @@ -482,14 +509,14 @@ devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20); if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Setting %s for snb-platform-id\n", value); + verbose("Setting 0x%s for snb-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k, 4); - verbose("Using default snb-platform-id of 00030010\n"); + verbose("Using default snb-platform-id of 0x00030010\n"); } break; @@ -515,14 +542,14 @@ devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20); if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Setting %s for snb-platform-id\n", value); + verbose("Setting 0x%s for snb-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k_mobile, 4); - verbose("Using default snb-platform-id of 00030010\n"); + verbose("Using default snb-platform-id of 0x00030010\n"); } break; @@ -535,25 +562,25 @@ devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20); if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Using %s for unsupported device id injection.\n", value); + verbose("Using 0x%s for unsupported device id injection.\n", value); hex2devprop(value, igp_device_id, 2); devprop_add_value(device, "device-id",igp_device_id, 4); } else { devprop_add_value(device, "device-id", hd3k_kmobile_device_id, 4); // MacMan Inject Mobile ID Instead of Patching Kext - verbose("Using default unsupported device id injection of 0126\n"); + verbose("Using default unsupported device id injection of 0x0126\n"); } if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Using %s for snb-platform-id\n", value); + verbose("Using 0x%s for snb-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k, 4); - verbose("Using default snb-platform-id of 00030010\n"); + verbose("Using default snb-platform-id of 0x00030010\n"); } break; @@ -580,14 +607,14 @@ devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20); if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Setting %s for snb-platform-id\n", value); + verbose("Setting 0x%s for snb-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,snb-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,snb-platform-id", snb_id_3k_mobile, 4); - verbose("Using default snb-platform-id of 00010000\n"); + verbose("Using default snb-platform-id of 0x00010000\n"); } break; @@ -603,14 +630,14 @@ devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Using %s for ig-platform-id\n", value); + verbose("Using 0x%s for ig-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4k, 4); - verbose("Using default ig-platform-id of 0166000a\n"); + verbose("Using default ig-platform-id of 0x0166000a\n"); } break; @@ -626,14 +653,14 @@ devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Using %s for ig-platform-id\n", value); + verbose("Using 0x%s for ig-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4k_mobile, 4); - verbose("Using default ig-platform-id of 01660003\n"); + verbose("Using default ig-platform-id of 0x01660003\n"); } break; @@ -662,14 +689,14 @@ } if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) { - verbose("Using %s for ig-platform-id\n", value); + verbose("Using 0x%s for ig-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4k, 4); - verbose("Using default ig-platform-id of 0166000a\n"); + verbose("Using default ig-platform-id of 0x0166000a\n"); } break; @@ -685,14 +712,14 @@ devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) { - verbose("Using %s for ig-platform-id\n", value); + verbose("Using 0x%s for ig-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600, 4); - verbose("Using default ig-platform-id of 0d220003\n"); + verbose("Using default ig-platform-id of 0x0d220003\n"); } break; @@ -714,14 +741,14 @@ devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) { - verbose("Using %s for ig-platform-id\n", value); + verbose("Using 0x%s for ig-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600_mobile, 4); - verbose("Using default ig-platform-id of 0a260006\n"); + verbose("Using default ig-platform-id of 0x0a260006\n"); } break; @@ -771,25 +798,25 @@ devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Using %s for unsupported device id injection.\n", value); + verbose("Using 0x%s for unsupported device id injection.\n", value); hex2devprop(value, igp_device_id, 2); devprop_add_value(device, "device-id",igp_device_id, 4); } else { devprop_add_value(device, "device-id", hd4600_device_id, 4); // MacMan Inject Supported ID Instead of Patching Kext - verbose("Using default unsupported device id injection of 0412\n"); + verbose("Using default unsupported device id injection of 0x0412\n"); } if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) { - verbose("Using %s for ig-platform-id\n", value); + verbose("Using 0x%s for ig-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600, 4); - verbose("Using default ig-platform-id of 0d220003\n"); + verbose("Using default ig-platform-id of 0x0d220003\n"); } break; @@ -799,7 +826,7 @@ devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Using %s for unsupported device id injection.\n", value); + verbose("Using 0x%s for unsupported device id injection.\n", value); hex2devprop(value, igp_device_id, 2); devprop_add_value(device, "device-id",igp_device_id, 4); } @@ -810,14 +837,14 @@ } if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) { - verbose("Using %s for ig-platform-id\n", value); + verbose("Using 0x%s for ig-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600, 4); - verbose("Using default ig-platform-id of 0d220003\n"); + verbose("Using default ig-platform-id of 0x0d220003\n"); } break; @@ -834,27 +861,63 @@ devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); if (getValueForKey(kIGPDeviceID, &value, &len, &bootInfo->chameleonConfig)) // MacMan { - verbose("Using %s for unsupported device id injection.\n", value); + verbose("Using 0x%s for unsupported device id injection.\n", value); hex2devprop(value, igp_device_id, 2); devprop_add_value(device, "device-id",igp_device_id, 4); } else { devprop_add_value(device, "device-id", hd4600_mobile_device_id, 4); // MacMan Inject Supported ID Instead of Patching Kext - verbose("Using default unsupported device id injection of 0416\n"); + verbose("Using default unsupported device id injection of 0x0416\n"); } if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) { - verbose("Using %s for ig-platform-id\n", value); + verbose("Using 0x%s for ig-platform-id\n", value); hex2devprop(value, ig_platform_id, 4); devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); } else { devprop_add_value(device, "AAPL,ig-platform-id", ig_id_4600_mobile, 4); - verbose("Using default ig-platform-id of 0a260006\n"); + verbose("Using default ig-platform-id of 0x0a260006\n"); } break; + + // + // Supported Broadwell Desktop Device IDs + // + + // + // Currently none available as of 2015-04-08 + // + + // + // Supported Broadwell Mobile Device IDs + // + case GMA_BRODWELL_ULT_M_GT1: // HD Graphics ??? found in kext + case GMA_BRODWELL_ULX_M_GT1: // HD Graphics ??? found in kext + case GMA_BRODWELL_BDW_M_GT2: // HD Graphics 5600 and found in kext + case GMA_BRODWELL_ULT_M_GT2: // HD Graphics 5500 and found in kext + case GMA_BRODWELL_ULX_M_GT2: // HD Graphics 5300 and found in kext + case GMA_BRODWELL_ULT_M_GT3: // HD Graphics 6000 and found in kext + case GMA_BRODWELL_BDW_M_GT3e: // Iris Pro 6200 and found in kext + case GMA_BRODWELL_LVT_M_GT3: // Iris 6100 and found in kext + devprop_add_value(device, "built-in", &BuiltIn, 1); + devprop_add_value(device, "class-code", ClassFix, 4); + devprop_add_value(device, "device-id", (uint8_t*)&device_id, sizeof(device_id)); + devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); + if (getValueForKey(kIGPlatformID, &value, &len, &bootInfo->chameleonConfig)) + { + verbose("Using 0x%s for ig-platform-id\n", value); + hex2devprop(value, ig_platform_id, 4); + devprop_add_value(device, "AAPL,ig-platform-id", ig_platform_id, 4); + } + else + { + devprop_add_value(device, "AAPL,ig-platform-id", ig_id_5500_mobile, 4); + verbose("Using default ig-platform-id of 0x16160000\n"); + } + break; default: break; Index: branches/Chimera/i386/libsaio/gma.h =================================================================== --- branches/Chimera/i386/libsaio/gma.h (revision 2657) +++ branches/Chimera/i386/libsaio/gma.h (revision 2658) @@ -66,6 +66,13 @@ #define HD_GRAPHICS_5000 "HD Graphics 5000" #define IRIS_5100 "Iris(TM) Graphics 5100" #define IRIS_5200 "Iris(TM) Pro Graphics 5200" +#define HD_GRAPHICS_5300 "HD Graphics 5300" +#define HD_GRAPHICS_5500 "HD Graphics 5500" +#define HD_GRAPHICS_5600 "HD Graphics 5600" +#define HD_GRAPHICS_6000 "HD Graphics 6000" +#define IRIS_6100 "Iris(TM) Graphics 6100" +#define IRIS_Pro_6200 "Iris(TM) Pro Graphics 6200" +#define IRIS_Pro_P6300 "Iris(TM) Pro P6300" #define INTEL_VENDORID 0x8086 /* http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/tree/src/intel_driver.h */ @@ -167,40 +174,42 @@ //#define GMA_VALLEYVIEW_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0F30) /* ============ Haswell =============== */ -// 0090 // AppleIntelHD5000Graphics.kext -// 0091 // AppleIntelHD5000Graphics.kext -// 0092 // AppleIntelHD5000Graphics.kext -//#define GMA_HASWELL_HB GFX_MODEL_CONSTRUCT(INTEL, 0x0400) /* Desktop */ #define GMA_HASWELL_D_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0402) // HD Graphics #define GMA_HASWELL_D_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0412) // HD Graphics 4600 and found in kext #define GMA_HASWELL_D_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0422) // HD Graphics 5000 -//#define GMA_HASWELL_M_HB GFX_MODEL_CONSTRUCT(INTEL, 0x0404) /* Mobile */ + #define GMA_HASWELL_M_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0406) // HD Graphics Mobile and found in kext #define GMA_HASWELL_M_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0416) // HD Graphics 4600 Mobile and found in kext #define GMA_HASWELL_M_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0426) // HD Graphics 5000 Mobile and found in kext + #define GMA_HASWELL_S_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x040A) // HD Graphics -//#define GMA_HASWELL_S_HB GFX_MODEL_CONSTRUCT(INTEL, 0x0408) /* Server */ #define GMA_HASWELL_S_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x041A) // HD Graphics #define GMA_HASWELL_S_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x042A) + #define GMA_HASWELL_B_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x040B) #define GMA_HASWELL_B_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x041B) // HD Graphics #define GMA_HASWELL_B_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x042B) + #define GMA_HASWELL_E_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x040E) #define GMA_HASWELL_E_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x041E) // HD Graphics 4400 #define GMA_HASWELL_E_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x042E) #define GMA_HASWELL_ULT_D_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0A02) #define GMA_HASWELL_ULT_D_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0A12) -#define GMA_HASWELL_ULT_D_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0A22) // HD Graphics 5000 Iris +#define GMA_HASWELL_ULT_D_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0A22) // HD Graphics 5000 Iris + #define GMA_HASWELL_ULT_M_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0A06) // HD Graphics #define GMA_HASWELL_ULT_M_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0A16) // HD Graphics 4400 Mobile and found in kext #define GMA_HASWELL_ULT_M_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0A26) // HD Graphics 5000 Iris Mobile and found in kext + #define GMA_HASWELL_ULT_S_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0A0A) #define GMA_HASWELL_ULT_S_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0A1A) #define GMA_HASWELL_ULT_S_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0A2A) + #define GMA_HASWELL_ULT_B_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0A0B) #define GMA_HASWELL_ULT_B_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0A1B) #define GMA_HASWELL_ULT_B_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0A2B) + #define GMA_HASWELL_ULT_E_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0A0E) // HD Graphics #define GMA_HASWELL_ULT_E_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0A1E) // HD Graphics 4200 Mobile and found in kext #define GMA_HASWELL_ULT_E_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0A2E) // HD Graphics 5100 Iris Mobile and found in kext @@ -219,22 +228,57 @@ #define GMA_HASWELL_CRW_D_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0D02) #define GMA_HASWELL_CRW_D_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0D12) // HD Graphics #define GMA_HASWELL_CRW_D_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0D22) // HD Graphics 5200 Iris Pro and found in kext -//#define GMA_HASWELL_CRW_D_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D32) +#define GMA_HASWELL_CRW_D_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D32) + #define GMA_HASWELL_CRW_M_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0D06) #define GMA_HASWELL_CRW_M_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0D16) // HD Graphics 4600 Mobile #define GMA_HASWELL_CRW_M_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0D26) // HD Graphics 5200 Iris Pro Mobile and found in kext +#define GMA_HASWELL_CRW_M_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D36) + #define GMA_HASWELL_CRW_S_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0D0A) #define GMA_HASWELL_CRW_S_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0D1A) #define GMA_HASWELL_CRW_S_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0D2A) // HD Graphics Iris Pro +#define GMA_HASWELL_CRW_S_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D3A) + #define GMA_HASWELL_CRW_B_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0D0B) #define GMA_HASWELL_CRW_B_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0D1B) #define GMA_HASWELL_CRW_B_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0D2B) + #define GMA_HASWELL_CRW_E_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x0D0E) #define GMA_HASWELL_CRW_E_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x0D1E) #define GMA_HASWELL_CRW_E_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x0D2E) -#define GMA_HASWELL_CRW_M_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D36) -//#define GMA_HASWELL_CRW_S_GT2_PLUS_IG GFX_MODEL_CONSTRUCT(INTEL, 0x0D3A) +/* Brodwell */ +#define GMA_BRODWELL_BDW_M_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x1602) +#define GMA_BRODWELL_BDW_M_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x1612) // HD Graphics 5600 and found in kext +#define GMA_BRODWELL_BDW_M_GT3e GFX_MODEL_CONSTRUCT(INTEL, 0x1622) // Iris Pro 6200 and found in kext +#define GMA_BRODWELL_BDW_M_1632 GFX_MODEL_CONSTRUCT(INTEL, 0x1632) + +#define GMA_BRODWELL_ULT_M_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x1606) // HD Graphics and found in kext +#define GMA_BRODWELL_ULT_M_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x1616) // HD Graphics 5500 and found in kext +#define GMA_BRODWELL_ULT_M_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x1626) // HD Graphics 6000 and found in kext +#define GMA_BRODWELL_ULT_M_1636 GFX_MODEL_CONSTRUCT(INTEL, 0x1636) + +#define GMA_BRODWELL_BDW_S_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x160A) +#define GMA_BRODWELL_BDW_S_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x161A) +#define GMA_BRODWELL_BDW_S_GT3e GFX_MODEL_CONSTRUCT(INTEL, 0x162A) // Iris Pro P6300 +#define GMA_BRODWELL_BDW_S_163A GFX_MODEL_CONSTRUCT(INTEL, 0x163A) + +#define GMA_BRODWELL_LVT_M_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x160B) +#define GMA_BRODWELL_LVT_M_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x161B) +#define GMA_BRODWELL_LVT_M_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x162B) // Iris 6100 and found in kext +#define GMA_BRODWELL_LVT_M_163B GFX_MODEL_CONSTRUCT(INTEL, 0x163B) + +#define GMA_BRODWELL_BDW_D_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x160D) +#define GMA_BRODWELL_BDW_D_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x161D) +#define GMA_BRODWELL_BDW_D_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x162D) +#define GMA_BRODWELL_BDW_D_163D GFX_MODEL_CONSTRUCT(INTEL, 0x163D) + +#define GMA_BRODWELL_ULX_M_GT1 GFX_MODEL_CONSTRUCT(INTEL, 0x160E) // HD Graphics and found in kext +#define GMA_BRODWELL_ULX_M_GT2 GFX_MODEL_CONSTRUCT(INTEL, 0x161E) // HD Graphics 5300 and found in kext +#define GMA_BRODWELL_ULX_M_GT3 GFX_MODEL_CONSTRUCT(INTEL, 0x162E) +#define GMA_BRODWELL_ULX_M_163E GFX_MODEL_CONSTRUCT(INTEL, 0x163E) + /* END */ #endif /* !__LIBSAIO_GMA_H */ \ No newline at end of file Index: branches/Chimera/i386/libsaio/aml_generator.c =================================================================== --- branches/Chimera/i386/libsaio/aml_generator.c (revision 2657) +++ branches/Chimera/i386/libsaio/aml_generator.c (revision 2658) @@ -67,7 +67,8 @@ { AML_CHUNK* next = child->Next; - if (child->Buffer) { + if (child->Buffer) + { free(child->Buffer); } free(child); @@ -76,7 +77,8 @@ } // Free node - if (node->Buffer) { + if (node->Buffer) + { free(node->Buffer); } @@ -87,7 +89,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_NONE; node->Length = (uint16_t)size; node->Buffer = malloc(node->Length); @@ -101,7 +104,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_BYTE; node->Length = 1; node->Buffer = malloc(node->Length); @@ -114,7 +118,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_WORD; node->Length = 2; node->Buffer = malloc(node->Length); @@ -128,7 +133,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_DWORD; node->Length = 4; node->Buffer = malloc(node->Length); @@ -144,7 +150,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_QWORD; node->Length = 8; node->Buffer = malloc(node->Length); @@ -162,7 +169,8 @@ uint32_t aml_fill_simple_name(char* buffer, char* name) { - if (strlen(name) < 4) { + if (strlen(name) < 4) + { verbose("aml_fill_simple_name: simple name %s has incorrect lengh! Must be 4.\n", name); return 0; } @@ -175,7 +183,8 @@ int len, offset, count; uint32_t root = 0; - if (!node) { + if (!node) + { return 0; } @@ -183,16 +192,19 @@ offset = 0; count = len >> 2; - if ((len % 4) > 1 || count == 0) { + if ((len % 4) > 1 || count == 0) + { verbose("aml_fill_name: pathname %s has incorrect length! Must be 4, 8, 12, 16, etc...\n", name); return 0; } - if (((len % 4) == 1) && (name[0] == '\\')) { + if (((len % 4) == 1) && (name[0] == '\\')) + { root++; } - if (count == 1) { + if (count == 1) + { node->Length = (uint16_t)(4 + root); node->Buffer = malloc(node->Length+4); memcpy(node->Buffer, name, 4 + root); @@ -200,7 +212,8 @@ return (uint32_t)offset; } - if (count == 2) { + if (count == 2) + { node->Length = 2 + 8; node->Buffer = malloc(node->Length+4); node->Buffer[offset++] = 0x5c; // Root Char @@ -224,7 +237,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_SCOPE; aml_fill_name(node, name); @@ -236,7 +250,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_NAME; aml_fill_name(node, name); @@ -248,7 +263,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { unsigned int offset = aml_fill_name(node, name); node->Type = AML_CHUNK_METHOD; @@ -263,7 +279,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_PACKAGE; node->Length = 1; @@ -276,7 +293,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_ALIAS; node->Length = 8; @@ -292,7 +310,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_RETURN; aml_fill_name(node, name); } @@ -304,7 +323,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_RETURN; aml_add_byte(node, value); } @@ -316,7 +336,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_DEVICE; aml_fill_name(node, name); } @@ -328,7 +349,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_LOCAL0; node->Length = 1; } @@ -340,7 +362,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_STORE_OP; node->Length = 1; } @@ -352,7 +375,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { int offset = 0; node->Type = AML_CHUNK_BUFFER; node->Length = (uint8_t)(size + 2); @@ -369,16 +393,17 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { unsigned int offset = 0; unsigned int len = strlen(StringBuf); node->Type = AML_CHUNK_BUFFER; node->Length = (uint8_t)(len + 3); node->Buffer = malloc (node->Length); node->Buffer[offset++] = AML_CHUNK_BYTE; - node->Buffer[offset++] = (char)len; + node->Buffer[offset++] = (char)(len+1); memcpy(node->Buffer+offset, StringBuf, len); - node->Buffer[offset+len] = '\0'; +// node->Buffer[offset+len] = '\0'; } return node; @@ -388,13 +413,14 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { int len = strlen(StringBuf); node->Type = AML_CHUNK_STRING; node->Length = (uint8_t)(len + 1); - node->Buffer = malloc (len); + node->Buffer = malloc (len+1); memcpy(node->Buffer, StringBuf, len); - node->Buffer[len] = '\0'; +// node->Buffer[len] = '\0'; } return node; @@ -404,7 +430,8 @@ { AML_CHUNK* node = aml_create_node(parent); - if (node) { + if (node) + { node->Type = AML_CHUNK_RETURN; //aml_add_byte(node, value); } @@ -426,13 +453,15 @@ uint32_t aml_calculate_size(AML_CHUNK* node) { - if (node) { + if (node) + { // Calculate child nodes size AML_CHUNK* child = node->First; uint8_t child_count = 0; node->Size = 0; - while (child) { + while (child) + { child_count++; node->Size += (uint16_t)aml_calculate_size(child); @@ -440,7 +469,8 @@ child = child->Next; } - switch (node->Type) { + switch (node->Type) + { case AML_CHUNK_NONE: case AML_STORE_OP: case AML_CHUNK_LOCAL0: @@ -466,7 +496,8 @@ break; case AML_CHUNK_BYTE: - if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1) { + if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1) + { node->Size += node->Length; } else { node->Size += 1 + node->Length; @@ -529,7 +560,8 @@ uint32_t aml_write_buffer(const char* value, uint32_t size, char* buffer, uint32_t offset) { - if (size > 0) { + if (size > 0) + { memcpy(buffer + offset, value, size); } @@ -538,7 +570,8 @@ uint32_t aml_write_size(uint32_t size, char* buffer, uint32_t offset) { - if (size <= 0x3f) { /* simple 1 byte length in 6 bits */ + if (size <= 0x3f) /* simple 1 byte length in 6 bits */ + { buffer[offset++] = (char)size; } else if (size <= 0xfff) { buffer[offset++] = 0x40 | (size & 0xf); /* 0x40 is type, 0x0X is first nibble of length */ @@ -559,11 +592,13 @@ uint32_t aml_write_node(AML_CHUNK* node, char* buffer, uint32_t offset) { - if (node && buffer) { + if (node && buffer) + { uint32_t old = offset; AML_CHUNK* child = node->First; - switch (node->Type) { + switch (node->Type) + { case AML_CHUNK_NONE: offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); break; Index: branches/Chimera/i386/libsaio/device_inject.c =================================================================== --- branches/Chimera/i386/libsaio/device_inject.c (revision 2657) +++ branches/Chimera/i386/libsaio/device_inject.c (revision 2658) @@ -20,7 +20,7 @@ #if DEBUG_INJECT #define DBG(x...) printf(x) #else -#define DBG(x...) +#define DBG(x...) msglog(x) #endif uint32_t devices_number = 1; @@ -251,9 +251,11 @@ return 1; } +// devprop_generate_string optimized by cparm char *devprop_generate_string(DevPropString *string) { - char *buffer = (char*)malloc(string->length * 2); + int len = string->length * 2; + char *buffer = (char*)malloc(len); char *ptr = buffer; if(!buffer) @@ -261,44 +263,68 @@ return NULL; } - sprintf(buffer, "%08x%08x%04x%04x", dp_swap32(string->length), string->WHAT2, + snprintf(buffer, len, "%08x%08x%04x%04x", dp_swap32(string->length), string->WHAT2, dp_swap16(string->numentries), string->WHAT3); buffer += 24; + len -= 24; int i = 0, x = 0; while(i < string->numentries) { - sprintf(buffer, "%08x%04x%04x", dp_swap32(string->entries[i]->length), + if (!(i < DEV_PROP_DEVICE_MAX_ENTRIES)) { + break; + } + + if(!len) { + break; + } + + snprintf(buffer, len, "%08x%04x%04x", dp_swap32(string->entries[i]->length), dp_swap16(string->entries[i]->numentries), string->entries[i]->WHAT2); buffer += 16; - sprintf(buffer, "%02x%02x%04x%08x%08x", string->entries[i]->acpi_dev_path.type, + len -= 16; + snprintf(buffer, len, "%02x%02x%04x%08x%08x", string->entries[i]->acpi_dev_path.type, string->entries[i]->acpi_dev_path.subtype, dp_swap16(string->entries[i]->acpi_dev_path.length), string->entries[i]->acpi_dev_path._HID, dp_swap32(string->entries[i]->acpi_dev_path._UID)); buffer += 24; + len -= 24; for(x = 0;x < string->entries[i]->num_pci_devpaths; x++) { - sprintf(buffer, "%02x%02x%04x%02x%02x", string->entries[i]->pci_dev_path[x].type, + if(!len) { + break; + } + snprintf(buffer, len, "%02x%02x%04x%02x%02x", string->entries[i]->pci_dev_path[x].type, string->entries[i]->pci_dev_path[x].subtype, dp_swap16(string->entries[i]->pci_dev_path[x].length), string->entries[i]->pci_dev_path[x].function, string->entries[i]->pci_dev_path[x].device); buffer += 12; + len -= 12; } - - sprintf(buffer, "%02x%02x%04x", string->entries[i]->path_end.type, + + if(!len) { + break; + } + + snprintf(buffer, len, "%02x%02x%04x", string->entries[i]->path_end.type, string->entries[i]->path_end.subtype, dp_swap16(string->entries[i]->path_end.length)); buffer += 8; + len -= 8; uint8_t *dataptr = string->entries[i]->data; for(x = 0; (uint32_t)x < (string->entries[i]->length) - (24 + (6 * string->entries[i]->num_pci_devpaths)) ; x++) { - sprintf(buffer, "%02x", *dataptr++); - buffer += 2; + if(!len) { + break; + } + snprintf(buffer, len, "%02x", *dataptr++); + buffer += 2; + len -= 2; } i++; } Index: branches/Chimera/i386/libsaio/hda.c =================================================================== --- branches/Chimera/i386/libsaio/hda.c (revision 2657) +++ branches/Chimera/i386/libsaio/hda.c (revision 2658) @@ -109,8 +109,8 @@ { HDA_INTEL_PCH2, "5 Series/3400 Series" }, { HDA_INTEL_SCH, "System Controller Hub (SCH Poulsbo)" }, { HDA_INTEL_SCH2, "9 Series" }, - { HDA_INTEL_LPT1, "Lynx Point" }, - { HDA_INTEL_LPT2, "Lynx Point" }, + { HDA_INTEL_LPT1, "Wellsburg" }, + { HDA_INTEL_LPT2, "Wellsburg" }, { HDA_INTEL_LYNX, "Lynx Point-LP" }, { HDA_INTEL_LYNX2, "Lynx Point-LP" }, //10de NVIDIA Corporation Index: branches/Chimera/i386/libsaio/dram_controllers.c =================================================================== --- branches/Chimera/i386/libsaio/dram_controllers.c (revision 2657) +++ branches/Chimera/i386/libsaio/dram_controllers.c (revision 2658) @@ -525,7 +525,7 @@ { 0x8086, 0x29C0, "82G33/G31/P35/P31", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x29D0, "82Q33 Express", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x29E0, "82X38/X48 Express", setup_p35, get_fsb_i965, get_timings_p35 }, -// { 0x8086, 0x29F0, "3200/3210 Chipset", NULL, NULL, NULL }, + { 0x8086, 0x29F0, "3200/3210", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x2E00, "Eaglelake", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x2E10, "Q45/Q43", setup_p35, get_fsb_i965, get_timings_p35 }, Index: branches/Chimera/i386/libsaio/nvidia.c =================================================================== --- branches/Chimera/i386/libsaio/nvidia.c (revision 2657) +++ branches/Chimera/i386/libsaio/nvidia.c (revision 2658) @@ -1012,7 +1012,9 @@ { 0x10DE0FC1, "NVIDIA GeForce GT 640" }, { 0x10DE0FC2, "NVIDIA GeForce GT 630" }, { 0x10DE0FC6, "NVIDIA GeForce GTX 650" }, + { 0x10DE0FC8, "NVIDIA GeForce GT 740" }, { 0x10DE0FCD, "NVIDIA GeForce GT 755M" }, + { 0x10DE0FCE, "NVIDIA GeForce GT 640M LE" }, // 0FD0 - 0FDF { 0x10DE0FD1, "NVIDIA GeForce GT 650M" }, { 0x10DE0FD2, "NVIDIA GeForce GT 640M" }, @@ -1021,15 +1023,29 @@ { 0x10DE0FD5, "NVIDIA GeForce GT 650M" }, { 0x10DE0FD8, "NVIDIA GeForce GT 640M" }, { 0x10DE0FD9, "NVIDIA GeForce GT 645M" }, + { 0x10DE0FDA, "GK107-ES-A1" }, { 0x10DE0FDB, "GK107-ESP-A1" }, + { 0x10DE0FDC, "GK107-INT22-A1" }, { 0x10DE0FDF, "NVIDIA GeForce GT 740M" }, // 0FE0 - 0FEF { 0x10DE0FE0, "NVIDIA GeForce GTX 660M" }, { 0x10DE0FE1, "NVIDIA GeForce GT 730M" }, { 0x10DE0FE3, "NVIDIA GeForce GT 745M" }, { 0x10DE0FE4, "NVIDIA GeForce GT 750M" }, + { 0x10DE0FE5, "NVIDIA GeForce K340 USM" }, + { 0x10DE0FE6, "NVS K1 USM" }, + { 0x10DE0FE7, "Generic K1 USM / GRID K100" }, + { 0x10DE0FE9, "NVIDIA GeForce GT 750M" }, + { 0x10DE0FEA, "NVIDIA GeForce GT 755M" }, + { 0x10DE0FEF, "GRID K340" }, // 0FF0 - 0FFF + { 0x10DE0FF0, "NB1Q" }, + { 0x10DE0FF1, "NVS 1000" }, { 0x10DE0FF2, "VGX K1" }, + { 0x10DE0FF3, "NVIDIA Quadro K420" }, + { 0x10DE0FF5, "Tesla K1 USM" }, + { 0x10DE0FF6, "NVIDIA Quadro K1100M" }, + { 0x10DE0FF7, "NVIDIA Quadro K1 USM" }, // K1 USM / GRID K120Q / GRID K140Q { 0x10DE0FF8, "NVIDIA Quadro K500M" }, { 0x10DE0FF9, "NVIDIA Quadro K2000D" }, { 0x10DE0FFA, "NVIDIA Quadro K600" }, @@ -1039,11 +1055,18 @@ { 0x10DE0FFE, "NVIDIA Quadro K2000" }, { 0x10DE0FFF, "NVIDIA Quadro 410" }, // 1000 - 100F + { 0x10DE1001, "NVIDIA GeForce GTX TITAN Z" }, { 0x10DE1003, "NVIDIA GeForce GTX Titan LE" }, { 0x10DE1004, "NVIDIA GeForce GTX 780" }, { 0x10DE1005, "NVIDIA GeForce GTX Titan" }, + { 0x10DE1006, "NVIDIA GeForce GTX 780 Ti" }, + { 0x10DE1007, "NVIDIA GeForce GTX 780" }, + { 0x10DE1008, "NVIDIA GeForce GTX 780 Ti" }, { 0x10DE100A, "NVIDIA GeForce GTX 780 Ti" }, + // { 0x10DE100B, "Graphics Device" }, // GK110 + { 0x10DE100C, "GeForce GTX Titan Black" }, // 1010 - 101F + { 0x10DE101E, "Tesla K20X" }, // GK110GL { 0x10DE101F, "NVIDIA Tesla K20" }, // 1020 - 102F { 0x10DE1020, "NVIDIA Tesla K20X" }, @@ -1051,7 +1074,15 @@ { 0x10DE1022, "NVIDIA Tesla K20c" }, { 0x10DE1026, "NVIDIA Tesla K20s" }, { 0x10DE1028, "NVIDIA Tesla K20m" }, + { 0x10DE102A, "NVIDIA Tesla K40t" }, // GK110BGL + // { 0x10DE102B, "Graphics Device" }, // GK110BGL + // { 0x10DE102C, "Graphics Device" }, // GK110BGL + { 0x10DE102D, "NVIDIA Tesla K80" }, // GK110BGL (2x) + { 0x10DE102E, "NVIDIA Tesla K40d" }, // GK110BGL + { 0x10DE102F, "TNVIDIA Tesla Stella Solo" }, // GK110BGL // 1030 - 103F + // { 0x10DE1030, "" }, // GK110 + { 0x10DE103F, "NVIDIA Tesla Stella SXM" }, // GK110 // 1040 - 104F { 0x10DE1040, "NVIDIA GeForce GT 520" }, // { 0x10DE1041, "D13M1-45" }, @@ -1060,6 +1091,8 @@ { 0x10DE1049, "NVIDIA GeForce GT 620" }, { 0x10DE104A, "NVIDIA GeForce GT 610" }, { 0x10DE104B, "NVIDIA GeForce GT 625 (OEM)" }, + { 0x10DE104C, "NVIDIA GeForce GT 705" }, // GF119 + { 0x10DE104D, "NVIDIA GeForce GT 710" }, // GF119 // 1050 - 105F { 0x10DE1050, "NVIDIA GeForce GT 520M" }, { 0x10DE1051, "NVIDIA GeForce GT 520MX" }, @@ -1117,14 +1150,14 @@ { 0x10DE1140, "NVIDIA GeForce GT 610M" }, { 0x10DE1141, "NVIDIA GeForce 610M" }, { 0x10DE1142, "NVIDIA GeForce 620M" }, - // { 0x10DE1143, "N13P-GV" }, - // { 0x10DE1144, "GF117" }, - // { 0x10DE1145, "GF117" }, - // { 0x10DE1146, "GF117" }, - // { 0x10DE1147, "GF117" }, + { 0x10DE1143, "N13P-GV" }, + { 0x10DE1144, "GF117" }, + { 0x10DE1145, "GF117" }, + { 0x10DE1146, "GF117" }, + { 0x10DE1147, "GF117" }, { 0x10DE1149, "GF117-ES" }, - // { 0x10DE114A, "GF117-INT" }, - // { 0x10DE114B, "PCI-GEN3-B" }, + { 0x10DE114A, "GF117-INT" }, + { 0x10DE114B, "PCI-GEN3-B" }, // 1150 - 115F // 1160 - 116F // 1170 - 117F @@ -1142,13 +1175,16 @@ { 0x10DE118E, "NVIDIA GeForce GTX 760 (192-bit)" }, { 0x10DE118F, "NVIDIA Tesla K10" }, // 1190 - 119F + { 0x10DE1191, "NVIDIA GeForce GTX 760" }, // GK104 { 0x10DE1192, "NVIDIA GeForce GK104" }, { 0x10DE1193, "NVIDIA GeForce GTX 760 Ti" }, + { 0x10DE1194, "NVIDIA Tesla K8" }, // GK104 + { 0x10DE1195, "NVIDIA GeForce GTX 660" }, { 0x10DE1198, "NVIDIA GeForce GTX 880M" }, { 0x10DE1199, "NVIDIA GeForce GTX 870M" }, - { 0x10DE119a, "NVIDIA GeForce GTX 860M" }, - { 0x10DE119d, "NVIDIA GeForce GTX 775M" }, // Mac Edition - { 0x10DE119e, "NVIDIA GeForce GTX 780M" }, // Mac Edition + { 0x10DE119A, "NVIDIA GeForce GTX 860M" }, + { 0x10DE119D, "NVIDIA GeForce GTX 775M" }, // Mac Edition + { 0x10DE119E, "NVIDIA GeForce GTX 780M" }, // Mac Edition { 0x10DE119F, "NVIDIA GeForce GTX 780M" }, // 11A0 - 11AF { 0x10DE11A0, "NVIDIA GeForce GTX 680M" }, @@ -1156,9 +1192,12 @@ { 0x10DE11A2, "NVIDIA GeForce GTX 675MX" }, // Mac Edition { 0x10DE11A3, "NVIDIA GeForce GTX 680MX" }, { 0x10DE11A7, "NVIDIA GeForce GTX 675MX" }, + { 0x10DE11AF, "GRID IceCube" }, // GF104M // 11B0 - 11BF { 0x10DE11B0, "GRID K240Q" }, // K260Q vGPU { 0x10DE11B1, "GRID K2 Tesla USM" }, + { 0x10DE11B4, "NVIDIA Quadro K4200" }, + { 0x10DE11B6, "NVIDIA Quadro K3100M" }, { 0x10DE11B6, "NVIDIA Quadro K3100M" }, { 0x10DE11B7, "NVIDIA Quadro K4100M" }, { 0x10DE11B8, "NVIDIA Quadro K5100M" }, @@ -1180,12 +1219,13 @@ { 0x10DE11D0, "GK106-INT353" }, // 11E0 - 11EF { 0x10DE11E0, "NVIDIA GeForce GTX 770M" }, - { 0x10DE11E1, "N14E-GE-B-A1" }, + { 0x10DE11E1, "NVIDIA GeForce GTX 765M" }, { 0x10DE11E2, "NVIDIA GeForce GTX 765M" }, { 0x10DE11E3, "NVIDIA GeForce GTX 760M" }, // 11F0 - 11FF { 0x10DE11FA, "NVIDIA Quadro K4000" }, { 0x10DE11FC, "NVIDIA Quadro 2100M" }, + { 0x10DE11FF, "NB1Q" }, // // 1200 - 120F { 0x10DE1200, "NVIDIA GeForce GTX 560 Ti" }, { 0x10DE1201, "NVIDIA GeForce GTX 560" }, @@ -1220,6 +1260,8 @@ { 0x10DE1281, "NVIDIA GeForce GT 710" }, { 0x10DE1282, "NVIDIA GeForce GT 640" }, { 0x10DE1284, "NVIDIA GeForce GT 630" }, + { 0x10DE1286, "NVIDIA GeForce GT 720" }, + { 0x10DE1287, "NVIDIA GeForce GT 730" }, // GK208 // 1290 - 129F { 0x10DE1290, "NVIDIA GeForce GT 730M" }, { 0x10DE1291, "NVIDIA GeForce GT 735M" }, @@ -1240,14 +1282,65 @@ // 12D0 - 12DF // 12E0 - 12EF // 12F0 - 12FF - { 0x10DE1340, "NVIDIA GeForce 830M" }, - { 0x10DE1341, "NVIDIA GeForce 840M" }, - { 0x10DE1380, "NVIDIA GeForce GTX 750 Ti" }, - { 0x10DE1381, "NVIDIA GeForce GTX 750" }, - { 0x10DE1390, "NVIDIA GeForce 845M" }, - { 0x10DE1391, "NVIDIA GeForce GTX 850M" }, - { 0x10DE1392, "NVIDIA GeForce GTX 860M" }, - { 0x10DE1393, "NVIDIA GeForce 840M" } + { 0x10DE1340, "NVIDIA GeForce 830M" }, + { 0x10DE1341, "NVIDIA GeForce 840M" }, + { 0x10DE1380, "NVIDIA GeForce GTX 750 Ti" }, + { 0x10DE1381, "NVIDIA GeForce GTX 750" }, + { 0x10DE1382, "NVIDIA GeForce GTX 745" }, + // { 0x10DE1383, "Graphics Device" }, // GM107 + { 0x10DE1389, "GRID M3" }, // GM107 + { 0x10DE1390, "NVIDIA GeForce 845M" }, + { 0x10DE1391, "NVIDIA GeForce GTX 850M" }, + { 0x10DE1392, "NVIDIA GeForce GTX 860M" }, + { 0x10DE1393, "NVIDIA GeForce 840M" }, + { 0x10DE1398, "NVIDIA GeForce N15S-GT1R" }, // + { 0x10DE13AD, "GM107 INT52" }, // + { 0x10DE13AE, "GM107 CS1" }, // + // { 0x10DE13AF, "Graphics Device" }, // GM107GLM + { 0x10DE13B3, "NVIDIA Quadro K2200M" }, // + { 0x10DE13BA, "NVIDIA Quadro K2200" }, + { 0x10DE13BB, "NVIDIA Quadro K620" }, + { 0x10DE13BD, "NVIDIA Tesla M40" }, // GM107GLM + { 0x10DE13BE, "GM107 CS1" }, // + { 0x10DE13BF, "GM107 INT52" }, // + // 12B0 - 12BF + { 0x10DE13C0, "NVIDIA GeForce GTX 980" }, // GM107GLM + // { 0x10DE13C1, "Graphics Device" }, // GM107GLM + { 0x10DE13C2, "NVIDIA GeForce GTX 970" }, // GM107GLM + // { 0x10DE13C3, "Graphics Device" }, // GM107GLM + { 0x10DE13D7, "NVIDIA GeForce GTX 980M" }, // + { 0x10DE13D8, "NVIDIA GeForce GTX 970M" }, // + // { 0x10DE13D9, "Graphics Device" }, // + // { 0x10DE13F0, "Graphics Device" }, // GM107GLM + // { 0x10DE13F1, "Graphics Device" }, // GM107GLM + // { 0x10DE1401, "Graphics Device" }, // + // { 0x10DE1402, "Graphics Device" }, // + // { 0x10DE143F, "Graphics Device" }, // + // { 0x10DE1600, "Graphics Device" }, // + // { 0x10DE1601, "Graphics Device" }, // + // { 0x10DE1602, "Graphics Device" }, // + // { 0x10DE1603, "Graphics Device" }, // + // { 0x10DE1630, "Graphics Device" }, // + // { 0x10DE1631, "Graphics Device" }, // + // { 0x10DE1780, "Graphics Device" }, // + // { 0x10DE1781, "Graphics Device" }, // + // { 0x10DE1782, "Graphics Device" }, // + // { 0x10DE1783, "Graphics Device" }, // + { 0x10DE1789, "GRID M3-3020" }, // + { 0x10DE1790, "N15S-GX" }, // + { 0x10DE1791, "N15P-GT" }, // + { 0x10DE1792, "N15P-GX" }, // + // { 0x10DE17B3, "Quadro" }, // + // { 0x10DE17BA, "Quadro" }, // + // { 0x10DE17BB, "Quadro" }, // + // { 0x10DE17BD, "Graphics Device" }, // + { 0x10DE17BE, "GM107 CS1" } // GM107 + // { 0x10DE17C1, "Graphics Device" }, // + // { 0x10DE17C2, "Graphics Device" }, // + // { 0x10DE17EE, "Graphics Device" }, // + // { 0x10DE17EF, "Graphics Device" }, // + // { 0x10DE17F0, "Graphics Device" }, // + // { 0x10DE17FF, "Graphics Device" }, // }; static nvidia_card_info_t nvidia_card_exceptions[] = { @@ -1437,6 +1530,8 @@ { 0x10DE1180, 0x38422682, "EVGA GTX 680 SC" }, { 0x10DE1180, 0x38422683, "EVGA GTX 680 SC" }, + { 0x10DE1185, 0x10DE106F, "nVidia GeForce GTX 760 OEM" }, // GK104 + { 0x10DE1187, 0x14583614, "GV-N760OC-4GD" }, { 0x10DE1189, 0x10438405, "Asus GTX 670 Direct CU II TOP" }, Index: branches/Chimera/i386/libsaio/ati.c =================================================================== --- branches/Chimera/i386/libsaio/ati.c (revision 2657) +++ branches/Chimera/i386/libsaio/ati.c (revision 2658) @@ -45,10 +45,7 @@ "Juniper", "Redwood", "Broadway", - // "Madison", - // "Park", /* Northern Islands */ - // "Antilles", "Barts", "Caicos", "Cayman", @@ -56,10 +53,15 @@ /* Southern Islands */ "Tahiti", "Pitcairn", - // "CapeVerde", - // "Thames", - // "Lombok", - // "NewZealand", + "Verde", + "Oland", + "Hainan", + "Bonaire", + "Kaveri", + "Abini", + "Hawaii", + /* ... */ + "Mullins", "" }; @@ -96,14 +98,14 @@ {"Uakari", 4}, {"Zonalis", 6}, {"Alouatta", 4}, - {"Hoolock", 3}, + {"Hoolock", 1}, {"Vervet", 4}, {"Baboon", 3}, {"Eulemur", 3}, {"Galago", 2}, {"Colobus", 2}, {"Mangabey", 2}, - {"Nomascus", 4}, + {"Nomascus", 5}, {"Orangutan", 2}, /* AMD6000Controller */ {"Pithecia", 3}, @@ -2337,7 +2339,7 @@ return false; } // ------------------------------------------------- - + #if 0 uint64_t fb = (uint32_t)card->fb; uint64_t mmio = (uint32_t)card->mmio; @@ -2346,7 +2348,7 @@ devprop_add_value(card->device, "ATY,RegisterSpaceOffset", &mmio, 8); devprop_add_value(card->device, "ATY,IOSpaceOffset", &io, 8); #endif - + devprop_add_list(ati_devprop_list); // ------------------------------------------------- Index: branches/Chimera/i386/libsaio/sys.c =================================================================== --- branches/Chimera/i386/libsaio/sys.c (revision 2657) +++ branches/Chimera/i386/libsaio/sys.c (revision 2658) @@ -65,6 +65,7 @@ #include "disk.h" #include "ramdisk.h" #include "xml.h" +#include "sl.h" #include //#include @@ -76,6 +77,12 @@ static unsigned char kFSUUIDNamespaceSHA1[] = {0xB3,0xE2,0x0F,0x39,0xF2,0x92,0x11,0xD6,0x97,0xA4,0x00,0x30,0x65,0x43,0xEC,0xAC}; #endif +#if DEBUG +#define DBG(x...) printf(x) +#else +#define DBG(x...) msglog(x) +#endif + extern int multiboot_partition; extern int multiboot_partition_set; extern int multiboot_skip_partition; @@ -203,21 +210,27 @@ readFile = bvr->fs_readfile; - if (readFile != NULL) { + if (readFile != NULL) + { // Read the first 4096 bytes (fat header) length = readFile(bvr, (char *)filePath, *binary, 0, 0x1000); - if (length > 0) { - if (ThinFatFile(binary, &length) == 0) { - if (length == 0) { + if (length > 0) + { + if (ThinFatFile(binary, &length) == 0) + { + if (length == 0) + { return 0; } // We found a fat binary; read only the thin part + DBG("Fat Binary found. Reading thin part only...\n"); length = readFile(bvr, (char *)filePath, (void *)kLoadAddr, (unsigned long)(*binary) - kLoadAddr, length); *binary = (void *)kLoadAddr; } else { // Not a fat binary; read the rest of the file + DBG("Thin Binary found. Reading rest of the file...\n"); length2 = readFile(bvr, (char *)filePath, (void *)(kLoadAddr + length), length, 0); if (length2 == -1) { @@ -230,7 +243,8 @@ } else { length = bvr->fs_loadfile(bvr, (char *)filePath); - if (length > 0) { + if (length > 0) + { ThinFatFile(binary, &length); } } Index: branches/Chimera/i386/libsaio/load.c =================================================================== --- branches/Chimera/i386/libsaio/load.c (revision 2657) +++ branches/Chimera/i386/libsaio/load.c (revision 2658) @@ -18,12 +18,11 @@ * under the License. * * @APPLE_LICENSE_HEADER_END@ - */ -/* - * load.c - Functions for decoding a Mach-o Kernel. * - * Copyright (c) 1998-2003 Apple Computer, Inc. + * load.c - Functions for decoding a Mach-o Kernel. * + * Copyright (c) 1998-2003 Apple Computer, Inc. + * */ #include @@ -32,6 +31,12 @@ #include +#if DEBUG +#define DBG(x...) printf(x) +#else +#define DBG(x...) msglog(x) +#endif + static long DecodeSegment(long cmdBase, unsigned int*load_addr, unsigned int *load_size); static long DecodeUnixThread(long cmdBase, unsigned int *entry); static long DecodeSymbolTable(long cmdBase); @@ -54,18 +59,22 @@ uint32_t fapoffset; uint32_t fapsize; - if (fhp->magic == FAT_MAGIC) { + if (fhp->magic == FAT_MAGIC)/* 0xcafebabe */ + { nfat = fhp->nfat_arch; swapped = 0; - } else if (fhp->magic == FAT_CIGAM) { + } else if (fhp->magic == FAT_CIGAM)/* 0xbebafeca */ + { nfat = OSSwapInt32(fhp->nfat_arch); swapped = 1; } else { return -1; } - for (; nfat > 0; nfat--, fap++) { - if (swapped) { + for (; nfat > 0; nfat--, fap++) + { + if (swapped) + { fapcputype = OSSwapInt32(fap->cputype); fapoffset = OSSwapInt32(fap->offset); fapsize = OSSwapInt32(fap->size); @@ -75,14 +84,16 @@ fapsize = fap->size; } - if (fapcputype == archCpuType) { + if (fapcputype == archCpuType) + { *binary = (void *) ((unsigned long)*binary + fapoffset); size = fapsize; break; } } - if (length != 0) { + if (length != 0) + { *length = size; } @@ -107,22 +118,24 @@ mH = (struct mach_header *)(gBinaryAddress); -#if DEBUG - printf("magic: %x\n", (unsigned)mH->magic); - printf("cputype: %x\n", (unsigned)mH->cputype); - printf("cpusubtype: %x\n", (unsigned)mH->cpusubtype); - printf("filetype: %x\n", (unsigned)mH->filetype); - printf("ncmds: %x\n", (unsigned)mH->ncmds); - printf("sizeofcmds: %x\n", (unsigned)mH->sizeofcmds); - printf("flags: %x\n", (unsigned)mH->flags); - getchar(); -#endif +/*#if DEBUG + DBG("magic: 0x%x\n", (unsigned)mH->magic); + DBG("cputype: 0x%x\n", (unsigned)mH->cputype); + DBG("cpusubtype: 0x%x\n", (unsigned)mH->cpusubtype); + DBG("filetype: 0x%x\n", (unsigned)mH->filetype); + DBG("ncmds: 0x%x\n", (unsigned)mH->ncmds); + DBG("sizeofcmds: 0x%x\n", (unsigned)mH->sizeofcmds); + DBG("flags: 0x%x\n", (unsigned)mH->flags); + DBG("archCpuType: 0x%x\n", archCpuType); + //getchar(); +#endif*/ switch (archCpuType) { case CPU_TYPE_I386: - if (mH->magic != MH_MAGIC) { + if (mH->magic != MH_MAGIC) + { error("Mach-O file has bad magic number\n"); return -1; } @@ -131,12 +144,14 @@ break; case CPU_TYPE_X86_64: - - if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC) { +/* + if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC) + { return -1; } - - if (mH->magic != MH_MAGIC_64) { +*/ + if (mH->magic != MH_MAGIC_64) + { error("Mach-O file has bad magic number\n"); return -1; } @@ -160,7 +175,8 @@ unsigned int load_addr; unsigned int load_size; - switch (cmd) { + switch (cmd) + { case LC_SEGMENT_64: case LC_SEGMENT: ret = DecodeSegment(cmdBase, &load_addr, &load_size); @@ -187,7 +203,8 @@ } - if (ret != 0) { + if (ret != 0) + { return -1; } @@ -200,15 +217,18 @@ cmdBase = cmdstart; - for (cnt = 0; cnt < ncmds; cnt++) { - cmd = ((long *)cmdBase)[0]; - cmdsize = ((long *)cmdBase)[1]; + for (cnt = 0; cnt < ncmds; cnt++) + { + cmd = ((long *)cmdBase)[0]; + cmdsize = ((long *)cmdBase)[1]; - if (cmd == LC_SYMTAB) { - if (DecodeSymbolTable(cmdBase) != 0) { - return -1; - } - } + if (cmd == LC_SYMTAB) + { + if (DecodeSymbolTable(cmdBase) != 0) + { + return -1; + } + } cmdBase += cmdsize; } @@ -227,7 +247,8 @@ long vmsize, filesize; unsigned long vmaddr, fileaddr; - if (((long *)cmdBase)[0] == LC_SEGMENT_64) { + if (((long *)cmdBase)[0] == LC_SEGMENT_64) + { struct segment_command_64 *segCmd; segCmd = (struct segment_command_64 *)cmdBase; vmaddr = (segCmd->vmaddr & 0x3fffffff); @@ -260,7 +281,8 @@ #endif } - if (vmsize == 0 || filesize == 0) { + if (vmsize == 0 || filesize == 0) + { *load_addr = ~0; *load_size = 0; return 0; Index: branches/Chimera/i386/libsaio/ati.h =================================================================== --- branches/Chimera/i386/libsaio/ati.h (revision 2657) +++ branches/Chimera/i386/libsaio/ati.h (revision 2658) @@ -16,8 +16,6 @@ #include "device_inject.h" #include "ati_reg.h" - - /* DEFINES */ #define OFFSET_TO_GET_ATOMBIOS_STRINGS_START 0x6e @@ -51,7 +49,8 @@ CHIP_FAMILY_UNKNOW, /* Old */ CHIP_FAMILY_R420, - CHIP_FAMILY_RV410, + CHIP_FAMILY_R423, + CHIP_FAMILY_RV410, CHIP_FAMILY_RV515, CHIP_FAMILY_R520, CHIP_FAMILY_RV530, @@ -84,27 +83,32 @@ CHIP_FAMILY_HEMLOCK, CHIP_FAMILY_JUNIPER, CHIP_FAMILY_REDWOOD, - CHIP_FAMILY_BROADWAY, - // CHIP_FAMILY_MADISON, - // CHIP_FAMILY_PARK, /* Northern Islands */ - // CHIP_FAMILY_ANTILLES, CHIP_FAMILY_BARTS, CHIP_FAMILY_CAICOS, CHIP_FAMILY_CAYMAN, CHIP_FAMILY_TURKS, /* Southern Islands */ - CHIP_FAMILY_TAHITI, + CHIP_FAMILY_PALM, + CHIP_FAMILY_LOMBOK, + CHIP_FAMILY_WRESTLER, + CHIP_FAMILY_SUMO, + CHIP_FAMILY_SUMO2, + CHIP_FAMILY_MANHATTAN, + CHIP_FAMILY_VANCOUVER, + CHIP_FAMILY_TRINITY, + CHIP_FAMILY_ARUBA, + CHIP_FAMILY_TAHITI, CHIP_FAMILY_PITCAIRN, CHIP_FAMILY_VERDE, - CHIP_FAMILY_THAMES, - CHIP_FAMILY_LOMBOK, - // CHIP_FAMILY_NEWZEALAND, - CHIP_FAMILY_SUMO, - CHIP_FAMILY_MANHATTAN, - CHIP_FAMILY_VANCOUVER, - CHIP_FAMILY_WRESTLER, - CHIP_FAMILY_TRINITY, + CHIP_FAMILY_OLAND, + CHIP_FAMILY_HAINAN, + CHIP_FAMILY_BONAIRE, + CHIP_FAMILY_KAVERI, + CHIP_FAMILY_KABINI, + CHIP_FAMILY_HAWAII, + /* ... */ + CHIP_FAMILY_MULLINS, CHIP_FAMILY_LAST } ati_chip_family_t; Index: branches/Chimera/i386/libsaio/platform.c =================================================================== --- branches/Chimera/i386/libsaio/platform.c (revision 2657) +++ branches/Chimera/i386/libsaio/platform.c (revision 2658) @@ -20,7 +20,7 @@ #if DEBUG_PLATFORM #define DBG(x...) printf(x) #else -#define DBG(x...) +#define DBG(x...) msglog(x) #endif PlatformInfo_t Platform; Index: branches/Chimera/i386/libsaio/cpu.c =================================================================== --- branches/Chimera/i386/libsaio/cpu.c (revision 2657) +++ branches/Chimera/i386/libsaio/cpu.c (revision 2658) @@ -27,72 +27,72 @@ */ uint64_t timeRDTSC(void) { - int attempts = 0; - uint64_t latchTime; - uint64_t saveTime,intermediate; - unsigned int timerValue, lastValue; - //boolean_t int_enabled; - /* - * Table of correction factors to account for - * - timer counter quantization errors, and - * - undercounts 0..5 - */ + int attempts = 0; + uint64_t latchTime; + uint64_t saveTime,intermediate; + unsigned int timerValue, lastValue; + //boolean_t int_enabled; + /* + * Table of correction factors to account for + * - timer counter quantization errors, and + * - undercounts 0..5 + */ #define SAMPLE_CLKS_EXACT (((double) CLKNUM) / 20.0) #define SAMPLE_CLKS_INT ((int) CLKNUM / 20) #define SAMPLE_NSECS (2000000000LL) #define SAMPLE_MULTIPLIER (((double)SAMPLE_NSECS)*SAMPLE_CLKS_EXACT) #define ROUND64(x) ((uint64_t)((x) + 0.5)) - uint64_t scale[6] = { + uint64_t scale[6] = { ROUND64(SAMPLE_MULTIPLIER/(double)(SAMPLE_CLKS_INT-0)), ROUND64(SAMPLE_MULTIPLIER/(double)(SAMPLE_CLKS_INT-1)), ROUND64(SAMPLE_MULTIPLIER/(double)(SAMPLE_CLKS_INT-2)), ROUND64(SAMPLE_MULTIPLIER/(double)(SAMPLE_CLKS_INT-3)), ROUND64(SAMPLE_MULTIPLIER/(double)(SAMPLE_CLKS_INT-4)), ROUND64(SAMPLE_MULTIPLIER/(double)(SAMPLE_CLKS_INT-5)) - }; - - //int_enabled = ml_set_interrupts_enabled(FALSE); - + }; + + //int_enabled = ml_set_interrupts_enabled(FALSE); + restart: - if (attempts >= 9) // increase to up to 9 attempts. - { - // This will flash-reboot. TODO: Use tscPanic instead. - printf("Timestamp counter calibation failed with %d attempts\n", attempts); - } - attempts++; - enable_PIT2(); // turn on PIT2 - set_PIT2(0); // reset timer 2 to be zero - latchTime = rdtsc64(); // get the time stamp to time - latchTime = get_PIT2(&timerValue) - latchTime; // time how long this takes - set_PIT2(SAMPLE_CLKS_INT); // set up the timer for (almost) 1/20th a second - saveTime = rdtsc64(); // now time how long a 20th a second is... - get_PIT2(&lastValue); - get_PIT2(&lastValue); // read twice, first value may be unreliable - do { + if (attempts >= 9) // increase to up to 9 attempts. + { + // This will flash-reboot. TODO: Use tscPanic instead. + printf("Timestamp counter calibation failed with %d attempts\n", attempts); + } + attempts++; + enable_PIT2(); // turn on PIT2 + set_PIT2(0); // reset timer 2 to be zero + latchTime = rdtsc64(); // get the time stamp to time + latchTime = get_PIT2(&timerValue) - latchTime; // time how long this takes + set_PIT2(SAMPLE_CLKS_INT); // set up the timer for (almost) 1/20th a second + saveTime = rdtsc64(); // now time how long a 20th a second is... + get_PIT2(&lastValue); + get_PIT2(&lastValue); // read twice, first value may be unreliable + do { intermediate = get_PIT2(&timerValue); if (timerValue > lastValue) - { + { // Timer wrapped set_PIT2(0); disable_PIT2(); goto restart; } lastValue = timerValue; - } while (timerValue > 5); - printf("timerValue %d\n",timerValue); - printf("intermediate 0x%016llx\n",intermediate); - printf("saveTime 0x%016llx\n",saveTime); + } while (timerValue > 5); + printf("timerValue %d\n",timerValue); + printf("intermediate 0x%016llx\n",intermediate); + printf("saveTime 0x%016llx\n",saveTime); - intermediate -= saveTime; // raw count for about 1/20 second - intermediate *= scale[timerValue]; // rescale measured time spent - intermediate /= SAMPLE_NSECS; // so its exactly 1/20 a second - intermediate += latchTime; // add on our save fudge + intermediate -= saveTime; // raw count for about 1/20 second + intermediate *= scale[timerValue]; // rescale measured time spent + intermediate /= SAMPLE_NSECS; // so its exactly 1/20 a second + intermediate += latchTime; // add on our save fudge - set_PIT2(0); // reset timer 2 to be zero - disable_PIT2(); // turn off PIT 2 + set_PIT2(0); // reset timer 2 to be zero + disable_PIT2(); // turn off PIT 2 - //ml_set_interrupts_enabled(int_enabled); - return intermediate; + //ml_set_interrupts_enabled(int_enabled); + return intermediate; } /* @@ -106,7 +106,7 @@ unsigned long pollCount; uint64_t retval = 0; int i; - + /* Time how many TSC ticks elapse in 30 msec using the 8254 PIT * counter 2. We run this loop 3 times to make sure the cache * is hot and we take the minimum delta from all of the runs. @@ -126,18 +126,18 @@ /* The poll loop must have run at least a few times for accuracy */ if (pollCount <= 1) { continue; - } + } /* The TSC must increment at LEAST once every millisecond. * We should have waited exactly 30 msec so the TSC delta should * be >= 30. Anything less and the processor is way too slow. */ if ((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC) { continue; - } + } // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) if ( (tscEnd - tscStart) < tscDelta ) { tscDelta = tscEnd - tscStart; - } + } } /* tscDelta is now the least number of TSC ticks the processor made in * a timespan of 0.03 s (e.g. 30 milliseconds) @@ -146,7 +146,7 @@ * Hz so we need to convert our milliseconds to seconds. Since we're * dividing by the milliseconds, we simply multiply by 1000. */ - + /* Unlike linux, we're not limited to 32-bit, but we do need to take care * that we're going to multiply by 1000 first so we do need at least some * arithmetic headroom. For now, 32-bit should be enough. @@ -176,7 +176,7 @@ unsigned long pollCount; uint64_t retval = 0; int i; - + /* Time how many APERF ticks elapse in 30 msec using the 8254 PIT * counter 2. We run this loop 3 times to make sure the cache * is hot and we take the minimum delta from all of the runs. @@ -194,23 +194,23 @@ /* The poll loop must have run at least a few times for accuracy */ if (pollCount <= 1) { continue; - } + } /* The TSC must increment at LEAST once every millisecond. * We should have waited exactly 30 msec so the APERF delta should * be >= 30. Anything less and the processor is way too slow. */ if ((aperfEnd - aperfStart) <= CALIBRATE_TIME_MSEC) { continue; - } + } // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) if ( (aperfEnd - aperfStart) < aperfDelta ) { aperfDelta = aperfEnd - aperfStart; - } + } } /* mperfDelta is now the least number of MPERF ticks the processor made in * a timespan of 0.03 s (e.g. 30 milliseconds) */ - + if (aperfDelta > (1ULL<<32)) { retval = 0; } else { @@ -285,29 +285,22 @@ +--------+----------------+--------+----+----+--------+--------+--------+ |########|Extended family |Extmodel|####|type|familyid| model |stepping| +--------+----------------+--------+----+----+--------+--------+--------+ - + EAX (AMD): 31 28 27 20 19 16 1514 1312 11 8 7 4 3 0 +--------+----------------+--------+----+----+--------+--------+--------+ |########|Extended family |Extmodel|####|####|familyid| model |stepping| - +--------+----------------+--------+----+----+--------+--------+--------+ + +--------+----------------+--------+----+----+--------+--------+--------+ */ - + p->CPU.Vendor = p->CPU.CPUID[CPUID_0][1]; p->CPU.Signature = p->CPU.CPUID[CPUID_1][0]; - // stepping = cpu_feat_eax & 0xF; - p->CPU.Stepping = bitfield(p->CPU.CPUID[CPUID_1][0], 3, 0); - // model = (cpu_feat_eax >> 4) & 0xF; - p->CPU.Model = bitfield(p->CPU.CPUID[CPUID_1][0], 7, 4); - // family = (cpu_feat_eax >> 8) & 0xF; - p->CPU.Family = bitfield(p->CPU.CPUID[CPUID_1][0], 11, 8); - // type = (cpu_feat_eax >> 12) & 0x3; - //p->CPU.Type = bitfield(p->CPU.CPUID[CPUID_1][0], 13, 12); - // ext_model = (cpu_feat_eax >> 16) & 0xF; - p->CPU.ExtModel = bitfield(p->CPU.CPUID[CPUID_1][0], 19, 16); - // ext_family = (cpu_feat_eax >> 20) & 0xFF; - p->CPU.ExtFamily = bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20); - + p->CPU.Stepping = bitfield(p->CPU.CPUID[CPUID_1][0], 3, 0); // stepping = cpu_feat_eax & 0xF; + p->CPU.Model = bitfield(p->CPU.CPUID[CPUID_1][0], 7, 4); // model = (cpu_feat_eax >> 4) & 0xF; + p->CPU.Family = bitfield(p->CPU.CPUID[CPUID_1][0], 11, 8); // family = (cpu_feat_eax >> 8) & 0xF; + //p->CPU.Type = bitfield(p->CPU.CPUID[CPUID_1][0], 13, 12); // type = (cpu_feat_eax >> 12) & 0x3; + p->CPU.ExtModel = bitfield(p->CPU.CPUID[CPUID_1][0], 19, 16); // ext_model = (cpu_feat_eax >> 16) & 0xF; + p->CPU.ExtFamily = bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20); // ext_family = (cpu_feat_eax >> 20) & 0xFF; p->CPU.Model += (p->CPU.ExtModel << 4); if (p->CPU.Vendor == CPUID_VENDOR_INTEL && @@ -388,7 +381,7 @@ if (p->CPU.NoThreads > p->CPU.NoCores) { p->CPU.Features |= CPU_FEATURE_HTT; } - + tscFrequency = measure_tsc_frequency(); /* if usual method failed */ if ( tscFrequency < 1000 ) { //TEST @@ -396,7 +389,7 @@ } fsbFrequency = 0; cpuFrequency = 0; - + if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((p->CPU.Family == 0x06) || (p->CPU.Family == 0x0f))) { int intelCPU = p->CPU.Model; if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0c) || (p->CPU.Family == 0x0f && p->CPU.Model >= 0x03)) { @@ -416,7 +409,8 @@ p->CPU.Model == CPU_MODEL_HASWELL || p->CPU.Model == CPU_MODEL_HASWELL_SVR || p->CPU.Model == CPU_MODEL_HASWELL_ULT || - p->CPU.Model == CPU_MODEL_CRYSTALWELL )){ + p->CPU.Model == CPU_MODEL_CRYSTALWELL || + p->CPU.Model == CPU_MODEL_BROADWELL )){ msr = rdmsr64(MSR_PLATFORM_INFO); // DBG("msr(%d): platform_info %08x\n", __LINE__, bitfield(msr, 31, 0)); bus_ratio_max = bitfield(msr, 15, 8); //MacMan: Changed bitfield to match Apple tsc.c @@ -457,6 +451,7 @@ case CPU_MODEL_HASWELL: // Intel Core i3, i5, i7, Xeon E3 LGA1050 (22nm) case CPU_MODEL_HASWELL_ULT: case CPU_MODEL_CRYSTALWELL: + case CPU_MODEL_BROADWELL: { msr = rdmsr64(MSR_IA32_PERF_STATUS); currcoef = bitfield(msr, 15, 8); Index: branches/Chimera/i386/libsaio/platform.h =================================================================== --- branches/Chimera/i386/libsaio/platform.h (revision 2657) +++ branches/Chimera/i386/libsaio/platform.h (revision 2658) @@ -30,38 +30,49 @@ #define CPUID_88 9 #define CPUID_MAX 10 -#define CPU_MODEL_PRESCOTT 0x03 // Celeron D, Pentium 4 (90nm) -#define CPU_MODEL_NOCONA 0x04 // Xeon Nocona, Irwindale (90nm) -#define CPU_MODEL_PRESLER 0x06 // Pentium 4, Pentium D (65nm) -#define CPU_MODEL_PENTIUM_M 0x09 // Banias -#define CPU_MODEL_DOTHAN 0x0D // Dothan -#define CPU_MODEL_YONAH 0x0E // Sossaman, Yonah -#define CPU_MODEL_MEROM 0x0F // Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom -#define CPU_MODEL_CONROE 0x0F // -#define CPU_MODEL_CELERON 0x16 // -#define CPU_MODEL_PENRYN 0x17 // Wolfdale, Yorkfield, Harpertown, Penryn -#define CPU_MODEL_WOLFDALE 0x17 // -#define CPU_MODEL_NEHALEM 0x1A // Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown -#define CPU_MODEL_ATOM 0x1C // Pineview -#define CPU_MODEL_XEON_MP 0x1D // MP 7400 -#define CPU_MODEL_FIELDS 0x1E // Lynnfield, Clarksfield, Jasper Forest -#define CPU_MODEL_DALES 0x1F // Havendale, Auburndale +#define CPU_MODEL_ANY 0x00 +#define CPU_MODEL_UNKNOWN 0x01 +#define CPU_MODEL_PRESCOTT 0x03 // Celeron D, Pentium 4 (90nm) +#define CPU_MODEL_NOCONA 0x04 // Xeon Nocona, Irwindale (90nm) +#define CPU_MODEL_PRESLER 0x06 // Pentium 4, Pentium D (65nm) +#define CPU_MODEL_PENTIUM_M 0x09 // Banias +#define CPU_MODEL_DOTHAN 0x0D // Dothan +#define CPU_MODEL_YONAH 0x0E // Sossaman, Yonah +#define CPU_MODEL_MEROM 0x0F // Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom +#define CPU_MODEL_CONROE 0x0F // +#define CPU_MODEL_CELERON 0x16 // +#define CPU_MODEL_PENRYN 0x17 // Wolfdale, Yorkfield, Harpertown, Penryn +#define CPU_MODEL_WOLFDALE 0x17 // +#define CPU_MODEL_NEHALEM 0x1A // Bloomfield. Nehalem-EP, Nehalem-WS, Gainestown +#define CPU_MODEL_ATOM 0x1C // Pineview +#define CPU_MODEL_XEON_MP 0x1D // MP 7400 +#define CPU_MODEL_FIELDS 0x1E // Lynnfield, Clarksfield, Jasper Forest +#define CPU_MODEL_DALES 0x1F // Havendale, Auburndale #define CPU_MODEL_DALES_32NM 0x25 // Clarkdale, Arrandale -#define CPU_MODEL_ATOM_SAN 0x26 // Lincroft -#define CPU_MODEL_LINCROFT 0x27 // +#define CPU_MODEL_ATOM_SAN 0x26 // Lincroft +#define CPU_MODEL_LINCROFT 0x27 // #define CPU_MODEL_SANDYBRIDGE 0x2A // Sandy Bridge -#define CPU_MODEL_WESTMERE 0x2C // Gulftown, Westmere-EP, Westmere-WS -#define CPU_MODEL_JAKETOWN 0x2D // Sandy Bridge-E, Sandy Bridge-EP +#define CPU_MODEL_WESTMERE 0x2C // Gulftown, Westmere-EP, Westmere-WS +#define CPU_MODEL_JAKETOWN 0x2D // Sandy Bridge-E, Sandy Bridge-EP #define CPU_MODEL_NEHALEM_EX 0x2E // Beckton #define CPU_MODEL_WESTMERE_EX 0x2F // Westmere-EX -#define CPU_MODEL_ATOM_2000 0x36 // Cedarview -#define CPU_MODEL_IVYBRIDGE 0x3A // Ivy Bridge -#define CPU_MODEL_HASWELL 0x3C // Haswell DT +#define CPU_MODEL_ATOM_2000 0x36 // Cedarview / Saltwell +#define CPU_MODEL_SILVERMONT 0x37 // Atom Silvermont +#define CPU_MODEL_IVYBRIDGE 0x3A // Ivy Bridge +#define CPU_MODEL_HASWELL 0x3C // Haswell DT +#define CPU_MODEL_BROADWELL 0x3D // Broadwell / Core-AVX2 #define CPU_MODEL_IVYBRIDGE_XEON 0x3E // Ivy Bridge Xeon -#define CPU_MODEL_HASWELL_SVR 0x3F // Haswell MB +#define CPU_MODEL_HASWELL_SVR 0x3F // Haswell Server //#define CPU_MODEL_HASWELL_H 0x?? // Haswell H #define CPU_MODEL_HASWELL_ULT 0x45 // Haswell ULT -#define CPU_MODEL_CRYSTALWELL 0x46 // Haswell ULX +#define CPU_MODEL_CRYSTALWELL 0x46 // Crystal Well +// 4A silvermont / atom +#define CPU_MODEL_AVOTON 0x4D // Silvermont/Avoton Atom C2000 +// 4E Core??? +#define CPU_MODEL_BRODWELL_SVR 0x4F // Broadwell Server +#define CPU_MODEL_BRODWELL_MSVR 0x56 // Broadwell Micro Server +// 5A silvermont / atom +// 5D silvermont / atom /* CPU Features */ #define CPU_FEATURE_MMX 0x00000001 // MMX Instruction Set @@ -98,6 +109,7 @@ #define SMB_MEM_TYPE_DDR2 19 #define SMB_MEM_TYPE_FBDIMM 20 #define SMB_MEM_TYPE_DDR3 24 // Supported in 10.5.6+ AppleSMBIOS +#define SMB_MEM_TYPE_DDR4 26 /* Memory Configuration Types */ #define SMB_MEM_CHANNEL_UNKNOWN 0 @@ -131,10 +143,13 @@ //============================================================================== -typedef struct _PlatformInfo_t { +typedef struct _PlatformInfo_t +{ struct CPU { uint32_t Features; // CPU Features like MMX, SSE2, VT, MobileCPU uint32_t Vendor; // Vendor + uint32_t CoresPerPackage; + uint32_t LogicalPerPackage; uint32_t Signature; // Processor Signature uint32_t Stepping; // Stepping //uint16_t Type; // Type @@ -177,7 +192,7 @@ int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot } DMI; - uint8_t Type; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile) + uint8_t Type; // System Type: 1=Desktop, 2=Portable, 3=Workstation... according ACPI2.0 (FACP: PM_Profile) uint8_t *UUID; } PlatformInfo_t; Index: branches/Chimera/i386/libsaio/disk.c =================================================================== --- branches/Chimera/i386/libsaio/disk.c (revision 2657) +++ branches/Chimera/i386/libsaio/disk.c (revision 2658) @@ -1039,8 +1039,10 @@ HFSGetDirEntry, HFSGetFileBlock, HFSGetUUID, + HFSGetDescription, + HFSFree, 0, - kBIOSDevTypeHardDrive); + kBIOSDevTypeHardDrive, 0); bvr->next = map->bvr; map->bvr = bvr; map->bvrcnt++; @@ -1077,6 +1079,7 @@ { return NULL; } + bzero(buffer,BPS); /* Check for alternate block size */ if (readBytes( biosdev, 0, 0, BPS, buffer ) != 0) @@ -1095,6 +1098,7 @@ { return NULL; } + bzero(buffer,BPS); } factor = blksize / BPS; } @@ -1572,26 +1576,29 @@ const char *val; int len; - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) { + if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) + { // getValueForKey uses const char for val // so copy it and trim *str = '\0'; -// strncat(str, val, MIN(len, 4)); // removed since it breaks any OS X version greater than 10.9 i.e. Yosemite 10.10 strncat(str, val, len); // just copy the whole version number instead } else { valid = false; } } - if(!valid) { + if(!valid) + { int fh = -1; sprintf(dirSpec, "hd(%d,%d)/.PhysicalMediaInstall", BIOS_DEV_UNIT(bvr), bvr->part_no); fh = open(dirSpec, 0); - if (fh >= 0) { + if (fh >= 0) + { valid = true; bvr->OSisInstaller = true; strcpy(bvr->OSVersion, "10.7"); // 10.7 + + close(fh); } else { close(fh); } Index: branches/Chimera/i386/libsaio/smbios.c =================================================================== --- branches/Chimera/i386/libsaio/smbios.c (revision 2657) +++ branches/Chimera/i386/libsaio/smbios.c (revision 2658) @@ -125,7 +125,7 @@ /* ============================================== OEM Platform Feature (Apple Specific - Type 133) ================================================ */ -//#define kSMBOemPlatformFeatureKey +//#define kSMBOemPlatformFeatureKey "SMoemplatformfeature" /* ==================================================*/ #define getFieldOffset(struct, field) ((uint8_t)(uint32_t)&(((struct *)0)->field)) @@ -186,8 +186,8 @@ uint8_t chassisType; char *version; char *serialNumber; - char *assetTag; // Bungo: renamed folowing convention - //char *skuNumber; + char *assetTag; + char *skuNumber; } defaultChassis_t; defaultChassis_t defaultChassis; @@ -267,7 +267,7 @@ kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber }, // SMboardserial - C02140302D5DMT31M {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, assetTag), - kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag }, // SMboardassetag - Base Board Asset Tag# + kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag }, // SMboardassettag - Base Board Asset Tag# {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, locationInChassis), kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component @@ -430,7 +430,9 @@ #define kDefaultMacMiniBoardProduct "Mac-F4208EAA" // MacMini5,1 Mac-8ED6AF5B48C039E1 - MM51.88Z.0077.B0F.1110201309 + // MacMini5,2 Mac-4BC72D62AD45599E + // MacMini5,3 //#define kDefaultMacMini "Macmini5,3" //#define kDefaultMacMiniBIOSVersion " MM51.88Z.0077.B10.1201241549" @@ -458,14 +460,23 @@ // MacBookAir4,1 - Mac-C08A6BB70A942AC2 // MacBookAir4,2 - Mac-742912EFDBEE19B3 + +// MacBookAir5,2 #define kDefaultMacBookAir "MacBookAir5,2" #define kDefaultMacBookAirBIOSVersion " MBA51.88Z.00EF.B00.1205221442" #define kDefaultMacBookAirBIOSReleaseDate "05/10/12" #define kDefaultMacBookBoardAirProduct "Mac-2E6FAB96566FE58C" -// MacBookAir6,1 - Mac-35C1E88140C3E6CF - MBA61.88Z.0099.B04.1309271229 -// MacBookAir6,2 - Mac-7DF21CB3ED6977E5 - MBA62.88Z.00EF.B00.1205221442 +// MacBookAir6,1 +// Bios: MBA61.88Z.0099.B04.1309271229 +// Board: Mac-35C1E88140C3E6CF +// Data: 24/06/13 +// MacBookAir6,2 +// Bios: MBA62.88Z.00EF.B00.1205221442 +// Board: Mac-7DF21CB3ED6977E5 +// Data: 24/06/13 + //=========== MacBookPro =========== #define kDefaultMacBookProFamily "MacBook Pro" //#define kDefaultMacBookProBoardAssetTagNumber "MacBook-Aluminum" @@ -500,6 +511,7 @@ #define kDefaultiMacBIOSVersion " IM81.88Z.00C1.B00.0903051113" #define kDefaultiMacBIOSReleaseDate "02/09/08" #define kDefaultiMacBoardProduct "Mac-F227BEC8" +#define kDefaultMacFamily "Mac" // iMac8,1 family = "Mac" not "iMac" // iMac10,1 // iMac11,1 core i3/i5/i7 @@ -513,7 +525,7 @@ // iMac12,1 #define kDefaultiMacSandy "iMac12,1" #define kDefaultiMacSandyBIOSVersion " IM121.88Z.0047.B00.1102091756" -#define kDefaultiMacSandyBIOSReleaseDate "01/02/08" +#define kDefaultiMacSandyBIOSReleaseDate "04/22/11" #define kDefaultiMacSandyBoardProduct "Mac-942B5BF58194151B" // iMac12,2 Mac-942B59F58194171B @@ -546,6 +558,8 @@ //#define KDefaultMacProBoardSerialNumber "J593902RA4MFE" // Mac Pro 4,1 core i7/Xeon +#define kDefaultMacProNahWestSystemVersion "0.0" + #define kDefaultMacProNehalem "MacPro4,1" #define kDefaultMacProNehalemBIOSVersion " MP41.88Z.0081.B07.0910130729" #define kDefaultMacProNehalemBIOSReleaseDate "10/13/09" @@ -584,7 +598,7 @@ bool useSMBIOSdefaults = true; // Bungo -SMBByte PlatformType = 3; // Bungo: same as Platfom.Type in platform.h +SMBByte PlatformType = 1; // Bungo: same as Platfom.Type in platform.h. Because can't get from ACPI FADT PM profile and platformCPUFeature(CPU_FEATURE_MOBILE)) doesn't work as expect, FIXING NEEDED. /* Rewrite this function */ void setDefaultSMBData(void) // Bungo: setting data from real Macs @@ -604,12 +618,13 @@ defaultChassis.manufacturer = kDefaultVendorManufacturer; defaultChassis.serialNumber = kDefaultSerialNumber; defaultChassis.assetTag = kDefaultAssetTag; -// defaultChassis.skuNumber = kDefaultSkuNumber; + defaultChassis.skuNumber = kDefaultSkuNumber; // if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly, need fixing if (PlatformType == 2) // this method works but it's a substitute { - if (Platform.CPU.NoCores > 1) { + if (Platform.CPU.NoCores > 1) + { defaultSystemInfo.productName = kDefaultMacBookPro; defaultBIOSInfo.version = kDefaultMacBookProBIOSVersion; defaultBIOSInfo.releaseDate = kDefaultMacBookProBIOSReleaseDate; @@ -643,7 +658,7 @@ defaultBIOSInfo.version = kDefaultiMacBIOSVersion; defaultBIOSInfo.releaseDate = kDefaultiMacBIOSReleaseDate; defaultSystemInfo.productName = kDefaultiMac; - defaultSystemInfo.family = kDefaultiMacFamily; + defaultSystemInfo.family = kDefaultiMacFamily; // iMac8,1 family = Mac defaultBaseBoard.product = kDefaultiMacBoardProduct; defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; defaultChassis.chassisType = kSMBchassisAllInOne; @@ -662,14 +677,14 @@ defaultBIOSInfo.version = kDefaultiMacNehalemBIOSVersion; defaultBIOSInfo.releaseDate = kDefaultiMacNehalemBIOSReleaseDate; defaultSystemInfo.productName = kDefaultiMacNehalem; - defaultSystemInfo.family = kDefaultiMacFamily; + defaultSystemInfo.family = kDefaultiMacFamily; // iMac8,1 family = Mac defaultBaseBoard.product = kDefaultiMacNehalemBoardProduct; defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; defaultChassis.chassisType = kSMBchassisAllInOne; break; - case CPU_MODEL_SANDYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (32nm) - case CPU_MODEL_IVYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (22nm) + case CPU_MODEL_SANDYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (32nm) + case CPU_MODEL_IVYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (22nm) defaultBIOSInfo.version = kDefaultiMacSandyBIOSVersion; defaultBIOSInfo.releaseDate = kDefaultiMacSandyBIOSReleaseDate; defaultSystemInfo.productName = kDefaultiMacSandy; @@ -679,36 +694,43 @@ defaultChassis.chassisType = kSMBchassisAllInOne; break; - case CPU_MODEL_NEHALEM: // Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm) - case CPU_MODEL_NEHALEM_EX: // Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x - defaultBIOSInfo.version = kDefaultMacProNehalemBIOSVersion; - defaultBIOSInfo.releaseDate = kDefaultMacProNehalemBIOSReleaseDate; + case CPU_MODEL_NEHALEM: // Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm) + case CPU_MODEL_NEHALEM_EX: // Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x + defaultBIOSInfo.version = kDefaultMacProNehalemBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacProNehalemBIOSReleaseDate; defaultSystemInfo.productName = kDefaultMacProNehalem; - defaultSystemInfo.family = kDefaultMacProFamily; + defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion; + defaultSystemInfo.family = kDefaultMacProFamily; defaultBaseBoard.product = kDefaultMacProNehalemBoardProduct; defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule; defaultChassis.chassisType = kSMBchassisTower; break; - case CPU_MODEL_WESTMERE: // Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core + case CPU_MODEL_WESTMERE: // Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core case CPU_MODEL_WESTMERE_EX: // Intel Xeon E7 case CPU_MODEL_JAKETOWN: // Intel Core i7, Xeon E5 LGA2011 (32nm) case CPU_MODEL_IVYBRIDGE_XEON: // Intel Core i7, Xeon E5 v2 LGA2011 (22nm) MacMan moved to proper location case CPU_MODEL_HASWELL_SVR: // Intel Core i7, Xeon E5 v3 LGA2011v3 (22nm) - defaultBIOSInfo.version = kDefaultMacProWestmereBIOSVersion; - defaultBIOSInfo.releaseDate = kDefaultMacProWestmereBIOSReleaseDate; + case CPU_MODEL_BROADWELL: // Intel Core i3, i5, i7 LGA1150 LGA2011v3 (14nm) + case CPU_MODEL_HASWELL_ULT: + case CPU_MODEL_CRYSTALWELL: + case CPU_MODEL_BRODWELL_SVR: + case CPU_MODEL_BRODWELL_MSVR: + defaultBIOSInfo.version = kDefaultMacProWestmereBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacProWestmereBIOSReleaseDate; defaultSystemInfo.productName = kDefaultMacProWestmere; - defaultSystemInfo.family = kDefaultMacProFamily; + defaultSystemInfo.version = kDefaultMacProNahWestSystemVersion; + defaultSystemInfo.family = kDefaultMacProFamily; defaultBaseBoard.product = kDefaultMacProWestmereBoardProduct; defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule; defaultChassis.chassisType = kSMBchassisTower; break; default: - defaultBIOSInfo.version = kDefaultMacProBIOSVersion; - defaultBIOSInfo.releaseDate = kDefaultMacProBIOSReleaseDate; + defaultBIOSInfo.version = kDefaultMacProBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacProBIOSReleaseDate; defaultSystemInfo.productName = kDefaultMacPro; - defaultSystemInfo.family = kDefaultMacProFamily; + defaultSystemInfo.family = kDefaultMacProFamily; defaultBaseBoard.product = kDefaultMacProBoardProduct; defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; defaultChassis.chassisType = kSMBchassisUnknown; @@ -717,10 +739,10 @@ break; } default: - defaultBIOSInfo.version = kDefaultMacProBIOSVersion; - defaultBIOSInfo.releaseDate = kDefaultMacProBIOSReleaseDate; + defaultBIOSInfo.version = kDefaultMacProBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacProBIOSReleaseDate; defaultSystemInfo.productName = kDefaultMacPro; - defaultSystemInfo.family = kDefaultMacProFamily; + defaultSystemInfo.family = kDefaultMacProFamily; defaultBaseBoard.product = kDefaultMacProBoardProduct; defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; defaultChassis.chassisType = kSMBchassisUnknown; @@ -853,7 +875,7 @@ case kSMBByte: case kSMBWord: case kSMBDWord: - //case kSMBQWord: + case kSMBQWord: if (SMBSetters[idx].keyString) { parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist); if (!parsed) @@ -870,9 +892,9 @@ case kSMBWord: value->word = (uint16_t)val; break; - //case kSMBQWord: - // value->qword = (uint64_t)val; - // break; + case kSMBQWord: + value->qword = (uint64_t)val; + break; case kSMBDWord: default: value->dword = (uint32_t)val; @@ -898,9 +920,9 @@ case kSMBWord: value->word = *(uint16_t *)(SMBSetters[idx].defaultValue); break; - //case kSMBQWord: - // value->qword = *(uint32_t *)(SMBSetters[idx].defaultValue); - // break; + case kSMBQWord: + value->qword = *(uint64_t *)(SMBSetters[idx].defaultValue); + break; case kSMBDWord: default: value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); @@ -983,10 +1005,13 @@ case CPU_MODEL_IVYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (22nm) case CPU_MODEL_IVYBRIDGE_XEON: case CPU_MODEL_JAKETOWN: // Intel Core i7, Xeon E5 LGA2011 (32nm) - case CPU_MODEL_HASWELL: + case CPU_MODEL_HASWELL: // Intel Core i3, i5, i7 LGA1150 LGA2011v3 (22nm) case CPU_MODEL_HASWELL_SVR: case CPU_MODEL_HASWELL_ULT: case CPU_MODEL_CRYSTALWELL: + case CPU_MODEL_BROADWELL: // Intel Core i3, i5, i7 LGA1150 LGA2011v3 (14nm) + case CPU_MODEL_BRODWELL_SVR: + case CPU_MODEL_BRODWELL_MSVR: break; @@ -1072,7 +1097,7 @@ structSize = sizeof(SMBMemoryDevice); break; default: - structSize = structPtr->orig->length; // don't change if not to patch + structSize = structPtr->orig->length; // doesn't change a length for unpatched break; } Index: branches/Chimera/i386/libsaio/smbios_decode.c =================================================================== --- branches/Chimera/i386/libsaio/smbios_decode.c (revision 2657) +++ branches/Chimera/i386/libsaio/smbios_decode.c (revision 2658) @@ -170,6 +170,25 @@ "Socket LGA1356-3" /* 2Ch */ }; +static const char *SMBMemoryDeviceFormFactors[] = // Bungo: strings for form factor (Table Type 17 - Memory Device) +{ + "Other", /* 01h */ + "Unknown", /* 02h */ + "SIMM", /* 03h */ + "SIP", /* 04h */ + "Chip", /* 05h */ + "DIP", /* 06h */ + "ZIP", /* 07h */ + "Proprietary Card", /* 08h */ + "DIMM", /* 09h */ + "TSOP", /* 0Ah */ + "Row of chips", /* 0Bh */ + "RIMM", /* 0Ch */ + "SODIMM", /* 0Dh */ + "SRIMM", /* 0Eh */ + "FB-DIMM" /* 0Fh */ +}; + /*===== 7.18.2 ====*/ @@ -382,6 +401,10 @@ } //------------------------------------------------------------------------------------------------------------------------- +// Memory Controller Information (Type 5) +//------------------------------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------------------------------- // Memory Module Information (Type 6) //------------------------------------------------------------------------------------------------------------------------- //void decodeMemoryModule(SMBStructHeader *structHeader) @@ -398,6 +421,22 @@ //} //------------------------------------------------------------------------------------------------------------------------- +// Cache Information (Type 7) +//------------------------------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------------------------------- +// Port Connector Information (Type 8) +//------------------------------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------------------------------- +// System Slot Information (Type 9) +//------------------------------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------------------------------- +// On Board Device Information (Type 10) +//------------------------------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------------------------------- // OEM Strings (Type 11) //------------------------------------------------------------------------------------------------------------------------- void decodeSMBOEMStrings(SMBStructHeader *structHeader) @@ -412,8 +451,19 @@ } DBG("\n"); } +//------------------------------------------------------------------------------------------------------------------------- +// System Configuration Options (Type 12) +//------------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------------- +// BIOS Language Information (Type 13) +//------------------------------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------------------------------- +// Physical Memory Array (Type 16) +//------------------------------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------------------------------- // MemoryDevice (Type 17) //------------------------------------------------------------------------------------------------------------------------- void decodeMemoryDevice(SMBStructHeader *structHeader) @@ -421,11 +471,32 @@ printHeader(structHeader); DBG("Memory Device\n"); // Aray Handle - DBG("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle); + if (((SMBMemoryDevice *)structHeader)->errorHandle == 0xFFFF) { + DBG("\tError Information Handle: No Error\n"); + } else { + DBG("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle); + } // Total Width: // Data Width: -// Size: -// Form Factor: + switch (((SMBMemoryDevice *)structHeader)->memorySize) { + case 0: + DBG("\tSize: No Module Installed\n"); + break; + case 0x7FFF: + DBG("\tSize: 32GB or more\n"); + break; + case 0xFFFF: + DBG("\tSize: Unknown\n"); + break; + default: + DBG("\tSize: %d %s\n", ((SMBMemoryDevice *)structHeader)->memorySize & 0x7FFF, ((((SMBMemoryDevice *)structHeader)->memorySize & 0x8000) == 0x8000) ? "kB" : "MB"); + break; + } + if ((((SMBMemoryDevice *)structHeader)->formFactor < 0x01) || (((SMBMemoryDevice *)structHeader)->formFactor > 0x0F)) { + DBG("\tForm Factor: %s\n", OutOfSpecStr); + } else { + DBG("\tForm Factor: %s\n", SMBMemoryDeviceFormFactors[((SMBMemoryDevice *)structHeader)->formFactor - 1]); + } // Set: DBG("\tLocator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->deviceLocator, neverMask)); DBG("\tBank Locator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->bankLocator, neverMask)); @@ -480,7 +551,7 @@ //} //------------------------------------------------------------------------------------------------------------------------- -// Specific (Type 134) +// Specific (Type 134) //------------------------------------------------------------------------------------------------------------------------- //void decodeOem(SMBStructHeader *structHeader) //{ Index: branches/Chimera/i386/libsaio/smbios.h =================================================================== --- branches/Chimera/i386/libsaio/smbios.h (revision 2657) +++ branches/Chimera/i386/libsaio/smbios.h (revision 2658) @@ -24,8 +24,8 @@ #define __LIBSAIO_SMBIOS_H -/* Based on System Management BIOS Reference Specification v2.5 */ -// http://dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf +/* Based on System Management BIOS Reference Specification v2.4 */ +// http://dmtf.org/standards/smbios typedef uint8_t SMBString; typedef uint8_t SMBByte; @@ -81,24 +81,21 @@ #define SMB_ANCHOR_RESET(x) \ bzero(x, sizeof(typedef struct SMBAnchor)); -/* - ======================= - SMBIOS structure types. - ======================= */ +/* ======================= SMBIOS structure types. ======================= */ enum { kSMBTypeBIOSInformation = 0, // BIOS information (Type 0) kSMBTypeSystemInformation = 1, // System Information (Type 1) - kSMBTypeBaseBoard = 2, // BaseBoard Information (Type 2) + kSMBTypeBaseBoard = 2, // BaseBoard Information (Type 2) kSMBTypeSystemEnclosure = 3, // System Chassis Information (Type 3) - kSMBTypeProcessorInformation = 4, // Processor Information (Type 4) + kSMBTypeProcessorInformation = 4, // Processor Information (Type 4) // Memory Controller Information (Type 5) Obsolete kSMBTypeMemoryModule = 6, // Memory Module Information (Type 6) Obsolete kSMBTypeCacheInformation = 7, // Cache Information (Type 7) // Port Connector Information (Type 8) - kSMBTypeSystemSlot = 9, // System Slots (Type 9) + kSMBTypeSystemSlot = 9, // System Slots (Type 9) // On Board Devices Information (Type 10) Obsolete - kSMBOEMStrings = 11 ,// OEM Strings (Type 11) + kSMBOEMStrings = 11 ,// OEM Strings (Type 11) // System Configuration Options (Type 12) // BIOS Language Information (Type 13) // Group Associations (Type 14) @@ -120,7 +117,7 @@ // Out-of-Band Remote Access (Type 30) // Boot Integrity Service (BIS) Entry Point (Type 31) // System Boot Information (Type 32) - kSMBType64BitMemoryErrorInfo = 33, // 64-Bit Memory Error Information (Type 33) + kSMBType64BitMemoryErrorInfo = 33, // 64-Bit Memory Error Information (Type 33) // Managment Device (Type 34) // Managment Device Component (Type 35) // Management Device Threshold Data (Type 36) @@ -132,19 +129,18 @@ // Management Controlle Host Interface (Type 42) // Inactive (Type 126) - kSMBTypeEndOfTable = 127, // End-of-Table (Type 127) + kSMBTypeEndOfTable = 127, // End-of-Table (Type 127) // Apple Specific Structures kSMBTypeFirmwareVolume = 128, // FirmwareVolume (TYPE 128) - kSMBTypeMemorySPD = 130, // MemorySPD (TYPE 130) + kSMBTypeMemorySPD = 130, // MemorySPD (TYPE 130) kSMBTypeOemProcessorType = 131, // Processor Type (Type 131) - kSMBTypeOemProcessorBusSpeed = 132 // Processor Bus Speed (Type 132) - //kSMBTypeOemPlatformFeature = 133 // Platform Feature (Type 133) + kSMBTypeOemProcessorBusSpeed = 132, // Processor Bus Speed (Type 132) + kSMBTypeOemPlatformFeature = 133 // Platform Feature (Type 133) }; -/* ======================= - BIOS Information (Type 0) - ========================= */ +//---------------------------------------------------------------------------------------------------------- +// Struct - BIOS Information (Type 0) typedef struct SMBBIOSInformation { SMB_STRUCT_HEADER @@ -163,9 +159,8 @@ SMBByte ECreleaseMinor; // Embedded Controller firmware release (minor) } __attribute__((packed)) SMBBIOSInformation; -/* ========================= - System Information (Type 1) - =========================== */ +//---------------------------------------------------------------------------------------------------------- +// Struct - System Information (Type 1) typedef struct SMBSystemInformation { // 2.0+ spec (8 bytes) @@ -182,9 +177,29 @@ SMBString family; } __attribute__((packed)) SMBSystemInformation; -/* ========================================= - Base Board (or Module) Information (Type 2) - =========================================== */ +//---------------------------------------------------------------------------------------------------------- +// Base Board (or Module) Information (Type 2) + +// Base Board - Board Type. +// Values for SMBBaseBoard.boardType +typedef enum +{ + kSMBBaseBoardUnknown = 0x01, // Unknow + kSMBBaseBoardOther = 0x02, // Other + kSMBBaseBoardServerBlade = 0x03, // Server Blade + kSMBBaseBoardConnectivitySwitch = 0x04, // Connectivity Switch + kSMBBaseBoardSystemMgmtModule = 0x05, // System Management Module + kSMBBaseBoardProcessorModule = 0x06, // Processor Module + kSMBBaseBoardIOModule = 0x07, // I/O Module + kSMBBaseBoardMemoryModule = 0x08, // Memory Module + kSMBBaseBoardDaughter = 0x09, // Daughter Board + kSMBBaseBoardMotherboard = 0x0A, // Motherboard (includes processor, memory, and I/O) + kSMBBaseBoardProcessorMemoryModule = 0x0B, // Processor/Memory Module + kSMBBaseBoardProcessorIOModule = 0x0C, // Processor/IO Module + kSMBBaseBoardInterconnect = 0x0D // Interconnect board +} BASE_BOARD_TYPE; + +// Struct - Base Board (or Module) Information (Type 2) typedef struct SMBBaseBoard { SMB_STRUCT_HEADER // Type 2 @@ -196,61 +211,20 @@ SMBByte featureFlags; // Collection of flag that identify features of this baseboard SMBString locationInChassis; SMBWord chassisHandle; - SMBByte boardType; // Type of board + SMBByte boardType; // Type of board, numeration value from BASE_BOARD_TYPE. SMBByte numberOfContainedHandles; -// SMBWord containedObjectHandles[1]; // 0 - 255 contained handles go here but we do not include // them in our structure. Be careful to use numberOfContainedHandles // times sizeof(SMBWord) when computing the actual record size, // if you need it. + SMBByte containedObjectHandles; } __attribute__((packed)) SMBBaseBoard; -/* ==================================== - Values for boardType in Type 2 records - ====================================== */ -enum -{ - kSMBBaseBoardUnknown = 0x01, // Unknow - kSMBBaseBoardOther = 0x02, // Other - kSMBBaseBoardServerBlade = 0x03, // Server Blade - kSMBBaseBoardConnectivitySwitch = 0x04, // Connectivity Switch - kSMBBaseBoardSystemMgmtModule = 0x05, // System Management Module - kSMBBaseBoardProcessorModule = 0x06, // Processor Module - kSMBBaseBoardIOModule = 0x07, // I/O Module - kSMBBaseBoardMemoryModule = 0x08, // Memory Module - kSMBBaseBoardDaughter = 0x09, // Daughter Board - kSMBBaseBoardMotherboard = 0x0A, // Motherboard (includes processor, memory, and I/O) - kSMBBaseBoardProcessorMemoryModule = 0x0B, // Processor/Memory Module - kSMBBaseBoardProcessorIOModule = 0x0C, // Processor/IO Module - kSMBBaseBoardInterconnect = 0x0D // Interconnect board -}; +//---------------------------------------------------------------------------------------------------------- +// System Enclosure (Type 3) -/* ======================= - System Enclosure (Type 3) - ========================= */ -typedef struct SMBSystemEnclosure -{ - SMB_STRUCT_HEADER // Type 3 - SMBString manufacturer; - SMBByte chassisType; // System Enclosure Indicator - SMBString version; // Board Number? - SMBString serialNumber; - SMBString assetTag; // Bungo: renamed from assetTagNumber folowing convention - SMBByte bootupState; // State of enclosure when when it was last booted - SMBByte powerSupplyState; // State of enclosure's power supply when last booted - SMBByte thermalState; // Thermal state of the enclosure when last booted - SMBByte securityStatus; // Physical security status of the enclosure when last booted - SMBDWord oemDefined; // OEM- or BIOS vendor-specific information - SMBByte height; // Height of the enclosure, in 'U's - SMBByte numberOfPowerCords; // Number of power cords associated with the enclosure or chassis - SMBByte containedElementCount; // Number of Contained Element record that follow, in the range 0 to 255 -// SMBByte containedElementRecord; // Byte leght of each Contained Element record that follow, in the range 0 to 255 -// SMBByte containedElements; // Elements, possibly defined by other SMBIOS structures present in chassis -// SMBString skuNumber; // Number of null-terminated string describing the chassis or enclosure SKU number (2.7+) -} __attribute__((packed)) SMBSystemEnclosure; - // Bungo: values for SMBSystemEnclosure.chassisType -enum { +typedef enum { kSMBchassisOther = 0x01, kSMBchassisUnknown = 0x02, kSMBchassisDesktop = 0x03, @@ -269,18 +243,313 @@ kSMBchassisLunchBox = 0x10, // ... fill up if needed ;-) kSMBchassisBladeEnclosing = 0x1D -}; +} MISC_CHASSIS_TYPE; -/* ============================ - Processor Information (Type 4) - ============================== */ +// System Enclosure or Chassis States. +// values for SMBSystemEnclosure.bootupState +// values for SMBSystemEnclosure.powerSupplyState +// values for SMBSystemEnclosure.thermalState +typedef enum { + kSMBChassisStateOther = 0x01, + kSMBChassisStateUnknown = 0x02, + kSMBChassisStateSafe = 0x03, + kSMBChassisStateWarning = 0x04, + kSMBChassisStateCritical = 0x05, + kSMBChassisStateNonRecoverable = 0x06 +} MISC_CHASSIS_STATE; + +// System Enclosure or Chassis Security Status. +// values for SMBSystemEnclosure.securityStatus +typedef enum { + kSMBChassisSecurityStatusOther = 0x01, + kSMBChassisSecurityStatusUnknown = 0x02, + kSMBChassisSecurityStatusNone = 0x03, + kSMBChassisSecurityStatusExternalInterfaceLockedOut = 0x04, + kSMBChassisSecurityStatusExternalInterfaceLockedEnabled = 0x05 +} MISC_CHASSIS_SECURITY_STATE; + +// Struct - System Enclosure (Type 3) +typedef struct SMBSystemEnclosure +{ + SMB_STRUCT_HEADER // Type 3 + SMBString manufacturer; + SMBByte chassisType; // System Enclosure Indicator + SMBString version; // Board Number? + SMBString serialNumber; + SMBString assetTag; // Bungo: renamed from assetTagNumber folowing convention + SMBByte bootupState; // State of enclosure when when it was last booted + SMBByte powerSupplyState; // State of enclosure's power supply when last booted + SMBByte thermalState; // Thermal state of the enclosure when last booted + SMBByte securityStatus; // Physical security status of the enclosure when last booted + SMBDWord oemDefined; // OEM- or BIOS vendor-specific information + SMBByte height; // Height of the enclosure, in 'U's + SMBByte numberOfPowerCords; // Number of power cords associated with the enclosure or chassis + SMBByte containedElementCount; // Number of Contained Element record that follow, in the range 0 to 255 + // SMBByte containedElementRecord; // Byte leght of each Contained Element record that follow, in the range 0 to 255 + // SMBByte containedElements; // Elements, possibly defined by other SMBIOS structures present in chassis + // SMBString skuNumber; // Number of null-terminated string describing the chassis or enclosure SKU number (2.7+) +} __attribute__((packed)) SMBSystemEnclosure; + +//---------------------------------------------------------------------------------------------------------- +// Processor Information (Type 4) +#define kSMBProcessorInformationMinSize 26 + +// Processor Information - Processor Type. +// Values for SMBProcessorInformation.processorType +typedef enum +{ + kSMBprocessorTypeOther = 0x01, + kSMBprocessorTypeUnknown = 0x02, + kSMBprocessorTypeCPU = 0x03, + kSMBprocessorTypeMPU = 0x04, + kSMBprocessorTypeDSP = 0x05, + kSMBprocessorTypeGPU = 0x06 +} PROCESSOR_TYPE_DATA; + +// Processor Information - Processor Family. +// Values for SMBProcessorInformation.processorFamily +typedef enum { + kSMBprocessorFamilyOther = 0x01, + kSMBprocessorFamilyUnknown = 0x02, + kSMBprocessorFamily8086 = 0x03, + kSMBprocessorFamily80286 = 0x04, + kSMBprocessorFamilyIntel386 = 0x05, + kSMBprocessorFamilyIntel486 = 0x06, + kSMBprocessorFamily8087 = 0x07, + kSMBprocessorFamily80287 = 0x08, + kSMBprocessorFamily80387 = 0x09, + kSMBprocessorFamily80487 = 0x0A, + kSMBprocessorFamilyPentium = 0x0B, + kSMBprocessorFamilyPentiumPro = 0x0C, + kSMBprocessorFamilyPentiumII = 0x0D, + kSMBprocessorFamilyPentiumMMX = 0x0E, + kSMBprocessorFamilyCeleron = 0x0F, + kSMBprocessorFamilyPentiumIIXeon = 0x10, + kSMBprocessorFamilyPentiumIII = 0x11, + kSMBprocessorFamilyM1 = 0x12, + kSMBprocessorFamilyM2 = 0x13, + kSMBprocessorFamilyIntelCeleronM = 0x14, + kSMBprocessorFamilyIntelPentium4Ht = 0x15, + kSMBprocessorFamilyM1Reserved4 = 0x16, + kSMBprocessorFamilyM1Reserved5 = 0x17, + kSMBprocessorFamilyAmdDuron = 0x18, + kSMBprocessorFamilyK5 = 0x19, + kSMBprocessorFamilyK6 = 0x1A, + kSMBprocessorFamilyK6_2 = 0x1B, + kSMBprocessorFamilyK6_3 = 0x1C, + kSMBprocessorFamilyAmdAthlon = 0x1D, + kSMBprocessorFamilyAmd29000 = 0x1E, + kSMBprocessorFamilyK6_2Plus = 0x1F, + kSMBprocessorFamilyPowerPC = 0x20, + kSMBprocessorFamilyPowerPC601 = 0x21, + kSMBprocessorFamilyPowerPC603 = 0x22, + kSMBprocessorFamilyPowerPC603Plus = 0x23, + kSMBprocessorFamilyPowerPC604 = 0x24, + kSMBprocessorFamilyPowerPC620 = 0x25, + kSMBprocessorFamilyPowerPCx704 = 0x26, + kSMBprocessorFamilyPowerPC750 = 0x27, + kSMBprocessorFamilyIntelCoreDuo = 0x28, + kSMBprocessorFamilyIntelCoreDuoMobile = 0x29, + kSMBprocessorFamilyIntelCoreSoloMobile = 0x2A, + kSMBprocessorFamilyIntelAtom = 0x2B, + kSMBprocessorFamilyAlpha3 = 0x30, + kSMBprocessorFamilyAlpha21064 = 0x31, + kSMBprocessorFamilyAlpha21066 = 0x32, + kSMBprocessorFamilyAlpha21164 = 0x33, + kSMBprocessorFamilyAlpha21164PC = 0x34, + kSMBprocessorFamilyAlpha21164a = 0x35, + kSMBprocessorFamilyAlpha21264 = 0x36, + kSMBprocessorFamilyAlpha21364 = 0x37, + kSMBprocessorFamilyAmdTurionIIUltraDualCoreMobileM = 0x38, + kSMBprocessorFamilyAmdTurionIIDualCoreMobileM = 0x39, + kSMBprocessorFamilyAmdAthlonIIDualCoreM = 0x3A, + kSMBprocessorFamilyAmdOpteron6100Series = 0x3B, + kSMBprocessorFamilyAmdOpteron4100Series = 0x3C, + kSMBprocessorFamilyAmdOpteron6200Series = 0x3D, + kSMBprocessorFamilyAmdOpteron4200Series = 0x3E, + kSMBprocessorFamilyMips = 0x40, + kSMBprocessorFamilyMIPSR4000 = 0x41, + kSMBprocessorFamilyMIPSR4200 = 0x42, + kSMBprocessorFamilyMIPSR4400 = 0x43, + kSMBprocessorFamilyMIPSR4600 = 0x44, + kSMBprocessorFamilyMIPSR10000 = 0x45, + kSMBprocessorFamilyAmdCSeries = 0x46, + kSMBprocessorFamilyAmdESeries = 0x47, + kSMBprocessorFamilyAmdSSeries = 0x48, + kSMBprocessorFamilyAmdGSeries = 0x49, + kSMBprocessorFamilySparc = 0x50, + kSMBprocessorFamilySuperSparc = 0x51, + kSMBprocessorFamilymicroSparcII = 0x52, + kSMBprocessorFamilymicroSparcIIep = 0x53, + kSMBprocessorFamilyUltraSparc = 0x54, + kSMBprocessorFamilyUltraSparcII = 0x55, + kSMBprocessorFamilyUltraSparcIIi = 0x56, + kSMBprocessorFamilyUltraSparcIII = 0x57, + kSMBprocessorFamilyUltraSparcIIIi = 0x58, + kSMBprocessorFamily68040 = 0x60, + kSMBprocessorFamily68xxx = 0x61, + kSMBprocessorFamily68000 = 0x62, + kSMBprocessorFamily68010 = 0x63, + kSMBprocessorFamily68020 = 0x64, + kSMBprocessorFamily68030 = 0x65, + kSMBprocessorFamilyHobbit = 0x70, + kSMBprocessorFamilyCrusoeTM5000 = 0x78, + kSMBprocessorFamilyCrusoeTM3000 = 0x79, + kSMBprocessorFamilyEfficeonTM8000 = 0x7A, + kSMBprocessorFamilyWeitek = 0x80, + kSMBprocessorFamilyItanium = 0x82, + kSMBprocessorFamilyAmdAthlon64 = 0x83, + kSMBprocessorFamilyAmdOpteron = 0x84, + kSMBprocessorFamilyAmdSempron = 0x85, + kSMBprocessorFamilyAmdTurion64Mobile = 0x86, + kSMBprocessorFamilyDualCoreAmdOpteron = 0x87, + kSMBprocessorFamilyAmdAthlon64X2DualCore = 0x88, + kSMBprocessorFamilyAmdTurion64X2Mobile = 0x89, + kSMBprocessorFamilyQuadCoreAmdOpteron = 0x8A, + kSMBprocessorFamilyThirdGenerationAmdOpteron = 0x8B, + kSMBprocessorFamilyAmdPhenomFxQuadCore = 0x8C, + kSMBprocessorFamilyAmdPhenomX4QuadCore = 0x8D, + kSMBprocessorFamilyAmdPhenomX2DualCore = 0x8E, + kSMBprocessorFamilyAmdAthlonX2DualCore = 0x8F, + kSMBprocessorFamilyPARISC = 0x90, + kSMBprocessorFamilyPaRisc8500 = 0x91, + kSMBprocessorFamilyPaRisc8000 = 0x92, + kSMBprocessorFamilyPaRisc7300LC = 0x93, + kSMBprocessorFamilyPaRisc7200 = 0x94, + kSMBprocessorFamilyPaRisc7100LC = 0x95, + kSMBprocessorFamilyPaRisc7100 = 0x96, + kSMBprocessorFamilyV30 = 0xA0, + kSMBprocessorFamilyQuadCoreIntelXeon3200Series = 0xA1, + kSMBprocessorFamilyDualCoreIntelXeon3000Series = 0xA2, + kSMBprocessorFamilyQuadCoreIntelXeon5300Series = 0xA3, + kSMBprocessorFamilyDualCoreIntelXeon5100Series = 0xA4, + kSMBprocessorFamilyDualCoreIntelXeon5000Series = 0xA5, + kSMBprocessorFamilyDualCoreIntelXeonLV = 0xA6, + kSMBprocessorFamilyDualCoreIntelXeonULV = 0xA7, + kSMBprocessorFamilyDualCoreIntelXeon7100Series = 0xA8, + kSMBprocessorFamilyQuadCoreIntelXeon5400Series = 0xA9, + kSMBprocessorFamilyQuadCoreIntelXeon = 0xAA, + kSMBprocessorFamilyDualCoreIntelXeon5200Series = 0xAB, + kSMBprocessorFamilyDualCoreIntelXeon7200Series = 0xAC, + kSMBprocessorFamilyQuadCoreIntelXeon7300Series = 0xAD, + kSMBprocessorFamilyQuadCoreIntelXeon7400Series = 0xAE, + kSMBprocessorFamilyMultiCoreIntelXeon7400Series = 0xAF, + kSMBprocessorFamilyPentiumIIIXeon = 0xB0, + kSMBprocessorFamilyPentiumIIISpeedStep = 0xB1, + kSMBprocessorFamilyPentium4 = 0xB2, + kSMBprocessorFamilyIntelXeon = 0xB3, + kSMBprocessorFamilyAS400 = 0xB4, + kSMBprocessorFamilyIntelXeonMP = 0xB5, + kSMBprocessorFamilyAMDAthlonXP = 0xB6, + kSMBprocessorFamilyAMDAthlonMP = 0xB7, + kSMBprocessorFamilyIntelItanium2 = 0xB8, + kSMBprocessorFamilyIntelPentiumM = 0xB9, + kSMBprocessorFamilyIntelCeleronD = 0xBA, + kSMBprocessorFamilyIntelPentiumD = 0xBB, + kSMBprocessorFamilyIntelPentiumEx = 0xBC, + kSMBprocessorFamilyIntelCoreSolo = 0xBD, ///< SMBIOS spec 2.6 correct this value + kSMBprocessorFamilyReserved = 0xBE, + kSMBprocessorFamilyIntelCore2 = 0xBF, + kSMBprocessorFamilyIntelCore2Solo = 0xC0, + kSMBprocessorFamilyIntelCore2Extreme = 0xC1, + kSMBprocessorFamilyIntelCore2Quad = 0xC2, + kSMBprocessorFamilyIntelCore2ExtremeMobile = 0xC3, + kSMBprocessorFamilyIntelCore2DuoMobile = 0xC4, + kSMBprocessorFamilyIntelCore2SoloMobile = 0xC5, + kSMBprocessorFamilyIntelCoreI7 = 0xC6, + kSMBprocessorFamilyDualCoreIntelCeleron = 0xC7, + kSMBprocessorFamilyIBM390 = 0xC8, + kSMBprocessorFamilyG4 = 0xC9, + kSMBprocessorFamilyG5 = 0xCA, + kSMBprocessorFamilyG6 = 0xCB, + kSMBprocessorFamilyzArchitectur = 0xCC, + kSMBprocessorFamilyIntelCoreI5 = 0xCD, + kSMBprocessorFamilyIntelCoreI3 = 0xCE, + kSMBprocessorFamilyViaC7M = 0xD2, + kSMBprocessorFamilyViaC7D = 0xD3, + kSMBprocessorFamilyViaC7 = 0xD4, + kSMBprocessorFamilyViaEden = 0xD5, + kSMBprocessorFamilyMultiCoreIntelXeon = 0xD6, + kSMBprocessorFamilyDualCoreIntelXeon3Series = 0xD7, + kSMBprocessorFamilyQuadCoreIntelXeon3Series = 0xD8, + kSMBprocessorFamilyViaNano = 0xD9, + kSMBprocessorFamilyDualCoreIntelXeon5Series = 0xDA, + kSMBprocessorFamilyQuadCoreIntelXeon5Series = 0xDB, + kSMBprocessorFamilyDualCoreIntelXeon7Series = 0xDD, + kSMBprocessorFamilyQuadCoreIntelXeon7Series = 0xDE, + kSMBprocessorFamilyMultiCoreIntelXeon7Series = 0xDF, + kSMBprocessorFamilyMultiCoreIntelXeon3400Series = 0xE0, + kSMBprocessorFamilyEmbeddedAmdOpteronQuadCore = 0xE6, + kSMBprocessorFamilyAmdPhenomTripleCore = 0xE7, + kSMBprocessorFamilyAmdTurionUltraDualCoreMobile = 0xE8, + kSMBprocessorFamilyAmdTurionDualCoreMobile = 0xE9, + kSMBprocessorFamilyAmdAthlonDualCore = 0xEA, + kSMBprocessorFamilyAmdSempronSI = 0xEB, + kSMBprocessorFamilyAmdPhenomII = 0xEC, + kSMBprocessorFamilyAmdAthlonII = 0xED, + kSMBprocessorFamilySixCoreAmdOpteron = 0xEE, + kSMBprocessorFamilyAmdSempronM = 0xEF, + kSMBprocessorFamilyi860 = 0xFA, + kSMBprocessorFamilyi960 = 0xFB, + kSMBprocessorFamilyIndicatorFamily2 = 0xFE, + kSMBprocessorFamilyReserved1 = 0xFF +} PROCESSOR_FAMILY_DATA; + +// Processor Information - Processor Upgrade. +// Values for SMBProcessorInformation.processorUpgrade +typedef enum { + kSMBprocessorUpgradeOther = 0x01, + kSMBprocessorUpgradeUnknown = 0x02, + kSMBprocessorUpgradeDaughterBoard = 0x03, + kSMBprocessorUpgradeZIFSocket = 0x04, + kSMBprocessorUpgradePiggyBack = 0x05, ///< Replaceable. + kSMBprocessorUpgradeNone = 0x06, + kSMBprocessorUpgradeLIFSocket = 0x07, + kSMBprocessorUpgradeSlot1 = 0x08, + kSMBprocessorUpgradeSlot2 = 0x09, + kSMBprocessorUpgrade370PinSocket = 0x0A, + kSMBprocessorUpgradeSlotA = 0x0B, + kSMBprocessorUpgradeSlotM = 0x0C, + kSMBprocessorUpgradeSocket423 = 0x0D, + kSMBprocessorUpgradeSocketA = 0x0E, ///< Socket 462. + kSMBprocessorUpgradeSocket478 = 0x0F, + kSMBprocessorUpgradeSocket754 = 0x10, + kSMBprocessorUpgradeSocket940 = 0x11, + kSMBprocessorUpgradeSocket939 = 0x12, + kSMBprocessorUpgradeSocketmPGA604 = 0x13, + kSMBprocessorUpgradeSocketLGA771 = 0x14, + kSMBprocessorUpgradeSocketLGA775 = 0x15, + kSMBprocessorUpgradeSocketS1 = 0x16, + kSMBprocessorUpgradeAM2 = 0x17, + kSMBprocessorUpgradeF1207 = 0x18, + kSMBprocessorUpgradeSocketLGA1366 = 0x19, + kSMBprocessorUpgradeSocketG34 = 0x1A, + kSMBprocessorUpgradeSocketAM3 = 0x1B, + kSMBprocessorUpgradeSocketC32 = 0x1C, + kSMBprocessorUpgradeSocketLGA1156 = 0x1D, + kSMBprocessorUpgradeSocketLGA1567 = 0x1E, + kSMBprocessorUpgradeSocketPGA988A = 0x1F, + kSMBprocessorUpgradeSocketBGA1288 = 0x20, + kSMBprocessorUpgradeSocketrPGA988B = 0x21, + kSMBprocessorUpgradeSocketBGA1023 = 0x22, + kSMBprocessorUpgradeSocketBGA1224 = 0x23, + kSMBprocessorUpgradeSocketBGA1155 = 0x24, + kSMBprocessorUpgradeSocketLGA1356 = 0x25, + kSMBprocessorUpgradeSocketLGA2011 = 0x26, + kSMBprocessorUpgradeSocketFS1 = 0x27, + kSMBprocessorUpgradeSocketFS2 = 0x28, + kSMBprocessorUpgradeSocketFM1 = 0x29, + kSMBprocessorUpgradeSocketFM2 = 0x2A +} PROCESSOR_UPGRADE; + +// Struct - Processor Information (Type 4). typedef struct SMBProcessorInformation { // 2.0+ spec (26 bytes) SMB_STRUCT_HEADER // Type 4 SMBString socketDesignation; - SMBByte processorType; // CPU = 3 - SMBByte processorFamily; // processor family enum + SMBByte processorType; // The enumeration value from PROCESSOR_TYPE_DATA. + SMBByte processorFamily; // The enumeration value from PROCESSOR_FAMILY_DATA. SMBString manufacturer; SMBQWord processorID; // based on CPUID SMBString processorVersion; @@ -289,7 +558,7 @@ SMBWord maximumClock; // max internal clock in MHz SMBWord currentClock; // current internal clock in MHz SMBByte status; - SMBByte processorUpgrade; // processor upgrade enum + SMBByte processorUpgrade; // The enumeration value from PROCESSOR_UPGRADE. // 2.1+ spec (32 bytes) SMBWord L1CacheHandle; SMBWord L2CacheHandle; @@ -307,24 +576,8 @@ // SMBWord processorFamily2; } __attribute__((packed)) SMBProcessorInformation; -#define kSMBProcessorInformationMinSize 26 - -/* ======================================== - Values for processorType in Type 4 records - ======================================== */ -enum -{ - kSMBprocessorTypeOther = 0x01, - kSMBprocessorTypeUnknown = 0x02, - kSMBprocessorTypeCPU = 0x03, - kSMBprocessorTypeMPU = 0x04, - kSMBprocessorTypeDSP = 0x05, - kSMBprocessorTypeGPU = 0x06 -}; - -/* ====================================================================== - Memory Controller Information (Type 5) Obsolete since SMBIOS version 2.1 - ======================================================================== */ +//---------------------------------------------------------------------------------------------------------- +// Struct - Memory Controller Information (Type 5) Obsolete since SMBIOS version 2.1 typedef struct SMBMemoryControllerInfo { SMB_STRUCT_HEADER SMBByte errorDetectingMethod; @@ -338,9 +591,8 @@ SMBByte numberOfMemorySlots; } __attribute__((packed)) SMBMemoryControllerInfo; -/* ================================================================== - Memory Module Information (Type 6) Obsolete since SMBIOS version 2.1 - ==================================================================== */ +//---------------------------------------------------------------------------------------------------------- +// Struct - Memory Module Information (Type 6) Obsolete since SMBIOS version 2.1 typedef struct SMBMemoryModule { SMB_STRUCT_HEADER // Type 6 @@ -357,9 +609,8 @@ #define kSMBMemoryModuleSizeNotEnabled 0x7E #define kSMBMemoryModuleSizeNotInstalled 0x7F -/* ======================== - Cache Information (Type 7) - ========================== */ +//---------------------------------------------------------------------------------------------------------- +// Struct - Cache Information (Type 7) typedef struct SMBCacheInformation { SMB_STRUCT_HEADER // Type 7 @@ -375,9 +626,8 @@ SMBByte associativity; } __attribute__((packed)) SMBCacheInformation; -/* =================== - System Slots (Type 9) - ===================== */ +//---------------------------------------------------------------------------------------------------------- +// Struct - System Slots (Type 9) typedef struct SMBSystemSlot { // 2.0+ spec (12 bytes) @@ -397,36 +647,20 @@ // SMBByte deviceFunctionNumber; } __attribute__((packed)) SMBSystemSlot; -/* =================== - OEM Strings (Type 11) - ===================== */ +//---------------------------------------------------------------------------------------------------------- +// Struct - OEM Strings (Type 11) typedef struct SMBOEMStrings { SMB_STRUCT_HEADER // Type 11 SMBByte count; // number of strings } __attribute__((packed)) SMBOEMStrings; -/* ============================= - Physical Memory Array (Type 16) - =============================== */ -typedef struct SMBPhysicalMemoryArray -{ - // 2.1+ spec (15 bytes) - SMB_STRUCT_HEADER // Type 16 - SMBByte physicalLocation; // physical location - SMBByte arrayUse; // the use for the memory array - SMBByte errorCorrection; // error correction/detection method - SMBDWord maximumCapacity; // maximum memory capacity in kilobytes - SMBWord errorHandle; // handle of a previously detected error - SMBWord numMemoryDevices; // number of memory slots or sockets - // 2.7+ spec -// SMBQWord extMaximumCapacity; // maximum memory capacity in bytes -} __attribute__((packed)) SMBPhysicalMemoryArray; +//---------------------------------------------------------------------------------------------------------- +// Physical Memory Array (Type 16) -/* ================ - Memory Array - Use - ================== */ -enum +// Physical Memory Array - Use. +// Values for SMBPhysicalMemoryArray.arrayUse +typedef enum { kSMBMemoryArrayUseOther = 0x01, kSMBMemoryArrayUseUnknown = 0x02, @@ -435,12 +669,11 @@ kSMBMemoryArrayUseFlashMemory = 0x05, kSMBMemoryArrayUseNonVolatileMemory = 0x06, kSMBMemoryArrayUseCacheMemory = 0x07 -}; +} MEMORY_ARRAY_USE; -/* =================================== - Memory Array - Error Correction Types - ===================================== */ -enum +// Physical Memory Array - Error Correction Types. +// Values for SMBPhysicalMemoryArray.errorCorrection +typedef enum { kSMBMemoryArrayErrorCorrectionTypeOther = 0x01, kSMBMemoryArrayErrorCorrectionTypeUnknown = 0x02, @@ -449,11 +682,25 @@ kSMBMemoryArrayErrorCorrectionTypeSingleBitECC = 0x05, kSMBMemoryArrayErrorCorrectionTypeMultiBitECC = 0x06, kSMBMemoryArrayErrorCorrectionTypeCRC = 0x07 -}; +} MEMORY_ERROR_CORRECTION; -/* ===================== - Memory Device (Type 17) - ======================= */ +// Struct - Physical Memory Array (Type 16) +typedef struct SMBPhysicalMemoryArray +{ + // 2.1+ spec (15 bytes) + SMB_STRUCT_HEADER // Type 16 + SMBByte physicalLocation; // physical location + SMBByte arrayUse; // the use for the memory array, The enumeration value from MEMORY_ARRAY_USE. + SMBByte errorCorrection; // error correction/detection method, The enumeration value from MEMORY_ERROR_CORRECTION. + SMBDWord maximumCapacity; // maximum memory capacity in kilobytes + SMBWord errorHandle; // handle of a previously detected error + SMBWord numMemoryDevices; // number of memory slots or sockets + // 2.7+ spec + // SMBQWord extMaximumCapacity; // maximum memory capacity in bytes +} __attribute__((packed)) SMBPhysicalMemoryArray; + +//---------------------------------------------------------------------------------------------------------- +// Struct - Memory Device (Type 17) typedef struct SMBMemoryDevice { // 2.1+ spec (21 bytes) @@ -486,9 +733,9 @@ // SMBWord configuredVolt; } __attribute__((packed)) SMBMemoryDevice; -/* =================================== - Memory Array Mapped Address (Type 19) - ===================================== */ +//---------------------------------------------------------------------------------------------------------- + +// Struct - Memory Array Mapped Address (Type 19) //typedef struct SMBMemoryArrayMappedAddress //{ // 2.1+ spec @@ -502,9 +749,9 @@ // SMBQWord extEndAddress; //} __attribute__((packed)) SMBMemoryArrayMappedAddress; -/* ==================================== - Memory Device Mapped Address (Type 20) - ====================================== */ +//---------------------------------------------------------------------------------------------------------- + +// Struct - Memory Device Mapped Address (Type 20) //typedef struct SMBMemoryDeviceMappedAddress //{ // 2.1+ spec @@ -520,9 +767,8 @@ // SMBQWord extEndAddress; //} __attribute__((packed)) SMBMemoryDeviceMappedAddress; -/* ===================================================== - Firmware Volume Description (Apple Specific - Type 128) - ======================================================= */ +//---------------------------------------------------------------------------------------------------------- +// Firmware Volume Description (Apple Specific - Type 128) enum { FW_REGION_RESERVED = 0, @@ -541,9 +787,7 @@ SMBDWord EndAddress; } __attribute__((packed)) FW_REGION_INFO; -/* ======== - (Type 128) - ========== */ +// Struct - Firmware Volume Description (Apple Specific - Type 128) typedef struct SMBFirmwareVolume { SMB_STRUCT_HEADER // Type 128 @@ -555,6 +799,8 @@ FW_REGION_INFO FlashMap[ NUM_FLASHMAP_ENTRIES ]; } __attribute__((packed)) SMBFirmwareVolume; +//---------------------------------------------------------------------------------------------------------- + /* =========================================== Memory SPD Data (Apple Specific - Type 130) ============================================= */ @@ -564,9 +810,11 @@ SMBWord Type17Handle; SMBWord Offset; SMBWord Size; - SMBWord Data[]; + SMBWord Data[1]; } __attribute__((packed)) SMBMemorySPD; +//---------------------------------------------------------------------------------------------------------- + /* ============================================ OEM Processor Type (Apple Specific - Type 131) ============================================== */ @@ -576,6 +824,8 @@ SMBWord ProcessorType; } __attribute__((packed)) SMBOemProcessorType; +//---------------------------------------------------------------------------------------------------------- + /* ================================================= OEM Processor Bus Speed (Apple Specific - Type 132) =================================================== */ @@ -585,6 +835,8 @@ SMBWord ProcessorBusSpeed; // MT/s unit } __attribute__((packed)) SMBOemProcessorBusSpeed; +//---------------------------------------------------------------------------------------------------------- + /* ============================================== OEM Platform Feature (Apple Specific - Type 133) ================================================ */ Index: branches/Chimera/i386/libsaio/stringTable.c =================================================================== --- branches/Chimera/i386/libsaio/stringTable.c (revision 2657) +++ branches/Chimera/i386/libsaio/stringTable.c (revision 2658) @@ -36,6 +36,8 @@ bool sysConfigValid; +#if UNUSED + /* * Compare a string to a key with quoted characters */ @@ -70,8 +72,6 @@ return 0; } -#if UNUSED - static void eatThru(char val, const char **table_p) { register const char *table = *table_p; Index: branches/Chimera/i386/libsaio/pci.h =================================================================== --- branches/Chimera/i386/libsaio/pci.h (revision 2657) +++ branches/Chimera/i386/libsaio/pci.h (revision 2658) @@ -63,7 +63,7 @@ /* Have pci_addr in the same format as the values written to 0xcf8 * so register accesses can be made easy. */ -#define PCIADDR(bus, dev, func) ((1 << 31) | (bus << 16) | (dev << 11) | (func << 8)) +#define PCIADDR(bus, dev, func) ((1L << 31) | (bus << 16) | (dev << 11) | (func << 8)) #define PCI_ADDR_REG 0xcf8 #define PCI_DATA_REG 0xcfc Index: branches/Chimera/i386/libsaio/saio_types.h =================================================================== --- branches/Chimera/i386/libsaio/saio_types.h (revision 2657) +++ branches/Chimera/i386/libsaio/saio_types.h (revision 2658) @@ -41,13 +41,15 @@ typedef unsigned long entry_t; -typedef struct { +typedef struct +{ unsigned int sectors:8; unsigned int heads:8; unsigned int cylinders:16; } compact_diskinfo_t; -struct driveParameters { +struct driveParameters +{ int cylinders; int sectors; int heads; @@ -77,8 +79,10 @@ /* * BIOS drive information. */ -struct boot_drive_info { - struct drive_params { +struct boot_drive_info +{ + struct drive_params + { unsigned short buf_size; unsigned short info_flags; unsigned long phys_cyls; @@ -100,7 +104,8 @@ unsigned char checksum; } params; - struct drive_dpte { + struct drive_dpte + { unsigned short io_port_base; unsigned short control_port_base; unsigned char head_flags; @@ -120,7 +125,8 @@ } __attribute__((packed)); typedef struct boot_drive_info boot_drive_info_t; -struct driveInfo { +struct driveInfo +{ boot_drive_info_t di; int uses_ebios; @@ -129,7 +135,8 @@ int valid; }; -typedef struct FinderInfo { +typedef struct FinderInfo +{ unsigned char data[16]; } FinderInfo; @@ -205,7 +212,8 @@ }; -enum { +enum +{ kBVFlagPrimary = 0x01, kBVFlagNativeBoot = 0x02, kBVFlagForeignBoot = 0x04, @@ -216,7 +224,8 @@ kBVFlagInstallVolume = 0x80 }; -enum { +enum +{ kBIOSDevTypeFloppy = 0x00, kBIOSDevTypeHardDrive = 0x80, kBIOSDevTypeNetwork = 0xE0, @@ -225,7 +234,8 @@ kBIOSDevMask = 0xFF }; -enum { +enum +{ //KPartitionTypeFAT12 = 0x01, // FAT12 kPartitionTypeHPFS = 0x07, // Mac OS X kPartitionTypeFAT16 = 0x06, // FAT16 @@ -248,7 +258,8 @@ // KernBootStruct device types. -enum { +enum +{ DEV_SD = 0, DEV_HD = 1, DEV_FD = 2, @@ -277,7 +288,8 @@ kBlockDeviceType = kBIOSDevTypeHardDrive }; //gBootFileType_t; -enum { +enum +{ kCursorTypeHidden = 0x0100, kCursorTypeUnderline = 0x0607 }; Index: branches/Chimera/i386/libsaio/md5c.c =================================================================== --- branches/Chimera/i386/libsaio/md5c.c (revision 2657) +++ branches/Chimera/i386/libsaio/md5c.c (revision 2658) @@ -50,8 +50,6 @@ * These notices must be retained in any copies of any part of this * documentation and/or software. * - * $Id: md5c.c,v 1.1 2005/06/24 22:47:12 curtisg Exp $ - * * This code is the same as the code published by RSA Inc. It has been * edited for clarity and style only. */ @@ -151,7 +149,8 @@ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ - if ((context->count[0] += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3)) { + if ((context->count[0] += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3)) + { context->count[1]++; } @@ -161,7 +160,8 @@ /* Transform as many times as possible. */ - if (inputLen >= partLen) { + if (inputLen >= partLen) + { memcpy((void *)&context->buffer[index], (const void *)input, partLen); MD5Transform (context->state, context->buffer); Index: branches/Chimera/i386/libsaio/fake_efi.c =================================================================== --- branches/Chimera/i386/libsaio/fake_efi.c (revision 2657) +++ branches/Chimera/i386/libsaio/fake_efi.c (revision 2658) @@ -93,6 +93,8 @@ EFI_SYSTEM_TABLE_64 *gST64 = NULL; Node *gEfiConfigurationTableNode = NULL; +// ========================================================================== + extern EFI_STATUS addConfigurationTable(EFI_GUID const *pGuid, void *table, char const *alias) { EFI_UINTN i = 0; @@ -146,6 +148,8 @@ return EFI_UNSUPPORTED; } +// ========================================================================== + //Azi: crc32 done in place, on the cases were it wasn't. /*static inline void fixupEfiSystemTableCRC32(EFI_SYSTEM_TABLE_64 *efiSystemTable) { @@ -572,9 +576,9 @@ node = DT__AddChild(node, "efi"); /* Bungo if (archCpuType == CPU_TYPE_I386) { - DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_32_PROP_VALUE), (char*)FIRMWARE_ABI_32_PROP_VALUE); + DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_32_PROP_VALUE), (char*)FIRMWARE_ABI_32_PROP_VALUE); } else { */ - DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_64_PROP_VALUE), (char *)FIRMWARE_ABI_64_PROP_VALUE); + DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_64_PROP_VALUE), (char *)FIRMWARE_ABI_64_PROP_VALUE); // } DT__AddProperty(node, EFI_MODE_PROP, sizeof(EFI_UINT8), (EFI_UINT8 *)&bootArgs->efiMode); Index: branches/Chimera/i386/libsaio/smbios_getters.c =================================================================== --- branches/Chimera/i386/libsaio/smbios_getters.c (revision 2657) +++ branches/Chimera/i386/libsaio/smbios_getters.c (revision 2658) @@ -27,8 +27,8 @@ { switch (Platform.CPU.Model) { - // removes FSB info from system profiler as on real mac's. // sets external clock to 0 + // removes FSB info from system profiler as on real mac's. case CPU_MODEL_SANDYBRIDGE: case CPU_MODEL_IVYBRIDGE_XEON: case CPU_MODEL_IVYBRIDGE: @@ -36,6 +36,9 @@ case CPU_MODEL_HASWELL_SVR: case CPU_MODEL_HASWELL_ULT: case CPU_MODEL_CRYSTALWELL: + case CPU_MODEL_BROADWELL: + case CPU_MODEL_BRODWELL_SVR: + case CPU_MODEL_BRODWELL_MSVR: value->word = 0; break; @@ -163,7 +166,7 @@ if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) { // Intel if (!done) { -/* verbose("CPU is %s, family 0x%x, model 0x%x\n", Platform.CPU.BrandString, (uint32_t)Platform.CPU.Family, (uint32_t)Platform.CPU.Model); */ + verbose("CPU is %s, family 0x%x, model 0x%x\n", Platform.CPU.BrandString, (uint32_t)Platform.CPU.Family, (uint32_t)Platform.CPU.Model); done = true; } // Bungo: fixes Oem Processor Type - better matching IMHO @@ -238,6 +241,9 @@ case CPU_MODEL_SANDYBRIDGE: // 0x2A - Intel Core i3, i5, i7 LGA1155 (32nm) case CPU_MODEL_IVYBRIDGE: // 0x3A - Intel Core i3, i5, i7 LGA1155 (22nm) + case CPU_MODEL_BROADWELL: // 0x3C - Intel Core i3, i5, i7 (14nm) + case CPU_MODEL_BRODWELL_SVR: // 0x4F + case CPU_MODEL_BRODWELL_MSVR: // 0x56 if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { value->word = 0x501; // 1281 - Xeon return true; @@ -312,6 +318,10 @@ static int idx = -1; int map; + if (!bootInfo->memDetect) { + return false; + } + idx++; if (idx < MAX_RAM_SLOTS) { map = Platform.DMI.DIMM[idx]; @@ -322,7 +332,8 @@ } } - return false; + value->byte = 2; // means Unknown + return true; // value->byte = SMB_MEM_TYPE_DDR2; // return true; } @@ -338,6 +349,10 @@ static int idx = -1; int map; + if (!bootInfo->memDetect) { + return false; + } + idx++; if (idx < MAX_RAM_SLOTS) { map = Platform.DMI.DIMM[idx]; @@ -348,7 +363,8 @@ } } - return false; + value->dword = 0; // means Unknown + return true; // value->dword = 800; // return true; } @@ -358,6 +374,10 @@ static int idx = -1; int map; + if (!bootInfo->memDetect) { + return false; + } + idx++; if (idx < MAX_RAM_SLOTS) { map = Platform.DMI.DIMM[idx]; @@ -368,9 +388,6 @@ } } - if (!bootInfo->memDetect) { - return false; - } value->string = NOT_AVAILABLE; return true; } @@ -380,9 +397,13 @@ static int idx = -1; int map; + if (!bootInfo->memDetect) { + return false; + } + idx++; - DBG("getSMBMemoryDeviceSerialNumber index: %d, MAX_RAM_SLOTS: %d\n",idx,MAX_RAM_SLOTS); +// DBG("getSMBMemoryDeviceSerialNumber index: %d, MAX_RAM_SLOTS: %d\n",idx,MAX_RAM_SLOTS); if (idx < MAX_RAM_SLOTS) { map = Platform.DMI.DIMM[idx]; @@ -393,9 +414,6 @@ } } - if (!bootInfo->memDetect) { - return false; - } value->string = NOT_AVAILABLE; return true; } @@ -405,6 +423,10 @@ static int idx = -1; int map; + if (!bootInfo->memDetect) { + return false; + } + idx++; if (idx < MAX_RAM_SLOTS) { map = Platform.DMI.DIMM[idx]; @@ -415,9 +437,6 @@ } } - if (!bootInfo->memDetect) { - return false; - } value->string = NOT_AVAILABLE; return true; } Index: branches/Chimera/i386/libsaio/saio_internal.h =================================================================== --- branches/Chimera/i386/libsaio/saio_internal.h (revision 2657) +++ branches/Chimera/i386/libsaio/saio_internal.h (revision 2658) @@ -81,8 +81,7 @@ /* cache.c */ extern void CacheReset(); extern void CacheInit(CICell ih, long blockSize); -extern long CacheRead(CICell ih, char *buffer, long long offset, - long length, long cache); +extern long CacheRead(CICell ih, char *buffer, long long offset, long length, long cache); /* console.c */ extern bool gVerboseMode; Index: branches/Chimera/i386/boot0/boot0.s =================================================================== --- branches/Chimera/i386/boot0/boot0.s (revision 2657) +++ branches/Chimera/i386/boot0/boot0.s (revision 2658) @@ -92,8 +92,8 @@ ; in LBA 0 (that is, the first block) precedes the ; GUID Partition Table Header to maintain compatibility ; with existing tools that do not understand GPT partition structures. - ; The Protective MBR has the same format as a legacy MBR - ; and contains one partition entry with an OSType set to 0xEE + ; The Protective MBR has the same format as a legacy MBR + ; and contains one partition entry with an OSType set to 0xEE ; reserving the entire space used on the disk by the GPT partitions, ; including all headers. @@ -283,7 +283,7 @@ ; to boot an inactive but boot1h aware HFS+ partition ; by scanning the MBR partition entries again. -.start_scan: +.start_scan: mov cx, kPartCount ; number of partition entries per table .loop: @@ -322,7 +322,7 @@ ; signature check. jmp .tryToBoot -.Pass2: +.Pass2: cmp BYTE [si + part.type], kPartTypeHFS ; In pass 2 we're going to find a HFS+ partition ; equipped with boot1h in its boot record ; regardless if it's active or not. @@ -473,6 +473,7 @@ jmp SHORT initBootLoader .gpt_continue: + add si, bx ; advance SI to next partition entry loop .gpt_loop ; loop through all partition entries @@ -519,7 +520,7 @@ je .checkBootSignature cmp ax, kHFSPCaseSignature ; 'HX' je .checkBootSignature - + ; ; Looking for boot1f32 magic string. ; @@ -535,7 +536,9 @@ cmp WORD [di + kSectorBytes - 2], kBootSignature .exit: + popa + ret @@ -737,7 +740,7 @@ popad ret - + print_nibble: and al, 0x0f add al, '0' Index: branches/Chimera/i386/boot0/boot0hfs.s =================================================================== --- branches/Chimera/i386/boot0/boot0hfs.s (revision 2657) +++ branches/Chimera/i386/boot0/boot0hfs.s (revision 2658) @@ -283,7 +283,7 @@ ; to boot an inactive but boot1h aware HFS+ partition ; by scanning the MBR partition entries again. -.start_scan: +.start_scan: mov cx, kPartCount ; number of partition entries per table .loop: @@ -444,7 +444,7 @@ .gpt_loop: mov eax, [si + gpta.PartitionTypeGUID + kGUIDLastDwordOffs] - + cmp eax, kAppleGUID ; check current GUID Partition for Apple's GUID type je .gpt_ok @@ -519,7 +519,7 @@ je .checkBootSignature cmp ax, kHFSPCaseSignature ; 'HX' je .checkBootSignature - + ; ; Looking for boot1f32 magic string. ; Index: branches/Chimera/i386/boot0/boot0md.s =================================================================== --- branches/Chimera/i386/boot0/boot0md.s (revision 2657) +++ branches/Chimera/i386/boot0/boot0md.s (revision 2658) @@ -306,8 +306,7 @@ DebugChar('P') ; starting new pass push dx ; save dl (boot drive) for next pass - - + .scan_drive: ; @@ -325,34 +324,34 @@ jc .next_pass ; MBR load error - normally because we scanned all drives DebugChar('D') ; starting disk scanning - + ; ; Look for the booter partition in the MBR partition table, ; which is at offset kMBRPartTable. ; mov si, kMBRPartTable ; pointer to partition table call find_boot ; will not return on success - + ; if returns - booter partition is not found - + ; skip scanning of all drives in Pass1 cmp bh, kPass1 je .next_pass - + ; try next drive ; if next drive does not exists - will break on the MBR load error above inc dl jmp short .scan_drive - + .next_pass: ; all drives scanned - move to next pass pop dx ; restore orig boot drive dec bh ; decrement scan pass counter jnz pass_loop ; if not zero - exec next pass - + ; we ran all passes - nothing found - error - + error: DebugChar('E') DebugPause @@ -386,7 +385,8 @@ xor bl, bl ; BL will be set to 1 later in case of ; Protective MBR has been found -.start_scan: + +.start_scan: mov cx, kPartCount ; number of partition entries per table .loop: @@ -418,7 +418,7 @@ ; ; Code may be harder to read because I tried to optimized it for minimum size. ; - + .testPass: DebugChar('t') ; testing partition xor dh, dh ; DH=0 This will be used in Pass3 (partition is active, not HFS+). @@ -499,7 +499,7 @@ DebugChar('G') ; found GPT mov si, di - + ; ; Loading GUID Partition Table Array ; @@ -546,7 +546,7 @@ .gpt_loop: mov eax, [si + gpta.PartitionTypeGUID + kGUIDLastDwordOffs] - + cmp eax, kAppleGUID ; check current GUID Partition for Apple's GUID type je .gpt_ok @@ -623,7 +623,7 @@ je .checkBootSignature cmp ax, kHFSPCaseSignature ; 'HX' je .checkBootSignature - + ; ; Looking for boot1f32 magic string. ; Index: branches/Chimera/i386/boot0/Makefile =================================================================== --- branches/Chimera/i386/boot0/Makefile (revision 2657) +++ branches/Chimera/i386/boot0/Makefile (revision 2658) @@ -17,10 +17,13 @@ all: $(DIRS_NEEDED) $(OBJS) +#To rebuild boot0 if boot0.s is touched +$(SYMROOT)/boot0: boot0.s + $(OBJS): $(SRCROOT)/autoconf.inc - @echo "\t[NASM] $(@F)" + @echo " [NASM] $(@F)" @$(NASM) $(@F).s -o $@ clean-local: - @for o in $(OBJS); do if [ -f "$${o}" ];then echo "\t[RM] $${o}"; fi; done + @for o in $(OBJS); do if [ -f "$${o}" ];then echo " [RM] $${o}"; fi; done @rm -f $(OBJS) Index: branches/Chimera/i386/include/sys/socket.h =================================================================== --- branches/Chimera/i386/include/sys/socket.h (revision 2657) +++ branches/Chimera/i386/include/sys/socket.h (revision 2658) @@ -514,6 +514,7 @@ * peer from lying about its identity. (Note that cmcred_groups[0] * is the effective GID.) */ +#if 0 struct cmsgcred { pid_t cmcred_pid; /* PID of sending process */ uid_t cmcred_uid; /* real UID of sending process */ @@ -523,6 +524,7 @@ gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ }; #endif +#endif #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ /* given pointer to struct cmsghdr, return pointer to data */ Index: branches/Chimera/i386/boot1/Makefile =================================================================== --- branches/Chimera/i386/boot1/Makefile (revision 2657) +++ branches/Chimera/i386/boot1/Makefile (revision 2658) @@ -32,8 +32,11 @@ all: $(DIRS_NEEDED) $(PROGRAMS) +#To rebuild boot1h if boot1h.s is touched +$(SYMROOT)/boot1h: boot1h.s + $(PROGRAMS): $(SRCROOT)/autoconf.inc - @echo "\t[NASM] $(@F)" + @echo " [NASM] $(@F)" @$(NASM) $(@F).s -o $@ install_i386:: all $(INSTALLDIR) @@ -41,5 +44,5 @@ cd $(INSTALLDIR); chmod u+w $(VERSIONED_FILES) clean-local: - @for p in $(PROGRAMS); do if [ -f "$${p}" ];then echo "\t[RM] $${p}"; fi; done + @for p in $(PROGRAMS); do if [ -f "$${p}" ];then echo " [RM] $${p}"; fi; done @rm -f $(PROGRAMS) Index: branches/Chimera/i386/boot1/boot1h.s =================================================================== --- branches/Chimera/i386/boot1/boot1h.s (revision 2657) +++ branches/Chimera/i386/boot1/boot1h.s (revision 2658) @@ -1,7 +1,7 @@ ; Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved. ; ; @APPLE_LICENSE_HEADER_START@ -; +; ; Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights ; Reserved. This file contains Original Code and/or Modifications of ; Original Code as defined in and that are subject to the Apple Public @@ -9,7 +9,7 @@ ; except in compliance with the License. Please obtain a copy of the ; License at http://www.apple.com/publicsource and read it before using ; this file. -; +; ; The Original Code and all software distributed under the License are ; distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, @@ -17,7 +17,7 @@ ; FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the ; License for the specific language governing rights and limitations ; under the License. -; +; ; @APPLE_LICENSE_HEADER_END@ ; ; Partition Boot Loader: boot1h @@ -74,7 +74,7 @@ kBoot1Sector1Addr EQU kBoot1RelocAddr + kSectorBytes ; boot1 load address for sector 1 kHFSPlusBuffer EQU kBoot1Sector1Addr + kSectorBytes ; HFS+ Volume Header address -kBoot2Sectors EQU (480 * 1024 - 512) / kSectorBytes ; max size of 'boot' file in sectors +kBoot2Sectors EQU (480 * 1024 - 512) / kSectorBytes ; max size of 'boot' file in sectors = 448 but I want 472 kBoot2Segment EQU 0x2000 ; boot2 load segment kBoot2Address EQU kSectorBytes ; boot2 load address @@ -335,7 +335,7 @@ mov si, %1 call print_string %endmacro - + %macro LogString 1 mov di, %1 call log_string @@ -352,7 +352,7 @@ %define PutChar(x) %define PrintHex(x) %endif - + ;-------------------------------------------------------------------------- ; Start of text segment. @@ -388,7 +388,7 @@ mov cx, kSectorBytes ; copy 256 words rep movsb ; repeat string move (word) operation pop si - + ; ; Code relocated, jump to startReloc in relocated location. ; @@ -406,7 +406,7 @@ ; Initializing global variables. ; mov eax, [si + part.lba] - mov [gPartLBA], eax ; save the current partition LBA offset + mov [gPartLBA], eax ; save the current partition LBA offset mov [gBIOSDriveNumber], dl ; save BIOS drive number mov WORD [gMallocPtr], mallocStart ; set free space pointer @@ -500,7 +500,7 @@ %if VERBOSE LogString(error_str) %endif - + hang: hlt jmp hang @@ -1058,11 +1058,11 @@ mov bx, [bp + BTree.nodeBuffer + BTNodeDescriptor.numRecords] xchg bh, bl dec bx - + .bsearch: cmp ax, bx ja .checkResult ; jump if lowerBound > upperBound - + mov cx, ax add cx, bx shr cx, 1 ; test index = (lowerBound + upperBound / 2) @@ -1088,7 +1088,7 @@ je .checkResult jl .searchLessThanTrial jg .searchGreaterThanTrial - jmp .bsearch + jmp .bsearch .searchLessThanTrial: mov bx, cx @@ -1099,7 +1099,7 @@ mov ax, cx inc ax ; lowerBound = index + 1 jmp .bsearch - + .checkResult: cmp BYTE [bp + BTree.searchResult], 0 jge .foundKey @@ -1115,7 +1115,7 @@ mov bx, [bx] mov edx, [bx] jmp .readNode - + .exit: cmp BYTE [bp + BTree.searchResult], 0 ret @@ -1183,7 +1183,7 @@ .exit: pop di ; restore address of trialKey -%if UNUSED +%if UNUSED ; ; Print catalog trial key ; @@ -1199,15 +1199,15 @@ .printLoop: lodsw call print_char - loop .printLoop + loop .printLoop .printExit: popad ; ; ; %endif ; UNUSED - -%if UNUSED + +%if UNUSED ; ; Print extent trial key ; @@ -1230,7 +1230,7 @@ pop si ; restore SI call bx ; call key compare proc popad - ret + ret ;-------------------------------------------------------------------------- ; readExtent - read extents from a HFS+ file (multiple extent support) @@ -1300,7 +1300,7 @@ pop ebx jmp .beginExtentBlock - + .continue: mov edx, [di + HFSPlusExtentDescriptor.blockCount] call blockToSector ; ECX = converted current extent's blockCount to sectors @@ -1328,20 +1328,20 @@ mov edx, [di + HFSPlusExtentDescriptor.startBlock] call blockToSector ; ECX = converted to sectors add ecx, eax ; file offset converted to sectors - + push si mov ax, si mov edx, [bp + BTree.readBufferPtr] call readSectors pop si - + add ebx, esi mov ax, si cwde shl ax, 9 ; convert SI (read sector count) to byte unit add [bp + BTree.readBufferPtr], eax sub [bp + BTree.readSize], esi - + jz .exit .nextExtent: Index: branches/Chimera/i386/boot1/boot1hp.s =================================================================== --- branches/Chimera/i386/boot1/boot1hp.s (revision 2657) +++ branches/Chimera/i386/boot1/boot1hp.s (revision 2658) @@ -269,7 +269,7 @@ mov al, 1 ; read HFS+ Volume Header mov edx, kHFSPlusBuffer call readLBA - jc NEAR bios_read_error + jc NEAR bios_read_error ; ; Looking for HFSPlus ('H+') or HFSPlus case-sensitive ('HX') signature. Index: branches/Chimera/i386/klibc/Makefile =================================================================== --- branches/Chimera/i386/klibc/Makefile (revision 2657) +++ branches/Chimera/i386/klibc/Makefile (revision 2658) @@ -34,17 +34,17 @@ $(LIBS): $(OBJS) - @echo "\t[RM] $@" + @echo " [RM] $@" @rm -f $@ - @echo "\t[AR] $(@F)" + @echo " [AR] $(@F)" @ar q $@ $^ &> /dev/null - @echo "\t[RANLIB] $(@F)" + @echo " [RANLIB] $(@F)" @ranlib $@ # dependencies -include $(OBJROOT)/Makedep clean-local: - @for o in $(OBJS); do if [ -f "$${o}" ];then echo "\t[RM] $${o}"; fi; done - @for l in $(LIBS); do if [ -f "$${l}" ];then echo "\t[RM] $${l}"; fi; done + @for o in $(OBJS); do if [ -f "$${o}" ];then echo " [RM] $${o}"; fi; done + @for l in $(LIBS); do if [ -f "$${l}" ];then echo " [RM] $${l}"; fi; done @rm -f $(LIBS) $(OBJS) Index: branches/Chimera/i386/boot2/picopng.c =================================================================== --- branches/Chimera/i386/boot2/picopng.c (revision 2657) +++ branches/Chimera/i386/boot2/picopng.c (revision 2658) @@ -23,7 +23,8 @@ /*************************************************************************************************/ -typedef struct png_alloc_node { +typedef struct png_alloc_node +{ struct png_alloc_node *prev, *next; void *addr; size_t size; @@ -32,32 +33,55 @@ png_alloc_node_t *png_alloc_head = NULL; png_alloc_node_t *png_alloc_tail = NULL; +//============================================================================== + png_alloc_node_t *png_alloc_find_node(void *addr) { png_alloc_node_t *node; + for (node = png_alloc_head; node; node = node->next) + { if (node->addr == addr) + { break; + } + } + return node; } + +//============================================================================== + void png_alloc_add_node(void *addr, size_t size) { png_alloc_node_t *node; + if (png_alloc_find_node(addr)) + { return; - node = malloc(sizeof (png_alloc_node_t)); + } + + node = malloc(sizeof(png_alloc_node_t)); node->addr = addr; node->size = size; node->prev = png_alloc_tail; node->next = NULL; png_alloc_tail = node; + if (node->prev) + { node->prev->next = node; + } + if (!png_alloc_head) + { png_alloc_head = node; + } } +//============================================================================== + void png_alloc_remove_node(png_alloc_node_t *node) { if (!node) { Index: branches/Chimera/i386/boot2/graphics.c =================================================================== --- branches/Chimera/i386/boot2/graphics.c (revision 2657) +++ branches/Chimera/i386/boot2/graphics.c (revision 2658) @@ -20,11 +20,10 @@ * under the License. * * @APPLE_LICENSE_HEADER_END@ + * + * Copyright 1993 NeXT, Inc. All rights reserved. + * */ -/* - * Copyright 1993 NeXT, Inc. - * All rights reserved. - */ #include "boot.h" #include "vbe.h" @@ -50,18 +49,18 @@ { VBEInfoBlock vbeInfo; int err, small; - + bzero( &vbeInfo, sizeof(vbeInfo) ); strcpy( (char*)&vbeInfo, "VBE2" ); err = getVBEInfo( &vbeInfo ); if (err != errSuccess) return 0; - + if ( strncmp( (char *)vbeInfo.VESASignature, "VESA", 4 ) ) return 0; - + small = (vbeInfo.TotalMemory < 16); - + return vbeInfo.TotalMemory * 64 * 1024; } @@ -79,23 +78,24 @@ err = getVBEInfo( &vbeInfo ); if (err != errSuccess) return 0; - + if ( strncmp( (char *)vbeInfo.VESASignature, "VESA", 4 ) ) return 0; - + buff = malloc(sizeof(char) * 256); if (!buff) { return 0; } + small = (vbeInfo.TotalMemory < 16); - + snprintf(buff, 256, - "VESA v%d.%d %d%s (%s)\n", - vbeInfo.VESAVersion >> 8, - vbeInfo.VESAVersion & 0xf, - small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16), - small ? "KB" : "MB", - VBEDecodeFP(const char *, vbeInfo.OEMStringPtr) ); + "VESA v%d.%d %d%s (%s)\n", + vbeInfo.VESAVersion >> 8, + vbeInfo.VESAVersion & 0xf, + small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16), + small ? "KB" : "MB", + VBEDecodeFP(const char *, vbeInfo.OEMStringPtr) ); return buff; } @@ -163,13 +163,15 @@ clearScreenRows(0, 24); setCursorPosition( 0, 0, 1 ); } - } + } if (line != 0) { pause(); } setActiveDisplayPage(0); } +//============================================================================== + char *getVBEModeInfoString() { VBEInfoBlock vbeInfo; @@ -184,7 +186,8 @@ return 0; } char *buff=malloc(sizeof(char)*3072); - if(!buff) { + if(!buff) + { return 0; } @@ -208,7 +211,7 @@ *modePtr, modeInfo.XResolution, modeInfo.YResolution, modeInfo.BitsPerPixel, modeInfo.MemoryModel, modeInfo.ModeAttributes); - } + } return buff; } @@ -219,141 +222,146 @@ // If a mode is not found, then return the "best" available mode. static unsigned short -getVESAModeWithProperties( unsigned short width, - unsigned short height, - unsigned char bitsPerPixel, - unsigned short attributesSet, - unsigned short attributesClear, - VBEModeInfoBlock * outModeInfo, - unsigned short * vesaVersion ) +getVESAModeWithProperties( unsigned short width, + unsigned short height, + unsigned char bitsPerPixel, + unsigned short attributesSet, + unsigned short attributesClear, + VBEModeInfoBlock *outModeInfo, + unsigned short *vesaVersion + ) { - VBEInfoBlock vbeInfo; - unsigned short * modePtr; - VBEModeInfoBlock modeInfo; - unsigned char modeBitsPerPixel; - unsigned short matchedMode = modeEndOfList; - int err; + VBEInfoBlock vbeInfo; + unsigned short * modePtr; + VBEModeInfoBlock modeInfo; + unsigned char modeBitsPerPixel; + unsigned short matchedMode = modeEndOfList; + int err; - // Clear output mode info. + // Clear output mode info. - bzero( outModeInfo, sizeof(*outModeInfo) ); + bzero( outModeInfo, sizeof(*outModeInfo) ); - // Get VBE controller info containing the list of supported modes. + // Get VBE controller info containing the list of supported modes. - bzero( &vbeInfo, sizeof(vbeInfo) ); - strcpy( (char*)&vbeInfo, "VBE2" ); - err = getVBEInfo( &vbeInfo ); - if ( err != errSuccess ) - { - return modeEndOfList; - } + bzero( &vbeInfo, sizeof(vbeInfo) ); + strcpy( (char*)&vbeInfo, "VBE2" ); + err = getVBEInfo( &vbeInfo ); + if ( err != errSuccess ) + { + return modeEndOfList; + } - // Report the VESA major/minor version number. + // Report the VESA major/minor version number. - if (vesaVersion) *vesaVersion = vbeInfo.VESAVersion; + if (vesaVersion) + { + *vesaVersion = vbeInfo.VESAVersion; + } - // Loop through the mode list, and find the matching mode. + // Loop through the mode list, and find the matching mode. - for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); - *modePtr != modeEndOfList; modePtr++ ) - { - // Get mode information. + for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); + *modePtr != modeEndOfList; modePtr++ ) + { + // Get mode information. - bzero( &modeInfo, sizeof(modeInfo) ); - err = getVBEModeInfo( *modePtr, &modeInfo ); - if ( err != errSuccess ) - { - continue; - } + bzero( &modeInfo, sizeof(modeInfo) ); + err = getVBEModeInfo( *modePtr, &modeInfo ); + if ( err != errSuccess ) + { + continue; + } #if DEBUG - printf("Mode %x: %dx%dx%d mm:%d attr:%x\n", + printf("Mode %x: %dx%dx%d mm:%d attr:%x\n", *modePtr, modeInfo.XResolution, modeInfo.YResolution, modeInfo.BitsPerPixel, modeInfo.MemoryModel, modeInfo.ModeAttributes); #endif - // Filter out unwanted modes based on mode attributes. + // Filter out unwanted modes based on mode attributes. - if ( ( ( modeInfo.ModeAttributes & attributesSet ) != attributesSet ) + if ( ( ( modeInfo.ModeAttributes & attributesSet ) != attributesSet ) || ( ( modeInfo.ModeAttributes & attributesClear ) != 0 ) ) - { - continue; - } + { + continue; + } - // Pixel depth in bits. + // Pixel depth in bits. - modeBitsPerPixel = modeInfo.BitsPerPixel; + modeBitsPerPixel = modeInfo.BitsPerPixel; - if ( ( modeBitsPerPixel == 4 ) && ( modeInfo.MemoryModel == 0 ) ) - { - // Text mode, 16 colors. - } - else if ( ( modeBitsPerPixel == 8 ) && ( modeInfo.MemoryModel == 4 ) ) - { - // Packed pixel, 256 colors. - } - else if ( ( ( modeBitsPerPixel == 16 ) || ( modeBitsPerPixel == 15 ) ) - && ( modeInfo.MemoryModel == 6 ) - && ( modeInfo.RedMaskSize == 5 ) - && ( modeInfo.GreenMaskSize == 5 ) - && ( modeInfo.BlueMaskSize == 5 ) ) - { - // Direct color, 16 bpp (1:5:5:5). - modeInfo.BitsPerPixel = modeBitsPerPixel = 16; - } - else if ( ( modeBitsPerPixel == 32 ) - && ( modeInfo.MemoryModel == 6 ) - && ( modeInfo.RedMaskSize == 8 ) - && ( modeInfo.GreenMaskSize == 8 ) - && ( modeInfo.BlueMaskSize == 8 ) ) - { - // Direct color, 32 bpp (8:8:8:8). - } - else - { - continue; // Not a supported mode. - } + if ( ( modeBitsPerPixel == 4 ) && ( modeInfo.MemoryModel == 0 ) ) + { + // Text mode, 16 colors. + } + else if ( ( modeBitsPerPixel == 8 ) && ( modeInfo.MemoryModel == 4 ) ) + { + // Packed pixel, 256 colors. + } + else if ( ( ( modeBitsPerPixel == 16 ) || ( modeBitsPerPixel == 15 ) ) + && ( modeInfo.MemoryModel == 6 ) + && ( modeInfo.RedMaskSize == 5 ) + && ( modeInfo.GreenMaskSize == 5 ) + && ( modeInfo.BlueMaskSize == 5 ) ) + { + // Direct color, 16 bpp (1:5:5:5). + modeInfo.BitsPerPixel = modeBitsPerPixel = 16; + } + else if ( ( modeBitsPerPixel == 32 ) + && ( modeInfo.MemoryModel == 6 ) + && ( modeInfo.RedMaskSize == 8 ) + && ( modeInfo.GreenMaskSize == 8 ) + && ( modeInfo.BlueMaskSize == 8 ) ) + { + // Direct color, 32 bpp (8:8:8:8). + } + else + { + continue; // Not a supported mode. + } - // Modes larger than the specified dimensions are skipped. + // Modes larger than the specified dimensions are skipped. - if ( ( modeInfo.XResolution > width ) || - ( modeInfo.YResolution > height ) ) - { - continue; - } + if ( ( modeInfo.XResolution > width ) || + ( modeInfo.YResolution > height ) ) + { + continue; + } - // Perfect match, we're done looking. + // Perfect match, we're done looking. - if ( ( modeInfo.XResolution == width ) && - ( modeInfo.YResolution == height ) && - ( modeBitsPerPixel == bitsPerPixel ) ) - { - matchedMode = *modePtr; - bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) ); - break; - } + if ( ( modeInfo.XResolution == width ) && + ( modeInfo.YResolution == height ) && + ( modeBitsPerPixel == bitsPerPixel ) ) + { + matchedMode = *modePtr; + bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) ); + break; + } - // Save the next "best" mode in case a perfect match is not found. + // Save the next "best" mode in case a perfect match is not found. - if ( modeInfo.XResolution == outModeInfo->XResolution && - modeInfo.YResolution == outModeInfo->YResolution && - modeBitsPerPixel <= outModeInfo->BitsPerPixel ) - { - continue; // Saved mode has more depth. - } - if ( modeInfo.XResolution < outModeInfo->XResolution || - modeInfo.YResolution < outModeInfo->YResolution || - modeBitsPerPixel < outModeInfo->BitsPerPixel ) - { - continue; // Saved mode has more resolution. - } + if ( modeInfo.XResolution == outModeInfo->XResolution && + modeInfo.YResolution == outModeInfo->YResolution && + modeBitsPerPixel <= outModeInfo->BitsPerPixel ) + { + continue; // Saved mode has more depth. + } - matchedMode = *modePtr; - bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) ); - } + if ( modeInfo.XResolution < outModeInfo->XResolution || + modeInfo.YResolution < outModeInfo->YResolution || + modeBitsPerPixel < outModeInfo->BitsPerPixel ) + { + continue; // Saved mode has more resolution. + } - return matchedMode; + matchedMode = *modePtr; + bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) ); + } + + return matchedMode; } //========================================================================== @@ -506,11 +514,9 @@ return err; } -int -convertImage( unsigned short width, - unsigned short height, - const unsigned char *imageData, - unsigned char **newImageData ) +//============================================================================== + +int convertImage( unsigned short width, unsigned short height, const unsigned char *imageData, unsigned char **newImageData ) { int cnt; unsigned char *img = 0; @@ -525,7 +531,7 @@ img16[cnt] = lookUpCLUTIndex(imageData[cnt], 16); img = (unsigned char *)img16; break; - + case 32 : img32 = malloc(width * height * 4); if ( !img32 ) break; @@ -533,7 +539,7 @@ img32[cnt] = lookUpCLUTIndex(imageData[cnt], 32); img = (unsigned char *)img32; break; - + default : img = malloc(width * height); bcopy(imageData, img, width * height); @@ -543,6 +549,8 @@ return 0; } +//============================================================================== + int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, uint8_t **imageData) { @@ -595,6 +603,8 @@ return error; } +//============================================================================== + int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData) { PNG_info_t *info; int error = 0; @@ -623,6 +633,8 @@ return error; } +//============================================================================== + void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data) { @@ -640,7 +652,7 @@ uint32_t a; // Alpha uint32_t dstrb, dstg, srcrb, srcg, drb, dg, rb, g, tempB; // Intermediate variables uint16_t pos; - + for (pos = 0; pos < drawWidth * 4; pos += 4) { // Fast pseudo-vector alpha blending, adapted from: http://www.stereopsis.com/doubleblend.html s = *((uint32_t*) (data + pos)); @@ -669,7 +681,7 @@ } } break; - + default: /*Universal version*/ { uint32_t s; @@ -677,7 +689,7 @@ uint32_t dr, dg, db, sr, sg, sb; // Intermediate variables uint16_t pos; int bpp = (VIDEO (depth) + 7)/8; - + for (pos = 0; pos < drawWidth; pos ++) { // Fast pseudo-vector alpha blending, adapted from: http://www.stereopsis.com/doubleblend.html s = *((uint32_t*) (data + 4*pos)); @@ -687,7 +699,7 @@ sr = (s & 0xFF); a = (s >> 24) + 1; - + switch (VIDEO (depth)) { case 24: @@ -704,7 +716,7 @@ db = ((*(uint16_t *)(vram + bpp*pos))&0x1f)<<3; dg = ((*(uint16_t *)(vram + bpp*pos))&0x03e0)>>2; dr = ((*(uint16_t *)(vram + bpp*pos))&0x7c00)>>7; - break; + break; default: return; } @@ -725,8 +737,8 @@ *(uint16_t *)(vram + bpp*pos) = ((db&0xf8)>>3) | ((dg&0xf8)<<2) | ((dr&0xf8)<<7); break; } - - } + + } } break; } @@ -735,6 +747,8 @@ } } +//============================================================================== + void drawCheckerBoard() { uint32_t *vram = (uint32_t *) VIDEO(baseAddr); @@ -752,8 +766,7 @@ //========================================================================== // LookUpCLUTIndex -unsigned long lookUpCLUTIndex( unsigned char index, - unsigned char depth ) +unsigned long lookUpCLUTIndex( unsigned char index, unsigned char depth ) { long result, red, green, blue; @@ -787,14 +800,16 @@ void * stosl(void * dst, long val, long len) { - asm volatile ( "rep; stosl" - : "=c" (len), "=D" (dst) - : "0" (len), "1" (dst), "a" (val) - : "memory" ); + asm volatile ( "rep; stosl" + : "=c" (len), "=D" (dst) + : "0" (len), "1" (dst), "a" (val) + : "memory" ); - return dst; + return dst; } +//============================================================================== + void drawColorRectangle( unsigned short x, unsigned short y, unsigned short width, @@ -844,8 +859,9 @@ } } -void -loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or) +//============================================================================== + +void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or) { int x,y, off; int red=0x7f, green=0x7f, blue=0x7f; @@ -862,7 +878,7 @@ red=(val>>7)&0xf8; green=(val>>2)&0xf8; blue=(val<<3)&0xf8; - break; + break; } case 32: { @@ -872,7 +888,7 @@ green=(val>>8)&0xff; blue=(val)&0xff; break; - } + } } char *ptr=(char *)output+x*(op/8)+y*or; switch (op) @@ -889,6 +905,8 @@ } } +//============================================================================== + DECLARE_IOHIBERNATEPROGRESSALPHA void drawPreview(void *src, uint8_t * saveunder) @@ -902,7 +920,7 @@ void *uncomp; int origwidth, origheight, origbpx; uint32_t saveindex[kIOHibernateProgressCount] = { 0 }; - + if (src && (uncomp=DecompressData(src, &origwidth, &origheight, &origbpx))) { if (!setVESAGraphicsMode(origwidth, origheight, origbpx, 0)) @@ -921,15 +939,15 @@ // Set the screen to 75% grey. drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01 /* color index */); } - - + + pixelShift = VIDEO (depth) >> 4; if (pixelShift < 1) return; - + screen += ((VIDEO (width) - kIOHibernateProgressCount * (kIOHibernateProgressWidth + kIOHibernateProgressSpacing)) << (pixelShift - 1)) + (VIDEO (height) - kIOHibernateProgressOriginY - kIOHibernateProgressHeight) * rowBytes; - + for (y = 0; y < kIOHibernateProgressHeight; y++) { out = screen + y * rowBytes; @@ -969,6 +987,8 @@ } } +//============================================================================== + void updateProgressBar(uint8_t * saveunder, int32_t firstBlob, int32_t select) { uint8_t * screen; @@ -978,20 +998,20 @@ uint32_t alpha, in, color, result; uint8_t * out; uint32_t saveindex[kIOHibernateProgressCount] = { 0 }; - + pixelShift = VIDEO(depth) >> 4; if (pixelShift < 1) return; screen = (uint8_t *) VIDEO (baseAddr); rowBytes = VIDEO (rowBytes); - + screen += ((VIDEO (width) - kIOHibernateProgressCount * (kIOHibernateProgressWidth + kIOHibernateProgressSpacing)) << (pixelShift - 1)) + (VIDEO (height) - kIOHibernateProgressOriginY - kIOHibernateProgressHeight) * rowBytes; - + lastBlob = (select < kIOHibernateProgressCount) ? select : (kIOHibernateProgressCount - 1); - + screen += (firstBlob * (kIOHibernateProgressWidth + kIOHibernateProgressSpacing)) << pixelShift; - + for (y = 0; y < kIOHibernateProgressHeight; y++) { out = screen + y * rowBytes; @@ -1028,10 +1048,7 @@ //========================================================================== // setVESATextMode -static int -setVESATextMode( unsigned short cols, - unsigned short rows, - unsigned char bitsPerPixel ) +static int setVESATextMode( unsigned short cols, unsigned short rows, unsigned char bitsPerPixel ) { VBEModeInfoBlock minfo; unsigned short mode = modeEndOfList; @@ -1068,8 +1085,7 @@ //========================================================================== // getNumberArrayFromProperty -static int -getNumberArrayFromProperty( const char * propKey, +static int getNumberArrayFromProperty( const char * propKey, unsigned long numbers[], unsigned long maxArrayCount ) { @@ -1100,11 +1116,13 @@ return count; } +//============================================================================== + int initGraphicsMode () { unsigned long params[4]; int count; - + params[3] = 0; count = getNumberArrayFromProperty( kGraphicsModeKey, params, 4 ); @@ -1122,13 +1140,13 @@ params[1] = gui.screen.height; params[2] = 32; } - + // Map from pixel format to bits per pixel. - + if ( params[2] == 256 ) params[2] = 8; if ( params[2] == 555 ) params[2] = 16; if ( params[2] == 888 ) params[2] = 32; - + return setVESAGraphicsMode( params[0], params[1], params[2], params[3] ); } @@ -1137,8 +1155,7 @@ // // Set the video mode to VGA_TEXT_MODE or GRAPHICS_MODE. -void -setVideoMode( int mode, int drawgraphics) +void setVideoMode( int mode, int drawgraphics) { unsigned long params[4]; int count; @@ -1165,13 +1182,14 @@ params[1] = 25; } - setVESATextMode( params[0], params[1], 4 ); + setVESATextMode( params[0], params[1], 4 ); bootArgs->Video.v_display = VGA_TEXT_MODE; } currentIndicator = 0; } +//============================================================================== void getGraphicModeParams(unsigned long params[]) { params[3] = 0; @@ -1180,7 +1198,7 @@ unsigned short vesaVersion; unsigned short mode = modeEndOfList; - + getNumberArrayFromProperty( kGraphicsModeKey, params, 4); mode = getVESAModeWithProperties( params[0], params[1], params[2], @@ -1190,7 +1208,7 @@ maLinearFrameBufferAvailBit, 0, &minfo, &vesaVersion ); - + params[0] = minfo.XResolution; params[1] = minfo.YResolution; params[2] = 32; @@ -1213,11 +1231,12 @@ // ensure a minimum of 1/9 sec between animation frames. #define MIN_TICKS 2 -void -spinActivityIndicator(int sectors) +//============================================================================== + +void spinActivityIndicator(int sectors) { static unsigned long lastTickTime = 0, currentTickTime; - + if (previewTotalSectors && previewSaveunder) { int blob, lastBlob; @@ -1227,10 +1246,12 @@ blob = (previewLoadedSectors * kIOHibernateProgressCount) / previewTotalSectors; if (blob!=lastBlob) + { updateProgressBar (previewSaveunder, lastBlob, blob); + } return; } - + currentTickTime = time18(); // late binding if (currentTickTime < lastTickTime + MIN_TICKS) { @@ -1240,7 +1261,7 @@ { lastTickTime = currentTickTime; } - + if (getVideoMode() == VGA_TEXT_MODE) { if (currentIndicator >= sizeof(indicator)) @@ -1252,13 +1273,15 @@ } } -void -clearActivityIndicator( void ) +//============================================================================== + +void clearActivityIndicator( void ) { - if ( getVideoMode() == VGA_TEXT_MODE ) - { + if ( getVideoMode() == VGA_TEXT_MODE ) + { putchar(' '); putchar('\b'); - } + } } +//============================================================================== Index: branches/Chimera/i386/boot2/graphics.h =================================================================== --- branches/Chimera/i386/boot2/graphics.h (revision 2657) +++ branches/Chimera/i386/boot2/graphics.h (revision 2658) @@ -1,7 +1,7 @@ /* * graphics.h - * * + * * Created by fassl on 22.12.08. * Copyright 2008 __MyCompanyName__. All rights reserved. * @@ -26,15 +26,12 @@ void drawDataRectangle( unsigned short x, unsigned short y, unsigned short width, unsigned short height, unsigned char * data ); int convertImage( unsigned short width, unsigned short height, const unsigned char *imageData, unsigned char **newImageData ); -int initGraphicsMode (); +int initGraphicsMode(); void drawCheckerBoard(); void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data); -void drawCheckerBoard(); -void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data); - int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData); uint32_t getVBEVideoRam(); Index: branches/Chimera/i386/boot2/mboot.c =================================================================== --- branches/Chimera/i386/boot2/mboot.c (revision 2657) +++ branches/Chimera/i386/boot2/mboot.c (revision 2658) @@ -15,6 +15,8 @@ int multiboot_skip_partition=0; int multiboot_skip_partition_set=0; +void boot(int biosdev); + // Global multiboot info, if using multiboot. struct multiboot_info *gMI; @@ -61,29 +63,7 @@ // would be on the stack which would possibly be using way too much stack. void multiboot_to_boot(int multiboot_magic, struct multiboot_info *mi_orig) { - uint32_t bootdevice = hi_multiboot(multiboot_magic, mi_orig); - if(bootdevice != BAD_BOOT_DEVICE) - { - // boot only returns to do a chain load. - for(;;) - { // NOTE: boot only uses the last byte (the drive number) - common_boot(bootdevice); - if(chainbootflag) - chainLoad(); - else - waitThenReload(); - } - } - // Avoid returning to high-memory address which isn't valid in the segment - // we are now in. - // Calling sleep() ensures the user ought to be able to use Ctrl+Alt+Del - // because the BIOS will have interrupts on. - for(;;) - sleep(10); - // NOTE: *IF* we needed to return we'd have to fix up our return address to - // be in low memory using the same trick as below. - // However, there doesn't seem to be any point in returning to assembly - // particularly when the remaining code merely halts the processor. + hi_multiboot(multiboot_magic, mi_orig); } void chainLoad() @@ -344,6 +324,31 @@ // Since we call multiboot ourselves, its return address will be correct. // That is unless it's inlined in which case it does not matter. uint32_t bootdevice = multiboot(multiboot_magic, mi_p); + + if(bootdevice != BAD_BOOT_DEVICE) + { + // boot only returns to do a chain load. + for(;;) + { // NOTE: boot only uses the last byte (the drive number) + boot(bootdevice); + if(chainbootflag) + chainLoad(); + else + waitThenReload(); + } + } + + // Avoid returning to high-memory address which isn't valid in the segment + // we are now in. + // Calling sleep() ensures the user ought to be able to use Ctrl+Alt+Del + // because the BIOS will have interrupts on. + for(;;) + sleep(10); + // NOTE: *IF* we needed to return we'd have to fix up our return address to + // be in low memory using the same trick as below. + // However, there doesn't seem to be any point in returning to assembly + // particularly when the remaining code merely halts the processor. + // We're about to exit and temporaryBootArgs will no longer be valid bootArgs = NULL; return bootdevice; Index: branches/Chimera/i386/boot2/prompt.c =================================================================== --- branches/Chimera/i386/boot2/prompt.c (revision 2657) +++ branches/Chimera/i386/boot2/prompt.c (revision 2658) @@ -28,10 +28,12 @@ #include - char bootBanner[] = "\nDarwin/x86 boot v" I386BOOT_VERSION " - Chameleon v" I386BOOT_CHAMELEONVERSION " r" I386BOOT_CHAMELEONREVISION "\n" +/*char bootBanner[] = "\nDarwin/x86 boot v" I386BOOT_VERSION " - Chameleon v" I386BOOT_CHAMELEONVERSION " r" I386BOOT_CHAMELEONREVISION "\n" "Build date: " I386BOOT_BUILDDATE "\n" - "%dMB memory\n"; + "%dMB memory\n";*/ +char bootBanner[] = "\nDarwin/x86 boot v" I386BOOT_VERSION " - Chimera v4.1.0\n" "Build date: " I386BOOT_BUILDDATE "\n" "%dMB memory\n"; + char bootPrompt[] = "Press Enter to start up Darwin/x86 with no options, or you can:\n" " Type -v and press Enter to start up with diagnostic messages\n" Index: branches/Chimera/i386/boot2/Makefile =================================================================== --- branches/Chimera/i386/boot2/Makefile (revision 2657) +++ branches/Chimera/i386/boot2/Makefile (revision 2658) @@ -82,7 +82,7 @@ @${MKDIRS} $(OBJROOT)/../boot2_modules/ @### First pass, don't worry abount segment alignment. - @echo "\t[LD] boot.sys" + @echo " [LD] boot.sys" @$(CC) -Wl,-preload -Wl,-alias,boot2,start \ -nostdlib -arch i386 -Wl,-pie \ -Wl,-read_only_relocs,suppress \ @@ -94,10 +94,10 @@ ifeq (${CONFIG_MODULES}, y) @# Generate the Symbols.dylib file - @echo "\t[dyldsymboltool] Symbols.dylib" + @echo " [dyldsymboltool] Symbols.dylib" @$(SYMROOT)/dyldsymboltool $(SYMROOT)/boot.sys $(SYMROOT)/${SYMBOLS_MODULE} - @echo "\t[LD] boot.sys" + @echo " [LD] boot.sys" @$(CC) -Wl,-preload -Wl,-alias,boot2,start \ -nostdlib -arch i386 -Wl,-pie \ -Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \ @@ -114,10 +114,10 @@ @${RM} $(SYMROOT)/${SYMBOLS_MODULE} @# Generate the Symbols.dylib file - @echo "\t[dyldsymboltool] Symbols.dylib" + @echo " [dyldsymboltool] Symbols.dylib" @$(SYMROOT)/dyldsymboltool $(SYMROOT)/boot.sys $(SYMROOT)/${SYMBOLS_MODULE} - @echo "\t[LD] boot.sys" + @echo " [LD] boot.sys" @$(CC) -Wl,-preload -Wl,-alias,boot2,start \ -nostdlib -arch i386 -Wl,-pie \ -Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \ @@ -142,7 +142,7 @@ -o $(OBJROOT)/Symbols_LINKER_ONLY.dylib else - @echo "\t[LD] boot.sys" + @echo " [LD] boot.sys" @$(CC) -Wl,-preload -Wl,-alias,boot2,start \ -nostdlib -arch i386 -Wl,-pie \ -Wl,-segaddr,__INIT,`echo obase=16\; $$((0x${BOOT2ADDR})) | bc` \ @@ -155,7 +155,7 @@ endif - @echo "\t[MACHOCONV] boot" + @echo " [MACHOCONV] boot" @$(SYMROOT)/machOconv ${SYMROOT}/$@.sys $(SYMROOT)/$@ &> /dev/null @( size=`ls -l $(SYMROOT)/boot | awk '{ print $$5}'` ; \ @@ -190,7 +190,7 @@ @echo "" >> $(SYMROOT)/art.h @echo "embeddedpng_t embeddedImages[] = {" >> $(SYMROOT)/art.h @cd $(SYMROOT)/embed && find . -name '*.png' | sort | cut -f 2 -d '/' | cut -f 1 -d '.' | \ - awk '{ printf "\t{.name = \"%s\", .pngdata = __%s_png, .length = &__%s_png_len},\n", $$1, $$1, $$1 }' >> $(SYMROOT)/art.h + awk '{ printf " {.name = \"%s\", .pngdata = __%s_png, .length = &__%s_png_len},\n", $$1, $$1, $$1 }' >> $(SYMROOT)/art.h @echo "};" >> $(SYMROOT)/art.h @echo "#endif /* !__BOOT2_ART_H */" >> $(SYMROOT)/art.h ;\ @@ -204,7 +204,7 @@ clean-local: @for o in $(SYMROOT)/boot $(SYMROOT)/boot.sys $(SYMROOT)/embedded.h $(OBJROOT)/Symbols_LINKER_ONLY.dylib; do \ - if [ -f "$${o}" ];then echo "\t[RM] $${o}"; fi; done - @if [ -d "$(OBJROOT)" ];then echo "\t[RM] all objects in $(OBJROOT)"; fi + if [ -f "$${o}" ];then echo " [RM] $${o}"; fi; done + @if [ -d "$(OBJROOT)" ];then echo " [RM] all objects in $(OBJROOT)"; fi @rm -f $(SYMROOT)/boot $(SYMROOT)/boot.sys $(SYMROOT)/embedded.h $(OBJS) @rm -rf $(OBJROOT) Index: branches/Chimera/i386/boot2/modules.c =================================================================== --- branches/Chimera/i386/boot2/modules.c (revision 2657) +++ branches/Chimera/i386/boot2/modules.c (revision 2658) @@ -105,6 +105,11 @@ long flags; long time; struct dirstuff* moduleDir = opendir("/Extra/modules/"); + if(!moduleDir) + { + verbose("Warning: Unable to open modules folder at '/Extra/modules/'. Ingoring modules.\n"); + return; + } while (readdir(moduleDir, (const char**)&name, &flags, &time) >= 0) { if(strcmp(&name[strlen(name) - sizeof("dylib")], ".dylib") == 0) { char* tmp = malloc(strlen(name) + 1); @@ -121,6 +126,7 @@ } } + closedir(moduleDir); } @@ -282,6 +288,11 @@ //DBG("External symbol %s located at 0x%X\n", name, entry->addr); return entry->addr; } + else if(strcmp(entry->symbol, name + 1) == 0 && *name == '_') // Allow _strstr to bing to strstr, etc + { + //DBG("External symbol %s located at 0x%X\n", name, entry->addr); + return entry->addr; + } else { entry = entry->next; Index: branches/Chimera/i386/boot2/gui.c =================================================================== --- branches/Chimera/i386/boot2/gui.c (revision 2657) +++ branches/Chimera/i386/boot2/gui.c (revision 2658) @@ -31,6 +31,7 @@ int lasttime = 0; // we need this for animating maybe +// ==================================================================== /* * ATTENTION: the enum and the following array images[] MUST match !!! @@ -74,7 +75,6 @@ iDeviceHFSRAID_Leo_o, iDeviceHFSRAID_Tiger, iDeviceHFSRAID_Tiger_o, - iDeviceEXT3, iDeviceEXT3_o, iDeviceFreeBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -120,6 +120,8 @@ iFontSmall, }; +// ==================================================================== + image_t images[] = { {.name = "background", .image = NULL}, {.name = "logo", .image = NULL}, @@ -159,7 +161,6 @@ {.name = "device_hfsraid_leo_o", .image = NULL}, {.name = "device_hfsraid_tiger", .image = NULL}, {.name = "device_hfsraid_tiger_o", .image = NULL}, - {.name = "device_ext3", .image = NULL}, {.name = "device_ext3_o", .image = NULL}, {.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -205,6 +206,8 @@ {.name = "font_small", .image = NULL}, }; +// ==================================================================== + int imageCnt = 0; extern int gDeviceCount; @@ -352,6 +355,8 @@ return 1; } +// ==================================================================== + static int loadGraphics(void) { LOADPNG(background, IMG_REQUIRED); @@ -442,6 +447,8 @@ return 0; } +// ==================================================================== + static int unloadGraphics(void) { int i; @@ -460,6 +467,8 @@ return 0; } +// ==================================================================== + int freeBackBuffer( window_t *window ) { if (gui.backbuffer && gui.backbuffer->pixels) { @@ -472,6 +481,8 @@ return 1; } +// ==================================================================== + pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height ) { pixmap_t *cropped = malloc( sizeof( pixmap_t ) ); @@ -496,6 +507,8 @@ return cropped; } +// ==================================================================== + int createBackBuffer( window_t *window ) { gui.backbuffer = malloc(sizeof(pixmap_t)); @@ -515,6 +528,8 @@ return 0; } +// ==================================================================== + int createWindowBuffer( window_t *window ) { window->pixmap = malloc(sizeof(pixmap_t)); @@ -535,6 +550,8 @@ return 0; } +// ==================================================================== + int freeWindowBuffer( window_t *window ) { if (window->pixmap && window->pixmap->pixels) { @@ -545,6 +562,8 @@ return 1; } +// ==================================================================== + void fillPixmapWithColor(pixmap_t *pm, uint32_t color) { int x,y; @@ -557,6 +576,8 @@ } } +// ==================================================================== + void drawBackground() { // reset text cursor @@ -577,6 +598,8 @@ memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); } +// ==================================================================== + void setupDeviceList(config_file_t *theme) { unsigned int pixel; @@ -649,6 +672,8 @@ } } +// ==================================================================== + void loadThemeValues(config_file_t *theme) { unsigned int screen_width = gui.screen.width; @@ -848,6 +873,8 @@ } } +// ==================================================================== + int initGUI(void) { int val; @@ -929,11 +956,15 @@ return 1; } +// ==================================================================== + bool is_image_loaded(int i) { return (images[i].image != NULL) ? true : false; } +// ==================================================================== + void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected) { int devicetype; @@ -974,9 +1005,9 @@ devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID : iDeviceHFS); break; } - + break; - + } case kPartitionTypeHPFS: devicetype = iDeviceNTFS; // Use HPFS / NTFS icon @@ -1029,6 +1060,8 @@ } +// ==================================================================== + void drawDeviceList (int start, int end, int selection) { int i; @@ -1133,6 +1166,8 @@ } +// ==================================================================== + void clearGraphicBootPrompt() { // clear text buffer @@ -1150,6 +1185,8 @@ return; } +// ==================================================================== + void updateGraphicBootPrompt() { fillPixmapWithColor( gui.bootprompt.pixmap, gui.bootprompt.bgcolor); @@ -1175,6 +1212,8 @@ return; } +// ==================================================================== + static inline void vramwrite (void *data, int width, int height) { @@ -1209,6 +1248,8 @@ } } +// ==================================================================== + void updateVRAM() { if (gui.redraw) { @@ -1234,12 +1275,16 @@ } } +// ==================================================================== + struct putc_info //Azi: exists on console.c & printf.c { char * str; char * last_str; }; +// ==================================================================== + static int sputc(int c, struct putc_info * pi) //Azi: same as above { @@ -1253,6 +1298,8 @@ return c; } +// ==================================================================== + int gprintf( window_t * window, const char * fmt, ...) { char *formattedtext; @@ -1335,6 +1382,8 @@ return 1; } +// ==================================================================== + int dprintf( window_t * window, const char * fmt, ...) { char *formattedtext; @@ -1418,6 +1467,8 @@ return 1; } +// ==================================================================== + int vprf(const char * fmt, va_list ap) { int i; @@ -1493,6 +1544,8 @@ return 1; } +// ==================================================================== + pixmap_t* charToPixmap(unsigned char ch, font_t *font) { unsigned int cha = (unsigned int)ch - 32; if (cha >= font->count) { @@ -1502,6 +1555,8 @@ return font->chars[cha] ? font->chars[cha] : NULL; } +// ==================================================================== + position_t drawChar(unsigned char ch, font_t *font, pixmap_t *blendInto, position_t p) { pixmap_t* pm = charToPixmap(ch, font); if (pm && ((p.x + pm->width) < blendInto->width)) { @@ -1512,6 +1567,8 @@ } } +// ==================================================================== + void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p) { int i=0; @@ -1535,6 +1592,8 @@ } } +// ==================================================================== + void drawStrCenteredAt(char *text, font_t *font, pixmap_t *blendInto, position_t p) { int i = 0; @@ -1566,6 +1625,8 @@ drawStr(text, font, blendInto, p); } +// ==================================================================== + int destroyFont(font_t *font) { int i; @@ -1581,6 +1642,8 @@ return 0; } +// ==================================================================== + int initFont(font_t *font, image_t *data) { unsigned int x = 0, y = 0, x2 = 0, x3 = 0; @@ -1637,6 +1700,8 @@ return 0; } +// ==================================================================== + void colorFont(font_t *font, uint32_t color) { if( !color ) { @@ -1663,6 +1728,8 @@ } } +// ==================================================================== + void makeRoundedCorners(pixmap_t *p) { int x,y; @@ -1707,6 +1774,8 @@ } } +// ==================================================================== + void showInfoBox(char *title, char *text_orig) { char* text; @@ -1837,6 +1906,8 @@ free(text); } +// ==================================================================== + void animateProgressBar() { int y; @@ -1857,6 +1928,8 @@ } } +// ==================================================================== + void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress) { if(progress>100) { @@ -1917,6 +1990,8 @@ free(progressbar.pixels); } +// ==================================================================== + void drawInfoMenuItems() { int i,n; @@ -1959,6 +2034,8 @@ gui.redraw = true; } +// ==================================================================== + int drawInfoMenu() { drawInfoMenuItems(); @@ -1970,6 +2047,8 @@ return 1; } +// ==================================================================== + int updateInfoMenu(int key) { switch (key) @@ -2027,9 +2106,11 @@ return DO_NOT_BOOT; } -uint16_t bootImageWidth = 0; -uint16_t bootImageHeight = 0; -uint8_t *bootImageData = NULL; +// ==================================================================== + +uint16_t bootImageWidth = 0; +uint16_t bootImageHeight = 0; +uint8_t *bootImageData = NULL; static bool usePngImage = true; //========================================================================== @@ -2128,6 +2209,7 @@ free(bootImageData); } free(appleBootPict); - } - } + } + } } +// ==================================================================== Index: branches/Chimera/i386/boot2/modules_support.s =================================================================== --- branches/Chimera/i386/boot2/modules_support.s (revision 2657) +++ branches/Chimera/i386/boot2/modules_support.s (revision 2658) @@ -3,7 +3,7 @@ LABEL(dyld_stub_binder) jmp _dyld_stub_binder - + LABEL(dyld_void_start) ret Index: branches/Chimera/i386/boot2/appleClut8.h =================================================================== --- branches/Chimera/i386/boot2/appleClut8.h (revision 2657) +++ branches/Chimera/i386/boot2/appleClut8.h (revision 2658) @@ -2,7 +2,7 @@ * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ - * + * * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights * Reserved. This file contains Original Code and/or Modifications of * Original Code as defined in and that are subject to the Apple Public @@ -10,7 +10,7 @@ * except in compliance with the License. Please obtain a copy of the * License at http://www.apple.com/publicsource and read it before using * this file. - * + * * The Original Code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, @@ -18,7 +18,7 @@ * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. - * + * * @APPLE_LICENSE_HEADER_END@ */ @@ -31,62 +31,77 @@ 0xbc,0xbc,0xbc, 0xff,0xff,0x00, 0xba,0xba,0xba, 0xb9,0xb9,0xb9, 0xb8,0xb8,0xb8, 0xb7,0xb7,0xb7, 0xb6,0xb6,0xb6, 0xb5,0xb5,0xb5, 0xb4,0xb4,0xb4, 0xb3,0xb3,0xb3, 0xb2,0xb2,0xb2, 0x00,0x00,0x00, + 0xb1,0xb1,0xb1, 0xb0,0xb0,0xb0, 0xaf,0xaf,0xaf, 0xae,0xae,0xae, 0xad,0xad,0xad, 0xac,0xac,0xac, 0xab,0xab,0xab, 0xaa,0xaa,0xaa, 0xff,0x00,0xff, 0xa9,0xa9,0xa9, 0xa8,0xa8,0xa8, 0xa7,0xa7,0xa7, 0xa6,0xa6,0xa6, 0xa5,0xa5,0xa5, 0xa4,0xa4,0xa4, 0xa3,0xa3,0xa3, + 0xa2,0xa2,0xa2, 0xa1,0xa1,0xa1, 0xa0,0xa0,0xa0, 0xff,0x00,0x00, 0x9f,0x9f,0x9f, 0x9e,0x9e,0x9e, 0x9d,0x9d,0x9d, 0x9c,0x9c,0x9c, 0x9b,0x9b,0x9b, 0x9a,0x9a,0x9a, 0xcc,0xcc,0xff, 0xcc,0xcc,0xcc, 0x99,0x99,0x99, 0x98,0x98,0x98, 0x97,0x97,0x97, 0x96,0x96,0x96, + 0x95,0x95,0x95, 0x94,0x94,0x94, 0x93,0x93,0x93, 0x92,0x92,0x92, 0x91,0x91,0x91, 0x90,0x90,0x90, 0x8f,0x8f,0x8f, 0x8e,0x8e,0x8e, 0x8d,0x8d,0x8d, 0x8c,0x8c,0x8c, 0x8b,0x8b,0x8b, 0x8a,0x8a,0x8a, - 0x89,0x89,0x89, 0x87,0x87,0x87, 0x86,0x86,0x86, 0x85,0x85,0x85, + 0x89,0x89,0x89, 0x88,0x88,0x88, 0x86,0x86,0x86, 0x85,0x85,0x85, + 0x84,0x84,0x84, 0x83,0x83,0x83, 0x82,0x82,0x82, 0x81,0x81,0x81, 0x80,0x80,0x80, 0x7f,0x7f,0x7f, 0x7e,0x7e,0x7e, 0x7d,0x7d,0x7d, 0x7c,0x7c,0x7c, 0x7b,0x7b,0x7b, 0x7a,0x7a,0x7a, 0x79,0x79,0x79, 0x78,0x78,0x78, 0x76,0x76,0x76, 0x75,0x75,0x75, 0x74,0x74,0x74, + 0x73,0x73,0x73, 0x72,0x72,0x72, 0x71,0x71,0x71, 0x70,0x70,0x70, 0x6f,0x6f,0x6f, 0x6e,0x6e,0x6e, 0x6d,0x6d,0x6d, 0x6c,0x6c,0x6c, 0x6b,0x6b,0x6b, 0x6a,0x6a,0x6a, 0x69,0x69,0x69, 0x68,0x68,0x68, 0x67,0x67,0x67, 0x66,0x66,0x66, 0x64,0x64,0x64, 0x63,0x63,0x63, + 0x62,0x62,0x62, 0x61,0x61,0x61, 0x60,0x60,0x60, 0x5f,0x5f,0x5f, 0x5e,0x5e,0x5e, 0x5d,0x5d,0x5d, 0x5c,0x5c,0x5c, 0x5b,0x5b,0x5b, 0x5a,0x5a,0x5a, 0x59,0x59,0x59, 0x58,0x58,0x58, 0x57,0x57,0x57, 0x56,0x56,0x56, 0x54,0x54,0x54, 0x53,0x53,0x53, 0x52,0x52,0x52, + 0x51,0x51,0x51, 0x50,0x50,0x50, 0x4f,0x4f,0x4f, 0x4e,0x4e,0x4e, 0x4d,0x4d,0x4d, 0x4c,0x4c,0x4c, 0x4b,0x4b,0x4b, 0x4a,0x4a,0x4a, 0x49,0x49,0x49, 0x48,0x48,0x48, 0x47,0x47,0x47, 0x46,0x46,0x46, 0x45,0x45,0x45, 0x43,0x43,0x43, 0x42,0x42,0x42, 0x41,0x41,0x41, + 0x40,0x40,0x40, 0x3f,0x3f,0x3f, 0x3e,0x3e,0x3e, 0x3d,0x3d,0x3d, 0x3c,0x3c,0x3c, 0x3b,0x3b,0x3b, 0x3a,0x3a,0x3a, 0x39,0x39,0x39, 0x38,0x38,0x38, 0x37,0x37,0x37, 0x36,0x36,0x36, 0x35,0x35,0x35, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, + 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, + 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, + 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x00,0xff,0xff, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x00,0xff,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, + 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, + 0x65,0x65,0x65, 0x65,0x65,0x65, 0x00,0x00,0xff, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, - 0xdd,0x00,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, + 0xd0,0x00,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, + 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x00,0xbb,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, + 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0xbb,0xbb,0xbb, 0x65,0x65,0x65, 0x88,0x88,0x88, 0x77,0x77,0x77, 0x55,0x55,0x55, Index: branches/Chimera/i386/boot2/gui.h =================================================================== --- branches/Chimera/i386/boot2/gui.h (revision 2657) +++ branches/Chimera/i386/boot2/gui.h (revision 2658) @@ -33,11 +33,15 @@ #define MENU_SHOW_VIDEO_INFO 5 #define MENU_SHOW_HELP 6 +// ==================================================================== + enum { HorizontalLayout = 0, VerticalLayout = 1, }; +// ==================================================================== + /* * Menu item structure. */ @@ -49,6 +53,8 @@ bool expandable; } menuitem_t; +// ==================================================================== + /* * Image structure. */ @@ -57,6 +63,8 @@ char name[32]; } image_t; +// ==================================================================== + /* * Font structure. */ @@ -67,6 +75,8 @@ uint16_t count; // Number of chars in font } font_t; +// ==================================================================== + /* * Window structure. */ @@ -86,7 +96,9 @@ uint32_t font_console_color; // Color for consle font AARRGGBB bool draw; // Draw flag } window_t; - + +// ==================================================================== + /* * gui structure */ Index: branches/Chimera/i386/boot2/lzss.c =================================================================== --- branches/Chimera/i386/boot2/lzss.c (revision 2657) +++ branches/Chimera/i386/boot2/lzss.c (revision 2658) @@ -64,53 +64,54 @@ int match_position, match_length; }; -int decompress_lzss( u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srclen ) +int +decompress_lzss( u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srclen ) { - /* ring buffer of size N, with extra F-1 bytes to aid string comparison */ - u_int8_t text_buf[N + F - 1]; - u_int8_t *dststart = dst; - u_int8_t *dstend = dst + dstlen; - u_int8_t *srcend = src + srclen; - int i, j, k, r, c; - unsigned int flags; - - dst = dststart; - srcend = src + srclen; - for (i = 0; i < N - F; i++) - text_buf[i] = ' '; - r = N - F; - flags = 0; - for ( ; ; ) { - if (((flags >>= 1) & 0x100) == 0) { - if (src < srcend) c = *src++; else break; - flags = c | 0xFF00; /* uses higher byte cleverly */ - } /* to count eight */ - if (flags & 1) { - if (src < srcend) c = *src++; else break; - *dst++ = c; - if (dst >= dstend) { - goto finish; - } - text_buf[r++] = c; - r &= (N - 1); - } else { - if (src < srcend) i = *src++; else break; - if (src < srcend) j = *src++; else break; - i |= ((j & 0xF0) << 4); - j = (j & 0x0F) + THRESHOLD; - for (k = 0; k <= j; k++) { - c = text_buf[(i + k) & (N - 1)]; - *dst++ = c; - if (dst >= dstend) { - goto finish; - } - text_buf[r++] = c; - r &= (N - 1); - } - } - } + /* ring buffer of size N, with extra F-1 bytes to aid string comparison */ + u_int8_t text_buf[N + F - 1]; + u_int8_t *dststart = dst; + u_int8_t *dstend = dst + dstlen; + u_int8_t *srcend = src + srclen; + int i, j, k, r, c; + unsigned int flags; + + dst = dststart; + srcend = src + srclen; + for (i = 0; i < N - F; i++) + text_buf[i] = ' '; + r = N - F; + flags = 0; + for ( ; ; ) { + if (((flags >>= 1) & 0x100) == 0) { + if (src < srcend) c = *src++; else break; + flags = c | 0xFF00; /* uses higher byte cleverly */ + } /* to count eight */ + if (flags & 1) { + if (src < srcend) c = *src++; else break; + *dst++ = c; + if (dst >= dstend) { + goto finish; + } + text_buf[r++] = c; + r &= (N - 1); + } else { + if (src < srcend) i = *src++; else break; + if (src < srcend) j = *src++; else break; + i |= ((j & 0xF0) << 4); + j = (j & 0x0F) + THRESHOLD; + for (k = 0; k <= j; k++) { + c = text_buf[(i + k) & (N - 1)]; + *dst++ = c; + if (dst >= dstend) { + goto finish; + } + text_buf[r++] = c; + r &= (N - 1); + } + } + } finish: - return dst - dststart; + return dst - dststart; } /* @@ -231,16 +232,16 @@ { /* Encoding state, mostly tree but some current match stuff */ struct encode_state *sp; - + int i, c, len, r, s, last_match_length, code_buf_ptr; u_int8_t code_buf[17], mask; u_int8_t *srcend = src + srclen; u_int8_t *dstend = dst + dstlen; - + /* initialize trees */ sp = (struct encode_state *) malloc(sizeof(*sp)); init_state(sp); - + /* * code_buf[1..16] saves eight units of code, and code_buf[0] works * as eight flags, "1" representing that the unit is an unencoded @@ -249,16 +250,16 @@ */ code_buf[0] = 0; code_buf_ptr = mask = 1; - + /* Clear the buffer with any character that will appear often. */ s = 0; r = N - F; - + /* Read F bytes into the last F bytes of the buffer */ for (len = 0; len < F && src < srcend; len++) sp->text_buf[r + len] = *src++; if (!len) return (void *) 0; /* text of size zero */ - + /* * Insert the F strings, each of which begins with one or more * 'space' characters. Note the order in which these strings are @@ -266,7 +267,7 @@ */ for (i = 1; i <= F; i++) insert_node(sp, r - i); - + /* * Finally, insert the whole string just read. * The global variables match_length and match_position are set. @@ -302,24 +303,24 @@ delete_node(sp, s); /* Delete old strings and */ c = *src++; sp->text_buf[s] = c; /* read new bytes */ - + /* * If the position is near the end of buffer, extend the buffer * to make string comparison easier. */ if (s < F - 1) sp->text_buf[s + N] = c; - + /* Since this is a ring buffer, increment the position modulo N. */ s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); - + /* Register the string in text_buf[r..r+F-1] */ insert_node(sp, r); } while (i++ < last_match_length) { delete_node(sp, s); - + /* After the end of text, no need to read, */ s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); @@ -328,7 +329,7 @@ insert_node(sp, r); } } while (len > 0); /* until length of string to be processed is zero */ - + if (code_buf_ptr > 1) { /* Send remaining code. */ for (i = 0; i < code_buf_ptr; i++) if (dst < dstend) @@ -336,5 +337,6 @@ else return (void *) 0; } + return dst; } Index: branches/Chimera/i386/boot2/options.c =================================================================== --- branches/Chimera/i386/boot2/options.c (revision 2657) +++ branches/Chimera/i386/boot2/options.c (revision 2658) @@ -192,7 +192,8 @@ gBootArgsPtr = gBootArgs; memset(gBootArgs, '\0', BOOT_STRING_LEN); - if (bootArgs->Video.v_display != VGA_TEXT_MODE) { + if (bootArgs->Video.v_display != VGA_TEXT_MODE) + { clearGraphicBootPrompt(); } execute_hook("ClearArgs", NULL, NULL, NULL, NULL); @@ -1095,33 +1096,34 @@ bool copyArgument(const char *argName, const char *val, int cnt, char **argP, int *cntRemainingP) { - int argLen = argName ? strlen(argName) : 0; - int len = argLen + cnt + 1; // +1 to account for space + int argLen = argName ? strlen(argName) : 0; + int len = argLen + cnt + 1; // + 1 to account for space. if (argName) - { + { len++; // +1 to account for '=' - } + } - if (len > *cntRemainingP) { - error("Warning: boot arguments too long, truncating\n"); - return false; - } + if (len > *cntRemainingP) { + error("Warning: boot arguments too long, truncating\n"); + return false; + } - if (argName) { - strncpy( *argP, argName, argLen ); - *argP += argLen; - *argP[0] = '='; - (*argP)++; - } + if (argName) + { + strncpy(*argP, argName, argLen); + *argP += argLen; + *argP[0] = '='; + (*argP)++; + } - strncpy( *argP, val, cnt ); - *argP += cnt; - *argP[0] = ' '; - (*argP)++; + strncpy(*argP, val, cnt); + *argP += cnt; + *argP[0] = ' '; + (*argP)++; + *cntRemainingP -= len; - *cntRemainingP -= len; - return true; + return true; } // @@ -1216,7 +1218,7 @@ // Load com.apple.Boot.plist from the selected volume // and use its contents to override default bootConfig. - loadSystemConfig(&bootInfo->bootConfig); + loadSystemConfig(&bootInfo->bootConfig); loadChameleonConfig(&bootInfo->chameleonConfig, NULL); // Use the kernel name specified by the user, or fetch the name @@ -1228,22 +1230,28 @@ gOverrideKernel = false; if (( kernel = extractKernelName((char **)&cp) )) + { + strlcpy( bootInfo->bootFile, kernel, sizeof(bootInfo->bootFile) ); + } + else { - strlcpy( bootInfo->bootFile, kernel, sizeof(bootInfo->bootFile) ); - } else { if ( getValueForKey( kKernelNameKey, &val, &cnt, &bootInfo->bootConfig ) ) { strlcpy( bootInfo->bootFile, val, cnt+1 ); - } else { + } + else + { if ((checkOSVersion("10.10"))) { strlcpy( bootInfo->bootFile, kDefaultKernelYosemite, sizeof(bootInfo->bootFile) ); - } else { + } + else + { strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) ); } } } if ((strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) && (strcmp( bootInfo->bootFile, kDefaultKernelYosemite ) != 0)) - { + { gOverrideKernel = true; } @@ -1282,7 +1290,7 @@ /* // Try to get the volume uuid string if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) - { + { gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString); } */ @@ -1309,12 +1317,16 @@ cnt++; strlcpy(valueBuffer + 1, val, cnt); val = valueBuffer; - } else { /* - if (strlen(gBootUUIDString)) - { + } + else + { /* + if (strlen(gBootUUIDString)) + { val = "*uuid"; cnt = 5; - } else { */ + } + else + { */ // Don't set "rd=.." if there is no boot device key // and no UUID. val = ""; @@ -1389,7 +1401,9 @@ if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) ) { strlcpy(gMKextName, val, cnt + 1); - } else { + } + else + { gMKextName[0]=0; } @@ -1481,7 +1495,9 @@ { if (bootArgs->Video.v_display != VGA_TEXT_MODE) { showInfoBox("Help. Press q to quit.\n", (char *)BootHelp_txt); - } else { + } + else + { showTextBuffer((char *)BootHelp_txt, BootHelp_txt_len); } } @@ -1493,14 +1509,16 @@ int fd; int size; - if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0) { + if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0) + { printf("\nFile not found: %s\n", filename); sleep(2); return; } size = file_size(fd); - if (size > MAX_TEXT_FILE_SIZE) { + if (size > MAX_TEXT_FILE_SIZE) + { size = MAX_TEXT_FILE_SIZE; } buf = malloc(size); @@ -1527,9 +1545,11 @@ printf("Enter two-digit hexadecimal boot device [%02x]: ", bootdevice); do { key = getchar(); - switch (ASCII_KEY(key)) { + switch (ASCII_KEY(key)) + { case KEY_BKSP: - if (digitsI > 0) { + if (digitsI > 0) + { int x, y, t; getCursorPositionAndType(&x, &y, &t); // Assume x is not 0; @@ -1538,7 +1558,9 @@ // Overwrite with space without moving cursor position putca(' ', 0x07, 1); digitsI--; - } else { + } + else + { // TODO: Beep or something } break; @@ -1546,7 +1568,8 @@ case KEY_ENTER: digits[digitsI] = '\0'; newbootdevice = strtol(digits, &end, 16); - if (end == digits && *end == '\0') { + if (end == digits && *end == '\0') + { // User entered empty string printf("\nUsing default boot device %x\n", bootdevice); key = 0; @@ -1561,10 +1584,13 @@ break; default: - if (isxdigit(ASCII_KEY(key)) && digitsI < 2) { + if (isxdigit(ASCII_KEY(key)) && digitsI < 2) + { putchar(ASCII_KEY(key)); digits[digitsI++] = ASCII_KEY(key); - } else { + } + else + { // TODO: Beep or something } break; @@ -1577,9 +1603,12 @@ bool promptForRescanOption(void) { printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n"); - if (getchar() == KEY_ENTER) { + if (getchar() == KEY_ENTER) + { return true; - } else { + } + else + { return false; } } Index: branches/Chimera/i386/config/confdata.c =================================================================== --- branches/Chimera/i386/config/confdata.c (revision 2657) +++ branches/Chimera/i386/config/confdata.c (revision 2658) @@ -13,6 +13,18 @@ #include #include +char * +int_stpncpy (dst, src, len) + char *dst; + const char *src; + size_t len; +{ + size_t n = strlen (src); + if (n > len) + n = len; + return strncpy (dst, src, len) + n; +} + #define LKC_DIRECT_LINK #include "lkc.h" @@ -101,7 +113,7 @@ char *name_ptr = name; size_t n = min(res_rem, src - in); - res_ptr = stpncpy(res_ptr, in, n); + res_ptr = int_stpncpy(res_ptr, in, n); if (!(res_rem -= n)) { return res_value; /* buffer full, quit now */ } @@ -118,7 +130,7 @@ symval = sym_get_string_value(sym); n = min(res_rem, strlen(symval)); - res_ptr = stpncpy(res_ptr, symval, n); + res_ptr = int_stpncpy(res_ptr, symval, n); if (!(res_rem -= n)) { return res_value; /* buffer full, quit now */ } Index: branches/Chimera/i386/config/textbox.c =================================================================== --- branches/Chimera/i386/config/textbox.c (revision 2657) +++ branches/Chimera/i386/config/textbox.c (revision 2658) @@ -320,7 +320,6 @@ */ static void print_line(WINDOW * win, int row, int width) { - int y, x; char *line; line = get_line(); @@ -329,9 +328,9 @@ waddch(win, ' '); waddnstr(win, line, MIN(strlen(line), width - 2)); - getyx(win, y, x); /* Clear 'residue' of previous line */ #if OLD_NCURSES + getyx(win, y, x); { int i; for (i = 0; i < width - x; i++) Index: branches/Chimera/i386/modules/KernelPatcher/Makefile =================================================================== --- branches/Chimera/i386/modules/KernelPatcher/Makefile (revision 2657) +++ branches/Chimera/i386/modules/KernelPatcher/Makefile (revision 2658) @@ -1,7 +1,7 @@ MODULE_NAME = KernelPatcher +MODULE_DESCRIPTION = Kernel patcher MODULE_AUTHOR = Evan Lojewski -MODULE_DESCRIPTION = Kernel patcher -MODULE_VERSION = "1.1.0" +MODULE_VERSION = "1.1.3" MODULE_COMPAT_VERSION = "1.0.0" MODULE_START = $(MODULE_NAME)_start MODULE_DEPENDENCIES = @@ -13,7 +13,7 @@ include ../MakeInc.dir $(SYMROOT)/modules/$(MODULE_NAME).dylib: - @echo "\t[CP] $(MODULE_NAME).dylib" + @echo " [[CP] $(MODULE_NAME).dylib" @cp $(MODULE_NAME).dylib $(SRCROOT)/sym/i386/modules/$(MODULE_NAME).dylib $(SRCROOT)/sym/i386/boot_modules.c: Index: branches/Chimera/i386/modules/AcpiCodec/acpi_codec.c =================================================================== --- branches/Chimera/i386/modules/AcpiCodec/acpi_codec.c (revision 2657) +++ branches/Chimera/i386/modules/AcpiCodec/acpi_codec.c (revision 2658) @@ -196,8 +196,9 @@ return entry; \ } -__RES(pss, long) -__RES(cst, int) +#if UNUSED +__RES(cst, int) +#endif /* UNUSED */ static ACPI_TABLE_HEADER * get_new_table_in_list(U32 *new_table_list, U32 Signature, U8 *retIndex ) { Index: branches/Chimera/i386/cdboot/Makefile =================================================================== --- branches/Chimera/i386/cdboot/Makefile (revision 2657) +++ branches/Chimera/i386/cdboot/Makefile (revision 2658) @@ -16,7 +16,7 @@ all embedtheme optionrom: $(DIRS_NEEDED) $(SYMROOT)/cdboot $(SYMROOT)/cdboot: - @echo "\t[NASM] cdboot.s" + @echo " [NASM] cdboot.s" @$(NASM) cdboot.s -o $(SYMROOT)/cdboot @dd if=$(SYMROOT)/boot of=$(SYMROOT)/cdboot conv=sync bs=2k seek=1 &> /dev/null @@ -26,5 +26,5 @@ | dd of=$(SYMROOT)/cdboot bs=1 count=4 seek=2044 conv=notrunc &> /dev/null clean-local: - @if [ -f "$(SYMROOT)/cdboot" ];then echo "\t[RM] $(SYMROOT)/cdboot"; fi + @if [ -f "$(SYMROOT)/cdboot" ];then echo " [RM] $(SYMROOT)/cdboot"; fi @rm -f $(SYMROOT)/cdboot Index: branches/Chimera/i386/libsa/zalloc.c =================================================================== --- branches/Chimera/i386/libsa/zalloc.c (revision 2657) +++ branches/Chimera/i386/libsa/zalloc.c (revision 2658) @@ -57,7 +57,7 @@ static void zcoalesce(void); #if ZDEBUG -size_t zalloced_size; + size_t zalloced_size; #endif #define ZALLOC_NODES 32767 /* was 16384 */ @@ -78,7 +78,8 @@ zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes; zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes; - if (size == 0) { + if (size == 0) + { size = ZALLOC_LEN; } @@ -108,8 +109,10 @@ size = ((size + 0xf) & ~0xf); - if (size == 0) { - if (zerror) { + if (size == 0) + { + if (zerror) + { (*zerror)((char *)0xdeadbeef, 0, file, line); } } @@ -155,12 +158,14 @@ done: if ((ret == 0) || (ret + size >= zalloc_end)) { - if (zerror) { + if (zerror) + { (*zerror)(ret, size, file, line); } } - if (ret != 0) { + if (ret != 0) + { bzero(ret, size); } #if ZDEBUG @@ -186,7 +191,8 @@ rp = 0; #endif - if (!start) { + if (!start) + { return; } @@ -207,8 +213,10 @@ break; } } - if (!found) { - if (zerror) { + if (!found) + { + if (zerror) + { (*zerror)(pointer, rp, "free", 0); } else { return; @@ -218,7 +226,8 @@ zalloced_size -= tsize; #endif - for (i = 0; i < availableNodes; i++) { + for (i = 0; i < availableNodes; i++) + { if ((start + tsize) == zavailable[i].start) // merge it in { zavailable[i].start = start; @@ -227,15 +236,19 @@ return; } - if ((i > 0) && (zavailable[i-1].start + zavailable[i-1].size == start)) { + if ((i > 0) && (zavailable[i-1].start + zavailable[i-1].size == start)) + { zavailable[i-1].size += tsize; zcoalesce(); return; } - if ((start + tsize) < zavailable[i].start) { - if (++availableNodes > totalNodes) { - if (zerror) { + if ((start + tsize) < zavailable[i].start) + { + if (++availableNodes > totalNodes) + { + if (zerror) + { (*zerror)((char *)0xf000f000, 0, "free", 0); } } @@ -246,8 +259,10 @@ } } - if (++availableNodes > totalNodes) { - if (zerror) { + if (++availableNodes > totalNodes) + { + if (zerror) + { (*zerror)((char *)0xf000f000, 1, "free", 0); } } @@ -270,8 +285,10 @@ zalloced[allocedNodes].start = start; zalloced[allocedNodes].size = size; - if (++allocedNodes > totalNodes) { - if (zerror) { + if (++allocedNodes > totalNodes) + { + if (zerror) + { (*zerror)((char *)0xf000f000, 2, "zallocate", 0); } }; @@ -287,7 +304,8 @@ z1 = zp + i; z2 = z1 + 1; - for (; i >= ndx; i--, z1--, z2--) { + for (; i >= ndx; i--, z1--, z2--) + { *z2 = *z1; } } @@ -301,7 +319,8 @@ z1 = zp + ndx; z2 = z1 + 1; - for (i = ndx; i < totalNodes - 1; i++, z1++, z2++) { + for (i = ndx; i < totalNodes - 1; i++, z1++, z2++) + { *z1 = *z2; } } @@ -311,8 +330,10 @@ { int i; - for (i = 0; i < availableNodes-1; i++) { - if ( zavailable[i].start + zavailable[i].size == zavailable[i + 1].start ) { + for (i = 0; i < availableNodes-1; i++) + { + if ( zavailable[i].start + zavailable[i].size == zavailable[i + 1].start ) + { zavailable[i].size += zavailable[i + 1].size; zdelete(zavailable, i + 1); availableNodes--; return; Index: branches/Chimera/i386/libsa/Makefile =================================================================== --- branches/Chimera/i386/libsa/Makefile (revision 2657) +++ branches/Chimera/i386/libsa/Makefile (revision 2658) @@ -36,17 +36,17 @@ $(LIBS): $(OBJS) - @echo "\t[RM] $@" + @echo " [RM] $@" @rm -f $@ - @echo "\t[AR] $(@F)" + @echo " [AR] $(@F)" @ar q $@ $^ &> /dev/null - @echo "\t[RANLIB] $(@F)" + @echo " [RANLIB] $(@F)" @ranlib $@ # dependencies -include $(OBJROOT)/Makedep clean-local: - @for o in $(OBJS); do if [ -f "$${o}" ];then echo "\t[RM] $${o}"; fi; done - @for l in $(LIBS); do if [ -f "$${l}" ];then echo "\t[RM] $${l}"; fi; done + @for o in $(OBJS); do if [ -f "$${o}" ];then echo " [RM] $${o}"; fi; done + @for l in $(LIBS); do if [ -f "$${l}" ];then echo " [RM] $${l}"; fi; done @rm -f $(LIBS) $(OBJS) Index: branches/Chimera/i386/util/Makefile =================================================================== --- branches/Chimera/i386/util/Makefile (revision 2657) +++ branches/Chimera/i386/util/Makefile (revision 2658) @@ -12,7 +12,6 @@ IMGSKELROOT = $(SRCROOT)/imgskel CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot - DIR = util include ${SRCROOT}/Make.rules @@ -43,11 +42,11 @@ all: $(DIRS_NEEDED) $(SYMPROG) all-recursive $(SYMPROG): $(OBJS) - @echo "\t[LD32] $(@F)_32" + @echo " [LD32] $(@F)_32" @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch i386 -o $(SYMROOT)/$(@F)_32 $(OBJROOT)/$(@F).o32 - @echo "\t[LD64] $(@F)_64" + @echo " [LD64] $(@F)_64" @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch x86_64 -o $(SYMROOT)/$(@F)_64 $(OBJROOT)/$(@F).o64 - @echo "\t[LIPO] $(@F)" + @echo " [LIPO] $(@F)" @lipo -create -arch i386 $(SYMROOT)/$(@F)_32 -arch x86_64 $(SYMROOT)/$(@F)_64 -output $(SYMROOT)/$(@F) @$(RM) $(SYMROOT)/$(@F)_32 $(SYMROOT)/$(@F)_64 @@ -55,6 +54,6 @@ -include $(OBJROOT)/Makedep clean-local: - @for o in $(OBJS); do if [ -f "$${o}" ];then echo "\t[RM] $${o}"; fi; done - @for p in $(SYMPROG); do if [ -f "$${p}" ];then echo "\t[RM] $${p}"; fi; done + @for o in $(OBJS); do if [ -f "$${o}" ];then echo " [RM] $${o}"; fi; done + @for p in $(SYMPROG); do if [ -f "$${p}" ];then echo " [RM] $${p}"; fi; done @rm -f $(SYMPROG) $(OBJS) Index: branches/Chimera/Chimera 4.1.0 Changes.txt =================================================================== --- branches/Chimera/Chimera 4.1.0 Changes.txt (revision 0) +++ branches/Chimera/Chimera 4.1.0 Changes.txt (revision 2658) @@ -0,0 +1,43 @@ +Chimera 4.0.0 includes: + +Used Chameleon 2.2 r2421 as the code base and incorporated any changes that didn't break Chimera 4.0.1 enhancements +Added Broadwell CPU and IGP support. +Added addition LPC device IDs in spd.c + +Files edited: + +i386/boot2/options.c +i386/boot2/prompt.c +i386/libsaio/acpi_patcher.c +i386/libsaio/aml_generator.c +i386/libsaio/ati.c +i386/libsaio/ati.h +i386/libsaio/bootargs.h +i386/libsaio/bootstruct.c +i386/libsaio/bootstruct.h +i386/libsaio/console.c +i386/libsaio/device_inject.c +i386/libsaio/device_tree.c +i386/libsaio/device_tree.h +i386/libsaio/disk.c +i386/libsaio/dram_controllers.c +i386/libsaio/efi.h +i386/libsaio/fake_efi.c +i386/libsaio/hda.c +i386/libsaio/load.c +i386/libsaio/md5c.c +i386/libsaio/nvidia.c +i386/libsaio/platform.h +i386/libsaio/saio_internal.h +i386/libsaio/saio_types.h +i386/libsaio/smbios_decode.c +i386/libsaio/smbios_getters.c +i386/libsaio/smbios_getters.h +i386/libsaio/smbios.c +i386/libsaio/smbios.h +i386/libsaio/spd.c +i386/libsaio/stringTable.c +i386/libsaio/sys.c +i386/libsaio/vbe.c + +Make.rules Changed to add -Wno-unused-const-variable to CFLAGS \ No newline at end of file