Get the PCI driver working

This commit is contained in:
pjht 2020-08-30 09:45:27 -05:00
parent 2337e70876
commit 520563d1b6
5 changed files with 8 additions and 12 deletions

View File

@ -36,7 +36,7 @@ debug: os.iso kernel/kernel.elf
gdb
#gdbgui -g i386-elf-gdb --project $(CWD)
os.iso: kernel/kernel.elf init vfs devfs vga_drv initrd_drv tar_fs sysroot/usr/share/man # vfs devfs initrd vga_drv initrd_drv pci
os.iso: kernel/kernel.elf init vfs devfs vga_drv initrd_drv tar_fs pci sysroot/usr/share/man # vfs devfs initrd vga_drv initrd_drv pci
@cp kernel/kernel.elf sysroot/boot
@cd initrd; tar -f ../sysroot/boot/initrd.tar -c *
@grub-mkrescue -o $@ sysroot >/dev/null 2>/dev/null

View File

@ -134,4 +134,6 @@ int main() {
char str[64];
fgets(str,64,file);
printf("Read %s from /initrd/hi\n", str);
serial_print("Loading PCI driver\n");
posix_spawn(NULL,"/initrd/pci",NULL,NULL,NULL,NULL);
}

View File

@ -2,13 +2,6 @@
#include <stdio.h>
int main() {
FILE* file;
do {
file=fopen("/dev/vga","w");
} while(file==NULL);
do {
file=fopen("/dev/vga","w");
} while(file==NULL);
yield();
stdout=fopen("/dev/vga","w");
pci_init();
}

View File

@ -1,5 +1,5 @@
#include "pci.h"
#include <sys/ports.h>
#include <cpu/ports.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,6 +1,7 @@
#ifndef PCI_H
#define PCI_H
#include <stddef.h>
#include <stdint.h>
#define PCI_CONFIG_ADDRESS 0xCF8
@ -67,9 +68,9 @@ typedef enum {
} pci_class;
extern pci_dev_common_info** pci_devs;
extern uint32_t pci_num_devs;
extern size_t pci_num_devs;
pci_dev_common_info* pci_get_dev_info(uint8_t bus,uint8_t device,uint8_t func);
pci_dev_common_info* pci_get_dev_info(int bus,int device,int func);
void pci_set_dev_info(pci_dev_common_info* inf);
void pci_init();