mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:17:34 +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/Bus/VirtIO/Console.h>
|
||||||
|
#include <Kernel/Devices/DeviceManagement.h>
|
||||||
#include <Kernel/Sections.h>
|
#include <Kernel/Sections.h>
|
||||||
#include <Kernel/WorkQueue.h>
|
#include <Kernel/WorkQueue.h>
|
||||||
|
|
||||||
|
@ -50,10 +51,10 @@ UNMAP_AFTER_INIT void Console::initialize()
|
||||||
if (success) {
|
if (success) {
|
||||||
finish_init();
|
finish_init();
|
||||||
|
|
||||||
if (is_feature_accepted(VIRTIO_CONSOLE_F_MULTIPORT))
|
if (is_feature_accepted(VIRTIO_CONSOLE_F_MULTIPORT)) {
|
||||||
setup_multiport();
|
setup_multiport();
|
||||||
else {
|
} else {
|
||||||
auto port = make_ref_counted<VirtIO::ConsolePort>(0u, *this);
|
auto port = MUST(DeviceManagement::the().try_create_device<VirtIO::ConsolePort>(0u, *this));
|
||||||
port->init_receive_buffer({});
|
port->init_receive_buffer({});
|
||||||
m_ports.append(port);
|
m_ports.append(port);
|
||||||
}
|
}
|
||||||
|
@ -160,13 +161,13 @@ void Console::process_control_message(ControlMessage message)
|
||||||
return;
|
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 {
|
ControlMessage ready_event {
|
||||||
.id = static_cast<u32>(id),
|
.id = static_cast<u32>(id),
|
||||||
.event = (u16)ControlEvent::PortReady,
|
.event = (u16)ControlEvent::PortReady,
|
||||||
.value = (u16)ControlMessage::Status::Success
|
.value = (u16)ControlMessage::Status::Success
|
||||||
};
|
};
|
||||||
|
|
||||||
write_control_message(ready_event);
|
write_control_message(ready_event);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -207,14 +207,7 @@ static void populate_devfs_char_devices()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 229: {
|
case 229: {
|
||||||
switch (minor_number) {
|
create_devfs_char_device(String::formatted("/dev/hvc0p{}", minor_number), 0666, major_number, minor_number);
|
||||||
case 0: {
|
|
||||||
create_devfs_char_device("/dev/hvc0p0", 0666, 229, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
warnln("Unknown character device {}:{}", major_number, minor_number);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 10: {
|
case 10: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue