lorenz / asrock-x300-s3-fix

Enabling S3 sleep on a DeskMini X300
MIT License
25 stars 8 forks source link

Support for 1.80A Beta Firmware #6

Open dtcooper opened 1 year ago

dtcooper commented 1 year ago

Hi there,

With the 1.80A beta firmware (available here), I get the following error with the patch being rejected,

root@8f67935f9c0a:/tmp/asrock-x300-s3-fix# ./mkoverride.sh 
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «string»:1:9:

            1| (import <nixpkgs> {}).bashInteractive
             |         ^
will use bash from your environment

Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version 20220331
Copyright (c) 2000 - 2022 Intel Corporation

File appears to be binary: found 7519 non-ASCII characters, disassembling
Binary file appears to be a valid ACPI table, disassembling
Input file dsdt.aml, Length 0x5B08 (23304) bytes
ACPI: DSDT 0x0000000000000000 005B08 (v02 ALASKA A M I    00000001 INTL 20120913)
External object resolution file        ssdt6.aml
Input file ssdt6.aml, Length 0x10AC (4268) bytes
ACPI: SSDT 0x0000000000000000 0010AC (v01 AMD    ArticTPX 00000001 INTL 20120913)
Pass 1 parse of [SSDT]
Pass 2 parse of [SSDT]
External object resolution file        ssdt1.aml
Input file ssdt1.aml, Length 0x72B0 (29360) bytes
ACPI: SSDT 0x0000000000000000 0072B0 (v02 AMD    Artic    00000002 MSFT 04000000)
Pass 1 parse of [SSDT]
Pass 2 parse of [SSDT]
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed

Found 3 external control methods, reparsing with new information
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed
Disassembly completed
ASL Output:    dsdt.dsl - 222582 bytes
patching file dsdt.dsl
Hunk #1 FAILED at 18.
1 out of 1 hunk FAILED -- saving rejects to file dsdt.dsl.rej
lorenz commented 1 year ago

Probably ASRock just increased the version number of the ACPI table which breaks the patch to increase it. I have to see what I'm going to do about it in terms of supporting multiple versions.

dtcooper commented 1 year ago

Great! Thanks for looking into it. :)

puppinoo commented 1 year ago

EDIT: reading replies maybe with "deep sleep" they don't refer to S3 mode but the bugged one implemened. No sure.

Hi, https://smallformfactor.net/forum/threads/new-bios-update-asrock-deskmini-x300-bios-l1-80a-agesa-combo-v2-pi-1-2-0-7.18014/ Here somebody speculates that with latest FW "Deep sleep" could be offically enabled. Still with patched 1.70 so I canìt verify.

Regards.

lorenz commented 1 year ago

I quickly reverse-engineered 1.79 and the code which disables S3 is still in there.

dtcooper commented 1 year ago

Heya! Just wondering if there's any update to getting this working with the 1.80A firmware. Cheers!

mingww64 commented 1 year ago

I added an SSDT to patch the DSDT by OpenCore. This should theoretically work across all firmware versions and support all operating systems! https://github.com/wmyfelix/asrock-X300-OpenCore

Brli commented 5 months ago

the reported version is

DefinitionBlock ("", "DSDT", 2, "ALASKA", "A M I ", 0x00000001)

where the patch tries to apply

-DefinitionBlock ("", "DSDT", 2, "ALASKA", "A M I ", 0x01072009)
+DefinitionBlock ("", "DSDT", 2, "ALASKA", "A M I ", 0x0107200A)

is it safe to just patch the patch file to bypass this error?

lorenz commented 5 months ago

I haven't verified 1.80A, but assuming this is the only thing you change I have pretty high confidence that this is safe (but there is obviously no warranty on that statement).

Brli commented 5 months ago

works. it now suspend to s3 as only the blue blinking LED

my cpu is AMD Ryzen 7 PRO 4750G, so, should i open a PR to update readme?

lorenz commented 1 month ago

Can you guys test https://github.com/lorenz/asrock-x300-s3-fix/commit/686917d14028f393f48b50be8cfd6484858b1c27? This should make it much more compatible with different BIOS/firmware versions.

puppinoo commented 1 month ago

Hi, I'm using official 1.80D which supports BOTH S3 and restore after power failure. If intersted you can check all the different versions here https://smallformfactor.net/forum/threads/26-09-2024-asrock-deskmini-a-x300-bios-p1-82-sl01-support-s3-ok-for-x300-p3-70e-for-a300-agesa-combo-v2-pi-1-2-0-cc.18423/page-4#post-288529

Brli commented 1 month ago

1.90 was released on 2024/10/07