Voodooprojects

Chameleon => DevTalk => Patches => Topic started by: andyvand on January 29, 2010, 11:02:34 PM

Title: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on January 29, 2010, 11:02:34 PM
I've added support to override following tables:
- SSDT tables
- HPET table
- Smart Battery Subsystem Table (SBST)
- Environment Controller Description Table (ECDT, for boot-ec device)
- Alert Standard Format Table (ASF!)
- DMAR table
- FADT table
- APIC table
- MCFG table

Besides those the following features have been implemented:
Automatic ACPI V1 to V4 upgrading through UpdateACPIVersion=Yes boot argument.
This:
 - Updates RSD PTR V1 to RSD PTR V3
 - Auto generates XSDT from RSDT
 - Converts old style short FADT to FADT V4

Source diff download:
http://rapidshare.com/files/343104547/PCEFI_10.5_AnV_Improvements.diff.zip

Glad to contribute...  ;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rocksteady on January 29, 2010, 11:14:09 PM
Cheers Andy


Update:

If it's not too much hassle, could you post your patch as an attachment here as well (or as a link to a 2nd host) ? Rapidshare is being blocked for some people. 

Thanks for your efforts
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on January 30, 2010, 10:02:09 AM
We've done some more testing.
The ACPI upgrade also fixes restart bug on Gigabyte motherboards (automatically without FADT.aml)
I think it's great...  8)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on January 31, 2010, 09:41:32 AM
I stand corrected... some tester reported it fixed his restart issue but it didn't...
I'm currently working on 2 simple things:
Fixing restart if FixRestart=Yes is given... (reset register gas, reset register value, reset register supported bit) [ready, testing currently]...
Overriding the preferred Power Management profile [ready, testing currently]...
I'll keep you guys posted on this and once ready post the required diff...
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 01, 2010, 05:16:02 PM
I've done the restart fix but it still needs an option for overriding the reset value but other than that it works for Intel Core (2) Duo or + processors.
Also Preferred PM override works perfectly allready...
It fixes restart by adding boot argument (FixRestart=Yes)
It overrides preferred PM profile also by boot argument (PMProfile=<0-7>)
Check ACPI V4.0 spec for values for PM profile override... (FADT section...)

Patch diff download for Chameleon 2 RC4:
http://rapidshare.com/files/344032081/Chameleon-2.0-RC4-AnV_Improvements.diff.zip

P.S. This also includes from the guy in the previous post (can't remember his name) the experimental USB Legacy Off fix... (Big thanks go to him because it works great except on an Acer laptop with a ICH9M chipset which I've tested)

Include the features that you want from the patch.  ;D
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: Blackosx on February 01, 2010, 05:25:30 PM
Hi andyvand

It's great to see further development and this looks interesting.
Can i ask if you have seen the repo (http://forge.voodooprojects.org/p/chameleon/) and in particular the latest work (http://forge.voodooprojects.org/p/chameleon/source/tree/HEAD/branches/rekursor/CHANGES) that Rekursor has been doing?

Maybe you could add to the work being done there?
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 01, 2010, 08:23:48 PM
Sure... anything I can do...
If you have any specific implement request, make them please.
 ;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: Blackosx on February 01, 2010, 08:58:28 PM
If you have any specific implement request, make them please.
Great, I am sure someone will take you up on your kind offer. Thanks

EDIT: If you want to create an account on the Chameleon repo (http://forge.voodooprojects.org/p/chameleonApplications/) then send rekursor a message so he can add you to the crew ;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: smith@@ on February 02, 2010, 07:29:58 AM
I would try this boot and i hope that it works. I think you should work with rekur to implement these functions in 'rc5 Chameleon ;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: scrax on February 02, 2010, 09:36:48 AM
I think you should work with rekur to implement these functions in 'rc5 Chameleon ;)
+1
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 02, 2010, 05:18:24 PM
OK I'll check out the Chameleon repo and I'll post the diff for it when I'm done.
I'll make sure they are properly implemented.
The reason I'll do it this way is because I've never used SVN uploading...
I'll also improve the patches still even more (like restart register address override function and reset value override function...).
I'll keep you guys posted.  ;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rocksteady on February 02, 2010, 06:17:21 PM
Yup, Repo is the best way

Most of us are on business trip right now, so comms may be a bit slow but do get in touch if you need any help/clarification

Cheers
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 02, 2010, 06:22:45 PM
OK, I will do so when I'm done patching...
I have at current no idea how to uplink something to an svn server (guessing it must be logging in and uploading source during which it checks automatically what has changed...).
Thanks everyone.  :)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 03, 2010, 05:30:01 PM
I've done the code changes for Chameleon-2-RC5-pre7-r59.

Changelog:
<<-Chameleon 2 RC5 pre7 done list->>
FADT override [OK]
FADT upgrade [OK]
RSD PTR conversion [OK]
Gen XSDT [OK]
-> ACPI upgrade [OK]

Changed procedures for fixing restart [OK]
Changed and completed facp structure [OK]

SSDT override [OK]
HPET override [OK]
HPET dropping [OK]
SLIC dropping [OK]
SBST dropping [OK]
SBST override [OK]
ECDT dropping [OK]
ASF! dropping [OK]
ASF! override [OK]
DMAR dropping [OK]
DMAR override [OK]
APIC override [OK]
MCFG override [OK]
-> Tables override [OK]

USB Legacy Off patch [OK]

Force 64-bit mode override (-x64) [OK]

Documentation Update [OK]

Patch download:
http://rapidshare.com/files/345380316/Chameleon-2-RC5-pre7-r60_proposal.diff.zip

Package download:
http://rapidshare.com/files/345379960/Chameleon-2.0-RC5pre7-r60_proposal.pkg.zip
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rocksteady on February 03, 2010, 05:34:29 PM
nice work andy, now gotta find some time for testing

will get back to you
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand 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.
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: smith@@ 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;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: outragedtony 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

Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand 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
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand 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
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rekursor 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 ...
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 03, 2010, 10:26:15 PM
Ok I registered with the same login I allways use...
Thanks...
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: smith@@ on February 03, 2010, 11:03:16 PM
Andy, can you post a FADT.aml?  ;)  Thanks
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand 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...
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: smith@@ 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? ;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rekursor 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 !
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: smith@@ on February 03, 2010, 11:59:24 PM
Finally. :)

The restart fix both seem to work the same way ;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rekursor 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.
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rekursor 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
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand 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
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 05, 2010, 10:03:26 PM
BTW guys... I've never used SVN for uploading.
How do I make & commit a branch to an SVN server?
Thanks in advance.
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rocksteady on February 05, 2010, 10:50:02 PM
let me pass this to zef andy and set you up with an account

he's managing the repo

update: done (http://forge.voodooprojects.org/p/chameleon/)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: zef on February 06, 2010, 01:35:50 AM
BTW guys... I've never used SVN for uploading.
How do I make & commit a branch to an SVN server?
Thanks in advance.

Andy,

You just need to import your project under http://forge.voodooprojects.org/svn/chameleon/branches/andyvand then commit other changes later.
To able to get write access for the chameleon repo, you need to use your forge username and the "extra password" found under your account page on the forge site.

I would recommend to learn the basics of subversion first, get here: http://svnbook.red-bean.com/ (http://svnbook.red-bean.com/)

There are many good clients for OS X besides the command line version. You may try Versions (http://versionsapp.com/ (http://versionsapp.com/)) or Cornerstone (http://www.zennaware.com/cornerstone/ (http://www.zennaware.com/cornerstone/)) or TortoiseSVN for Windows (http://tortoisesvn.net/ (http://tortoisesvn.net/))

Finally you can browse and compare the revision in the repo with the Trac frontend as well - use the same user/pass as for the svn:

http://forge.voodooprojects.org/trac/chameleon/browser (http://forge.voodooprojects.org/trac/chameleon/browser)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 06, 2010, 04:57:20 PM
OK thx... added my branch to the repo
Now I can continue the work on it there.
Thanks for the branch access Zef  :) ;)
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 06, 2010, 05:19:11 PM
I examined reset register on an AMD computer.
Below is the FADT...
Patching should also be enabled for AMD's...

/*
 * Intel ACPI Component Architecture
 * AML Disassembler version 20091013
 *
 * Disassembly of FADT_AMD.aml, Sat Feb  6 17:15:46 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 : 00000084
[008h 0008  1]                     Revision : 02
[009h 0009  1]                     Checksum : B8
[00Ah 0010  6]                       Oem ID : "A_M_I "
[010h 0016  8]                 Oem Table ID : "OEMFACP "
[018h 0024  4]                 Oem Revision : 12000601
[01Ch 0028  4]              Asl Compiler ID : "MSFT"
[020h 0032  4]        Asl Compiler Revision : 00000097

[024h 0036  4]                 FACS Address : C7EC0000
[028h 0040  4]                 DSDT Address : C7EB0440
[02Ch 0044  1]                        Model : 01
[02Dh 0045  1]                   PM Profile : 00 (Unspecified)
[02Eh 0046  2]                SCI Interrupt : 0009
[030h 0048  4]             SMI Command Port : 000000B0
[034h 0052  1]            ACPI Enable Value : E1
[035h 0053  1]           ACPI Disable Value : 1E
[036h 0054  1]               S4BIOS Command : 00
[037h 0055  1]              P-State Control : 00
[038h 0056  4]     PM1A Event Block Address : 00000800
[03Ch 0060  4]     PM1B Event Block Address : 00000000
[040h 0064  4]   PM1A Control Block Address : 00000804
[044h 0068  4]   PM1B Control Block Address : 00000000
[048h 0072  4]    PM2 Control Block Address : 000008FF
[04Ch 0076  4]       PM Timer Block Address : 00000808
[050h 0080  4]           GPE0 Block Address : 00000820
[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 : 01
[05Bh 0091  1]        PM Timer Block Length : 04
[05Ch 0092  1]            GPE0 Block Length : 08
[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 : 0400
[066h 0102  2]           Cache Flush Stride : 0010
[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 : 32
[06Dh 0109  2]   Boot Flags (decoded below) : 0003
              Legacy Devices Supported (V2) : 1
           8042 Present on ports 60/64 (V2) : 1
                       VGA Not Present (V4) : 0
                     MSI Not Supported (V4) : 0
               PCIe ASPM Not Supported (V4) : 0
[06Fh 0111  1]                     Reserved : 00
[070h 0112  4]        Flags (decoded below) : 0001C1A5
     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) : 1
                     Docking Supported (V1) : 0
              Reset Register Supported (V2) : 0
                           Sealed Case (V3) : 0
                   Headless - No Video (V3) : 0
       Use native instr after SLP_TYPx (V3) : 0
             PCIEXP_WAK Bits Supported (V4) : 1
                    Use Platform Timer (V4) : 1
              RTC_STS valid on S4 wake (V4) : 1
               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

Raw Table Data

  0000: 46 41 43 50 84 00 00 00 02 B8 41 5F 4D 5F 49 20  FACP......A_M_I
  0010: 4F 45 4D 46 41 43 50 20 01 06 00 12 4D 53 46 54  OEMFACP ....MSFT
  0020: 97 00 00 00 00 00 EC C7 40 04 EB C7 01 00 09 00  ........@.......
  0030: B0 00 00 00 E1 1E 00 00 00 08 00 00 00 00 00 00  ................
  0040: 04 08 00 00 00 00 00 00 FF 08 00 00 08 08 00 00  ................
  0050: 20 08 00 00 00 00 00 00 04 02 01 04 08 00 00 00   ...............
  0060: 65 00 E9 03 00 04 10 00 01 03 0D 00 32 03 00 00  e...........2...
  0070: A5 C1 01 00 01 08 00 00 F9 0C 00 00 00 00 00 00  ................
  0080: 06 00 00 00                                      ....

EDIT: forgot to add, it's a Phenom X3...
asrock a770de+ mobo
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: rekursor on February 13, 2010, 04:42:08 PM
Hey Andy, no prob I am quite busy too with my real life work ;)
1. I don't follow you on that one could you clarify please ?
1B. Parsing the list is a very fast operation (few microseconds) on modern processors,
So I promise you you would never notice a difference.
What really slows down the booter is
- file access: this can be optimized in our current version, I'll come back to this subject later.
- IO access can also sometimes slow down the booter.

2. The simplified scenario that I started coding on my branch is, like I said, far from being finished.
For the first increment you can only  :
  - drop undesired table by including them in the drop list but not including the corresponding files
  - replace any table by including it in the same folder than your other dsdt.aml file

We can solve this easily by adding only one new option:
- AddAML <aml list ...>
We can then decide wether we want all custom tables to be loaded included here,
or if we want that implicitly: all tables found in the dsdt.aml directory that are already specified in the drop would be automatically replaced ...
In the later case, we should then name this option :
- AddNewAML <new_aml only list>

Then Drop would be named
- DropAML <aml list ...>

Note that with only these two options you can address all needs concerning aml table loading  (including SSDTx handling).

Wouldn't it be much simpler (for the user) and nicer ?

Look at my new acpi.c file (and also the dsdt_patcher.c that I only started to modify but it gives you an idea) in my branch for the underlying logic / fast prototyping that I coded.
It needs testing and probably some polishing as I didn't take too much time on it,
but you can count on me to help implement that rapidly if you agree, for this more sophisticated parsing list engine ;)

I'm also OK for all the new features that you added, the only things that we don't want, is mainly this number of raw options explosion, as it has been discussed in the insanelymac forum in the last 10 pages (sorry for that as this huge thread should now take place here):
http://www.insanelymac.com/forum/index.php?showtopic=201902

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
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: andyvand on February 17, 2010, 07:23:21 PM
Yeah... I guess you are right...
I suppose it is that way much better...
I have checked your code and it indeed needs a little work but the idea = great.
Sorry to not reply sooner but I've been quite busy but I'll get to it...
Title: Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
Post by: BuildSmart on April 01, 2010, 01:10:07 PM
andyvand, don't take this wrong but why would you load ECDT and DMAR tables when you can clearly generate them from scratch and inject them much faster than you could load one file from disk???

The WDDT and WDTT tables can be dropped, OS X doesn't use them.

The FACP ACPIv1 table should increase to 0x81 bytes if it is smaller.

The FACP ACPIv2 table should increase to 0x94 bytes if it is smaller.

The FACP ACPIv3+ table should increase to 0xF4 bytes if it is smaller.

Also, a lot of fixes can be done in the existing FACP table but the size is an issue and the missing data needs to be generated based on the hardware if the table isn't the correct size but all the information is available either from the PCI buss or existing ACPI tables.

Some other settings to consider:
Code: [Select]
fadt_mod->Model should be 0 for desktop, 1 for mobile and 2 for server.
fadt_mod->Flags (should be)  |= 0x0400; /* set this for all configs */
fadt_mod->Preferred_PM_Profile should be 3, 5, 6 or 7 (depending on expected behavior)
fadt_mod->PM2_CB_Length should be 1

The reset details can be consistent across all hardware configurations.
[reset space, reset bitwidth, reset bitoffset. reset accesswidth, reset address, reset value]
0x01, 0x08, 0x00, 0x01, 0x0CF9, 0x06