kv2: initialize memory manager, early pci devices
Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
parent
e5b55a6ba5
commit
a252a3f8e9
58 changed files with 1270 additions and 505 deletions
|
|
@ -1,32 +1,23 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#include <drivers/serial.h>
|
||||
#include <kernel/device.h>
|
||||
#include <kernel/common.h>
|
||||
#include <kernel/slab.h>
|
||||
#include <drivers/serial.h>
|
||||
#include <drivers/tty.h>
|
||||
|
||||
static mem_cache_t *tty_slab;
|
||||
|
||||
static struct tty_serial_ops arch_serial_ops = { .serial_getchar = arch_serial_read, .serial_putchar = arch_serial_write };
|
||||
static struct tty_serial_ops arch_serial_ops = {.serial_getchar = arch_serial_read, .serial_putchar = arch_serial_write};
|
||||
|
||||
struct tty *tty_create(const char *name, dev_t serial_device)
|
||||
struct tty *tty_create(const char *name, void *priv)
|
||||
{
|
||||
struct tty *tty = slab_alloc(tty_slab);
|
||||
|
||||
dev_t tty_device = device_create(tty, DEV_CLASS_TTY, name);
|
||||
|
||||
tty->dev = tty_device;
|
||||
tty->serial_device = serial_device;
|
||||
tty->serial_device_private = device_private_info(serial_device);
|
||||
|
||||
switch (device_class(serial_device)) {
|
||||
case DEV_CLASS_NATIVE_SERIAL:
|
||||
tty->serial_ops = &arch_serial_ops;
|
||||
break;
|
||||
default:
|
||||
kwarn("unknown serial device: %s", name);
|
||||
break;
|
||||
}
|
||||
tty->priv = priv;
|
||||
tty->serial_ops = &arch_serial_ops;
|
||||
|
||||
return tty;
|
||||
}
|
||||
|
|
@ -50,7 +41,7 @@ void tty_write(struct tty *tty, const char *s)
|
|||
|
||||
void tty_layer_init()
|
||||
{
|
||||
tty_slab = slab_create(sizeof(struct tty), 256 * KB, 8);
|
||||
tty_slab = slab_create("tty_layer", sizeof(struct tty), 256 * KB, 8);
|
||||
|
||||
if (!tty_slab) {
|
||||
panic("tty_slab alloc failed\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue