summaryrefslogtreecommitdiffhomepage
path: root/src/boot/BootKit/Device.h
blob: e54d0bf11f554527e9b9265f0eab727fa381c854 (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
/* ========================================

  Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.

======================================== */

#ifndef __BOOTKIT_DEVICE_H__
#define __BOOTKIT_DEVICE_H__

#include <BootKit/Config.h>
#include <modules/AHCI/AHCI.h>
#include <modules/ATA/ATA.h>

namespace Boot {
/// @brief Physical/Virtual device type.
class Device {
 public:
  explicit Device() = default;
  virtual ~Device() = default;

  NE_MOVE_DEFAULT(Device)

  struct Trait {
    Lba   mBase{0};
    SizeT mSize{0};
  };

  virtual Trait& Leak() = 0;

  virtual Device& Read(Char* Buf, SizeT SecCount)  = 0;
  virtual Device& Write(Char* Buf, SizeT SecCount) = 0;
};

using BootDevice    = Device;
using NetworkDevice = Device;
using DiskDevice    = Device;
}  // namespace Boot

#endif