Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636132

RE: [PATCH] ACPI: SPCR: Use access width to determine mmio usage

From "Zheng, Lv" <lv.zheng@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH] ACPI: SPCR: Use access width to determine mmio usage
Date 2017-05-05 05:10 +0200
Message-ID <tDBMZ-4hE-1@gated-at.bofh.it> (permalink)
References <tDqyd-595-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

> From: Jon Mason [mailto:jon.mason@broadcom.com]
> Sent: Thursday, May 4, 2017 11:06 PM
> Subject: [PATCH] ACPI: SPCR: Use access width to determine mmio usage
> 
> The current SPCR code does not check the access width of the mmio, and
> uses a default of 8bit register accesses.  This prevents devices that
> only do 16 or 32bit register accesses from working.  By simply checking
> this field and setting the mmio string appropriately, this issue can be
> corrected.  To prevent any legacy issues, the code will default to 8bit
> accesses if the value is anything but 16 or 32.
> 
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>
> ---
>  drivers/acpi/spcr.c     | 18 ++++++++++++++++--
>  include/acpi/acrestyp.h |  7 +++++++
>  2 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
> index 01c9466..11233f6 100644
> --- a/drivers/acpi/spcr.c
> +++ b/drivers/acpi/spcr.c
> @@ -74,8 +74,22 @@ int __init parse_spcr(bool earlycon)
>  		goto done;
>  	}
> 
> -	iotype = table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY ?
> -			"mmio" : "io";
> +	if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
> +		switch (table->serial_port.access_width) {
> +		default:
> +			pr_err("Unexpected SPCR Access Width.  Defaulting to byte size\n");
> +		case ACPI_ACCESS_SIZE_BYTE:
> +			iotype = "mmio";
> +			break;
> +		case ACPI_ACCESS_SIZE_WORD:
> +			iotype = "mmio16";
> +			break;
> +		case ACPI_ACCESS_SIZE_DWORD:
> +			iotype = "mmio32";
> +			break;
> +		}
> +	} else
> +		iotype = "io";
> 
>  	switch (table->interface_type) {
>  	case ACPI_DBG2_ARM_SBSA_32BIT:
> diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
> index f0f7403..781cb55 100644
> --- a/include/acpi/acrestyp.h
> +++ b/include/acpi/acrestyp.h
> @@ -372,6 +372,13 @@ struct acpi_resource_generic_register {
>  	u64 address;
>  };
> 
> +/* Generic Address Space Access Sizes */
> +#define ACPI_ACCESS_SIZE_UNDEFINED		0
> +#define ACPI_ACCESS_SIZE_BYTE			1
> +#define ACPI_ACCESS_SIZE_WORD			2
> +#define ACPI_ACCESS_SIZE_DWORD			3
> +#define ACPI_ACCESS_SIZE_QWORD			4
> +
>  struct acpi_resource_gpio {
>  	u8 revision_id;
>  	u8 connection_type;

Please don't define this.
It's possible to calculate 8/16/32/64 from the access width value.
Try:
1 << (access_width + 2)

Thanks
Lv

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ACPI: SPCR: Use access width to determine mmio usage Jon Mason <jon.mason@broadcom.com> - 2017-05-04 17:10 +0200
  RE: [PATCH] ACPI: SPCR: Use access width to determine mmio usage "Moore, Robert" <robert.moore@intel.com> - 2017-05-04 18:30 +0200
    Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Jon Mason <jon.mason@broadcom.com> - 2017-05-04 19:40 +0200
  RE: [PATCH] ACPI: SPCR: Use access width to determine mmio usage "Zheng, Lv" <lv.zheng@intel.com> - 2017-05-05 05:10 +0200
    Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Jon Mason <jon.mason@broadcom.com> - 2017-05-06 00:00 +0200
  Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Jon Masters <jcm@redhat.com> - 2017-05-07 00:50 +0200
    Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Loc Ho <lho@apm.com> - 2017-05-08 21:20 +0200
      Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Loc Ho <lho@apm.com> - 2017-05-08 22:00 +0200
        Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Jon Mason <jon.mason@broadcom.com> - 2017-05-08 22:40 +0200
          Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Loc Ho <lho@apm.com> - 2017-05-08 23:00 +0200
            Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Jon Masters <jcm@redhat.com> - 2017-05-08 23:30 +0200
            Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Jon Mason <jon.mason@broadcom.com> - 2017-05-08 23:30 +0200
              Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Loc Ho <lho@apm.com> - 2017-05-08 23:40 +0200
      Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage Jon Masters <jcm@redhat.com> - 2017-05-08 22:00 +0200

csiph-web