2020-01-18 08:38:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 08:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-04 10:54:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/HashMap.h>
|
2020-04-08 14:35:00 +00:00
|
|
|
#include <AK/Optional.h>
|
2020-03-22 00:12:45 +00:00
|
|
|
#include <AK/String.h>
|
2021-03-03 08:51:55 +00:00
|
|
|
#include <AK/Vector.h>
|
2019-06-04 10:54:27 +00:00
|
|
|
|
2020-04-08 11:54:44 +00:00
|
|
|
namespace Kernel {
|
2019-06-04 10:54:27 +00:00
|
|
|
|
2021-03-03 08:51:55 +00:00
|
|
|
enum class BootMode {
|
2021-04-16 19:58:51 +00:00
|
|
|
NoFramebufferDevices,
|
2021-03-03 08:51:55 +00:00
|
|
|
SelfTest,
|
2021-08-08 19:40:45 +00:00
|
|
|
Graphical,
|
|
|
|
Unknown,
|
2021-03-03 08:51:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class HPETMode {
|
|
|
|
Periodic,
|
|
|
|
NonPeriodic
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class AcpiFeatureLevel {
|
|
|
|
Enabled,
|
|
|
|
Limited,
|
|
|
|
Disabled,
|
|
|
|
};
|
|
|
|
|
2021-04-03 13:46:04 +00:00
|
|
|
enum class PCIAccessLevel {
|
|
|
|
IOAddressing,
|
|
|
|
MappingPerBus,
|
|
|
|
MappingPerDevice,
|
|
|
|
};
|
|
|
|
|
2021-03-12 16:35:16 +00:00
|
|
|
enum class AHCIResetMode {
|
|
|
|
ControllerOnly,
|
2021-05-28 22:18:45 +00:00
|
|
|
Aggressive,
|
2021-03-12 16:35:16 +00:00
|
|
|
};
|
|
|
|
|
2020-04-08 11:54:44 +00:00
|
|
|
class CommandLine {
|
|
|
|
AK_MAKE_ETERNAL;
|
2020-04-08 14:35:00 +00:00
|
|
|
|
2020-04-08 11:54:44 +00:00
|
|
|
public:
|
2020-08-25 01:35:27 +00:00
|
|
|
static void early_initialize(const char* cmd_line);
|
|
|
|
static void initialize();
|
2019-06-04 10:54:27 +00:00
|
|
|
|
2021-08-08 19:40:45 +00:00
|
|
|
enum class Validate {
|
|
|
|
Yes,
|
|
|
|
No,
|
|
|
|
};
|
|
|
|
|
2021-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] const String& string() const { return m_string; }
|
2021-08-15 06:49:17 +00:00
|
|
|
Optional<StringView> lookup(const StringView& key) const;
|
2021-05-31 08:59:02 +00:00
|
|
|
[[nodiscard]] bool contains(const StringView& key) const;
|
2021-03-03 08:51:55 +00:00
|
|
|
|
2021-03-03 09:00:41 +00:00
|
|
|
[[nodiscard]] bool is_boot_profiling_enabled() const;
|
2021-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] bool is_ide_enabled() const;
|
|
|
|
[[nodiscard]] bool is_smp_enabled() const;
|
2021-06-04 05:02:14 +00:00
|
|
|
[[nodiscard]] bool is_physical_networking_disabled() const;
|
2021-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] bool is_vmmouse_enabled() const;
|
2021-04-03 13:46:04 +00:00
|
|
|
[[nodiscard]] PCIAccessLevel pci_access_level() const;
|
2021-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] bool is_legacy_time_enabled() const;
|
2021-04-16 19:58:51 +00:00
|
|
|
[[nodiscard]] bool is_no_framebuffer_devices_mode() const;
|
2021-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] bool is_force_pio() const;
|
|
|
|
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
|
2021-08-08 19:40:45 +00:00
|
|
|
[[nodiscard]] BootMode boot_mode(Validate should_validate = Validate::No) const;
|
2021-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] HPETMode hpet_mode() const;
|
2021-04-08 18:18:48 +00:00
|
|
|
[[nodiscard]] bool disable_physical_storage() const;
|
|
|
|
[[nodiscard]] bool disable_ps2_controller() const;
|
2021-04-17 19:36:53 +00:00
|
|
|
[[nodiscard]] bool disable_uhci_controller() const;
|
2021-08-08 18:50:20 +00:00
|
|
|
[[nodiscard]] bool disable_usb() const;
|
2021-04-18 13:06:35 +00:00
|
|
|
[[nodiscard]] bool disable_virtio() const;
|
2021-03-12 16:35:16 +00:00
|
|
|
[[nodiscard]] AHCIResetMode ahci_reset_mode() const;
|
2021-08-15 06:49:17 +00:00
|
|
|
[[nodiscard]] StringView userspace_init() const;
|
2021-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] Vector<String> userspace_init_args() const;
|
2021-08-15 06:49:17 +00:00
|
|
|
[[nodiscard]] StringView root_device() const;
|
2021-05-13 21:22:02 +00:00
|
|
|
[[nodiscard]] size_t switch_to_tty() const;
|
2019-06-07 09:43:58 +00:00
|
|
|
|
2019-06-04 10:54:27 +00:00
|
|
|
private:
|
2020-04-08 11:54:44 +00:00
|
|
|
CommandLine(const String&);
|
|
|
|
|
2021-05-31 08:59:02 +00:00
|
|
|
void add_arguments(const Vector<StringView>& args);
|
2021-05-21 17:42:33 +00:00
|
|
|
void build_commandline(const String& cmdline_from_bootloader);
|
|
|
|
|
2020-04-08 11:54:44 +00:00
|
|
|
String m_string;
|
2021-05-31 08:59:02 +00:00
|
|
|
HashMap<StringView, StringView> m_params;
|
2019-06-04 10:54:27 +00:00
|
|
|
};
|
2020-04-08 11:54:44 +00:00
|
|
|
|
|
|
|
const CommandLine& kernel_command_line();
|
|
|
|
|
|
|
|
}
|