From 4bd32b966938a9f52c22d63cac0b22d6932e585d Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 1 Dec 2011 22:34:17 +0800 Subject: [PATCH] Misc - Cleaning up logging output --- Kernel/arch/x86/main.c | 2 +- Kernel/arch/x86/mm_virt.c | 4 ++-- Kernel/arch/x86/proc.c | 8 +++++--- Modules/Display/VESA/main.c | 15 ++++++--------- Modules/Network/NE2000/ne2000.c | 5 +---- Modules/Network/RTL8139/rtl8139.c | 4 ++-- Modules/Storage/ATA/main.c | 16 +++++++++------- Modules/Storage/ATA/mbr.c | 22 ++++++++++++++-------- 8 files changed, 40 insertions(+), 36 deletions(-) diff --git a/Kernel/arch/x86/main.c b/Kernel/arch/x86/main.c index 99c10206..d7c06e79 100644 --- a/Kernel/arch/x86/main.c +++ b/Kernel/arch/x86/main.c @@ -45,7 +45,7 @@ int kmain(Uint MbMagic, void *MbInfoPtr) tMBoot_Module *mods; tMBoot_Info *mbInfo; - LogF("Acess2 x86_65 v"EXPAND_STR(KERNEL_VERSION)"\n"); + LogF("Acess2 x86 v"EXPAND_STR(KERNEL_VERSION)"\n"); LogF(" Build %i, Git Hash %s\n", BUILD_NUM, gsGitHash); Log("MbMagic = %08x, MbInfoPtr = %p", MbMagic, MbInfoPtr); diff --git a/Kernel/arch/x86/mm_virt.c b/Kernel/arch/x86/mm_virt.c index e2442ae1..af3d4bf0 100644 --- a/Kernel/arch/x86/mm_virt.c +++ b/Kernel/arch/x86/mm_virt.c @@ -666,11 +666,11 @@ tVAddr MM_NewKStack(void) } } // Success - Log("MM_NewKStack - Allocated %p", base + KERNEL_STACK_SIZE); +// Log("MM_NewKStack - Allocated %p", base + KERNEL_STACK_SIZE); return base+KERNEL_STACK_SIZE; } // No stacks left - Warning("MM_NewKStack - No address space left"); + Log_Warning("MMVirt", "MM_NewKStack - No address space left"); return 0; } diff --git a/Kernel/arch/x86/proc.c b/Kernel/arch/x86/proc.c index 5ec3676d..dfde3591 100644 --- a/Kernel/arch/x86/proc.c +++ b/Kernel/arch/x86/proc.c @@ -93,7 +93,9 @@ Uint8 gaAPIC_to_CPU[256] = {0}; int giProc_BootProcessorID = 0; tTSS gaTSSs[MAX_CPUS]; // TSS Array #endif -tCPU gaCPUs[MAX_CPUS]; +tCPU gaCPUs[MAX_CPUS] = { + {.Current = &gThreadZero} + }; tTSS *gTSSs = NULL; // Pointer to TSS array tTSS gTSS0 = {0}; // --- Error Recovery --- @@ -315,7 +317,7 @@ void ArchThreads_Init(void) outb(0x40, TIMER_DIVISOR&0xFF); // Low Byte of Divisor outb(0x40, (TIMER_DIVISOR>>8)&0xFF); // High Byte - Log("Timer Frequency %i.%03i Hz", + Log_Debug("Proc", "PIT Frequency %i.%03i Hz", TIMER_BASE/TIMER_DIVISOR, ((Uint64)TIMER_BASE*1000/TIMER_DIVISOR)%1000 ); @@ -593,7 +595,7 @@ int Proc_NewKThread(void (*Fcn)(void*), void *Data) newThread->SavedState.ESP = esp; newThread->SavedState.EIP = (Uint)&NewTaskHeader; newThread->SavedState.SSE = NULL; - Log("New (KThread) %p, esp = %p\n", newThread->SavedState.EIP, newThread->SavedState.ESP); +// Log("New (KThread) %p, esp = %p", newThread->SavedState.EIP, newThread->SavedState.ESP); // MAGIC_BREAK(); Threads_AddActive(newThread); diff --git a/Modules/Display/VESA/main.c b/Modules/Display/VESA/main.c index b543c239..6f056f33 100644 --- a/Modules/Display/VESA/main.c +++ b/Modules/Display/VESA/main.c @@ -222,12 +222,6 @@ int Vesa_Int_SetMode(int mode) // Sanity Check values if(mode < 0 || mode > giVesaModeCount) return -1; - Log_Log("VESA", "Setting mode to %i (%ix%i %ibpp)", - mode, - gVesa_Modes[mode].width, gVesa_Modes[mode].height, - gVesa_Modes[mode].bpp - ); - // Check for fast return if(mode == giVesaCurrentMode) return 1; @@ -239,7 +233,6 @@ int Vesa_Int_SetMode(int mode) gpVesa_BiosState->AX = 0x4F02; gpVesa_BiosState->BX = gVesa_Modes[mode].code; if(gVesa_Modes[mode].flags & FLAG_LFB) { - Log_Log("VESA", "Using LFB"); gpVesa_BiosState->BX |= 0x4000; // Bit 14 - Use LFB } @@ -252,8 +245,12 @@ int Vesa_Int_SetMode(int mode) giVesaPageCount = (gVesa_Modes[mode].fbSize + 0xFFF) >> 12; gpVesa_Framebuffer = (void*)MM_MapHWPages(gVesa_Modes[mode].framebuffer, giVesaPageCount); - Log_Log("VESA", "Framebuffer (Phys) = 0x%x, (Virt) = 0x%x, Size = 0x%x", - gVesa_Modes[mode].framebuffer, gpVesa_Framebuffer, giVesaPageCount << 12); + Log_Log("VESA", "Setting mode to %i (%ix%i %ibpp) %p[0x%x] maps %P", + mode, + gVesa_Modes[mode].width, gVesa_Modes[mode].height, + gVesa_Modes[mode].bpp, + gpVesa_Framebuffer, giVesaPageCount << 12, gVesa_Modes[mode].framebuffer + ); // Record Mode Set giVesaCurrentMode = mode; diff --git a/Modules/Network/NE2000/ne2000.c b/Modules/Network/NE2000/ne2000.c index 288db5f4..37d9c5a6 100644 --- a/Modules/Network/NE2000/ne2000.c +++ b/Modules/Network/NE2000/ne2000.c @@ -129,10 +129,7 @@ int Ne2k_Install(char **Options) giNe2k_CardCount += PCI_CountDevices( csaCOMPAT_DEVICES[i].Vendor, csaCOMPAT_DEVICES[i].Device ); } - if( giNe2k_CardCount == 0 ) { - Log_Warning("Ne2k", "No cards detected"); - return MODULE_ERR_NOTNEEDED; - } + if( giNe2k_CardCount == 0 ) return MODULE_ERR_NOTNEEDED; // Enumerate Cards k = 0; diff --git a/Modules/Network/RTL8139/rtl8139.c b/Modules/Network/RTL8139/rtl8139.c index 4472276a..eb77812b 100644 --- a/Modules/Network/RTL8139/rtl8139.c +++ b/Modules/Network/RTL8139/rtl8139.c @@ -127,10 +127,10 @@ int RTL8139_Install(char **Options) tCard *card; giRTL8139_CardCount = PCI_CountDevices(VENDOR_ID, DEVICE_ID); - Log_Debug("RTL8139", "%i cards", giRTL8139_CardCount); if( giRTL8139_CardCount == 0 ) return MODULE_ERR_NOTNEEDED; - + + Log_Debug("RTL8139", "%i cards", giRTL8139_CardCount); gaRTL8139_Cards = calloc( giRTL8139_CardCount, sizeof(tCard) ); for( i = 0 ; (id = PCI_GetDevice(VENDOR_ID, DEVICE_ID, i)) != -1; i ++ ) diff --git a/Modules/Storage/ATA/main.c b/Modules/Storage/ATA/main.c index 11498da9..958855fc 100644 --- a/Modules/Storage/ATA/main.c +++ b/Modules/Storage/ATA/main.c @@ -139,6 +139,11 @@ int ATA_ScanDisk(int Disk) LOG("gATA_Disks[ %i ].Sectors = 0x%x", Disk, gATA_Disks[ Disk ].Sectors); + // Create Name + gATA_Disks[ Disk ].Name[0] = 'A'+Disk; + gATA_Disks[ Disk ].Name[1] = '\0'; + + #if 1 { Uint64 val = gATA_Disks[ Disk ].Sectors / 2; char *units = "KiB"; @@ -154,13 +159,10 @@ int ATA_ScanDisk(int Disk) val /= 1024; units = "TiB"; } - Log_Log("ATA", "Disk %i: 0x%llx Sectors (%lli %s)", Disk, - gATA_Disks[ Disk ].Sectors, val, units); + Log_Notice("ATA", "Disk %s: 0x%llx Sectors (%lli %s)", + gATA_Disks[ Disk ].Name, gATA_Disks[ Disk ].Sectors, val, units); } - - // Create Name - gATA_Disks[ Disk ].Name[0] = 'A'+Disk; - gATA_Disks[ Disk ].Name[1] = '\0'; + #endif // Get pointer to vfs node and populate it node = &gATA_Disks[ Disk ].Node; @@ -225,7 +227,7 @@ void ATA_int_MakePartition(tATA_Partition *Part, int Disk, int Num, Uint64 Start Part->Node.Read = ATA_ReadFS; Part->Node.Write = ATA_WriteFS; Part->Node.IOCtl = ATA_IOCtl; - Log_Notice("ATA", "Note '%s' at 0x%llx, 0x%llx long", Part->Name, Part->Start, Part->Length); + Log_Notice("ATA", "Partition %s at 0x%llx+0x%llx", Part->Name, Part->Start, Part->Length); LOG("Made '%s' (&Node=%p)", Part->Name, &Part->Node); LEAVE('-'); } diff --git a/Modules/Storage/ATA/mbr.c b/Modules/Storage/ATA/mbr.c index 09ca55d6..a294ca81 100644 --- a/Modules/Storage/ATA/mbr.c +++ b/Modules/Storage/ATA/mbr.c @@ -125,7 +125,6 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) if( ATA_ReadDMA( Disk, Addr, 1, &mbr ) != 0 ) return -1; // Stop on Errors - for( i = 0; i < 4; i ++ ) { if( mbr.Parts[i].SystemID == 0 ) continue; @@ -141,8 +140,10 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) len = (mbr.Parts[i].LengthHi << 16) | mbr.Parts[i].LBALength; } else { - Warning("Unknown partition type, Disk %i 0x%llx Part %i", - Disk, Addr, i); + Log_Warning("ATA MBR", + "Unknown partition type 0x%x, Disk %i Ext 0x%llx Part %i", + mbr.Parts[i].Boot, Disk, Addr, i + ); return -1; } @@ -151,16 +152,20 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) case 0xF: case 0x5: if(link != 0) { - Warning("Disk %i has two forward links in the extended partition", - Disk); + Log_Warning("ATA MBR", + "Disk %i has two forward links in the extended partition", + Disk + ); return -1; } link = base; break; default: if(bFoundPart) { - Warning("Disk %i has more than one partition in the extended partition at 0x%llx", - Disk, Addr); + Warning("ATA MBR", + "Disk %i has more than one partition in the extended partition at 0x%llx", + Disk, Addr + ); return -1; } bFoundPart = 1; @@ -171,7 +176,8 @@ Uint64 ATA_MBR_int_ReadExt(int Disk, Uint64 Addr, Uint64 *Base, Uint64 *Length) } if(!bFoundPart) { - Warning("No partition in extended partiton, Disk %i 0x%llx", + Log_Warning("ATA MBR", + "No partition in extended partiton, Disk %i 0x%llx", Disk, Addr); return -1; } -- 2.20.1