Compare commits

..

21 Commits

Author SHA1 Message Date
176864f623
kernel/ATA: Pass extra information to DeviceRegistry
Some checks failed
continuous-integration/drone/pr Build is failing
This is needed since merging e7d482e from main.
2023-05-26 20:28:21 +02:00
1e586ee982
kernel+init: Create a device node in /dev to access the CDROM from userspace!
Still using PIO, though.
2023-05-26 20:28:21 +02:00
35c96024d4
kernel/ATA: Read the CDROM's first sector using ATAPI PIO!!
Sadly, for some reason, DMA is not working right now.
This is a problem, as PIO is inconvenient. But hey, it works for now!
2023-05-26 20:28:21 +02:00
9653497051
kernel/x86_64: Implement writing to PCI fields 2023-05-26 20:28:21 +02:00
39a713333d
kernel/PCI: Add bit enum for the Command field 2023-05-26 20:28:21 +02:00
52cbcb627f
kernel: Actually register interrupt handlers properly 2023-05-26 20:28:21 +02:00
d55edf77cd
kernel/ATA: Calculate block sizes for ATA devices as well 2023-05-26 20:28:20 +02:00
e60b8cfdf0
kernel/ATA: Send a READ CAPACITY packet to an ATA drive on initialization 2023-05-26 20:28:20 +02:00
0483f38038
kernel/ATA: Read the PCI Busmaster registers and start preparing for DMA 2023-05-26 20:28:20 +02:00
1722b995c9
kernel/ATA: Read the Busmaster base port and verify it 2023-05-26 20:28:20 +02:00
5afe1ec3a6
kernel: Handle device BARs properly 2023-05-26 20:28:20 +02:00
2c239f7d19
kernel/ATA: Read ATA strings properly instead of backwards
Now we can see the model string. What does it say...

"QEMU DVD-ROM". Let's go!
2023-05-26 20:28:20 +02:00
6fb25e2499
kernel/ATA: Implement enough to send an IDENTIFY command and read the model number :) 2023-05-26 20:28:20 +02:00
2ab3860d04
kernel/ATA: Handle drive IRQs in compatibility mode 2023-05-26 20:28:20 +02:00
a35c8d74fb
kernel/CPU: Allow passing arbitrary data to interrupt handlers 2023-05-26 20:28:20 +02:00
9422b8c878
kernel/ATA: Start reading/writing registers and detecting drives 2023-05-26 20:28:20 +02:00
1c4a26a381
kernel: Warn if no ATA controller is found 2023-05-26 20:28:19 +02:00
01489a12d9
kernel: Add a KMutex class and use that for ATA::Controller locking 2023-05-26 20:28:19 +02:00
5eaacd7b29
kernel/x86_64: Add basic ATA controller and channel identification 2023-05-26 20:28:19 +02:00
249453ac3f
kernel/PCI: Add more PCI field types 2023-05-26 20:28:19 +02:00
260c86e22c
kernel/x86_64: Add a way to register IRQ handlers from other kernel subsystems 2023-05-26 20:28:19 +02:00
3 changed files with 6 additions and 10 deletions

View File

@ -296,11 +296,6 @@ class ATADevice : public Device
return false; return false;
} }
bool is_block_device() const override
{
return true;
}
usize size() const override usize size() const override
{ {
return m_drive->capacity(); return m_drive->capacity();

View File

@ -286,7 +286,7 @@ namespace VFS
bool is_setuid(SharedPtr<Inode> inode); bool is_setuid(SharedPtr<Inode> inode);
bool is_setgid(SharedPtr<Inode> inode); bool is_setgid(SharedPtr<Inode> inode);
bool is_seekable(SharedPtr<Inode> inode); bool is_seekable(VFS::InodeType type);
Inode& root_inode(); Inode& root_inode();

View File

@ -33,7 +33,7 @@ Result<u64> sys_read(Registers*, SyscallArgs args)
usize nread = TRY(descriptor.inode->read(buf, descriptor.offset, size)); usize nread = TRY(descriptor.inode->read(buf, descriptor.offset, size));
if (VFS::is_seekable(descriptor.inode)) descriptor.offset += nread; if (VFS::is_seekable(descriptor.inode->type())) descriptor.offset += nread;
return nread; return nread;
} }
@ -52,11 +52,12 @@ Result<u64> sys_write(Registers*, SyscallArgs args)
if (!descriptor.is_writable()) return err(EBADF); if (!descriptor.is_writable()) return err(EBADF);
if (descriptor.should_append() && VFS::is_seekable(descriptor.inode)) descriptor.offset = descriptor.inode->size(); if (descriptor.should_append() && VFS::is_seekable(descriptor.inode->type()))
descriptor.offset = descriptor.inode->size();
usize nwritten = TRY(descriptor.inode->write(buf, descriptor.offset, size)); usize nwritten = TRY(descriptor.inode->write(buf, descriptor.offset, size));
if (VFS::is_seekable(descriptor.inode)) descriptor.offset += nwritten; if (VFS::is_seekable(descriptor.inode->type())) descriptor.offset += nwritten;
return nwritten; return nwritten;
} }
@ -73,7 +74,7 @@ Result<u64> sys_lseek(Registers*, SyscallArgs args)
if (descriptor.inode->type() == VFS::InodeType::FIFO) return err(ESPIPE); if (descriptor.inode->type() == VFS::InodeType::FIFO) return err(ESPIPE);
if (!VFS::is_seekable(descriptor.inode)) return descriptor.offset; if (!VFS::is_seekable(descriptor.inode->type())) return descriptor.offset;
off_t new_offset; off_t new_offset;