1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

Merge branch 'pci' into shell

This commit is contained in:
Adrien Bourmault 2020-02-20 08:46:46 +01:00
commit cffb941feb
No known key found for this signature in database
GPG Key ID: AFEE5788AEE3F4EC
64 changed files with 167 additions and 115 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
*.c linguist-language=C
*.h linguist-language=C

12
.github/FUNDING.yml vendored
View File

@ -1,12 +0,0 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: os-k-team
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -38,11 +38,13 @@ ASM=nasm
LD=x86_64-elf-ld LD=x86_64-elf-ld
OBJCOPY=x86_64-elf-objcopy OBJCOPY=x86_64-elf-objcopy
CCNAME=x86_64-elf-gcc CCNAME=x86_64-elf-gcc
# Flags
ASMFLAGS=-f elf64 ASMFLAGS=-f elf64
LDFLAGS=-melf_x86_64 LDFLAGS=-melf_x86_64
COPTIM=-O2 COPTIM=-O2
CWARNS=-Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror=implicit-function-declaration -Werror=return-type #-Wpadded CWARNS=-Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror=implicit-function-declaration -Werror=return-type #-Wpadded
CINCLUDES=-Iinclude CINCLUDES=-Iinclude -Iinclude/drivers -Iinclude/kernel
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-all -fdump-rtl-expand CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-all -fdump-rtl-expand
CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2 CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2
CFLAGS= $(CFLAGS1) $(CFLAGS2) CFLAGS= $(CFLAGS1) $(CFLAGS2)
@ -50,12 +52,15 @@ CFLAGS_MATHS= $(CFLAGS1) -c -mno-red-zone -mno-mmx
ifeq ($(mode), release) ifeq ($(mode), release)
CFLAGS += -D_NO_DEBUG CFLAGS += -D_NO_DEBUG
CFLAGS_MATHS += -D_NO_DEBUG
dep += dust dep += dust
endif endif
ifeq ($(mode), debug) ifeq ($(mode), debug)
CFLAGS += -g CFLAGS += -g
CFLAGS_MATHS += -g
endif endif
# GCC
KCC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES) \ KCC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES) \
-D_OSK_SOURCE -D_KALEID_KERNEL -D_OSK_SOURCE -D_KALEID_KERNEL
@ -66,7 +71,6 @@ KCC_MATHS=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS_MATHS) $(CINCLUDES) \
MBRDIR=boot/grub MBRDIR=boot/grub
LOADERDIR=boot/loader LOADERDIR=boot/loader
KALEIDDIR=kaleid KALEIDDIR=kaleid
INCLUDEDIR=include
OBJDIR=build/obj OBJDIR=build/obj
KOBJDIR=build/obj/kaleid KOBJDIR=build/obj/kaleid
LOBJDIR=build/obj/boot LOBJDIR=build/obj/boot
@ -113,14 +117,25 @@ KernSources = kernel/ke/cpuid.c kernel/mm/paging.c \
kernel/ke/rtc.c kernel/io/keyb.c \ kernel/ke/rtc.c kernel/io/keyb.c \
kernel/io/spkr.c kernel/po/shtdwn.c \ kernel/io/spkr.c kernel/po/shtdwn.c \
kernel/sh/shell.c kernel/sh/shcmds.c \ kernel/sh/shell.c kernel/sh/shcmds.c \
kernel/sh/musage.c kernel/io/ata.c \ kernel/sh/musage.c kernel/sh/argv.c \
kernel/sh/argv.c kernel/ke/pit.c \ kernel/ke/pit.c kernel/sh/testcmds.c \
kernel/sh/testcmds.c kernel/mm/palloc.c \ kernel/mm/palloc.c kernel/io/acpi.c \
kernel/io/acpi.c kernel/io/pci.c kernel/io/pci.c
KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources)) KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources))
KernDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(KernSources)) KernDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(KernSources))
# Drivers sources
DriverSources = drivers/ata.c
DriverObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(DriverSources))
DriverDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(DriverSources))
-include $(LibCDep)
-include $(KernDep)
-include $(DriverDep)
## MISC MAKEFILE ------------------------------------------------------------- # ## MISC MAKEFILE ------------------------------------------------------------- #
./ProjectTree: ./.stylehlp_sh ./ProjectTree: ./.stylehlp_sh
@ -137,17 +152,14 @@ wc:
@cat $(shell find -name *.[ch]) $(shell find -name *.asm) $(shell find -name *.inc) | wc -l @cat $(shell find -name *.[ch]) $(shell find -name *.asm) $(shell find -name *.inc) | wc -l
egypt: CFLAGS := -DNDEBUG $(filter-out -fstack-protector-all,$(CFLAGS)) egypt: CFLAGS := -DNDEBUG $(filter-out -fstack-protector-all,$(CFLAGS))
egypt: dust $(LibCObj) $(KernObj) egypt: dust $(LibCObj) $(KernObj) $(DriverObj)
@find -name '*.expand' -o -name '*.expand' | xargs cat > rtl_exp.out @find -name '*.expand' -o -name '*.expand' | xargs cat > rtl_exp.out
@egypt < rtl_exp.out | dot -Tps -o osk-graph.ps @egypt < rtl_exp.out | dot -Tps -o osk-graph.ps
@rm -f rtl_exp.out @rm -f rtl_exp.out
@evince osk-graph.ps & @evince osk-graph.ps &
## LIB C MAKEFILE ------------------------------------------------------------ # ## LIB C MAKEFILE ------------------------------------------------------------ #
-include $(LibCDep)
$(KOBJDIR)/libc/atoi.o: $(KALEIDDIR)/libc/atoi.c | $(KOBJDIR) $(KOBJDIR)/libc/atoi.o: $(KALEIDDIR)/libc/atoi.c | $(KOBJDIR)
@mkdir -p $(shell dirname $@) @mkdir -p $(shell dirname $@)
@$(KCC) -D_NEED_ATOI $< -o $@.1 @$(KCC) -D_NEED_ATOI $< -o $@.1
@ -174,9 +186,7 @@ $(KOBJDIR)/libc/mem.o: $(KALEIDDIR)/libc/mem.c | $(KOBJDIR)
@echo ${CL2}[$@] ${CL}Compiled.${CL3} @echo ${CL2}[$@] ${CL}Compiled.${CL3}
## KERNEL MAKEFILE ----------------------------------------------------------- # ## KERNEL SPECIAL RECIPES MAKEFILE ------------------------------------------- #
-include $(KernDep)
$(KOBJDIR)/kernel/ke/idt.o: $(KALEIDDIR)/kernel/ke/idt.c \ $(KOBJDIR)/kernel/ke/idt.o: $(KALEIDDIR)/kernel/ke/idt.c \
$(KALEIDDIR)/kernel/ke/isr.asm | $(KOBJDIR) $(KALEIDDIR)/kernel/ke/isr.asm | $(KOBJDIR)
@ -219,15 +229,17 @@ $(KOBJDIR)/kernel/mm/gdt.o: $(KALEIDDIR)/kernel/mm/gdt.c \
@rm -f $@.1 $@.2 @rm -f $@.1 $@.2
@echo ${CL2}[$@] ${CL}Compiled.${CL3} @echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/io/ata.o: $(KALEIDDIR)/kernel/io/ata.c \ ## DRIVERS SPECIAL RECIPES MAKEFILE ------------------------------------------ #
$(KALEIDDIR)/kernel/io/ata.asm | $(KOBJDIR)
$(KOBJDIR)/drivers/ata.o: $(KALEIDDIR)/drivers/ata.c $(KALEIDDIR)/drivers/ata.asm | $(KOBJDIR)
@mkdir -p $(shell dirname $@) @mkdir -p $(shell dirname $@)
@$(ASM) $(ASMFLAGS) $(KALEIDDIR)/kernel/io/ata.asm -o $@.1 @$(ASM) $(ASMFLAGS) $(KALEIDDIR)/drivers/ata.asm -o $@.1
@$(KCC) $< -o $@.2 @$(KCC) $< -o $@.2
@$(LD) $(LDFLAGS) -r $@.1 $@.2 -o $@ @$(LD) $(LDFLAGS) -r $@.1 $@.2 -o $@
@rm -f $@.1 $@.2 @rm -f $@.1 $@.2
@echo ${CL2}[$@] ${CL}Compiled.${CL3} @echo ${CL2}[$@] ${CL}Compiled.${CL3}
## DEPENDENCIES MAKEFILE ----------------------------------------------------- # ## DEPENDENCIES MAKEFILE ----------------------------------------------------- #
$(KOBJDIR)/%.d: %.c | $(KOBJDIR) $(KOBJDIR)/%.d: %.c | $(KOBJDIR)
@ -235,7 +247,6 @@ $(KOBJDIR)/%.d: %.c | $(KOBJDIR)
@$(KCC) -MM -MT $(@:%.d=%.o) -MF $@ $< @$(KCC) -MM -MT $(@:%.d=%.o) -MF $@ $<
@echo ${CL2}[$@] ${CL}Dependencies generated.${CL3} @echo ${CL2}[$@] ${CL}Dependencies generated.${CL3}
## MAIN MAKEFILE ------------------------------------------------------------- # ## MAIN MAKEFILE ------------------------------------------------------------- #
$(KOBJDIR)/%.o: %.c | $(KOBJDIR) $(KOBJDIR)/%.o: %.c | $(KOBJDIR)
@ -246,14 +257,16 @@ $(KOBJDIR)/%.o: %.c | $(KOBJDIR)
$(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64 $(BINDIR)/kaleid: $(LOBJDIR)/kaleid.x86_64
@echo ${CL2}[$@] ${NC}Objcopy...${CL3} @echo ${CL2}[$@] ${NC}Objcopy...${CL3}
@mkdir -p $(shell dirname $@) @mkdir -p $(shell dirname $@)
@$(OBJCOPY) -I elf64-x86-64 -O elf32-i386 $(LOBJDIR)/kaleid.x86_64 $(BINDIR)/kaleid @$(OBJCOPY) -I elf64-x86-64 -O elf32-i386 $(LOBJDIR)/kaleid.x86_64 \
$(BINDIR)/kaleid
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}
$(LOBJDIR)/kaleid.x86_64: $(LibCObj) $(KernObj) $(LOBJDIR)/loader.o $(BUILDDIR)/kernel.ld $(LOBJDIR)/kaleid.x86_64: $(LibCObj) $(KernObj) $(DriverObj) \
$(LOBJDIR)/loader.o $(BUILDDIR)/kernel.ld
@echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3} @echo ${CL2}[$@] ${NC}Linking kernel objects...${CL3}
@mkdir -p $(shell dirname $@) @mkdir -p $(shell dirname $@)
@$(LD) $(LDFLAGS) -T $(BUILDDIR)/kernel.ld \ @$(LD) $(LDFLAGS) -T $(BUILDDIR)/kernel.ld \
$(LOBJDIR)/loader.o $(KernObj) $(LibCObj) \ $(LOBJDIR)/loader.o $(KernObj) $(DriverObj) $(LibCObj) \
-o $(LOBJDIR)/kaleid.x86_64 -o $(LOBJDIR)/kaleid.x86_64
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}

View File

@ -47,48 +47,52 @@
│   ├── install-os-k.sh │   ├── install-os-k.sh
│   └── kernel.ld │   └── kernel.ld
├── include ├── include
│   ├── ex │   ├── drivers
│   │   ├── lock.h │   │   └── ata.h
│   │   └── malloc.h │   ├── kernel
│   ├── init │   │   ├── ex
│   │   ├── boot.h │   │   │   ├── lock.h
│   │   └── mboot.h │   │   │   └── malloc.h
│   ├── io │   │   ├── init
│   │   ├── acpi.h │   │   │   ├── boot.h
│   │   ├── ata.h │   │   │   └── mboot.h
│   │   ├── cursor.h │   │   ├── io
│   │   ├── keyb.h │   │   │   ├── acpi.h
│   │   ├── pci.h │   │   │   ├── cursor.h
│   │   ├── spkr.h │   │   │   ├── keyb.h
│   │   └── vga.h │   │   │   ├── pci.h
│   ├── ke │   │   │   ├── spkr.h
│   │   ├── cpuid.h │   │   │   └── vga.h
│   │   ├── idt.h │   │   ├── ke
│   │   ├── proc.h │   │   │   ├── cpuid.h
│   │   ├── sched.h │   │   │   ├── idt.h
│   │   ├── spinlock.h │   │   │   ├── proc.h
│   │   └── time.h │   │   │   ├── sched.h
│   ├── lib │   │   │   ├── spinlock.h
│   │   ├── buf.h │   │   │   └── time.h
│   │   └── list.h │   │   ├── mm
│   ├── mm │   │   │   ├── gdt.h
│   │   ├── gdt.h │   │   │   ├── heap.h
│   │   ├── heap.h │   │   │   ├── malloc.h
│   │   ├── malloc.h │   │   │   ├── map.h
│   │   ├── map.h │   │   │   ├── paging.h
│   │   ├── paging.h │   │   │   └── palloc.h
│   │   └── palloc.h │   │   ├── po
│   ├── po │   │   │   └── shtdwn.h
│   │   └── shtdwn.h │   │   └── sh
│   ├── sh
│   │   ├── argv.h │   │   ├── argv.h
│   │   └── shell.h │   │   └── shell.h
│   ├── asm.h │   ├── asm.h
│   ├── errno.h │   ├── errno.h
│   ├── kernel.h │   ├── kernel.h
│   ├── libbuf.h
│   ├── libc.h │   ├── libc.h
│   ├── liblist.h
│   └── vers.h │   └── vers.h
├── kaleid ├── kaleid
│   ├── drivers
│   │   ├── ata.asm
│   │   └── ata.c
│   ├── kernel │   ├── kernel
│   │   ├── init │   │   ├── init
│   │   │   ├── info.c │   │   │   ├── info.c
@ -97,8 +101,6 @@
│   │   │   └── table.c │   │   │   └── table.c
│   │   ├── io │   │   ├── io
│   │   │   ├── acpi.c │   │   │   ├── acpi.c
│   │   │   ├── ata.asm
│   │   │   ├── ata.c
│   │   │   ├── cursor.c │   │   │   ├── cursor.c
│   │   │   ├── keyb.c │   │   │   ├── keyb.c
│   │   │   ├── pci.c │   │   │   ├── pci.c
@ -164,4 +166,4 @@
├── ProjectTree ├── ProjectTree
└── README.md └── README.md
28 directories, 111 files 30 directories, 111 files

Binary file not shown.

View File

@ -35,11 +35,18 @@
// //
// Device registers offsets // Device registers offsets
// //
#define PCI_REG_VENDOR 0 #define PCI_REG_VENDOR 0x00
#define PCI_REG_DEVICE 2 #define PCI_REG_DEVICE 0x02
#define PCI_REG_COMMAND 4 #define PCI_REG_COMMAND 0x04
#define PCI_REG_STATUS 6 #define PCI_REG_STATUS 0x06
//.. #define PCI_REG_REVISION 0x08
#define PCI_REG_PROGIF 0x09
#define PCI_REG_SUBCLASS 0x0A
#define PCI_REG_CLASS 0x0B
#define PCI_REG_CACHE_LINE_SIZE 0x0C
#define PCI_REG_LATENCY_TIMER 0x0D
#define PCI_REG_HEADER_TYPE 0x0E
#define PCI_REG_BIST 0x0F
#define PCI_REG_BAR0 0x10 #define PCI_REG_BAR0 0x10
#define PCI_REG_BAR1 0x14 #define PCI_REG_BAR1 0x14
#define PCI_REG_BAR2 0x18 #define PCI_REG_BAR2 0x18
@ -57,6 +64,10 @@
struct PciDev_t { struct PciDev_t {
ushort vendorID; ushort vendorID;
ushort deviceID; ushort deviceID;
uchar classID;
uchar subclassID;
void* configAddr; void* configAddr;
}; };
@ -66,6 +77,7 @@ struct PciDev_t {
void IoInitPCI(); void IoInitPCI();
void IoPciEnumerate(); void IoPciEnumerate();
PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID); PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID);
PciDev_t *IoPciGetDeviceByClass(uchar classID, uchar subclassID);
uchar IoPciReadConfigByte(PciDev_t *device, ushort offset); uchar IoPciReadConfigByte(PciDev_t *device, ushort offset);
ushort IoPciReadConfigWord(PciDev_t *device, ushort offset); ushort IoPciReadConfigWord(PciDev_t *device, ushort offset);

View File

@ -27,7 +27,7 @@
#endif #endif
#ifndef _LIB_LIST_H #ifndef _LIB_LIST_H
#include <lib/list.h> #include <liblist.h>
#endif #endif
#ifndef _KALKERN_PROC_H #ifndef _KALKERN_PROC_H

View File

@ -27,7 +27,7 @@
#endif #endif
#ifndef _LIB_LIST_H #ifndef _LIB_LIST_H
#include <lib/list.h> #include <liblist.h>
#endif #endif
#ifndef _MM_MALLOC_H #ifndef _MM_MALLOC_H

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <io/ata.h> #include <drivers/ata.h>
#include <io/vga.h> #include <io/vga.h>
void IoDumpFirstSector(void) void IoDumpFirstSector(void)

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#include <io/keyb.h> #include <io/keyb.h>
#include <ke/idt.h> #include <ke/idt.h>

View File

@ -27,6 +27,7 @@
#include <mm/paging.h> #include <mm/paging.h>
static void *pciConfigBaseAddress = NULL; static void *pciConfigBaseAddress = NULL;
static MCFG_t *MCFG_table = NULL;
// -------------------------------------------------------------------------- // // -------------------------------------------------------------------------- //
@ -114,8 +115,11 @@ void IoPciEnumerate()
for(uchar device = 0; device < 32; device++) { for(uchar device = 0; device < 32; device++) {
for(uchar function = 0; function < 8; function++) { for(uchar function = 0; function < 8; function++) {
ushort vendor = pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR); ushort vendor = pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR);
if(bus * device * function > MCFG_table->length) break;
if(vendor == 0xffff) continue; if(vendor == 0xffff) continue;
DebugLog("PCI device vendor: %x, device: %x\n", DebugLog("PCI device class: %x, subclass: %x, vendor: %x, device: %x\n",
pciReadConfigByte((uchar)bus, device, function, PCI_REG_CLASS),
pciReadConfigByte((uchar)bus, device, function, PCI_REG_SUBCLASS),
vendor, vendor,
pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE) pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE)
); );
@ -136,9 +140,38 @@ PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID)
for(uchar function = 0; function < 8; function++) { for(uchar function = 0; function < 8; function++) {
if(vendorID == pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR) if(vendorID == pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR)
&& deviceID == pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE)) { && deviceID == pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE)) {
if(bus * device * function > MCFG_table->length) break;
PciDev_t *pciDevicePtr = (PciDev_t *)malloc(sizeof(PciDev_t)); PciDev_t *pciDevicePtr = (PciDev_t *)malloc(sizeof(PciDev_t));
pciDevicePtr->vendorID = vendorID; pciDevicePtr->vendorID = vendorID;
pciDevicePtr->deviceID = deviceID; pciDevicePtr->deviceID = deviceID;
pciDevicePtr->classID = pciReadConfigByte((uchar)bus, device, function, PCI_REG_CLASS);
pciDevicePtr->subclassID = pciReadConfigByte((uchar)bus, device, function, PCI_REG_SUBCLASS);
pciDevicePtr->configAddr = pciGetConfigAddr((uchar)bus, device, function, 0);
return pciDevicePtr;
}
}
}
}
return NULL;
}
PciDev_t *IoPciGetDeviceByClass(uchar classID, uchar subclassID)
{
if(pciConfigBaseAddress == NULL) {
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
return NULL;
}
for(ushort bus = 0; bus < 256; bus++) {
for(uchar device = 0; device < 32; device++) {
for(uchar function = 0; function < 8; function++) {
if(classID == pciReadConfigByte((uchar)bus, device, function, PCI_REG_CLASS)
&& subclassID == pciReadConfigByte((uchar)bus, device, function, PCI_REG_SUBCLASS)) {
PciDev_t *pciDevicePtr = (PciDev_t *)malloc(sizeof(PciDev_t));
pciDevicePtr->vendorID = pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR);
pciDevicePtr->deviceID = pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE);
pciDevicePtr->classID = classID;
pciDevicePtr->subclassID = subclassID;
pciDevicePtr->configAddr = pciGetConfigAddr((uchar)bus, device, function, 0); pciDevicePtr->configAddr = pciGetConfigAddr((uchar)bus, device, function, 0);
return pciDevicePtr; return pciDevicePtr;
} }
@ -150,21 +183,23 @@ PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID)
void IoInitPCI() void IoInitPCI()
{ {
MCFG_t *MCFG_table = (MCFG_t*)IoGetAcpiTable(SDT_MCFG); MCFG_table = (MCFG_t*)IoGetAcpiTable(SDT_MCFG);
if(MCFG_table == NULL) { if(MCFG_table == NULL) {
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n"); KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
} }
pciConfigBaseAddress = MCFG_table->pciConfigBaseAddress; pciConfigBaseAddress = MCFG_table->pciConfigBaseAddress;
DebugLog("PCI Config Base address = 0x%p\n", pciConfigBaseAddress); DebugLog("PCI Config Base address = 0x%p\n", pciConfigBaseAddress);
IoPciEnumerate();
// Give R/W access to the configuration space // Give R/W access to the configuration space
int maxI = (256 * 32 * 8 * 4096) / KPAGESIZE; int maxI = (MCFG_table->length) / KPAGESIZE; // More secure,
for(int i=0; i < maxI; i++) for(int i=0; i < maxI; i++)
{ {
// XXX verify that page is marked busy
MmMapPage((void *)((ulong)pciConfigBaseAddress + i * KPAGESIZE), MmMapPage((void *)((ulong)pciConfigBaseAddress + i * KPAGESIZE),
(void *)((ulong)pciConfigBaseAddress + i * KPAGESIZE), (void *)((ulong)pciConfigBaseAddress + i * KPAGESIZE),
PRESENT | READWRITE); PRESENT | READWRITE);
} }
IoPciEnumerate();
} }

View File

@ -24,7 +24,7 @@
#include <io/spkr.h> #include <io/spkr.h>
#include <ke/time.h> #include <ke/time.h>
#include <lib/buf.h> #include <libbuf.h>
extern bool KeIdtIsInitialized; extern bool KeIdtIsInitialized;

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#include <init/boot.h> #include <init/boot.h>
#include <io/cursor.h> #include <io/cursor.h>
#include <io/vga.h> #include <io/vga.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#include <init/boot.h> #include <init/boot.h>
#include <ke/idt.h> #include <ke/idt.h>
#include <io/vga.h> #include <io/vga.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#include <kernel.h> #include <kernel.h>
#include <ke/time.h> #include <ke/time.h>
#include <io/vga.h> #include <io/vga.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#include <ke/proc.h> #include <ke/proc.h>
#include <io/vga.h> #include <io/vga.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#include <ke/time.h> #include <ke/time.h>
#include <ke/idt.h> #include <ke/idt.h>
#include <ke/sched.h> #include <ke/sched.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#include <ke/time.h> #include <ke/time.h>
#include <ke/idt.h> #include <ke/idt.h>

View File

@ -29,7 +29,7 @@
#include <mm/heap.h> #include <mm/heap.h>
#include <mm/paging.h> #include <mm/paging.h>
#include <mm/map.h> #include <mm/map.h>
#include <lib/buf.h> #include <libbuf.h>
#include <io/vga.h> #include <io/vga.h>
#include <ke/time.h> #include <ke/time.h>

View File

@ -29,7 +29,7 @@
#include <mm/palloc.h> #include <mm/palloc.h>
#include <mm/map.h> #include <mm/map.h>
#include <io/vga.h> #include <io/vga.h>
#include <lib/buf.h> #include <libbuf.h>
#include <ke/time.h> #include <ke/time.h>
//--------- //---------

View File

@ -25,7 +25,7 @@
#include <asm.h> #include <asm.h>
#include <ke/proc.h> #include <ke/proc.h>
#include <ke/sched.h> #include <ke/sched.h>
#include <lib/list.h> #include <liblist.h>
#include <ke/time.h> #include <ke/time.h>
bool PsInitialized = false; bool PsInitialized = false;

View File

@ -25,11 +25,11 @@
#include <vers.h> #include <vers.h>
#include <mm/paging.h> #include <mm/paging.h>
#include <mm/map.h> #include <mm/map.h>
#include <io/ata.h> #include <drivers/ata.h>
#include <io/vga.h> #include <io/vga.h>
#include <io/spkr.h> #include <io/spkr.h>
#include <ke/time.h> #include <ke/time.h>
#include <lib/buf.h> #include <libbuf.h>
#include <sh/shell.h> #include <sh/shell.h>
#include <po/shtdwn.h> #include <po/shtdwn.h>

View File

@ -25,7 +25,7 @@
#include <io/vga.h> #include <io/vga.h>
#include <io/keyb.h> #include <io/keyb.h>
#include <io/spkr.h> #include <io/spkr.h>
#include <lib/buf.h> #include <libbuf.h>
#include <sh/argv.h> #include <sh/argv.h>
#include <sh/shell.h> #include <sh/shell.h>
#include <po/shtdwn.h> #include <po/shtdwn.h>

View File

@ -24,7 +24,7 @@
#include <asm.h> #include <asm.h>
#include <vers.h> #include <vers.h>
#include <lib/buf.h> #include <libbuf.h>
#include <ex/argv.h> #include <ex/argv.h>
#include <init/boot.h> #include <init/boot.h>
#include <ke/time.h> #include <ke/time.h>
@ -34,7 +34,7 @@
#include <io/keyb.h> #include <io/keyb.h>
#include <po/shtdwn.h> #include <po/shtdwn.h>
#include <ke/cpuid.h> #include <ke/cpuid.h>
#include <io/ata.h> #include <drivers/ata.h>

View File

@ -26,11 +26,11 @@
#include <mm/paging.h> #include <mm/paging.h>
#include <mm/palloc.h> #include <mm/palloc.h>
#include <mm/map.h> #include <mm/map.h>
#include <io/ata.h> #include <drivers/ata.h>
#include <io/vga.h> #include <io/vga.h>
#include <io/spkr.h> #include <io/spkr.h>
#include <ke/time.h> #include <ke/time.h>
#include <lib/buf.h> #include <libbuf.h>
#include <sh/shell.h> #include <sh/shell.h>
#include <po/shtdwn.h> #include <po/shtdwn.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
// //
// Closes a buffer, not flushing unless the proper flag is set // Closes a buffer, not flushing unless the proper flag is set

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
// //
// Erases buf's content // Erases buf's content

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#ifdef _KALEID_KERNEL #ifdef _KALEID_KERNEL
#include <ke/time.h> #include <ke/time.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
// Straightforward functions // Straightforward functions
int BGetFlags(Buffer_t *buf) { return buf->flags; } int BGetFlags(Buffer_t *buf) { return buf->flags; }

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#include <ex/malloc.h> #include <ex/malloc.h>
Buffer_t *BStdIn, *BStdOut, *BStdDbg; Buffer_t *BStdIn, *BStdOut, *BStdDbg;

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#ifdef _KALEID_KERNEL #ifdef _KALEID_KERNEL
#include <io/vga.h> #include <io/vga.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
// //
// Writes a character on a buffer // Writes a character on a buffer

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
#if 0 #if 0
error_t BReadBuf(Buffer_t *buf, uchar *out, size_t n) error_t BReadBuf(Buffer_t *buf, uchar *out, size_t n)

View File

@ -23,7 +23,7 @@
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#if 0 #if 0
#include <lib/buf.h> #include <libbuf.h>
// //
// Builds string reading from buf according to fmt // Builds string reading from buf according to fmt

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
void BEnableAutoScroll(Buffer_t *buf) { buf->flags |= BF_AUTOSCROLL; } void BEnableAutoScroll(Buffer_t *buf) { buf->flags |= BF_AUTOSCROLL; }
void BDisableAutoScroll(Buffer_t *buf) { buf->flags &= ~BF_AUTOSCROLL; } void BDisableAutoScroll(Buffer_t *buf) { buf->flags &= ~BF_AUTOSCROLL; }

View File

@ -22,5 +22,5 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>

View File

@ -22,7 +22,7 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <lib/buf.h> #include <libbuf.h>
// //
// XXX // XXX

View File

@ -23,7 +23,7 @@
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <libc.h> #include <libc.h>
#include <lib/buf.h> #include <libbuf.h>
long strtol(const char *str, char **endp, int base) { long strtol(const char *str, char **endp, int base) {
ulong n; ulong n;