summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpiprt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/acpi/acpiprt.c')
-rw-r--r--sys/dev/acpi/acpiprt.c61
1 files changed, 57 insertions, 4 deletions
diff --git a/sys/dev/acpi/acpiprt.c b/sys/dev/acpi/acpiprt.c
index 3051294b851..cd63da05583 100644
--- a/sys/dev/acpi/acpiprt.c
+++ b/sys/dev/acpi/acpiprt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpiprt.c,v 1.24 2008/05/16 06:50:55 dlg Exp $ */
+/* $OpenBSD: acpiprt.c,v 1.25 2008/06/01 17:59:55 marco Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org>
*
@@ -45,7 +45,9 @@ int acpiprt_match(struct device *, void *, void *);
void acpiprt_attach(struct device *, struct device *, void *);
int acpiprt_getirq(union acpi_resource *crs, void *arg);
int acpiprt_getminbus(union acpi_resource *, void *);
-
+#if 0
+int acpiprt_showprs(union acpi_resource *, void *);
+#endif
struct acpiprt_softc {
struct device sc_dev;
@@ -118,6 +120,37 @@ acpiprt_attach(struct device *parent, struct device *self, void *aux)
aml_freevalue(&res);
}
+#if 0
+int
+acpiprt_showprs(union acpi_resource *crs, void *arg)
+{
+ int *irq = (int *)arg;
+ int typ;
+
+ typ = AML_CRSTYPE(crs);
+ switch (typ) {
+ case SR_IRQ:
+ printf("possible irq:[ ");
+ for (typ = 0; typ < sizeof(crs->sr_irq.irq_mask) * 8; typ++) {
+ if (crs->sr_irq.irq_mask & (1L << typ))
+ printf("%d%s ", typ, (typ == *irq) ? "*" : "");
+ }
+ printf("]\n");
+ break;
+ case LR_EXTIRQ:
+ printf("possible irq: [ ");
+ for (typ = 0; typ < crs->lr_extirq.irq_count; typ++)
+ printf("%d%s ", crs->lr_extirq.irq[typ],
+ crs->lr_extirq.irq[typ] == *irq ? "*" : "");
+ printf("]\n");
+ break;
+ default:
+ printf("Unknown interrupt : %x\n", typ);
+ }
+ return (0);
+}
+#endif
+
int
acpiprt_getirq(union acpi_resource *crs, void *arg)
{
@@ -166,8 +199,16 @@ acpiprt_prt_add(struct acpiprt_softc *sc, struct aml_value *v)
}
pp = v->v_package[2];
+ if (pp->type == AML_OBJTYPE_STRING) {
+ node = aml_searchrel(sc->sc_devnode, pp->v_string);
+ if (node == NULL) {
+ printf("Invalid device\n");
+ return;
+ }
+ pp = node->value;
+ }
if (pp->type == AML_OBJTYPE_NAMEREF) {
- node = aml_searchname(sc->sc_devnode, pp->v_nameref);
+ node = aml_searchrel(sc->sc_devnode, pp->v_nameref);
if (node == NULL) {
printf("Invalid device\n");
return;
@@ -198,6 +239,19 @@ acpiprt_prt_add(struct acpiprt_softc *sc, struct aml_value *v)
aml_parse_resource(res.length, res.v_buffer,
acpiprt_getirq, &irq);
aml_freevalue(&res);
+
+#if 0
+ /* Get Possible IRQs */
+ if (!aml_evalname(sc->sc_acpi, node, "_PRS.", 0, NULL, &res)){
+ if (res.type == AML_OBJTYPE_BUFFER &&
+ res.length >= 6)
+ {
+ aml_parse_resource(res.length, res.v_buffer,
+ acpiprt_showprs, &irq);
+ }
+ aml_freevalue(&res);
+ }
+#endif
} else {
irq = aml_val2int(v->v_package[3]);
}
@@ -340,6 +394,5 @@ acpiprt_getpcibus(struct acpiprt_softc *sc, struct aml_node *node)
return (PPB_BUSINFO_SECONDARY(reg));
}
}
-
return (0);
}