Hello :-)

Here are the diff -u. I've used the 5.0-RELEASE sys.tar.gz to compile
the kernel.

dsdt.c : aml_evalexpr now operates with 64-bit unsigned integers as it
should. (quick hack, not throughoutly tested).   

--- dsdt.c.old  2012-03-06 10:28:54.000000000 +0100
+++ dsdt.c      2012-03-06 11:04:15.000000000 +0100
@@ -63,7 +63,7 @@
                            const void *);
 
 u_int64_t              aml_convradix(u_int64_t, int, int);
-int64_t                        aml_evalexpr(int64_t, int64_t, int);
+u_int64_t              aml_evalexpr(u_int64_t, u_int64_t, int);
 int                    aml_lsb(u_int64_t);
 int                    aml_msb(u_int64_t);
 
@@ -1099,10 +1099,10 @@
 }
 
 /* Evaluate Math operands */
-int64_t
-aml_evalexpr(int64_t lhs, int64_t rhs, int opcode)
+u_int64_t
+aml_evalexpr(u_int64_t lhs, u_int64_t rhs, int opcode)
 {
-       int64_t res = 0;
+       u_int64_t res = 0;
 
        switch (opcode) {
                /* Math operations */

--------------------

acpiec.c: in acpiec_getcrs: hack to remove the first backslaches of
sc->ec_id to temporary solve the problem with the configuration of
acpiec. (In my case sc->ec=id is prefixed by two backslashes instead of
one or none and this was causing aml_searchname to return NULL).

--- acpiec.c.old        2012-03-06 10:28:54.000000000 +0100
+++ acpiec.c    2012-03-06 11:06:01.000000000 +0100
@@ -394,6 +394,7 @@
        int64_t                 gpe;
        struct acpi_ecdt        *ecdt = aa->aaa_table;
        extern struct aml_node  aml_root;
+       u_int8_t                *ec_id_temp;
 
        /* Check if this is ECDT initialization */
        if (ecdt) {
@@ -407,7 +408,10 @@
                ec_data = ecdt->ec_data.address;
 
                /* Get devnode from header */
-               sc->sc_devnode = aml_searchname(&aml_root, ecdt->ec_id);
+               ec_id_temp=ecdt->ec_id;
+               while (*ec_id_temp==AMLOP_ROOTCHAR)
+                       ec_id_temp++;
+               sc->sc_devnode = aml_searchname(&aml_root, ec_id_temp);
 
                goto ecdtdone;
        }

--------

Alternatively, a more general way to remove the superfluous backslash is
to make it directly in aml_searchname but that doesn't seem to make any
difference in my case: 

--- dsdt.c.old  2012-03-06 10:28:54.000000000 +0100
+++ dsdt.c      2012-03-06 11:05:01.000000000 +0100
@@ -4085,7 +4085,7 @@
        int   i;
 
        dnprintf(25,"Searchname: %s:%s = ", aml_nodename(root), vname);
-       if (*name == AMLOP_ROOTCHAR) {
+       while (*name == AMLOP_ROOTCHAR) {
                root = &aml_root;
                name++;
        }

To summarize, these fixes have solved the following problems on my EeePC
Asus 1001PX:

  64-bit unsigned integers virtual machine: 
 - hw.sensors.acpitz0.temp0 returns now the correct temperature (or 60B0
if acpiec is not configured) instead of 255B0C! (Ones was considered
smaller than 255) 
 - hw.sensors.acpibat0.amphour3 (remaining capacity) returns 4Ah (the
full capicity) instead of 65Ah! (I think it's because of this operation
in \SB.PCI0.SBRG.EC0.BST2: Divide ffffffffffffff9c 63 =
ffffffffffffffff). 

After fixing the problem with acpiec :
 - temperatures reported by _TMP is now precise.
 - hw.sensors.acpibat0.volt1 returns 12V instead of 65V!
 - hw.sensors.acpibat0.raw0 returns 0 (battery full, correct in my case)
instead of 2 (battery discharging).
 - hw.sensors.acpibat0.raw1 returns 0 instead of 1 (I don't know to waht
this corresponds to). 
 - fan has been activated but I didn't tested that a lot.

Best regards,
Christophe Staiesse.

Le lundi 05 mars 2012 C  20:28 +0000, Alexey E. Suslikov a C)crit :
> Christophe StaC/esse <chastai <at> skynet.be> writes:
> 
> > To solve the problem temporarily I've simply changed the types of the
> > arguments and the return type of aml_evalexpr to u_int64_t. And now,
> 
> Hey.
> 
> Could you provide diff -u so other people can try this out?
> 
> > (SB.PCI0.SBRG.EC0) is prefixed by several backslashes characters (4 was
> > displayed in the log but I think it is 2 in reality), what
> > aml_searchname is not supposed to handle apparently and so returns NULL.
> > Keeping one or none backslash solve the problem temporarily at least.
> 
> Same as above: diff -u please :)
> 
> Alexey

Reply via email to