Max OS 0.3
Loading...
Searching...
No Matches
ide.cpp
Go to the documentation of this file.
1
9#include <drivers/disk/ide.h>
10
11
12using namespace MaxOS;
13using namespace MaxOS::hardwarecommunication;
14using namespace MaxOS::drivers;
15using namespace MaxOS::drivers::disk;
16using namespace MaxOS::filesystem;
17using namespace MaxOS::filesystem::partition;
18
26{
27 // Primary
28 auto primary_maser = new AdvancedTechnologyAttachment(0x1F0, true);
29 auto primary_slave = new AdvancedTechnologyAttachment(0x1F0, false);
30 devices.insert(primary_maser, true);
31 devices.insert(primary_slave, false);
32
33 // Secondary
34 auto secondary_maser = new AdvancedTechnologyAttachment(0x170, true);
35 auto secondary_slave = new AdvancedTechnologyAttachment(0x170, false);
36 devices.insert(secondary_maser, true);
37 devices.insert(secondary_slave, false);
38
39}
40
41IntegratedDriveElectronicsController::~IntegratedDriveElectronicsController() = default;
42
47
48 // Loop through the devices and identify them
49 for (auto &device: devices) {
50
51 // Check if the device is present
52 auto ata_device = device.first;
53 if (ata_device == nullptr)
54 continue;
55
56 // Identify the device
57 bool exists = ata_device->identify();
58
59 // Remove the device if it does not exist
60 if (!exists) {
61 devices.erase(ata_device);
62 delete ata_device;
63 continue;
64 }
65 }
66
67 // Log the init done
68 Logger::DEBUG() << "IDE Controller: Initialised " << devices.size() << " devices\n";
69}
70
75
76 // Loop through the devices and load the partitions
77 for (auto &device: devices) {
78
79 // Ensure there is a device and that it is the master
80 if (device.first == nullptr || !device.second)
81 continue;
82
83 // Mount the device
85
86 }
87}
88
89
96 return "Intel";
97}
98
105 return "PIIX4";
106}
static Logger DEBUG()
Gets active logger set to DEBUG level.
Definition logger.cpp:193
Driver for the ATA controller, handles the reading and writing of data to the hard drive.
Definition ata.h:25
void activate() final
Activate the IDE controller by mounting the devices to the virtual file system.
Definition ide.cpp:74
void initialise() final
Initialise the IDE controller by identifying the devices.
Definition ide.cpp:46
string device_name() final
Get the device name.
Definition ide.cpp:104
IntegratedDriveElectronicsController(hardwarecommunication::PCIDeviceDescriptor *device_descriptor)
Construct a new Integrated Drive Electronics Controller object.
Definition ide.cpp:25
string vendor_name() final
Get the vendor name.
Definition ide.cpp:95
static void mount_partitions(drivers::disk::Disk *disk)
read the partition table of a given hard disk
Definition msdos.cpp:23
Stores information about a PCI device.
Definition pci.h:54
Defines a driver for the Integrated Drive Electronics (IDE) controller.