Component.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/Library/LockRefPtr.h>
  13. #include <Kernel/Memory/PhysicalAddress.h>
  14. namespace Kernel {
  15. class BIOSSysFSComponent final : public SysFSComponent {
  16. public:
  17. enum class Type {
  18. DMIEntryPoint,
  19. SMBIOSTable,
  20. };
  21. public:
  22. static NonnullRefPtr<BIOSSysFSComponent> must_create(Type, PhysicalAddress, size_t blob_size);
  23. virtual StringView name() const override;
  24. virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override;
  25. private:
  26. ErrorOr<NonnullOwnPtr<KBuffer>> try_to_generate_buffer() const;
  27. BIOSSysFSComponent(Type, PhysicalAddress, size_t blob_size);
  28. virtual size_t size() const override { return m_blob_length; }
  29. PhysicalAddress const m_blob_paddr;
  30. size_t const m_blob_length { 0 };
  31. Type const m_type { Type::DMIEntryPoint };
  32. };
  33. }