summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2006-02-26 17:28:27 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2006-02-26 17:28:27 +0000
commit2eb78e4d230daf6f7b5714419d37d42ce1792671 (patch)
tree8554d30a648186a0bfff56b678907c7ff5c97237 /sys/dev
parente1a7be5fabe61b9d65d83d6f1473df849e8ef137 (diff)
Print _PCT & _PPC.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpicpu.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpicpu.c b/sys/dev/acpi/acpicpu.c
index 525e9394fe7..11f5f6e2401 100644
--- a/sys/dev/acpi/acpicpu.c
+++ b/sys/dev/acpi/acpicpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpicpu.c,v 1.4 2006/02/26 07:59:20 marco Exp $ */
+/* $OpenBSD: acpicpu.c,v 1.5 2006/02/26 17:28:26 marco Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -50,8 +50,11 @@ struct acpicpu_softc {
int sc_pss_len;
struct acpicpu_pss *sc_pss;
+
+ struct acpicpu_pct sc_pct;
};
+int acpicpu_getpct(struct acpicpu_softc *);
int acpicpu_getpss(struct acpicpu_softc *);
struct cfattach acpicpu_ca = {
@@ -112,10 +115,68 @@ acpicpu_attach(struct device *parent, struct device *self, void *aux)
printf("%d%s", sc->sc_pss[i].pss_core_freq,
i < sc->sc_pss_len - 1 ? ", " : " MHz\n");
+ acpicpu_getpct(sc);
+
/* aml_register_notify(sc->sc_devnode->parent, aa->aaa_dev, acpicpu_notify, sc); */
}
int
+acpicpu_getpct(struct acpicpu_softc *sc)
+{
+ struct aml_value res, env;
+ struct acpi_context *ctx;
+
+ memset(&res, 0, sizeof(res));
+ memset(&env, 0, sizeof(env));
+
+ ctx = NULL;
+ if (aml_eval_name(sc->sc_acpi, sc->sc_devnode, "_PPC", &res, &env)) {
+ dnprintf(20, "%s: no _PPC\n", DEVNAME(sc));
+ printf("%s: no _PPC\n", DEVNAME(sc));
+ return (1);
+ }
+
+ dnprintf(10, "_PPC: %d\n", aml_val2int(NULL, &res));
+
+ if (aml_eval_name(sc->sc_acpi, sc->sc_devnode, "_PCT", &res, &env)) {
+ dnprintf(20, "%s: no _PCT\n", DEVNAME(sc));
+ printf("%s: no _PCT\n", DEVNAME(sc));
+ return (1);
+ }
+
+ if (res.length != 2) {
+ printf("%s: %s: invalid _PCT length\n", DEVNAME(sc),
+ sc->sc_devnode->parent->name);
+ return (1);
+ }
+
+ memcpy(&sc->sc_pct.pct_ctrl, res.v_package[0]->v_buffer,
+ sizeof sc->sc_pct.pct_ctrl);
+ memcpy(&sc->sc_pct.pct_status, res.v_package[1]->v_buffer,
+ sizeof sc->sc_pct.pct_status);
+
+ dnprintf(10, "_PCT(ctrl) : %02x %04x %02x %02x %02x %02x %016x\n",
+ sc->sc_pct.pct_ctrl.grd_descriptor,
+ sc->sc_pct.pct_ctrl.grd_length,
+ sc->sc_pct.pct_ctrl.grd_access_type,
+ sc->sc_pct.pct_ctrl.grd_reg_width,
+ sc->sc_pct.pct_ctrl.grd_reg_bit_offset,
+ sc->sc_pct.pct_ctrl.grd_address_size,
+ sc->sc_pct.pct_ctrl.grd_address);
+
+ dnprintf(10, "_PCT(status): %02x %04x %02x %02x %02x %02x %016x\n",
+ sc->sc_pct.pct_status.grd_descriptor,
+ sc->sc_pct.pct_status.grd_length,
+ sc->sc_pct.pct_status.grd_access_type,
+ sc->sc_pct.pct_status.grd_reg_width,
+ sc->sc_pct.pct_status.grd_reg_bit_offset,
+ sc->sc_pct.pct_status.grd_address_size,
+ sc->sc_pct.pct_status.grd_address);
+
+ return (0);
+}
+
+int
acpicpu_getpss(struct acpicpu_softc *sc)
{
struct aml_value res, env;