diff options
author | Benji Dial <benji6283@gmail.com> | 2020-09-06 00:48:07 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2020-09-06 00:48:07 -0400 |
commit | e8c6577617bffa4402c07c7aa20e3c24f03c1c20 (patch) | |
tree | 2fb9230b62d2344a44453117de9e656892219788 /src/kernel/pci.c | |
parent | 7ff724fe8f709440da9c730fdb8dcbaa4f989ed5 (diff) | |
download | portland-os-e8c6577617bffa4402c07c7aa20e3c24f03c1c20.tar.gz |
program loading, others
big kernel additions: paging, elf loading, separate kernel and user page allocation
it now properly loads and runs sd0:bin/init.elf
still need to determine which disk was booted from, and start the init on that disk
Diffstat (limited to 'src/kernel/pci.c')
-rw-r--r-- | src/kernel/pci.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/kernel/pci.c b/src/kernel/pci.c index 28ca6c6..9e33e49 100644 --- a/src/kernel/pci.c +++ b/src/kernel/pci.c @@ -1,7 +1,7 @@ #include "panic.h" #include "boot.h" #include "util.h" -#include "mem.h" +#include "pmap.h" #include "pci.h" enum { @@ -9,7 +9,7 @@ enum { PCP_READ = 0x0cfc }; -uint16_t n_pci_devices = 0; +uint16_t n_pci_devices; static struct pci_device *pci_device_pages[256]; #define PCI_DEVICES_PER_PAGE (4096 / sizeof(struct pci_device)) @@ -31,7 +31,7 @@ struct pci_device *find_pci_device_from_class_and_subclass(uint8_t class, uint8_ static struct pci_device *next_pci_device() { if (!(n_pci_devices % PCI_DEVICES_PER_PAGE)) - if (!(pci_device_pages[n_pci_devices / PCI_DEVICES_PER_PAGE] = allocate_pages(1))) + if (!(pci_device_pages[n_pci_devices / PCI_DEVICES_PER_PAGE] = allocate_kernel_pages(1))) panic("Out of memory in PCI enumeration"); return nth_pci_device(n_pci_devices++); } @@ -68,6 +68,8 @@ void pci_init() { if (!(BOOT_INFO->pci_hw_char & PHC_CS_M1)) panic("No PCI Mechanism 1 support"); + n_pci_devices = 0; + for (uint32_t number = 0; number < (BOOT_INFO->last_pci_bus + 1) * 256; ++number) pci_device_check(number); }
\ No newline at end of file |