patch from Fredrik Holmqvist:

* oshaiku.c is based on a different original from a stub, therefore it
looks like a lot of comment changes.
* achaiku.h is redone completely.
* dpc is added as boot module.
* acpi_busman.c now does all mandatory steps to init.
* style fixes
* added another acpi kernel settings to avoid full init for debugging.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33236 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2009-09-22 21:10:18 +00:00
parent b1c4413c56
commit 53ef0850a7
5 changed files with 552 additions and 575 deletions

View File

@ -467,7 +467,7 @@ AddFilesToHaikuImage system : haiku_loader ;
# boot module links
AddBootModuleSymlinksToHaikuImage
$(X86_ONLY)acpi $(ATA_ONLY)ata pci $(X86_ONLY)isa config_manager
$(X86_ONLY)acpi $(ATA_ONLY)ata pci $(X86_ONLY)isa config_manager dpc
$(IDE_ONLY)ide scsi usb
$(PPC_ONLY)openpic
$(ATA_ONLY)ata_adapter $(IDE_ONLY)ide_adapter locked_pool scsi_periph

View File

@ -55,3 +55,7 @@
#acpi true
# ACPI support, off by default
#acpi_avoid_full_init true
# Avoids running _INI and _STA methods and final object initialization,
# which may be used to for debugging ACPI issues, false by default

View File

@ -79,13 +79,17 @@ acpi_std_ops(int32 op,...)
case B_MODULE_INIT:
{
ACPI_STATUS status;
bool acpiDisabled = false;
uint32 flags;
void *settings;
bool acpiDisabled = false;
bool acpiAvoidFullInit = false;
settings = load_driver_settings("kernel");
if (settings != NULL) {
acpiDisabled = !get_driver_boolean_parameter(settings, "acpi",
false, false);
acpiAvoidFullInit = get_driver_boolean_parameter(settings,
"acpi_avoid_full_init", false, false);
unload_driver_settings(settings);
}
@ -103,6 +107,8 @@ acpi_std_ops(int32 op,...)
ERROR("ACPI disabled\n");
return ENOSYS;
}
AcpiGbl_EnableInterpreterSlack = true;
// AcpiGbl_CreateOSIMethod = true;
#ifdef ACPI_DEBUG_OUTPUT
AcpiDbgLevel = ACPI_DEBUG_ALL | ACPI_LV_VERBOSE;
@ -130,6 +136,13 @@ acpi_std_ops(int32 op,...)
goto err;
}
flags = acpiAvoidFullInit ?
ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT :
ACPI_FULL_INITIALIZATION;
// FreeBSD seems to pass in the above flags here as
// well but specs don't define ACPI_NO_DEVICE_INIT
// and ACPI_NO_OBJECT_INIT here.
status = AcpiEnableSubsystem(ACPI_FULL_INITIALIZATION);
if (status != AE_OK) {
ERROR("AcpiEnableSubsystem failed (%s)\n",
@ -137,6 +150,13 @@ acpi_std_ops(int32 op,...)
goto err;
}
status = AcpiInitializeObjects(flags);
if (status != AE_OK) {
ERROR("AcpiInitializeObjects failed (%s)\n",
AcpiFormatException(status));
goto err;
}
/* Phew. Now in ACPI mode */
TRACE("ACPI initialized\n");
return B_OK;
@ -545,8 +565,7 @@ reboot(void)
if ((AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) == 0)
return B_UNSUPPORTED;
status = AcpiWrite(AcpiGbl_FADT.ResetValue,
&AcpiGbl_FADT.ResetRegister);
status = AcpiWrite(AcpiGbl_FADT.ResetValue, &AcpiGbl_FADT.ResetRegister);
if (status != AE_OK) {
ERROR("Reset failed, status = %d\n", status);

View File

@ -117,62 +117,49 @@
#ifndef __ACHAIKU_H__
#define __ACHAIKU_H__
/* Haiku uses GCC */
#include "acgcc.h"
#include <SupportDefs.h>
/*#ifdef _LP64
#define ACPI_MACHINE_WIDTH 64
#else*/
#define ACPI_MACHINE_WIDTH 32 /* Haiku always 32 bit right now */
/*#endif*/
#define COMPILER_DEPENDENT_INT64 int64
#define COMPILER_DEPENDENT_UINT64 uint64
/* Host-dependent types and defines for user- and kernel-space ACPICA */
#ifdef _KERNEL_MODE
/* #include "opt_acpi.h" collect build-time options here */
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_STANDARD_HEADERS
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
/* TODO: add mutex or benaphore code
#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX
#define ACPI_MUTEX sem_id
*/
#define asm __asm
#define ACPI_USE_LOCAL_CACHE
//#define ACPI_MUTEX_DEBUG
#define ACPI_USE_NATIVE_DIVIDE
#define ACPI_ASM_MACROS /* tell acenv.h */
#define ACPI_THREAD_ID thread_id
#define ACPI_SEMAPHORE sem_id
#define ACPI_SPINLOCK spinlock *
#define ACPI_CPU_FLAGS cpu_status
#define ACPI_SYSTEM_XFACE
#define ACPI_EXTERNAL_XFACE
#define ACPI_INTERNAL_XFACE
#define ACPI_INTERNAL_VAR_XFACE
#define COMPILER_DEPENDENT_INT64 int64
#define COMPILER_DEPENDENT_UINT64 uint64
/* TODO: Add 64 bit when Haiku goes 64 bit */
#define ACPI_MACHINE_WIDTH 32
#ifdef _KERNEL_MODE
/* Host-dependent types and defines for in-kernel ACPICA */
#include <KernelExport.h>
#define ACPI_USE_LOCAL_CACHE
/* TODO: Use Haiku's slab code */
//#define ACPI_CACHE_T struct kmem_cache
#define ACPI_FLUSH_CPU_CACHE() __asm __volatile("wbinvd");
#ifdef ACPI_DEBUG
#define ACPI_DEBUG_OUTPUT
#define ACPI_DBG_TRACK_ALLOCATIONS
#ifdef DEBUGGER_THREADING
#undef DEBUGGER_THREADING
#endif /* DEBUGGER_THREADING */
#define DEBUGGER_THREADING 0 /* integrated with DDB */
//#include "opt_ddb.h"
//#ifdef DDB
#define ACPI_DISASSEMBLER
#define ACPI_DEBUGGER
//#endif /* DDB */
#endif /* ACPI_DEBUG */
/* The following Global Lock code stolen from NetBSD
src/sys/arch/i386/include/acpi_func.h which in turn
was stolen from Intel's spec document */
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
do { \
__asm __volatile( \
@ -206,26 +193,10 @@ do { \
: "edx"); \
} while (0)
#else /* _KERNEL_MODE */
/* Host-dependent types and defines for user-space ACPICA */
#include <ctype.h>
/* Not building kernel code, so use libc */
#define ACPI_USE_STANDARD_HEADERS
#define ACPI_FLUSH_CPU_CACHE()
#define __cli()
#define __sti()
/* XXX */
#define __inline inline
#error "We only support kernel mode ACPI atm."
#endif /* _KERNEL_MODE */
/* Always use Haiku code over our local versions */
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_NATIVE_DIVIDE
#endif /* __ACHAIKU_H__ */

File diff suppressed because it is too large Load Diff