summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-18 21:15:14 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-18 21:15:14 -0400
commit2a6c07a6ad1270319670fbebd190b74a4e9f11e3 (patch)
tree57045471701540f44b16b1ff3638293fbe865a51 /kernel
parentfix compile warnings (diff)
downloadcomus-2a6c07a6ad1270319670fbebd190b74a4e9f11e3.tar.gz
comus-2a6c07a6ad1270319670fbebd190b74a4e9f11e3.tar.bz2
comus-2a6c07a6ad1270319670fbebd190b74a4e9f11e3.zip
more pci devices
Diffstat (limited to 'kernel')
-rw-r--r--kernel/drivers/pci.c8
-rw-r--r--kernel/include/comus/limits.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/kernel/drivers/pci.c b/kernel/drivers/pci.c
index ce2583f..6daba09 100644
--- a/kernel/drivers/pci.c
+++ b/kernel/drivers/pci.c
@@ -1,10 +1,10 @@
#include <comus/drivers/pci.h>
#include <comus/asm.h>
+#include <comus/limits.h>
#include <lib.h>
#define CONF_ADDR 0xCF8
#define CONF_DATA 0xCFC
-#define TABLE_LEN 16
struct pci_table_entry {
struct pci_device device;
@@ -16,7 +16,7 @@ struct pci_table_entry {
uint8_t revision;
};
-static struct pci_table_entry pci_table[TABLE_LEN];
+static struct pci_table_entry pci_table[N_PCI_DEV];
static size_t pci_table_next = 0;
uint32_t pci_rcfg_d(struct pci_device dev, uint8_t offset)
@@ -43,8 +43,8 @@ static void print_device(struct pci_table_entry *entry)
static struct pci_table_entry *load_device(struct pci_device dev)
{
- if (pci_table_next >= TABLE_LEN)
- panic("Too many PCI devices: limit is %d", TABLE_LEN);
+ if (pci_table_next >= N_PCI_DEV)
+ panic("Too many PCI devices: limit is %d", N_PCI_DEV);
struct pci_table_entry *entry = &pci_table[pci_table_next++];
entry->device = dev;
uint32_t dword0 = pci_rcfg_d(dev, 0);
diff --git a/kernel/include/comus/limits.h b/kernel/include/comus/limits.h
index 2942b89..aedb49e 100644
--- a/kernel/include/comus/limits.h
+++ b/kernel/include/comus/limits.h
@@ -9,6 +9,9 @@
/// max number of processes
#define N_PROCS 256
+/// max numer of pci devices
+#define N_PCI_DEV 256
+
/// length of terminal buffer
#define TERM_MAX_WIDTH 480
#define TERM_MAX_HEIGHT 270