summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2010-06-19 19:43:07 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2010-06-19 19:43:07 +0000
commitc4376d1f14f36850dd0d5ea0a54b77c39ba03770 (patch)
tree8402e6ac4d6c28ec1822d99cdaf3a7db58375cb3 /sys
parent6944f989e28ee5100d5f05375f348a5d662eba43 (diff)
Fix reference counting panic for CondRef
Various HP laptops now boot correctly, fixes PR 6276 ok marco@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/dsdt.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index cf393695ccf..8a23f4de209 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.157 2009/12/05 02:38:11 jordan Exp $ */
+/* $OpenBSD: dsdt.c,v 1.158 2010/06/19 19:43:06 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -699,6 +699,10 @@ aml_delchildren(struct aml_node *node)
aml_delchildren(onode);
+ /* Don't delete values that have references */
+ if (onode->value && onode->value->refcnt > 1)
+ onode->value->node = NULL;
+
/* Decrease reference count */
aml_xdelref(&onode->value, "");
@@ -976,6 +980,7 @@ aml_copyvalue(struct aml_value *lhs, struct aml_value *rhs)
break;
case AML_OBJTYPE_OBJREF:
lhs->v_objref = rhs->v_objref;
+ aml_xaddref(lhs->v_objref.ref, "");
break;
default:
printf("copyvalue: %x", rhs->type);
@@ -3626,12 +3631,12 @@ aml_xparse(struct aml_scope *scope, int ret_type, const char *stype)
/* CondRef: rr => I */
ival = 0;
if (opargs[0]->node != NULL) {
- aml_freevalue(opargs[1]);
-
/* Create Object Reference */
- _aml_setvalue(opargs[1], AML_OBJTYPE_OBJREF, opcode, opargs[0]);
- aml_xaddref(opargs[1], "CondRef");
-
+ opargs[2] = aml_allocvalue(AML_OBJTYPE_OBJREF, opcode,
+ opargs[0]);
+ aml_xaddref(opargs[0], "CondRef");
+ aml_xstore(scope, opargs[1], 0, opargs[2]);
+
/* Mark that we found it */
ival = -1;
}