Module Name: src
Committed By: jmcneill
Date: Tue Jan 18 18:56:26 UTC 2011
Modified Files:
src/sys/dev/acpi: thinkpad_acpi.c
Log Message:
Use AcpiOsReadPort/AcpiOsWritePort instead of inb/outb so I can get rid of
of the i386 and x86_64 ifdefs.
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/acpi/thinkpad_acpi.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/acpi/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.32 src/sys/dev/acpi/thinkpad_acpi.c:1.33
--- src/sys/dev/acpi/thinkpad_acpi.c:1.32 Fri Dec 31 08:17:54 2010
+++ src/sys/dev/acpi/thinkpad_acpi.c Tue Jan 18 18:56:25 2011
@@ -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 <[email protected]>
@@ -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