Index: trunk/version =================================================================== --- trunk/version (revision 45) +++ trunk/version (revision 46) @@ -1 +1 @@ -2.0-RC5pre5 \ No newline at end of file +2.0-RC5pre6 \ No newline at end of file Index: trunk/CHANGES =================================================================== --- trunk/CHANGES (revision 45) +++ trunk/CHANGES (revision 46) @@ -1,3 +1,7 @@ +- Fixed the hibernation problem in boot2/resume.c +- Fixed all new booter versions with SystemType would override the facp value even if correct, + now keeps the facp value if correct and no override has been done, implemented a best effort algo. + for maximizing the chance to get the most correct value before we decide to use a fixed value (1=desktop) - Fixed display cosmetics of UUID, now a convert.c file contains all conversions api, to be completed by function that we should reuse. Index: trunk/i386/libsaio/dsdt_patcher.c =================================================================== --- trunk/i386/libsaio/dsdt_patcher.c (revision 45) +++ trunk/i386/libsaio/dsdt_patcher.c (revision 46) @@ -135,14 +135,18 @@ return NULL; } + struct acpi_2_fadt * patch_fadt(struct acpi_2_fadt *fadt, void *new_dsdt) { + extern void setupSystemType(); + struct acpi_2_fadt *fadt_mod; bool fadt_rev2_needed = false; bool fix_restart; - + const char * value; + // Restart Fix if (Platform.CPU.Vendor == 0x756E6547) { /* Intel */ fix_restart = true; @@ -167,12 +171,36 @@ fadt_mod=(struct acpi_2_fadt *)AllocateKernelMemory(fadt->Length); memcpy(fadt_mod, fadt, fadt->Length); } - - // Set PM_Profile from System-type - if (fadt_mod->PM_Profile != Platform.Type) { + // Determine system type / PM_Model + if ( (value=getStringForKey(kSystemType, &bootInfo->bootConfig))!=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 if 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; + } } + // 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. + setupSystemType(); // Patch FADT to fix restart if (fix_restart) Index: trunk/i386/libsaio/fake_efi.c =================================================================== --- trunk/i386/libsaio/fake_efi.c (revision 45) +++ trunk/i386/libsaio/fake_efi.c (revision 46) @@ -431,30 +431,27 @@ return ret; } +// must be called AFTER setup Acpi because we need to take care of correct facp content to reflect in ioregs +void setupSystemType() +{ + Node *node = DT__FindNode("/", false); + if (node == 0) stop("Couldn't get root node"); + // we need to write this property after facp parsing + /* Export system-type only if it has been overrriden by the SystemType option */ + DT__AddProperty(node, SYSTEM_TYPE_PROP, sizeof(Platform.Type), &Platform.Type); +} + void setupEfiDeviceTree(void) { EFI_CHAR16* ret16=0; EFI_CHAR8* ret=0; size_t len=0; Node *node; - const char *value; node = DT__FindNode("/", false); if (node == 0) stop("Couldn't get root node"); - /* Export system-type only if it has been overrriden by the SystemType option */ - Platform.Type = 1; /* Desktop */ - if (getValueForKey(kSystemType, &value, (int*) &len, &bootInfo->bootConfig) && value != NULL) - { - if (Platform.Type > 6) - verbose("Error: system-type must be 0..6. Defaulting to 1!\n"); - else - Platform.Type = (unsigned char) strtoul(value, NULL, 10); - verbose("Using system-type=0x%02x\n", Platform.Type); - DT__AddProperty(node, SYSTEM_TYPE_PROP, sizeof(Platform.Type), &Platform.Type); - } - /* We could also just do DT__FindNode("/efi/platform", true) * 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. Index: trunk/i386/boot2/resume.c =================================================================== --- trunk/i386/boot2/resume.c (revision 45) +++ trunk/i386/boot2/resume.c (revision 46) @@ -139,8 +139,8 @@ mem_base = getmemorylimit() - allocSize;//TODO: lower this printf("mem_base %x\n", mem_base); - - if (!(long long)mem_base+allocSize<1024*bootInfo->extmem+0x100000) + // Rek : hibernate fix + if (!((long long)mem_base+allocSize<1024*bootInfo->extmem+0x100000)) { printf ("Not enough space to restore image. Press any key to proceed with normal boot.\n"); getc ();