public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <syrjala-ORSVBvAovxo@public.gmane.org>
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: RefOf() bug?
Date: Tue, 30 Mar 2004 13:49:33 +0300	[thread overview]
Message-ID: <20040330104933.GA9234@sci.fi> (raw)

My HP OmniBook 6000 has some problems with the battery. The first time the 
battery gets detected (it doesn't matter if I boot with battery 
disconnected or connected) things don't work. Then if I disconnect and 
reconnect the battery things start to work. But the next 
disconnect/reconnect cycle fails again, the next after that succeeds and 
so on.

I've traced the problem to usage of RefOf() operator. Here's a snippet of 
the DSDT:

While (LGreater (Local1, 0x08))
{
  If (LNot (And (UBIF, VTOB (Local1))))
  {
    GBFE (Local2, Local1, RefOf (Local3))
    If (Local3)
    {
      If (LNot (\_SB.PCI0.ISA0.EC0.SMRD (0x0B, 0x16, Local3, RefOf (Local4))))

                                                             ^^^^^^^^^^^^^
      {
        Store (\_SB.PCI0.ISA0.EC0.BCNT, Local5)
        Store (Zero, Local3)
        Store (Zero, ERRC)
        While (LGreater (Local5, Local3))
        {
          GBFE (Local4, Local3, RefOf (Local6))

I've highlighted the offending RefOf(). On the first run of the outer 
while loop SMRD() creates a buffer of size 4 and stores it into Arg3. For 
some reason that size never changes even though SMRD() creates buffers 
with size 5 and 6 on the following runs and when the buffer is supposed 
to be size 6 the following GBFE() tries to access beyond the size 4 limit 
and I get the error:
dsopcode-0526 [528] ds_init_buffer_field  : Field [TIDX] size 40 exceeds Buffer [NULL] size 32 (

The data in the Local4 buffer changes as SMRD copies new stuff to the new 
buffer so it looks like the Store() to Arg3 only copies the buffer 
contents up to the original buffer's size.

Why the battery works on every second reconnect is because the first 
SMRD() call creates a buffer with size 6 on those occasions. I have yet to 
find out why. But that should not matter since it looks like RefOf() is to 
blame here.

I've only glanced at the ACPI spec so I'm not entirely sure my diagnosis 
is correct...

-- 
Ville Syrjälä
syrjala-ORSVBvAovxo@public.gmane.org
http://www.sci.fi/~syrjala/


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click

             reply	other threads:[~2004-03-30 10:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-30 10:49 Ville Syrjälä [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-03-30 10:53 RefOf() bug? Yu, Luming
     [not found] ` <3ACA40606221794F80A5670F0AF15F8401CBB7AA-SRlDPOYGfgogGBtAFL8yw7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-03-30 12:06   ` Ville Syrjälä
2004-03-30 12:14 Yu, Luming
     [not found] ` <3ACA40606221794F80A5670F0AF15F8401CBB7AB-SRlDPOYGfgogGBtAFL8yw7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-03-30 13:21   ` Ville Syrjälä
2004-03-30 14:38 Yu, Luming
2004-03-30 16:49 Moore, Robert
2004-04-01  1:13 Moore, Robert
     [not found] ` <37F890616C995246BE76B3E6B2DBE0552D15A3-sBd4vmA9Se7vCEQmvpVV9VDQ4js95KgL@public.gmane.org>
2004-04-01 12:01   ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040330104933.GA9234@sci.fi \
    --to=syrjala-orsvbvaovxo@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox