1Revenger1 / ECEnabler

223 stars 22 forks source link

Many compose failures [UUID] when checking if ECEnabler is used (via debug logging enabled) #13

Closed mackonsti closed 2 years ago

mackonsti commented 3 years ago

Hello @1Revenger1 thank you for providing this kext ! I recently discovered it in the EFI.zip of someone that posted it who's using the same laptop as me.

I was about to post a request to you, to ask you to enhance your main README.md file and to show us users if your kext is needed (i.e. what can we see, somewhere like IORegistry or kernel logs) and how your kext can provide information on whether it is eventually useed.

I have a Lenovo IdeaPad S145 and added ECEnabler to my OpenCore config alongside msgbuf=1048576 -ecedbg boot-arguments.

Upon reboot, I was getting only dozens and dozens of such failures without any other ECE related information:

$ log show --style syslog -debug --info --last boot | grep ECEnabler

localhost kernel[0]: (ECEnabler) <compose failure [UUID]>
localhost kernel[0]: (ECEnabler) <compose failure [UUID]>
localhost kernel[0]: (ECEnabler) <compose failure [UUID]>
localhost kernel[0]: (ECEnabler) <compose failure [UUID]>
  1. So if there is no other output produced in the system/kernel log, is it safe to assume that ECEnabler is not doing anything and this not really needed? Referring to your Issue #10 and the comment there.

  2. Is there anything that can help us detect if we need your kext? Perhaps the Device (EC) declarations in a dumped DSDT and some byte range or similar?

  3. Any idea why these <compose failure [UUID]> occur?

I tried finding the root cause of such compose failures and bumped into this article: https://eclecticlight.co/2018/08/16/working-around-a-bug-recently-introduced-into-mojave-when-signposts-point-the-wrong-way/

Could it be some parameter or setting during your Xcode building?

Thank you again!

1Revenger1 commented 3 years ago

It's needed for most Lenovo's probably. You can use it to read EC fields greater than 8 bits big, which requires battery patching otherwise to split up. You can tell if you need it if you have fields greater than 8 bits in size in your DSDT.

Field (AAAA, 0x0...)
{
  Offset (0x86),
  BBBB, 8, // No patching needed
  CCCC, 8,
  DDDD, 16 // Can be fixed with ECEnabler or splitting into 2 fields.
}

I've had awful luck using the log command, I prefer to use DebugEnhancer.kext and sudo dmesg to get logs. Has the compose failure less often as well. And no, I have no clue where it comes from.

mackonsti commented 2 years ago

Hello @1Revenger1 thank you for your tip. Please can you kindly confirm you're referring to Device (EC0) or any other naming convention such as (BAT0) under EC? I have extracted my DSDT from my IdeaPad S145 and I see this for Device (EC0) before the different "Methods" but no 16bits entry:

    Scope (_SB.PCI0.LPCB)
    {
        Device (EC0)
        {
            Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */)  // _HID: Hardware ID
            Name (_UID, One)  // _UID: Unique ID
            Name (ECAV, Zero)
            Mutex (LFCM, 0x00)
            Mutex (ECMT, 0x00)
            Mutex (HGCT, 0x00)
            Method (_GPE, 0, NotSerialized)  // _GPE: General Purpose Events
            [...]

            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            [...]

            Method (_STA, 0, NotSerialized)  // _STA: Status
            [...]

            OperationRegion (SMIO, SystemIO, 0xB2, 0x02)
            Field (SMIO, ByteAcc, NoLock, Preserve)
            {
                SMIC,   8,
                SMID,   8
            }

            OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF)
            Field (ERAM, ByteAcc, Lock, Preserve)
            {
                VCMD,   8,
                Offset (0x60),
                SMPR,   8
            }

            OperationRegion (TCIO, SystemIO, 0x0270, 0x10)
            Field (TCIO, ByteAcc, Lock, Preserve)
            {
                TCIN,   8,
                TCDD,   8
            }

            Method (TCRD, 1, Serialized)
            {
                Local0 = Acquire (ECMT, 0x01F4)
                If ((Local0 == Zero))
                {
                    TCIN = Arg0
                    Release (ECMT)
                    Return (TCDD) /* \_SB_.PCI0.LPCB.EC0_.TCDD */
                }

                Release (ECMT)
            }

            Method (TCWT, 2, Serialized)
            {
                Local0 = Acquire (ECMT, 0x01F4)
                If ((Local0 == Zero))
                {
                    TCIN = Arg1
                    TCDD = Arg0
                }

                Release (ECMT)
            }

            OperationRegion (ERAX, SystemMemory, 0xFF000400, 0xFF)
            Field (ERAX, ByteAcc, Lock, Preserve)
            {
                Offset (0x01),
                VDAT,   8,
                VSTA,   8,
                Offset (0x06),
                FANS,   8,
                BUSG,   1,
                BLEG,   1,
                BATF,   1,
                BNSM,   1,
                BTST,   1,
                BBAD,   1,
                AUTO,   1,
                FCHG,   1,
                ABTL,   8,
                DBTL,   8,
                EDCC,   1,
                ALSC,   1,
                CDMB,   1,
                CCSB,   1,
                BTSM,   1,
                BTCM,   1,
                LBTM,   1,
                CSBM,   1,
                SGST,   1,
                HDMI,   1,
                HYBD,   1,
                SWST,   1,
                EVNT,   1,
                DCRF,   1,
                COLR,   1,
                SGCN,   1,
                ODPO,   1,
                EODD,   1,
                ODPK,   1,
                CMEX,   1,
                CMON,   1,
                SODD,   1,
                ODFB,   1,
                EODS,   1,
                Offset (0x0E),
                Offset (0x0F),
                AFCC,   8,
                PINF,   3,
                SUPR,   1,
                GTMP,   1,
                QUIT,   1,
                LS35,   1,
                Offset (0x11),
                RMBT,   1,
                RSBT,   1,
                VTYP,   2,
                Offset (0x12),
                FUSL,   8,
                FUSH,   8,
                FWBT,   64,
                Offset (0x1D),
                QUIE,   8,
                Offset (0x31),
                GIRT,   8,
                PIRT,   8,
                KIRT,   8,
                IRTI,   8,
                Offset (0x36),
                DGPU,   8,
                GUST,   8,
                GDST,   8,
                Offset (0x43),
                ECTP,   8,
                Offset (0x4A),
                ESMC,   1,
                Offset (0x4B),
                EMOD,   8,
                BFUD,   16,
                Offset (0x5D),
                EXSI,   8,
                EXSB,   8,
                EXND,   8,
                Offset (0x61),
                SMST,   8,
                SMAD,   8,
                SMCM,   8,
                SMDA,   256,
                BCNT,   8,
                SMAA,   8,
                SAD0,   8,
                SAD1,   8,
                    ,   1,
                    ,   1,
                    ,   1,
                    ,   1,
                    ,   1,
                FBFG,   1,
                Offset (0x8A),
                KBLO,   1,
                UCHE,   1,
                KLCH,   1,
                    ,   1,
                KLFS,   1,
                KLOR,   1,
                UCHR,   1,
                UCER,   1,
                TPDV,   3,
                Offset (0x8C),
                QCHO,   1,
                BKLT,   1,
                    ,   1,
                    ,   1,
                ABC5,   1,
                Offset (0x8F),
                BMN0,   72,
                BDN0,   64,
                IBTL,   1,
                IBCL,   1,
                ISS0,   1,
                IRTC,   1,
                ISUP,   1,
                ISC2,   1,
                IWAK,   1,
                Offset (0xA1),
                    ,   1,
                VOUT,   1,
                TPAD,   1,
                HKDB,   1,
                Offset (0xA2),
                Offset (0xA3),
                OSTY,   3,
                    ,   1,
                ADPI,   2,
                    ,   1,
                ADPT,   1,
                PMEW,   1,
                MODW,   1,
                LANW,   1,
                RTCW,   1,
                WLAW,   1,
                USBW,   1,
                KEYW,   1,
                TPWK,   1,
                CHCR,   1,
                ADPP,   1,
                LERN,   1,
                ACMD,   1,
                BOVP,   1,
                LEAK,   1,
                AIRP,   1,
                ACOF,   1,
                S3EN,   1,
                S3RS,   1,
                S4EN,   1,
                S4RS,   1,
                S5EN,   1,
                S5RS,   1,
                Offset (0xA7),
                OSTT,   8,
                OSST,   8,
                THRT,   8,
                TCOT,   8,
                MODE,   1,
                    ,   2,
                INIT,   1,
                FAN1,   1,
                FAN2,   1,
                FAOK,   1,
                SKIN,   1,
                SDTE,   8,
                SPDN,   4,
                FNUM,   4,
                TLVL,   4,
                    ,   2,
                THSW,   1,
                TPIN,   1,
                TSTH,   1,
                TSCP,   1,
                    ,   2,
                PLVL,   4,
                CPUT,   8,
                CPTL,   8,
                Offset (0xB3),
                RTMP,   8,
                DGPT,   8,
                VTMP,   8,
                Offset (0xB7),
                    ,   1,
                PWDB,   1,
                DIGT,   1,
                CDLK,   1,
                Offset (0xB8),
                    ,   1,
                LSTE,   1,
                PMEE,   1,
                PWBE,   1,
                RNGE,   1,
                BTWE,   1,
                Offset (0xB9),
                LCBV,   8,
                DGDF,   8,
                WLAN,   1,
                BLUE,   1,
                WEXT,   1,
                BEXT,   1,
                KILL,   1,
                WLOK,   1,
                EN3G,   1,
                EX3G,   1,
                KPID,   8,
                CTYP,   3,
                CORE,   3,
                GATY,   2,
                BA1P,   1,
                BA2P,   1,
                    ,   2,
                B1CH,   1,
                B2CH,   1,
                Offset (0xBF),
                PBY1,   1,
                PBY2,   1,
                    ,   2,
                SMB1,   1,
                SMB2,   1,
                Offset (0xC0),
                B1TY,   1,
                B1MD,   1,
                B1LW,   1,
                    ,   1,
                B1MF,   3,
                Offset (0xC1),
                B1ST,   8,
                B1RC,   16,
                B1SN,   16,
                B1FV,   16,
                B1DV,   16,
                B1DC,   16,
                B1FC,   16,
                B1GS,   8,
                Offset (0xD0),
                B1CR,   16,
                B1AC,   16,
                B1PC,   8,
                B1VL,   8,
                B1TM,   8,
                B1AT,   8,
                B1CC,   16,
                B1TC,   8,
                B1CI,   8,
                B1CU,   8,
                B1CA,   8,
                B1SM,   16,
                B1VC,   8,
                B1FA,   8,
                B1VA,   8,
                B1C1,   16,
                B1C2,   16,
                B1C3,   16,
                B1C4,   16,
                Offset (0xEC),
                MAXE,   16,
                B1CT,   16,
                B1EX,   1,
                B1FL,   1,
                B1EP,   1,
                B1FI,   1,
                    ,   2,
                B1RE,   1,
                Offset (0xF1),
                B1LL,   1,
                B1CE,   1,
                B1SE,   1,
                B1S5,   1,
                B1SR,   1,
                B1SC,   1,
                Offset (0xF2),
                B1TO,   1,
                B1BC,   1,
                B1CF,   1,
                B1CS,   1,
                B1SG,   1,
                B1SU,   1,
                B1OV,   1,
                B1OT,   1,
                B1TT,   1,
                B1SA,   1,
                B1SS,   1,
                    ,   1,
                B1SF,   1,
                B1WN,   1,
                Offset (0xF4),
                B1DA,   16,
                Offset (0xF8),
                B1CN,   8,
                Offset (0xFB),
                Offset (0xFE),
                FA2S,   8
            }

            OperationRegion (ECMS, SystemIO, 0x72, 0x02)
            Field (ECMS, ByteAcc, Lock, Preserve)
            {
                INDX,   8,
                DATA,   8
            }

            Method (RECM, 1, Serialized)
            [...]

            Method (WECM, 2, Serialized)
            [...]

            OperationRegion (CMDE, SystemIO, 0x62, 0x0B)
            Field (CMDE, ByteAcc, Lock, Preserve)
            {
                EC62,   8,
                Offset (0x02),
                Offset (0x03),
                Offset (0x04),
                EC66,   8,
                Offset (0x06),
                EC68,   8,
                Offset (0x08),
                Offset (0x09),
                Offset (0x0A),
                EC6C,   8
            }

No other EC device exists in DSDT, so I guess ECEnabler.kext may not be needed after all... Thanks for your time.