Implemented first basic APM driver. Only tested with QEMU so far, that's why

it's currently disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16120 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-01-28 18:11:20 +00:00
parent bfb4078864
commit afd6dfc8b4
13 changed files with 316 additions and 25 deletions
+5
View File
@@ -1,20 +1,25 @@
/*
* Copyright 2006, Axel Dörfler, [email protected].
* Copyright 2005, Ingo Weinhold <[email protected]>.
*
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_PLATFORM_H
#define _KERNEL_ARCH_PLATFORM_H
#include <SupportDefs.h>
struct kernel_args;
#ifdef __cplusplus
extern "C" {
#endif
status_t arch_platform_init(struct kernel_args *kernelArgs);
status_t arch_platform_init_post_vm(struct kernel_args *kernelArgs);
status_t arch_platform_init_post_thread(struct kernel_args *kernelArgs);
#ifdef __cplusplus
} // extern "C"
+41
View File
@@ -1,9 +1,38 @@
/*
* Copyright 2006, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_APM_H
#define KERNEL_APM_H
#include <SupportDefs.h>
struct kernel_args;
// int 0x15 APM definitions
#define BIOS_APM_CHECK 0x5300
#define BIOS_APM_CONNECT_32_BIT 0x5303
#define BIOS_APM_DISCONNECT 0x5304
#define BIOS_APM_CPU_IDLE 0x5305
#define BIOS_APM_CPU_BUSY 0x5306
#define BIOS_APM_SET_STATE 0x5307
#define BIOS_APM_ENABLE 0x5308
#define BIOS_APM_GET_POWER_STATUS 0x530a
#define BIOS_APM_GET_EVENT 0x530b
#define BIOS_APM_GET_STATE 0x530c
#define BIOS_APM_VERSION 0x530e
#define BIOS_APM_ENGAGE 0x530f
// APM devices
#define APM_ALL_DEVICES 0x0001
// APM power states
#define APM_POWER_STATE_ENABLED 0x0000
#define APM_POWER_STATE_STANDBY 0x0001
#define APM_POWER_STATE_SUSPEND 0x0002
#define APM_POWER_STATE_OFF 0x0003
typedef struct apm_info {
uint16 version;
@@ -18,4 +47,16 @@ typedef struct apm_info {
} apm_info;
#ifndef _BOOT_MODE
#ifdef __cplusplus
extern "C" {
#endif
status_t apm_init(struct kernel_args *args);
#ifdef __cplusplus
}
#endif
#endif // !_BOOT_MODE
#endif /* KERNEL_APM_H */
@@ -19,11 +19,13 @@
#define APM_CODE16_SEGMENT 0x30
#define APM_DATA_SEGMENT 0x38
#define BIOS_DATA_SEGMENT 0x40
#ifndef _ASSEMBLER
// this file can also be included from assembler as well
// (and is in arch_interrupts.S)
#define DOUBLE_FAULT_TSS_BASE_SEGMENT 8
#define DOUBLE_FAULT_TSS_BASE_SEGMENT 9
#define TSS_BASE_SEGMENT (DOUBLE_FAULT_TSS_BASE_SEGMENT + smp_get_num_cpus())
#define TLS_BASE_SEGMENT (TSS_BASE_SEGMENT + smp_get_num_cpus())
#define APM_BASE_SEGMENT (TLS_BASE_SEGMENT + smp_get_num_cpus())