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

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