linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Alexey Starikovskiy <astarikovskiy@suse.de>
Cc: "Moore, Robert" <robert.moore@intel.com>,
	Len Brown <lenb@kernel.org>,
	"Linux-acpi@vger.kernel.org" <Linux-acpi@vger.kernel.org>
Subject: Re: [PATCH] ACPICA: Handle large field apertures.
Date: Wed, 26 May 2010 10:49:18 +0800	[thread overview]
Message-ID: <1274842158.28455.18.camel@minggr.sh.intel.com> (raw)
In-Reply-To: <1274841567.28455.16.camel@minggr.sh.intel.com>

On Wed, 2010-05-26 at 10:39 +0800, Lin Ming wrote:
> On Tue, 2010-05-25 at 18:59 +0800, Alexey Starikovskiy wrote:
> > Allow field reads of more than 64 bits if the field is properly aligned.
> > EC driver will be able to read in bursts of up to 32 bytes with this patch.
> 
> Hi, Alexey,
> 
> Got a divide-by-zero fault when running aslts test.
> 
> $cd aslts/src/runtime/collections/functional/region
> $iasl MAIN.asl
> $acpiexec -bex,mn00 region.aml
> ......
> Floating point exception
> 
> It's because in the region test case, ObjDesc->CommonField.BitLength is
> 2048 and ObjDesc->CommonField.AccessByteWidth is UINT8,
> 
> ObjDesc->CommonField.AccessByteWidth =
> 		    ACPI_ROUND_BITS_UP_TO_BYTES(ObjDesc->CommonField.BitLength);
> 
> so this assignment causes ObjDesc->CommonField.AccessByteWidth to zero.
> 
> Although this test case nearly can not exist in real BIOS aml code, but
> how about add below code to do more check?
> 
> diff --git a/source/components/executer/exprep.c b/source/components/executer/exprep.c
> index 95fa502..65cbe39 100644
> --- a/source/components/executer/exprep.c
> +++ b/source/components/executer/exprep.c
> @@ -511,6 +511,7 @@ AcpiExPrepFieldValue (
>      ACPI_OPERAND_OBJECT     *ObjDesc;
>      ACPI_OPERAND_OBJECT     *SecondDesc = NULL;
>      UINT32                  Type;
> +    UINT32                  AccessByteWidth;
>      ACPI_STATUS             Status;
>  
> 
> @@ -568,8 +569,12 @@ AcpiExPrepFieldValue (
>  	/* allow full data read from EC address space */
>  	if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) {
>  	    if (ObjDesc->CommonField.BitLength > 8) {
> -		ObjDesc->CommonField.AccessByteWidth =
> -		    ACPI_ROUND_BITS_UP_TO_BYTES(ObjDesc->CommonField.BitLength);
> +                AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES(ObjDesc->CommonField.BitLength);
> +
> +                /* The max of ObjDesc->CommonField.AccessByteWidth is 0xFF */
> +                if (!(AccessByteWidth >> 8)) {

Better to test AccessByteWidth as below,

+                if (!(AccessByteWidth & ~0xFF)) {


> +		    ObjDesc->CommonField.AccessByteWidth = AccessByteWidth;
> +                }
>  	    }
>  	}
>  
> ---
> Lin Ming



  reply	other threads:[~2010-05-26  2:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4911F71203A09E4D9981D27F9D830858709F2D04@orsmsx503.amr.corp.intel.com>
2010-05-25 10:56 ` [PATCH] ACPICA: Handle large field appertures Alexey Starikovskiy
2010-05-25 10:59 ` [PATCH] ACPICA: Handle large field apertures Alexey Starikovskiy
2010-05-25 16:16   ` Len Brown
2010-05-26  2:39   ` Lin Ming
2010-05-26  2:49     ` Lin Ming [this message]
2010-05-26  7:30       ` Alexey Starikovskiy
2010-05-26  7:31         ` Lin Ming
2010-05-26 17:51           ` Moore, Robert

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=1274842158.28455.18.camel@minggr.sh.intel.com \
    --to=ming.m.lin@intel.com \
    --cc=Linux-acpi@vger.kernel.org \
    --cc=astarikovskiy@suse.de \
    --cc=lenb@kernel.org \
    --cc=robert.moore@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).