kv2: initialize memory manager, early pci devices

Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
Michael Shaw 2026-05-12 02:59:37 -04:00
commit a252a3f8e9
58 changed files with 1270 additions and 505 deletions

View file

@ -14,12 +14,12 @@ struct dev_info {
static mem_cache_t *dev_info_cache = NULL;
static rbtree device_tree = { 0 };
static rbtree_t device_tree = {0};
dev_t device_create(void *private, dev_class_t class, const char *name)
{
dev_t key = rbt_next_key(&device_tree);
rbnode *node = rbt_insert(&device_tree, key);
rbnode_t *node = rbt_insert(&device_tree, key);
size_t name_len = strlen(name);
@ -36,7 +36,7 @@ dev_t device_create(void *private, dev_class_t class, const char *name)
void device_destroy(dev_t dev)
{
rbnode *dev_node = rbt_search(&device_tree, dev);
rbnode_t *dev_node = rbt_search(&device_tree, dev);
struct dev_info *devinfo = (void *)dev_node->value;
slab_free(dev_info_cache, devinfo);
@ -45,7 +45,7 @@ void device_destroy(dev_t dev)
dev_class_t device_class(dev_t dev)
{
rbnode *dev_node = rbt_search(&device_tree, dev);
rbnode_t *dev_node = rbt_search(&device_tree, dev);
struct dev_info *devinfo = (void *)dev_node->value;
return devinfo->class;
@ -53,7 +53,7 @@ dev_class_t device_class(dev_t dev)
void *device_private_info(dev_t dev)
{
rbnode *dev_node = rbt_search(&device_tree, dev);
rbnode_t *dev_node = rbt_search(&device_tree, dev);
struct dev_info *devinfo = (void *)dev_node->value;
return devinfo->private;
@ -61,7 +61,7 @@ void *device_private_info(dev_t dev)
void device_layer_init()
{
dev_info_cache = slab_create(sizeof(struct dev_info), 16 * KB, 8);
dev_info_cache = slab_create("dev_info_cache", sizeof(struct dev_info), 16 * KB, 8);
if (!dev_info_cache)
panic("dev_info_cache allocation failure!\n");