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 {
|
|
|
|
Text,
|
|
|
|
SelfTest,
|
|
|
|
Graphical
|
|
|
|
};
|
|
|
|
|
|
|
|
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,
|
|
|
|
Complete,
|
|
|
|
None
|
|
|
|
};
|
|
|
|
|
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-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] const String& string() const { return m_string; }
|
2020-04-08 14:35:00 +00:00
|
|
|
Optional<String> lookup(const String& key) const;
|
2021-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] bool contains(const String& key) const;
|
|
|
|
|
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;
|
|
|
|
[[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;
|
|
|
|
[[nodiscard]] bool is_text_mode() const;
|
|
|
|
[[nodiscard]] bool is_force_pio() const;
|
|
|
|
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
|
|
|
|
[[nodiscard]] BootMode boot_mode() const;
|
|
|
|
[[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-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-03-03 08:51:55 +00:00
|
|
|
[[nodiscard]] String userspace_init() const;
|
|
|
|
[[nodiscard]] Vector<String> userspace_init_args() const;
|
|
|
|
[[nodiscard]] String root_device() 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&);
|
|
|
|
|
|
|
|
String m_string;
|
2019-06-04 10:54:27 +00:00
|
|
|
HashMap<String, String> m_params;
|
|
|
|
};
|
2020-04-08 11:54:44 +00:00
|
|
|
|
|
|
|
const CommandLine& kernel_command_line();
|
|
|
|
|
|
|
|
}
|