summaryrefslogtreecommitdiffhomepage
path: root/Kernel/StorageKit/NVME.hpp
blob: 5d50f8bb8abc70361a9dc106efc60fa808532084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* -------------------------------------------

	Copyright SoftwareLabs

------------------------------------------- */

#pragma once

#include <KernelKit/DeviceManager.hpp>
#include <KernelKit/DriveManager.hxx>
#include <NewKit/OwnPtr.hpp>

namespace NewOS
{
	class NVMEDeviceInterface : public DeviceInterface<MountpointInterface*>
	{
	public:
		explicit NVMEDeviceInterface(void (*Out)(MountpointInterface* outpacket),
									 void (*In)(MountpointInterface* inpacket),
									 void (*Cleanup)(void))
			: DeviceInterface(Out, In), fCleanup(Cleanup)
		{
		}

		virtual ~NVMEDeviceInterface()
		{
			if (fCleanup)
				fCleanup();
		}

	public:
		NVMEDeviceInterface& operator=(const NVMEDeviceInterface&) = default;
		NVMEDeviceInterface(const NVMEDeviceInterface&)			   = default;

		const char* Name() const override;

	public:
		OwnPtr<MountpointInterface*> operator()(UInt32 dmaLow, UInt32 dmaHigh, SizeT sz);

	private:
		void (*fCleanup)(void);
	};
} // namespace NewOS