summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/acfreebsd.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/acfreebsd.h')
-rw-r--r--sys/contrib/dev/acpica/acfreebsd.h69
1 files changed, 67 insertions, 2 deletions
diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h
index ca6c799..894af50 100644
--- a/sys/contrib/dev/acpica/acfreebsd.h
+++ b/sys/contrib/dev/acpica/acfreebsd.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acfreebsd.h - OS specific defines, etc.
- * $Revision: 4 $
+ * $Revision: 6 $
*
*****************************************************************************/
@@ -117,18 +117,83 @@
#ifndef __ACFREEBSD_H__
#define __ACFREEBSD_H__
+/*
+ * XXX this is technically correct, but will cause problems with some ASL
+ * which only works if the string names a Microsoft operating system.
+ */
#define ACPI_OS_NAME "FreeBSD"
+/* FreeBSD uses GCC */
+
+#include "acgcc.h"
+
#ifdef _KERNEL
#include <sys/ctype.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/libkern.h>
-#include <stdarg.h>
+#include <machine/stdarg.h>
#define asm __asm
#define __cli() disable_intr()
#define __sti() enable_intr()
+#ifdef ACPI_DEBUG
+#ifdef DEBUGGER_THREADING
+#undef DEBUGGER_THREADING
+#endif /* DEBUGGER_THREADING */
+#define DEBUGGER_THREADING 0 /* integrated with DDB */
+#include "opt_ddb.h"
+#ifdef DDB
+#define ENABLE_DEBUGGER
+#endif /* DDB */
+#endif /* ACPI_DEBUG */
+
+#else /* _KERNEL */
+
+/* Not building kernel code, so use libc */
+#define ACPI_USE_STANDARD_HEADERS
+
+#define __cli()
+#define __sti()
+
+#endif /* _KERNEL */
+
+/* Always use FreeBSD code over our local versions */
+#define ACPI_USE_SYSTEM_CLIBRARY
+
+/* FreeBSD doesn't have strupr, should be fixed. (move to libkern) */
+static __inline char *
+strupr(char *str)
+{
+ char *c = str;
+ while(*c) {
+ *c = toupper(*c);
+ c++;
+ }
+ return(str);
+}
+
+#ifdef _KERNEL
+/* Or strstr (used in debugging mode, also move to libkern) */
+static __inline char *
+strstr(char *s, char *find)
+{
+ char c, sc;
+ size_t len;
+
+ if ((c = *find++) != 0) {
+ len = strlen(find);
+ do {
+ do {
+ if ((sc = *s++) == 0)
+ return (NULL);
+ } while (sc != c);
+ } while (strncmp(s, find, len) != 0);
+ s--;
+ }
+ return ((char *)s);
+}
+#endif /* _KERNEL */
#endif /* __ACFREEBSD_H__ */
OpenPOWER on IntegriCloud