[ACPI_NEW] Minimal to build

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Co-authored-by: Dmitry Borisov <di.sean@protonmail.com>
This commit is contained in:
Justin Miller
2025-03-30 19:17:49 +02:00
committed by Justin Miller
parent 156fead517
commit 8aab5a9b24
7 changed files with 564 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
set(CMAKE_C_STANDARD 11)
include_directories(
uacpi/include
uacpi/include/uacpi/
uacpi/include/uacpi/platform
uacpi/include/uacpi/internal)
list(APPEND UACPI_SOURCE
uacpi/source/default_handlers.c
uacpi/source/event.c
uacpi/source/interpreter.c
uacpi/source/io.c
uacpi/source/mutex.c
uacpi/source/namespace.c
uacpi/source/notify.c
uacpi/source/opcodes.c
uacpi/source/opregion.c
uacpi/source/osi.c
uacpi/source/registers.c
uacpi/source/resources.c
uacpi/source/shareable.c
uacpi/source/sleep.c
uacpi/source/stdlib.c
uacpi/source/tables.c
uacpi/source/types.c
uacpi/source/uacpi.c
uacpi/source/utilities.c)
add_library(uacpi ${UACPI_SOURCE})
add_pch(uacpi uacpi/include/uacpi/acpi.h "${UACPI_SOURCE}")
list(APPEND ACPI_SOURCE
uacpiosl.c
main.c)
add_library(acpi MODULE
${ACPI_SOURCE}
acpi.rc)
target_link_libraries(acpi wdmguid uacpi memcmp strtol ${PSEH_LIB})
set_module_type(acpi kernelmodedriver)
add_importlibs(acpi ntoskrnl hal)
add_pch(acpi precomp.h ACPI_SOURCE)
add_cd_file(TARGET acpi DESTINATION reactos/system32/drivers NO_CAB FOR all)
add_driver_inf(acpi acpi.inf)

View File

@@ -0,0 +1,131 @@
; ACPI.INF
; Installation file for ACPI driver
[Version]
Signature = "$Windows NT$"
;Signature = "$ReactOS$"
LayoutFile = layout.inf
Class = System
ClassGUID = {4D36E97D-E325-11CE-BFC1-08002BE10318}
Provider = %ReactOS%
DriverVer = 10/11/2005,1.01.0.0
[DestinationDirs]
DefaultDestDir = 12
[Manufacturer]
%GenericMfg% = GenericMfg
[GenericMfg]
%*PNP0C08.DeviceDesc% = ACPI_Inst,*PNP0C08
%COMPOSITE_BATTERY.DeviceDesc% = CompBatt_Inst,COMPOSITE_BATTERY
;------------------------------ ACPI DRIVER -----------------------------
[ACPI_Inst.NT]
CopyFiles = ACPI_CopyFiles.NT
[ACPI_CopyFiles.NT]
acpi.sys
[ACPI_Inst.NT.Services]
AddService = acpi, 0x00000002, acpi_Service_Inst
[acpi_Service_Inst]
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%\acpi.sys
LoadOrderGroup = Boot Bus Extender
;---------------------------- COMPBATT DRIVER ---------------------------
[CompBatt_Inst.NT]
CopyFiles = CompBatt_CopyFiles.NT
[CompBatt_CopyFiles.NT]
compbatt.sys
[CompBatt_Inst.NT.Services]
AddService = compbatt, 0x00000002, compbatt_Service_Inst
[compbatt_Service_Inst]
ServiceType = 1
StartType = 0
ErrorControl = 1
ServiceBinary = %12%\compbatt.sys
LoadOrderGroup = System Bus Extender
;-------------------------------- STRINGS -------------------------------
[Strings]
; Non-localizable
ReactOS = "ReactOS Project"
; Localizable
GenericMfg = "(Generic system devices)"
*PNP0C08.DeviceDesc = "ACPI hardware"
COMPOSITE_BATTERY.DeviceDesc = "Composite battery"
[Strings.0405]
GenericMfg = "(Generická systémová zařízení)"
[Strings.0404]
GenericMfg = "(標準系統裝置)"
*PNP0C08.DeviceDesc = "ACPI 硬體"
[Strings.0407]
GenericMfg = "(Generische Systemgeräte)"
*PNP0C08.DeviceDesc = "ACPI Hardware"
[Strings.0a]
GenericMfg = "(Dispositivos del sistema estándar)"
*PNP0C08.DeviceDesc = "Hardware ACPI"
[Strings.040C]
GenericMfg = "(Périphériques systèmes génériques)"
[Strings.0411]
GenericMfg = "(標準システム デバイス)"
*PNP0C08.DeviceDesc = "ACPI ハードウェア"
[Strings.0415]
GenericMfg = "(Standardowe urządzenia systemowe)"
*PNP0C08.DeviceDesc = "Sprzęt ACPI"
[Strings.0416]
GenericMfg = "(Dispositivos de sistema padrão)"
*PNP0C08.DeviceDesc = "Hardware ACPI"
[Strings.0418]
GenericMfg = "(dispozitiv de sistem generic)"
*PNP0C08.DeviceDesc = "Dispozitive ACPI"
[Strings.0419]
GenericMfg = "(Стандартные системные устройства)"
*PNP0C08.DeviceDesc = "Устройства ACPI"
[Strings.041B]
GenericMfg = "(Generické systémové zariadenia)"
*PNP0C08.DeviceDesc = "ACPI hardvér"
[Strings.041f]
GenericMfg = "(Genel Sistem Aygıtları)"
*PNP0C08.DeviceDesc = "ACPI Donanım"
[Strings.0422]
GenericMfg = "(Стандартні системні пристрої)"
*PNP0C08.DeviceDesc = "Пристрої ACPI"
[Strings.0427]
GenericMfg = "(Standartiniai sisteminiai įrenginiai)"
[Strings.0804]
GenericMfg = "(通用系统设备)"
*PNP0C08.DeviceDesc = "ACPI 硬件"
[Strings.0c04]
GenericMfg = "(標準系統裝置)"
*PNP0C08.DeviceDesc = "ACPI 硬件"

View File

@@ -0,0 +1,5 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "uACPI ReactOS ACPI Driver"
#define REACTOS_STR_INTERNAL_NAME "uACPI"
#define REACTOS_STR_ORIGINAL_FILENAME "acpi.sys"
#include <reactos/version.rc>

View File

@@ -0,0 +1,15 @@
#include "precomp.h"
//#define NDEBUG
#include <debug.h>
CODE_SEG("INIT")
NTSTATUS
NTAPI
DriverEntry(
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath)
{
ACPIInitUACPI();
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}

View File

@@ -0,0 +1,21 @@
#pragma once
#include <stdio.h>
#include <acpi.h>
#include <kernel_api.h>
#include <uacpi/uacpi.h>
#include <uacpi/event.h>
#include <initguid.h>
#include <ntddk.h>
#include <ntifs.h>
#include <mountdev.h>
#include <mountmgr.h>
#include <ketypes.h>
#include <iotypes.h>
#include <rtlfuncs.h>
#include <arc/arc.h>
UINT32
ACPIInitUACPI(void);

View File

@@ -1,12 +1,20 @@
#pragma once
#if __REACTOS__
#define UACPI_STATIC_ASSERT _STATIC_ASSERT
#else
#ifdef __cplusplus
#define UACPI_STATIC_ASSERT static_assert
#else
#define UACPI_STATIC_ASSERT _Static_assert
#endif
#endif
#ifdef __REACTOS__
#define UACPI_BUILD_BUG_ON_WITH_MSG(expr, msg) UACPI_STATIC_ASSERT(!(expr))
#else
#define UACPI_BUILD_BUG_ON_WITH_MSG(expr, msg) UACPI_STATIC_ASSERT(!(expr), msg)
#endif
#define UACPI_BUILD_BUG_ON(expr) \
UACPI_BUILD_BUG_ON_WITH_MSG(expr, "BUILD BUG: " #expr " evaluated to true")

View File

@@ -0,0 +1,338 @@
#include "precomp.h"
//#define NDEBUG
#include <debug.h>
UINT32
ACPIInitUACPI(void)
{
uacpi_status status = uacpi_initialize(0);
if (uacpi_unlikely_error(status))
{
DPRINT1("uacpi_initialize error: %s\n", uacpi_status_to_string(status));
}
return status;
}
#ifndef UACPI_FORMATTED_LOGGING
void uacpi_kernel_log(uacpi_log_level Level, const uacpi_char* Char)
{
}
#else
UACPI_PRINTF_DECL(2, 3)
void uacpi_kernel_log(uacpi_log_level Level, const uacpi_char* Char, ...)
{
}
void uacpi_kernel_vlog(uacpi_log_level Level, const uacpi_char* Char, uacpi_va_list list)
{
}
#endif
uacpi_u64
uacpi_kernel_get_nanoseconds_since_boot(void)
{
UNIMPLEMENTED_DBGBREAK();
return 0;
}
void
uacpi_kernel_stall(uacpi_u8 usec)
{
UNIMPLEMENTED_DBGBREAK();
}
void uacpi_kernel_sleep(uacpi_u64 msec)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_handle
uacpi_kernel_create_event(void)
{
UNIMPLEMENTED_DBGBREAK();
return NULL;
}
void
uacpi_kernel_free_event(uacpi_handle Handle)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_bool
uacpi_kernel_wait_for_event(uacpi_handle Handle, uacpi_u16 Timeout)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
void
uacpi_kernel_signal_event(uacpi_handle Handle)
{
UNIMPLEMENTED_DBGBREAK();
}
void
uacpi_kernel_reset_event(uacpi_handle Handle)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_handle
uacpi_kernel_create_spinlock(void)
{
UNIMPLEMENTED_DBGBREAK();
return NULL;
}
void
uacpi_kernel_free_spinlock(uacpi_handle Handle)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_cpu_flags
uacpi_kernel_lock_spinlock(uacpi_handle Handle)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
void
uacpi_kernel_unlock_spinlock(uacpi_handle Handle, uacpi_cpu_flags Flags)
{
UNIMPLEMENTED_DBGBREAK();
}
void*
uacpi_kernel_alloc(uacpi_size size)
{
UNIMPLEMENTED_DBGBREAK();
return NULL;
}
void *
uacpi_kernel_calloc(uacpi_size count, uacpi_size size)
{
UNIMPLEMENTED_DBGBREAK();
return NULL;
}
#ifndef UACPI_SIZED_FREES
void
uacpi_kernel_free(void *mem)
{
UNIMPLEMENTED_DBGBREAK();
}
#else
void
uacpi_kernel_free(void *mem, uacpi_size size_hint)
{
UNIMPLEMENTED_DBGBREAK();
}
#endif
uacpi_handle
uacpi_kernel_create_mutex(void)
{
UNIMPLEMENTED_DBGBREAK();
return NULL;
}
void
uacpi_kernel_free_mutex(uacpi_handle handle)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_status
uacpi_kernel_acquire_mutex(uacpi_handle Handle, uacpi_u16 Timeout)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
void
uacpi_kernel_release_mutex(uacpi_handle Handle)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_status
uacpi_kernel_io_map(uacpi_io_addr base, uacpi_size len, uacpi_handle *out_handle)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
void uacpi_kernel_io_unmap(uacpi_handle handle)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_status
uacpi_kernel_handle_firmware_request(uacpi_firmware_request* Req)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_thread_id
uacpi_kernel_get_thread_id(void)
{
UNIMPLEMENTED_DBGBREAK();
return (uacpi_thread_id)1;
}
void *
uacpi_kernel_map(uacpi_phys_addr addr, uacpi_size len)
{
UNIMPLEMENTED_DBGBREAK();
return NULL;
}
void
uacpi_kernel_unmap(void *addr, uacpi_size len)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_status
uacpi_kernel_get_rsdp(uacpi_phys_addr *out_rdsp_address)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_install_interrupt_handler(
uacpi_u32 irq, uacpi_interrupt_handler handler, uacpi_handle ctx,
uacpi_handle *out_irq_handle)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_uninstall_interrupt_handler(uacpi_interrupt_handler handler, uacpi_handle irq_handle)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_schedule_work(uacpi_work_type type, uacpi_work_handler Handler, uacpi_handle ctx)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_wait_for_work_completion(void)
{
DPRINT("uacpi_kernel_wait_for_work_completion: Enter\n");
return 1;
}
uacpi_status
uacpi_kernel_pci_device_open(
uacpi_pci_address address, uacpi_handle *out_handle
)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
void
uacpi_kernel_pci_device_close(uacpi_handle Handle)
{
UNIMPLEMENTED_DBGBREAK();
}
uacpi_status
uacpi_kernel_pci_read8(uacpi_handle device, uacpi_size offset, uacpi_u8 *Value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_pci_read16(uacpi_handle device, uacpi_size offset, uacpi_u16 *value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_pci_read32(uacpi_handle device, uacpi_size offset, uacpi_u32 *value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_pci_write8(uacpi_handle device, uacpi_size offset, uacpi_u8 value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_pci_write16(uacpi_handle device, uacpi_size offset, uacpi_u16 value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_pci_write32(uacpi_handle device, uacpi_size offset, uacpi_u32 va_list)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_io_read8(uacpi_handle handle, uacpi_size offset, uacpi_u8 *out_value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_io_read16(uacpi_handle handle, uacpi_size offset, uacpi_u16 *out_value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_io_read32(uacpi_handle handle, uacpi_size offset, uacpi_u32 *out_value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_io_write8(uacpi_handle handle, uacpi_size offset, uacpi_u8 in_value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_io_write16(uacpi_handle handle, uacpi_size offset, uacpi_u16 in_value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}
uacpi_status
uacpi_kernel_io_write32(uacpi_handle handle, uacpi_size offset, uacpi_u32 in_value)
{
UNIMPLEMENTED_DBGBREAK();
return 1;
}