Fix Toshiba battery issue for Linux

Its been a year since I made my last post and have been thinking about what I could write  to start posting again. I have finally found a perfect one. Yepieeee, Its about vexing Toshiba battery conflict with the kernel.  I have got my battery issue fixed after a long wait. First of all let me thank Steve who proposed the perfect resolution for this issue and many thanks to other people who were also part of this seeking for a resolution.

Here was the scenario.

Laptop Made : Toshiba L650 X5310

OS : Ubuntu, Centos, BackTrack Linux

Issue : None of them detects and show my battery status.

I have tried different versions of Ubutnu, distros, Kernels and none of them helped and hence raised a bug report at https://bugs.launchpad.net/ubuntu/+source/linux/+bug/703302

Surprisingly the thread got replies/responses from many people who were having the same issue and none had a clue about the fix. But reply no:16 by George Moutsopoulos helped me to find the solution.

Old Results :

[bash]efheem@tuxjockey:~$ cat /proc/acpi/battery/BAT1/*
present:                 no
present:                 no
present:                 no
efheem@tuxjockey:~$ dmesg | grep batt
[    1.370268] ACPI: Battery Slot [BAT1] (battery absent)[/bash]

The cause of issue is because Toshiba included two sets of boot data that tell the OS what hardware exists in the machine. Windows reads the correct one whereas Linux doesn’t. We will need to build our own kernel to make this happen. We will need to extract the DSDT (Differentiated System Description Table) from the machine, the ASL modified, and a new AML DSDT can be compiled. The sections below show the way to tell Linux to use this modified DSDT instead of the version that came with the BIOS.

Get the original DSDL of machine:

[bash]# cat /sys/firmware/acpi/tables/DSDT > DSDT.dat[/bash]

Disassemble it

[bash]# iasl -d DSDT.dat[/bash]

Make the changes:

[bash]# vi DSDT.dsl[/bash]

search for line : OperationRegion (EMEM, SystemMemory, 0×FF808001, 0×FF)
and replace it with : OperationRegion (EMEM, EmbeddedControl, 0×00, 0×FF)
save the file.

Build it:

[bash]# iasl -tc DSDT.dsl[/bash]

This will create a file DSDT.hex (This file is used for kernel recompilation)

I received the below two errors during this compilation

N:B :- You can actually ignore these errors, this works even having these error unfixed. But if interested you can work out to get those fixed.  Else directly goto ‘Kernel Recompilation’ section.

———————————-

[bash]DSDT.dsl  2656:                     0×00000000,         // Length
Error    4122 -                              ^ Invalid combination of Length and Min/Max fixed flags

DSDT.dsl  2663:                     0×00000000,         // Length
Error    4122 -                              ^ Invalid combination of Length and Min/Max fixed flags[/bash]

———————————-

Fix : (If you didnt receive any error please skip this part )

open DSDT.dsl file and go to the line where iasl indicated the error. In my case I go to lines 2656 and 2663.

iasl is complaining about the “Length” line “0×00000000″. This is wrong. Look at the “Range Minimum” and “Range Maximum”. Open up your Kcalc or whatever you Gnome people use and change it to Numeral System Mode. Make sure HEX is selected and now we subtract the minimun range from the maximun range and then we add 1. Since the minimum range is 0 (And you can’t subtract 0) I will input  FEAFFFFF and then add 1 which gives me FEB00000  (Don’t get confused, I’m simply omitting “0x”, the calculator doesn’t need this). I change 0×00000000 to 0xFEB00000 by Length. So now it looks like this:

0×00000000,         // Granularity
0×00000000,         // Range Minimum
0xFEAFFFFF,         // Range Maximum
0×00000000,         // Translation Offset
0xFEB00000,         // Length

Line 2663 changed to

0×00000000,    // Granularity
0xFED40000,         // Range Minimum
0xFED44FFF,         // Range Maximum
0×00000000,         // Translation Offset
0×00005000,         // Length

compile again.

Kernel Recompilation :

Install necessary packages:

[bash]apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5 libncurses5-dev[/bash]
[bash]apt-get build-dep –no-install-recommends linux-image-$(uname -r)[/bash]
[bash]mkdir /root/source

cd /root/source

apt-get source linux-image-$(uname -r)[/bash]

NB: My uname -r was 2.6.38.2-generic

[bash]cd linux-2.6.38[/bash]

(replace this with your kernel version)

copy kernel config file from your current kernel:

[bash]cp -vi /boot/config-`uname -r` .config[/bash]

now copy the DSDT.hex file to the include folder inside kernel source

[bash]cp DSDT.hex /root/source/linux-2.6.38/include[/bash]

open .config file we have just copied

[bash]vi /root/source/linux-2.6.38/.config[/bash]

Make the below changes

[bash]CONFIG_STANDALONE=n
CONFIG_ACPI_CUSTOM_DSDT=y
CONFIG_ACPI_CUSTOM_DSDT_FILE="DSDT.hex"[/bash]

save and quit.

My pwd : /root/source/linux-2.6.38

start compiling the Kernel:

[bash]make menuconfig[/bash]

load the .config file, save the menu file and exit.

We are about to start the compile process . A little trick you can do is to set the CONCURRENCY_LEVEL variable to speed up the compile of the kernel. The number should be the number of processors you have plus one. So in my case I have a Intel Core i5 processor so I will add one with the 4 available.

[bash]cat /proc/cpuinfo | grep -i processor
processor    : 0
processor    : 1
processor    : 2
processor    : 3[/bash]

I have got 4 processors, so concurrency will be 4+1

[bash]# export CONCURRENCY_LEVEL=5[/bash]

Start Building :

Here I named my custom kernel as tuxsage, replace it with the one you wish.

[bash]# make-kpkg clean[/bash]
[bash]# fakeroot make-kpkg –initrd –append-to-version=-tuxsage kernel-image kernel-headers[/bash]

(This will take some time)

Once this is completed you will find the built kernel one directory up from your present directory

[bash]# cd /root/source
# dpkg -i linux-image-2.6.38.(This part will be whatever name you gave it).deb
# dpkg -i linux-headers-2.6.38.(This part will be whatever name you gave it).deb[/bash]

Make initramfs:

[bash]# update-initramfs -c -k 2.6.38+tuxsage (replace tuxsage with correct name)[/bash]

Update Grub :

[bash]#update-grub[/bash]

Reboot to the New Kernel :)

UPDATE : If you are using latest Ubuntu (11.10) with kernel 3.0.0-12-generic then you can get my custom compiled kernel with battery fix downloaded directly from http://www.4shared.com/file/O8CRV1qo/Toshiba-kernel-304-tuxsagetar.html which you can install and use. Have a look at ReadMe.txt for install instructions.

N:B : This post was made very soon after I got this fixed and you may find typos and other errors. Will proofread and fix those soon if any :-)

References :

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/703302

https://bugzilla.kernel.org/show_bug.cgi?id=34532
https://bugzilla.kernel.org/show_bug.cgi?id=15707

http://homeport.org/~bcordes/satellite-l500-install.html

http://www.insanelymac.com/forum/lofiversion/index.php/t189272-100.html

http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems

http://www.lesswatts.org/projects/acpi/overridingDSDT.php

http://www.question-defense.com/2010/09/26/how-to-recompile-your-ubuntu-10-10-kernel-for-patching-or-to-add-support-for-a-specific-device

123 thoughts on “Fix Toshiba battery issue for Linux

  1. I used your custom kernel for 11.10 and it fixed the battery issue, so thank you for that. However, now my screen turns black on my laptop whenever I log in to my account. I can use an external monitor which is how I’m typing this right now, and the guest user screen doesn’t turn black. Please help.

    1. So it does work when I plug in an external monitor, and then remove the monitor my laptop display works. However, if I turn it off and on again, the same issue happens. Does anyone know why?

      1. Ah, it sound’s like an issues that started up after this upgrade to 10.10 that I was having..

        Try adding ‘nomodeset’ in your grub boot loading line and see if it let’s you view things over your display. After that, try downloading the drivers for your graphics card. (If it’s an ati/amd card, just download the latest linux drivers from the site.) This really should fix the problem. :)

        PS: Thank you so much for this battery solution! I’ve been going crazy trying to get it working on my laptop…

    1. Eric, I’m following your recomendation of using grub instead of recompiling kernel. The custom downloadable kernel does work, but it kills the 3d nvidia acceleration with the propietary drivers. My question is: in Patching DSDT post the man mention a DSDT.aml to add in grub… but the files after extracting, disassemby and reasembli are .dat .hex and .dsl.
      ¿How exactly do you use your custom DSDT in grub? I am missing the step that trasform to .aml
      Thanks

      1. @rod this answer is a lot late, but here it is :) . The “.aml” file is generated when you execute iasl -tc DSDT.dsl.

        Thanks to @Faheem for the post and thanks to @jose for the link with instructions to avoid recompiling the kernel.

        Also, this may help others:

        If you are getting:

        $ iasl -tc DSDT.dsl
        Non-ascii input file – DSDT.dsl

        errors, that could be caused because you are doing copy and paste from the website, instead of this, type all the text in your editor.

    2. When I patched DSDT and used custom dsdt.aml file, the Ubuntu recognizes battery but the Suspend mode is disabled. Also, I have a dual boot system with Windows. When I try to boot Windows it says “BIOS acpi compliance error” and won’t load. If I don’t use the custom dsdt.aml, the problem with Suspend mode in Ubuntu and Windows boot is resolved but I won’t have battery recognition in Ubuntu. Please share any ideas ?

  2. perhaps making a video could greatly assist. I haven’t much history of programming (did some Pascal at school) but I do have a suggestion/ idea. you said that windows reads the correct file, right? can’t then the code that generates battery status for windows be isolated and run on Linux? or even have Windows installed on a very, very small partition of the disk, and run the code to generate battery status form that partition with a Linux app? it is extremely annoying to not know one’s battery status.. many thanks.

  3. Fix for SATELLITE L750-1p9

    Replace BATTERY original _STA method with this patch:

    Method (_STA, 0, NotSerialized)
    {
    If (BTIN)
    {
    Return (0x1F)
    }
    Else
    {

    If (ECON)
    {
    Store (^^PCI0.LPCB.EC0.MBTS, Local0)
    If (LEqual (Local0, One))
    {
    Store (One, BTCH)
    Store (Zero, BIFI)
    Store (One, BTIN)
    Return (0x1F)
    }
    }

    Return (0x0f)
    }
    }

  4. Thanks Jose, that solved my problem. Your method is the preferred way so that future kernel updates will not affect DSDT settings/bettery. Thanks a lot

  5. Thanks, this help to me, but now I have an error, and showme this:

    …..
    FATAL: Could not load /lib/modules/3.0.0+tuxsage/modules.dep: No such file or directory
    FATAL: Could not load /lib/modules/3.0.0+tuxsage/modules.dep: No such file or directory
    FATAL: Could not load /lib/modules/3.0.0+tuxsage/modules.dep: No such file or directory
    FATAL: Could not load /lib/modules/3.0.0+tuxsage/modules.dep: No such file or directory
    FATAL: Could not load /lib/modules/3.0.0+tuxsage/modules.dep: No such file or directory
    FATAL: Could not load /lib/modules/3.0.0+tuxsage/modules.dep: No such file or directory
    FATAL: Could not load /lib/modules/3.0.0+tuxsage/modules.dep: No such file or directory
    ….. Every time.

      1. i can’t do this :
        # dpkg -i linux-image-2.6.38.(This part will be whatever name you gave it).deb
        update-initramfs -c -k 2.6.38+tuxsage (replace tuxsage with correct name)

        how i know what name i gave ?

  6. someone with this problem?

    LD drivers/built-in.o
    ld: final link failed: No space left on device
    make[2]: *** [drivers/built-in.o] Error 1
    make[1]: *** [drivers] Error 2
    make[1]: se sale del directorio «/root/source/linux-2.6.38»
    make: *** [debian/stamp/build/kernel] Error 2

    12 hours of work and i could not compile =S

  7. > search for line : OperationRegion (EMEM, SystemMemory, 0xFF808001, 0xFF)
    > and replace it with : OperationRegion (EMEM, EmbeddedControl, 0×00, 0xFF)

    Careful! The replacement text has a typo: 0×00 (with a multiply character, “×”) rather than 0×00 (with an “x”).

  8. Hey, I’ve gotten to the point were I’m supposed to change the OperationRegion (EMEM, SystemMemory, 0×FF808001, 0×FF) , Backspace obviously doesnt work. but i can use the delete key, however I cannot input any new text? help please :(

    1. Ah, you seem to be having issues using the VI editor. It would be very wise to google some good vi guides, as it’s a wonderfully powerful editor, but for now, I would suggest using “nano DSDT.dsl” instead of “vi DSDT.dsl”. You can also edit it with a graphical editor like “gedit DSDT.dsl” or “leafpad DSDT.dsl”. :)

  9. DSDT.dsl 4616: Method (_DSM, 4, NotSerialized)
    Warning 1088 – ^ Not all control paths return a value (_DSM)

    DSDT.dsl 4616: Method (_DSM, 4, NotSerialized)
    Warning 1081 – ^ Reserved method must return a value (Integer/String/Buffer/Package/Reference required for _DSM)

    how to fix this warning?

  10. i have the same proble with toshiba L650.
    bios 2.60
    ubuntu 12.04
    followed the above soln,but got struck at
    mkdir /root/source
    permission denied
    sudo mkdir /root/source
    “file exists”.
    pls help

  11. Could anyone post a custom kernel for ubuntu 12.04?. I fixed it in 11.10 this way but now i have 12.04 and again am in the same situation. I tried the steps and can not get it to work.
    Thanks

  12. I HAVE A PROBLEM please help me

    -e ‘s/=SA//g’ \
    -e ‘s/=I//g’ \
    -e ‘s/=CV/2.6/g’ \
    -e ‘s/=M/Unknown Kernel Package Maintainer /g’ \
    -e ‘s/=ST/linux/g’ -e ‘s/=B/i386/g’ \
    /usr/share/kernel-package/Control > debian/control
    sed -e ‘s/=V/2.6.24.6-ardi/g’ -e ‘s/=D/2.6.24.6-ardi-10.00.Custom/g’ \
    -e ‘s/=A/i386/g’ -e ‘s/=M/Unknown Kernel Package Maintainer /g’ \
    -e ‘s/=ST/linux/g’ -e ‘s/=B/i386/g’ \
    /usr/share/kernel-package/changelog > debian/changelog
    chmod 0644 debian/control debian/changelog
    make -f debian/rules debian/stamp/conf/kernel-conf
    make[2]: Entering directory `/source/linux-2.6.24′
    make[2]: `debian/stamp/conf/kernel-conf’ is up to date.
    make[2]: Leaving directory `/source/linux-2.6.24′
    make[1]: Leaving directory `/source/linux-2.6.24′
    echo done > debian/stamp/conf/minimal_debian
    exec debian/rules APPEND_TO_VERSION=-ardi INITRD=YES kernel-image kernel-headers
    ====== making target debian/stamp/conf/vars [new prereqs: ]======

    ====== making target debian/stamp/build/kernel [new prereqs: vars]======
    This is kernel package version 12.036+nmu2.
    restore_upstream_debianization
    test ! -f scripts/package/builddeb.kpkg-dist || mv -f scripts/package/builddeb.kpkg-dist scripts/package/builddeb
    test ! -f scripts/package/Makefile.kpkg-dist || mv -f scripts/package/Makefile.kpkg-dist scripts/package/Makefile
    /usr/bin/make -j5 EXTRAVERSION=.6-ardi ARCH=i386 \
    bzImage
    make[1]: Entering directory `/source/linux-2.6.24′
    CHK include/linux/version.h
    CHK include/linux/utsrelease.h
    CALL scripts/checksyscalls.sh
    CHK include/linux/compile.h
    SYSCALL arch/x86/kernel/vsyscall-int80_32.so
    gcc: error: elf_i386: No such file or directory
    make[2]: *** [arch/x86/kernel/vsyscall-int80_32.so] Error 1
    make[1]: *** [arch/x86/kernel] Error 2
    make[1]: *** Waiting for unfinished jobs….
    make[1]: *** wait: No child processes. Stop.
    make: *** [debian/stamp/build/kernel] Error 2

  13. Hey,
    Thanks a lot for your post. It worked great on 11.04 and 11.10.
    Will your kernel work on ubuntu 12.04 as well? Do you have a updated version ?

  14. i can’t do this :
    # dpkg -i linux-image-2.6.38.(This part will be whatever name you gave it).deb
    update-initramfs -c -k 2.6.38+tuxsage (replace tuxsage with correct name)

    how i know what name i gave ?

  15. i can’t do this :
    # dpkg -i linux-image-2.6.38.(This part will be whatever name you gave it).deb
    update-initramfs -c -k 2.6.38+tuxsage (replace tuxsage with correct name)

    how i know what name i gave ??

  16. line not found
    OperationRegion (EMEM, SystemMemory, 0×FF808001, 0×FF)

    here’s DSDT.dsl

    /*
    * Intel ACPI Component Architecture
    * AML Disassembler version 20100528
    *
    * Disassembly of DSDT.dat, Fri Oct 26 10:32:22 2012
    *
    *
    * Original Table Header:
    * Signature “DSDT”
    * Length 0x0000AE80 (44672)
    * Revision 0×02
    * Checksum 0xE6
    * OEM ID “TOSINV”
    * OEM Table ID “TOSINV00″
    * OEM Revision 0×00000001 (1)
    * Compiler ID “MSFT”
    * Compiler Version 0×01000013 (16777235)
    */
    DefinitionBlock (“DSDT.aml”, “DSDT”, 2, “TOSINV”, “TOSINV00″, 0×00000001)
    {
    External (TNOT, MethodObj) // 0 Arguments
    External (PDC7)
    External (PDC6)
    External (PDC5)
    External (PDC4)
    External (PDC3)
    External (PDC2)
    External (PDC1)
    External (PDC0)
    External (CFGD)
    External (HNOT, MethodObj) // 1 Arguments
    External (IDAB)
    External (HDOS, MethodObj) // 0 Arguments
    External (ECST, MethodObj) // 1 Arguments
    External (\_SB_.PCI0.IEIT.EITV, MethodObj) // 0 Arguments
    External (\_SB_.PCI0.AHCI.RID1, IntObj)
    External (\_SB_.PCI0.AHCI.DID2, IntObj)
    External (\_SB_.PCI0.AHCI.DID1, IntObj)
    External (\_SB_.PCI0.SAT2.RID1, IntObj)
    External (\_SB_.PCI0.SAT2.DID2, IntObj)
    External (\_SB_.PCI0.SAT2.DID1, IntObj)

    Name (SP2O, 0x4E)
    Name (SP1O, 0x2E)
    Name (IO1B, 0×0600)
    Name (IO1L, 0×70)
    Name (IO2B, 0×0600)
    Name (IO2L, 0×20)
    Name (IO3B, 0×0290)
    Name (IO3L, 0×10)
    Name (SP3O, 0x2E)
    Name (IO4B, 0x0A20)
    Name (IO4L, 0×20)
    Name (MCHB, 0xFED10000)
    Name (MCHL, 0×4000)
    Name (EGPB, 0xFED19000)
    Name (EGPL, 0×1000)
    Name (DMIB, 0xFED1B000)
    Name (DMIL, 0×1000)
    Name (IFPB, 0xFED14000)
    Name (IFPL, 0×1000)
    Name (PEBS, 0xF0000000)
    Name (PELN, 0×04000000)
    Name (TTTB, 0xFED20000)
    Name (TTTL, 0×00020000)
    Name (SMBS, 0xEFA0)
    Name (PBLK, 0×0410)
    Name (PMBS, 0×0400)
    Name (PMLN, 0×80)
    Name (LVL2, 0×0414)
    Name (LVL3, 0×0415)
    Name (LVL4, 0×0416)
    Name (SMIP, 0xB2)
    Name (GPBS, 0×0500)
    Name (GPLN, 0×80)
    Name (APCB, 0xFEC00000)
    Name (APCL, 0×1000)
    Name (PM30, 0×0430)
    Name (SRCB, 0xFED1C000)
    Name (SRCL, 0×4000)
    Name (SUSW, 0xFF)
    Name (HPTB, 0xFED00000)
    Name (HPTC, 0xFED1F404)
    Name (ACPH, 0xDE)
    Name (ASSB, Zero)
    Name (AOTB, Zero)
    Name (AAXB, Zero)
    Name (PEHP, Zero)
    Name (SHPC, One)
    Name (PEPM, Zero)
    Name (PEER, Zero)
    Name (PECS, Zero)
    Name (ITKE, Zero)
    Name (FHPP, One)
    Name (DSSP, Zero)
    Name (FMBL, One)
    Name (FDTP, 0×02)
    Name (BRF, One)
    Name (BPH, 0×02)
    Name (BLC, 0×03)
    Name (BRFS, 0×04)
    Name (BPHS, 0×05)
    Name (BLCT, 0×06)
    Name (BRF4, 0×07)
    Name (BEP, 0×08)
    Name (BBF, 0×09)
    Name (BOF, 0x0A)
    Name (BPT, 0x0B)
    Name (SRAF, 0x0C)
    Name (WWP, 0x0D)
    Name (SDOE, 0x0E)
    Name (TRTP, One)
    Name (TRTD, 0×02)
    Name (TRTI, 0×03)
    Name (GCDD, One)
    Name (DSTA, 0x0A)
    Name (DSLO, 0x0C)
    Name (DSLC, 0x0E)
    Name (PITS, 0×10)
    Name (SBCS, 0×12)
    Name (SALS, 0×13)
    Name (LSSS, 0x2A)
    Name (SOOT, 0×35)
    Name (PDBR, 0x4D)
    Name (SMBL, 0×10)
    Name (TCGM, One)
    OperationRegion (GNVS, SystemMemory, 0x777BEE18, 0×00000174)
    Field (GNVS, AnyAcc, Lock, Preserve)
    {
    OSYS, 16,
    SMIF, 8,
    PRM0, 8,
    PRM1, 8,
    SCIF, 8,
    PRM2, 8,
    PRM3, 8,
    LCKF, 8,
    PRM4, 8,
    PRM5, 8,
    P80D, 32,
    LIDS, 8,
    PWRS, 8,
    DBGS, 8,
    THOF, 8,
    ACT1, 8,
    ACTT, 8,
    PSVT, 8,
    TC1V, 8,
    TC2V, 8,
    TSPV, 8,
    CRTT, 8,
    DTSE, 8,
    DTS1, 8,
    DTS2, 8,
    DTSF, 8,
    Offset (0×25),
    REVN, 8,
    Offset (0×28),
    APIC, 8,
    TCNT, 8,
    PCP0, 8,
    PCP1, 8,
    PPCM, 8,
    PPMF, 32,
    Offset (0×32),
    NATP, 8,
    CMAP, 8,
    CMBP, 8,
    LPTP, 8,
    FDCP, 8,
    COMA, 8,
    COMB, 8,
    SMSC, 8,
    W381, 8,
    SMC1, 8,
    IGDS, 8,
    TLST, 8,
    CADL, 8,
    PADL, 8,
    CSTE, 16,
    NSTE, 16,
    SSTE, 16,
    NDID, 8,
    DID1, 32,
    DID2, 32,
    DID3, 32,
    DID4, 32,
    DID5, 32,
    KSV0, 32,
    KSV1, 8,
    Offset (0×67),
    BLCS, 8,
    BRTL, 8,
    ALSE, 8,
    ALAF, 8,
    LLOW, 8,
    LHIH, 8,
    Offset (0x6E),
    EMAE, 8,
    EMAP, 16,
    EMAL, 16,
    Offset (0×74),
    MEFE, 8,
    DSTS, 8,
    Offset (0×78),
    TPMP, 8,
    TPME, 8,
    MORD, 8,
    TCGP, 8,
    PPRP, 32,
    PPRQ, 8,
    LPPR, 8,
    GTF0, 56,
    GTF2, 56,
    IDEM, 8,
    GTF1, 56,
    BID, 8,
    Offset (0xAA),
    ASLB, 32,
    IBTT, 8,
    IPAT, 8,
    ITVF, 8,
    ITVM, 8,
    IPSC, 8,
    IBLC, 8,
    IBIA, 8,
    ISSC, 8,
    I409, 8,
    I509, 8,
    I609, 8,
    I709, 8,
    IPCF, 8,
    IDMS, 8,
    IF1E, 8,
    HVCO, 8,
    NXD1, 32,
    NXD2, 32,
    NXD3, 32,
    NXD4, 32,
    NXD5, 32,
    NXD6, 32,
    NXD7, 32,
    NXD8, 32,
    GSMI, 8,
    PAVP, 8,
    Offset (0xE1),
    OSCC, 8,
    NEXP, 8,
    SDGV, 8,
    SDDV, 8,
    Offset (0xEB),
    DSEN, 8,
    ECON, 8,
    GPIC, 8,
    CTYP, 8,
    L01C, 8,
    VFN0, 8,
    VFN1, 8,
    Offset (0×100),
    NVGA, 32,
    NVHA, 32,
    AMDA, 32,
    DID6, 32,
    DID7, 32,
    DID8, 32,
    EBAS, 32,
    CPSP, 32,
    EECP, 32,
    EVCP, 32,
    XBAS, 32,
    OBS1, 32,
    OBS2, 32,
    OBS3, 32,
    OBS4, 32,
    OBS5, 32,
    OBS6, 32,
    OBS7, 32,
    OBS8, 32,
    Offset (0×157),
    ATMC, 8,
    PTMC, 8,
    ATRA, 8,
    PTRA, 8,
    PNHM, 32,
    TBAB, 32,
    TBAH, 32,
    RTIP, 8,
    TSOD, 8,
    ATPC, 8,
    PTPC, 8,
    PFLV, 8,
    BREV, 8,
    DPBM, 8,
    DPCM, 8,
    DPDM, 8,
    ALFP, 8,
    IMON, 8,
    S3DS, 8,
    PMEE, 8
    }

    OperationRegion (OGNS, SystemMemory, 0x777BDC98, 0×00000228)
    Field (OGNS, AnyAcc, Lock, Preserve)
    {
    ACPS, 8,
    CPUS, 8,
    CPUL, 8,
    ECRO, 8,
    ECRM, 8,
    ECRS, 8,
    ECRD, 8,
    Offset (0×08),
    EGST, 8,
    LCDS, 4,
    CECS, 1,
    CECP, 1,
    HDMI, 1,
    HKMD, 1,
    TSBK, 1,
    SDAT, 1,
    DCIR, 1,
    DBTN, 2,
    HKEM, 1,
    HSEM, 1,
    IECC, 1,
    HSWK, 8,
    LCMD, 8,
    SVCF, 8,
    SWB0, 32,
    SWB1, 32,
    SWB2, 32,
    SWB3, 32,
    SWB4, 32,
    SWB5, 32,
    SWB6, 32,
    SWB7, 32,
    KYB0, 32,
    Offset (0x4E),
    IEC0, 8,
    IEC1, 8,
    IEC2, 8,
    CECC, 8,
    CECE, 32,
    CECI, 16,
    CECZ, 8,
    CECF, 8,
    CEC1, 32,
    CEC2, 32,
    CEC3, 32,
    CEC4, 32,
    CEC5, 32,
    LENA, 8,
    LENB, 8,
    LENC, 8,
    LEND, 8,
    IFNK, 640,
    ICMD, 2560,
    RESL, 32,
    RESV, 16,
    USC1, 32,
    USC2, 32,
    VGAM, 8,
    USBM, 32,
    TPID, 8,
    NODD, 8,
    IHDD, 8,
    TJET, 8,
    CPUM, 8,
    POLI, 8,
    TCCR, 8,
    TEST, 8,
    LCDA, 8,
    PWM0, 8,
    PWM1, 8,
    PWM2, 8,
    PWM3, 8,
    PWM4, 8,
    PWM5, 8,
    PWM6, 8,
    PWM7, 8,
    EJLL, 8,
    EJLR, 8
    }

    Field (OGNS, AnyAcc, Lock, Preserve)
    {
    Offset (0x2E),
    KYBF, 8,
    KYBA, 248
    }

    Field (OGNS, AnyAcc, Lock, Preserve)
    {
    Offset (0x0E),
    SWBF, 256,
    KYBB, 256,
    Offset (0×72),
    F0CM, 8,
    JFNK, 224,
    CYCC, 16,
    BTV1, 32,
    BTV2, 32,
    ILLU, 8
    }

    Name (ECOK, One)
    Name (INIF, Zero)
    Name (CAGA, Package (0x0D)
    {
    Zero
    })
    Name (CAGB, Package (0×12)
    {
    Zero
    })
    Name (CAGC, Package (0x1E)
    {
    Zero
    })
    Name (CAGD, Package (0×13)
    {
    Zero
    })
    Name (FNKC, Buffer (0×50)
    {
    0×00
    })
    Name (RETP, Package (0×06)
    {
    Zero
    })
    Name (USAC, Zero)
    Name (BTCG, One)
    Name (PWBS, Zero)
    Name (ACBS, Zero)
    Name (ACBW, Zero)
    Name (FTBT, Zero)
    Name (PEGL, Zero)
    Mutex (MUTS, 0×00)
    Mutex (MUTE, 0×00)
    OperationRegion (WNBD, SystemMemory, 0xFF800100, 0×0100)
    Field (WNBD, ByteAcc, Lock, Preserve)
    {
    Offset (0×02),
    LRPM, 8,
    HRPM, 8,
    RCPU, 8,
    EVCT, 8,
    Offset (0×08),
    , 4,
    , 1,
    ECSL, 1,
    POFL, 1,
    Offset (0×09),
    WMEC, 8,
    VGAT, 8,
    THRF, 3,
    , 1,
    PR10, 4,
    Offset (0×11),
    BCM1, 40,
    Offset (0×17),
    FKST, 2,
    Offset (0×40),
    EC92, 8,
    EC93, 8,
    EC94, 8,
    EC95, 8,
    EC96, 8,
    EC99, 8,
    EC9A, 8,
    EC9C, 8,
    EC9D, 8,
    EC9E, 8,
    EC9F, 8,
    ECA0, 8,
    ECA2, 8,
    ECA3, 8,
    ECA4, 8,
    ECA5, 8,
    ECA7, 8,
    ECA8, 8,
    ECA9, 8,
    ECAA, 8,
    ECAB, 8,
    ECAC, 8,
    ECAD, 8,
    ECAE, 8,
    ECAF, 8,
    ECB6, 8,
    ECB8, 8,
    ECB9, 8,
    ECBA, 8,
    ECBD, 8,
    ECBE, 8,
    ECBF, 8,
    ECC0, 8,
    ECC1, 8,
    ECC2, 8,
    ECC5, 8,
    ECC6, 8,
    ECC8, 8,
    ECC9, 8,
    ECCA, 8,
    ECCB, 8,
    ECD7, 8,
    ECDB, 8,
    ECDF, 8,
    ECE2, 8,
    ECE3, 8,
    Offset (0x6F),
    HDS0, 16,
    HDS1, 16,
    HDST, 16,
    HDSS, 8,
    BCM2, 64,
    PHC1, 32,
    PHC2, 32,
    BATI, 8,
    PHC3, 32,
    PHC4, 32,
    PWMS, 8,
    B1VT, 16,
    B1CC, 16,
    B1TP, 8,
    MFAN, 16,
    EVTC, 4,
    Offset (0×98),
    ADVT, 8,
    ACCA, 8,
    ACCR, 16,
    CTHI, 8,
    CTLO, 8,
    HSRL, 8,
    BSS1, 8,
    BSS2, 8,
    , 1,
    FBFG, 4,
    FBS3, 1,
    DVLK, 1,
    Offset (0xA2),
    PWRT, 8,
    Offset (0xA6),
    EWRB, 32,
    ERDB, 32,
    Offset (0xB0),
    BCV1, 16,
    BCV2, 32,
    Offset (0xC1),
    COOL, 2,
    Offset (0xC2),
    SCRI, 1,
    Offset (0xC3),
    PNID, 8,
    TCPD, 1,
    Offset (0xFE),
    OVLA, 1
    }

    Method (RDEC, 3, Serialized)
    {
    Acquire (MUTE, 0xFFFF)
    Store (Arg0, ECRO)
    Store (Arg1, ECRM)
    Store (Arg2, ECRS)
    FLNK (0xFF, 0x0E)
    Store (ECRD, Local0)
    Release (MUTE)
    Return (Local0)
    }

    Method (WREC, 4, Serialized)
    {
    Acquire (MUTE, 0xFFFF)
    Store (Arg0, ECRO)
    Store (Arg1, ECRM)
    Store (Arg2, ECRS)
    Store (Arg3, ECRD)
    FLNK (0xFF, 0x0F)
    Release (MUTE)
    }

    Method (FLNK, 2, Serialized)
    {
    If (LEqual (IECC, Zero))
    {
    Add (IEC2, 0×03, IEC2)
    Decrement (IEC1)
    Subtract (IEC0, 0x0B, IEC0)
    Store (One, IECC)
    }

    If (LEqual (Arg0, 0xFF))
    {
    Store (Arg1, SVCF)
    }
    Else
    {
    Store (Arg1, SWB0)
    }

    Store (Arg0, LCMD)
    Store (0xFF, APMD)
    Store (0xE3, APMC)
    Return (And (SWB0, 0xFF))
    }

    Method (TINC, 2, NotSerialized)
    {
    CreateDWordField (Arg1, Arg0, DCMD)
    Return (DCMD)
    }

    Method (TINI, 0, NotSerialized)
    {
    Name (TMPB, Buffer (0×0154)
    {
    0×00
    })
    FLNK (0xFF, Zero)
    CopyObject (ICMD, TMPB)
    Store (Zero, Local2)
    Store (Zero, Local1)
    While (LLess (Local1, LENA))
    {
    Store (TINC (Local2, TMPB), Local0)
    Store (Local0, Index (CAGA, Local1))
    Add (Local2, 0×04, Local2)
    Increment (Local1)
    }

    Store (Zero, Local1)
    While (LLess (Local1, LENB))
    {
    Store (TINC (Local2, TMPB), Local0)
    Store (Local0, Index (CAGB, Local1))
    Add (Local2, 0×04, Local2)
    Increment (Local1)
    }

    Store (Zero, Local1)
    While (LLess (Local1, LENC))
    {
    Store (TINC (Local2, TMPB), Local0)
    Store (Local0, Index (CAGC, Local1))
    Add (Local2, 0×04, Local2)
    Increment (Local1)
    }

    Store (Zero, Local1)
    While (LLess (Local1, LEND))
    {
    Store (TINC (Local2, TMPB), Local0)
    Store (Local0, Index (CAGD, Local1))
    Add (Local2, 0×04, Local2)
    Increment (Local1)
    }

    Store (IFNK, FNKC)
    Store (Zero, ICMD)
    Store (Zero, IFNK)
    If (And (EC94, One))
    {
    If (BTCG)
    {
    Store (One, F0CM)
    FLNK (0xFF, Zero)
    Store (Zero, BTCG)
    }
    }
    }

    Method (PARG, 1, NotSerialized)
    {
    CreateDWordField (Arg0, Zero, LARG)
    Return (LARG)
    }

    Method (CKIF, 0, NotSerialized)
    {
    If (LEqual (INIF, Zero))
    {
    Acquire (MUTS, 0xFFFF)
    Store (0x0F, ILLU)
    TINI ()
    CLRB ()
    Release (MUTS)
    Store (One, INIF)
    }
    }

    Method (CHKB, 0, Serialized)
    {
    Store (0x0F, Local0)
    If (LEqual (And (ECE2, 0xC0), 0xC0))
    {
    Return (Zero)
    }

    If (LOr (LLess (OSYS, 0x07D6), LEqual (OSYS, 0x07D8)))
    {
    Return (Zero)
    }

    Return (Local0)
    }

    Device (_SB.HSB1)
    {
    Name (_HID, EisaId (“PNP0C32″))
    Name (_UID, One)
    Method (_STA, 0, NotSerialized)
    {
    If (LOr (LLess (OSYS, 0x07D6), LEqual (OSYS, 0x07D8)))
    {
    Return (Zero)
    }

    If (LEqual (BLBM, Zero))
    {
    Return (0x0F)
    }
    Else
    {
    If (LEqual (TCPD, One))
    {
    Return (0x0F)
    }
    Else
    {
    Return (Zero)
    }
    }
    }

    Method (GHID, 0, NotSerialized)
    {
    Return (Buffer (One)
    {
    0×01
    })
    }
    }

    Name (RETA, Package (0×06)
    {
    Zero
    })
    Name (HDSP, 0x0F)
    Name (HDSB, Zero)
    Name (SYBZ, Zero)
    Name (HDSD, Zero)
    Name (RFMD, 0xA0)
    Name (VADV, 0xBE)
    Name (VACC, 0×0100)
    Mutex (MUTM, 0×00)
    Name (ECRT, Package (0×08)
    {
    Zero
    })
    Method (CLRB, 0, NotSerialized)
    {
    Store (Zero, Local0)
    While (LLess (Local0, 0×08))
    {
    Store (Zero, Index (ECRT, Local0))
    Increment (Local0)
    }

    Store (Zero, EWRB)
    Store (Zero, ERDB)
    }

    Method (CKPC, 0, NotSerialized)
    {
    If (LEqual (EWRB, Zero))
    {
    Store (Zero, Local0)
    While (LLess (Local0, 0×08))
    {
    Store (DerefOf (Index (ECRT, Local0)), Local1)
    If (LEqual (And (Local1, 0xFF000000), 0xFD000000))
    {
    Store (Add (And (Local1, 0x00FFFFFF), 0xFF000000), Index (ECRT,
    Local0))
    Increment (Local0)
    Store (Add (And (Local1, 0x00FFFFFF), ShiftLeft (Local0, 0×18)
    ), EWRB)
    Break
    }

    Increment (Local0)
    }
    }
    }

    Method (CKSM, 0, NotSerialized)
    {
    If (LNotEqual (ERDB, Zero))
    {
    Store (And (ShiftRight (ERDB, 0×18), 0xFF), Local0)
    If (LLessEqual (Local0, 0×08))
    {
    Store (Local0, Local1)
    Decrement (Local0)
    Store (Add (And (ERDB, 0x00FFFFFF), 0xFE000000), Index (ECRT,
    Local0))
    If (LEqual (Local1, 0×02))
    {
    Store (Zero, HDSB)
    }
    }

    Store (Zero, ERDB)
    }

    CKPC ()
    }

    Method (RDSM, 1, NotSerialized)
    {
    Acquire (MUTM, 0xFFFF)
    CKSM ()
    Store (Arg0, Local0)
    Decrement (Local0)
    Store (DerefOf (Index (ECRT, Local0)), Local1)
    If (LEqual (And (Local1, 0xFF000000), 0xFE000000))
    {
    Store (Zero, Index (ECRT, Local0))
    }

    Release (MUTM)
    Return (Local1)
    }

    Method (WRSM, 4, NotSerialized)
    {
    If (LOr (LOr (LEqual (Arg0, 0×94), LEqual (Arg0, 0×91)), LEqual (
    Arg0, 0×92)))
    {
    RDSM (Arg1)
    }

    Acquire (MUTM, 0xFFFF)
    Add (Arg0, Add (ShiftLeft (Arg1, 0×18), Add (ShiftLeft (Arg3,
    0×10), ShiftLeft (Arg2, 0×08))), Local3)
    Store (One, Local2)
    Store (Zero, Local1)
    CKSM ()
    Store (And (ShiftRight (Local3, 0×18), 0xFF), Local0)
    Decrement (Local0)
    If (LOr (LOr (LEqual (Arg0, 0×94), LEqual (Arg0, 0×91)), LEqual (
    Arg0, 0×92)))
    {
    Store (Zero, Index (ECRT, Local0))
    }
    Else
    {
    Store (DerefOf (Index (ECRT, Local0)), Local1)
    }

    If (LEqual (Local1, Zero))
    {
    If (LEqual (EWRB, Zero))
    {
    Store (0xFF000000, Index (ECRT, Local0))
    Store (Local3, EWRB)
    }
    Else
    {
    Store (Add (And (Local3, 0x00FFFFFF), 0xFD000000), Index (ECRT,
    Local0))
    }

    Store (Zero, Local2)
    }
    Else
    {
    If (LEqual (And (Local1, 0xFF000000), 0xFE000000))
    {
    Store (0×02, Local2)
    }
    }

    Release (MUTM)
    Return (Local2)
    }

    Method (H3DC, 0, NotSerialized)
    {
    If (LEqual (BLBM, Zero))
    {
    Store (Zero, HDSP)
    }
    Else
    {
    If (LEqual (HDSP, 0x0F))
    {
    Store (RDEC (0xD5, 0×02, One), HDSP)
    }
    }

    Return (HDSP)
    }

    Method (GRPA, 6, Serialized)
    {
    Store (DerefOf (Index (CAGD, Zero)), Local7)
    Store (DerefOf (Index (CAGD, 0×04)), Local6)
    Store (DerefOf (Index (CAGD, 0×05)), Local5)
    Store (DerefOf (Index (CAGD, 0x0D)), Local4)
    Store (DerefOf (Index (CAGD, 0×03)), Index (RETA, Zero))
    Store (Local7, Index (RETA, One))
    Store (Local7, Index (RETA, 0×02))
    Store (Local7, Index (RETA, 0×03))
    Store (Local7, Index (RETA, 0×04))
    Store (Local7, Index (RETA, 0×05))
    Name (_T_0, Zero)
    Store (Arg0, _T_0)
    If (LEqual (_T_0, Zero))
    {
    If (BCMF)
    {
    Store (And (0xFF, \_SB.PCI0.GFX0.CBLV), Local2)
    Store (SizeOf (DerefOf (Index (PANL, PNID))), Local0)
    While (Local0)
    {
    Decrement (Local0)
    Store (DerefOf (Index (DerefOf (Index (PANL, PNID)), Local0)),
    Local1)
    If (LEqual (Local2, Local1))
    {
    Break
    }
    }

    Subtract (Local0, 0×02, Local0)
    Store (Local0, ECA3)
    }

    Store (ShiftLeft (ECA3, 0x0D), Index (RETA, 0×02))
    Store (0xE000, Index (RETA, 0×03))
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (_T_0, One))
    {
    If (LEqual (Arg2, One))
    {
    Store (0x0A, RFMD)
    WRSM (0×94, One, 0×08, Zero)
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg2, 0×10))
    {
    Store (0xA0, RFMD)
    WRSM (0×94, One, 0×08, One)
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0×02))
    {
    If (LEqual (Arg2, Zero))
    {
    Store (DerefOf (Index (CAGD, 0×06)), Index (RETA, 0×03))
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg2, 0xFFFF))
    {
    Store (0×0200, Index (RETA, 0×03))
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0×03))
    {
    If (LEqual (Arg2, Zero))
    {
    And (Arg3, 0xFFFF, Local0)
    ShiftLeft (Add (ShiftRight (Local0, 0×08), And (Local0, 0xFF)
    ), 0×10, Local1)
    Add (Local1, Local0, Local1)
    Acquire (MUTS, 0xFFFF)
    FLNK (Arg1, Local1)
    If (LEqual (SWB0, Zero))
    {
    Store (Local0, Index (CAGD, 0×06))
    Store (Local7, Index (RETA, Zero))
    }

    Release (MUTS)
    }
    }
    Else
    {
    If (LEqual (_T_0, 0×04))
    {
    If (LOr (LEqual (Arg2, One), LEqual (Arg2, 0×02)))
    {
    If (LEqual (Arg5, Zero))
    {
    If (LEqual (SYBZ, Zero))
    {
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (Local6, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg5, One))
    {
    If (LEqual (SYBZ, 0×03))
    {
    Store (Local5, Index (RETA, Zero))
    }
    Else
    {
    Store (Arg2, Local0)
    If (LEqual (Local0, One))
    {
    If (And (EC94, One))
    {
    Store (B1VT, Index (RETA, 0×02))
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (0×02, Local0)
    }
    }

    If (LEqual (Local0, 0×02))
    {
    Store (0xFF, Index (RETA, 0×02))
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0×05))
    {
    If (LEqual (And (Arg2, 0xFFFFFFFE), Zero))
    {
    If (LEqual (Arg5, Zero))
    {
    If (LEqual (SYBZ, Zero))
    {
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (Local6, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg5, One))
    {
    If (LEqual (SYBZ, 0×03))
    {
    Store (Local5, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg3, Zero))
    {
    If (LEqual (Arg2, Zero))
    {
    Add (ShiftLeft (HRPM, 0×08), LRPM, Local1)
    Store (Local1, Index (RETA, 0×02))
    Store (Local7, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg3, One))
    {
    If (LEqual (Arg2, Zero))
    {
    Add (ShiftLeft (HRPM, 0×08), LRPM, Local1)
    Store (Local1, Index (RETA, 0×02))
    Store (MFAN, Index (RETA, 0×03))
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    }
    }
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0×06))
    {
    If (LEqual (H3DC (), One))
    {
    If (LAnd (LEqual (Arg2, Zero), LEqual (And (Arg3, 0xFFFFFDFE),
    Zero)))
    {
    If (LEqual (Arg5, Zero))
    {
    If (LAnd (LNotEqual (SYBZ, 0×03), LEqual (HDSB, Zero)))
    {
    Store (0×02, HDSB)
    Store (Zero, HDSS)
    ShiftRight (And (Arg3, 0×0200), 0×08, Local0)
    Add (Local0, And (Arg3, One), Local0)
    WRSM (0×94, 0×02, 0×57, Local0)
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (Local6, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg5, One))
    {
    If (LEqual (SYBZ, 0×03))
    {
    Store (Local5, Index (RETA, Zero))
    }
    Else
    {
    If (LNotEqual (HDSS, 0xFA))
    {
    Store (Local6, Index (RETA, Zero))
    }
    Else
    {
    Store (Add (ShiftLeft (HDS0, 0×10), HDS1), Index (RETA,
    0×02))
    Store (HDST, Index (RETA, 0×04))
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    }
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0×07))
    {
    If (LAnd (LEqual (Arg2, Zero), LEqual (Arg3, Zero)))
    {
    If (LEqual (Arg5, Zero))
    {
    If (LNotEqual (SYBZ, 0×03))
    {
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (Local6, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg5, One))
    {
    If (LEqual (SYBZ, 0×03))
    {
    Store (Local5, Index (RETA, Zero))
    }
    Else
    {
    If (IGDS)
    {
    Add (ShiftLeft (VGAT, 0×18), Add (ShiftLeft (TCCR, 0×10),
    ShiftLeft (RCPU, 0×08)), Local0)
    }
    Else
    {
    Add (0xFF000000, Add (ShiftLeft (TCCR, 0×10), ShiftLeft (RCPU, 0×08
    )), Local0)
    }

    If (LEqual (And (EC92, 0×08), 0×08))
    {
    If (LNotEqual (ADVT, 0xFF))
    {
    Store (ADVT, Local1)
    Store (Local1, VADV)
    }
    Else
    {
    Store (VADV, Local1)
    }

    Store (Add (Local0, Local1), Index (RETA, 0×02))
    If (LNotEqual (And (ACCR, 0xFF00), 0xFF00))
    {
    Store (ACCR, Local1)
    Store (Local1, VACC)
    }
    Else
    {
    Store (VACC, Local1)
    }

    Store (Local1, Local0)
    Store (Add (ShiftLeft (ACCA, 0×10), Local0), Index (RETA,
    0×03))
    }
    Else
    {
    Store (Add (Local0, 0xFF), Index (RETA, 0×02))
    Store (0xFFFF, Index (RETA, 0×03))
    }

    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0×08))
    {
    If (LEqual (Arg5, Zero))
    {
    Store (One, Local0)
    Add (Local4, One, Local1)
    If (LEqual (Arg4, 0×98))
    {
    If (LAnd (LNotEqual (Arg2, One), LNotEqual (Arg2, 0×02)))
    {
    Store (Zero, Local0)
    }
    }
    Else
    {
    If (LEqual (Arg4, 0xA9))
    {
    If (LAnd (LNotEqual (Arg2, One), LNotEqual (Arg2, 0×02)))
    {
    If (LAnd (LNotEqual (Arg2, Local4), LNotEqual (Arg2, Local1)))
    {
    Store (Zero, Local0)
    }
    }
    }
    Else
    {
    If (LEqual (Arg4, 0x9A))
    {
    If (LNotEqual (And (Arg2, 0xFFFFFFFE), Zero))
    {
    Store (Zero, Local0)
    }
    }
    Else
    {
    If (LEqual (Arg4, 0x9B))
    {
    If (LGreater (Arg2, 0×02))
    {
    Store (Zero, Local0)
    }
    }
    Else
    {
    If (LOr (LEqual (Arg4, 0xA0), LEqual (Arg4, 0x9D)))
    {
    If (LNotEqual (Arg3, Zero))
    {
    Store (Zero, Local0)
    }
    }
    }
    }
    }
    }

    If (Local0)
    {
    If (LEqual (SYBZ, 0×03))
    {
    Store (Local6, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg4, 0xA9))
    {
    If (LOr (LEqual (Arg2, 0×02), LEqual (Arg2, Local1)))
    {
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg2, Local4))
    {
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg2, One))
    {
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    }
    Else
    {
    If (LEqual (SYBZ, Zero))
    {
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (Local6, Index (RETA, Zero))
    }
    }
    }
    }
    }
    Else
    {
    If (LEqual (Arg5, One))
    {
    If (LEqual (SYBZ, 0×03))
    {
    Store (Local5, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg4, 0×98))
    {
    Store (Arg2, Local0)
    If (LEqual (Local0, One))
    {
    If (And (EC94, One))
    {
    Store (B1CC, Index (RETA, 0×02))
    Store (B1TP, Index (RETA, 0×03))
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (0×02, Local0)
    }
    }

    If (LEqual (Local0, 0×02))
    {
    Store (0xFFFF, Index (RETA, 0×02))
    Store (0xFF, Index (RETA, 0×03))
    Store (Local7, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg4, 0x9A))
    {
    If (LEqual (Arg2, Zero))
    {
    Store (PWMS, Index (RETA, 0×02))
    Store (Local7, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg4, 0x9B))
    {
    If (LEqual (Arg2, Zero))
    {
    Store (PHC1, Index (RETA, 0×03))
    Store (PHC2, Index (RETA, 0×02))
    Store (Zero, PHC1)
    Store (Zero, PHC2)
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg2, One))
    {
    Store (BATI, Index (RETA, 0×02))
    Store (Zero, BATI)
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (Arg2, 0×02))
    {
    Store (PHC3, Index (RETA, 0×03))
    Store (PHC4, Index (RETA, 0×02))
    Store (Zero, PHC3)
    Store (Zero, PHC4)
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    }
    Else
    {
    If (LEqual (Arg4, 0x9D))
    {
    If (LEqual (Arg3, Zero))
    {
    Store (HDSD, Index (RETA, 0×02))
    Store (Local7, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg4, 0xA0))
    {
    If (LEqual (Arg3, Zero))
    {
    Store (And (EVTC, 0x0B), Index (RETA, 0×02))
    Store (Local7, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LEqual (Arg4, 0xA9))
    {
    Add (Local4, One, Local1)
    If (LEqual (Arg2, One))
    {
    If (And (EC94, One))
    {
    Add (ECAE, ShiftLeft (ECAF, 0×08), Local2)
    Store (ECAA, Local0)
    Store (ECAB, Local1)
    ShiftLeft (Local1, 0×08, Local1)
    Add (Local0, Local1, Local0)
    Multiply (Local0, Local2, Local0)
    Divide (Local0, 0x03E8, Local1, Local4)
    Divide (Local0, 0×2710, Local1, Local3)
    Store (ECAC, Local0)
    Store (ECAD, Local1)
    ShiftLeft (Local1, 0×08, Local1)
    Add (Local0, Local1, Local0)
    Multiply (Local0, Local2, Local0)
    Divide (Local0, 0×2710, Local1, Local0)
    Add (ShiftLeft (Local0, 0×10), Local3, Local1)
    Store (Local1, Index (RETA, 0×04))
    Store (ECA4, Local0)
    Store (Local4, Local1)
    Multiply (Local1, Local0, Local4)
    Divide (Local4, 0×64, Local1, Local0)
    Add (Local0, One, Local0)
    Divide (Local0, 0x0A, Local1, Local0)
    Add (ShiftLeft (Local0, 0×10), BSS1, Local1)
    Add (Local1, ShiftLeft (BSS2, 0×08), Index (RETA, 0×02))
    Store (ShiftLeft (BCV1, 0×10), Index (RETA, 0×03))
    Store (BCV2, Index (RETA, 0×05))
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (0xFFFF, Index (RETA, 0×02))
    Store (0xFFFF, Index (RETA, 0×03))
    Store (0xFFFF, Index (RETA, 0×04))
    Store (0xFFFF, Index (RETA, 0×05))
    Store (Local7, Index (RETA, Zero))
    }
    }
    Else
    {
    If (LAnd (LEqual (Arg2, Local4), LEqual (And (EC94, One),
    One)))
    {
    Add (ECAE, ShiftLeft (ECAF, 0×08), Local2)
    Store (Local2, Index (RETA, 0×02))
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    If (LOr (LEqual (Arg2, 0×02), LEqual (Arg2, Local1)))
    {
    Store (0xFFFF, Index (RETA, 0×02))
    Store (0xFFFF, Index (RETA, 0×03))
    Store (0xFFFF, Index (RETA, 0×04))
    Store (0xFFFF, Index (RETA, 0×05))
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0×09))
    {
    If (LEqual (Arg3, Zero))
    {
    If (LEqual (And (Arg2, 0xF4), Zero))
    {
    Store (Arg2, EVTC)
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0x0A))
    {
    Store (DerefOf (Index (CAGD, 0×02)), Index (RETA, Zero))
    }
    Else
    {
    If (LEqual (_T_0, 0x0B))
    {
    If (LEqual (Arg3, Zero))
    {
    If (LEqual (H3DC (), One))
    {
    If (LOr (LEqual (Arg2, Zero), LEqual (Arg2, One)))
    {
    Store (Arg2, HDSD)
    Store (Local7, Index (RETA, Zero))
    }
    }
    }
    }
    Else
    {
    If (LEqual (_T_0, 0x0C))
    {
    Store (CTHI, Index (RETA, 0×02))
    Store (CTLO, Index (RETA, 0×03))
    Store (Local7, Index (RETA, Zero))
    }
    Else
    {
    Store (DerefOf (Index (CAGD, 0×02)), Index (RETA, Zero))
    }
    }
    }
    }
    }
    }
    }
    }
    }

  17. Anyone got a fix for 12.10?
    Followed everything here, including the custom kernel and still the same problem.
    Laptop runs fine from battery but can’t show me percentage or detect the battery.

  18. I’m new to Ubuntu but am running 12.04 and have the same issue with the battery showing as not present; i’ve followed the instructions from here and http://blog.michael.kuron-germany.de/2011/03/patching-dsdt-in-recent-linux-kernels-without-recompiling/ but i’m stuck at the part:

    search for line : OperationRegion (EMEM, SystemMemory, 0×FF808001, 0×FF)
    and replace it with : OperationRegion (EMEM, EmbeddedControl, 0×00, 0×FF)
    save the file.

    I cannot find this line in the DSDT.dsl file at all so assume this fix doesn’t apply to 12.04?

  19. Hello,
    I’m using CentOS6.4.
    Do you know how to fix the battery on CentOS or redhat?
    Is there anything for reference. Thanks

  20. Hi.

    I have installed ubuntu 13.04. In this I am not able to go to the root folder.
    Even “sudo cd /root” is not working. How to execute the following command

    mkdir /root/source

    cd /root/source

    apt-get source linux-image-$(uname -r)

  21. This is fixed when Ubuntu gets kernel 3.11 because of an upstream merge with the new ACPI stuff and a patch regarding the execution of _REG.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>