Linux ACPI
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: linux-acpi@vger.kernel.org
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>,
	Len Brown <len.brown@intel.com>
Subject: [PATCH 01/12] ACPI: EC: Allow multibyte access to EC
Date: Tue, 06 Apr 2010 03:06:12 -0400	[thread overview]
Message-ID: <dadf28a10c3eb29421837a2e413ab869ebd9e168.1270537380.git.len.brown@intel.com> (raw)
In-Reply-To: <1270537583-8756-1-git-send-email-lenb@kernel.org>

From: Alexey Starikovskiy <astarikovskiy@suse.de>

http://bugzilla.kernel.org/show_bug.cgi?id=14667

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/acpi/acpica/exprep.c |   12 ++++++++++++
 drivers/acpi/ec.c            |   35 +++++++++--------------------------
 2 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index edf62bf..a610ebe 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -468,6 +468,18 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
 
 		acpi_ut_add_reference(obj_desc->field.region_obj);
 
+		/* allow full data read from EC address space */
+		if (obj_desc->field.region_obj->region.space_id ==
+			ACPI_ADR_SPACE_EC) {
+			if (obj_desc->common_field.bit_length > 8)
+				obj_desc->common_field.access_bit_width =
+				ACPI_ROUND_UP(obj_desc->common_field.
+							bit_length, 8);
+				obj_desc->common_field.access_byte_width =
+				ACPI_DIV_8(obj_desc->common_field.
+							access_bit_width);
+		}
+
 		ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
 				  "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
 				  obj_desc->field.start_field_bit_offset,
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 1ac28c6..7208a69 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -628,12 +628,12 @@ static u32 acpi_ec_gpe_handler(void *data)
 
 static acpi_status
 acpi_ec_space_handler(u32 function, acpi_physical_address address,
-		      u32 bits, u64 *value,
+		      u32 bits, u64 *value64,
 		      void *handler_context, void *region_context)
 {
 	struct acpi_ec *ec = handler_context;
-	int result = 0, i;
-	u8 temp = 0;
+	int result = 0, i, bytes = bits / 8;
+	u8 *value = (u8 *)value64;
 
 	if ((address > 0xFF) || !value || !handler_context)
 		return AE_BAD_PARAMETER;
@@ -641,32 +641,15 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
 	if (function != ACPI_READ && function != ACPI_WRITE)
 		return AE_BAD_PARAMETER;
 
-	if (bits != 8 && acpi_strict)
-		return AE_BAD_PARAMETER;
-
-	if (EC_FLAGS_MSI)
+	if (EC_FLAGS_MSI || bits > 8)
 		acpi_ec_burst_enable(ec);
 
-	if (function == ACPI_READ) {
-		result = acpi_ec_read(ec, address, &temp);
-		*value = temp;
-	} else {
-		temp = 0xff & (*value);
-		result = acpi_ec_write(ec, address, temp);
-	}
-
-	for (i = 8; unlikely(bits - i > 0); i += 8) {
-		++address;
-		if (function == ACPI_READ) {
-			result = acpi_ec_read(ec, address, &temp);
-			(*value) |= ((u64)temp) << i;
-		} else {
-			temp = 0xff & ((*value) >> i);
-			result = acpi_ec_write(ec, address, temp);
-		}
-	}
+	for (i = 0; i < bytes; ++i, ++address, ++value)
+		result = (function == ACPI_READ) ?
+			acpi_ec_read(ec, address, value) :
+			acpi_ec_write(ec, address, *value);
 
-	if (EC_FLAGS_MSI)
+	if (EC_FLAGS_MSI || bits > 8)
 		acpi_ec_burst_disable(ec);
 
 	switch (result) {
-- 
1.6.0.6


  reply	other threads:[~2010-04-06  7:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06  7:06 ACPI patches for 2.6.34-rc3 Len Brown
2010-04-06  7:06 ` Len Brown [this message]
2010-04-06  7:06   ` [PATCH 02/12] ACPI / PM: Move ACPI video resume to a PM notifier Len Brown
2010-04-06 18:55     ` Rafael J. Wysocki
2010-04-06 21:07       ` Len Brown
2010-04-06  7:06   ` [PATCH 03/12] ACPI dock: support multiple ACPI dock devices Len Brown
2010-04-06  7:06   ` [PATCH 04/12] ACPI: fixes a false alarm from lockdep Len Brown
2010-04-06  7:06   ` [PATCH 05/12] ACPI / ACPICA: Do not check reference counters in acpi_ev_enable_gpe() Len Brown
2010-04-06  7:06   ` [PATCH 06/12] ACPI: use _HID when supplied by root-level devices Len Brown
2010-04-06  7:06   ` [PATCH 07/12] ACPI: NUMA: map pxms to low node ids Len Brown
2010-04-06  7:06   ` [PATCH 08/12] ACPI: Don't send KEY_UNKNOWN for random video notifications Len Brown
2010-04-06  7:06   ` [PATCH 09/12] PNPACPI: truncate _CRS windows with _LEN > _MAX - _MIN + 1 Len Brown
2010-04-06  7:06   ` [PATCH 10/12] ACPI: battery: Fix CONFIG_ACPI_SYSFS_POWER=n Len Brown
2010-04-06  7:06   ` [PATCH 11/12] ACPI: battery drivers should call power_supply_changed() Len Brown
2010-04-06  7:06   ` [PATCH 12/12] ACPI: Reduce ACPI resource conflict message to KERN_WARNING, printk cleanup Len Brown

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=dadf28a10c3eb29421837a2e413ab869ebd9e168.1270537380.git.len.brown@intel.com \
    --to=lenb@kernel.org \
    --cc=astarikovskiy@suse.de \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    /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