summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2006-11-27 23:43:48 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2006-11-27 23:43:48 +0000
commitf3f0efdfceb6190e490dbfb5e5d003e7a93dfe87 (patch)
tree909c5eab1cdb3f07f84137de823b98712d280cf8 /sys
parent8ee8d0355f2708209fcea39b17ff37c52f99fe05 (diff)
Post-process PCI config space opregions
Fixed acpiprt for stinky presario v3000 ok marco@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpiprt.c10
-rw-r--r--sys/dev/acpi/dsdt.c25
2 files changed, 29 insertions, 6 deletions
diff --git a/sys/dev/acpi/acpiprt.c b/sys/dev/acpi/acpiprt.c
index 96f8eaca473..8f95f1c1b10 100644
--- a/sys/dev/acpi/acpiprt.c
+++ b/sys/dev/acpi/acpiprt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpiprt.c,v 1.6 2006/11/27 18:41:23 kettenis Exp $ */
+/* $OpenBSD: acpiprt.c,v 1.7 2006/11/27 23:43:47 jordan Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org>
*
@@ -137,7 +137,7 @@ acpiprt_prt_add(struct acpiprt_softc *sc, struct aml_value *v)
struct aml_node *node;
struct aml_value res, *pp;
u_int64_t addr;
- int pin, irq;
+ int pin, irq, sta;
#if NIOAPIC > 0
struct mp_intr_map *map;
struct ioapic_softc *apic;
@@ -172,10 +172,11 @@ acpiprt_prt_add(struct acpiprt_softc *sc, struct aml_value *v)
pp = pp->v_objref.ref;
}
if (pp->type == AML_OBJTYPE_DEVICE) {
- node = pp->node;
+ node = pp->node;
if (aml_evalname(sc->sc_acpi, node, "_STA", 0, NULL, &res)) {
printf("no _STA method\n");
}
+ sta = aml_val2int(&res);
if (aml_evalname(sc->sc_acpi, node, "_CRS", 0, NULL, &res)) {
printf("no _CRS method\n");
@@ -193,7 +194,8 @@ acpiprt_prt_add(struct acpiprt_softc *sc, struct aml_value *v)
}
#ifdef ACPI_DEBUG
- printf("%s: addr 0x%llx pin %d irq %d\n", DEVNAME(sc), addr, pin, irq);
+ printf("%s: %s addr 0x%llx pin %d irq %d sta %x\n",
+ DEVNAME(sc), aml_nodename(pp->node), addr, pin, irq, sta);
#endif
#if NIOAPIC > 0
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index c10cfc0faa2..f461a681f58 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.65 2006/11/27 15:17:37 jordan Exp $ */
+/* $OpenBSD: dsdt.c,v 1.66 2006/11/27 23:43:47 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -2088,6 +2088,11 @@ aml_getpciaddr(struct acpi_softc *sc, struct aml_node *root)
dnprintf(20,"got _adr [%s]\n",
aml_nodename(root));
}
+ else {
+ /* Mark invalid */
+ pciaddr += (0xFFFF << 16L);
+ return pciaddr;
+ }
if (!aml_evalname(dsdt_softc, root, "_BBN", 0, NULL, &tmpres)) {
/* PCI bus is in bits 48-63 */
@@ -2235,6 +2240,10 @@ aml_parsenamed(struct aml_scope *scope, int opcode, struct aml_value *res)
if (res->v_opregion.iospace == GAS_PCI_CFG_SPACE) {
res->v_opregion.iobase += aml_getpciaddr(dsdt_softc,
scope->node);
+ dnprintf(20,"got ioaddr: %s.%s:%llx\n",
+ aml_nodename(scope->node),
+ aml_getname(name),
+ res->v_opregion.iobase);
}
break;
}
@@ -3147,7 +3156,7 @@ aml_parse_resource(int length, uint8_t *buffer,
for (off=0; off<length; off += rlen+1) {
crs = (union acpi_resource *)(buffer+off);
rlen = AML_CRSLEN(crs);
- if (rlen == 0)
+ if (rlen == 0 || crs->hdr.typecode == 0x79)
break;
//aml_print_resource(crs, NULL);
crs_enum(crs, arg);
@@ -3199,6 +3208,18 @@ int aml_fixup_node(struct aml_node *node, void *arg)
for (i=0; i<val->length; i++)
aml_fixup_node(node, val->v_package[i]);
}
+ else if (val->type == AML_OBJTYPE_OPREGION) {
+ if (val->v_opregion.iospace != GAS_PCI_CFG_SPACE)
+ return (0);
+ if (ACPI_PCI_FN(val->v_opregion.iobase) != 0xFFFF)
+ return (0);
+ val->v_opregion.iobase =
+ ACPI_PCI_REG(val->v_opregion.iobase) +
+ aml_getpciaddr(dsdt_softc, node);
+ dnprintf(20,"late ioaddr : %s:%llx\n",
+ aml_nodename(node),
+ val->v_opregion.iobase);
+ }
return (0);
}