summaryrefslogtreecommitdiff
path: root/Kernel/Devices
AgeCommit message (Collapse)Author
2020-06-16Kernel: Replace char and u8 data types to u32 for code pointHüseyin ASLITÜRK
Remove character property from event and add code_point property.
2020-06-13Kernel: KeyboardDevice, remove char mapping logicHüseyin ASLITÜRK
Remove char mapping logic and constant character map.
2020-06-03Kernel: Add scancode value to KeyEventHüseyin ASLITÜRK
2020-05-31Kernel: Fix glitched audio output in SB16 driverAndreas Kling
We were not setting the DMA transfer mode correctly. I have absolutely no clue how this could ever have worked, but it did work for months until it suddenly didn't. Anyways, this fixes that. The sound is still a little bit glitchy and that could probably be fixed by using the SB16's auto-initialized mode.
2020-05-29Meta: Add a script check the presence of "#pragma once" in header filesEmanuele Torre
.. and make travis run it. I renamed check-license-headers.sh to check-style.sh and expanded it so that it now also checks for the presence of "#pragma once" in .h files. It also checks the presence of a (single) blank line above and below the "#pragma once" line. I also added "#pragma once" to all the files that need it: even the ones we are not check. I also added/removed blank lines in order to make the script not fail. I also ran clang-format on the files I modified.
2020-05-23Kernel+LibC: Fix various build issues introduced by ssize_tAndreas Kling
Now that ssize_t is derived from size_t, we have to
2020-05-23Kernel: Use a FlatPtr for the "argument" to ioctl()Andreas Kling
Since it's often used to pass pointers, it should really be a FlatPtr.
2020-05-16Kernel: Absorb LibBareMetal back into the kernelAndreas Kling
This was supposed to be the foundation for some kind of pre-kernel environment, but nobody is working on it right now, so let's move everything back into the kernel and remove all the confusion.
2020-05-16Kernel: Let's say that IO::delay(N) delays for N microsecondsAndreas Kling
Supposedly that's how much delay you get when doing I/O on port 0x80.
2020-05-14Build: Switch to CMake :^)Sergey Bugaev
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-02Kernel: Detect 5-button PS/2 mouse if present :^)Andreas Kling
The detection works very similarly to how we detect a mouse wheel, just another magical sequence of "set sample rate" requests to the mouse followed by an ID check.
2020-04-29Kernel: Fix integer overflow in framebuffer resolution handlingAndreas Kling
This made it possible to map the E1000 MMIO range into userspace and mess with the registers. Thanks to @grigoritchy for finding this! Fixes #2015.
2020-04-28Kernel: Add Region helpers for accessing underlying physical pagesAndreas Kling
Since a Region is basically a view into a potentially larger VMObject, it was always necessary to include the Region starting offset when accessing its underlying physical pages. Until now, you had to do that manually, but this patch adds a simple Region::physical_page() for read-only access and a physical_page_slot() when you want a mutable reference to the RefPtr<PhysicalPage> itself. A lot of code is simplified by making use of this.
2020-04-15Kernel: Refuse to set overflowy resolution values in BXVGADeviceAndreas Kling
2020-04-15Kernel: Ensure that we receive IRQs in PIO mode when IOAPIC is enabledLiav A
The IOAPIC manual states that "Interrupt Mask-R/W. When this bit is 1, the interrupt signal is masked. Edge-sensitive interrupts signaled on a masked interrupt pin are ignored." - Therefore we have to ensure that we disable interrupts globally with cli(), but also to ensure that we invoke enable_irq() before sending the hardware command that generates an IRQ almost immediately.
2020-04-15Kernel: Restore ATA PIO functionalityLiav A
First, before this change, specifying 'force_pio' in the kernel commandline was meaningless because we nevertheless set the DMA flag to be enabled. Also, we had a problem in which we used IO::repeated_out16() in PIO write method. This might work on buggy emulators, but I suspect that on real hardware this code will fail. The most difficult problem was to restore the PIO read operation. Apparently, it seems that we can't use IO::repeated_in16() here because it will read zeroed data. Currently we rely on a simple loop that invokes IO::in16() to a buffer. Also, the interrupt handling stage in the PIO read method is moved to be handled inside the loop of reading the requested sectors.
2020-04-11Kernel: Keep records of PCI::Address & PCI::ID pairs for enumerationLiav A
2020-04-11Kernel: Simplify a message in PATAChannel::create()Liav A
2020-04-11Kernel: Assert if we try to initialize VMWareBackdoor more than onceLiav A
2020-04-10Kernel: Add explicit offset parameter to File::read etcConrad Pankoff
2020-04-09Kernel: Allow again to boot with partitioned diskLiav A
This change ensures that we don't return a zero value blindly from DiskPartition write/read methods. Fixes #1719.
2020-04-08Kernel: Simplify VMWareBackdoor somewhatAndreas Kling
- If there is no VMWare backdoor, don't allocate memory for it. - Remove the "unsupported" state, instead just don't instantiate. - Move the command-line parsing from init to the driver. - Move mouse packet reception from PS2MouseDevice to VMWareBackdoor.
2020-04-08Kernel: Make VMWareBackdoor eternal (since it's never freed)Andreas Kling
2020-04-08Kernel: Remove DebugLogDeviceAndreas Kling
This was a cute idea but ultimately it's just not useful since we already have the dbgputch() and dbgputstr() syscalls.
2020-03-28Kernel: Remove the floppy driverAndreas Kling
Nobody was using this code, and it was not actively worked on, so let's just not have it. Press F.
2020-03-23AK: Reduce header dependency graph of String.hAndreas Kling
String.h no longer pulls in StringView.h. We do this by moving a bunch of String functions out-of-line.
2020-03-19Kernel: Delete unnecessary filesLiav A
2020-03-19Kernel: Introduce the new Time management subsystemLiav A
This new subsystem includes better abstractions of how time will be handled in the OS. We take advantage of the existing RTC timer to aid in keeping time synchronized. This is standing in contrast to how we handled time-keeping in the kernel, where the PIT was responsible for that function in addition to update the scheduler about ticks. With that new advantage, we can easily change the ticking dynamically and still keep the time synchronized. In the process context, we no longer use a fixed declaration of TICKS_PER_SECOND, but we call the TimeManagement singleton class to provide us the right value. This allows us to use dynamic ticking in the future, a feature known as tickless kernel. The scheduler no longer does by himself the calculation of real time (Unix time), and just calls the TimeManagment singleton class to provide the value. Also, we can use 2 new boot arguments: - the "time" boot argument accpets either the value "modern", or "legacy". If "modern" is specified, the time management subsystem will try to setup HPET. Otherwise, for "legacy" value, the time subsystem will revert to use the PIT & RTC, leaving HPET disabled. If this boot argument is not specified, the default pattern is to try to setup HPET. - the "hpet" boot argumet accepts either the value "periodic" or "nonperiodic". If "periodic" is specified, the HPET will scan for periodic timers, and will assert if none are found. If only one is found, that timer will be assigned for the time-keeping task. If more than one is found, both time-keeping task & scheduler-ticking task will be assigned to periodic timers. If this boot argument is not specified, the default pattern is to try to scan for HPET periodic timers. This boot argument has no effect if HPET is disabled. In hardware context, PIT & RealTimeClock classes are merely inheriting from the HardwareTimer class, and they allow to use the old i8254 (PIT) and RTC devices, managing them via IO ports. By default, the RTC will be programmed to a frequency of 1024Hz. The PIT will be programmed to a frequency close to 1000Hz. About HPET, depending if we need to scan for periodic timers or not, we try to set a frequency close to 1000Hz for the time-keeping timer and scheduler-ticking timer. Also, if possible, we try to enable the Legacy replacement feature of the HPET. This feature if exists, instructs the chipset to disconnect both i8254 (PIT) and RTC. This behavior is observable on QEMU, and was verified against the source code: https://github.com/qemu/qemu/commit/ce967e2f33861b0e17753f97fa4527b5943c94b6 The HPETComparator class is inheriting from HardwareTimer class, and is responsible for an individual HPET comparator, which is essentially a timer. Therefore, it needs to call the singleton HPET class to perform HPET-related operations. The new abstraction of Hardware timers brings an opportunity of more new features in the foreseeable future. For example, we can change the callback function of each hardware timer, thus it makes it possible to swap missions between hardware timers, or to allow to use a hardware timer for other temporary missions (e.g. calibrating the LAPIC timer, measuring the CPU frequency, etc).
2020-03-19Kernel: Use a const reference to RegisterState in IRQ handlingLiav A
2020-03-19Kernel: Remove unnecessary include from PATAChannel.cppLiav A
2020-03-08Kernel: Add missing #includes now that <AK/StdLibExtras.h> is smallerAndreas Kling
2020-03-06Kernel: Fix syntax errors in PS2MOUSE_DEBUGTibor Nagy
Found with Cppcheck.
2020-03-06Kernel: Simplify a bunch of dbg() and klog() callsAndreas Kling
LogStream can handle VirtualAddress and PhysicalAddress directly.
2020-03-06Kernel: Change HandlerPurpose to HandlerTypeLiav A
Also, GenericInterruptHandler class requires to implement two new methods.
2020-03-06Kernel: Enable IRQs before sending commands to devicesLiav A
Without this fix, a very fast IRQ can preempt the enable_irq() call, leaving that IRQ being unhandled.
2020-03-02Kernel: Use klog() instead of kprintf()Liav A
Also, duplicate data in dbg() and klog() calls were removed. In addition, leakage of virtual address to kernel log is prevented. This is done by replacing kprintf() calls to dbg() calls with the leaked data instead. Also, other kprintf() calls were replaced with klog().
2020-03-02Kernel: Use IOAddress class in PATAChannel classLiav A
This change make the code a bit more readable. Also, kprintf() calls are replaced with klog() calls.
2020-02-28Kernel: Implement basic support for sys$mmap() with MAP_PRIVATEAndreas Kling
You can now mmap a file as private and writable, and the changes you make will only be visible to you. This works because internally a MAP_PRIVATE region is backed by a unique PrivateInodeVMObject instead of using the globally shared SharedInodeVMObject like we always did before. :^) Fixes #1045.
2020-02-28Kernel: Validate changed framebuffer resolutionLiav A
Now we check before we set a FBResolution if the BXVGA device is capable of setting the requested resolution. If not, we revert the resolution to the previous one and return an error to userspace. Fixes #451.
2020-02-27VMWareBackdoor: Use dbg() instead of dbgprintf()Liav A
2020-02-27PS2MouseDevice: Use dbg() instead of dbgprintf()Liav A
2020-02-27KeyboardDevice: Use dbg() instead of dbgprintf()Liav A
2020-02-24Kernel: Change get_pci_address() to pci_address() in PCI::Device classLiav A
The Serenity Coding Style tends to not accept the word "get" in methods' names if possible.
2020-02-24Kernel: Update SB16 driver to use the new IRQHandler classLiav A
Also, add methods to allow changing of IRQ line in the SB16 card.
2020-02-24Kernel: Include the new PIT class in system componentsLiav A
2020-02-24Kernel: Update PATAChannel implementation to use the PIT classLiav A
Also, update the class implementation to use PCI::Device class accordingly. The create() helper will now search for an IDE controller in the PCI bus, allowing to simplify the initialize() method.
2020-02-24Kernel: Update PATAChannel class to use the PCI::Device classLiav A
PATAChannel class will inherit from the PCI::Device class, thus, can still implement IRQ handling.
2020-02-24Kernel: Update system components to use the new IRQHandler classLiav A
2020-02-24Kernel: Introduce the PIT classLiav A
The PIT class inherits from HardwareTimer class, and is replacing the PIT namespace.
2020-02-24Kernel: Add HardwareTimer classLiav A
This is an abstraction layer for future hardware timers that will be implemented.