Renamed devices_check_boot_cd() to check_boot_cd() and moved it up to the other BIOS

functions - it no longer terminates the CD-ROM emulation, but only checks the status,
and therefore, it's now called by platform_register_boot_device() instead of from
platform_start_kernel().
This also makes the devices.h header useless.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14390 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-10-14 21:38:12 +00:00
parent 51e081bade
commit 2e2bd87511
3 changed files with 38 additions and 64 deletions

View File

@ -4,7 +4,6 @@
*/
#include "devices.h"
#include "bios.h"
#include <boot/platform.h>
@ -33,6 +32,7 @@ extern uint32 gBootPartitionOffset;
#define BIOS_IS_EXT_PRESENT 0x4100
#define BIOS_EXT_READ 0x4200
#define BIOS_GET_EXT_DRIVE_PARAMETERS 0x4800
#define BIOS_BOOT_CD_GET_STATUS 0x4b01
struct real_addr {
uint16 offset;
@ -152,6 +152,42 @@ class BIOSDrive : public Node {
};
static void
check_cd_boot(void)
{
gKernelArgs.boot_disk.cd = false;
if (gBootDriveID != 0)
return;
struct bios_regs regs;
regs.eax = BIOS_BOOT_CD_GET_STATUS;
regs.edx = 0;
regs.esi = kDataSegmentScratch;
call_bios(0x13, &regs);
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
}
static status_t
get_ext_drive_parameters(uint8 drive, drive_parameters *targetParameters)
{
@ -490,45 +526,6 @@ 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, &regs);
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)
{
@ -593,6 +590,7 @@ platform_register_boot_device(Node *device)
BIOSDrive *drive = (BIOSDrive *)device;
gKernelArgs.platform_args.boot_drive_number = gBootDriveID;
check_cd_boot();
if (drive->HasParameters()) {
const drive_parameters &parameters = drive->Parameters();

View File

@ -1,22 +0,0 @@
/*
* 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 */

View File

@ -11,7 +11,6 @@
#include "smp.h"
#include "keyboard.h"
#include "bios.h"
#include "devices.h"
#include <KernelExport.h>
#include <boot/platform.h>
@ -75,7 +74,6 @@ 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();