From e170b01108793ca1debcd3fea81f88832987d7a6 Mon Sep 17 00:00:00 2001 From: msmith Date: Sat, 28 Oct 2000 07:29:08 +0000 Subject: FreeBSD-specific customisations: - Set debugger options for kernel build - Define some missing functions - Bring in GCC defines - Disable the 'wbinvd' macro as it conflicts with our inline --- .../dev/acpica/Subsystem/Include/acconfig.h | 3 +- .../dev/acpica/Subsystem/Include/acfreebsd.h | 64 +++++++++++++++++++++- sys/contrib/dev/acpica/Subsystem/Include/acgcc.h | 4 ++ sys/contrib/dev/acpica/acconfig.h | 3 +- sys/contrib/dev/acpica/acfreebsd.h | 64 +++++++++++++++++++++- sys/contrib/dev/acpica/acgcc.h | 4 ++ 6 files changed, 138 insertions(+), 4 deletions(-) diff --git a/sys/contrib/dev/acpica/Subsystem/Include/acconfig.h b/sys/contrib/dev/acpica/Subsystem/Include/acconfig.h index 116c020..08653a3 100644 --- a/sys/contrib/dev/acpica/Subsystem/Include/acconfig.h +++ b/sys/contrib/dev/acpica/Subsystem/Include/acconfig.h @@ -213,13 +213,14 @@ #define DEBUGGER_SINGLE_THREADED 0 #define DEBUGGER_MULTI_THREADED 1 +#ifndef DEBUGGER_THREADING #ifdef ACPI_APPLICATION #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #else #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED #endif - +#endif /****************************************************************************** * diff --git a/sys/contrib/dev/acpica/Subsystem/Include/acfreebsd.h b/sys/contrib/dev/acpica/Subsystem/Include/acfreebsd.h index 36ba77a..1cd6b4a 100644 --- a/sys/contrib/dev/acpica/Subsystem/Include/acfreebsd.h +++ b/sys/contrib/dev/acpica/Subsystem/Include/acfreebsd.h @@ -117,9 +117,19 @@ #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 "opt_acpi.h" /* collect build-time options here */ + #include #include #include @@ -130,5 +140,57 @@ #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 + +#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); +} + +/* 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 /* __ACFREEBSD_H__ */ \ No newline at end of file +#endif /* __ACFREEBSD_H__ */ diff --git a/sys/contrib/dev/acpica/Subsystem/Include/acgcc.h b/sys/contrib/dev/acpica/Subsystem/Include/acgcc.h index 9689664..7711d66 100644 --- a/sys/contrib/dev/acpica/Subsystem/Include/acgcc.h +++ b/sys/contrib/dev/acpica/Subsystem/Include/acgcc.h @@ -131,7 +131,9 @@ #define BREAKPOINT3 #define disable() __cli() #define enable() __sti() +#ifndef __FreeBSD__ /* XXX conflicts with inline in cpufunc.h */ #define wbinvd() +#endif /*! [Begin] no source code translation */ @@ -194,7 +196,9 @@ #define disable() __cli() #define enable() __sti() #define halt() __asm__ __volatile__ ("sti; hlt":::"memory") +#ifndef __FreeBSD__ /* XXX conflicts with inline in cpufunc.h */ #define wbinvd() +#endif /*! [Begin] no source code translation * diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index 116c020..08653a3 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -213,13 +213,14 @@ #define DEBUGGER_SINGLE_THREADED 0 #define DEBUGGER_MULTI_THREADED 1 +#ifndef DEBUGGER_THREADING #ifdef ACPI_APPLICATION #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #else #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED #endif - +#endif /****************************************************************************** * diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h index 36ba77a..1cd6b4a 100644 --- a/sys/contrib/dev/acpica/acfreebsd.h +++ b/sys/contrib/dev/acpica/acfreebsd.h @@ -117,9 +117,19 @@ #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 "opt_acpi.h" /* collect build-time options here */ + #include #include #include @@ -130,5 +140,57 @@ #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 + +#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); +} + +/* 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 /* __ACFREEBSD_H__ */ \ No newline at end of file +#endif /* __ACFREEBSD_H__ */ diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/acgcc.h index 9689664..7711d66 100644 --- a/sys/contrib/dev/acpica/acgcc.h +++ b/sys/contrib/dev/acpica/acgcc.h @@ -131,7 +131,9 @@ #define BREAKPOINT3 #define disable() __cli() #define enable() __sti() +#ifndef __FreeBSD__ /* XXX conflicts with inline in cpufunc.h */ #define wbinvd() +#endif /*! [Begin] no source code translation */ @@ -194,7 +196,9 @@ #define disable() __cli() #define enable() __sti() #define halt() __asm__ __volatile__ ("sti; hlt":::"memory") +#ifndef __FreeBSD__ /* XXX conflicts with inline in cpufunc.h */ #define wbinvd() +#endif /*! [Begin] no source code translation * -- cgit v1.1