topology: system cpu topology

This commit is contained in:
Matheus
2024-10-05 11:32:39 -03:00
parent 8315d5642e
commit 3152d1bc3c
3 changed files with 71 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#ifndef _TOPOLOGY_H
#define _TOPOLOGY_H
#define TOPOLOGY_MAKE_ID(depth, id) ((depth << 16) | id)
#include <arch/cpu.h>
typedef struct topology_node_t {
int id;
struct topology_node_t *parent;
struct topology_node_t *sibling;
struct topology_node_t *children;
cpu_t *cpu;
} topology_node_t;
extern topology_node_t topology_root;
topology_node_t *topology_create_node(void);
void topology_insert(topology_node_t *node, topology_node_t *parent, int id, cpu_t *cpu);
static inline topology_node_t *topology_get_root(void) {
return &topology_root;
}
#endif