summaryrefslogtreecommitdiff
path: root/Kernel/Storage/IDEChannel.h
AgeCommit message (Collapse)Author
2021-07-17Kernel: Rename Lock to MutexAndreas Kling
Let's be explicit about what kind of lock this is meant to be.
2021-07-11Kernel: Make various T::class_name() and similar return StringViewAndreas Kling
Instead of returning char const*, we can also give you a StringView.
2021-07-06Kernel: Promote various integers to 64 bits in storage layerJean-Baptiste Boric
2021-06-17Kernel/Interrupts: Return boolean on whether we handled the interruptLiav A
If we are in a shared interrupt handler, the called handlers might indicate it was not their interrupt, so we should not increment the call counter of these handlers.
2021-04-26Kernel/Storage: Make the IDEChannel design more robustLiav A
The overall design is the same, but we change a few things, like decreasing the amount of blocking forever loops. The goal is to ensure the kernel won't hang forever when dealing with buggy hardware. Also, we reset the channel when initializing it, just in case the hardware was in bad state before we start use it.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-03Kernel/Storage: Add support for IDE controllers in PCI native modeLiav A
Also handle native and compatibility channel modes together, so if only one IDE channel was set to work on PCI native mode, we need to handle it separately, so the other channel continue to operate with the legacy IO ports and interrupt line.
2021-03-27Kernel/Storage: Use more locking in the IDE codeLiav A
This change should make it less possible for race conditions to happen and cause fatal errors when accessing the hardware.
2021-03-27Kernel/Storage: Add support for non-bus mastering IDE controllersLiav A
Although unlikely to happen, a user can have an IDE controller that doesn't support bus master capability. If that's the case, we need to check for this, and create an IDEChannel (not BMIDEChannel) to allow IO operations with the controller.
2021-03-27Kernel/Storage: Move IDE bus master handling code into a separate classLiav A
If the user requests to force PIO mode, we just create IDEChannel objects which are capable of sending PIO commands only. However, if the user doesn't force PIO mode, we create BMIDEChannel objects, which are sending DMA commands. This change is somewhat simplifying the code, so each class is supporting its type of operation - PIO or DMA. The PATADiskDevice should not care if DMA is enabled or not. Later on, we could write an IDEChannel class for UDMA modes, that are available and documented on Intel specifications for their IDE controllers.
2021-03-27Kernel: Make IDEChannel Ref-countedLiav A
Technically not supported by the original ATA specification, IDE hot swapping is still in practice possible, so the only sane way to start support it is with ref-counting the IDEChannel object so if we remove a PATADiskDevice, it's not gone with it.
2021-03-17Kernel: Refactor storage stack with u64 as block indexJean-Baptiste Boric
2021-02-05Kernel: Clear pending interrupts before enabling IRQs of IDE ChannelLiav A
Calling detect_disks() can generate interrupts, so we must clear it to allow proper function when booting with kernel argument smp=on.
2021-01-29Kernel/Storage: Rewrite IDE disk detection and disk accessLuke
This replaces the current disk detection and disk access code with code based on https://wiki.osdev.org/IDE This allows the system to boot on VirtualBox with serial debugging enabled and VMWare Player. I believe there were several issues with the current code: - It didn't utilise the last 8 bits of the LBA in 24-bit mode. - {read,write}_sectors_with_dma was not setting the obsolete bits, which according to OSdev wiki aren't used but should be set. - The PIO and DMA methods were using slightly different copy and pasted access code, which is now put into a single function called "ata_access" - PIO mode doesn't work. This doesn't fix that and should be looked into in the future. - The detection code was not checking for ATA/ATAPI. - The detection code accidentally had cyls/heads/spt as 8-bit, when they're 16-bit. - The capabilities of the device were not considered. This is now brought in and is currently used to check if the device supports LBA. If not, use CHS.
2020-12-21Kernel: Add a method to gather the devices count of a Storage controllerLiav A
Also, change device() method to be const.
2020-12-21Kernel: Introduce the new Storage subsystemLiav A
This new subsystem is somewhat replacing the IDE disk code we had with a new flexible design. StorageDevice is a generic class that represent a generic storage device. It is meant that specific storage hardware will override the interface. StorageController is a generic class that represent a storage controller that can be found in a machine. The IDEController class governs two IDEChannels. An IDEChannel is responsible to manage the master & slave devices of the channel, therefore an IDEChannel is an IRQHandler.