Jump to content

Compiling ACPI v2.0 driver for Windows XP SP3 and Windows 2003 SP2 (x32/x64)


Mov AX, 0xDEAD

Recommended Posts

@daniel_k

Thank you very much for the informations ! :)

For reference, are affected by the problem the following USB flash drives:

All models of Transcend JetFlash 780 (8GB, 16GB, 32GB, 64GB and 128GB)

https://www.transcend-info.com/product/usb-jetflash-jf/jetflash-780

Three models of Grixx (32GB, 64GB and 128GB)

Regards

Link to comment
Share on other sites


@Dietmar

Connection() fix, change ParseField() to                         

Quote

    ENTER(2, ("ParseField(pctxt=%x,pbOp=%x,pnsParent=%x,FieldFlags=%x,BitPos=%x)\n",
              pctxt, pctxt->pbOp, pnsParent, *pdwFieldFlags, *pdwBitPos));

    // Connection Field
    if (*pctxt->pbOp == 0x02) {
        PUCHAR pbOp = pctxt->pbOp + 1;

        if (*pbOp == 0x11) {                            // Buffer()
            ULONG dwcbBits;
            pbOp++;
            dwcbBits = ParsePackageLen(&pbOp, NULL);
            pctxt->pbOp += dwcbBits;
            pctxt->pbOp += 2;   //  0x02, 0x11, [...]
        } else {                                        // Name()
            pctxt->pbOp += 4;   //  name len
            pctxt->pbOp += 1;   //  0x02, name
        }
    }


    if (*pctxt->pbOp == 0x01)
    ...


Tested on DSDT test code:

Quote

    Field (GPO2, ByteAcc, NoLock, Preserve)
    {                
        Connection(SBFB),
        FLD0, 8,
        FLD1, 8
    }
    
    Field (GPO2, ByteAcc, NoLock, Preserve)
    {
        Connection (
            GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
                "\\_SB.GPO0", 0x00, ResourceConsumer, ,
                )
                {   // Pin list
                    0x005F
                }
        ),
        SHS3,   1
    }
    
    SHS3 = 2
    Local1 = SHS3

SHS3 and FLD0/FLD1 are dummy with undefined type, if DSDT uses it lately in some math calculation, i don't know what happens

Link to comment
Share on other sites

@Mov AX, 0xDEAD

Can you write a pseudocode with words,

what you change and how?

From your post before I thought, that you make the pointer from amli just to jump to next device,

when it meets the acpi5 word connection(), depending on the real OS version.

This would be very similar as we did in the very first editing the DSDT in the Gigabyte H110M board via

       

Method (THDH, 1, Serialized)
        {
            THDS (ToHexString (Arg0))
        }

 

====>

        Method (THDH, 1, Serialized)
        {
            If ((OSYS >= 0x07D6))
            {
                THDS (ToHexString (Arg0))
            }
        }

From my thinking this would be the ideal solution,

depending from the OS the words from >acpi2.0 would be just overjumped but now not with editing DSDT,

just lets do acpi.sys exact the same

Dietmar

 

EDIT: May be, that you can make a compare between the

DSDT.raw and DSDT2.raw files from my 2 DSDT examples on the Gigabyte H110M board,

what this

  If ((OSYS >= 0x07D6))

exactly is doing.

 

Edited by Dietmar
Link to comment
Share on other sites

@daniel_k

I dont have one of those USB sticks.

But I noticed another strange behavior on any USB device with the new USB3 driver:

When you copy a really big amount of data (for example 40 Gbyte) in one step,

suddently comes a message, that not enough ram is there, even I have with patch 32 Gigabyte.

When you disconnect the stick and connect again, you can copy this 40 Gbyte.

But when you try to copy the next 40 Gbyte, exact the same message appears.

This is not a big problem, because nearly no "normal" file is about this size,

but the problem is real. This never happens, when you make the same transfer with 40Gbyte again and again via 2  Sata disks

Dietmar

Link to comment
Share on other sites

@daniel_k

I found this place in parser.c .

I only want to know,

how it works.

Maybe, that my idea is not so bad

and this way to jump over unknown words depending on the OS version

can be generalized in acpi.sys

Dietmar

Link to comment
Share on other sites

1 hour ago, Dietmar said:

@Mov AX, 0xDEAD

From my thinking this would be the ideal solution,

depending from the OS the words from >acpi2.0 would be just overjumped but now not with editing DSDT,

just lets do acpi.sys exact the same

Method (THDH, 1, Serialized)
        {
            THDS (ToHexString (Arg0))
        }

====>

        Method (THDH, 1, Serialized)
        {
            If ((OSYS >= 0x07D6))
            {
                THDS (ToHexString (Arg0))
            }
        }

 

New "global" 12 acpi 2.0 commands like ToHexString() in v6666/v7777 works as expected, when you comment it, you broke codeflow, in your example you never call THDS() on XP. It is wrong way, i dont want talk about it.

Edited by Mov AX, 0xDEAD
Link to comment
Share on other sites

1 hour ago, Dietmar said:

@Mov AX, 0xDEAD

Can you write a pseudocode with words,

what you change and how?

See how DSDT coded in bytes

fix detect sequence 02 11 (connection as buffer), skip all inside buffer definition and jump to 53 48 53 33 01 

Quote

871D: 5B 81 33 47 50 4F 32 01 02 11 26 0A 23 8C 20 00  // [.3GPO2...&.#. .
872D: 01 01 01 00 02 00 00 00 00 00 00 17 00 00 19 00  // ................
873D: 23 00 00 00 5F 00 5C 5F 53 42 2E 47 50 4F 30 00  // #..._.\_SB.GPO0.
874D: 53 48 53 33 01    

to

Quote

871D: 5B 81 33 47 50 4F 32 01 02 11 26 0A 23 8C 20 00  // [.3GPO2...&.#. .
872D: 01 01 01 00 02 00 00 00 00 00 00 17 00 00 19 00  // ................
873D: 23 00 00 00 5F 00 5C 5F 53 42 2E 47 50 4F 30 00  // #..._.\_SB.GPO0.
874D: 53 48 53 33 01    

same in decompiled format:

Quote

Field (GPO2, ByteAcc, NoLock, Preserve)
            {
                SHS3,   1
            }
        }

now SHS3 is not alias to GPIO pins, now it is alias to fake memory field

Link to comment
Share on other sites

@Dietmar

Now I see what you mean.

You can't jump over a certain device because sometimes other code may have references to it.

For example, in your Flex 10 DSDT table, if you skip Device GPO0, it is referenced in Device (SDHC), something bad may happen,

Unless you skip all related devices. In the case of your Flex, GPIO/SDHC/I2C.

Edited by daniel_k
Link to comment
Share on other sites

@Mov AX, 0xDEAD

ACPI 5.0+ code is usually used in code related to GPIO, I2C and SDHC devices.

What if we skip/ignore these devices, by comparing string names in _HID/_CID/_DDN against I2C, GPIO or "SD Host"/"SD Card"?

These devices seem to be linked to each other.

Edited by daniel_k
Link to comment
Share on other sites

7 minutes ago, daniel_k said:

@Mov AX, 0xDEAD

ACPI 5.0+ code is usually used in code related to GPIO, I2C and SDHC devices.

What if we skip/ignore these devices, by comparing string names in _HID/_CID/_DDN against I2C, GPIO or "SD Host"/"SD Card"?

You need manually parse every motherboard  :)

For my h110 s2pv board, you need "hide" IICB method of PCI device because it uses I2cSerialBusV2 + probaly link to I2C0 device

Then need to hide CLP0 device + LNK0 device + ....

Quote

   Scope (_SB.PCI0)
    {
        Method (IICB, 2, Serialized)
        {
            Name (_T_0, Zero)  // _T_x: Emitted by ASL Compiler
            While (One)
            {
                _T_0 = ToInteger (Arg1)
                If (_T_0 == Zero)
                {
                    Name (IIC0, ResourceTemplate ()
                    {
                        I2cSerialBusV2 (0x0000, ControllerInitiated, 0x00061A80,
                            AddressingMode7Bit, "\\_SB.PCI0.I2C0",
                            0x00, ResourceConsumer, _Y3C, Exclusive,
                            )
                    })

....

        Device (CLP0)
        {
            Name (_UID, Zero)  // _UID: Unique ID
            Name (_HID, "INT3472")  // _HID: Hardware ID
            Name (_CID, "INT3472")  // _CID: Compatible ID
            Name (_DDN, "PMIC-CRDG")  // _DDN: DOS Device Name
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Local0 = ResourceTemplate ()
                    {
                    }
                ConcatenateResTemplate (Local0, IICB (C0IA, C0IB), Local2)
                Local0 = Local2
                Return (Local0)
            }

   Device (LNK0)
        {
            Name (_ADR, Zero)  // _ADR: Address   

            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Local0 = ResourceTemplate ()
                    {
                    }
                If (L0DI > Zero)
                {
                    Local1 = IICB (L0A0, L0BS)
                    ConcatenateResTemplate (Local0, Local1, Local2)
                    Local0 = Local2
                }

                If (L0DI > One)
                {
                    Local1 = IICB (L0A1, L0BS)
                    ConcatenateResTemplate (Local0, Local1, Local2)
                    Local0 = Local2
                }
 


 

Link to comment
Share on other sites

@Mov AX, 0xDEAD

Just test for me, if I understand you correct:

"fix detect sequence 02 11 (connection as buffer), skip all inside buffer definition and jump"

If acpi.sys sees any code in DSDT, that it does not like,

via this way it jumps over it.

For this, acpi.sys only needs to know, which is the byte code for the unknown  >acpi2.0 word (here 02 11)

and then it ignores what happens inside this code, jumping to the very first code after (here 02 11) is finished

Dietmar

PS: So, when the same happens again for another unknown >acpi2.0 word,

you only need to do the same patch in parse.c again via its special byte code.

Edited by Dietmar
Link to comment
Share on other sites

15 minutes ago, Dietmar said:

PS: So, when the same happens again for another unknown >acpi2.0 word,

you only need to do the same patch in parse.c again via its special byte code.

Yes, but you need to read ACPI specs (pdf) to understand the number of fields of the structure, their size etc.

You can't just copy and paste.

Quote

    // Connection Field
    if (*pctxt->pbOp == 0x02) {
        PUCHAR pbOp = pctxt->pbOp + 1;

        if (*pbOp == 0x11) {                            // Buffer()
            ULONG dwcbBits;
            pbOp++;
            dwcbBits = ParsePackageLen(&pbOp, NULL);
            pctxt->pbOp += dwcbBits;
            pctxt->pbOp += 2;   //  0x02, 0x11, [...] -> skips 2 bytes
        } else {                                        // Name()
            pctxt->pbOp += 4;   //  name len -> skips 4 bytes
            pctxt->pbOp += 1;   //  0x02, name -> skips 1 byte
        }
    }

 

Edited by daniel_k
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...