BeardOverflow / msi-ec

GNU General Public License v2.0
145 stars 45 forks source link

Support for MSI Alpha 17 B5EEK #45

Closed mutchiko closed 3 months ago

mutchiko commented 1 year ago

hello, after installing the msi-ec package from the AUR, i'm not able to find the msi-ec folder at : /sys/devices/platform/

i also noticed a error massage when i boot that goes along the lines: "failed to start kernel modules", which only happens when install msi-ec

important info: system: garuda linux kernel version: 6.1.30-1-lts

BIOS:E17LLAMS.108 EC:17LLEMS1.106 I tried to do this : https://github.com/BeardOverflow/msi-ec/issues/18#issuecomment-1435733090

but i failed to get the dump file this way, however, after going with the first 3 steps, i was able to find the msi-ec folder in: /sys/devices/platform/ (it disappears after rebooting) and from there i manually copied the contents of ec_dump dump.txt

when i opened ec_dump using kate and spammed f5 i saw some values change in real time, i remember one of entries had 3 values for each time that i press fn+f8 to change the keyboard lights (they don't work)

other things to note with this laptop:

1- i had very poor performance when using any external monitor, so i had to disable resize-BAR from the bios.

2-the dGPU:RX6600M is having performance issues too, low wattage, high usage when playing games.

so im hoping to solve this issue IF i can get msi-ec to work

thanks.

glpnk commented 1 year ago

By the way this helped me a lot : msi ec.pdf

Also previously found hexpat for Modern 15 a11m containing data about fan curves

UPD: this hexpat format is outdated and requires update Release note: Replaced [[left_to_right]] and [[right_to_left]] with a [[bitfield_order]] attribute that offers more control

UPD2: file contains some info about shifts in comments

UPD3: his screenshot

mutchiko commented 1 year ago

@glpnk hi, can you install kernel 6.5 then cpupower-gui and tell me how many options do you see in Energy preference?

We need this exact kernel because it enables AMD EPP driver on ryzen 3 CPUs, if you see 4 options that means super_battery doesn't control the CPU P-states.

glpnk commented 1 year ago

I'll try it

mutchiko commented 6 months ago

Super_battery is a dGPU switch (only on AMD laptops??) and it most likely doesn't exist on laptops without one, it activates - disactivate the main GPU and also sets the tdp limits on laptops which support multiple values (0W->65W->85W).

It must be changed at the same time as shift_mode to take effect, since the scanout reads the two addresses in one shot.

mutchiko commented 6 months ago

hi, i tried installing the driver but it fails saying the firmware version is not supported (in msi-ec.c there's no mention pf alpha 17) , i loaded it in debug mode and it kinda worked.

kernel: 6.8.4-1-cachyos EC: 17LLEMS1.106 BIOS: E17LLAMS.10B

surprisingly, i have 0 issues with the laptop in default bios settings (which wasn't the case before i changed the motherboard), and with amd pstate driver in action, it looks like it's ready for another round of testing. i just need help getting the driver installed.

glpnk commented 5 months ago

@mutchiko probably we don't finished adding your model. Please make new EC dump using debug mode.

And someone add your model to list. Weird...

glpnk commented 5 months ago

Find it. It is #47 PR. Probably @teackot made it draft. This version a bit outdated. Probably, you can use old version or try to add new model to latest version until it merged

mutchiko commented 5 months ago

Alright, i finally got the driver to build and function normally, it seems that the addresses didn't change (CONF18). msi-ec(alpha17).txt

The LEDs for mic and speaker muting refuse to function on linux, even though all the addresses are correct, i even verified them on windows (the mic mute led on windows is actually stuck and i have to change the value myself).

This laptop has almost the same addresses as MSI Modern 15 A5M (CONF16), apart from one shift mode that has changed after a bios update.

From what i can see, super_battery still doesn't support modes, i think it shouldn't be controlled by the user from the first place, it should be changed automatically with every available shift_mode.

I was hoping to synchronize Power-Profiles-Daemon with shift_mode in the driver, in a way that it executes a command like sudo echo turbo | sudo tee /sys/devices/platform/msi-ec/shift_mode every time you select the performance profile, but i don't think this is possible, but maybe i should try it with each CPU p-state change.

glpnk commented 5 months ago

So state for leds are readable from windows, but not work on linux? Address maps hardcoded in DSDT table, and in MSI software Your model is WMI1, because MSI share EC FW separately https://www.msi.com/Laptop/Alpha-17-B5EX/support?sub_product=Alpha-17-B5EEK#firmware

mutchiko commented 4 months ago

@glpnk if we start talking about DSDT tables then i think we should look for journal errors? i see two of them every time i boot to linux.

glpnk commented 4 months ago

I have some DSDT related error too, but it is not breaking anything

[    0.275821] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.SBRG.EC0], AE_NOT_FOUND (20230628/dswload2-162)
[    0.275829] ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20230628/psobject-220)
[   31.124328] ACPI Error: No handler for Region [VRTC] (0000000086f239b0) [SystemCMOS] (20230628/evregion-130)
[   31.124342] ACPI Error: Region SystemCMOS (ID=5) has no handler (20230628/exfldio-261)

[   31.124354] No Local Variables are initialized for Method [_Q9A]

[   31.124357] No Arguments are initialized for method [_Q9A]

[   31.124361] ACPI Error: Aborting method \_SB.PCI0.SBRG.EC._Q9A due to previous error (AE_NOT_EXIST) (20230628/psparse-529)

Actually, WMI1 have a bunch of WMI GUIDs, but WMI2 have like 1-2.

You can try reading WMI related values using DSDT names with this module https://github.com/nix-community/acpi_call

Also, one WMI2 methods allow raw access to EC, other just maps address lists

UPD: some device have random changing brightness caused by weird callbacks in DSDT (fixable)

glpnk commented 4 months ago

@mutchiko Which MSI app your laptop use? According to MSI Support it is MSI Center

In #76 you say that you broke some settings in BIOS. How do you fix that?

This GH issue was about CPU P-states. Do you try to change Windows power settings and check for changes to EC?

I have the Asus laptop and changes of "shift" setting corresponds to the Windows power settings. But I use G-helper instead of stock garbage software. So change of "shift" reduces the CPU power limit or max frequency (IDK what actually), but it reduces heat

mutchiko commented 4 months ago

Mine are these [ 0.261537] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored [ 0.396260] ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.GP17.MP2], AE_NOT_FOUND (20230628/psargs-330) [ 0.396266] ACPI Error: Aborting method \_SB.GPIO._EVT due to previous error (AE_NOT_FOUND) (20230628/psparse-529)

every recent msi laptop has some ACPI errors, this is just bad.

Actually, WMI1 have a bunch of WMI GUIDs, but WMI2 have like 1-2.

im not really familiar with the whole WMI thing, but i would gladly start learning

You can try reading WMI related values using DSDT names with this module https://github.com/nix-community/acpi_call

thanks, i'll check it out later

Also, one WMI2 methods allow raw access to EC, other just maps address lists

doesn't this make the way we're writing to the EC useless?

mutchiko commented 4 months ago

Which MSI app your laptop use? According to MSI Support it is MSI Center

@glpnk yes, this one https://www.msi.com/Landing/dragon-center-download/nb

In https://github.com/BeardOverflow/msi-ec/issues/76 you say that you broke some settings in BIOS. How do you fix that?

i broke the bios twice, the first time i just didn't know how to reset it, the second time there was no hope for it, sent it for repair and they replaced the motherboard, which had some weird PCI bridge problem (now i don't need to turn off resize bar on linux).

by the way you can close that issue, shift mode does change somethings but not the p-states on linux.

This GH issue was about CPU P-states. Do you try to change Windows power settings and check for changes to EC?

didn't do that (yet) but i discovered a whole load of CPU tuning tricks that happens on shift_mode, only on windows but can be replicated on linux too.

I have the Asus laptop and changes of "shift" setting corresponds to the Windows power settings.

i think with msi laptops we're stuck with msi garbage.

change of "shift" reduces the CPU power limit or max frequency (IDK what actually), but it reduces heat

leave these to me, it goes WAY deeper than frequency and heat.

glpnk commented 4 months ago

doesn't this make the way we're writing to the EC useless?

No, because address seems identical, so port should be easy. Cooler get RPM for WMI2 would be upstreamed soon https://github.com/lm-sensors/lm-sensors/issues/475#issuecomment-2085062771

If you have Windows installed you can try to sniff/log WMI calls https://github.com/BeardOverflow/msi-ec/discussions/98#discussioncomment-9528450

every recent msi laptop has some ACPI errors, this is just bad.

Many laptops have ACPI bugs, in some cases - decompiled code can't be compiled

BIOS _OSI(Linux) query ignored

Weird because many Linux distros just pass Windows as current OS to DSDT handler.

Could not resolve symbol [_SB.PCI0.GP17.MP2], AE_NOT_FOUND

This is GPU probably related

Aborting method _SB.GPIO._EVT due to previous error (AE_NOT_FOUND)

And this might be handler for \_SB.PCI0.GP17.MP2


TLDR how WMI works in case of EC: it uses same EC driver, like msi-ec for example. So roughly pipeline may look like this:

[driver which make WMI calls] => [DSDT worker] => [EC driver, etc] => [HW]
glpnk commented 4 months ago

i broke the bios twice, the first time i just didn't know how to reset it, the second time there was no hope for it, sent it for repair and they replaced the motherboard, which had some weird PCI bridge problem (now i don't need to turn off resize bar on linux).

Nice. =) I hope you don't lose data. My friend a while ago sent his laptop to Asus service, and they replaced the board with SSD

glpnk commented 4 months ago

@mutchiko If you're interested in decoding EC map try my ImHex map.

You need to download ImHex 1.33+ version, because it reloads when pattern settings are changed. So enable image and try different options from Settings section image

mutchiko commented 4 months ago

if you have Windows installed you can try to sniff/log WMI calls https://github.com/BeardOverflow/msi-ec/discussions/98#discussioncomment-9528450

i have windows installed, i'll definitely be doing this.

Many laptops have ACPI bugs, in some cases - decompiled code can't be compiled

I'm surprised that this is true, I've never ever seen an ACPI bugs on linux... until now

Weird because many Linux distros just pass Windows as current OS to DSDT handler.

i know that i didn't pass any kernel parameters, but should the DSDT handler respond to it? look:

`Else { If(MCTH(_OS, "Microsoft Windows NT")) { Store(Zero, OSVR) } If(MCTH(_OS, "Microsoft Windows")) { Store(One, OSVR) } If(MCTH(_OS, "Microsoft WindowsME: Millennium Edition")) { Store(0x02, OSVR) } If(MCTH(_OS, "Linux")) { Store(0x03, OSVR) } If(MCTH(_OS, "FreeBSD")) { Store(0x06, OSVR) } If(MCTH(_OS, "HP-UX")) { Store(0x07, OSVR) } If(MCTH(_OS, "OpenVMS")) { Store(0x08, OSVR) } } Return(OSVR) }

This is GPU probably related

i hate my life.

[driver which make WMI calls] => [DSDT worker] => [EC driver, etc] => [HW]

thanks, i needed this clarification

glpnk commented 4 months ago

If you're gonna do deep dive into DSDT decompilation try this "IDE". https://github.com/ic005k/Xiasl

OS detection in DSDT seems broken by design + may discriminate non Windows OSes. But ACPI Source Language have 2 OS dependent keywords.

OSVR seems to be stored to EC if I remember correctly. You can try to understand my logs in #98

I can't find _SB.PCI0.GP17.MP2 and _SB.GPIO._EVT in DSDT for your model, you can try to find it in SSDT tables

UPD: WMI logging seems working, at least on Asus laptop. Log is not updating in real time, you need to reload page by opening different log, for example. If you can't find WMI Activity — re check the list from the middle.

But I don't found any requests other than reading battery %.

May be check this also, idk is it safe or not https://github.com/Alois-xx/WMIWatcher

UPD2: tool definitely works, but it seems not log calls to device specific handlers. Seems WMI-ACPI is different

mutchiko commented 4 months ago

I can't find _SB.PCI0.GP17.MP2 and _SB.GPIO._EVT in DSDT for your model, you can try to find it in SSDT tables

and you're right, i found them in a SSDT table SB.PCI.txt

now that we have them, can we do something with them?

glpnk commented 4 months ago

@mutchiko Actually I don't know. As you have AMD GPU, maybe it has own tuning software. Try to find AMD GPU maintainers and ask them, or ACPI kernel maintainers. Just google \_SB.PCI0.GP17.MP2

Or you can try to find which driver uses this path and check its sources.

What kernel and distro you run?

Do you tried WMI dumper on Windows?

mutchiko commented 4 months ago

@glpnk im googling it right now.

kernel: 6.9.1-zen1-2-zen distro: Garuda linux (basically arch)

glpnk commented 4 months ago

WMI dump works, but anyone of our contributor community seems don't have wmi2 laptops

glpnk commented 4 months ago

On Windows setting custom fan curve, then setting silent seems restore stock fan curve, on Linux not(?). WRONG, silent do not mod fan curve

I want ImHex with EC dumping

mutchiko commented 4 months ago

I want ImHex with EC dumping

on linux?

glpnk commented 4 months ago

On Windows, because EC readings on linux is too slow. It should be possible to do with windring(?) kernel mode driver and custom plugin or C# "script"

Ran CleanCenterMaster™ and got BSOD. Realtime debugging is fun

mutchiko commented 4 months ago

@glpnk alright, so if i understand correctly: i go to msi center, change the fan curve values (let's say max for each temp) dump the table, then move to silent mode and dump the table again?

glpnk commented 4 months ago

No, you don't need it, fan curve address is same for all devices.

You don't need to dump WMI data, because you have WMI1 device

mutchiko commented 4 months ago

@glpnk then what am i supposed to do?

glpnk commented 4 months ago

You can try to find how to fine tune your gpu on linux, or check my logs in #98 if you want, to find what to do next

glpnk commented 4 months ago

Windows power manager can't downclock CPU without MSI app. IDK is MSI app can change max clock, but ASUS drivers can.

Re checked on Asus, so Windows power settings (or power mode?) don't change max clock, but driver and app could. App also changes Windows power settings

mutchiko commented 4 months ago

@glpnk windows doesn't downclock, it just passes some parameters to the AMD SMU, just like msi center, but with less control.

i'll explain that in better detail later, for now im trying to replicate the msi center behavior on linux, and i managed to get a lot done.

i even modified Mcontrol center to make it change the value of supper battery with shift mode, just like windows. but after much testing, it seems to do nothing on linux (and maybe on windows too??)

also i have discovered a read-only address that behaves similarly to what supper battery does on other laptops

at 0x33 = 05 when selecting power save mode 0x33 = 0D when selecting any other mode but again it's read only so it probably changes on linux too.

glpnk commented 4 months ago

Nice. I wanted to remake mcontrol center to allow it to read value by address. Because now it makes full EC dump every time

mutchiko commented 4 months ago

before we move on to the next objective, i pinned down the SSDT table issue, it's with the iGPU (vega 8)

can be found here : /sys/class/pci_bus/0000:00/device/0000:03.00/firmware_node/path and it says :_SB.PCI0.GP17

but on windows it says: _SB.PCI0.GP17.VGA

is there a way for me to fix the SSDT table and then recompile it?

glpnk commented 4 months ago

Msi center pro (and may be other programs) in some case use RAW EC access instead of wmi, so we can just hardcode some values.

Not logget in WMI:

glpnk commented 4 months ago

You say vega 8 iGPU, i have asus laptop with it + nvidia 1050 dGPU and can check is this error occurs for it

is there a way for me to fix the SSDT table and then recompile it?

This is should be possible, you can replace DSDT, but this shoud be possible for SSDT

glpnk commented 4 months ago

@mutchiko I think your SSDT GPU may be caused by Linux not being able to read/write ACPI values larger than 1 byte. Fix might be released in 6.10 kernel.[wrong assumption] But you need to check what this method is returning

mutchiko commented 4 months ago

can check is this error occurs for it

great! to check for it on windows go to device manager> display controllers> double click the igpu> details > BIOS device name

mutchiko commented 4 months ago

@glpnk alright then, once the mainline 6.10 hits the repos im going to try it

you need to check what this method is returning

but i have no idea how to do that, but i know that GOvelay only detects my iGPU, even though i can game on the dGPU just fine

glpnk commented 4 months ago

AMD Vega 8

PCI\VEN_1002&DEV_15D8&SUBSYS_18F11043&REV_C2
\_SB.PCI0.GP17.VGA

Nvidia 1050

\_SB.PCI0.GPP0.PEGP

Also, I have kernel with that patch, and I can compare SSDT. Try older drivers, because I've tested it on Ubuntu 22.04 with \~6.4 and 6.8-rc7

I have different ACPI errors with Nvidia GPU and TPM (probably software)

glpnk commented 4 months ago

[ 0.261537] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored [ 0.396260] ACPI BIOS Error (bug): Could not resolve symbol [_SB.PCI0.GP17.MP2], AE_NOT_FOUND (20230628/psargs-330) [ 0.396266] ACPI Error: Aborting method _SB.GPIO._EVT due to previous error (AE_NOT_FOUND) (20230628/psparse-529)

Soooooo...

\_SB.PCI0.GP17.MP2 is event handler. But it not exists in your dump.

Please just copy all files from /sys/firmware/acpi/tables/ and send it somehow. (make archive, rename to .txt and send here, for example). Or try to find symbol MP2 defenition yourself.

\_SB.GPIO._EVT exists

And its seems to be some GPU switch logic

Scope(\_SB.GPIO)
    {
        Method(_AEI, 0, NotSerialized)
        {
            Name(BUF0, ResourceTemplate()
            {
                GpioInt(Edge, ActiveHigh, ExclusiveAndWake, PullDefault, 0x1388, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0000
                }
                GpioInt(Edge, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x002C
                }
                GpioInt(Level, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x003D
                }
                GpioInt(Level, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x003E
                }
                GpioInt(Level, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x003A
                }
                GpioInt(Level, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x003B
                }
                GpioInt(Edge, ActiveLow, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0002
                }
                GpioInt(Level, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0031
                }
                GpioInt(Edge, ActiveLow, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0011
                }
                GpioInt(Edge, ActiveLow, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x000B
                }
                GpioInt(Edge, ActiveLow, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0012
                }
                GpioInt(Edge, ActiveLow, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0018
                }
                GpioInt(Edge, ActiveHigh, ExclusiveAndWake, PullDown, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0044
                }
                GpioInt(Edge, ActiveLow, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0036
                }
                GpioInt(Edge, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPIO", 0x00, ResourceConsumer,,)
                {
                    0x0059
                }
            })
            Return(BUF0)
        }
        Method(_EVT, 1, Serialized)
        {
            Name(_T_0, Zero)
            While(One)
            {
                Store(ToInteger(Arg0), _T_0)
                If(LEqual(_T_0, Zero))
                {
                    MSTP(0x3900)
                    Notify(\_SB.PWRB, 0x80)
                }
                Else
                {
                    If(LEqual(_T_0, 0x02))
                    {
                        MSTP(0x3902)
                        Notify(\_SB.PCI0.GPP1, 0x02)
                    }
                    Else
                    {
                        If(LEqual(_T_0, 0x0B))
                        {
                            MSTP(0x3911)
                            Notify(\_SB.PCI0.GPP1, Zero)
                        }
                        Else
                        {
                            If(LEqual(_T_0, 0x11))
                            {
                                MSTP(0x3917)
                                Notify(\_SB.PCI0.GPP2, 0x02)
                            }
                            Else
                            {
                                If(LEqual(_T_0, 0x12))
                                {
                                    MSTP(0x3918)
                                    Notify(\_SB.PCI0.GPP4, 0x02)
                                }
                                Else
                                {
                                    If(LEqual(_T_0, 0x18))
                                    {
                                        MSTP(0x3924)
                                        Notify(\_SB.PCI0.GPP3, 0x02)
                                    }
                                    Else
                                    {
                                        If(LEqual(_T_0, 0x31))
                                        {
                                            MSTP(0x3949)
                                            Store(Add(Multiply(SMBA, 0x0100), 0x20), Local0)
                                            OperationRegion(ASFA, SystemIO, Local0, 0x10)
                                            Field(ASFA, ByteAcc, NoLock, Preserve)
                                            {
                                                Offset(0xA),    //Offset(10),
                                                ASTS, 8,
                                            }
                                            If(LEqual(And(ASTS, 0x44), 0x44))
                                            {
                                                Notify(\_SB.PWRB, 0x80)
                                            }
                                            Store(0xFF, ASTS)
                                        }
                                        Else
                                        {
                                            If(LEqual(_T_0, 0x36))
                                            {
                                                MSTP(0x3954)
                                                Notify(\_SB.PCI0.GP17.MP2, 0x02)
                                            }
                                            Else
                                            {
                                                If(LEqual(_T_0, 0x3A))
                                                {
                                                    MSTP(0x3958)
                                                    Notify(\_SB.PCI0.GP17.XHC0, 0x02)
                                                }
                                                Else
                                                {
                                                    If(LEqual(_T_0, 0x3B))
                                                    {
                                                        MSTP(0x3959)
                                                        Notify(\_SB.PCI0.GP17.XHC1, 0x02)
                                                    }
                                                    Else
                                                    {
                                                        If(LEqual(_T_0, 0x3D))
                                                        {
                                                            MSTP(0x3961)
                                                            Notify(\_SB.PCI0.GP17.AZAL, 0x02)
                                                        }
                                                        Else
                                                        {
                                                            If(LEqual(_T_0, 0x3E))
                                                            {
                                                                MSTP(0x3961)
                                                                Notify(\_SB.PCI0.GP17.ACP, 0x02)
                                                            }
                                                            Else
                                                            {
                                                                If(LEqual(_T_0, 0x44))
                                                                {
                                                                    MSTP(0x3962)
                                                                    Notify(\_SB.PCI0.GPP0, Zero)
                                                                }
                                                                Else
                                                                {
                                                                    If(LEqual(_T_0, 0x59))
                                                                    {
                                                                        MSTP(0x3962)
                                                                        Notify(\_SB.PCI0.GPP0, Zero)
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                Break
            }
        }
    }
mutchiko commented 4 months ago

Try older drivers

i have this issue since linux 6.1, so it's not the drivers.

I have different ACPI errors with Nvidia GPU and TPM (probably software)

i don't think we can fix TPM errors, but it's not THAT important on linux anyway. do you use the proprietary nvidia drivers?

try to find symbol MP2 defenition yourself

trust me i tried

And its seems to be some GPU switch logic

nice.

copy all files from /sys/firmware/acpi/tables/ and send it

here: tables.tar.gz

github supports uploading .tar archives so it's all good.

glpnk commented 4 months ago

I'll check your files later. You can experiment with files from my Asus laptop. Just unpack and drag-n-drop to xiasl. It has builtin decompiler. UPD: I accidentally sent you decompiled files. Why not...

tables-asus-505dd.zip

To work with your files on xiasl you need to add to your table files extension .dat

mutchiko commented 4 months ago

@glpnk my fault, ill rename all the files, compress and send them again

here: tables(Alpha 17 B5EEK).tar.gz

Update: it looks like i wasn't searching correctly, i found MP2 in SSDT15. from the comments it seems that it's related to device wake.

glpnk commented 4 months ago

Asus laptop has like 7 SSDTs, my MSI has 10, your 15. Wow

mutchiko commented 4 months ago

i know right? it seems to get more complicated with each new generation, what's the processors on each of your laptops?

mutchiko commented 4 months ago

useful links: wmidump: https://github.com/iksaif/wmidump

MP2: https://www.kernel.org/doc/html/v5.11/i2c/busses/i2c-amd-mp2.html (possibly related to the mp2 issue in acpi?)

ACPI_CALL dkms: https://github.com/nix-community/acpi_call (to call acpi methods)

battmgr: https://github.com/0xless/battmngr/blob/main/battmngr (uses acpi calls to change charging speed for ex. in ideapads. i bet that msi center does the same for other functions like display overdrive)

glpnk commented 4 months ago

Actually, battery interface is only one msi-ec feature, that was upstreamed to kernel

If you want to collect useful links, please use #98. I have many links there.

Here

glpnk commented 4 months ago

About WMI: I've got a bunch of DSDT dumps, and none of them have MOF file, but they exported similar GUIDs. These blocks called _WDG in ACPI. WQXX should have binary MOF/BMOF, but they shipped inside of driver. Kernel have module, which exports this BMOF as file in sysfs (or similar interface). Then you can decompile BMOF to MOF in text form.

WMI1 GUIDs on real HW

Full MOF made with bmfdec

glpnk commented 4 months ago

What CPU you have? Support page states that it is ryzen 7 5xxxH gen. Maybe you have vega 8 iGPU but on different platform

Check VFCT table, it's iGPU VBIOS

We probably shouldn't share SLIC table, because it may have activation keys. But IDK how this table is shared - flashed on factory in RO part of BIOS or contains placeholder in BIOS updates

And don't share MSDM because it seems Windows key

I don't know anything about these tables because all my devices don't have Windows built in key.

Look like ECDT for my MSI laptop is just empty, but should have path to EC

Archive with tables from my laptop msi-c5m.zip

Update: it looks like i wasn't searching correctly, i found MP2 in SSDT15. from the comments it seems that it's related to device wake.

This looks like that this function just not exists. And this is just weird. I think you can just remove it from SSDT15. Or it might be passed from driver side, if it possible...

Older decompilers don't understand switch-case, new can. Compare this and code below:

Method (_EVT, 1, Serialized)  // _EVT: Event
        {
            Switch (ToInteger (Arg0))
            {
                Case (Zero)
                {
                    MSTP (0x3900)
                    Notify (\_SB.PWRB, 0x80) // Status Change
                }
                Case (0x02)
                {
                    MSTP (0x3902)
                    Notify (\_SB.PCI0.GPP1, 0x02) // Device Wake
                }
                Case (0x0B)
                {
                    MSTP (0x3911)
                    Notify (\_SB.PCI0.GPP1, Zero) // Bus Check
                }
                Case (0x11)
                {
                    MSTP (0x3917)
                    Notify (\_SB.PCI0.GPP2, 0x02) // Device Wake
                }
                Case (0x12)
                {
                    MSTP (0x3918)
                    Notify (\_SB.PCI0.GPP4, 0x02) // Device Wake
                }
                Case (0x18)
                {
                    MSTP (0x3924)
                    Notify (\_SB.PCI0.GPP3, 0x02) // Device Wake
                }
                Case (0x31)
                {
                    MSTP (0x3949)
                    Local0 = ((SMBA * 0x0100) + 0x20)
                    OperationRegion (ASFA, SystemIO, Local0, 0x10)
                    Field (ASFA, ByteAcc, NoLock, Preserve)
                    {
                        Offset (0x0A), 
                        ASTS,   8
                    }

                    If (((ASTS & 0x44) == 0x44))
                    {
                        Notify (\_SB.PWRB, 0x80) // Status Change
                    }

                    ASTS = 0xFF
                }
                Case (0x36)
                {
                    MSTP (0x3954)
                    Notify (\_SB.PCI0.GP17.MP2, 0x02) // Device Wake
                }
                Case (0x3A)
                {
                    MSTP (0x3958)
                    Notify (\_SB.PCI0.GP17.XHC0, 0x02) // Device Wake
                }
                Case (0x3B)
                {
                    MSTP (0x3959)
                    Notify (\_SB.PCI0.GP17.XHC1, 0x02) // Device Wake
                }
                Case (0x3D)
                {
                    MSTP (0x3961)
                    Notify (\_SB.PCI0.GP17.AZAL, 0x02) // Device Wake
                }
                Case (0x3E)
                {
                    MSTP (0x3961)
                    Notify (\_SB.PCI0.GP17.ACP, 0x02) // Device Wake
                }
                Case (0x44)
                {
                    MSTP (0x3962)
                    Notify (\_SB.PCI0.GPP0, Zero) // Bus Check
                }
                Case (0x59)
                {
                    MSTP (0x3962)
                    Notify (\_SB.PCI0.GPP0, Zero) // Bus Check
                }

            }
        }