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 #30 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.

rocksteady

  • Global Moderator
  • Posts: 233
  • Root Down
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #31 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
« Last Edit: February 05, 2010, 11:30:20 PM by rocksteady »
Stop bitching, start coding or documenting or both..

P5Q-EM : Q6600 : 8GB RAM : 8800GT : SATA Drives

zef

  • Administrator
  • Posts: 265
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #32 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/

There are many good clients for OS X besides the command line version. You may try Versions (http://versionsapp.com/) or Cornerstone (http://www.zennaware.com/cornerstone/) or TortoiseSVN for Windows (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
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #33 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  :) ;)

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #34 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
« Last Edit: February 06, 2010, 07:03:06 PM by andyvand »

rekursor

  • VoodooLabs
  • Posts: 47
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #35 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
« Last Edit: February 13, 2010, 05:36:27 PM by rekursor »

andyvand

  • VoodooLabs
  • Posts: 51
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #36 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...

BuildSmart

  • Member
  • Posts: 30
Re: Full ACPI table overrides and ACPI V1 to V4 conversion patch
« Reply #37 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