Component.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/RefPtr.h>
  8. #include <AK/Types.h>
  9. #include <AK/Vector.h>
  10. #include <Kernel/FileSystem/SysFS/Subsystems/Firmware/Directory.h>
  11. #include <Kernel/KBuffer.h>
  12. #include <Kernel/PhysicalAddress.h>
  13. namespace Kernel {
  14. class BIOSSysFSComponent final : public SysFSComponent {
  15. public:
  16. enum class Type {
  17. DMIEntryPoint,
  18. SMBIOSTable,
  19. };
  20. public:
  21. static NonnullRefPtr<BIOSSysFSComponent> must_create(Type, PhysicalAddress, size_t blob_size);
  22. virtual StringView name() const override;
  23. virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override;
  24. private:
  25. ErrorOr<NonnullOwnPtr<KBuffer>> try_to_generate_buffer() const;
  26. BIOSSysFSComponent(Type, PhysicalAddress, size_t blob_size);
  27. virtual size_t size() const override { return m_blob_length; }
  28. PhysicalAddress const m_blob_paddr;
  29. size_t const m_blob_length { 0 };
  30. Type const m_type { Type::DMIEntryPoint };
  31. };
  32. }