mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
Kernel/Storage: Add support for IDE controllers in PCI native mode
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.
This commit is contained in:
parent
627cfe017c
commit
2718d7c74c
6 changed files with 96 additions and 25 deletions
|
@ -49,6 +49,11 @@ UNMAP_AFTER_INIT NonnullRefPtr<IDEChannel> IDEChannel::create(const IDEControlle
|
|||
return adopt(*new IDEChannel(controller, io_group, type));
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<IDEChannel> IDEChannel::create(const IDEController& controller, u8 irq, IOAddressGroup io_group, ChannelType type)
|
||||
{
|
||||
return adopt(*new IDEChannel(controller, irq, io_group, type));
|
||||
}
|
||||
|
||||
RefPtr<StorageDevice> IDEChannel::master_device() const
|
||||
{
|
||||
return m_master;
|
||||
|
@ -59,16 +64,9 @@ RefPtr<StorageDevice> IDEChannel::slave_device() const
|
|||
return m_slave;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT IDEChannel::IDEChannel(const IDEController& controller, IOAddressGroup io_group, ChannelType type)
|
||||
: IRQHandler(type == ChannelType::Primary ? PATA_PRIMARY_IRQ : PATA_SECONDARY_IRQ)
|
||||
, m_channel_type(type)
|
||||
, m_io_group(io_group)
|
||||
, m_parent_controller(controller)
|
||||
UNMAP_AFTER_INIT void IDEChannel::initialize()
|
||||
{
|
||||
disable_irq();
|
||||
|
||||
// FIXME: The device may not be capable of DMA.
|
||||
|
||||
dbgln_if(PATA_DEBUG, "IDEChannel: {} IO base: {}", channel_type_string(), m_io_group.io_base());
|
||||
dbgln_if(PATA_DEBUG, "IDEChannel: {} control base: {}", channel_type_string(), m_io_group.control_base());
|
||||
if (m_io_group.bus_master_base().has_value())
|
||||
|
@ -83,6 +81,24 @@ UNMAP_AFTER_INIT IDEChannel::IDEChannel(const IDEController& controller, IOAddre
|
|||
clear_pending_interrupts();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT IDEChannel::IDEChannel(const IDEController& controller, u8 irq, IOAddressGroup io_group, ChannelType type)
|
||||
: IRQHandler(irq)
|
||||
, m_channel_type(type)
|
||||
, m_io_group(io_group)
|
||||
, m_parent_controller(controller)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT IDEChannel::IDEChannel(const IDEController& controller, IOAddressGroup io_group, ChannelType type)
|
||||
: IRQHandler(type == ChannelType::Primary ? PATA_PRIMARY_IRQ : PATA_SECONDARY_IRQ)
|
||||
, m_channel_type(type)
|
||||
, m_io_group(io_group)
|
||||
, m_parent_controller(controller)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
void IDEChannel::clear_pending_interrupts() const
|
||||
{
|
||||
m_io_group.io_base().offset(ATA_REG_STATUS).in<u8>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue