Index: branches/Bungo/Chameleon.xcodeproj/project.pbxproj =================================================================== --- branches/Bungo/Chameleon.xcodeproj/project.pbxproj (revision 2378) +++ branches/Bungo/Chameleon.xcodeproj/project.pbxproj (revision 2379) @@ -3872,7 +3872,7 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0500; }; buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "Chameleon" */; compatibilityVersion = "Xcode 3.2"; @@ -4119,8 +4119,8 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = YES; + GCC_WARN_UNUSED_VARIABLE = NO; + ONLY_ACTIVE_ARCH = NO; SDKROOT = macosx; }; name = Debug; @@ -4130,7 +4130,7 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_WARN_UNUSED_VARIABLE = NO; SDKROOT = macosx; }; name = Release; Index: branches/Bungo/i386/libsaio/console.c =================================================================== --- branches/Bungo/i386/libsaio/console.c (revision 2378) +++ branches/Bungo/i386/libsaio/console.c (revision 2379) @@ -246,6 +246,24 @@ } else { vprf(fmt, ap); } + + { + // Kabyl: BooterLog + struct putc_info pi; + + if (!msgbuf) { + return 0; + } + + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) { + return 0; + } + pi.str = cursor; + pi.last_str = 0; + prf(fmt, ap, sputc, &pi); + cursor += strlen((char *)cursor); + } + va_end(ap); return(0); } Index: branches/Bungo/i386/libsaio/bootstruct.c =================================================================== --- branches/Bungo/i386/libsaio/bootstruct.c (revision 2378) +++ branches/Bungo/i386/libsaio/bootstruct.c (revision 2379) @@ -29,6 +29,16 @@ #include "libsaio.h" #include "bootstruct.h" +#ifndef DEBUG_BOOTSTRUCT +#define DEBUG_BOOTSTRUCT 0 +#endif + +#if DEBUG_BOOTSTRUCT +#define DBG(x...) printf(x) +#else +#define DBG(x...) msglog(x) +#endif + /*========================================================================== * Initialize the structure of parameters passed to * the kernel by the booter. @@ -52,7 +62,7 @@ bootArgs = (boot_args *)malloc(sizeof(boot_args)); bootArgsPreLion = (boot_args_pre_lion *)malloc(sizeof(boot_args_pre_lion)); bootInfo = (PrivateBootInfo_t *)malloc(sizeof(PrivateBootInfo_t)); - if (bootArgs == 0 || bootInfo == 0) + if (bootArgs == 0 || bootArgsPreLion == 0 || bootInfo == 0) stop("Couldn't allocate boot info\n"); bzero(bootArgs, sizeof(boot_args)); Index: branches/Bungo/i386/libsaio/bootstruct.h =================================================================== --- branches/Bungo/i386/libsaio/bootstruct.h (revision 2378) +++ branches/Bungo/i386/libsaio/bootstruct.h (revision 2379) @@ -33,9 +33,9 @@ /* * Kernel boot args global also used by booter for its own data. */ -extern boot_args *bootArgs; -extern boot_args_pre_lion *bootArgsPreLion; -extern Node *gMemoryMapNode; +extern boot_args *bootArgs; +extern boot_args_pre_lion *bootArgsPreLion; +extern Node *gMemoryMapNode; #define VGA_TEXT_MODE 0 //defined in /usr/../boot.h Index: branches/Bungo/i386/libsaio/device_tree.c =================================================================== --- branches/Bungo/i386/libsaio/device_tree.c (revision 2378) +++ branches/Bungo/i386/libsaio/device_tree.c (revision 2379) @@ -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/Bungo/i386/libsaio/hfs.c =================================================================== --- branches/Bungo/i386/libsaio/hfs.c (revision 2378) +++ branches/Bungo/i386/libsaio/hfs.c (revision 2379) @@ -304,7 +304,7 @@ } dirID = kHFSRootFolderID; - // Skip a lead '\'. Start in the system folder if there are two. + // Skip a lead '/'. Start in the system folder if there are two. if (filePath[0] == '/') { if (filePath[1] == '/') @@ -370,7 +370,7 @@ if (*dirIndex == -1) return -1; dirID = kHFSRootFolderID; - // Skip a lead '\'. Start in the system folder if there are two. + // Skip a lead '/'. Start in the system folder if there are two. if (dirPath[0] == '/') { if (dirPath[1] == '/') { if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]); @@ -435,7 +435,7 @@ if (HFSInitPartition(ih) == -1) return -1; dirID = kHFSRootFolderID; - // Skip a lead '\'. Start in the system folder if there are two. + // Skip a lead '/'. Start in the system folder if there are two. if (filePath[0] == '/') { if (filePath[1] == '/') { if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]); Index: branches/Bungo/i386/libsaio/acpi_patcher.c =================================================================== --- branches/Bungo/i386/libsaio/acpi_patcher.c (revision 2378) +++ branches/Bungo/i386/libsaio/acpi_patcher.c (revision 2379) @@ -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; @@ -677,7 +677,7 @@ bool fadt_rev2_needed = false; bool fix_restart; bool fix_restart_ps2; - const char * value; + int value = 1; // Restart Fix if (Platform.CPU.Vendor == 0x756E6547) { /* Intel */ @@ -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; } @@ -708,33 +708,30 @@ fadt_mod=(struct acpi_2_fadt *)AllocateKernelMemory(fadt->Length); memcpy(fadt_mod, fadt, fadt->Length); } - // Determine system type / PM_Model - if ( (value=getStringForKey(kSystemType, &bootInfo->chameleonConfig))!=NULL) - { - if (Platform.Type > 6) { - if(fadt_mod->PM_Profile<=6) { - Platform.Type = fadt_mod->PM_Profile; // get the fadt if correct - } else { - Platform.Type = 1; /* Set a fixed value (Desktop) */ - } - verbose("Error: system-type must be 0..6. Defaulting to %d !\n", Platform.Type); - } else { - Platform.Type = (unsigned char) strtoul(value, NULL, 10); - } - } - // Set PM_Profile from System-type if only user wanted this value to be forced - 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); - 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 - Platform.Type = fadt_mod->PM_Profile <= 6 ? fadt_mod->PM_Profile : 1; - } - } + + // Determine PM Profile + if (getIntForKey(kSystemType, &value, &bootInfo->chameleonConfig)) { + DBG("FADT: changing PM Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, (unsigned char)value); + // user has overriden the PM Profile so take care of it in FACP + fadt_mod->PM_Profile = (unsigned char)value; + } else { + DBG("FADT: PM Profile=0x%02x\n", fadt_mod->PM_Profile); + } + // Check if PM Profile is correct (1..3), otherwise set it to value + switch (fadt_mod->PM_Profile) { + case 1: break; + case 2: break; + case 3: break; + default: + value = 1; + DBG("FADT: wrong PM Profile (0x%02x), must be 1..3. Defaulting to 0x%02x!\n", fadt_mod->PM_Profile, (unsigned char)value); + fadt_mod->PM_Profile = (unsigned char)value; + } + // Setup system-type + Platform.Type = fadt_mod->PM_Profile; + // 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 +744,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 +753,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"); } } @@ -771,8 +768,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 +790,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 +799,7 @@ int setupAcpi(void) { int version; - void *new_dsdt; + void *new_dsdt, *new_table; const char *filename; @@ -823,6 +819,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 +837,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 +846,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++; @@ -858,6 +855,10 @@ } } } + + // Load new table + sprintf(dirSpec, "ECDT.aml"); + new_table = loadACPITable(dirSpec); // Do the same procedure for both versions of ACPI for (version = 0; version < 2; version++) { @@ -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); @@ -895,7 +896,7 @@ if (rsdt && (uint32_t)rsdt !=0xffffffff && rsdt->Length<0x10000) { uint32_t *rsdt_entries; int rsdt_entries_num; - int dropoffset=0, i; + int dropoffset=0, i, j; // mozo: using malloc cos I didn't found how to free already allocated kernel memory rsdt_mod=(struct acpi_2_rsdt *)malloc(rsdt->Length); @@ -909,22 +910,22 @@ continue; } - DBG("TABLE %c%c%c%c,",table[0],table[1],table[2],table[3]); + //DBG("TABLE %c%c%c%c,",table[0],table[1],table[2],table[3]); + DBG("TABLE %c%c%c%c@%x: ", table[0],table[1],table[2],table[3],rsdt_entries[i]); rsdt_entries[i-dropoffset]=rsdt_entries[i]; if (drop_ssdt && tableSign(table, "SSDT")) { - verbose("OEM SSDT tables was dropped\n"); + DBG("dropped (OEM)\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; + DBG("custom table added\n"); } - continue; } @@ -932,10 +933,10 @@ struct acpi_2_fadt *fadt, *fadt_mod; fadt=(struct acpi_2_fadt *)rsdt_entries[i]; - DBG("FADT found @%x, Length %d\n",fadt, fadt->Length); + DBG("found, Length %d\n",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,56 +956,55 @@ generate_pstates = false; // Generate SSDT only once! ssdt_count++; } - continue; } + DBG("coppied (OEM)\n"); } - DBG("\n"); + // Mozodojo: Insert additional SSDTs into RSDT + if(ssdt_count > 0) { + for (j=0; jLength += 4*ssdt_count - 4*dropoffset; + rsdt_mod->Length += 4*ssdt_count + 4 - 4*dropoffset; struct acpi_2_rsdt *rsdt_copy = (struct acpi_2_rsdt *)AllocateKernelMemory(rsdt_mod->Length); memcpy (rsdt_copy, rsdt_mod, rsdt_mod->Length); - free(rsdt_mod); rsdt_mod = rsdt_copy; + free(rsdt_mod); + rsdt_mod = rsdt_copy; rsdp_mod->RsdtAddress=(uint32_t)rsdt_mod; rsdt_entries_num=(rsdt_mod->Length-sizeof(struct acpi_2_rsdt))/4; rsdt_entries=(uint32_t *)(rsdt_mod+1); - - // Mozodojo: Insert additional SSDTs into RSDT - if(ssdt_count>0) { - int j; - - for (j=0; jChecksum); - rsdt_mod->Checksum=0; rsdt_mod->Checksum=256-checksum8(rsdt_mod,rsdt_mod->Length); - DBG("New checksum %d at %x\n", rsdt_mod->Checksum,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; // FIXME: handle 64-bit address correctly - xsdt=(struct acpi_2_xsdt*) ((uint32_t)rsdp->XsdtAddress); DBG("XSDT @%x;%x, Length=%d\n", (uint32_t)(rsdp->XsdtAddress>>32),(uint32_t)rsdp->XsdtAddress, xsdt->Length); if (xsdt && (uint64_t)rsdp->XsdtAddress<0xffffffff && xsdt->Length<0x10000) { uint64_t *xsdt_entries; - int xsdt_entries_num, i; + int xsdt_entries_num, i, j; int dropoffset=0; // mozo: using malloc cos I didn't found how to free already allocated kernel memory @@ -1019,62 +1019,75 @@ if (!table) { continue; } + + DBG("TABLE %c%c%c%c@%x: ", table[0],table[1],table[2],table[3],xsdt_entries[i]); + xsdt_entries[i-dropoffset]=xsdt_entries[i]; if (drop_ssdt && tableSign(table, "SSDT")) { - verbose("OEM SSDT tables was dropped\n"); + DBG("dropped (OEM)\n"); dropoffset++; continue; } + if (tableSign(table, "DSDT")) { - DBG("DSDT found\n"); - 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")) { struct acpi_2_fadt *fadt, *fadt_mod; fadt=(struct acpi_2_fadt *)(uint32_t)xsdt_entries[i]; - DBG("FADT found @%x%x, Length %d\n",(uint32_t)(xsdt_entries[i]>>32),fadt, - fadt->Length); + DBG("found, Length %d\n",(uint32_t)(xsdt_entries[i]>>32), 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("coppied (OEM)\n"); + // DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]); } + + // Mozodojo: Insert additional SSDTs into XSDT + if(ssdt_count > 0) { + for (j=0; jLength += 8*ssdt_count - 8*dropoffset; + xsdt_mod->Length += 8*ssdt_count + 8 - 8*dropoffset; struct acpi_2_xsdt *xsdt_copy = (struct acpi_2_xsdt *)AllocateKernelMemory(xsdt_mod->Length); memcpy(xsdt_copy, xsdt_mod, xsdt_mod->Length); free(xsdt_mod); xsdt_mod = xsdt_copy; @@ -1082,53 +1095,36 @@ xsdt_entries_num=(xsdt_mod->Length-sizeof(struct acpi_2_xsdt))/8; xsdt_entries=(uint64_t *)(xsdt_mod+1); - // Mozodojo: Insert additional SSDTs into XSDT - if(ssdt_count > 0) { - int j; - - for (j=0; jChecksum); xsdt_mod->Checksum=0; xsdt_mod->Checksum=256-checksum8(xsdt_mod,xsdt_mod->Length); + DBG("New checksum %d\n", xsdt_mod->Checksum); } else { drop_xsdt: - DBG("About to drop XSDT\n"); - /*FIXME: Now we just hope that if MacOS doesn't find XSDT it reverts to RSDT. * A Better strategy would be to generate */ - rsdp_mod->XsdtAddress=0xffffffffffffffffLL; 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 +1134,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/Bungo/i386/libsaio/device_tree.h =================================================================== --- branches/Bungo/i386/libsaio/device_tree.h (revision 2378) +++ branches/Bungo/i386/libsaio/device_tree.h (revision 2379) @@ -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/Bungo/i386/libsaio/bootargs.h =================================================================== --- branches/Bungo/i386/libsaio/bootargs.h (revision 2378) +++ branches/Bungo/i386/libsaio/bootargs.h (revision 2379) @@ -116,7 +116,7 @@ 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/Bungo/i386/libsaio/device_inject.c =================================================================== --- branches/Bungo/i386/libsaio/device_inject.c (revision 2378) +++ branches/Bungo/i386/libsaio/device_inject.c (revision 2379) @@ -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; Index: branches/Bungo/i386/libsaio/sys.c =================================================================== --- branches/Bungo/i386/libsaio/sys.c (revision 2378) +++ branches/Bungo/i386/libsaio/sys.c (revision 2379) @@ -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; @@ -206,18 +213,20 @@ 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) { return 0; } - // We found a fat binary; read only the thin part + // 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) { @@ -234,7 +243,7 @@ ThinFatFile(binary, &length); } } - + return length; } Index: branches/Bungo/i386/libsaio/load.c =================================================================== --- branches/Bungo/i386/libsaio/load.c (revision 2378) +++ branches/Bungo/i386/libsaio/load.c (revision 2379) @@ -32,6 +32,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,10 +60,10 @@ 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 { @@ -102,22 +108,23 @@ unsigned long cnt; long ret = -1; unsigned int entry = 0; - + gBinaryAddress = (unsigned long)binary; 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: @@ -131,11 +138,11 @@ break; case CPU_TYPE_X86_64: - +/* if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC) { return -1; } - +*/ if (mH->magic != MH_MAGIC_64) { error("Mach-O file has bad magic number\n"); return -1; @@ -201,13 +208,13 @@ cmdBase = cmdstart; for (cnt = 0; cnt < ncmds; cnt++) { - cmd = ((long *)cmdBase)[0]; - cmdsize = ((long *)cmdBase)[1]; + cmd = ((long *)cmdBase)[0]; + cmdsize = ((long *)cmdBase)[1]; - if (cmd == LC_SYMTAB) { - if (DecodeSymbolTable(cmdBase) != 0) { + if (cmd == LC_SYMTAB) { + if (DecodeSymbolTable(cmdBase) != 0) { return -1; - } + } } cmdBase += cmdsize; Index: branches/Bungo/i386/libsaio/platform.c =================================================================== --- branches/Bungo/i386/libsaio/platform.c (revision 2378) +++ branches/Bungo/i386/libsaio/platform.c (revision 2379) @@ -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/Bungo/i386/libsaio/cpu.c =================================================================== --- branches/Bungo/i386/libsaio/cpu.c (revision 2378) +++ branches/Bungo/i386/libsaio/cpu.c (revision 2379) @@ -261,17 +261,17 @@ do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]); } -#if DEBUG_CPU +// #if DEBUG_CPU { int i; - printf("CPUID Raw Values:\n"); + DBG("CPUID Raw Values:\n"); for (i=0; iCPU.CPUID[i][0], p->CPU.CPUID[i][1], p->CPU.CPUID[i][2], p->CPU.CPUID[i][3]); } } -#endif +// #endif /* EAX (Intel): Index: branches/Bungo/i386/libsaio/platform.h =================================================================== --- branches/Bungo/i386/libsaio/platform.h (revision 2378) +++ branches/Bungo/i386/libsaio/platform.h (revision 2379) @@ -32,8 +32,8 @@ #define CPU_MODEL_PENTIUM_M 0x09 // Banias Pentium M (130nm) #define CPU_MODEL_DOTHAN 0x0D // Dothan Pentium M, Celeron M (90nm) -#define CPU_MODEL_PRESCOTT 0x03 // Celeron D, Pentium 4 (90nm) -#define CPU_MODEL_NOCONA 0x04 // Xeon Nocona, Irwindale (90nm) +#define CPU_MODEL_NOCONA 0x03 // Celeron D, Pentium 4 (90nm) +#define CPU_MODEL_IRWINDALE 0x04 // Xeon Nocona, Irwindale (90nm) #define CPU_MODEL_PRESLER 0x06 // Pentium 4, Pentium D (65nm) #define CPU_MODEL_CELERON 0x16 // Merom, Conroe (65nm) #define CPU_MODEL_YONAH 0x0E // Sossaman, Yonah @@ -177,7 +177,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/Bungo/i386/libsaio/cpu.h =================================================================== --- branches/Bungo/i386/libsaio/cpu.h (revision 2378) +++ branches/Bungo/i386/libsaio/cpu.h (revision 2379) @@ -10,7 +10,7 @@ extern void scan_cpu(PlatformInfo_t *); -#define bit(n) (1ULL << (n)) +#define bit(n) (1ULL << (n)) #define bitmask(h,l) ((bit(h)|(bit(h)-1)) & ~(bit(l)-1)) #define bitfield(x,h,l) (((x) & bitmask(h,l)) >> l) @@ -102,25 +102,25 @@ * The CPUID_EXTFEATURE_XXX values define 64-bit values * returned in %ecx:%edx to a CPUID request with %eax of 0x80000001: */ -#define CPUID_EXTFEATURE_SYSCALL _Bit(11) /* SYSCALL/sysret */ -#define CPUID_EXTFEATURE_XD _Bit(20) /* eXecute Disable */ +#define CPUID_EXTFEATURE_SYSCALL _Bit(11) /* SYSCALL/sysret */ +#define CPUID_EXTFEATURE_XD _Bit(20) /* eXecute Disable */ -#define CPUID_EXTFEATURE_1GBPAGE _Bit(26) /* 1GB pages */ -#define CPUID_EXTFEATURE_RDTSCP _Bit(27) /* RDTSCP */ -#define CPUID_EXTFEATURE_EM64T _Bit(29) /* Extended Mem 64 Technology */ +#define CPUID_EXTFEATURE_1GBPAGE _Bit(26) /* 1GB pages */ +#define CPUID_EXTFEATURE_RDTSCP _Bit(27) /* RDTSCP */ +#define CPUID_EXTFEATURE_EM64T _Bit(29) /* Extended Mem 64 Technology */ -#define CPUID_EXTFEATURE_LAHF _HBit(0) /* LAFH/SAHF instructions */ +#define CPUID_EXTFEATURE_LAHF _HBit(0) /* LAFH/SAHF instructions */ /* * The CPUID_EXTFEATURE_XXX values define 64-bit values * returned in %ecx:%edx to a CPUID request with %eax of 0x80000007: */ -#define CPUID_EXTFEATURE_TSCI _Bit(8) /* TSC Invariant */ +#define CPUID_EXTFEATURE_TSCI _Bit(8) /* TSC Invariant */ #define CPUID_CACHE_SIZE 16 /* Number of descriptor values */ -#define CPUID_MWAIT_EXTENSION _Bit(0) /* enumeration of WMAIT extensions */ -#define CPUID_MWAIT_BREAK _Bit(1) /* interrupts are break events */ +#define CPUID_MWAIT_EXTENSION _Bit(0) /* enumeration of WMAIT extensions */ +#define CPUID_MWAIT_BREAK _Bit(1) /* interrupts are break events */ //-- processor type -> p_type: #define PT_OEM 0x00 // Intel Original OEM Processor; @@ -155,19 +155,19 @@ #define IA32_ENERGY_PERF_BIAS 0x01B0 #define MSR_PACKAGE_THERM_STATUS 0x01B1 #define IA32_PLATFORM_DCA_CAP 0x01F8 -#define MSR_POWER_CTL 0x01FC // MSR 000001FC 0000-0000-0004-005F +#define MSR_POWER_CTL 0x01FC // MSR 000001FC 0000-0000-0004-005F // Sandy Bridge & JakeTown specific 'Running Average Power Limit' MSR's. #define MSR_RAPL_POWER_UNIT 0x606 /* R/O */ //MSR 00000606 0000-0000-000A-1003 -#define MSR_PKGC3_IRTL 0x60A /* RW time limit to go C3 */ +#define MSR_PKGC3_IRTL 0x60A /* RW time limit to go C3 */ // bit 15 = 1 -- the value valid for C-state PM -#define MSR_PKGC6_IRTL 0x60B /* RW time limit to go C6 */ +#define MSR_PKGC6_IRTL 0x60B /* RW time limit to go C6 */ //MSR 0000060B 0000-0000-0000-8854 //Valid + 010=1024ns + 0x54=84mks -#define MSR_PKGC7_IRTL 0x60C /* RW time limit to go C7 */ +#define MSR_PKGC7_IRTL 0x60C /* RW time limit to go C7 */ //MSR 0000060C 0000-0000-0000-8854 -#define MSR_PKG_C2_RESIDENCY 0x60D /* same as TSC but in C2 only */ +#define MSR_PKG_C2_RESIDENCY 0x60D /* same as TSC but in C2 only */ #define MSR_PKG_RAPL_POWER_LIMIT 0x610 //MSR 00000610 0000-A580-0000-8960 #define MSR_PKG_ENERGY_STATUS 0x611 //MSR 00000611 0000-0000-3212-A857 @@ -219,20 +219,21 @@ { asm volatile ("cpuid" : "=a" (data[0]), - "=b" (data[1]), - "=c" (data[2]), - "=d" (data[3]) - : "a" (selector)); + "=b" (data[1]), + "=c" (data[2]), + "=d" (data[3]) + : "a" (selector)); } static inline void do_cpuid2(uint32_t selector, uint32_t selector2, uint32_t *data) { asm volatile ("cpuid" : "=a" (data[0]), - "=b" (data[1]), - "=c" (data[2]), - "=d" (data[3]) - : "a" (selector), "c" (selector2)); + "=b" (data[1]), + "=c" (data[2]), + "=d" (data[3]) + : "a" (selector), + "c" (selector2)); } // DFE: enable_PIT2 and disable_PIT2 come from older xnu Index: branches/Bungo/i386/libsaio/smbios.c =================================================================== --- branches/Bungo/i386/libsaio/smbios.c (revision 2378) +++ branches/Bungo/i386/libsaio/smbios.c (revision 2379) @@ -127,7 +127,7 @@ ================================================ */ //#define kSMBOemPlatformFeatureKey "SMoemplatformfeature" -/* ==================================================*/ +/* =================================================*/ #define getFieldOffset(struct, field) ((uint8_t)(uint32_t)&(((struct *)0)->field)) typedef struct Index: branches/Bungo/i386/libsaio/stringTable.c =================================================================== --- branches/Bungo/i386/libsaio/stringTable.c (revision 2378) +++ branches/Bungo/i386/libsaio/stringTable.c (revision 2379) @@ -60,7 +60,7 @@ break; } } else if (c == '\"') { - /* Premature end of key */ + // Premature end of key return 1; } if (c != *str++) { @@ -254,8 +254,7 @@ #endif -char * -newStringForKey(char *key, config_file_t *config) +char *newStringForKey(char *key, config_file_t *config) { const char *val; char *newstr; Index: branches/Bungo/i386/libsaio/fake_efi.c =================================================================== --- branches/Bungo/i386/libsaio/fake_efi.c (revision 2378) +++ branches/Bungo/i386/libsaio/fake_efi.c (revision 2379) @@ -74,9 +74,10 @@ /* Identify ourselves as the EFI firmware vendor */ static EFI_CHAR16 const FIRMWARE_VENDOR[] = {'C','h','a','m','e','l','e','o','n','_','2','.','2', 0}; -static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */ - // Bungo +//static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */ +static EFI_UINT32 const FIRMWARE_REVISION = 0x0001000a; // got from real MBP6,1 +// Bungo /* Default platform system_id (fix by IntVar) static EFI_CHAR8 const SYSTEM_ID[] = "0123456789ABCDEF"; //random value gen by uuidgen */ @@ -438,13 +439,23 @@ static const char FIRMWARE_VENDOR_PROP[] = "firmware-vendor"; static const char FIRMWARE_ABI_32_PROP_VALUE[] = "EFI32"; static const char FIRMWARE_ABI_64_PROP_VALUE[] = "EFI64"; +static const char EFI_MODE_PROP[] = "efi-mode"; //Bungo static const char SYSTEM_ID_PROP[] = "system-id"; static const char SYSTEM_SERIAL_PROP[] = "SystemSerialNumber"; static const char SYSTEM_TYPE_PROP[] = "system-type"; static const char MODEL_PROP[] = "Model"; static const char BOARDID_PROP[] = "board-id"; static const char DEV_PATH_SUP[] = "DevicePathsSupported"; -static uint32_t DevPathSup = 1; +static EFI_UINT32 DevPathSup = 1; +static EFI_UINT32 MachineSig = 0; //Bungo +static EFI_UINT8 const RANDOM_SEED[] = +{ + 0x40, 0x00, 0x50, 0x00, 0x5c, 0x00, 0x53, 0x00, 0x79, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00, + 0x6d, 0x00, 0x5c, 0x00, 0x4c, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, + 0x79, 0x00, 0x5c, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x65, 0x00, 0x53, 0x00, 0x65, 0x00, + 0x72, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00, 0x73, 0x00, 0x5c, 0x00, 0x62, 0x00 +}; + /* * Get an smbios option string option to convert to EFI_CHAR16 string */ @@ -567,15 +578,17 @@ // But I think eventually we want to fill stuff in the efi node // too so we might as well create it so we have a pointer for it too. 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); - } else { - DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_64_PROP_VALUE), (char*)FIRMWARE_ABI_64_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_REVISION_PROP, sizeof(FIRMWARE_REVISION), (EFI_UINT32*)&FIRMWARE_REVISION); - DT__AddProperty(node, FIRMWARE_VENDOR_PROP, sizeof(FIRMWARE_VENDOR), (EFI_CHAR16*)FIRMWARE_VENDOR); + DT__AddProperty(node, EFI_MODE_PROP, sizeof(EFI_UINT8), (EFI_UINT8 *)&bootArgs->efiMode); + + DT__AddProperty(node, FIRMWARE_REVISION_PROP, sizeof(FIRMWARE_REVISION), (EFI_UINT32 *)&FIRMWARE_REVISION); + DT__AddProperty(node, FIRMWARE_VENDOR_PROP, sizeof(FIRMWARE_VENDOR), (EFI_CHAR16 *)FIRMWARE_VENDOR); // TODO: Fill in other efi properties if necessary @@ -598,7 +611,12 @@ // all of the configuration tables needed by various kernel extensions. gEfiConfigurationTableNode = DT__AddChild(node, "configuration-table"); - // Now fill in the /efi/platform Node + // New node: /efi/kernel-compatibility + Node *efiKernelComNode = DT__AddChild(node, "kernel-compatibility"); + len = 1; + DT__AddProperty(efiKernelComNode, "x86_64", sizeof(uint32_t), (EFI_UINT32 *)&len); + + // Now fill in the /efi/platform Node Node *efiPlatformNode = DT__AddChild(node, "platform"); // NOTE WELL: If you do add FSB Frequency detection, make sure to store @@ -618,7 +636,7 @@ DT__AddProperty(efiPlatformNode, CPU_Frequency_prop, sizeof(uint64_t), &Platform.CPU.CPUFrequency); } - DT__AddProperty(efiPlatformNode,DEV_PATH_SUP, sizeof(uint32_t), &DevPathSup); + DT__AddProperty(efiPlatformNode,DEV_PATH_SUP, sizeof(EFI_UINT32), &DevPathSup); // Bungo /* Export system-id. Can be disabled with SystemId=No in com.apple.Boot.plist @@ -674,11 +692,23 @@ stop("Couldn't get chosen node"); } - int bootUUIDLength = strlen(gBootUUIDString); - if (bootUUIDLength) + int length = strlen(gBootUUIDString); + if (length) { - DT__AddProperty(chosenNode, "boot-uuid", bootUUIDLength + 1, gBootUUIDString); + DT__AddProperty(chosenNode, "boot-uuid", length + 1, gBootUUIDString); } + + length = strlen(bootArgs->CommandLine); + DT__AddProperty(chosenNode, "boot-args", length + 1, bootArgs->CommandLine); + + length = strlen(bootInfo->bootFile); + DT__AddProperty(chosenNode, "boot-file", length + 1, bootInfo->bootFile); +// DT__AddProperty(chosenNode, "boot-device-path", bootDPsize, gBootDP); +// DT__AddProperty(chosenNode, "boot-file-path", bootFPsize, gBootFP); +// DT__AddProperty(chosenNode, "boot-kernelchache-adler32", sizeof(adler32), adler32); + + DT__AddProperty(chosenNode, "machine-signature", sizeof(EFI_UINT32), (EFI_UINT32 *)&MachineSig); + DT__AddProperty(chosenNode, "random-seed", sizeof(RANDOM_SEED), (EFI_UINT8*) &RANDOM_SEED); } /* @@ -776,7 +806,7 @@ } memcpy(tableAddress, (void *)origeps->dmi.tableAddress, origeps->dmi.tableLength); - DT__AddProperty(node, "SMBIOS-ORIG", origeps->dmi.tableLength, tableAddress); // Bungo: changed from SMBIOS to SMBIOS-ORIG to differentiate + DT__AddProperty(node, "SMBIOS", origeps->dmi.tableLength, tableAddress); } /* Index: branches/Bungo/i386/libsaio/smbios_getters.c =================================================================== --- branches/Bungo/i386/libsaio/smbios_getters.c (revision 2378) +++ branches/Bungo/i386/libsaio/smbios_getters.c (revision 2379) @@ -30,6 +30,7 @@ // set external clock to 0 for SANDY // removes FSB info from system profiler as on real mac's. case CPU_MODEL_SANDYBRIDGE: + case CPU_MODEL_JAKETOWN: case CPU_MODEL_IVYBRIDGE_XEON: case CPU_MODEL_IVYBRIDGE: case CPU_MODEL_HASWELL: @@ -85,10 +86,10 @@ case CPU_MODEL_NEHALEM_EX: // Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x case CPU_MODEL_WESTMERE_EX: // Intel Xeon E7 case CPU_MODEL_SANDYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (32nm) + case CPU_MODEL_JAKETOWN: // Intel Core i7, Xeon E5 LGA2011 (32nm) case CPU_MODEL_IVYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (22nm) case CPU_MODEL_IVYBRIDGE_XEON: case CPU_MODEL_HASWELL: - case CPU_MODEL_JAKETOWN: // Intel Core i7, Xeon E5 LGA2011 (32nm) { // thanks to dgobe for i3/i5/i7 bus speed detection int nhm_bus = 0x3F; @@ -163,8 +164,11 @@ switch (Platform.CPU.Model) { case CPU_MODEL_PENTIUM_M: case CPU_MODEL_DOTHAN: // 0x0D - Intel Pentium M model D - case CPU_MODEL_PRESCOTT: + case CPU_MODEL_IRWINDALE: case CPU_MODEL_NOCONA: + if (strstr(Platform.CPU.BrandString, "Xeon")) { + value->word = 0x402; // 1026 - Xeon + } return true; case CPU_MODEL_PRESLER: @@ -176,7 +180,7 @@ case CPU_MODEL_MEROM: // 0x0F - Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx case CPU_MODEL_XEON_MP: // 0x1D - Six-Core Xeon 7400, "Dunnington", 45nm case CPU_MODEL_PENRYN: // 0x17 - Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx - if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + if (strstr(Platform.CPU.BrandString, "Xeon")) { value->word = 0x402; // 1026 - Xeon return true; } @@ -195,7 +199,7 @@ case CPU_MODEL_NEHALEM: // 0x1A - Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm) case CPU_MODEL_FIELDS: // 0x1E - Intel Core i5, i7, Xeon X34xx LGA1156 (45nm) case CPU_MODEL_DALES: // 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale) - if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + if (strstr(Platform.CPU.BrandString, "Xeon")) { value->word = 0x501; // // 1281 - Lynnfiled Quad-Core Xeon return true; } @@ -219,7 +223,7 @@ case CPU_MODEL_DALES_32NM: // 0x25 - Intel Core i3, i5 LGA1156 (32nm) (Clarkdale, Arrandale) case CPU_MODEL_WESTMERE: // 0x2C - Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core case CPU_MODEL_WESTMERE_EX: // 0x2F - Intel Xeon E7 - if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + if (strstr(Platform.CPU.BrandString, "Xeon")) { value->word = 0x501; // Xeon return true; } @@ -242,7 +246,7 @@ case CPU_MODEL_JAKETOWN: // 0x2D - Intel Core i7, Xeon E5-xxxx LGA2011 (32nm) case CPU_MODEL_SANDYBRIDGE: // 0x2A - Intel Core i3, i5, i7 LGA1155 (32nm) - if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + if (strstr(Platform.CPU.BrandString, "Xeon")) { value->word = 0x501; // Xeon return true; } @@ -264,7 +268,7 @@ return true; case CPU_MODEL_IVYBRIDGE: // 0x3A - Intel Core i3, i5, i7 LGA1155 (22nm) - if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + if (strstr(Platform.CPU.BrandString, "Xeon")) { value->word = 0xA01; // 2561 - Xeon return true; } @@ -293,7 +297,7 @@ case CPU_MODEL_HASWELL_SVR: // 0x3F - case CPU_MODEL_HASWELL_ULT: // 0x45 - case CPU_MODEL_CRYSTALWELL: // 0x46 - if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + if (strstr(Platform.CPU.BrandString, "Xeon")) { value->word = 0xA01; // 2561 - Xeon return true; } Index: branches/Bungo/i386/boot2/drivers.c =================================================================== --- branches/Bungo/i386/boot2/drivers.c (revision 2378) +++ branches/Bungo/i386/boot2/drivers.c (revision 2379) @@ -40,8 +40,14 @@ #include "ramdisk.h" #include "modules.h" -//extern char gMacOSVersion[8]; +#if DEBUG +#define DBG(x...) printf(x) +#else +#define DBG(x...) msglog(x) +#endif +// extern char gMacOSVersion[8]; + struct Module { struct Module *nextModule; long willLoad; @@ -837,16 +843,18 @@ static char gPlatformName[64]; #endif +char *gDarwinBuildVerStr = "Darwin Kernel Version"; // Bungo + long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize) { - long ret; + long ret = 0; compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary; - u_int32_t uncompressed_size, size; - void *buffer; - unsigned long len; + u_int32_t uncompressed_size = 0, size = 0, adler32 = 0; + void *buffer = NULL; + unsigned long len = 0; -#if 0 +/*#if 0 printf("kernel header:\n"); printf("signature: 0x%x\n", kernel_header->signature); printf("compress_type: 0x%x\n", kernel_header->compress_type); @@ -854,13 +862,15 @@ printf("uncompressed_size: 0x%x\n", kernel_header->uncompressed_size); printf("compressed_size: 0x%x\n", kernel_header->compressed_size); getchar(); -#endif +#endif*/ if (kernel_header->signature == OSSwapBigToHostConstInt32('comp')) { + DBG("Decompressing Kernel: "); + if (kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss')) { - error("kernel compression is bad\n"); + error("ERROR: kernel compression is bad!\n"); return -1; } #if NOTDEF @@ -873,23 +883,23 @@ return -1; } #endif - uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size); binary = buffer = malloc(uncompressed_size); - size = decompress_lzss((u_int8_t *) binary, &kernel_header->data[0], - OSSwapBigToHostInt32(kernel_header->compressed_size)); + size = decompress_lzss((u_int8_t *)binary, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size)); if (uncompressed_size != size) { - error("size mismatch from lzss: %x\n", size); + error("ERROR: size mismatch from lzss (found: %x, expected: %x).\n", size, uncompressed_size); return -1; } - if (OSSwapBigToHostInt32(kernel_header->adler32) != - Adler32(binary, uncompressed_size)) + adler32 = Adler32(binary, uncompressed_size); + if (OSSwapBigToHostInt32(kernel_header->adler32) != adler32) { - printf("adler mismatch\n"); + error("ERROR: adler mismatch (found: %x, expected: %x).\n", adler32, OSSwapBigToHostInt32(kernel_header->adler32)); return -1; } + + DBG("OK.\n"); } ret = ThinFatFile(&binary, &len); @@ -898,6 +908,13 @@ archCpuType=CPU_TYPE_I386; ret = ThinFatFile(&binary, &len); } + + // Bungo: no range checking, sorry + size = 0; + while (memcmp((uint8_t *)binary + size, (uint8_t *)gDarwinBuildVerStr, 21)) { + size++; + } + gDarwinBuildVerStr = (char *)binary + size; // Notify modules that the kernel has been decompressed, thinned and is about to be decoded execute_hook("DecodeKernel", (void*)binary, NULL, NULL, NULL); @@ -908,6 +925,6 @@ archCpuType=CPU_TYPE_I386; ret = DecodeMachO(binary, rentry, raddr, rsize); } - + return ret; } Index: branches/Bungo/i386/boot2/boot.c =================================================================== --- branches/Bungo/i386/boot2/boot.c (revision 2378) +++ branches/Bungo/i386/boot2/boot.c (revision 2379) @@ -59,7 +59,18 @@ #include "gui.h" #include "platform.h" #include "modules.h" +#include "device_tree.h" +#ifndef DEBUG_BOOT2 +#define DEBUG_BOOT2 0 +#endif + +#if DEBUG_BOOT2 +#define DBG(x...) printf(x) +#else +#define DBG(x...) msglog(x) +#endif + /* * How long to wait (in seconds) to load the * kernel after displaying the "boot:" prompt. @@ -75,7 +86,7 @@ char gRootDevice[ROOT_DEVICE_SIZE]; char gMKextName[512]; char gMacOSVersion[8]; -int bvCount = 0, gDeviceCount = 0; +int bvCount = 0, gDeviceCount = 0; //int menucount = 0; long gBootMode; /* defaults to 0 == kBootModeNormal */ BVRef bvr, menuBVR, bvChain; @@ -165,9 +176,6 @@ md0Ramdisk(); - verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64"); - verbose("Boot Args: %s\n", bootArgs->CommandLine); - // Cleanup the PXE base code. if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) { @@ -192,6 +200,10 @@ } else { drawBootGraphics(); } + + DBG("Starting Darwin/%s [%s]\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64", gDarwinBuildVerStr); + DBG("Boot Args: %s\n", bootArgs->CommandLine); + setupBooterLog(); finalizeBootStruct(); @@ -231,7 +243,7 @@ unsigned long adler32; if((gBootMode & kBootModeSafe) != 0) { - verbose("Kernel Cache ignored.\n"); + DBG("Kernel Cache ignored.\n"); return -1; } @@ -251,12 +263,12 @@ else if (checkOSVersion("10.6")) { snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s", (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); - int lnam = strlen(kernelCacheFile) + 9; //with adler32 - - char* name; - long prev_time = 0; - - struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow); + + int lnam = strlen(kernelCacheFile) + 9; //with adler32 + char *name; + long prev_time = 0; + struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow); + /* TODO: handle error? */ if (cacheDir) { while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0) { @@ -271,9 +283,7 @@ } else { // Reset cache name. bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64); - snprintf(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64, - "%s,%s", - gRootDevice, bootInfo->bootFile); + snprintf(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64, "%s,%s", gRootDevice, bootInfo->bootFile); adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler)); snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s.%08lX", kDefaultCachePathLeo, adler32); } @@ -309,7 +319,7 @@ // Exit if kernel cache file wasn't found if (ret == -1) { - verbose("No Kernel Cache File '%s' found\n", kernelCacheFile); + DBG("No Kernel Cache File '%s' found\n", kernelCacheFile); return -1; } @@ -319,7 +329,7 @@ // Check if the kernel file is more recent than the cache file if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) && (kerneltime > cachetime)) { - verbose("Kernel file (%s) is more recent than KernelCache (%s), ignoring KernelCache\n", + DBG("Kernel file (%s) is more recent than Kernel Cache (%s)! Ignoring Kernel Cache.\n", bootInfo->bootFile, kernelCacheFile); return -1; } @@ -328,13 +338,13 @@ // Check if the S/L/E directory time is more recent than the cache file if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) && (exttime > cachetime)) { - verbose("/System/Library/Extensions is more recent than KernelCache (%s), ignoring KernelCache\n", + DBG("Folder: '/System/Library/Extensions' is more recent than Kernel Cache file (%s)! Ignoring Kernel Cache.\n", kernelCacheFile); return -1; } // Since the kernel cache file exists and is the most recent try to load it - verbose("Loading kernel cache %s\n", kernelCachePath); + DBG("Loading kernel cache: '%s'\n", kernelCachePath); ret = LoadThinFatFile(kernelCachePath, binary); return ret; // ret contain the length of the binary @@ -379,12 +389,13 @@ // Record the device that the booter was loaded from. gBIOSDev = biosdev & kBIOSDevMask; + + // Initialize boot-log + initBooterLog(); // Initialize boot info structure. initKernBootStruct(); - initBooterLog(); - // Setup VGA text mode. // Not sure if it is safe to call setVideoMode() before the // config table has been loaded. Call video_mode() instead. @@ -603,8 +614,6 @@ HibernateBoot((char *)val); break; } - - verbose("Loading Darwin %s\n", gMacOSVersion); getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig); if (useKernelCache) do { @@ -623,13 +632,12 @@ } if (gOverrideKernel && kernelCacheFile[0] == 0) { - verbose("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n", - bootInfo->bootFile); + DBG("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n", bootInfo->bootFile); useKernelCache = false; break; } if (gMKextName[0] != 0) { - verbose("Using a specific MKext Cache (%s), KernelCache will not be used\n", + DBG("Using a specific MKext Cache (%s), KernelCache will not be used\n", gMKextName); useKernelCache = false; break; @@ -679,8 +687,8 @@ // No alternate location found, using the original kernel image path. strlcpy(bootFilePath, bootFile, sizeof(bootFilePath)); } - - verbose("Loading kernel %s\n", bootFilePath); + + DBG("Loading kernel: '%s'\n", bootFilePath); ret = LoadThinFatFile(bootFilePath, &binary); if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) { Index: branches/Bungo/i386/boot2/boot.h =================================================================== --- branches/Bungo/i386/boot2/boot.h (revision 2378) +++ branches/Bungo/i386/boot2/boot.h (revision 2379) @@ -53,66 +53,66 @@ #define kKernelCacheKey "Kernel Cache" #define kUseKernelCache "UseKernelCache" /* boot.c */ #define kBootDeviceKey "Boot Device" -#define kTimeoutKey "Timeout" +#define kTimeoutKey "Timeout" #define kRootDeviceKey "rd" #define kBootUUIDKey "boot-uuid" #define kHelperRootUUIDKey "Root UUID" #define kPlatformKey "platform" -#define kACPIKey "acpi" +#define kACPIKey "acpi" #define kCDROMPromptKey "CD-ROM Prompt" #define kCDROMOptionKey "CD-ROM Option Key" #define kRescanPromptKey "Rescan Prompt" -#define kRescanKey "Rescan" +#define kRescanKey "Rescan" #define kScanSingleDriveKey "Scan Single Drive" #define kInstantMenuKey "Instant Menu" #define kDefaultKernel "mach_kernel" -#define kGUIKey "GUI" +#define kGUIKey "GUI" #define kBootBannerKey "Boot Banner" #define kShowInfoKey "ShowInfo" // gui.c #define kWaitForKeypressKey "Wait" /* AsereBLN: added these keys */ -#define kUseAtiROM "UseAtiROM" /* ati.c */ -#define kWake "Wake" /* boot.c */ -#define kForceWake "ForceWake" /* boot.c */ -#define kWakeImage "WakeImage" /* boot.c */ +#define kUseAtiROM "UseAtiROM" /* ati.c */ +#define kWake "Wake" /* boot.c */ +#define kForceWake "ForceWake" /* boot.c */ +#define kWakeImage "WakeImage" /* boot.c */ #define kProductVersion "ProductVersion" /* boot.c */ -#define karch "arch" /* boot.c */ -#define kDSDT "DSDT" /* acpi_patcher.c */ -#define kDropSSDT "DropSSDT" /* acpi_patcher.c */ +#define karch "arch" /* boot.c */ +#define kDSDT "DSDT" /* acpi_patcher.c */ +#define kDropSSDT "DropSSDT" /* acpi_patcher.c */ #define kDeviceProperties "device-properties" /* device_inject.c */ #define kHidePartition "Hide Partition" /* disk.c */ #define kRenamePartition "Rename Partition" /* disk.c */ -#define kSMBIOSKey "SMBIOS" /* fake_efi.c */ -#define kSystemID "SystemId" /* fake_efi.c */ -#define kSystemType "SystemType" /* fake_efi.c */ +#define kSMBIOSKey "SMBIOS" /* fake_efi.c */ +#define kSystemID "SystemId" /* fake_efi.c */ +#define kSystemType "SystemType" /* fake_efi.c */ #define kUseNvidiaROM "UseNvidiaROM" /* nvidia.c */ -#define kVBIOS "VBIOS" /* nvidia.c && ati.c */ -#define kPCIRootUID "PCIRootUID" /* pci_root.c */ +#define kVBIOS "VBIOS" /* nvidia.c && ati.c */ +#define kPCIRootUID "PCIRootUID" /* pci_root.c */ #define kEthernetBuiltIn "EthernetBuiltIn" /* pci_setup.c */ #define kGraphicsEnabler "GraphicsEnabler" /* pci_setup.c */ -#define kForceHPET "ForceHPET" /* pci_setup.c */ +#define kForceHPET "ForceHPET" /* pci_setup.c */ #define kUseMemDetect "UseMemDetect" /* platform.c */ #define kSMBIOSdefaults "SMBIOSdefaults" /* smbios_patcher.c */ -#define kUSBBusFix "USBBusFix" /* usb.c */ +#define kUSBBusFix "USBBusFix" /* usb.c */ #define kEHCIacquire "EHCIacquire" /* usb.c */ -#define kUHCIreset "UHCIreset" /* usb.c */ -#define kEHCIhard "EHCIhard" /* usb.c */ +#define kUHCIreset "UHCIreset" /* usb.c */ +#define kEHCIhard "EHCIhard" /* usb.c */ #define kDefaultPartition "Default Partition" /* sys.c */ /* Duvel300: added this */ -#define kRestartFix "RestartFix" /* acpi_patcher.c */ +#define kRestartFix "RestartFix" /* acpi_patcher.c */ /* Slice: added this */ #define kPS2RestartFix "PS2RestartFix" /* acpi_patcher.c */ /* Signal64: added this key */ -#define kLegacyOff "USBLegacyOff" /* usb.c */ +#define kLegacyOff "USBLegacyOff" /* usb.c */ /* Lebidou: added this key */ /* Meklort: added this key */ -#define kMD0Image "md0" /* ramdisk.h */ +#define kMD0Image "md0" /* ramdisk.h */ /* Andyvand: added these keys */ @@ -125,16 +125,16 @@ #define kEnableC4State "EnableC4State" /* acpi_patcher.c */ /* valv: added these keys */ -#define kbusratio "busratio" /* cpu.c */ -#define kDcfg0 "display_0" /* nvidia.c */ -#define kDcfg1 "display_1" /* nvidia.c */ +#define kbusratio "busratio" /* cpu.c */ +#define kDcfg0 "display_0" /* nvidia.c */ +#define kDcfg1 "display_1" /* nvidia.c */ /* Marchrius: added these keys */ #define kEnableBacklight "EnableBacklight" /* nvidia.c */ /* Kabyl: added these keys */ -#define kAtiConfig "AtiConfig" /* ati.c */ -#define kAtiPorts "AtiPorts" /* ati.c */ +#define kAtiConfig "AtiConfig" /* ati.c */ +#define kAtiPorts "AtiPorts" /* ati.c */ #define kATYbinimage "ATYbinimage" /* ati.c */ /* cosmo1: added these keys */ @@ -147,11 +147,11 @@ #define kNvidiaGeneric "NvidiaGeneric" /* nvidia.c */ #define kSkipIntelGfx "SkipIntelGfx" /* pci_setup.c */ #define kSkipNvidiaGfx "SkipNvidiaGfx" /* pci_setup.c */ -#define kSkipAtiGfx "SkipAtiGfx" /* pci_setup.c */ +#define kSkipAtiGfx "SkipAtiGfx" /* pci_setup.c */ #define kIntelCapriFB "IntelCapriFB" /* gma.c was HD4K-ig */ #define kIntelAzulFB "IntelAzulFB" /* gma.c was HD5K-ig */ #define kAAPLCustomIG "InjectIntel-ig" /* gma.c */ -#define kHDAEnabler "HDAEnabler" /* pci_setup.c */ +#define kHDAEnabler "HDAEnabler" /* pci_setup.c */ #define kHDEFLayoutID "HDEFLayoutID" /* hda.c */ #define kHDAULayoutID "HDAULayoutID" /* hda.c */ @@ -159,7 +159,7 @@ #define kMemFullInfo "ForceFullMemInfo" /* smbios.c */ /* Bungo: added these keys */ -// mask private data or no +// mask private data #define kPrivateData "PrivateData" /* smbios_decode.c */ /* @@ -248,10 +248,10 @@ /* * drivers.c */ +extern char *gDarwinBuildVerStr; // Bungo extern long LoadExtraDrivers(char * dirSpec); extern long LoadDrivers(char * dirSpec); extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize); - typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin); /*! Hookable function pointer called during the driver loading phase that Index: branches/Bungo/i386/boot2/options.c =================================================================== --- branches/Bungo/i386/boot2/options.c (revision 2378) +++ branches/Bungo/i386/boot2/options.c (revision 2379) @@ -32,6 +32,12 @@ #include "pci.h" #include "modules.h" +#if DEBUG +#define DBG(x...) printf(x) +#else +#define DBG(x...) msglog(x) +#endif + bool showBootBanner = true; //Azi:showinfo static bool shouldboot = false; @@ -1254,16 +1260,22 @@ } } } - + /* // Try to get the volume uuid string if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) { gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString); } - + */ // If we have the volume uuid add it to the commandline arguments if (strlen(gBootUUIDString)) { copyArgument(kBootUUIDKey, gBootUUIDString, strlen(gBootUUIDString), &argP, &cntRemaining); } + + // Try to get the volume uuid string + if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) { + gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString); + DBG("boot-uuid: %s\n", gBootUUIDString); + } } if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config, @@ -1274,17 +1286,18 @@ cnt++; strlcpy(valueBuffer + 1, val, cnt); val = valueBuffer; - } else { + } 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 = ""; cnt = 0; - } - } + /* } */ + } + if (cnt > 0) { copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining); }