Misc - Cleaning up logging output
authorJohn Hodge <[email protected]>
Thu, 1 Dec 2011 14:34:17 +0000 (22:34 +0800)
committerJohn Hodge <[email protected]>
Thu, 1 Dec 2011 14:34:17 +0000 (22:34 +0800)
Kernel/arch/x86/main.c
Kernel/arch/x86/mm_virt.c
Kernel/arch/x86/proc.c
Modules/Display/VESA/main.c
Modules/Network/NE2000/ne2000.c
Modules/Network/RTL8139/rtl8139.c
Modules/Storage/ATA/main.c
Modules/Storage/ATA/mbr.c

index 99c1020..d7c06e7 100644 (file)
@@ -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);
index e2442ae..af3d4bf 100644 (file)
@@ -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;
 }
 
index 5ec3676..dfde359 100644 (file)
@@ -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);
index b543c23..6f056f3 100644 (file)
@@ -222,12 +222,6 @@ int Vesa_Int_SetMode(int mode)
        // Sanity Check values\r
        if(mode < 0 || mode > giVesaModeCount)  return -1;\r
 \r
-       Log_Log("VESA", "Setting mode to %i (%ix%i %ibpp)",\r
-               mode,\r
-               gVesa_Modes[mode].width, gVesa_Modes[mode].height,\r
-               gVesa_Modes[mode].bpp\r
-               );\r
-       \r
        // Check for fast return\r
        if(mode == giVesaCurrentMode)   return 1;\r
        \r
@@ -239,7 +233,6 @@ int Vesa_Int_SetMode(int mode)
        gpVesa_BiosState->AX = 0x4F02;\r
        gpVesa_BiosState->BX = gVesa_Modes[mode].code;\r
        if(gVesa_Modes[mode].flags & FLAG_LFB) {\r
-               Log_Log("VESA", "Using LFB");\r
                gpVesa_BiosState->BX |= 0x4000; // Bit 14 - Use LFB\r
        }\r
        \r
@@ -252,8 +245,12 @@ int Vesa_Int_SetMode(int mode)
        giVesaPageCount = (gVesa_Modes[mode].fbSize + 0xFFF) >> 12;\r
        gpVesa_Framebuffer = (void*)MM_MapHWPages(gVesa_Modes[mode].framebuffer, giVesaPageCount);\r
        \r
-       Log_Log("VESA", "Framebuffer (Phys) = 0x%x, (Virt) = 0x%x, Size = 0x%x",\r
-               gVesa_Modes[mode].framebuffer, gpVesa_Framebuffer, giVesaPageCount << 12);\r
+       Log_Log("VESA", "Setting mode to %i (%ix%i %ibpp) %p[0x%x] maps %P",\r
+               mode,\r
+               gVesa_Modes[mode].width, gVesa_Modes[mode].height,\r
+               gVesa_Modes[mode].bpp,\r
+               gpVesa_Framebuffer, giVesaPageCount << 12, gVesa_Modes[mode].framebuffer\r
+               );\r
        \r
        // Record Mode Set\r
        giVesaCurrentMode = mode;\r
index 288db5f..37d9c5a 100644 (file)
@@ -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;
index 4472276..eb77812 100644 (file)
@@ -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 ++ )
index 11498da..958855f 100644 (file)
@@ -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('-');
 }
index 09ca55d..a294ca8 100644 (file)
@@ -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;
        }

UCC git Repository :: git.ucc.asn.au