Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Use AcpiOsReadPort/AcpiOsWritePort instead of i...
details: https://anonhg.NetBSD.org/src/rev/2581a6463c3b
branches: trunk
changeset: 761007:2581a6463c3b
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Jan 18 18:56:25 2011 +0000
description:
Use AcpiOsReadPort/AcpiOsWritePort instead of inb/outb so I can get rid of
of the i386 and x86_64 ifdefs.
diffstat:
sys/dev/acpi/thinkpad_acpi.c | 25 ++++++++-----------------
1 files changed, 8 insertions(+), 17 deletions(-)
diffs (54 lines):
diff -r b3a38db389e5 -r 2581a6463c3b sys/dev/acpi/thinkpad_acpi.c
--- a/sys/dev/acpi/thinkpad_acpi.c Tue Jan 18 17:44:15 2011 +0000
+++ b/sys/dev/acpi/thinkpad_acpi.c Tue Jan 18 18:56:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.32 2010/12/31 08:17:54 jruoho Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.33 2011/01/18 18:56:25 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.32 2010/12/31 08:17:54 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.33 2011/01/18 18:56:25 jmcneill Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -38,10 +38,7 @@
#include <dev/acpi/acpivar.h>
#include <dev/acpi/acpi_ecvar.h>
-#if defined(__i386__) || defined(__amd64__)
#include <dev/isa/isareg.h>
-#include <machine/pio.h>
-#endif
#define _COMPONENT ACPI_RESOURCE_COMPONENT
ACPI_MODULE_NAME ("thinkpad_acpi")
@@ -590,18 +587,12 @@
static uint8_t
thinkpad_brightness_read(thinkpad_softc_t *sc)
{
-#if defined(__i386__) || defined(__amd64__)
- /*
- * We have two ways to get the current brightness -- either via
- * magic RTC registers, or using the EC. Since I don't dare mess
- * with the EC, and Thinkpads are x86-only, this will have to do
- * for now.
- */
- outb(IO_RTC, 0x6c);
- return inb(IO_RTC+1) & 7;
-#else
- return 0;
-#endif
+ uint32_t val = 0;
+
+ AcpiOsWritePort(IO_RTC, 0x6c, 8);
+ AcpiOsReadPort(IO_RTC + 1, &val, 8);
+
+ return val & 7;
}
static void
Home |
Main Index |
Thread Index |
Old Index