Compare commits

..

23 Commits

Author SHA1 Message Date
8939edf313
ATA: Mark the CDROM as a block device
All checks were successful
continuous-integration/drone/pr Build is passing
2023-05-26 20:30:54 +02:00
921b5ce360
kernel/ATA: Pass extra information to DeviceRegistry
This is needed since merging e7d482e from main.
2023-05-26 20:30:54 +02:00
4dc8a13058
kernel+init: Create a device node in /dev to access the CDROM from userspace!
Still using PIO, though.
2023-05-26 20:30:54 +02:00
b41fe9d45e
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:30:54 +02:00
6e22d4649f
kernel/x86_64: Implement writing to PCI fields 2023-05-26 20:30:54 +02:00
e864965400
kernel/PCI: Add bit enum for the Command field 2023-05-26 20:30:53 +02:00
74d5e7759f
kernel: Actually register interrupt handlers properly 2023-05-26 20:30:53 +02:00
4d949d48c4
kernel/ATA: Calculate block sizes for ATA devices as well 2023-05-26 20:30:53 +02:00
aaf3934d9a
kernel/ATA: Send a READ CAPACITY packet to an ATA drive on initialization 2023-05-26 20:30:53 +02:00
6854daf673
kernel/ATA: Read the PCI Busmaster registers and start preparing for DMA 2023-05-26 20:30:53 +02:00
3742ae23a1
kernel/ATA: Read the Busmaster base port and verify it 2023-05-26 20:30:53 +02:00
e0c84a0174
kernel: Handle device BARs properly 2023-05-26 20:30:53 +02:00
fc6aa2bb36
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:30:53 +02:00
b578680bf5
kernel/ATA: Implement enough to send an IDENTIFY command and read the model number :) 2023-05-26 20:30:53 +02:00
20a1d16606
kernel/ATA: Handle drive IRQs in compatibility mode 2023-05-26 20:30:53 +02:00
a558c3b2d0
kernel/CPU: Allow passing arbitrary data to interrupt handlers 2023-05-26 20:30:53 +02:00
e22c9a9659
kernel/ATA: Start reading/writing registers and detecting drives 2023-05-26 20:30:52 +02:00
6f02dde85e
kernel: Warn if no ATA controller is found 2023-05-26 20:30:52 +02:00
4aa4cd47e2
kernel: Add a KMutex class and use that for ATA::Controller locking 2023-05-26 20:30:52 +02:00
2d28f03304
kernel/x86_64: Add basic ATA controller and channel identification 2023-05-26 20:30:52 +02:00
c83bf29ef4
kernel/PCI: Add more PCI field types 2023-05-26 20:30:52 +02:00
3ca3a138fc
kernel/x86_64: Add a way to register IRQ handlers from other kernel subsystems 2023-05-26 20:30:52 +02:00
7cdb967730
kernel: compilation fix
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-26 20:30:39 +02:00
3 changed files with 10 additions and 6 deletions

View File

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

View File

@ -286,7 +286,7 @@ namespace VFS
bool is_setuid(SharedPtr<Inode> inode);
bool is_setgid(SharedPtr<Inode> inode);
bool is_seekable(VFS::InodeType type);
bool is_seekable(SharedPtr<Inode> 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));
if (VFS::is_seekable(descriptor.inode->type())) descriptor.offset += nread;
if (VFS::is_seekable(descriptor.inode)) descriptor.offset += nread;
return nread;
}
@ -52,12 +52,11 @@ Result<u64> sys_write(Registers*, SyscallArgs args)
if (!descriptor.is_writable()) return err(EBADF);
if (descriptor.should_append() && VFS::is_seekable(descriptor.inode->type()))
descriptor.offset = descriptor.inode->size();
if (descriptor.should_append() && VFS::is_seekable(descriptor.inode)) descriptor.offset = descriptor.inode->size();
usize nwritten = TRY(descriptor.inode->write(buf, descriptor.offset, size));
if (VFS::is_seekable(descriptor.inode->type())) descriptor.offset += nwritten;
if (VFS::is_seekable(descriptor.inode)) descriptor.offset += nwritten;
return nwritten;
}
@ -74,7 +73,7 @@ Result<u64> sys_lseek(Registers*, SyscallArgs args)
if (descriptor.inode->type() == VFS::InodeType::FIFO) return err(ESPIPE);
if (!VFS::is_seekable(descriptor.inode->type())) return descriptor.offset;
if (!VFS::is_seekable(descriptor.inode)) return descriptor.offset;
off_t new_offset;