summaryrefslogtreecommitdiff
path: root/Kernel/Firmware
AgeCommit message (Collapse)Author
2022-02-09Kernel: Change static constexpr variables to constexpr where possibleLenny Maiorani
Function-local `static constexpr` variables can be `constexpr`. This can reduce memory consumption, binary size, and offer additional compiler optimizations. These changes result in a stripped x86_64 kernel binary size reduction of 592 bytes.
2022-01-21Kernel: Replace {String => KString}::formatted in ACPISysFSDirectoryIdan Horowitz
2022-01-21Kernel: Make ACPI reboot OOM-fallibleIdan Horowitz
2022-01-18Kernel: Don't populate the ACPI SysFS directory with a disabled ACPIIdan Horowitz
This would cause a nullptr dereference on ACPI::Parser::the().
2022-01-13Kernel: Make map_typed() & map_typed_writable() fallible using ErrorOrIdan Horowitz
This mostly just moved the problem, as a lot of the callers are not capable of propagating the errors themselves, but it's a step in the right direction.
2022-01-13Kernel: Make map_bios() and map_ebda() fallible using ErrorOrIdan Horowitz
2022-01-07Everywhere: Fix many spelling errorsmjz19910
2022-01-05Kernel: Use MUST + Vector::try_empend instead of Vector::empendBrian Gianforcaro
In preparation for making Vector::empend unavailable during compilation of the Kernel.
2022-01-05Kernel: Use MUST + Vector::try_append instead of Vector::appendBrian Gianforcaro
In preparation for making Vector::append unavailable during compilation of the Kernel.
2022-01-04Kernel: Scan ACPI memory ranges for the RSDP tableTom
On some systems the ACPI RSDP table may be located in ACPI reserved memory ranges rather than in the EBDA or BIOS areas.
2022-01-04Kernel: Fix determining EBDA sizeTom
The first byte of the EBDA structure contains the size of the EBDA in 1 KiB units. We were incorrectly using the word at offset 0x413 of the BDA which specifies the number of KiB before the EBDA structure.
2021-12-28Kernel: Propagate overflow errors from Memory::page_round_upGuilherme Goncalves
Fixes #11402.
2021-12-23Kernel: Move Multi Processor Parser code to a separate directoryLiav A
2021-12-14Kernel/SysFS: Don't allocate ACPISysFS components in constructorsLiav A
Instead defer it to a method to be called after the construction of ACPISysFSDirectory.
2021-12-14Kernel/SysFS: Make it clear that some components must be created in bootLiav A
Using the phrase "create" doesn't give information on whether the object must be allocated or a failure to do so can be handled gracefully. Therefore, we must use better phrase for such purpose, so "must_create" for the allocate-and-construct static methods is definitely good choice.
2021-12-14Kernel/SysFS: Prevent allocation for component name during constructionLiav A
Instead, allocate before constructing the object and pass NonnullOwnPtr of KString to the object if needed. Some classes can determine their names as they have a known attribute to look for or have a static name.
2021-12-11Everywhere: Fix -Winconsistent-missing-override warnings from ClangDaniel Bertalan
This option is already enabled when building Lagom, so let's enable it for the main build too. We will no longer be surprised by Lagom Clang CI builds failing while everything compiles locally. Furthermore, the stronger `-Wsuggest-override` warning is enabled in this commit, which enforces the use of the `override` keyword in all classes, not just those which already have some methods marked as `override`. This works with both GCC and Clang.
2021-12-09Kernel: Mark ACPI::Parser's empty destructor as defaultHendiadyoin1
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-10AK+Everywhere: Stop including Vector.h from StringView.hAndreas Kling
Preparation for using Error.h from Vector.h. This required moving some things out of line.
2021-11-08Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>Andreas Kling
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
2021-11-02Kernel: Switch BIOSSysFSComponent constructor to AK::StringViewBrian Gianforcaro
These are constants, they don't need to be dynamically allocated. Another minor step towards removing `AK::String` from the Kernel and improving OOM safety.
2021-10-09Kernel/SysFS: Provide a way to "truncate" and "set" mtime on inodesLiav A
Normally, trying to truncate a SysFSInode should result in EPERM error. However, as suggested by Ali (@alimpfard), we can allow the PowerState node to be "truncated" so one can open that file with O_TRUNC option. Likewise, we also need to provide a way to set modified time on SysFS inodes. For most inodes, we should return ENOTIMPL error, but for the power state switch, we ignore the modified time setting and just return KSuccess. These fixes allow to do "echo -n 1 > /sys/firmware/power_state" in Shell after gaining root permissions, to switch the power state.
2021-10-03Kernel: Use `operator ""sv` in all purpose() implementationsBrian Gianforcaro
Previously there was a mix of returning plain strings and returning explicit string views using `operator ""sv`. This change switches them all to standardized on `operator ""sv` as it avoids a call to strlen.
2021-10-01Kernel: Move x86 IO instructions code into the x86 specific folderLiav A
2021-09-12Kernel+Userland: Introduce a new way to reboot and poweroff the machineLiav A
This change removes the halt and reboot syscalls, and create a new mechanism to change the power state of the machine. Instead of how power state was changed until now, put a SysFS node as writable only for the superuser, that with a defined value, can result in either reboot or poweroff. In the future, a power group can be assigned to this node (which will be the GroupID responsible for power management). This opens an opportunity to permit to shutdown/reboot without superuser permissions, so in the future, a userspace daemon can take control of this node to perform power management operations without superuser permissions, if we enforce different UserID/GroupID on that node.
2021-09-12Kernel: Unify BIOS and ACPI components in the SysFS firmware directoryLiav A
Both should reside in the SysFS firmware directory which is normally located in /sys/firmware. Also, apply some OOM-safety patterns when creating the BIOS and ACPI directories.
2021-09-12Kernel: Move ACPI and BIOS code into the new Firmware directoryLiav A
This will somwhat help unify them also under the same SysFS directory in the commit. Also, it feels much more like this change reflects the reality that both ACPI and the BIOS are part of the firmware on x86 computers.