x86: Make "Disable BIOS calls" boot option actually work.
It was a complete no-op before. Now, when enabled, BIOS calls won't be done past the bootloader, and the Framebuffer driver will be used instead of VESA. (cherry picked from commit 7f12208162a5fc676f7a03e050f7671919f4fb12) Change-Id: Id7670cc060ab5273411222e27467a6dfdbbb9e7f Reviewed-on: https://review.haiku-os.org/c/haiku/+/11313 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
bb98e98305
commit
7dc7df27e9
@@ -14,6 +14,7 @@
|
|||||||
#define B_SAFEMODE_DISABLE_ACPI "disable_acpi"
|
#define B_SAFEMODE_DISABLE_ACPI "disable_acpi"
|
||||||
#define B_SAFEMODE_DISABLE_APIC "disable_apic"
|
#define B_SAFEMODE_DISABLE_APIC "disable_apic"
|
||||||
#define B_SAFEMODE_DISABLE_APM "disable_apm"
|
#define B_SAFEMODE_DISABLE_APM "disable_apm"
|
||||||
|
#define B_SAFEMODE_DISABLE_BIOS_CALLS "disable_bios_calls"
|
||||||
#define B_SAFEMODE_DISABLE_HYPER_THREADING "disable_hyperthreading"
|
#define B_SAFEMODE_DISABLE_HYPER_THREADING "disable_hyperthreading"
|
||||||
#define B_SAFEMODE_DISABLE_IDE_DMA "disable_ide_dma"
|
#define B_SAFEMODE_DISABLE_IDE_DMA "disable_ide_dma"
|
||||||
#define B_SAFEMODE_DISABLE_IOAPIC "disable_ioapic"
|
#define B_SAFEMODE_DISABLE_IOAPIC "disable_ioapic"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <drivers/bios.h>
|
#include <drivers/bios.h>
|
||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
#include <safemode.h>
|
||||||
|
|
||||||
#include <AutoDeleter.h>
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
@@ -339,6 +340,11 @@ std_ops(int32 op, ...)
|
|||||||
{
|
{
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case B_MODULE_INIT:
|
case B_MODULE_INIT:
|
||||||
|
if (get_safemode_boolean(B_SAFEMODE_DISABLE_BIOS_CALLS, false)) {
|
||||||
|
dprintf("BIOS calls disabled\n");
|
||||||
|
return ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
sBIOSLock = create_sem(1, "bios lock");
|
sBIOSLock = create_sem(1, "bios lock");
|
||||||
if (sBIOSLock < B_OK)
|
if (sBIOSLock < B_OK)
|
||||||
return sBIOSLock;
|
return sBIOSLock;
|
||||||
|
|||||||
@@ -67,9 +67,10 @@ platform_add_menus(Menu* menu)
|
|||||||
item = new(std::nothrow) MenuItem("Don't call the BIOS");
|
item = new(std::nothrow) MenuItem("Don't call the BIOS");
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
|
item->SetData(B_SAFEMODE_DISABLE_BIOS_CALLS);
|
||||||
item->SetHelpText("Stops the system from calling BIOS "
|
item->SetHelpText("Stops the system from calling BIOS "
|
||||||
"functions.");
|
"functions.");
|
||||||
item->SetType(MENU_ITEM_MARKABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new(std::nothrow) MenuItem("Disable APM");
|
item = new(std::nothrow) MenuItem("Disable APM");
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
#ifndef _BOOT_MODE
|
#ifndef _BOOT_MODE
|
||||||
#include <vesa_info.h>
|
#include <vesa_info.h>
|
||||||
|
|
||||||
#include <edid.h>
|
#include <edid.h>
|
||||||
|
#include <safemode.h>
|
||||||
#else
|
#else
|
||||||
#define mutex_lock(...)
|
#define mutex_lock(...)
|
||||||
#define mutex_unlock(...)
|
#define mutex_unlock(...)
|
||||||
@@ -510,6 +510,12 @@ frame_buffer_console_init_post_vm(kernel_args* args)
|
|||||||
add_boot_item(FRAME_BUFFER_BOOT_INFO, &sBootInfo,
|
add_boot_item(FRAME_BUFFER_BOOT_INFO, &sBootInfo,
|
||||||
sizeof(frame_buffer_boot_info));
|
sizeof(frame_buffer_boot_info));
|
||||||
|
|
||||||
|
if (get_safemode_boolean(B_SAFEMODE_DISABLE_BIOS_CALLS, false)) {
|
||||||
|
// If BIOS calls are disabled, then the VESA driver can't work.
|
||||||
|
// So, don't report any VESA information in this case.
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
sVesaModes = (vesa_mode*)malloc(args->vesa_modes_size);
|
sVesaModes = (vesa_mode*)malloc(args->vesa_modes_size);
|
||||||
if (sVesaModes != NULL && args->vesa_modes_size > 0) {
|
if (sVesaModes != NULL && args->vesa_modes_size > 0) {
|
||||||
memcpy(sVesaModes, args->vesa_modes, args->vesa_modes_size);
|
memcpy(sVesaModes, args->vesa_modes, args->vesa_modes_size);
|
||||||
|
|||||||
Reference in New Issue
Block a user