public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <umgwanakikbuti@gmail.com>
To: Lv Zheng <lv.zheng@intel.com>
Cc: Bob Moore <robert.moore@intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: 4.7 regression - ACPICA: Hardware: Enhance acpi_hw_validate_register() with access_width/bit_offset awareness
Date: Wed, 22 Jun 2016 09:07:09 +0200	[thread overview]
Message-ID: <1466579229.3188.14.camel@gmail.com> (raw)

In my aging (ok old) HP DL980 G7 ->access_width may be either 0 or
max_bit_width, the later inspiring cpufreq to say go away.  The below
made box a happy camper again.

ACPI Error: Unsupported register access width: 0x40 (20160422/hwregs-165)

Dinged-up-by: my little hammer
---
 drivers/acpi/acpica/hwregs.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -83,7 +83,7 @@ acpi_hw_write_multiple(u32 value,
 static u8
 acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)
 {
-	if (!reg->access_width) {
+	if (!reg->access_width || reg->access_width == max_bit_width) {
 		if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
 			max_bit_width = 32;
 		}
@@ -152,9 +152,16 @@ acpi_hw_validate_register(struct acpi_ge
 		return (AE_SUPPORT);
 	}
 
-	/* Validate the access_width */
+	/* Validate the access_width, or bit_width for old register descriptors */
 
-	if (reg->access_width > 4) {
+	if ((!reg->access_width || reg->access_width == max_bit_width)) {
+		if (reg->bit_width != 8 && reg->bit_width != 16 &&
+		    reg->bit_width != 32 && reg->bit_width != max_bit_width) {
+			ACPI_ERROR((AE_INFO, "Unsupported register bit width: 0x%X",
+				   reg->bit_width));
+			return (AE_SUPPORT);
+		}
+	} else if (reg->access_width > 4) {
 		ACPI_ERROR((AE_INFO,
 			    "Unsupported register access width: 0x%X",
 			    reg->access_width));

             reply	other threads:[~2016-06-22  7:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22  7:07 Mike Galbraith [this message]
2016-06-23  0:32 ` 4.7 regression - ACPICA: Hardware: Enhance acpi_hw_validate_register() with access_width/bit_offset awareness Zheng, Lv
2016-06-23  4:30   ` Mike Galbraith
2016-06-23  6:45 ` [patch] cpufreq/pcc-cpufreq: Fix doorbell.access_width Mike Galbraith
2016-06-23 21:13   ` Rafael J. Wysocki

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=1466579229.3188.14.camel@gmail.com \
    --to=umgwanakikbuti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --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