Some work on the boot disk identification: the kernel_args structure has

now fields that carry information about the boot disk and partition.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9956 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-11-15 17:59:15 +00:00
parent 0c3888b965
commit b193fcc716
6 changed files with 122 additions and 17 deletions
@@ -0,0 +1,72 @@
/*
* Copyright 2004, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_BOOT_DISK_IDENTIFIER_H
#define KERNEL_BOOT_DISK_IDENTIFIER_H
#include <SupportDefs.h>
enum bus_types {
UNKNOWN_BUS,
LEGACY_BUS,
PCI_BUS,
};
enum device_types {
UNKNOWN_DEVICE,
ATA_DEVICE,
ATAPI_DEVICE,
SCSI_DEVICE,
USB_DEVICE,
FIREWIRE_DEVICE,
FIBRE_DEVICE,
};
typedef struct disk_identifier {
int32 bus_type;
int32 device_type;
union {
struct {
uint16 base_address;
} legacy;
struct {
uint8 bus;
uint8 slot;
uint8 function;
} pci;
} bus;
union {
struct {
bool master;
} ata;
struct {
bool master;
uint8 logical_unit;
} atapi;
struct {
uint8 logical_unit;
} scsi;
struct {
uint8 tbd;
} usb;
struct {
uint64 guid;
} firewire;
struct {
uint64 wwd;
} fibre;
struct {
off_t size;
struct {
off_t offset;
uint32 sum;
} check_sums[5];
} unknown;
} device;
} disk_identifier;
#endif /* KERNEL_BOOT_DISK_IDENTIFIER_H */
+12 -6
View File
@@ -1,10 +1,10 @@
/*
** Copyright 2002-2004, The Haiku Team. All rights reserved.
** Distributed under the terms of the Haiku License.
**
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
* Copyright 2002-2004, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
*/
#ifndef KERNEL_BOOT_KERNEL_ARGS_H
#define KERNEL_BOOT_KERNEL_ARGS_H
@@ -12,6 +12,7 @@
#include <SupportDefs.h>
#include <boot/elf.h>
#include <boot/disk_identifier.h>
#include <platform_kernel_args.h>
#include <arch_kernel_args.h>
@@ -41,6 +42,11 @@ typedef struct kernel_args {
uint32 num_cpus;
addr_range cpu_kstack[MAX_BOOT_CPUS];
struct {
disk_identifier identifier;
off_t partition_offset;
} boot_disk;
struct {
bool enabled;
int32 width;
+4 -3
View File
@@ -1,7 +1,7 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
* Copyright 2003-2004, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_BOOT_PLATFORM_H
#define KERNEL_BOOT_PLATFORM_H
@@ -57,6 +57,7 @@ extern status_t platform_get_boot_device(struct stage2_args *args, Node **_devic
extern status_t platform_add_block_devices(struct stage2_args *args, NodeList *devicesList);
extern status_t platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
NodeList *partitions, boot::Partition **_partition);
extern status_t platform_register_boot_device(Node *device);
/* menu functions */
@@ -0,0 +1,18 @@
/*
* Copyright 2004, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_BOOT_PLATFORM_BIOS_IA32_BIOS_DRIVE_H
#define KERNEL_BOOT_PLATFORM_BIOS_IA32_BIOS_DRIVE_H
#include <boot/disk_identifier.h>
typedef struct bios_drive {
struct bios_drive *next;
uint16 drive_number;
disk_identifier identifier;
} bios_drive;
#endif /* KERNEL_BOOT_PLATFORM_BIOS_IA32_BIOS_DRIVE_H */
@@ -1,7 +1,7 @@
/*
** Copyright 2003-2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
* Copyright 2003-2004, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_BOOT_PLATFORM_BIOS_IA32_KERNEL_ARGS_H
#define KERNEL_BOOT_PLATFORM_BIOS_IA32_KERNEL_ARGS_H
@@ -9,6 +9,9 @@
# error This file is included from <boot/kernel_args.h> only
#endif
#include <bios_drive.h>
// must match SMP_MAX_CPUS in arch_smp.h
#define MAX_BOOT_CPUS 4
#define MAX_PHYSICAL_MEMORY_RANGE 4
@@ -18,7 +21,10 @@
#define MAX_SERIAL_PORTS 4
typedef struct {
uint16 serial_base_ports[MAX_SERIAL_PORTS];
uint16 serial_base_ports[MAX_SERIAL_PORTS];
uint16 boot_drive_number;
bios_drive *drives; // this does not contain the boot drive
} platform_kernel_args;
#endif /* KERNEL_BOOT_PLATFORM_BIOS_IA32_KERNEL_ARGS_H */
+6 -4
View File
@@ -1,7 +1,7 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
* Copyright 2003-2004, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_BOOT_VFS_H
#define KERNEL_BOOT_VFS_H
@@ -78,12 +78,14 @@ class ConsoleNode : public Node {
/* function prototypes */
extern status_t vfs_init(stage2_args *args);
extern void register_boot_file_system(Directory *directory);
extern status_t register_boot_file_system(Directory *directory);
extern Directory *get_boot_file_system(stage2_args *args);
extern status_t mount_file_systems(stage2_args *args);
extern int open_node(Node *node, int mode);
extern int open_from(Directory *directory, const char *path, int mode);
extern Node *get_node_from(int fd);
extern status_t add_partitions_for(int fd, bool mountFileSystems);
extern status_t add_partitions_for(Node *device, bool mountFileSystems);