From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752081AbcFVHHR (ORCPT ); Wed, 22 Jun 2016 03:07:17 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33477 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbcFVHHN (ORCPT ); Wed, 22 Jun 2016 03:07:13 -0400 Message-ID: <1466579229.3188.14.camel@gmail.com> Subject: 4.7 regression - ACPICA: Hardware: Enhance acpi_hw_validate_register() with access_width/bit_offset awareness From: Mike Galbraith To: Lv Zheng Cc: Bob Moore , "Rafael J. Wysocki" , LKML Date: Wed, 22 Jun 2016 09:07:09 +0200 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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));