Add a #define VERBOSE in param.h to enable printing diagnostics.

上级 70e01816
...@@ -279,6 +279,7 @@ e1000attach(struct pci_func *pcif) ...@@ -279,6 +279,7 @@ e1000attach(struct pci_func *pcif)
r = eeprom_read((u16*)e1000.hwaddr, EEPROM_OFF_MACADDR, 3); r = eeprom_read((u16*)e1000.hwaddr, EEPROM_OFF_MACADDR, 3);
if (r < 0) if (r < 0)
return 0; return 0;
if (VERBOSE)
cprintf("%x:%x:%x:%x:%x:%x\n", cprintf("%x:%x:%x:%x:%x:%x\n",
e1000.hwaddr[0], e1000.hwaddr[1], e1000.hwaddr[2], e1000.hwaddr[0], e1000.hwaddr[1], e1000.hwaddr[2],
e1000.hwaddr[3], e1000.hwaddr[4], e1000.hwaddr[5]); e1000.hwaddr[3], e1000.hwaddr[4], e1000.hwaddr[5]);
......
...@@ -25,7 +25,6 @@ main(void) ...@@ -25,7 +25,6 @@ main(void)
printf(2, "init: mknod netif failed\n"); printf(2, "init: mknod netif failed\n");
for(;;){ for(;;){
printf(1, "init: starting sh\n");
pid = fork(0); pid = fork(0);
if(pid < 0){ if(pid < 0){
printf(1, "init: fork failed\n"); printf(1, "init: fork failed\n");
......
...@@ -271,6 +271,7 @@ initkalloc(u64 mbaddr) ...@@ -271,6 +271,7 @@ initkalloc(u64 mbaddr)
} }
} }
if (VERBOSE)
cprintf("%lu mbytes\n", membytes / (1<<20)); cprintf("%lu mbytes\n", membytes / (1<<20));
n = membytes / NCPU; n = membytes / NCPU;
if (n & (PGSIZE-1)) if (n & (PGSIZE-1))
......
...@@ -109,6 +109,7 @@ cmain(u64 mbmagic, u64 mbaddr) ...@@ -109,6 +109,7 @@ cmain(u64 mbmagic, u64 mbaddr)
initpci(); initpci();
initnet(); initnet();
if (VERBOSE)
cprintf("ncpu %d %lu MHz\n", ncpu, cpuhz / 1000000); cprintf("ncpu %d %lu MHz\n", ncpu, cpuhz / 1000000);
inituser(); // first user process inituser(); // first user process
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#define QUANTUM 10 // scheduling time quantum and tick length (in msec) #define QUANTUM 10 // scheduling time quantum and tick length (in msec)
#define WQSHIFT 4 // 2^WORKSHIFT work queue slots #define WQSHIFT 4 // 2^WORKSHIFT work queue slots
#define VICTIMAGE 1000000 // cycles a proc executes before an eligible victim #define VICTIMAGE 1000000 // cycles a proc executes before an eligible victim
#define VERBOSE 0 // print kernel diagnostics
#if defined(HW_josmp) #if defined(HW_josmp)
#define NCPU 16 // maximum number of CPUs #define NCPU 16 // maximum number of CPUs
#define MTRACE 0 #define MTRACE 0
......
...@@ -247,6 +247,7 @@ pci_func_enable(struct pci_func *f) ...@@ -247,6 +247,7 @@ pci_func_enable(struct pci_func *f)
regnum, base, size); regnum, base, size);
} }
if (VERBOSE)
cprintf("PCI function %x:%x.%d (%x:%x) enabled\n", cprintf("PCI function %x:%x.%d (%x:%x) enabled\n",
f->bus->busno, f->dev, f->func, f->bus->busno, f->dev, f->func,
PCI_VENDOR(f->dev_id), PCI_PRODUCT(f->dev_id)); PCI_VENDOR(f->dev_id), PCI_PRODUCT(f->dev_id));
......
...@@ -213,6 +213,7 @@ initsamp(void) ...@@ -213,6 +213,7 @@ initsamp(void)
name[3] = 0; name[3] = 0;
cpuid(0, 0, &name[0], &name[2], &name[1]); cpuid(0, 0, &name[0], &name[2], &name[1]);
if (VERBOSE)
cprintf("%s\n", s); cprintf("%s\n", s);
if (!strcmp(s, "AuthenticAMD")) if (!strcmp(s, "AuthenticAMD"))
pmu = amdpmu; pmu = amdpmu;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论