Chameleon

Chameleon Commit Details

Date:2010-01-30 20:08:55 (9 years 8 months ago)
Author:Rekursor
Commit:46
Parents: 45
Message:Released pre6 that fixes the hibernation problem, features a new algo for smarter SystemType determination, see CHANGES for details.
Changes:
M/trunk/i386/boot2/resume.c
M/trunk/i386/libsaio/dsdt_patcher.c
M/trunk/i386/libsaio/fake_efi.c
M/trunk/version
M/trunk/CHANGES

File differences

trunk/version
1
1
2.0-RC5pre5
2.0-RC5pre6
trunk/CHANGES
1
2
3
4
15
26
37
- 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.
trunk/i386/libsaio/dsdt_patcher.c
135135
136136
137137
138
138139
139140
140141
141142
143
144
142145
143146
144147
145
148
149
146150
147151
148152
......
167171
168172
169173
170
171
172
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
173193
174194
195
196
197
198
199
175200
201
202
203
176204
177205
178206
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;
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)
trunk/i386/libsaio/fake_efi.c
431431
432432
433433
434
435
436
437
438
439
440
441
442
443
434444
435445
436446
437447
438448
439449
440
441450
442451
443452
444453
445454
446
447
448
449
450
451
452
453
454
455
456
457
458455
459456
460457
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.
trunk/i386/boot2/resume.c
139139
140140
141141
142
143
142
143
144144
145145
146146
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 ();

Archive Download the corresponding diff file

Revision: 46