linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huang Ying <ying.huang@intel.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-kernel@vger.kernel.org, Tony Luck <tony.luck@intel.com>,
	ying.huang@intel.com, linux-acpi@vger.kernel.org
Subject: [PATCH 01/11] ACPI, Add 64bit read/write support to atomicio on i386
Date: Thu,  8 Dec 2011 11:25:40 +0800	[thread overview]
Message-ID: <1323314750-8185-2-git-send-email-ying.huang@intel.com> (raw)
In-Reply-To: <1323314750-8185-1-git-send-email-ying.huang@intel.com>

There is no 64bit read/write support in ACPI atomicio because
readq/writeq is used to implement 64bit read/write, but readq/writeq
is not available on i386.  This patch implement 64bit read/write
support in atomicio via two readl/writel.

Signed-off-by: Huang Ying <ying.huang@intel.com>
---
 drivers/acpi/atomicio.c |   36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -260,6 +260,21 @@ int acpi_post_unmap_gar(struct acpi_gene
 }
 EXPORT_SYMBOL_GPL(acpi_post_unmap_gar);
 
+#ifdef readq
+static inline u64 read64(const volatile void __iomem *addr)
+{
+	return readq(addr);
+}
+#else
+static inline u64 read64(const volatile void __iomem *addr)
+{
+	u64 l, h;
+	l = readl(addr);
+	h = readl(addr+4);
+	return l | (h << 32);
+}
+#endif
+
 /*
  * Can be used in atomic (including NMI) or process context. RCU read
  * lock can only be released after the IO memory area accessing.
@@ -280,11 +295,9 @@ static int acpi_atomic_read_mem(u64 padd
 	case 32:
 		*val = readl(addr);
 		break;
-#ifdef readq
 	case 64:
-		*val = readq(addr);
+		*val = read64(addr);
 		break;
-#endif
 	default:
 		return -EINVAL;
 	}
@@ -293,6 +306,19 @@ static int acpi_atomic_read_mem(u64 padd
 	return 0;
 }
 
+#ifdef writeq
+static inline void write64(u64 val, volatile void __iomem *addr)
+{
+	writeq(val, addr);
+}
+#else
+static inline void write64(u64 val, volatile void __iomem *addr)
+{
+	writel(val, addr);
+	writel(val>>32, addr+4);
+}
+#endif
+
 static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
 {
 	void __iomem *addr;
@@ -309,11 +335,9 @@ static int acpi_atomic_write_mem(u64 pad
 	case 32:
 		writel(val, addr);
 		break;
-#ifdef writeq
 	case 64:
-		writeq(val, addr);
+		write64(val, addr);
 		break;
-#endif
 	default:
 		return -EINVAL;
 	}

  reply	other threads:[~2011-12-08  3:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08  3:25 [PATCH 00/11] ACPI, APEI, Patches for 3.3 Huang Ying
2011-12-08  3:25 ` Huang Ying [this message]
2011-12-08  3:25 ` [PATCH 02/11] ACPI, APEI, GHES: Add PCIe AER recovery support Huang Ying
2011-12-08  3:25 ` [PATCH 03/11] ACPI, APEI, Print resource errors in conventional format Huang Ying
2011-12-08  3:25 ` [PATCH 04/11] ACPI, APEI, Remove table not found message Huang Ying
2011-12-08  3:25 ` [PATCH 05/11] ACPI, APEI, GHES, Distinguish interleaved error report in kernel log Huang Ying
2011-12-08  3:25 ` [PATCH 06/11] ACPI, APEI, Printk queued error record before panic Huang Ying
2011-12-08  3:25 ` [PATCH 07/11] ACPI, Add RAM mapping support to ACPI atomic IO support Huang Ying
2011-12-08  3:25 ` [PATCH 08/11] ACPI, APEI, EINJ, Fix resource conflict on some machine Huang Ying
2011-12-08  3:25 ` [PATCH 09/11] ACPI, APEI, EINJ, Refine the fix of resource conflict Huang Ying
2011-12-08  3:25 ` [PATCH 10/11] ACPI, Record ACPI NVS regions Huang Ying
2011-12-08  3:25 ` [PATCH 11/11] ACPI, APEI, Resolve false conflict between ACPI NVS and APEI Huang Ying

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=1323314750-8185-2-git-send-email-ying.huang@intel.com \
    --to=ying.huang@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@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;
as well as URLs for NNTP newsgroup(s).