Module Name: src
Committed By: jruoho
Date: Tue Mar 1 05:32:03 UTC 2011
Modified Files:
src/sys/dev/acpi: acpi_cpu.c acpi_cpu_cstate.c acpi_cpu_pstate.c
acpi_cpu_tstate.c
Log Message:
Simplify by moving the debug printfs to one place. No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/acpi/acpi_cpu.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/acpi/acpi_cpu_cstate.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/acpi/acpi_cpu_pstate.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_cpu_tstate.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/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.31 src/sys/dev/acpi/acpi_cpu.c:1.32
--- src/sys/dev/acpi/acpi_cpu.c:1.31 Sun Feb 27 18:32:53 2011
+++ src/sys/dev/acpi/acpi_cpu.c Tue Mar 1 05:32:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.31 2011/02/27 18:32:53 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.32 2011/03/01 05:32:03 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.31 2011/02/27 18:32:53 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.32 2011/03/01 05:32:03 jruoho Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -54,6 +54,7 @@
static int acpicpu_once_detach(void);
static void acpicpu_start(device_t);
static void acpicpu_debug_print(device_t);
+static const char *acpicpu_debug_print_method(uint8_t);
static const char *acpicpu_debug_print_dep(uint32_t);
static void acpicpu_sysctl(device_t);
@@ -680,7 +681,61 @@
{
struct acpicpu_softc *sc = device_private(self);
struct cpu_info *ci = sc->sc_ci;
+ struct acpicpu_cstate *cs;
+ struct acpicpu_pstate *ps;
+ struct acpicpu_tstate *ts;
+ static bool once = false;
struct acpicpu_dep *dep;
+ uint32_t i, method;
+
+ if (once != true) {
+
+ for (i = 0; i < __arraycount(sc->sc_cstate); i++) {
+
+ cs = &sc->sc_cstate[i];
+
+ if (cs->cs_method == 0)
+ continue;
+
+ aprint_verbose_dev(sc->sc_dev, "C%d: %3s, "
+ "lat %3u us, pow %5u mW, %s\n", i,
+ acpicpu_debug_print_method(cs->cs_method),
+ cs->cs_latency, cs->cs_power,
+ (cs->cs_flags != 0) ? "bus master check" : "");
+ }
+
+ method = sc->sc_pstate_control.reg_spaceid;
+
+ for (i = 0; i < sc->sc_pstate_count; i++) {
+
+ ps = &sc->sc_pstate[i];
+
+ if (ps->ps_freq == 0)
+ continue;
+
+ aprint_verbose_dev(sc->sc_dev, "P%d: %3s, "
+ "lat %3u us, pow %5u mW, %4u MHz\n", i,
+ acpicpu_debug_print_method(method),
+ ps->ps_latency, ps->ps_power, ps->ps_freq);
+ }
+
+ method = sc->sc_tstate_control.reg_spaceid;
+
+ for (i = 0; i < sc->sc_tstate_count; i++) {
+
+ ts = &sc->sc_tstate[i];
+
+ if (ts->ts_percent == 0)
+ continue;
+
+ aprint_verbose_dev(sc->sc_dev, "T%u: %3s, "
+ "lat %3u us, pow %5u mW, %3u %%\n", i,
+ acpicpu_debug_print_method(method),
+ ts->ts_latency, ts->ts_power, ts->ts_percent);
+ }
+
+ once = true;
+ }
aprint_debug_dev(sc->sc_dev, "id %u, lapic id %u, "
"cap 0x%04x, flags 0x%08x\n", ci->ci_acpiid,
@@ -715,6 +770,27 @@
}
static const char *
+acpicpu_debug_print_method(uint8_t val)
+{
+
+ switch (val) {
+
+ case ACPICPU_C_STATE_HALT:
+ return "HLT";
+
+ case ACPICPU_C_STATE_FFH:
+ case ACPI_ADR_SPACE_FIXED_HARDWARE:
+ return "FFH";
+
+ case ACPICPU_C_STATE_SYSIO: /* ACPI_ADR_SPACE_SYSTEM_IO */
+ return "I/O";
+
+ default:
+ return "???";
+ }
+}
+
+static const char *
acpicpu_debug_print_dep(uint32_t val)
{
Index: src/sys/dev/acpi/acpi_cpu_cstate.c
diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.46 src/sys/dev/acpi/acpi_cpu_cstate.c:1.47
--- src/sys/dev/acpi/acpi_cpu_cstate.c:1.46 Fri Feb 25 19:55:06 2011
+++ src/sys/dev/acpi/acpi_cpu_cstate.c Tue Mar 1 05:32:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.46 2011/02/25 19:55:06 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.47 2011/03/01 05:32:03 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.46 2011/02/25 19:55:06 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.47 2011/03/01 05:32:03 jruoho Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -48,7 +48,6 @@
#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME ("acpi_cpu_cstate")
-static void acpicpu_cstate_attach_print(struct acpicpu_softc *);
static void acpicpu_cstate_attach_evcnt(struct acpicpu_softc *);
static void acpicpu_cstate_detach_evcnt(struct acpicpu_softc *);
static ACPI_STATUS acpicpu_cstate_cst(struct acpicpu_softc *);
@@ -112,51 +111,6 @@
acpicpu_cstate_quirks(sc);
acpicpu_cstate_attach_evcnt(sc);
- acpicpu_cstate_attach_print(sc);
-}
-
-void
-acpicpu_cstate_attach_print(struct acpicpu_softc *sc)
-{
- struct acpicpu_cstate *cs;
- static bool once = false;
- const char *str;
- int i;
-
- if (once != false)
- return;
-
- for (i = 0; i < ACPI_C_STATE_COUNT; i++) {
-
- cs = &sc->sc_cstate[i];
-
- if (cs->cs_method == 0)
- continue;
-
- switch (cs->cs_method) {
-
- case ACPICPU_C_STATE_HALT:
- str = "HLT";
- break;
-
- case ACPICPU_C_STATE_FFH:
- str = "FFH";
- break;
-
- case ACPICPU_C_STATE_SYSIO:
- str = "I/O";
- break;
-
- default:
- panic("NOTREACHED");
- }
-
- aprint_verbose_dev(sc->sc_dev, "C%d: %3s, "
- "lat %3u us, pow %5u mW, flags 0x%02x\n", i, str,
- cs->cs_latency, cs->cs_power, cs->cs_flags);
- }
-
- once = true;
}
static void
Index: src/sys/dev/acpi/acpi_cpu_pstate.c
diff -u src/sys/dev/acpi/acpi_cpu_pstate.c:1.42 src/sys/dev/acpi/acpi_cpu_pstate.c:1.43
--- src/sys/dev/acpi/acpi_cpu_pstate.c:1.42 Tue Mar 1 04:35:48 2011
+++ src/sys/dev/acpi/acpi_cpu_pstate.c Tue Mar 1 05:32:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_pstate.c,v 1.42 2011/03/01 04:35:48 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_pstate.c,v 1.43 2011/03/01 05:32:03 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.42 2011/03/01 04:35:48 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.43 2011/03/01 05:32:03 jruoho Exp $");
#include <sys/param.h>
#include <sys/evcnt.h>
@@ -42,7 +42,6 @@
#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME ("acpi_cpu_pstate")
-static void acpicpu_pstate_attach_print(struct acpicpu_softc *);
static void acpicpu_pstate_attach_evcnt(struct acpicpu_softc *);
static void acpicpu_pstate_detach_evcnt(struct acpicpu_softc *);
static ACPI_STATUS acpicpu_pstate_pss(struct acpicpu_softc *);
@@ -141,7 +140,6 @@
acpicpu_pstate_bios();
acpicpu_pstate_reset(sc);
acpicpu_pstate_attach_evcnt(sc);
- acpicpu_pstate_attach_print(sc);
return;
@@ -162,35 +160,6 @@
}
static void
-acpicpu_pstate_attach_print(struct acpicpu_softc *sc)
-{
- const uint8_t method = sc->sc_pstate_control.reg_spaceid;
- struct acpicpu_pstate *ps;
- static bool once = false;
- const char *str;
- uint32_t i;
-
- if (once != false)
- return;
-
- str = (method != ACPI_ADR_SPACE_SYSTEM_IO) ? "FFH" : "I/O";
-
- for (i = 0; i < sc->sc_pstate_count; i++) {
-
- ps = &sc->sc_pstate[i];
-
- if (ps->ps_freq == 0)
- continue;
-
- aprint_verbose_dev(sc->sc_dev, "P%d: %3s, "
- "lat %3u us, pow %5u mW, %4u MHz\n", i, str,
- ps->ps_latency, ps->ps_power, ps->ps_freq);
- }
-
- once = true;
-}
-
-static void
acpicpu_pstate_attach_evcnt(struct acpicpu_softc *sc)
{
struct acpicpu_pstate *ps;
Index: src/sys/dev/acpi/acpi_cpu_tstate.c
diff -u src/sys/dev/acpi/acpi_cpu_tstate.c:1.24 src/sys/dev/acpi/acpi_cpu_tstate.c:1.25
--- src/sys/dev/acpi/acpi_cpu_tstate.c:1.24 Tue Mar 1 04:35:48 2011
+++ src/sys/dev/acpi/acpi_cpu_tstate.c Tue Mar 1 05:32:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_tstate.c,v 1.24 2011/03/01 04:35:48 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_tstate.c,v 1.25 2011/03/01 05:32:03 jruoho Exp $ */
/*-
* Copyright (c) 2010 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.24 2011/03/01 04:35:48 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.25 2011/03/01 05:32:03 jruoho Exp $");
#include <sys/param.h>
#include <sys/evcnt.h>
@@ -41,7 +41,6 @@
#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME ("acpi_cpu_tstate")
-static void acpicpu_tstate_attach_print(struct acpicpu_softc *);
static void acpicpu_tstate_attach_evcnt(struct acpicpu_softc *);
static void acpicpu_tstate_detach_evcnt(struct acpicpu_softc *);
static ACPI_STATUS acpicpu_tstate_tss(struct acpicpu_softc *);
@@ -123,36 +122,6 @@
acpicpu_tstate_reset(sc);
acpicpu_tstate_attach_evcnt(sc);
- acpicpu_tstate_attach_print(sc);
-}
-
-static void
-acpicpu_tstate_attach_print(struct acpicpu_softc *sc)
-{
- const uint8_t method = sc->sc_tstate_control.reg_spaceid;
- struct acpicpu_tstate *ts;
- static bool once = false;
- const char *str;
- uint32_t i;
-
- if (once != false)
- return;
-
- str = (method != ACPI_ADR_SPACE_FIXED_HARDWARE) ? "I/O" : "FFH";
-
- for (i = 0; i < sc->sc_tstate_count; i++) {
-
- ts = &sc->sc_tstate[i];
-
- if (ts->ts_percent == 0)
- continue;
-
- aprint_verbose_dev(sc->sc_dev, "T%u: %3s, "
- "lat %3u us, pow %5u mW, %3u %%\n", i, str,
- ts->ts_latency, ts->ts_power, ts->ts_percent);
- }
-
- once = true;
}
static void