Voodooprojects

Chameleon => DevTalk => Patches => Topic started by: JrCs on January 01, 2010, 03:16:50 PM

Title: [PATCH] restart fix Removed !
Post by: JrCs on January 01, 2010, 03:16:50 PM
Hi,

it's the patch that modify the facp table to fix the restart of our hack (no need kext like openhaltrestart anymore).
Credit goes to duvel300. I have refactored the code to simplify it.

A new boolean entry (RestartFix) must be add to com.apple.boot.plist to activate the fix.


Removing the patch because:
 - only work for specific chipset
 - not fully ACPI compliant

JrCs
Title: Re: [PATCH] restart fix Removed !
Post by: 18seven on January 21, 2010, 03:34:33 PM
The new and improved version is in the repo, correct?
Title: Re: [PATCH] restart fix Removed !
Post by: JrCs on January 21, 2010, 08:31:10 PM
In my branch YES. Not in the trunk.
Title: Re: [PATCH] restart fix Removed !
Post by: 18seven on January 22, 2010, 02:55:55 PM
Good stuff. I know this is related to fadt, so does your branch also include the tables override patch?
Title: Re: [PATCH] restart fix Removed !
Post by: prasys on January 22, 2010, 03:46:15 PM
It seems to be not working for non-Intel processors at this moment. It seems to be specific to Intel (just to let you know)
Title: Re: [PATCH] restart fix Removed !
Post by: andyvand on March 02, 2010, 08:04:52 PM
Yeah... we should make it possible to override some of the addresses / values...
For example my previous laptop (Packard Bell EasyNote MZ-35 200) used restart register value 4 instead of 6...
But 0xCF9 address seems to be correct for any Intel CPU.
Title: Re: [PATCH] restart fix Removed !
Post by: Slice on January 15, 2011, 08:30:31 PM
Any news here?
Even having Intel Core2Duo and 965GM chipset I have no good restart with or without this patch.
Title: Re: [PATCH] restart fix Removed !
Post by: toine44 on May 07, 2011, 03:29:52 PM
I don't understand why you remove it.

Code: [Select]
// Patch FADT to fix restart
if (fix_restart)
{
/*
fadt_mod->Flags|= 0x400;
fadt_mod->Reset_SpaceID = 0x01; // System I/O
fadt_mod->Reset_BitWidth = 0x08; // 1 byte
fadt_mod->Reset_BitOffset = 0x00; // Offset 0
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
*/
fadt_mod->Flags|= 0x400;
fadt_mod->Reset_SpaceID = 0x01; // System I/O
fadt_mod->Reset_BitWidth = 0x08; // 1 byte
fadt_mod->Reset_BitOffset = 0x00; // Offset 0
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

verbose("FADT: Restart Fix applied!\n");
}

After looking in linux sources and this http://smackerelofopinion.blogspot.com/2009/06/rebooting-pc.html (http://smackerelofopinion.blogspot.com/2009/06/rebooting-pc.html) and http://smackerelofopinion.blogspot.com/2011/02/resetting-pc-using-reset-control.html (http://smackerelofopinion.blogspot.com/2011/02/resetting-pc-using-reset-control.html)
I think these patchs could become an optional feature in com.apple.Boot.plist:
I've noticed that apple hardware use the pci reset in their FADT and they have no ps/2 keyboard controller.
My laptop, asus 1201N, use MCP79 chipset like macbook6,1 but I have ps/2 keyboard. Unlike the mac, pci reset didn't work but keyboard reset works (before I was using evoReboot with does the same keyboard reset).
Title: Re: [PATCH] restart fix Removed !
Post by: oldnapalm on May 07, 2011, 08:07:36 PM
Thanks toine44.

Finally restart works in my Acer Aspire 5920.
Title: Re: [PATCH] restart fix Removed !
Post by: Loureiro on May 17, 2011, 07:49:51 PM
Can someone help me with this fix? I don't know which file I need to edit.

Thanks
Title: Re: [PATCH] restart fix Removed !
Post by: Gringo Vermelho on May 18, 2011, 01:09:19 AM
acpi_patcher.c, line 657
Title: Re: [PATCH] restart fix Removed !
Post by: Loureiro on May 23, 2011, 02:51:43 AM
Thanks!  ;D
Title: Re: [PATCH] restart fix Removed !
Post by: Slice on July 22, 2011, 08:05:14 AM
I don't understand why you remove it.
  • It works on my intel desktop computer
  • I've modified it to make it works in my laptop : using keyboard controller reset (see below)

Code: [Select]
// Patch FADT to fix restart
if (fix_restart)
{
/*
fadt_mod->Flags|= 0x400;
fadt_mod->Reset_SpaceID = 0x01; // System I/O
fadt_mod->Reset_BitWidth = 0x08; // 1 byte
fadt_mod->Reset_BitOffset = 0x00; // Offset 0
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
*/
fadt_mod->Flags|= 0x400;
fadt_mod->Reset_SpaceID = 0x01; // System I/O
fadt_mod->Reset_BitWidth = 0x08; // 1 byte
fadt_mod->Reset_BitOffset = 0x00; // Offset 0
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

verbose("FADT: Restart Fix applied!\n");
}

After looking in linux sources and this http://smackerelofopinion.blogspot.com/2009/06/rebooting-pc.html (http://smackerelofopinion.blogspot.com/2009/06/rebooting-pc.html) and http://smackerelofopinion.blogspot.com/2011/02/resetting-pc-using-reset-control.html (http://smackerelofopinion.blogspot.com/2011/02/resetting-pc-using-reset-control.html)
I think these patchs could become an optional feature in com.apple.Boot.plist:
  • reset fix=keyboard
  • reset fix=pci

I've noticed that apple hardware use the pci reset in their FADT and they have no ps/2 keyboard controller.
My laptop, asus 1201N, use MCP79 chipset like macbook6,1 but I have ps/2 keyboard. Unlike the mac, pci reset didn't work but keyboard reset works (before I was using evoReboot with does the same keyboard reset).
I accepted this patch into my branch of Chameleon since rev1200.
Title: Re: [PATCH] restart fix Removed !
Post by: cosmo1t on July 22, 2011, 02:51:04 PM
slice can u attach the diff please either to the issue or here so we can get it merged to the trunk
thanks
Title: Re: [PATCH] restart fix Removed !
Post by: Slice on July 22, 2011, 10:14:00 PM
According to the patch I made the follow: user can choise RestartFix=ACPI | PS2 | NO
My choice
Code: [Select]
<key>RestartFix</key>
<string>PS2</string>
The patch is located in acpi_patcher as usual
Code: [Select]
// Restart Fix
- if (Platform.CPU.Vendor == 0x756E6547) { /* Intel */
+// if (Platform->CPU.Vendor == 0x756E6547) { /* Intel */
  fix_restart = true;
- getBoolForKey(kRestartFix, &fix_restart, &bootInfo->chameleonConfig);
+ value = getStringForKey(kRestartFix, &bootInfo->chameleonConfig);
+ if (value[0] == 'A') {
+ fix_restart_acpi = true;
+ } else if (value[0] == 'P') {
+ fix_restart_acpi = false;
+ } else {
+ fix_restart = false;
+ }
+/*
  } else {
- verbose ("Not an Intel platform: Restart Fix not applied !!!\n");
+ DBG ("Not an Intel platform: Restart Fix not applied !!!\n");
  fix_restart = false;
  }
-
+*/
.........
  if (fix_restart)
  {
+ if (fix_restart_acpi) {
+ fadt_mod->Flags|= 0x400;
+ fadt_mod->Reset_SpaceID = 0x01;   // System I/O
+ fadt_mod->Reset_BitWidth = 0x08;   // 1 byte
+ fadt_mod->Reset_BitOffset = 0x00;   // Offset 0
+ 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
+ msglog("FADT: ACPI Restart Fix applied!\n");
+ } else {
+ fadt_mod->Flags|= 0x400;
+ fadt_mod->Reset_SpaceID = 0x01;   // System I/O
+ fadt_mod->Reset_BitWidth = 0x08;   // 1 byte
+ fadt_mod->Reset_BitOffset = 0x00;   // Offset 0
+ 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");
+ }
  }

If you want to see other my diffs look here http://www.projectosx.com/forum/index.php?showtopic=1106&view=findpost&p=15446 (http://www.projectosx.com/forum/index.php?showtopic=1106&view=findpost&p=15446)
Title: Re: [PATCH] restart fix Removed !
Post by: cosmo1t on August 13, 2011, 11:43:18 PM
hey please post a diff with an issue or a request for merge on forge.voodooprojects.org
we will then work w/ it to get it in the trunk

I'd love to have more features and fixes, but we need to establish a baseline of how this is done.

Thanks slice
cos
Title: Re: [PATCH] restart fix Removed !
Post by: Slice on August 16, 2011, 03:57:10 PM
hey please post a diff with an issue or a request for merge on forge.voodooprojects.org
we will then work w/ it to get it in the trunk

I'd love to have more features and fixes, but we need to establish a baseline of how this is done.

Thanks slice
cos
3 weeks passed since my post. The patch is still not in trunk? Is it very hard for voodoo team?
I show you all that you need. If you want there is the diff file but I think it is not more easy to apply.
Title: Re: [PATCH] restart fix Removed !
Post by: meklort on August 16, 2011, 04:19:44 PM
Slice, Please send  a diff that will
1) compile with trunk (eg: Platform is a struct pointer in your branch, while just a struct in trunk).
2) submit the patch on forge.voodooprojects.org
3) *always* verify that the return value is *non null* for getStringForKey before you use it.
4) Verify the complete string, not just the first letter.
5) Values such as 0x756E6547 should be replaced with the corresponding #define

Also, when possible, submit separate patches for separate features.
Title: Re: [PATCH] restart fix Removed !
Post by: Slice on August 17, 2011, 08:09:59 AM
Apply my diff and then correct all what you want. I think you are able to do this.
4) I don't know how.
Title: Re: [PATCH] restart fix Removed !
Post by: PolishOX on August 18, 2011, 05:08:46 PM
Apply my diff and then correct all what you want. I think you are able to do this.
4) I don't know how.
Slice as a developer with access to the trunk you do not find writing proper code to be important?

You need some employees or intern to fix your code?