Author Topic: Full ACPI table overrides and ACPI V1 to V4 conversion patch  (Read 20989 times)

0 Members and 1 Guest are viewing this topic.

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #15 on: February 03, 2010, 07:44:00 PM »
There is one more fix I'd like to suggest.
For Disabler.kext's dependencies:
<key>OSBundleLibraries</key>
<dict>
   <key>com.apple.kpi.iokit</key>
   <string>7.0</string>
   <key>com.apple.kpi.libkern</key>
   <string>8.0d0</string>
</dict>
Rather than old com.apple.kernel.iokit...
This should fix it better for 64-bit support and Tiger and above support the kpi components so it shouldn't be any problem for older systems.

smith@@

  • Member
  • Posts: 49
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #16 on: February 03, 2010, 07:55:23 PM »
I have try your boot, it works very well. The SystemType option works yet, the restar fix also without to add nothing in com.apple.

Good job;)

outragedtony

  • Observer
  • Posts: 13
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #17 on: February 03, 2010, 08:38:33 PM »
great! I'll test it later.
For people having problems with rapidshare (it took me two full hours to get into the free-user queue):

Alternative Package download
http://uploadrobots.com/Z8FXn3
Alternative Patch download

« Last Edit: February 03, 2010, 09:08:02 PM by outragedtony »

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #18 on: February 03, 2010, 08:40:13 PM »
We've done restart fix tests on Gigabyte P35 motherboard...
Original FADT:
/*
 * Intel ACPI Component Architecture
 * AML Disassembler version 20081204
 *
 * Disassembly of FACP, Sun Dec  6 23:45:55 2009
 *
 * ACPI Data Table [FACP]
 *
 * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
 */

[000h 000  4]                    Signature : "FACP"    /* Fixed ACPI Description Table */
[004h 004  4]                 Table Length : 00000074
[008h 008  1]                     Revision : 01
[009h 009  1]                     Checksum : F0
[00Ah 010  6]                       Oem ID : "GBT   "
[010h 016  8]                 Oem Table ID : "GBTUACPI"
[018h 024  4]                 Oem Revision : 42302E31
[01Ch 028  4]              Asl Compiler ID : "GBTU"
[020h 032  4]        Asl Compiler Revision : 01010101

[024h 036  4]                 FACS Address : DFEE0000
[028h 040  4]                 DSDT Address : DFEE3180
[02Ch 044  1]                        Model : 01
[02Dh 045  1]                   PM Profile : 01
[02Eh 046  2]                SCI Interrupt : 0009
[030h 048  4]             SMI Command Port : 000000B2
[034h 052  1]            ACPI Enable Value : A1
[035h 053  1]           ACPI Disable Value : A0
[036h 054  1]               S4BIOS Command : 00
[037h 055  1]              P-State Control : 34
[038h 056  4]     PM1A Event Block Address : 00000400
[03Ch 060  4]     PM1B Event Block Address : 00000000
[040h 064  4]   PM1A Control Block Address : 00000404
[044h 068  4]   PM1B Control Block Address : 00000000
[048h 072  4]    PM2 Control Block Address : 00000000
[04Ch 076  4]       PM Timer Block Address : 00000408
[050h 080  4]           GPE0 Block Address : 00000420
[054h 084  4]           GPE1 Block Address : 00000000
[058h 088  1]       PM1 Event Block Length : 04
[059h 089  1]     PM1 Control Block Length : 02
[05Ah 090  1]     PM2 Control Block Length : 00
[05Bh 091  1]        PM Timer Block Length : 04
[05Ch 092  1]            GPE0 Block Length : 10
[05Dh 093  1]            GPE1 Block Length : 00
[05Eh 094  1]             GPE1 Base Offset : 00
[05Fh 095  1]                 _CST Support : 00
[060h 096  2]                   C2 Latency : 0065
[062h 098  2]                   C3 Latency : 03E9
[064h 100  2]               CPU Cache Size : 0000
[066h 102  2]           Cache Flush Stride : 0000
[068h 104  1]            Duty Cycle Offset : 01
[069h 105  1]             Duty Cycle Width : 03
[06Ah 106  1]          RTC Day Alarm Index : 0D
[06Bh 107  1]        RTC Month Alarm Index : 00
[06Ch 108  1]            RTC Century Index : 00
[06Dh 109  2]      Boot Architecture Flags : 0010
[06Fh 111  1]                     Reserved : 00
[070h 112  4]        Flags (decoded below) : 000004A5
                     WBINVD is operational : 1
                WBINVD does not invalidate : 0
                       All CPUs support C1 : 1
                     C2 works on MP system : 0
                   Power button is generic : 0
                   Sleep button is generic : 1
                      RTC wakeup not fixed : 0
                RTC wakeup/S4 not possible : 1
                           32-bit PM Timer : 0
                         Docking Supported : 0

Raw Table Data

  0000: 46 41 43 50 74 00 00 00 01 F0 47 42 54 20 20 20  FACPt.....GBT   
  0010: 47 42 54 55 41 43 50 49 31 2E 30 42 47 42 54 55  GBTUACPI1.0BGBTU
  0020: 01 01 01 01 00 00 EE DF 80 31 EE DF 01 01 09 00  .........1......
  0030: B2 00 00 00 A1 A0 00 34 00 04 00 00 00 00 00 00  .......4........
  0040: 04 04 00 00 00 00 00 00 00 00 00 00 08 04 00 00  ................
  0050: 20 04 00 00 00 00 00 00 04 02 00 04 10 00 00 00   ...............
  0060: 65 00 E9 03 00 00 00 00 01 03 0D 00 00 10 00 00  e...............
  0070: A5 04 00 00                                      ....

FADT auto patched with options "UpdateACPI=Yes RestartFix=Yes":
/*
 * Intel ACPI Component Architecture
 * AML Disassembler version 20091013
 *
 * Disassembly of FADT_auto.aml, Wed Feb  3 20:38:57 2010
 *
 * ACPI Data Table [FACP]
 *
 * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
 */

[000h 0000  4]                    Signature : "FACP"    /* Fixed ACPI Description Table */
[004h 0004  4]                 Table Length : 000000F4
[008h 0008  1]                     Revision : 04
[009h 0009  1]                     Checksum : 3A
[00Ah 0010  6]                       Oem ID : "GBT   "
[010h 0016  8]                 Oem Table ID : "GBTUACPI"
[018h 0024  4]                 Oem Revision : 42302E31
[01Ch 0028  4]              Asl Compiler ID : "GBTU"
[020h 0032  4]        Asl Compiler Revision : 01010101

[024h 0036  4]                 FACS Address : BFEE0000
[028h 0040  4]                 DSDT Address : 00BE4000
[02Ch 0044  1]                        Model : 01
[02Dh 0045  1]                   PM Profile : 01 (Desktop)
[02Eh 0046  2]                SCI Interrupt : 0009
[030h 0048  4]             SMI Command Port : 000000B2
[034h 0052  1]            ACPI Enable Value : A1
[035h 0053  1]           ACPI Disable Value : A0
[036h 0054  1]               S4BIOS Command : 00
[037h 0055  1]              P-State Control : 34
[038h 0056  4]     PM1A Event Block Address : 00000400
[03Ch 0060  4]     PM1B Event Block Address : 00000000
[040h 0064  4]   PM1A Control Block Address : 00000404
[044h 0068  4]   PM1B Control Block Address : 00000000
[048h 0072  4]    PM2 Control Block Address : 00000000
[04Ch 0076  4]       PM Timer Block Address : 00000408
[050h 0080  4]           GPE0 Block Address : 00000420
[054h 0084  4]           GPE1 Block Address : 00000000
[058h 0088  1]       PM1 Event Block Length : 04
[059h 0089  1]     PM1 Control Block Length : 02
[05Ah 0090  1]     PM2 Control Block Length : 00
[05Bh 0091  1]        PM Timer Block Length : 04
[05Ch 0092  1]            GPE0 Block Length : 10
[05Dh 0093  1]            GPE1 Block Length : 00
[05Eh 0094  1]             GPE1 Base Offset : 00
[05Fh 0095  1]                 _CST Support : 00
[060h 0096  2]                   C2 Latency : 0065
[062h 0098  2]                   C3 Latency : 03E9
[064h 0100  2]               CPU Cache Size : 0000
[066h 0102  2]           Cache Flush Stride : 0000
[068h 0104  1]            Duty Cycle Offset : 01
[069h 0105  1]             Duty Cycle Width : 03
[06Ah 0106  1]          RTC Day Alarm Index : 0D
[06Bh 0107  1]        RTC Month Alarm Index : 00
[06Ch 0108  1]            RTC Century Index : 00
[06Dh 0109  2]   Boot Flags (decoded below) : 0010
              Legacy Devices Supported (V2) : 0
           8042 Present on ports 60/64 (V2) : 0
                       VGA Not Present (V4) : 0
                     MSI Not Supported (V4) : 0
               PCIe ASPM Not Supported (V4) : 1
[06Fh 0111  1]                     Reserved : 00
[070h 0112  4]        Flags (decoded below) : 000004A5
     WBINVD instruction is operational (V1) : 1
             WBINVD flushes all caches (V1) : 0
                   All CPUs support C1 (V1) : 1
                 C2 works on MP system (V1) : 0
           Control Method Power Button (V1) : 0
           Control Method Sleep Button (V1) : 1
       RTC wake not in fixed reg space (V1) : 0
           RTC can wake system from S4 (V1) : 1
                       32-bit PM Timer (V1) : 0
                     Docking Supported (V1) : 0
              Reset Register Supported (V2) : 1
                           Sealed Case (V3) : 0
                   Headless - No Video (V3) : 0
       Use native instr after SLP_TYPx (V3) : 0
             PCIEXP_WAK Bits Supported (V4) : 0
                    Use Platform Timer (V4) : 0
              RTC_STS valid on S4 wake (V4) : 0
               Remote Power-on capable (V4) : 0
                Use APIC Cluster Model (V4) : 0
    Use APIC Physical Destination Mode (V4) : 0

[074h 0116 12]               Reset Register : <Generic Address Structure>
[074h 0116  1]                     Space ID : 01 (SystemIO)
[075h 0117  1]                    Bit Width : 08
[076h 0118  1]                   Bit Offset : 00
[077h 0119  1]                 Access Width : 00
[078h 0120  8]                      Address : 0000000000000CF9

[080h 0128  1]         Value to cause reset : 06
[081h 0129  3]                     Reserved : 000000
[084h 0132  8]                 FACS Address : 00000000BFEE0000
[08Ch 0140  8]                 DSDT Address : 0000000000BE4000
[094h 0148 12]             PM1A Event Block : <Generic Address Structure>
[094h 0148  1]                     Space ID : 01 (SystemIO)
[095h 0149  1]                    Bit Width : 20
[096h 0150  1]                   Bit Offset : 00
[097h 0151  1]                 Access Width : 00
[098h 0152  8]                      Address : 0000000000000400

[0A0h 0160 12]             PM1B Event Block : <Generic Address Structure>
[0A0h 0160  1]                     Space ID : 01 (SystemIO)
[0A1h 0161  1]                    Bit Width : 00
[0A2h 0162  1]                   Bit Offset : 00
[0A3h 0163  1]                 Access Width : 00
[0A4h 0164  8]                      Address : 0000000000000000

[0ACh 0172 12]           PM1A Control Block : <Generic Address Structure>
[0ACh 0172  1]                     Space ID : 01 (SystemIO)
[0ADh 0173  1]                    Bit Width : 10
[0AEh 0174  1]                   Bit Offset : 00
[0AFh 0175  1]                 Access Width : 00
[0B0h 0176  8]                      Address : 0000000000000404

[0B8h 0184 12]           PM1B Control Block : <Generic Address Structure>
[0B8h 0184  1]                     Space ID : 01 (SystemIO)
[0B9h 0185  1]                    Bit Width : 00
[0BAh 0186  1]                   Bit Offset : 00
[0BBh 0187  1]                 Access Width : 00
[0BCh 0188  8]                      Address : 0000000000000000

[0C4h 0196 12]            PM2 Control Block : <Generic Address Structure>
[0C4h 0196  1]                     Space ID : 01 (SystemIO)
[0C5h 0197  1]                    Bit Width : 00
[0C6h 0198  1]                   Bit Offset : 00
[0C7h 0199  1]                 Access Width : 00
[0C8h 0200  8]                      Address : 0000000000000000

[0D0h 0208 12]               PM Timer Block : <Generic Address Structure>
[0D0h 0208  1]                     Space ID : 01 (SystemIO)
[0D1h 0209  1]                    Bit Width : 20
[0D2h 0210  1]                   Bit Offset : 00
[0D3h 0211  1]                 Access Width : 00
[0D4h 0212  8]                      Address : 0000000000000408

[0DCh 0220 12]                   GPE0 Block : <Generic Address Structure>
[0DCh 0220  1]                     Space ID : 01 (SystemIO)
[0DDh 0221  1]                    Bit Width : 80
[0DEh 0222  1]                   Bit Offset : 00
[0DFh 0223  1]                 Access Width : 00
[0E0h 0224  8]                      Address : 0000000000000420

[0E8h 0232 12]                   GPE1 Block : <Generic Address Structure>
[0E8h 0232  1]                     Space ID : 01 (SystemIO)
[0E9h 0233  1]                    Bit Width : 00
[0EAh 0234  1]                   Bit Offset : 00
[0EBh 0235  1]                 Access Width : 00
[0ECh 0236  8]                      Address : 0000000000000000


Raw Table Data

  0000: 46 41 43 50 F4 00 00 00 04 3A 47 42 54 20 20 20  FACP.....:GBT   
  0010: 47 42 54 55 41 43 50 49 31 2E 30 42 47 42 54 55  GBTUACPI1.0BGBTU
  0020: 01 01 01 01 00 00 EE BF 00 40 BE 00 01 01 09 00  .........@......
  0030: B2 00 00 00 A1 A0 00 34 00 04 00 00 00 00 00 00  .......4........
  0040: 04 04 00 00 00 00 00 00 00 00 00 00 08 04 00 00  ................
  0050: 20 04 00 00 00 00 00 00 04 02 00 04 10 00 00 00   ...............
  0060: 65 00 E9 03 00 00 00 00 01 03 0D 00 00 10 00 00  e...............
  0070: A5 04 00 00 01 08 00 00 F9 0C 00 00 00 00 00 00  ................
  0080: 06 00 00 00 00 00 EE BF 00 00 00 00 00 40 BE 00  .............@..
  0090: 00 00 00 00 01 20 00 00 00 04 00 00 00 00 00 00  ..... ..........
  00A0: 01 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  ................
  00B0: 04 04 00 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
  00C0: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
  00D0: 01 20 00 00 08 04 00 00 00 00 00 00 01 80 00 00  . ..............
  00E0: 20 04 00 00 00 00 00 00 01 00 00 00 00 00 00 00   ...............
  00F0: 00 00 00 00                                      ....

Everything working great  ;D

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #19 on: February 03, 2010, 10:20:04 PM »
Did further testing of the bootloader.
Loading replacement FADT.aml works
Overriding tables works for every tester who has tested...
This is great...
Auto patching also works like a charm.
We've got done what we needed to get done  :D

rekursor

  • VoodooLabs
  • Posts: 47
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #20 on: February 03, 2010, 10:24:09 PM »
Hey Andy,
please register a nickname to the forge here:
http://forge.voodooprojects.org/p/chameleon/

I'll add you to the team thanks ;)

I'm greatly interested by your work hope you'll join soon ...

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #21 on: February 03, 2010, 10:26:15 PM »
Ok I registered with the same login I allways use...
Thanks...

smith@@

  • Member
  • Posts: 49
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #22 on: February 03, 2010, 11:03:16 PM »
Andy, can you post a FADT.aml?  ;)  Thanks

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #23 on: February 03, 2010, 11:07:09 PM »
You should use UpdateACPI=Yes and RestartFix=Yes
But I'll post an example of one...
This one is an auto-fixed one for P35...

smith@@

  • Member
  • Posts: 49
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #24 on: February 03, 2010, 11:22:22 PM »
Thanks,   hence the FADT table is equal to the FACP table, right?

The restart fix for me works also without this option in com.apple  ;)

Andy until this feautures will not be implemented official from rek in chameleon rc5 can you will patch the nexts prerc of cham with these implementation? ;)

rekursor

  • VoodooLabs
  • Posts: 47
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #25 on: February 03, 2010, 11:50:44 PM »
Andy,
You are now a crew member of the public chameleon repository :)

I would like to integrate only the acpi tables loading but I made quite somes fixes since my last RC5pre7,
I'm about to release a pre8 and would love to integrate that first.
I'm not aware fo the FACP mods you did, I thought RestartFix would work already great here,
But I'm open to *any* suggestions if it can makes chameleon better.
I want to make sure any feature we integrate before final RC5 won't cause regression,
apart from that I'll welcome all your work, should some of it be postponed if not mature enough ;)

Thank you for your work Andy and WELCOME to the chameleon Team !

smith@@

  • Member
  • Posts: 49
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #26 on: February 03, 2010, 11:59:24 PM »
Finally. :)

The restart fix both seem to work the same way ;)

rekursor

  • VoodooLabs
  • Posts: 47
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #27 on: February 04, 2010, 01:01:42 AM »
Andy, I'm currently having a look to your acpi loading mod:
I would like to change the options (far too many new options!)
I believe we could reuse Drop=y and replace it by Drop = "[<SSDT>] [<HPET>] ..."
Also, Do we really need oemXXX ?
My proposal : any dropped acpi table by Dropp would be tried to be loaded at the same place that we found the dsdt.aml file, if not present we don't load the corresponding table, if present we load it.
Simple, isn't it ?

Also I would remove for the same reason all the <ACPI_table_NAME>=path options,
because if they are available in the same directory than the dsdt (and they are specified in drop), then we simply load them.
Simple, easy to use and more importantly: no need to add so many new options when we can automatically do a great job...

What do you think ?
EDIT:
I'm currently integrating your full work in my branch (GREAT work Andy !), the only thing that we are currently discussing and trying to do is limiting the number of new options and replacing with hopefully a bit smarter acpi table finding and handling code, I am also trying to reduce the number of code duplication, not only in your recent mods, but in all the booter.
You can follow and comment, and participate to what I'm doing anytime, I would probably need and welcome your help and suggestions on that wonderful work you've done.
Thanks Andy.
« Last Edit: February 04, 2010, 04:14:35 AM by rekursor »

rekursor

  • VoodooLabs
  • Posts: 47
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #28 on: February 04, 2010, 09:23:29 AM »
Hey andy, I started the code refactoring from your patch, created a new acpi.c file, including all utilities necessary to implement what I was talking about previously.
Started to modify dsdt_patcher.c, still some work to do but I think you might understand better what it is about.
It might be oversimplified in this first increment, feel to have a look to the code and comment.
But the generic enumeration and table loading mechanism is here (see acpi.c).
I would greatly appreciate your help on /* CHECK ME here */ assertions in dsdt_patcher,
particularly in the offset calculation (would be estonished if it could work as is).
Thanks

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #29 on: February 05, 2010, 08:03:57 PM »
OK I've been a little busy, I'll review the code now...
I'll get back to you.

EDIT: Checked code...
Bad things:
1. It would be better if you parse the tables to drop untill a , is found and it transfers it into some structure for dropping.
It should start at 0 unless boot arg Drop is found (in which case it starts at 1).
For each , which is found it increments the amount and it thus copies the characters into the structure.
The structure should get parsed for each table loop (untill total amount is reached).

1B. Isn't parsing this Drop list slower because of parsing a list?

2. What about table adding?
It currently supports overriding certain tables but it doesn't check if it they got replaced and thus there is no way to add new tables.
Also table adding underneat (out of the for (i=0;i<(x or r)sdt_entries_num;i++) loop) isn't present so it doesn't add any new tables.

3. What about specific SSDT table replacing?
It should be possible to only add or replace certain SSDT table.
Check my code to see how I accomplish that.

Good things:
1. The FADT upgrade/patching will work fine.
2. Adding SSDT tables should work fine.
3. XSDT generation will work fine.
4. Opening FD code should work.
5. Loading to memory code should work.
6. SSDT loading to memory code should work but should use (acpiSearchAndGetFd) or check path for first SSDT load first.
7. The only advantage of parsing a Drop= list is that you can also drop other tables (like BOOT table or so...)

P.S. What about Disabler.kext's plist dependency fixes?

I've also got some new ideas for fixing some other things up.
Download my saved ioregs from various Macs...
You can check them out for various new fixes.
The IODeviceTree:/efi... node contains somewhere the model of the Mac and so.
It might be wise to add them from smbios.plist or default...
http://rapidshare.com/files/346407925/ioregs.zip
« Last Edit: February 05, 2010, 09:30:37 PM by andyvand »