Patches for OpenBSD

This is an index of patches for OpenBSD that I have submitted to the developers, but have not received any feedback on.

Kernel panic on “BreakPoint” AML instructions

The ACPI 3.0b spec (S17.5.8, p463) says “In the non-debug version of the AML interpreter, 'BreakPoint' is equivalent to 'Noop'.” OpenBSD has a dev/acpi/acpidebug.c file, but as far as I can tell, it's not used, so I assume OpenBSD's AML interpreter qualifies as a “non-debug version.”

Either way, this patch fixes the ``Unknown opcode'' panic caused when I enable acpiec(4) and shut my Thinkpad X40's lid. (For whatever reason, there's a 'BreakPoint' instruction in its DSDT code.)

It also replaces 'Nop' with 'Noop', to be consistent with the spec and acpidump(8)'s output.

Available from here.

Index: amltypes.h
===================================================================
RCS file: /cvs/src/sys/dev/acpi/amltypes.h,v
retrieving revision 1.25
diff -p -u -r1.25 amltypes.h
--- amltypes.h	6 Feb 2007 18:56:31 -0000	1.25
+++ amltypes.h	4 Apr 2007 14:40:48 -0000
@@ -136,7 +136,7 @@
 #define AMLOP_IF		0xA0
 #define AMLOP_ELSE		0xA1
 #define AMLOP_WHILE		0xA2
-#define AMLOP_NOP		0xA3
+#define AMLOP_NOOP		0xA3
 #define AMLOP_RETURN		0xA4
 #define AMLOP_BREAK		0xA5
 #define AMLOP_BREAKPOINT	0xCC
Index: dsdt.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
retrieving revision 1.86
diff -p -u -r1.86 dsdt.c
--- dsdt.c	23 Mar 2007 05:43:46 -0000	1.86
+++ dsdt.c	4 Apr 2007 14:40:50 -0000
@@ -190,8 +190,8 @@ struct aml_opcode aml_table[] = {
 	{ AMLOP_CONTINUE,	"Continue",	"" },
 	{ AMLOP_RETURN,		"Return",	"t",	aml_parseref },
 	{ AMLOP_FATAL,		"Fatal",	"bdi",	aml_parsemisc2 },
-	{ AMLOP_NOP,		"Nop",		"",	aml_parsesimple },
-	{ AMLOP_BREAKPOINT,	"BreakPoint",	"" },
+	{ AMLOP_NOOP,		"Noop",		"",	aml_parsesimple },
+	{ AMLOP_BREAKPOINT,	"BreakPoint",	"",	aml_parsesimple },
 
 	/* Arithmetic operations */
 	{ AMLOP_INCREMENT,	"Increment",	"t",	aml_parsemath },

Unnecessary cast in acpidump(8)

dp is already of type “u_int8_t *” so it seems redundant to cast it.

Available from here.

Index: acpi_user.c
===================================================================
RCS file: /cvs/src/usr.sbin/acpidump/acpi_user.c,v
retrieving revision 1.4
diff -p -u -r1.4 acpi_user.c
--- acpi_user.c	5 Jan 2007 14:13:29 -0000	1.4
+++ acpi_user.c	4 Apr 2007 14:34:58 -0000
@@ -159,7 +159,7 @@ acpi_load_dsdt(char *dumpfile, u_int8_t 
 		sb.st_size -= SIZEOF_SDT_HDR;
 	}
 
-	end = (u_int8_t *) dp + sb.st_size;
+	end = dp + sb.st_size;
 	*dpp = dp;
 	*endp = end;
 }