mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 05:44:58 +00:00

To do this we also need to get rid of LockRefPtrs in the USB code as well. Most of the SysFS nodes are statically generated during boot and are not mutated afterwards. The same goes for general device code - once we generate the appropriate SysFS nodes, we almost never mutate the node pointers afterwards, making locking unnecessary.
32 lines
1 KiB
C++
32 lines
1 KiB
C++
/*
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Vector.h>
|
|
#include <Kernel/Bus/PCI/Definitions.h>
|
|
#include <Kernel/FileSystem/SysFS/Component.h>
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Bus/PCI/DeviceDirectory.h>
|
|
|
|
namespace Kernel {
|
|
|
|
class PCIDeviceExpansionROMSysFSComponent : public SysFSComponent {
|
|
public:
|
|
static NonnullRefPtr<PCIDeviceExpansionROMSysFSComponent> create(PCIDeviceSysFSDirectory const& device);
|
|
|
|
virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override;
|
|
virtual ~PCIDeviceExpansionROMSysFSComponent() {};
|
|
|
|
virtual StringView name() const override { return "rom"sv; }
|
|
|
|
protected:
|
|
ErrorOr<NonnullOwnPtr<KBuffer>> try_to_generate_buffer(size_t offset_in_rom, size_t count) const;
|
|
PCIDeviceExpansionROMSysFSComponent(PCIDeviceSysFSDirectory const& device, size_t option_rom_size);
|
|
NonnullRefPtr<PCIDeviceSysFSDirectory> m_device;
|
|
size_t const m_option_rom_size { 0 };
|
|
};
|
|
|
|
}
|