Page 1 of 1

How to use ACPICA in my own OS

Posted: Sat Dec 26, 2015 1:46 pm
by songziming
Hi, everyone. I want to use ACPICA in my own OS. I downloaded the ACPICA for Unix source code, copied the all the C files in `components/` and header files in `include/` to a single directory (except files in `debugger` and `disassembler` folders). I also modified `platform/acenv.h` and created a configure header for my own OS based on `aclinux.h`.

My makefile automatically finds all the C file and compiles it. But I got compile errors from ACPICA code:

Code: Select all

kernel/driver/acpi/acpica/evxfregn.c:79:1: error: redefinition of 'AcpiInstallAddressSpaceHandler'
AcpiInstallAddressSpaceHandler (
^
kernel/driver/acpi/acpica/acpixf.h:778:1: note: previous definition is here
AcpiInstallAddressSpaceHandler (
^
kernel/driver/acpi/acpica/platform/acwheel.h:96:24: note: expanded from macro
      'ACPI_EXTERNAL_RETURN_STATUS'
    static ACPI_INLINE Prototype {return(AE_NOT_CONFIGURED);}
                       ^
kernel/driver/acpi/acpica/evxfregn.c:145:14: error: use of undeclared identifier
      'AcpiGbl_RegMethodsExecuted'
        if (!AcpiGbl_RegMethodsExecuted)
             ^
kernel/driver/acpi/acpica/evxfregn.c:168:1: warning: type specifier missing, defaults to 'int'
      [-Wimplicit-int]
ACPI_EXPORT_SYMBOL (AcpiInstallAddressSpaceHandler)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/driver/acpi/acpica/platform/acwheel.h:109:37: note: expanded from macro 'ACPI_EXPORT_SYMBOL'
#define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
                                    ^~~~~~~~~~~~~
kernel/driver/acpi/acpica/evxfregn.c:168:21: error: a parameter list without types is only allowed
      in a function definition
ACPI_EXPORT_SYMBOL (AcpiInstallAddressSpaceHandler)
                    ^
kernel/driver/acpi/acpica/platform/acwheel.h:109:51: note: expanded from macro 'ACPI_EXPORT_SYMBOL'
#define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
                                                  ^
kernel/driver/acpi/acpica/evxfregn.c:186:1: error: redefinition of 'AcpiRemoveAddressSpaceHandler'
AcpiRemoveAddressSpaceHandler (
^
kernel/driver/acpi/acpica/acpixf.h:787:1: note: previous definition is here
AcpiRemoveAddressSpaceHandler (
^
kernel/driver/acpi/acpica/platform/acwheel.h:96:24: note: expanded from macro
      'ACPI_EXTERNAL_RETURN_STATUS'
    static ACPI_INLINE Prototype {return(AE_NOT_CONFIGURED);}
                       ^
kernel/driver/acpi/acpica/evxfregn.c:222:19: error: use of undeclared identifier 'AcpiGbl_RootNode'
         (Node != AcpiGbl_RootNode)))
                  ^
kernel/driver/acpi/acpica/evxfregn.c:315:1: warning: type specifier missing, defaults to 'int'
      [-Wimplicit-int]
ACPI_EXPORT_SYMBOL (AcpiRemoveAddressSpaceHandler)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/driver/acpi/acpica/platform/acwheel.h:109:37: note: expanded from macro 'ACPI_EXPORT_SYMBOL'
#define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
                                    ^~~~~~~~~~~~~
kernel/driver/acpi/acpica/evxfregn.c:315:21: error: a parameter list without types is only allowed
      in a function definition
ACPI_EXPORT_SYMBOL (AcpiRemoveAddressSpaceHandler)
                    ^
kernel/driver/acpi/acpica/platform/acwheel.h:109:51: note: expanded from macro 'ACPI_EXPORT_SYMBOL'
#define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
                                                  ^
So what should I do if I just want to use ACPICA. There's not much information on the internet.

Re: How to use ACPICA in my own OS

Posted: Sat Dec 26, 2015 2:17 pm
by FallenAvatar

Re: How to use ACPICA in my own OS

Posted: Sun Dec 27, 2015 7:22 am
by songziming
I have read that several times. And I did exactly what the wiki says.

I created an `acpica_adapter.c` file and implemented all the OS layer functions. And I copied the files into a single directory, also created the configure header file for my os based on `aclinux.h` and include it from `acenv.h`. Although most of the OSL functions are simple empty, but that should at least make the kernel COMPILE.

But the kernel won't compile. I'm getting compiler errors from ACPICA. I noticed that many errors are related with macros, is there any important macros that I need to adjust?

Re: How to use ACPICA in my own OS

Posted: Sun Dec 27, 2015 3:20 pm
by FallenAvatar
Seeing as you said you grabbed the ACPICA code from linux source, you clearly didn't follow what it said.

- Monk