Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::drivers::disk::IntegratedDriveElectronicsController Class Reference

Driver for the IDE controller, handles the creation and management of the IDE devices. More...

#include <ide.h>

Inheritance diagram for MaxOS::drivers::disk::IntegratedDriveElectronicsController:
MaxOS::drivers::Driver

Public Member Functions

 IntegratedDriveElectronicsController (hardwarecommunication::PCIDeviceDescriptor *device_descriptor)
 Construct a new Integrated Drive Electronics Controller object.
 
void initialise () final
 Initialise the IDE controller by identifying the devices.
 
void activate () final
 Activate the IDE controller by mounting the devices to the virtual file system.
 
string vendor_name () final
 Get the vendor name.
 
string device_name () final
 Get the device name.
 
- Public Member Functions inherited from MaxOS::drivers::Driver
virtual void deactivate ()
 Deactivate the driver.
 
virtual uint32_t reset ()
 Reset the driver.
 

Detailed Description

Driver for the IDE controller, handles the creation and management of the IDE devices.

Definition at line 25 of file ide.h.

Constructor & Destructor Documentation

◆ IntegratedDriveElectronicsController()

IntegratedDriveElectronicsController::IntegratedDriveElectronicsController ( hardwarecommunication::PCIDeviceDescriptor device_descriptor)
explicit

Construct a new Integrated Drive Electronics Controller object.

Parameters
device_descriptorThe PCI device descriptor for this controller
Todo:
Use the device descriptor to get the port base and add the devices dynamically

Definition at line 25 of file ide.cpp.

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}
Driver for the ATA controller, handles the reading and writing of data to the hard drive.
Definition ata.h:25

Member Function Documentation

◆ activate()

void IntegratedDriveElectronicsController::activate ( )
finalvirtual

Activate the IDE controller by mounting the devices to the virtual file system.

Reimplemented from MaxOS::drivers::Driver.

Definition at line 74 of file ide.cpp.

74 {
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}
static void mount_partitions(drivers::disk::Disk *disk)
read the partition table of a given hard disk
Definition msdos.cpp:23

References MaxOS::filesystem::partition::MSDOSPartition::mount_partitions().

◆ device_name()

string IntegratedDriveElectronicsController::device_name ( )
finalvirtual

Get the device name.

Returns
The device name

Reimplemented from MaxOS::drivers::Driver.

Definition at line 104 of file ide.cpp.

104 {
105 return "PIIX4";
106}

◆ initialise()

void IntegratedDriveElectronicsController::initialise ( )
finalvirtual

Initialise the IDE controller by identifying the devices.

Reimplemented from MaxOS::drivers::Driver.

Definition at line 46 of file ide.cpp.

46 {
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}
static Logger DEBUG()
Gets active logger set to DEBUG level.
Definition logger.cpp:193

References MaxOS::Logger::DEBUG().

◆ vendor_name()

string IntegratedDriveElectronicsController::vendor_name ( )
finalvirtual

Get the vendor name.

Returns
The vendor name

Reimplemented from MaxOS::drivers::Driver.

Definition at line 95 of file ide.cpp.

95 {
96 return "Intel";
97}

The documentation for this class was generated from the following files: