Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Simplify by moving the debug printfs to one pla...
details: https://anonhg.NetBSD.org/src/rev/10f7ea9e2e5c
branches: trunk
changeset: 762799:10f7ea9e2e5c
user: jruoho <jruoho%NetBSD.org@localhost>
date: Tue Mar 01 05:32:03 2011 +0000
description:
Simplify by moving the debug printfs to one place. No functional change.
diffstat:
sys/dev/acpi/acpi_cpu.c | 80 ++++++++++++++++++++++++++++++++++++++++-
sys/dev/acpi/acpi_cpu_cstate.c | 50 +-------------------------
sys/dev/acpi/acpi_cpu_pstate.c | 35 +-----------------
sys/dev/acpi/acpi_cpu_tstate.c | 35 +-----------------
4 files changed, 84 insertions(+), 116 deletions(-)
diffs (truncated from 327 to 300 lines):
diff -r 9c0a309f25a1 -r 10f7ea9e2e5c sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c Tue Mar 01 05:02:16 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.c Tue Mar 01 05:32:03 2011 +0000
@@ -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 <jruohonen%iki.fi@localhost>
@@ -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)
{
diff -r 9c0a309f25a1 -r 10f7ea9e2e5c sys/dev/acpi/acpi_cpu_cstate.c
--- a/sys/dev/acpi/acpi_cpu_cstate.c Tue Mar 01 05:02:16 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu_cstate.c Tue Mar 01 05:32:03 2011 +0000
@@ -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 <jruohonen%iki.fi@localhost>
@@ -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
diff -r 9c0a309f25a1 -r 10f7ea9e2e5c sys/dev/acpi/acpi_cpu_pstate.c
--- a/sys/dev/acpi/acpi_cpu_pstate.c Tue Mar 01 05:02:16 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu_pstate.c Tue Mar 01 05:32:03 2011 +0000
@@ -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 <jruohonen%iki.fi@localhost>
@@ -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;
diff -r 9c0a309f25a1 -r 10f7ea9e2e5c sys/dev/acpi/acpi_cpu_tstate.c
--- a/sys/dev/acpi/acpi_cpu_tstate.c Tue Mar 01 05:02:16 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu_tstate.c Tue Mar 01 05:32:03 2011 +0000
@@ -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 <jruohonen%iki.fi@localhost>
@@ -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)
-{
Home |
Main Index |
Thread Index |
Old Index