summaryrefslogtreecommitdiff
path: root/Kernel/Devices
AgeCommit message (Collapse)Author
2019-10-14Kernel: Remove unused FileBackedDiskDevice classAndreas Kling
2019-10-07PartitionTable: Removing unnecessary declarations from GPT & MBR classessupercomputer7
2019-10-07PartitionTable: Initial GPT Support, Adding Block Limitsupercomputer7
Also added a script to handle creation of GPT partitioned disk (with GRUB config file). Block limit will be used to disallow potential access to other partitions.
2019-10-02BXVGADevice: Log a debug message whenever the resolution changesAndreas Kling
Fixes #618.
2019-09-30MBVGADevice: Log address/pitch/width/height when createdAndreas Kling
2019-09-30ByteBuffer: Remove pointer() in favor of data()Andreas Kling
We had two ways to get the data inside a ByteBuffer. That was silly.
2019-09-06AK: Rename <AK/AKString.h> to <AK/String.h>Andreas Kling
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
2019-09-04Kernel: Fix wrong I/O ports for the ATA alternate status registersAndreas Kling
The alternate status register is not part of the same set of registers as all the other stuff. Also rename wait_400ns() to io_delay() since we had no guarantee that it was waiting for 400ns..
2019-09-04Kernel: Remove unused gunk from PATADiskDeviceAndreas Kling
2019-08-29Kernel: Fixed FDC motor_enable()Jesse Buhagiar
Motor Enable now selects the correct drive. The ternary operations were backwards. QEMU doesn't care (obviously) but on a real PC, the drive doesn't actually ever get selected...
2019-08-26Kernel: Display virtual addresses as V%p instead of L%xAndreas Kling
The L was a leftover from when these were called linear addresses.
2019-08-21Kernel: Move DiskDevice::block_size() up to BlockDeviceAndreas Kling
All block devices should have a block size, after all. This defaults to PAGE_SIZE if no size is specified.
2019-08-18Kernel: Move device lookup to Device class itselfSergey Bugaev
Previously, VFS stored a list of all devices, and devices had to register and unregister themselves with it. This cleans up things a bit.
2019-08-18Kernel: Implement generic VGA device using multiboot infoConrad Pankoff
This implements a very basic VGA device using the information provided to us by the bootloader in the multiboot header. This allows Serenity to boot to the desktop on basically any halfway modern system.
2019-08-18Kernel: Implement generic framebuffer ioctls in BXVGAConrad Pankoff
This also hides some functions that were previously public, since that same functionality is now exposed via ioctl functions.
2019-08-17FloppyDiskDevice: Fixed hang on wait_for_irq() (#458)Jesse
It turns out that the `SenseInterrupt` command is actually very important! The system hangs if it's not there! Whoops...!
2019-08-17Kernel: Expose info about source devices of mounts in /proc/dfSergey Bugaev
2019-08-17ProcFS: Do not assume there is one of itSergey Bugaev
The complication is around /proc/sys/ variables, which were attached to inodes. Now they're their own thing, and the corresponding inodes are lazily created (as all other ProcFS inodes are) and simply refer to them by index.
2019-08-12Kernel: Don't forward hijacked keypresses in keyboard driverConrad Pankoff
2019-08-12Kernel: Fix non-DMA writes to IDE drivesConrad Pankoff
Our logic for using the ATA_CMD_CACHE_FLUSH functionality was a bit wrong, and now it's better. The ATA spec says these two things: > The device shall enter the interrupt pending state when: > 1) any command except a PIO data-in command reaches command completion > successfully; > ... > The device shall exit the interrupt pending state when: > 1) the device is selected, BSY is cleared to zero, and the Status > register is read; This means that our sequence of actions was probably never going to work. We were waiting in a loop checking the status register until it left the busy state, _then_ waiting for an interrupt. Unfortunately by checking the status register, we were _clearing_ the interrupt we were about to wait for. Now we just wait for the interrupt - we don't poll the status register at all. This also means that once we get our `wait_for_irq` method sorted out we'll spend a bunch less CPU time waiting for things to complete.
2019-08-12Kernel: Use established device name and number for framebufferConrad Pankoff
This is to prepare for other framebuffer implementations, for which it would be inappropriate to use the /dev/bxvga device name.
2019-08-12Kernel: Allow boot without mouse attached by checking for presenceConrad Pankoff
2019-08-11Kernel: Clean up some PATA log messagesConrad Pankoff
2019-08-11Kernel: Fix PATA reads without DMAConrad Pankoff
Apparently we need to poll the drive for its status after each sector we read if we're not doing DMA. Previously we only did it at the start, which resulted in every sector after the first in a batch having 12 bytes of garbage on the end. This manifested as silent read corruption.
2019-08-10Kernel: Hack the default keymap to support UK pipe/backslashAndreas Kling
Since this key number doesn't appear to collide with anything on the US keymap, I was thinking we could get away with supporting a hybrid US/UK keymap. :^)
2019-08-07Kernel: Split VMObject into two classes: Anonymous- and InodeVMObjectAndreas Kling
InodeVMObject is a VMObject with an underlying Inode in the filesystem. AnonymousVMObject has no Inode. I'm happy that InodeVMObject::inode() can now return Inode& instead of VMObject::inode() return Inode*. :^)
2019-08-07DiskDevice: Add missing override and remove unnecessary class_name()Andreas Kling
This class needs to be fixed up to not hide the read()/write() virtuals at some point.
2019-08-02Kernel: mount system call (#396)Jesse
It is now possible to mount ext2 `DiskDevice` devices under Serenity on any folder in the root filesystem. Currently any user can do this with any permissions. There's a fair amount of assumptions made here too, that might not be too good, but can be worked on in the future. This is a good start to allow more dynamic operation under the OS itself. It is also currently impossible to unmount and such, and devices will fail to mount in Linux as the FS 'needs to be cleaned'. I'll work on getting `umount` done ASAP to rectify this (as well as working on less assumption-making in the mount syscall. We don't want to just be able to mount DiskDevices!). This could probably be fixed with some `-t` flag or something similar.
2019-07-28Kernel: Expand PATA driver to support multiple hard drives (#365)Jesse
The previous implementation of the PIIX3/4 PATA/IDE channel driver only supported a single drive, as the object model was wrong (the channel inherits the IRQ, not the disk drive itself). This fixes it by 'attaching' two `PATADiskDevices` to a `PATAChannel`, which makes more sense. The reading/writing code is presented as is, which violates the spec outlined by Seagate in the linked datasheet. That spec is rather old, so it might not be 100% up to date, though may cause issues on real hardware, so until we can actually test it, this will suffice.
2019-07-20Thread: Return a result from block() indicating why the block terminatedRobin Burchell
And use this to return EINTR in various places; some of which we were not handling properly before. This might expose a few bugs in userspace, but should be more compatible with other POSIX systems, and is certainly a little cleaner.
2019-07-19Kernel: Restore state strings for block statesRobin Burchell
"Blocking" is not terribly informative, but now that everything is ported over, we can force the blocker to provide us with a reason. This does mean that to_string(State) needed to become a member, but that's OK.
2019-07-18Kernel: Remove unnecessary use of LibDraw.Andreas Kling
BXVGADevice was using a Size object for its framebuffer size. We shouldn't be pulling in userspace code in the kernel like this, even if it's just headers. :^)
2019-07-18LibDraw: Introduce (formerly known as SharedGraphics.)Andreas Kling
Instead of LibGUI and WindowServer building their own copies of the drawing and graphics code, let's it in a separate LibDraw library. This avoids building the code twice, and will encourage better separation of concerns. :^)
2019-07-17Kernel: Initial FDC Device Driver (#315)Jesse
A basic Floppy Disk Controller device driver for any system later than (and including) the IBM AT. The driver is based on the documentation supplied by QEMU, which is the datasheet for the Intel 82078 Floppy Disk controller (found here: https://wiki.qemu.org/images/f/f0/29047403.pdf) Naturally, floppy disks are a _very_ outdated storage medium, however, as Serenity is a throwback to aesthetic 90s computing, it's a definite must have. Not to mention that there are still a lot of floppy disks around, with countless petabytes of software on them, so it would be nice if people could create images of said disks with serenity. The code for this is mostly clean. however there are a LOT of values specified in the datasheet, so some of them might be wrong, not to mention that the actual specification itself is rather dirt and seemingly hacked together. I'm also only supporting 3.5" floppy disks, without PIO polling (DMA only), so if you want anything more/less than 1.44MB HD Floppys, you'll have to do it yourself.
2019-07-16Kernel: Remove use of [[gnu::pure]].Andreas Kling
I was messing around with this to tell the compiler that these functions always return the same value no matter how many times you call them. It doesn't really seem to improve code generation and it looks weird so let's just get rid of it.
2019-07-16IDEDiskDevice: Remove superstitious memory_barrier().Andreas Kling
2019-07-14SB16: Set "m_interrupted" to false before enabling IRQ's.Andreas Kling
Otherwise, we might get interrupted before entering wait_for_irq() and then resetting the flag again.
2019-07-14Kernel: Add Thread::block_until(Condition).Andreas Kling
Replace the class-based snooze alarm mechanism with a per-thread callback. This makes it easy to block the current thread on an arbitrary condition: void SomeDevice::wait_for_irq() { m_interrupted = false; current->block_until([this] { return m_interrupted; }); } void SomeDevice::handle_irq() { m_interrupted = true; } Use this in the SB16 driver, and in NetworkTask :^)
2019-07-13SB16: Write the correct DMA buffer offset for 16-bit samples.Andreas Kling
Also switch to using single-cycle mode for now. It would be nice to add support for auto-initialized mode but this works okay at the moment.
2019-07-13SB16: IRQ handler should send 0xd5 to pause 16-bit playback.Andreas Kling
We were sending 0xd0 to pause 8-bit playback. Not sure if this actually makes any difference but it seems like the correct thing to do. Also update 'm_interrupted' *after* handling things.
2019-07-13SB16: Use a snooze alarm to block the current thread while playing.Andreas Kling
2019-07-13SB16: Put debug spam behind SB16_DEBUG.Andreas Kling
2019-07-13SB16: Use Stereo samples by default.Andreas Kling
2019-07-13SB16: Send (sample count, less 1) to the DSP, not the number of bytes.Andreas Kling
This worked fine when we were using 8-bit samples but broke on 16-bit.
2019-07-13SB16: Switch to signed 16-bit 44100 Hz Mono by default.Andreas Kling
We should switch to Stereo but I'm having some trouble with that locally.. Since we intend to mix everything through SoundServer, let's just put the card into 16-bit mode right away.
2019-07-13Kernel: First cut of a sb16 driverRobin Burchell
Also add an AudioServer that (right now) doesn't do much. It tries to open, parse, and play a wav file. In the future, it can do more. My general thinking here here is that /dev/audio will be "owned" by AudioServer, and we'll do mixing in software before passing buffers off to the kernel to play, but we have to start somewhere.
2019-07-11Kernel: Remove use of copy_ref() in favor of regular RefPtr copies.Andreas Kling
This is obviously more readable. If we ever run into a situation where ref count churn is actually causing trouble in the future, we can deal with it then. For now, let's keep it simple. :^)
2019-07-09Kernel: Move PhysicalAddress.h into VM/Andreas Kling
2019-07-09Kernel: Move VirtualAddress.h into VM/Andreas Kling
2019-07-09Kernel: Move File.{cpp,h} into FileSystem/Andreas Kling
Also tweak the kernel's Makefile to use -nostdinc and -nostdinc++. This prevents us from picking up random headers from ../Root, which may include older versions of kernel headers. Since we still need <initializer_list> for Vector, we specifically include the necessary GCC path. This is a bit hackish but it works for now.