mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-23 11:32:51 +00:00
Kernel/SysFS: Split the bulky BIOS.h file into multiple files
This commit is contained in:
parent
9c6834698f
commit
4d05a41b30
Notes:
sideshowbarker
2024-07-17 10:07:42 +09:00
Author: https://github.com/supercomputer7
Commit: 4d05a41b30
Pull-request: https://github.com/SerenityOS/serenity/pull/13772
12 changed files with 297 additions and 180 deletions
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/FileSystem/OpenFileDescription.h>
|
||||
#include <Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/DMI/Table.h>
|
||||
#include <Kernel/KBufferBuilder.h>
|
||||
#include <Kernel/Memory/TypedMapping.h>
|
||||
#include <Kernel/Sections.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<SMBIOSExposedTable> SMBIOSExposedTable::must_create(PhysicalAddress smbios_structure_table, size_t smbios_structure_table_length)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) SMBIOSExposedTable(smbios_structure_table, smbios_structure_table_length));
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT SMBIOSExposedTable::SMBIOSExposedTable(PhysicalAddress smbios_structure_table, size_t smbios_structure_table_length)
|
||||
: BIOSSysFSComponent()
|
||||
, m_smbios_structure_table(smbios_structure_table)
|
||||
, m_smbios_structure_table_length(smbios_structure_table_length)
|
||||
{
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<KBuffer>> SMBIOSExposedTable::try_to_generate_buffer() const
|
||||
{
|
||||
auto dmi_blob = TRY(Memory::map_typed<u8>((m_smbios_structure_table), m_smbios_structure_table_length));
|
||||
return KBuffer::try_create_with_bytes(Span<u8> { dmi_blob.ptr(), m_smbios_structure_table_length });
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue