Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosa.DeviceDriver: remove pointless XML comments #1209

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 3 additions & 166 deletions Source/Mosa.DeviceDriver/ISA/IDEController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public class IDEController : BaseDeviceDriver, IDiskControllerDevice
{
#region Definitions

/// <summary>
/// IDE Command
/// </summary>
private struct IDECommand
{
internal const byte ReadSectorsWithRetry = 0x20;
Expand All @@ -41,9 +38,6 @@ private struct StatusRegister
internal const byte Error = 1 << 0;
}

/// <summary>
/// Identify Drive
/// </summary>
private struct IdentifyDrive
{
internal const uint GeneralConfig = 0x00;
Expand All @@ -64,70 +58,11 @@ private struct IdentifyDrive

#endregion Definitions

/// <summary>
/// The drives per controller
/// </summary>
public const uint DrivesPerController = 2; // The maximum supported

/// <summary>
/// The data port
/// </summary>
private IOPortReadWrite dataPort;

/// <summary>
/// The feature port
/// </summary>
private IOPortReadWrite featurePort;

/// <summary>
/// The error port
/// </summary>
private IOPortRead errorPort;

/// <summary>
/// The sector count port
/// </summary>
private IOPortReadWrite sectorCountPort;

/// <summary>
/// The lba low port
/// </summary>
private IOPortReadWrite lbaLowPort;

/// <summary>
/// The lba mid port
/// </summary>
private IOPortReadWrite lbaMidPort;

/// <summary>
/// The lba high port
/// </summary>
private IOPortReadWrite lbaHighPort;

/// <summary>
/// The device head port
/// </summary>
private IOPortReadWrite deviceHeadPort;

/// <summary>
/// The status port
/// </summary>
private IOPortRead statusPort;

/// <summary>
/// The command port
/// </summary>
private IOPortWrite commandPort;

/// <summary>
/// The bus control register port
/// </summary>
private IOPortWrite controlPort;

/// <summary>
/// The status port
/// </summary>
private IOPortRead altStatusPort;
private IOPortReadWrite dataPort, featurePort, sectorCountPort, lbaLowPort, lbaMidPort, lbaHighPort, deviceHeadPort;
private IOPortRead errorPort, statusPort, altStatusPort;
private IOPortWrite commandPort, controlPort;

private enum AddressingMode
{
Expand All @@ -142,30 +77,13 @@ private enum SectorOperation
Write
}

/// <summary>
/// Drive Info
/// </summary>
private struct DriveInfo
{
/// <summary>
/// The present
/// </summary>
public bool Present;

/// <summary>
/// The maximum lba
/// </summary>
public uint MaxLBA;

/// <summary>
/// The lba type
/// </summary>
public AddressingMode AddressingMode;
}

/// <summary>
/// The drive information
/// </summary>
private readonly DriveInfo[] driveInfo = new DriveInfo[DrivesPerController];

public override void Initialize()
Expand Down Expand Up @@ -266,16 +184,8 @@ private void DoIdentifyDrive(byte index)
driveInfo[index].AddressingMode = aMode;
}

/// <summary>
/// Called when an interrupt is received.
/// </summary>
/// <returns></returns>
public override bool OnInterrupt() => true;

/// <summary>
/// Waits for register ready.
/// </summary>
/// <returns>True if the drive is ready.</returns>
private bool WaitForReadyStatus()
{
byte status;
Expand All @@ -290,10 +200,6 @@ private bool WaitForReadyStatus()
// TODO: Timeout -> return false
}

/// <summary>
/// Waits for the selected drive to send the identify data.
/// </summary>
/// <returns>True if the data is received, False if an error ocurred.</returns>
private bool WaitForIdentifyData()
{
byte status;
Expand All @@ -306,25 +212,12 @@ private bool WaitForIdentifyData()
return (status & StatusRegister.Error) != StatusRegister.Error;
}

/// <summary>
/// Send a CacheFlush (0xE7) command to the selected drive.
/// </summary>
/// <returns>True if the cache flush command is successful, false if not.</returns>
private bool DoCacheFlush()
{
commandPort.Write8(0xE7);
return WaitForReadyStatus();
}

/// <summary>
/// Performs the LBA28.
/// </summary>
/// <param name="operation">The operation.</param>
/// <param name="drive">The drive NBR.</param>
/// <param name="lba">The lba.</param>
/// <param name="data">The data.</param>
/// <param name="offset">The offset.</param>
/// <returns></returns>
private bool PerformLBA28(SectorOperation operation, uint drive, uint lba, byte[] data, uint offset)
{
if (drive >= MaximumDriveCount || !driveInfo[drive].Present)
Expand Down Expand Up @@ -362,15 +255,6 @@ private bool PerformLBA28(SectorOperation operation, uint drive, uint lba, byte[
return true;
}

/// <summary>
/// Reads the LBA48.
/// </summary>
/// <param name="operation">The operation.</param>
/// <param name="drive">The drive.</param>
/// <param name="lba">The lba.</param>
/// <param name="data">The data.</param>
/// <param name="offset">The offset.</param>
/// <returns></returns>
private bool PerformLBA48(SectorOperation operation, uint drive, uint lba, byte[] data, uint offset)
{
if (drive >= MaximumDriveCount || !driveInfo[drive].Present)
Expand Down Expand Up @@ -422,57 +306,18 @@ private bool PerformLBA48(SectorOperation operation, uint drive, uint lba, byte[

#region IDiskControllerDevice

/// <summary>
/// Gets the maximum drive count.
/// </summary>
/// <value>The drive count.</value>
public uint MaximumDriveCount { get; private set; }

/// <summary>
/// Opens the specified drive.
/// </summary>
/// <param name="drive">The drive.</param>
/// <returns></returns>
public bool Open(uint drive) => drive < MaximumDriveCount && driveInfo[drive].Present;

/// <summary>
/// Releases the specified drive.
/// </summary>
/// <param name="drive">The drive.</param>
/// <returns></returns>
public bool Release(uint drive) => true;

/// <summary>
/// Gets the size of the sector.
/// </summary>
/// <param name="drive">The drive NBR.</param>
/// <returns></returns>
public uint GetSectorSize(uint drive) => 512;

/// <summary>
/// Gets the total sectors.
/// </summary>
/// <param name="drive">The drive NBR.</param>
/// <returns></returns>
public uint GetTotalSectors(uint drive) => drive >= MaximumDriveCount || !driveInfo[drive].Present ? 0 : driveInfo[drive].MaxLBA;

/// <summary>
/// Determines whether this instance can write to the specified drive.
/// </summary>
/// <param name="drive">The drive NBR.</param>
/// <returns>
/// <c>true</c> if this instance can write to the specified drive; otherwise, <c>false</c>.
/// </returns>
public bool CanWrite(uint drive) => true; // TODO

/// <summary>
/// Reads the block.
/// </summary>
/// <param name="drive">The drive NBR.</param>
/// <param name="block">The block.</param>
/// <param name="count">The count.</param>
/// <param name="data">The data.</param>
/// <returns></returns>
public bool ReadBlock(uint drive, uint block, uint count, byte[] data)
{
if (drive >= MaximumDriveCount || !driveInfo[drive].Present)
Expand Down Expand Up @@ -506,14 +351,6 @@ public bool ReadBlock(uint drive, uint block, uint count, byte[] data)
}
}

/// <summary>
/// Writes the block.
/// </summary>
/// <param name="drive">The drive NBR.</param>
/// <param name="block">The block.</param>
/// <param name="count">The count.</param>
/// <param name="data">The data.</param>
/// <returns></returns>
public bool WriteBlock(uint drive, uint block, uint count, byte[] data)
{
if (drive >= MaximumDriveCount || !driveInfo[drive].Present)
Expand Down
14 changes: 0 additions & 14 deletions Source/Mosa.DeviceDriver/ISA/ISABus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private void StartDevices()
{
HAL.DebugWriteLine("ISABus:StartDevices()");

// Start ISA Drivers
var drivers = DeviceService.GetDeviceDrivers(DeviceBusType.ISA);

foreach (var driver in drivers)
Expand Down Expand Up @@ -58,19 +57,6 @@ private void StartDevice(ISADeviceDriverRegistryEntry driverEntry)
if (driverEntry.BaseAddress != 0x00)
memoryRegions.Add(new AddressRegion(new Pointer(driverEntry.BaseAddress), driverEntry.AddressRange));

//if (driverEntry.PhysicalMemory != null)
//{
// foreach (var physicalMemory in driver.PhysicalMemory)
// {
// if (physicalMemory.MemorySize > 0)
// {
// var memory = HAL.AllocateMemory(physicalMemory.MemorySize, physicalMemory.MemoryAlignment);

// memoryRegions.Add(new MemoryRegion(memory.Address, memory.Size));
// }
// }
//}

var hardwareResources = new HardwareResources(ioPortRegions, memoryRegions, driverEntry.IRQ);
DeviceService.Initialize(driverEntry, Device, true, null, hardwareResources);
}
Expand Down
Loading
Loading