xref: /haiku/headers/private/kernel/boot/kernel_args.h (revision 3af8011358bd4c624a0979336d48dabb466171ed)
1 /*
2  * Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  *
5  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
6  * Distributed under the terms of the NewOS License.
7  */
8 #ifndef KERNEL_BOOT_KERNEL_ARGS_H
9 #define KERNEL_BOOT_KERNEL_ARGS_H
10 
11 
12 #include <SupportDefs.h>
13 
14 #include <boot/elf.h>
15 #include <boot/disk_identifier.h>
16 #include <boot/driver_settings.h>
17 
18 #include <platform_kernel_args.h>
19 #include <arch_kernel_args.h>
20 
21 #include <util/FixedWidthPointer.h>
22 
23 
24 #define CURRENT_KERNEL_ARGS_VERSION	1
25 #define MAX_KERNEL_ARGS_RANGE		20
26 
27 // names of common boot_volume fields
28 #define BOOT_METHOD						"boot method"
29 #define BOOT_VOLUME_USER_SELECTED		"user selected"
30 #define BOOT_VOLUME_BOOTED_FROM_IMAGE	"booted from image"
31 #define BOOT_VOLUME_PACKAGED			"packaged"
32 #define BOOT_VOLUME_PACKAGES_STATE		"packages state"
33 #define BOOT_VOLUME_PARTITION_OFFSET	"partition offset"
34 #define BOOT_VOLUME_DISK_IDENTIFIER		"disk identifier"
35 
36 // boot methods
37 enum {
38 	BOOT_METHOD_HARD_DISK	= 0,
39 	BOOT_METHOD_CD			= 1,
40 	BOOT_METHOD_NET			= 2,
41 
42 	BOOT_METHOD_DEFAULT		= BOOT_METHOD_HARD_DISK
43 };
44 
45 typedef struct kernel_args {
46 	uint32		kernel_args_size;
47 	uint32		version;
48 
49 	FixedWidthPointer<struct preloaded_image> kernel_image;
50 	FixedWidthPointer<struct preloaded_image> preloaded_images;
51 
52 	uint32		num_physical_memory_ranges;
53 	addr_range	physical_memory_range[MAX_PHYSICAL_MEMORY_RANGE];
54 	uint32		num_physical_allocated_ranges;
55 	addr_range	physical_allocated_range[MAX_PHYSICAL_ALLOCATED_RANGE];
56 	uint32		num_virtual_allocated_ranges;
57 	addr_range	virtual_allocated_range[MAX_VIRTUAL_ALLOCATED_RANGE];
58 	uint32		num_kernel_args_ranges;
59 	addr_range	kernel_args_range[MAX_KERNEL_ARGS_RANGE];
60 	uint64		ignored_physical_memory;
61 
62 	uint32		num_cpus;
63 	addr_range	cpu_kstack[SMP_MAX_CPUS];
64 
65 	// boot volume KMessage data
66 	FixedWidthPointer<void> boot_volume;
67 	int32		boot_volume_size;
68 
69 	FixedWidthPointer<struct driver_settings_file> driver_settings;
70 
71 	struct {
72 		addr_range	physical_buffer;
73 		uint32	bytes_per_row;
74 		uint16	width;
75 		uint16	height;
76 		uint8	depth;
77 		bool	enabled;
78 	} frame_buffer;
79 
80 	FixedWidthPointer<void> vesa_modes;
81 	uint16		vesa_modes_size;
82 	uint8		vesa_capabilities;
83 	FixedWidthPointer<void> edid_info;
84 
85 	FixedWidthPointer<void> debug_output;
86 		// If keep_debug_output_buffer, points to a ring_buffer, else to a
87 		// simple flat buffer. In either case it stores the debug output from
88 		// the boot loader.
89 	FixedWidthPointer<void> previous_debug_output;
90 		// A flat pointer to a buffer containing the debug output from the
91 		// previous session. May be NULL.
92 	uint32		debug_size;
93 		// If keep_debug_output_buffer, the size of the ring buffer, otherwise
94 		// the size of the flat buffer debug_output points to.
95 	uint32		previous_debug_size;
96 		// The size of the buffer previous_debug_output points to. Used as a
97 		// boolean indicator whether to save the previous session's debug output
98 		// until initialized for the kernel.
99 	bool		keep_debug_output_buffer;
100 		// If true, debug_output is a ring buffer, otherwise a flat buffer.
101 
102 	platform_kernel_args platform_args;
103 	arch_kernel_args arch_args;
104 
105 	// bootsplash data
106 	FixedWidthPointer<uint8> boot_splash;
107 
108 	// optional microcode
109 	FixedWidthPointer<void> ucode_data;
110 	uint32	ucode_data_size;
111 
112 } _PACKED kernel_args;
113 
114 
115 const size_t kernel_args_size_v1 = sizeof(kernel_args)
116 	- sizeof(FixedWidthPointer<void>) - sizeof(uint32);
117 
118 
119 #endif	/* KERNEL_BOOT_KERNEL_ARGS_H */
120