mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Song liwei <liwei.song@windriver.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>
Cc: linux-acpi <linux-acpi@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	LiweiSong <liwei.song@windriver.com>
Subject: [PATCH V2] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug
Date: Wed, 26 Jul 2017 22:31:08 -0400	[thread overview]
Message-ID: <1501122668-53948-1-git-send-email-liwei.song@windriver.com> (raw)

From: Liwei Song <liwei.song@windriver.com>

This is a follow up to commit f712c71f7b2b ("ACPI, APEI: Fixup common
access width firmware bug") fix the following firmware bug:

[Firmware Bug]: APEI: Invalid bit width + offset in GAR [0xb2/16/0/1/1]

This is due to an 8-bit access width is specified for a 16-bit register,
Rearrange the condition and add 8-bit width check.

Signed-off-by: Liwei Song <liwei.song@windriver.com>
---
 drivers/acpi/apei/apei-base.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index da370e1..eca3d7a 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -604,12 +604,12 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr,
 	*access_bit_width = 1UL << (access_size_code + 2);
 
 	/* Fixup common BIOS bug */
-	if (bit_width == 32 && bit_offset == 0 && (*paddr & 0x03) == 0 &&
-	    *access_bit_width < 32)
-		*access_bit_width = 32;
-	else if (bit_width == 64 && bit_offset == 0 && (*paddr & 0x07) == 0 &&
-	    *access_bit_width < 64)
-		*access_bit_width = 64;
+	if (*access_bit_width < bit_width && bit_offset == 0) {
+		if ((bit_width == 16 && (*paddr & 0x01) == 0) ||
+		    (bit_width == 32 && (*paddr & 0x03) == 0) ||
+		    (bit_width == 64 && (*paddr & 0x07) == 0))
+			*access_bit_width = bit_width;
+	}
 
 	if ((bit_width + bit_offset) > *access_bit_width) {
 		pr_warning(FW_BUG APEI_PFX
-- 
2.7.4

             reply	other threads:[~2017-07-27  2:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27  2:31 Song liwei [this message]
2017-07-31  2:09 ` Zheng, Lv
2017-08-01  2:05   ` Liwei Song

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=1501122668-53948-1-git-send-email-liwei.song@windriver.com \
    --to=liwei.song@windriver.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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

all inboxes | Powered by JetHome®