mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
Kernel: Rename SysFS related classes in ACPI code
Give them names that sound related to SysFS.
This commit is contained in:
parent
805319ed30
commit
b1c68dd235
3 changed files with 19 additions and 19 deletions
|
@ -27,12 +27,12 @@ Parser* Parser::the()
|
||||||
return s_acpi_parser;
|
return s_acpi_parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT NonnullRefPtr<ExposedComponent> ExposedComponent::create(String name, PhysicalAddress paddr, size_t table_size)
|
UNMAP_AFTER_INIT NonnullRefPtr<ACPISysFSComponent> ACPISysFSComponent::create(String name, PhysicalAddress paddr, size_t table_size)
|
||||||
{
|
{
|
||||||
return adopt_ref(*new (nothrow) ExposedComponent(name, paddr, table_size));
|
return adopt_ref(*new (nothrow) ACPISysFSComponent(name, paddr, table_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
KResultOr<size_t> ExposedComponent::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, FileDescription*) const
|
KResultOr<size_t> ACPISysFSComponent::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, FileDescription*) const
|
||||||
{
|
{
|
||||||
auto blob = try_to_generate_buffer();
|
auto blob = try_to_generate_buffer();
|
||||||
if (!blob)
|
if (!blob)
|
||||||
|
@ -47,48 +47,48 @@ KResultOr<size_t> ExposedComponent::read_bytes(off_t offset, size_t count, UserO
|
||||||
return nread;
|
return nread;
|
||||||
}
|
}
|
||||||
|
|
||||||
OwnPtr<KBuffer> ExposedComponent::try_to_generate_buffer() const
|
OwnPtr<KBuffer> ACPISysFSComponent::try_to_generate_buffer() const
|
||||||
{
|
{
|
||||||
auto acpi_blob = map_typed<u8>((m_paddr), m_length);
|
auto acpi_blob = map_typed<u8>((m_paddr), m_length);
|
||||||
return KBuffer::try_create_with_bytes(Span<u8> { acpi_blob.ptr(), m_length });
|
return KBuffer::try_create_with_bytes(Span<u8> { acpi_blob.ptr(), m_length });
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT ExposedComponent::ExposedComponent(String name, PhysicalAddress paddr, size_t table_size)
|
UNMAP_AFTER_INIT ACPISysFSComponent::ACPISysFSComponent(String name, PhysicalAddress paddr, size_t table_size)
|
||||||
: SysFSComponent(name)
|
: SysFSComponent(name)
|
||||||
, m_paddr(paddr)
|
, m_paddr(paddr)
|
||||||
, m_length(table_size)
|
, m_length(table_size)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT void ExposedDirectory::initialize()
|
UNMAP_AFTER_INIT void ACPISysFSDirectory::initialize()
|
||||||
{
|
{
|
||||||
auto acpi_folder = adopt_ref(*new (nothrow) ExposedDirectory());
|
auto acpi_folder = adopt_ref(*new (nothrow) ACPISysFSDirectory());
|
||||||
SysFSComponentRegistry::the().register_new_component(acpi_folder);
|
SysFSComponentRegistry::the().register_new_component(acpi_folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT ExposedDirectory::ExposedDirectory()
|
UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory()
|
||||||
: SysFSDirectory("acpi", SysFSComponentRegistry::the().root_folder())
|
: SysFSDirectory("acpi", SysFSComponentRegistry::the().root_folder())
|
||||||
{
|
{
|
||||||
NonnullRefPtrVector<SysFSComponent> components;
|
NonnullRefPtrVector<SysFSComponent> components;
|
||||||
size_t ssdt_count = 0;
|
size_t ssdt_count = 0;
|
||||||
ACPI::Parser::the()->enumerate_static_tables([&](const StringView& signature, PhysicalAddress p_table, size_t length) {
|
ACPI::Parser::the()->enumerate_static_tables([&](const StringView& signature, PhysicalAddress p_table, size_t length) {
|
||||||
if (signature == "SSDT") {
|
if (signature == "SSDT") {
|
||||||
components.append(ExposedComponent::create(String::formatted("{:4s}{}", signature.characters_without_null_termination(), ssdt_count), p_table, length));
|
components.append(ACPISysFSComponent::create(String::formatted("{:4s}{}", signature.characters_without_null_termination(), ssdt_count), p_table, length));
|
||||||
ssdt_count++;
|
ssdt_count++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
components.append(ExposedComponent::create(signature, p_table, length));
|
components.append(ACPISysFSComponent::create(signature, p_table, length));
|
||||||
});
|
});
|
||||||
m_components = components;
|
m_components = components;
|
||||||
|
|
||||||
auto rsdp = map_typed<Structures::RSDPDescriptor20>(ACPI::Parser::the()->rsdp());
|
auto rsdp = map_typed<Structures::RSDPDescriptor20>(ACPI::Parser::the()->rsdp());
|
||||||
m_components.append(ExposedComponent::create("RSDP", ACPI::Parser::the()->rsdp(), rsdp->base.revision == 0 ? sizeof(Structures::RSDPDescriptor) : rsdp->length));
|
m_components.append(ACPISysFSComponent::create("RSDP", ACPI::Parser::the()->rsdp(), rsdp->base.revision == 0 ? sizeof(Structures::RSDPDescriptor) : rsdp->length));
|
||||||
|
|
||||||
auto main_system_description_table = map_typed<Structures::SDTHeader>(ACPI::Parser::the()->main_system_description_table());
|
auto main_system_description_table = map_typed<Structures::SDTHeader>(ACPI::Parser::the()->main_system_description_table());
|
||||||
if (ACPI::Parser::the()->is_xsdt_supported()) {
|
if (ACPI::Parser::the()->is_xsdt_supported()) {
|
||||||
m_components.append(ExposedComponent::create("XSDT", ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length));
|
m_components.append(ACPISysFSComponent::create("XSDT", ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length));
|
||||||
} else {
|
} else {
|
||||||
m_components.append(ExposedComponent::create("RSDT", ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length));
|
m_components.append(ACPISysFSComponent::create("RSDT", ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,23 +17,23 @@
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
namespace ACPI {
|
namespace ACPI {
|
||||||
|
|
||||||
class ExposedDirectory : public SysFSDirectory {
|
class ACPISysFSDirectory : public SysFSDirectory {
|
||||||
public:
|
public:
|
||||||
static void initialize();
|
static void initialize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExposedDirectory();
|
ACPISysFSDirectory();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExposedComponent : public SysFSComponent {
|
class ACPISysFSComponent : public SysFSComponent {
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<ExposedComponent> create(String name, PhysicalAddress, size_t table_size);
|
static NonnullRefPtr<ACPISysFSComponent> create(String name, PhysicalAddress, size_t table_size);
|
||||||
|
|
||||||
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const override;
|
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
OwnPtr<KBuffer> try_to_generate_buffer() const;
|
OwnPtr<KBuffer> try_to_generate_buffer() const;
|
||||||
ExposedComponent(String name, PhysicalAddress, size_t table_size);
|
ACPISysFSComponent(String name, PhysicalAddress, size_t table_size);
|
||||||
|
|
||||||
PhysicalAddress m_paddr;
|
PhysicalAddress m_paddr;
|
||||||
size_t m_length;
|
size_t m_length;
|
||||||
|
|
|
@ -237,7 +237,7 @@ void init_stage2(void*)
|
||||||
USB::UHCIController::detect();
|
USB::UHCIController::detect();
|
||||||
|
|
||||||
BIOSExposedDirectory::initialize();
|
BIOSExposedDirectory::initialize();
|
||||||
ACPI::ExposedDirectory::initialize();
|
ACPI::ACPISysFSDirectory::initialize();
|
||||||
|
|
||||||
VirtIO::detect();
|
VirtIO::detect();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue