mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Kernel: Register Virtio console ports with device management
Previously, Virtio console ports would not show up in `/sys/dev/char/`. Also adds support to `SystemServer` to create more than one console port device in `/dev/` in the multiport case.
This commit is contained in:
parent
2565f458d1
commit
e187207610
2 changed files with 7 additions and 13 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <Kernel/Bus/VirtIO/Console.h>
|
||||
#include <Kernel/Devices/DeviceManagement.h>
|
||||
#include <Kernel/Sections.h>
|
||||
#include <Kernel/WorkQueue.h>
|
||||
|
||||
|
@ -50,10 +51,10 @@ UNMAP_AFTER_INIT void Console::initialize()
|
|||
if (success) {
|
||||
finish_init();
|
||||
|
||||
if (is_feature_accepted(VIRTIO_CONSOLE_F_MULTIPORT))
|
||||
if (is_feature_accepted(VIRTIO_CONSOLE_F_MULTIPORT)) {
|
||||
setup_multiport();
|
||||
else {
|
||||
auto port = make_ref_counted<VirtIO::ConsolePort>(0u, *this);
|
||||
} else {
|
||||
auto port = MUST(DeviceManagement::the().try_create_device<VirtIO::ConsolePort>(0u, *this));
|
||||
port->init_receive_buffer({});
|
||||
m_ports.append(port);
|
||||
}
|
||||
|
@ -160,13 +161,13 @@ void Console::process_control_message(ControlMessage message)
|
|||
return;
|
||||
}
|
||||
|
||||
m_ports.at(id) = make_ref_counted<VirtIO::ConsolePort>(id, *this);
|
||||
m_ports.at(id) = MUST(DeviceManagement::the().try_create_device<VirtIO::ConsolePort>(id, *this));
|
||||
|
||||
ControlMessage ready_event {
|
||||
.id = static_cast<u32>(id),
|
||||
.event = (u16)ControlEvent::PortReady,
|
||||
.value = (u16)ControlMessage::Status::Success
|
||||
};
|
||||
|
||||
write_control_message(ready_event);
|
||||
});
|
||||
|
||||
|
|
|
@ -207,14 +207,7 @@ static void populate_devfs_char_devices()
|
|||
break;
|
||||
}
|
||||
case 229: {
|
||||
switch (minor_number) {
|
||||
case 0: {
|
||||
create_devfs_char_device("/dev/hvc0p0", 0666, 229, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
warnln("Unknown character device {}:{}", major_number, minor_number);
|
||||
}
|
||||
create_devfs_char_device(String::formatted("/dev/hvc0p{}", minor_number), 0666, major_number, minor_number);
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue