* Added kernel settings for APM - defaults to disabled (since it doesn't work

on at least one of my systems, it only works on 3 of them...).
* Added APM safemode setting.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16152 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-01-30 14:43:38 +00:00
parent 7f40667cbc
commit bd610d2fcd
4 changed files with 31 additions and 5 deletions
+4
View File
@@ -28,3 +28,7 @@
#load_symbols false
# load kernel and kernel add-on symbols
#apm false
# APM (advanced power management) support
# (system shutdown, battery info, ...)
+6 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2004-2006, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@@ -27,6 +27,11 @@ platform_add_menus(Menu *menu)
menu->AddItem(item = new MenuItem("Don't call the BIOS"));
item->SetType(MENU_ITEM_MARKABLE);
menu->AddItem(item = new MenuItem("Disable APM"));
item->SetType(MENU_ITEM_MARKABLE);
item->SetData("disable_apm");
item->SetHelpText("This overrides the APM setting in the kernel settings file");
break;
default:
break;
+19 -3
View File
@@ -8,6 +8,7 @@
#include <apm.h>
#include <descriptors.h>
#include <safemode.h>
#include <boot/kernel_args.h>
@@ -217,7 +218,7 @@ apm_init(kernel_args *args)
if ((info.version & 0xf) < 2) {
// no APM or connect failed
return B_OK;
return B_ERROR;
}
TRACE((" code32: 0x%x, 0x%lx, length 0x%x\n",
@@ -227,8 +228,23 @@ apm_init(kernel_args *args)
TRACE((" data: 0x%x, length 0x%x\n",
info.data_segment_base, info.data_segment_length));
// TODO: remove me when tested on more hardware
if (1)
// get APM setting - safemode settings override kernel settings
bool apm = false;
void *handle = load_driver_settings("kernel");
if (handle != NULL) {
apm = get_driver_boolean_parameter(handle, "apm", false, false);
unload_driver_settings(handle);
}
handle = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS);
if (handle != NULL) {
apm = !get_driver_boolean_parameter(handle, "disable_apm", !apm, !apm);
unload_driver_settings(handle);
}
if (!apm)
return B_OK;
// Apparently, some broken BIOS try to access segment 0x40 for the BIOS
+2 -1
View File
@@ -29,6 +29,7 @@ arch_platform_init_post_vm(struct kernel_args *args)
status_t
arch_platform_init_post_thread(struct kernel_args *args)
{
return apm_init(args);
apm_init(args);
return B_OK;
}