summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/SysFS
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-04-22 10:34:15 +0300
committerAndreas Kling <kling@serenityos.org>2022-06-17 11:01:27 +0200
commit9c6834698f3523c86442276d0b7df03b99778dd1 (patch)
tree1014a3f375ca719267bf32d45b0184732fa73434 /Kernel/FileSystem/SysFS
parent7310a9a641e2d899b8091587d22818a6b5f9e882 (diff)
downloadserenity-9c6834698f3523c86442276d0b7df03b99778dd1.zip
Kerenl/Firmware: Add map_ebda and map_bios methods in the original place
In a previous commit I moved everything into the new subdirectories in FileSystem/SysFS directory without trying to actually make changes in the code itself too much. Now it's time to split the code to make it more readable and understandable, hence this change occurs now.
Diffstat (limited to 'Kernel/FileSystem/SysFS')
-rw-r--r--Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.cpp28
-rw-r--r--Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.h3
2 files changed, 1 insertions, 30 deletions
diff --git a/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.cpp b/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.cpp
index ad42d1336a..0eea9ac40c 100644
--- a/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.cpp
+++ b/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.cpp
@@ -8,6 +8,7 @@
#include <AK/StringView.h>
#include <Kernel/FileSystem/OpenFileDescription.h>
#include <Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.h>
+#include <Kernel/Firmware/BIOS.h>
#include <Kernel/KBufferBuilder.h>
#include <Kernel/Memory/MemoryManager.h>
#include <Kernel/Memory/TypedMapping.h>
@@ -157,31 +158,4 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> BIOSSysFSDirectory::find_dmi_entry32b
return bios_or_error.value().find_chunk_starting_with("_SM_", 16);
}
-ErrorOr<Memory::MappedROM> map_bios()
-{
- Memory::MappedROM mapping;
- mapping.size = 128 * KiB;
- mapping.paddr = PhysicalAddress(0xe0000);
- auto region_size = TRY(Memory::page_round_up(mapping.size));
- mapping.region = TRY(MM.allocate_kernel_region(mapping.paddr, region_size, {}, Memory::Region::Access::Read));
- return mapping;
-}
-
-ErrorOr<Memory::MappedROM> map_ebda()
-{
- auto ebda_segment_ptr = TRY(Memory::map_typed<u16>(PhysicalAddress(0x40e)));
- PhysicalAddress ebda_paddr(PhysicalAddress(*ebda_segment_ptr).get() << 4);
- // The EBDA size is stored in the first byte of the EBDA in 1K units
- size_t ebda_size = *TRY(Memory::map_typed<u8>(ebda_paddr));
- ebda_size *= 1024;
-
- Memory::MappedROM mapping;
- auto region_size = TRY(Memory::page_round_up(ebda_size));
- mapping.region = TRY(MM.allocate_kernel_region(ebda_paddr.page_base(), region_size, {}, Memory::Region::Access::Read));
- mapping.offset = ebda_paddr.offset_in_page();
- mapping.size = ebda_size;
- mapping.paddr = ebda_paddr;
- return mapping;
-}
-
}
diff --git a/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.h b/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.h
index 19a1dd5224..1f41695dd1 100644
--- a/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.h
+++ b/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS.h
@@ -57,9 +57,6 @@ struct [[gnu::packed]] EntryPoint64bit {
namespace Kernel {
-ErrorOr<Memory::MappedROM> map_bios();
-ErrorOr<Memory::MappedROM> map_ebda();
-
class BIOSSysFSComponent : public SysFSComponent {
public:
virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override;