Skip to content

Commit

Permalink
Clib: Fix wrong mini C library usage
Browse files Browse the repository at this point in the history
When mini C library is used, we should have the following macros undefined.
The only user should be the EFI applications:
  ACPI_USE_SYSTEM_CLIBRARY=n
  ACPI_USE_STANDARD_HEADERS=n
All other applications uses the compiler specific library:
  ACPI_USE_SYSTEM_CLIBRARY=y
  ACPI_USE_STANDARD_HEADERS=y
Linux/BSD kernels are the kind of hosts providing C library but does not
provide the standard headers:
  ACPI_USE_SYSTEM_CLIBRARY=y
  ACPI_USE_STANDARD_HEADERS=n
But the above logic hasn't been synchronized between the header files.

This patch synchronizes all header files to correct C library usages for
different platforms. This patch moves all ACPI_USE_SYSTEM_CLIRARY and
ACPI_USE_STANDARD_HEADERS to the top most lines of a platform specific
header. However, BSD headers are not changed, like Linux, they need to
handle special _KERNEL build cases, thus they are left for the BSD
developers to complete the cleanup.

After synchronization, ACPI_USE_SYSTEM_CLIRARY definition can be removed
for ACPI_APPLICATION. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
  • Loading branch information
Lv Zheng committed Jul 22, 2016
1 parent 03b0397 commit 4aab184
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
6 changes: 3 additions & 3 deletions source/include/platform/accygwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
/*
* ACPICA configuration
*/
#define ACPI_USE_STANDARD_HEADERS
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_DO_WHILE_0
#define ACPI_FLUSH_CPU_CACHE()
Expand All @@ -130,10 +131,9 @@
#define ACPI_USE_ALTERNATE_TIMEOUT


#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#ifdef ACPI_USE_STANDARD_HEADERS
#include <unistd.h>
#endif

#if defined(__ia64__) || defined(__x86_64__)
#define ACPI_MACHINE_WIDTH 64
Expand Down
7 changes: 2 additions & 5 deletions source/include/platform/acenv.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@
/* Common for all ACPICA applications */

#ifdef ACPI_APPLICATION
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_LOCAL_CACHE
#endif

Expand Down Expand Up @@ -402,15 +401,15 @@
* ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
* Otherwise, local versions of string/memory functions will be used.
* ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
* the standard header files may be used.
* the standard header files may be used. Defining this implies that
* ACPI_USE_SYSTEM_CLIBRARY has been defined.
*
* The ACPICA subsystem only uses low level C library functions that do not
* call operating system services and may therefore be inlined in the code.
*
* It may be necessary to tailor these include files to the target
* generation environment.
*/
#ifdef ACPI_USE_SYSTEM_CLIBRARY

/* Use the standard C library headers. We want to keep these to a minimum. */

Expand All @@ -424,8 +423,6 @@

#endif /* ACPI_USE_STANDARD_HEADERS */

#endif /* ACPI_USE_SYSTEM_CLIBRARY */

#ifndef ACPI_FILE
#ifdef ACPI_APPLICATION
#include <stdio.h>
Expand Down
6 changes: 3 additions & 3 deletions source/include/platform/achaiku.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
#ifndef __ACHAIKU_H__
#define __ACHAIKU_H__

#define ACPI_USE_STANDARD_HEADERS
#define ACPI_USE_SYSTEM_CLIBRARY

#include "acgcc.h"
#include <KernelExport.h>

Expand All @@ -124,9 +127,6 @@ struct mutex;

/* Host-dependent types and defines for user- and kernel-space ACPICA */

#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_STANDARD_HEADERS

#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX
#define ACPI_MUTEX struct mutex *

Expand Down
7 changes: 4 additions & 3 deletions source/include/platform/aclinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@

#else /* !__KERNEL__ */

#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define ACPI_USE_STANDARD_HEADERS

#ifdef ACPI_USE_STANDARD_HEADERS
#include <unistd.h>
#endif

/* Define/disable kernel-specific declarators */

Expand Down
5 changes: 4 additions & 1 deletion source/include/platform/acos2.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@

#ifndef __ACOS2_H__
#define __ACOS2_H__

#define ACPI_USE_STANDARD_HEADERS
#define ACPI_USE_SYSTEM_CLIBRARY

#define INCL_LONGLONG
#include <os2.h>

Expand All @@ -138,7 +142,6 @@
*/
#define ACPI_UNUSED_VAR

#define ACPI_USE_STANDARD_HEADERS
#include <io.h>

#define ACPI_FLUSH_CPU_CACHE() Wbinvd()
Expand Down
6 changes: 3 additions & 3 deletions source/include/platform/acqnx.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
#ifndef __ACQNX_H__
#define __ACQNX_H__

#define ACPI_USE_STANDARD_HEADERS
#define ACPI_USE_SYSTEM_CLIBRARY

/* QNX uses GCC */

#include "acgcc.h"
Expand All @@ -134,13 +137,10 @@
#include <stdint.h>
#include <sys/neutrino.h>

#define ACPI_USE_STANDARD_HEADERS

#define __cli() InterruptDisable();
#define __sti() InterruptEnable();
#define __cdecl

#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_NATIVE_DIVIDE

#endif /* __ACQNX_H__ */

0 comments on commit 4aab184

Please sign in to comment.