Removed platform_boot_device_is_image() - platform_get_boot_device() now fills
in the adequate field in the kernel_args structure. Renamed gCDFloppyBoot variable to gBootedFromImage (as network boot should look similar). The "kernel_args.boot_disk.cd" field is now maintained as well. The print_item_at() menu function now prints the Menu::ChoiceText() instead of that of its marked item. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14389 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5ea23bb0a3
commit
51e081bade
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "devices.h"
|
||||
#include "bios.h"
|
||||
|
||||
#include <boot/platform.h>
|
||||
@ -22,7 +23,7 @@
|
||||
|
||||
|
||||
// exported from shell.S
|
||||
extern uint8 gCDFloppyBoot;
|
||||
extern uint8 gBootedFromImage;
|
||||
extern uint8 gBootDriveID;
|
||||
extern uint32 gBootPartitionOffset;
|
||||
|
||||
@ -114,6 +115,16 @@ struct device_table {
|
||||
uint8 lba_enabled : 1;
|
||||
} _PACKED;
|
||||
|
||||
struct specification_packet {
|
||||
uint8 size;
|
||||
uint8 media_type;
|
||||
uint8 drive_number;
|
||||
uint8 controller_index;
|
||||
uint32 start_emulation;
|
||||
uint16 device_specification;
|
||||
uint8 _more_[9];
|
||||
} _PACKED;
|
||||
|
||||
class BIOSDrive : public Node {
|
||||
public:
|
||||
BIOSDrive(uint8 driveID);
|
||||
@ -479,6 +490,45 @@ BIOSDrive::Size() const
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C" void
|
||||
devices_check_cd_boot(void)
|
||||
{
|
||||
gKernelArgs.boot_disk.cd = false;
|
||||
|
||||
if (gBootDriveID != 0)
|
||||
return;
|
||||
|
||||
struct bios_regs regs;
|
||||
regs.eax = 0x4b00;
|
||||
regs.edx = 0;
|
||||
regs.esi = kDataSegmentScratch;
|
||||
call_bios(0x13, ®s);
|
||||
|
||||
if ((regs.flags & CARRY_FLAG) != 0)
|
||||
return;
|
||||
|
||||
// we obviously were booted from CD!
|
||||
|
||||
specification_packet *packet = (specification_packet *)kDataSegmentScratch;
|
||||
|
||||
if (packet->media_type != 0)
|
||||
gKernelArgs.boot_disk.cd = false;
|
||||
|
||||
#if 0
|
||||
dprintf("got CD boot spec:\n");
|
||||
dprintf(" size: %#x\n", packet->size);
|
||||
dprintf(" media type: %u\n", packet->media_type);
|
||||
dprintf(" drive_number: %u\n", packet->drive_number);
|
||||
dprintf(" controller index: %u\n", packet->controller_index);
|
||||
dprintf(" start emulation: %lu\n", packet->start_emulation);
|
||||
dprintf(" device_specification: %u\n", packet->device_specification);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_device(struct stage2_args *args, Node **_device)
|
||||
{
|
||||
@ -491,6 +541,7 @@ platform_get_boot_device(struct stage2_args *args, Node **_device)
|
||||
}
|
||||
|
||||
TRACE(("drive size: %Ld bytes\n", drive->Size()));
|
||||
gKernelArgs.boot_disk.booted_from_image = gBootedFromImage;
|
||||
|
||||
*_device = drive;
|
||||
return B_OK;
|
||||
@ -571,9 +622,3 @@ platform_register_boot_device(Node *device)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
platform_boot_device_is_image()
|
||||
{
|
||||
return gCDFloppyBoot;
|
||||
}
|
||||
|
22
src/system/boot/platform/bios_ia32/devices.h
Normal file
22
src/system/boot/platform/bios_ia32/devices.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef DEVICES_H
|
||||
#define DEVICES_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void devices_check_cd_boot(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DEVICES_H */
|
@ -104,20 +104,15 @@ print_item_at(int32 line, MenuItem *item, bool clearHelp = true)
|
||||
|
||||
if (item->Submenu() && item->Submenu()->Type() == CHOICE_MENU) {
|
||||
// show the current choice (if any)
|
||||
Menu *subMenu = item->Submenu();
|
||||
MenuItem *subItem = NULL;
|
||||
|
||||
for (int32 i = subMenu->CountItems(); i-- > 0; ) {
|
||||
subItem = subMenu->ItemAt(i);
|
||||
if (subItem != NULL && subItem->IsMarked())
|
||||
break;
|
||||
}
|
||||
|
||||
const char *text = " (Current: ";
|
||||
printf(text);
|
||||
length += strlen(text);
|
||||
|
||||
text = subItem != NULL ? subItem->Label() : "None";
|
||||
Menu *subMenu = item->Submenu();
|
||||
if (subMenu->ChoiceText() != NULL)
|
||||
text = subMenu->ChoiceText();
|
||||
else
|
||||
text = "None";
|
||||
length += strlen(text);
|
||||
|
||||
console_set_color(selected ? DARK_GRAY : WHITE, background);
|
||||
@ -207,7 +202,7 @@ draw_menu(Menu *menu)
|
||||
print_centered(2, "Haiku Boot Loader");
|
||||
|
||||
console_set_color(kCopyrightColor, kBackgroundColor);
|
||||
print_centered(4, "Copyright 2004 Haiku Inc.");
|
||||
print_centered(4, "Copyright 2004-2005 Haiku Inc.");
|
||||
|
||||
if (menu->Title()) {
|
||||
console_set_cursor(kOffsetX, kFirstLine - 2);
|
||||
|
@ -72,10 +72,10 @@ floppy_start:
|
||||
#endif
|
||||
|
||||
start_loader:
|
||||
// indicate that we were booted from CD/floppy
|
||||
// indicate that we were booted from CD/floppy/whatever
|
||||
.code32
|
||||
.byte 0x67
|
||||
movb $1, gCDFloppyBoot - 0x7c00
|
||||
movb $1, gBootedFromImage - 0x7c00
|
||||
// %ds is 0x7c0 right now, but the symbol were loaded
|
||||
// to offset 0x10000
|
||||
.code16
|
||||
@ -364,7 +364,7 @@ gdt_descriptor:
|
||||
.word 0x2f // 6 entries in the GDT (8 bytes each)
|
||||
.long gdt
|
||||
|
||||
GLOBAL(gCDFloppyBoot):
|
||||
GLOBAL(gBootedFromImage):
|
||||
.byte 0
|
||||
|
||||
GLOBAL(gBootDriveID):
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "smp.h"
|
||||
#include "keyboard.h"
|
||||
#include "bios.h"
|
||||
#include "devices.h"
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <boot/platform.h>
|
||||
@ -74,6 +75,7 @@ platform_start_kernel(void)
|
||||
// or I don't see something important...
|
||||
addr_t stackTop = gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size;
|
||||
|
||||
devices_check_cd_boot();
|
||||
mmu_init_for_kernel();
|
||||
smp_boot_other_cpus();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user