From d5ba2e6250feee1c3a30c0b40ec03f3d9d77fb56 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 27 Mar 2012 10:00:00 +0800 Subject: [PATCH] Kernel - Fixed PCI bus enumeration bug, switched x86 serial debug to 115200baud - PCI wasn't enumuerating extra busses located --- KernelLand/Kernel/arch/x86/lib.c | 4 ++-- KernelLand/Kernel/drv/pci.c | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/KernelLand/Kernel/arch/x86/lib.c b/KernelLand/Kernel/arch/x86/lib.c index 175f9a55..6b3d7228 100644 --- a/KernelLand/Kernel/arch/x86/lib.c +++ b/KernelLand/Kernel/arch/x86/lib.c @@ -177,8 +177,8 @@ void Debug_PutCharDebug(char ch) if(!gbDebug_SerialSetup) { outb(SERIAL_PORT + 1, 0x00); // Disable all interrupts outb(SERIAL_PORT + 3, 0x80); // Enable DLAB (set baud rate divisor) - outb(SERIAL_PORT + 0, 0x0C); // Set divisor to 12 (lo byte) 9600 baud - outb(SERIAL_PORT + 1, 0x00); // (hi byte) + outb(SERIAL_PORT + 0, 0x01); // Set divisor to 1 (lo byte) - 115200 baud + outb(SERIAL_PORT + 1, 0x00); // (hi byte) outb(SERIAL_PORT + 3, 0x03); // 8 bits, no parity, one stop bit outb(SERIAL_PORT + 2, 0xC7); // Enable FIFO with 14-byte threshold and clear it outb(SERIAL_PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set diff --git a/KernelLand/Kernel/drv/pci.c b/KernelLand/Kernel/drv/pci.c index 327d651d..2c01b96c 100644 --- a/KernelLand/Kernel/drv/pci.c +++ b/KernelLand/Kernel/drv/pci.c @@ -73,7 +73,7 @@ Uint32 gaPCI_BusBitmap[256/32]; */ int PCI_Install(char **Arguments) { - int i; + int i, ret, bus; void *tmpPtr; // Build Portmap @@ -89,8 +89,11 @@ int PCI_Install(char **Arguments) gaPCI_PortBitmap[MAX_RESERVED_PORT / 32] = 1 << i; // Scan Bus (Bus 0, Don't fill gPCI_Devices) - i = PCI_ScanBus(0, 0); - if(i != MODULE_ERR_OK) return i; + for( bus = 0; bus < giPCI_BusCount; bus ++ ) + { + ret = PCI_ScanBus(bus, 0); + if(ret != MODULE_ERR_OK) return i; + } if(giPCI_DeviceCount == 0) { Log_Notice("PCI", "No devices were found"); @@ -109,10 +112,13 @@ int PCI_Install(char **Arguments) // Reset counts giPCI_DeviceCount = 0; - giPCI_BusCount = 0; + giPCI_BusCount = 1; memset(gaPCI_BusBitmap, 0, sizeof(gaPCI_BusBitmap)); // Rescan, filling the PCI device array - PCI_ScanBus(0, 1); + for( bus = 0; bus < giPCI_BusCount; bus ++ ) + { + PCI_ScanBus(bus, 1); + } // Complete Driver Structure gPCI_DriverStruct.RootNode.Size = giPCI_DeviceCount; -- 2.20.1