1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

Revert "Kernel: Move Kernel mapping to 0xc0000000"

This reverts commit bd33c66273.

This broke the network card drivers, since they depended on kmalloc
addresses being identity-mapped.
This commit is contained in:
Andreas Kling 2019-11-23 17:27:09 +01:00
parent f61ed8eab5
commit 9a157b5e81
13 changed files with 64 additions and 132 deletions

View file

@ -116,13 +116,11 @@ void PATAChannel::initialize(bool force_pio)
kprintf("PATAChannel: PATA Controller found! id=%w:%w\n", id.vendor_id, id.device_id);
}
});
m_prdt_page = MM.allocate_supervisor_physical_page();
m_force_pio.resource() = false;
if (!m_pci_address.is_null()) {
// Let's try to set up DMA transfers.
PCI::enable_bus_mastering(m_pci_address);
prdt().end_of_table = 0x8000;
m_prdt.end_of_table = 0x8000;
m_bus_master_base = PCI::get_BAR4(m_pci_address) & 0xfffc;
m_dma_buffer_page = MM.allocate_supervisor_physical_page();
kprintf("PATAChannel: Bus master IDE: I/O @ %x\n", m_bus_master_base);
@ -261,16 +259,16 @@ bool PATAChannel::ata_read_sectors_with_dma(u32 lba, u16 count, u8* outbuf, bool
disable_irq();
prdt().offset = m_dma_buffer_page->paddr();
prdt().size = 512 * count;
m_prdt.offset = m_dma_buffer_page->paddr();
m_prdt.size = 512 * count;
ASSERT(prdt().size <= PAGE_SIZE);
ASSERT(m_prdt.size <= PAGE_SIZE);
// Stop bus master
IO::out8(m_bus_master_base, 0);
// Write the PRDT location
IO::out32(m_bus_master_base + 4, (u32)&prdt());
IO::out32(m_bus_master_base + 4, (u32)&m_prdt);
// Turn on "Interrupt" and "Error" flag. The error flag should be cleared by hardware.
IO::out8(m_bus_master_base + 2, IO::in8(m_bus_master_base + 2) | 0x6);
@ -340,18 +338,18 @@ bool PATAChannel::ata_write_sectors_with_dma(u32 lba, u16 count, const u8* inbuf
disable_irq();
prdt().offset = m_dma_buffer_page->paddr();
prdt().size = 512 * count;
m_prdt.offset = m_dma_buffer_page->paddr();
m_prdt.size = 512 * count;
memcpy(m_dma_buffer_page->paddr().as_ptr(), inbuf, 512 * count);
ASSERT(prdt().size <= PAGE_SIZE);
ASSERT(m_prdt.size <= PAGE_SIZE);
// Stop bus master
IO::out8(m_bus_master_base, 0);
// Write the PRDT location
IO::out32(m_bus_master_base + 4, (u32)&prdt());
IO::out32(m_bus_master_base + 4, (u32)&m_prdt);
// Turn on "Interrupt" and "Error" flag. The error flag should be cleared by hardware.
IO::out8(m_bus_master_base + 2, IO::in8(m_bus_master_base + 2) | 0x6);