panic() cleanup.

this change
   - makes panic() variadic, doing full printf() formatting -
     no more NO_NUM, and no more separate printf() statements
     needed to print extra info (or something in hex) before panicing
   - unifies panic() - same panic() name and usage for everyone -
     vm, kernel and rest have different names/syntax currently
     in order to implement their own luxuries, but no longer
   - throws out the 1st argument, to make source less noisy.
     the panic() in syslib retrieves the server name from the kernel
     so it should be clear enough who is panicing; e.g.
         panic("sigaction failed: %d", errno);
     looks like:
         at_wini(73130): panic: sigaction failed: 0
         syslib:panic.c: stacktrace: 0x74dc 0x2025 0x100a
   - throws out report() - printf() is more convenient and powerful
   - harmonizes/fixes the use of panic() - there were a few places
     that used printf-style formatting (didn't work) and newlines
     (messes up the formatting) in panic()
   - throws out a few per-server panic() functions
   - cleans up a tie-in of tty with panic()

merging printf() and panic() statements to be done incrementally.
This commit is contained in:
Ben Gras 2010-03-05 15:05:11 +00:00
parent 851dc95566
commit 35a108b911
171 changed files with 1381 additions and 1649 deletions

View file

@ -78,7 +78,7 @@ int main(void)
r= sef_receive(ANY, &m); r= sef_receive(ANY, &m);
if (r != OK) if (r != OK)
panic(__FILE__, "sef_receive failed", r); panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) { if (is_notify(m.m_type)) {
if (_ENDPOINT_P(m.m_source) == PM_PROC_NR) { if (_ENDPOINT_P(m.m_source) == PM_PROC_NR) {
do_pm_notify(&m); do_pm_notify(&m);
@ -247,7 +247,7 @@ static void init_domain(int index)
size= 0x100000 / 8; size= 0x100000 / 8;
table= alloc_contig(size, AC_ALIGN4K, &busaddr); table= alloc_contig(size, AC_ALIGN4K, &busaddr);
if (table == NULL) if (table == NULL)
panic("AMDDEV","malloc failed", NO_NUM); panic("malloc failed");
if (index == 0) if (index == 0)
{ {
memset(table, 0, size); memset(table, 0, size);

View file

@ -270,7 +270,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
sa.sa_handler = SIG_MESS; sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sa.sa_flags = 0; sa.sa_flags = 0;
if (sigaction(SIGTERM,&sa,NULL)<0) panic("AT","sigaction failed", errno); if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno);
/* Set special disk parameters. */ /* Set special disk parameters. */
init_params(); init_params();
@ -306,7 +306,7 @@ PRIVATE void init_params()
w_identify_wakeup_ticks = wakeup_secs * system_hz; w_identify_wakeup_ticks = wakeup_secs * system_hz;
if(atapi_debug) if(atapi_debug)
panic("at_wini", "atapi_debug", NO_NUM); panic("atapi_debug");
if(w_identify_wakeup_ticks <= 0) { if(w_identify_wakeup_ticks <= 0) {
printf("changing wakeup from %d to %d ticks.\n", printf("changing wakeup from %d to %d ticks.\n",
@ -330,7 +330,7 @@ PRIVATE void init_params()
/* Get the number of drives from the BIOS data area */ /* Get the number of drives from the BIOS data area */
s=sys_readbios(NR_HD_DRIVES_ADDR, params, NR_HD_DRIVES_SIZE); s=sys_readbios(NR_HD_DRIVES_ADDR, params, NR_HD_DRIVES_SIZE);
if (s != OK) if (s != OK)
panic(w_name(), "Couldn't read BIOS", s); panic("Couldn't read BIOS: %d", s);
if ((nr_drives = params[0]) > 2) nr_drives = 2; if ((nr_drives = params[0]) > 2) nr_drives = 2;
for (drive = 0, wn = wini; drive < COMPAT_DRIVES; drive++, wn++) { for (drive = 0, wn = wini; drive < COMPAT_DRIVES; drive++, wn++) {
@ -342,13 +342,13 @@ PRIVATE void init_params()
BIOS_HD1_PARAMS_SIZE; BIOS_HD1_PARAMS_SIZE;
s=sys_readbios(vector, parv, size); s=sys_readbios(vector, parv, size);
if (s != OK) if (s != OK)
panic(w_name(), "Couldn't read BIOS", s); panic("Couldn't read BIOS: %d", s);
/* Calculate the address of the parameters and copy them */ /* Calculate the address of the parameters and copy them */
s=sys_readbios(hclick_to_physb(parv[1]) + parv[0], s=sys_readbios(hclick_to_physb(parv[1]) + parv[0],
params, 16L); params, 16L);
if (s != OK) if (s != OK)
panic(w_name(),"Couldn't copy parameters", s); panic("Couldn't copy parameters: %d", s);
/* Copy the parameters to the structures of the drive */ /* Copy the parameters to the structures of the drive */
wn->lcylinders = bp_cylinders(params); wn->lcylinders = bp_cylinders(params);
@ -700,9 +700,7 @@ check_dma(struct wini *wn)
if (dma_base) { if (dma_base) {
if (sys_inb(dma_base + DMA_STATUS, &dma_status) != OK) { if (sys_inb(dma_base + DMA_STATUS, &dma_status) != OK) {
panic(w_name(), panic("unable to read DMA status register");
"unable to read DMA status register",
NO_NUM);
} }
} }
@ -796,7 +794,7 @@ PRIVATE int w_identify()
/* Device information. */ /* Device information. */
if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK) if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK)
panic(w_name(),"Call to sys_insw() failed", s); panic("Call to sys_insw() failed: %d", s);
#if 0 #if 0
if (id_word(0) & ID_GEN_NOT_ATA) if (id_word(0) & ID_GEN_NOT_ATA)
@ -869,7 +867,7 @@ PRIVATE int w_identify()
/* Device information. */ /* Device information. */
if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, 512)) != OK) if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, 512)) != OK)
panic(w_name(),"Call to sys_insw() failed", s); panic("Call to sys_insw() failed: %d", s);
size = 0; /* Size set later. */ size = 0; /* Size set later. */
check_dma(wn); check_dma(wn);
@ -906,9 +904,9 @@ PRIVATE int w_identify()
wn->irq = w_drive < 2 ? AT_WINI_0_IRQ : AT_WINI_1_IRQ; wn->irq = w_drive < 2 ? AT_WINI_0_IRQ : AT_WINI_1_IRQ;
wn->irq_hook_id = wn->irq; /* id to be returned if interrupt occurs */ wn->irq_hook_id = wn->irq; /* id to be returned if interrupt occurs */
if ((s=sys_irqsetpolicy(wn->irq, IRQ_REENABLE, &wn->irq_hook_id)) != OK) if ((s=sys_irqsetpolicy(wn->irq, IRQ_REENABLE, &wn->irq_hook_id)) != OK)
panic(w_name(), "couldn't set IRQ policy", s); panic("couldn't set IRQ policy: %d", s);
if ((s=sys_irqenable(&wn->irq_hook_id)) != OK) if ((s=sys_irqenable(&wn->irq_hook_id)) != OK)
panic(w_name(), "couldn't enable IRQ line", s); panic("couldn't enable IRQ line: %d", s);
} }
wn->state |= IDENTIFIED; wn->state |= IDENTIFIED;
return(OK); return(OK);
@ -963,13 +961,13 @@ PRIVATE int w_io_test(void)
/* Try I/O on the actual drive (not any (sub)partition). */ /* Try I/O on the actual drive (not any (sub)partition). */
if (w_prepare(w_drive * DEV_PER_DRIVE) == NIL_DEV) if (w_prepare(w_drive * DEV_PER_DRIVE) == NIL_DEV)
panic(w_name(), "Couldn't switch devices", NO_NUM); panic("Couldn't switch devices");
r = w_transfer(SELF, DEV_GATHER_S, cvu64(0), &iov, 1); r = w_transfer(SELF, DEV_GATHER_S, cvu64(0), &iov, 1);
/* Switch back. */ /* Switch back. */
if (w_prepare(save_dev) == NIL_DEV) if (w_prepare(save_dev) == NIL_DEV)
panic(w_name(), "Couldn't switch back devices", NO_NUM); panic("Couldn't switch back devices");
/* Restore parameters. */ /* Restore parameters. */
timeout_ticks = save_timeout; timeout_ticks = save_timeout;
@ -1108,7 +1106,7 @@ PRIVATE void stop_dma(struct wini *wn)
/* Stop bus master operation */ /* Stop bus master operation */
r= sys_outb(wn->base_dma + DMA_COMMAND, 0); r= sys_outb(wn->base_dma + DMA_COMMAND, 0);
if (r != 0) panic("at_wini", "stop_dma: sys_outb failed", r); if (r != 0) panic("stop_dma: sys_outb failed: %d", r);
} }
PRIVATE void start_dma(struct wini *wn, int do_write) PRIVATE void start_dma(struct wini *wn, int do_write)
@ -1124,7 +1122,7 @@ PRIVATE void start_dma(struct wini *wn, int do_write)
v |= DMA_CMD_WRITE; v |= DMA_CMD_WRITE;
} }
r= sys_outb(wn->base_dma + DMA_COMMAND, v); r= sys_outb(wn->base_dma + DMA_COMMAND, v);
if (r != 0) panic("at_wini", "start_dma: sys_outb failed", r); if (r != 0) panic("start_dma: sys_outb failed: %d", r);
} }
PRIVATE int error_dma(struct wini *wn) PRIVATE int error_dma(struct wini *wn)
@ -1140,7 +1138,7 @@ PRIVATE int error_dma(struct wini *wn)
return 1; \ return 1; \
r= sys_inb(wn->base_dma + DMA_STATUS, &v); r= sys_inb(wn->base_dma + DMA_STATUS, &v);
if (r != 0) panic("at_wini", "w_transfer: sys_inb failed", r); if (r != 0) panic("w_transfer: sys_inb failed: %d", r);
if (!wn->dma_intseen) { if (!wn->dma_intseen) {
/* DMA did not complete successfully */ /* DMA did not complete successfully */
@ -1234,7 +1232,7 @@ unsigned nr_req; /* length of request vector */
* way to implement this wait. * way to implement this wait.
*/ */
if (sys_inb((wn->base_ctl+REG_CTL_ALTSTAT), &w_status) != OK) if (sys_inb((wn->base_ctl+REG_CTL_ALTSTAT), &w_status) != OK)
panic(w_name(), "couldn't get status", NO_NUM); panic("couldn't get status");
} }
if (do_dma) { if (do_dma) {
@ -1281,11 +1279,8 @@ unsigned nr_req; /* length of request vector */
s= sys_safecopyto(proc_nr, iov->iov_addr, s= sys_safecopyto(proc_nr, iov->iov_addr,
addr_offset, addr_offset,
(vir_bytes)dma_buf+dma_buf_offset, n, D); (vir_bytes)dma_buf+dma_buf_offset, n, D);
if (s != OK) if (s != OK) {
{ panic("w_transfer: sys_vircopy failed: %d", s);
panic(w_name(),
"w_transfer: sys_vircopy failed",
s);
} }
} else { } else {
memcpy((char *) iov->iov_addr + addr_offset, memcpy((char *) iov->iov_addr + addr_offset,
@ -1317,11 +1312,8 @@ unsigned nr_req; /* length of request vector */
if (w_wn->w_status & STATUS_DRQ) { if (w_wn->w_status & STATUS_DRQ) {
if ((s=sys_insw(wn->base_cmd+REG_DATA, if ((s=sys_insw(wn->base_cmd+REG_DATA,
SELF, tmp_buf, SELF, tmp_buf,
SECTOR_SIZE)) != OK) SECTOR_SIZE)) != OK) {
{ panic("Call to sys_insw() failed: %d", s);
panic(w_name(),
"Call to sys_insw() failed",
s);
} }
} }
break; break;
@ -1346,7 +1338,7 @@ unsigned nr_req; /* length of request vector */
SECTOR_SIZE); SECTOR_SIZE);
} }
if(s != OK) { if(s != OK) {
panic(w_name(),"Call to sys_insw() failed", s); panic("Call to sys_insw() failed: %d", s);
} }
} else { } else {
if(proc_nr != SELF) { if(proc_nr != SELF) {
@ -1360,7 +1352,7 @@ unsigned nr_req; /* length of request vector */
} }
if(s != OK) { if(s != OK) {
panic(w_name(),"Call to sys_outsw() failed", s); panic("Call to sys_outsw() failed: %d", s);
} }
/* Data sent, wait for an interrupt. */ /* Data sent, wait for an interrupt. */
@ -1415,7 +1407,7 @@ struct command *cmd; /* Command block */
/* Select drive. */ /* Select drive. */
if ((s=sys_outb(base_cmd + REG_LDH, cmd->ldh)) != OK) if ((s=sys_outb(base_cmd + REG_LDH, cmd->ldh)) != OK)
panic(w_name(),"Couldn't write register to select drive",s); panic("Couldn't write register to select drive: %d", s);
if (!w_waitfor(STATUS_BSY, 0)) { if (!w_waitfor(STATUS_BSY, 0)) {
printf("%s: com_out: drive not ready\n", w_name()); printf("%s: com_out: drive not ready\n", w_name());
@ -1439,7 +1431,7 @@ struct command *cmd; /* Command block */
pv_set(outbyte[5], base_cmd + REG_CYL_HI, cmd->cyl_hi); pv_set(outbyte[5], base_cmd + REG_CYL_HI, cmd->cyl_hi);
pv_set(outbyte[6], base_cmd + REG_COMMAND, cmd->command); pv_set(outbyte[6], base_cmd + REG_COMMAND, cmd->command);
if ((s=sys_voutb(outbyte,7)) != OK) if ((s=sys_voutb(outbyte,7)) != OK)
panic(w_name(),"Couldn't write registers with sys_voutb()",s); panic("Couldn't write registers with sys_voutb(): %d", s);
return(OK); return(OK);
} }
@ -1466,7 +1458,7 @@ struct command *cmd; /* Command block */
/* Select drive. */ /* Select drive. */
if ((s=sys_outb(base_cmd + REG_LDH, cmd->ldh)) != OK) if ((s=sys_outb(base_cmd + REG_LDH, cmd->ldh)) != OK)
panic(w_name(),"Couldn't write register to select drive",s); panic("Couldn't write register to select drive: %d", s);
if (!w_waitfor(STATUS_BSY, 0)) { if (!w_waitfor(STATUS_BSY, 0)) {
printf("%s: com_out: drive not ready\n", w_name()); printf("%s: com_out: drive not ready\n", w_name());
@ -1493,7 +1485,7 @@ struct command *cmd; /* Command block */
pv_set(outbyte[8], base_cmd + REG_CYL_HI, cmd->cyl_hi); pv_set(outbyte[8], base_cmd + REG_CYL_HI, cmd->cyl_hi);
pv_set(outbyte[9], base_cmd + REG_COMMAND, cmd->command); pv_set(outbyte[9], base_cmd + REG_COMMAND, cmd->command);
if ((s=sys_voutb(outbyte, 10)) != OK) if ((s=sys_voutb(outbyte, 10)) != OK)
panic(w_name(),"Couldn't write registers with sys_voutb()",s); panic("Couldn't write registers with sys_voutb(): %d", s);
return(OK); return(OK);
} }
@ -1538,21 +1530,19 @@ int *do_copyoutp;
if (n > size) if (n > size)
n= size; n= size;
if (n == 0 || (n & 1)) if (n == 0 || (n & 1))
panic("at_wini", "bad size in iov", iov[i].iov_size); panic("bad size in iov: %d", iov[i].iov_size);
if(proc_nr != SELF) { if(proc_nr != SELF) {
r= sys_umap(proc_nr, VM_GRANT, iov[i].iov_addr, n, r= sys_umap(proc_nr, VM_GRANT, iov[i].iov_addr, n,
&user_phys); &user_phys);
if (r != 0) if (r != 0)
panic("at_wini", panic("can't map user buffer (VM_GRANT): %d", r);
"can't map user buffer (VM_GRANT)", r);
user_phys += offset + addr_offset; user_phys += offset + addr_offset;
} else { } else {
r= sys_umap(proc_nr, VM_D, r= sys_umap(proc_nr, VM_D,
iov[i].iov_addr+offset+addr_offset, n, iov[i].iov_addr+offset+addr_offset, n,
&user_phys); &user_phys);
if (r != 0) if (r != 0)
panic("at_wini", panic("can't map user buffer (VM_D): %d", r);
"can't map user buffer (VM_D)", r);
} }
if (user_phys & 1) if (user_phys & 1)
{ {
@ -1598,7 +1588,7 @@ int *do_copyoutp;
if (!bad) if (!bad)
{ {
if (j <= 0 || j > N_PRDTE) if (j <= 0 || j > N_PRDTE)
panic("at_wini", "bad prdt index", j); panic("bad prdt index: %d", j);
prdt[j-1].prdte_flags |= PRDTE_FL_EOT; prdt[j-1].prdte_flags |= PRDTE_FL_EOT;
if(verbose) { if(verbose) {
@ -1639,10 +1629,8 @@ int *do_copyoutp;
r= sys_safecopyfrom(proc_nr, iov->iov_addr, r= sys_safecopyfrom(proc_nr, iov->iov_addr,
addr_offset, (vir_bytes)dma_buf+offset, addr_offset, (vir_bytes)dma_buf+offset,
n, D); n, D);
if (r != OK) if (r != OK) {
{ panic("setup_dma: sys_vircopy failed: %d", r);
panic(w_name(),
"setup_dma: sys_vircopy failed", r);
} }
} else { } else {
memcpy(dma_buf + offset, memcpy(dma_buf + offset,
@ -1659,22 +1647,17 @@ int *do_copyoutp;
if (phys & 1) if (phys & 1)
{ {
/* Two byte alignment is required */ /* Two byte alignment is required */
panic("at_wini", "bad buffer alignment in setup_dma", panic("bad buffer alignment in setup_dma: 0x%lx", phys);
phys);
} }
for (j= 0; j<N_PRDTE; i++) for (j= 0; j<N_PRDTE; i++)
{ {
if (size == 0) if (size == 0) {
{ panic("bad size in setup_dma: %d", size);
panic("at_wini", "bad size in setup_dma",
size);
} }
if (size & 1) if (size & 1)
{ {
/* Two byte alignment is required for size */ /* Two byte alignment is required for size */
panic("at_wini", panic("bad size alignment in setup_dma: %d", size);
"bad size alignment in setup_dma",
size);
} }
n= size; n= size;
@ -1696,7 +1679,7 @@ int *do_copyoutp;
} }
} }
if (size != 0) if (size != 0)
panic("at_wini", "size to large for prdt", NO_NUM); panic("size to large for prdt");
if(verbose) { if(verbose) {
for (i= 0; i<=j; i++) for (i= 0; i<=j; i++)
@ -1710,18 +1693,18 @@ int *do_copyoutp;
/* Verify that the bus master is not active */ /* Verify that the bus master is not active */
r= sys_inb(wn->base_dma + DMA_STATUS, &v); r= sys_inb(wn->base_dma + DMA_STATUS, &v);
if (r != 0) panic("at_wini", "setup_dma: sys_inb failed", r); if (r != 0) panic("setup_dma: sys_inb failed: %d", r);
if (v & DMA_ST_BM_ACTIVE) if (v & DMA_ST_BM_ACTIVE)
panic("at_wini", "Bus master IDE active", NO_NUM); panic("Bus master IDE active");
if (prdt_phys & 3) if (prdt_phys & 3)
panic("at_wini", "prdt not aligned", prdt_phys); panic("prdt not aligned: %d", prdt_phys);
r= sys_outl(wn->base_dma + DMA_PRDTP, prdt_phys); r= sys_outl(wn->base_dma + DMA_PRDTP, prdt_phys);
if (r != 0) panic("at_wini", "setup_dma: sys_outl failed", r); if (r != 0) panic("setup_dma: sys_outl failed: %d", r);
/* Clear interrupt and error flags */ /* Clear interrupt and error flags */
r= sys_outb(wn->base_dma + DMA_STATUS, DMA_ST_INT | DMA_ST_ERROR); r= sys_outb(wn->base_dma + DMA_STATUS, DMA_ST_INT | DMA_ST_ERROR);
if (r != 0) panic("at_wini", "setup_dma: sys_outb failed", r); if (r != 0) panic("setup_dma: sys_outb failed: %d", r);
} }
@ -1825,10 +1808,10 @@ PRIVATE int w_reset()
/* Strobe reset bit */ /* Strobe reset bit */
if ((s=sys_outb(wn->base_ctl + REG_CTL, CTL_RESET)) != OK) if ((s=sys_outb(wn->base_ctl + REG_CTL, CTL_RESET)) != OK)
panic(w_name(),"Couldn't strobe reset bit",s); panic("Couldn't strobe reset bit: %d", s);
tickdelay(DELAY_TICKS); tickdelay(DELAY_TICKS);
if ((s=sys_outb(wn->base_ctl + REG_CTL, 0)) != OK) if ((s=sys_outb(wn->base_ctl + REG_CTL, 0)) != OK)
panic(w_name(),"Couldn't strobe reset bit",s); panic("Couldn't strobe reset bit: %d", s);
tickdelay(DELAY_TICKS); tickdelay(DELAY_TICKS);
/* Wait for controller ready */ /* Wait for controller ready */
@ -1870,7 +1853,7 @@ PRIVATE void w_intr_wait()
while (w_wn->w_status & (STATUS_ADMBSY|STATUS_BSY)) { while (w_wn->w_status & (STATUS_ADMBSY|STATUS_BSY)) {
int rr; int rr;
if((rr=sef_receive(ANY, &m)) != OK) if((rr=sef_receive(ANY, &m)) != OK)
panic("at_wini", "sef_receive(ANY) failed", rr); panic("sef_receive(ANY) failed: %d", rr);
if (is_notify(m.m_type)) { if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) { switch (_ENDPOINT_P(m.m_source)) {
case CLOCK: case CLOCK:
@ -1882,8 +1865,7 @@ PRIVATE void w_intr_wait()
r= sys_inb(w_wn->base_cmd + r= sys_inb(w_wn->base_cmd +
REG_STATUS, &w_status); REG_STATUS, &w_status);
if (r != 0) if (r != 0)
panic("at_wini", panic("sys_inb failed: %d", r);
"sys_inb failed", r);
w_wn->w_status= w_status; w_wn->w_status= w_status;
ack_irqs(m.NOTIFY_ARG); ack_irqs(m.NOTIFY_ARG);
break; break;
@ -1923,7 +1905,7 @@ PRIVATE int at_intr_wait()
r = OK; r = OK;
} else { } else {
if ((s=sys_inb(w_wn->base_cmd + REG_ERROR, &inbval)) != OK) if ((s=sys_inb(w_wn->base_cmd + REG_ERROR, &inbval)) != OK)
panic(w_name(),"Couldn't read register",s); panic("Couldn't read register: %d", s);
if ((w_wn->w_status & STATUS_ERR) && (inbval & ERROR_BB)) { if ((w_wn->w_status & STATUS_ERR) && (inbval & ERROR_BB)) {
r = ERR_BAD_SECTOR; /* sector marked bad, retries won't help */ r = ERR_BAD_SECTOR; /* sector marked bad, retries won't help */
} else { } else {
@ -1953,7 +1935,7 @@ int value; /* required status */
getuptime(&t0); getuptime(&t0);
do { do {
if ((s=sys_inb(w_wn->base_cmd + REG_STATUS, &w_status)) != OK) if ((s=sys_inb(w_wn->base_cmd + REG_STATUS, &w_status)) != OK)
panic(w_name(),"Couldn't read register",s); panic("Couldn't read register: %d", s);
w_wn->w_status= w_status; w_wn->w_status= w_status;
if ((w_wn->w_status & mask) == value) { if ((w_wn->w_status & mask) == value) {
return 1; return 1;
@ -1984,7 +1966,7 @@ int value; /* required status */
getuptime(&t0); getuptime(&t0);
do { do {
if ((s=sys_inb(w_wn->base_dma + DMA_STATUS, &w_status)) != OK) if ((s=sys_inb(w_wn->base_dma + DMA_STATUS, &w_status)) != OK)
panic(w_name(),"Couldn't read register",s); panic("Couldn't read register: %d", s);
if ((w_status & mask) == value) { if ((w_status & mask) == value) {
return 1; return 1;
} }
@ -2191,7 +2173,7 @@ unsigned nr_req; /* length of request vector */
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE; if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
if ((s=sys_insw(wn->base_cmd + REG_DATA, if ((s=sys_insw(wn->base_cmd + REG_DATA,
SELF, tmp_buf, chunk)) != OK) SELF, tmp_buf, chunk)) != OK)
panic(w_name(),"Call to sys_insw() failed", s); panic("Call to sys_insw() failed: %d", s);
before -= chunk; before -= chunk;
count -= chunk; count -= chunk;
} }
@ -2210,7 +2192,7 @@ unsigned nr_req; /* length of request vector */
chunk); chunk);
} }
if (s != OK) if (s != OK)
panic(w_name(),"Call to sys_insw() failed", s); panic("Call to sys_insw() failed: %d", s);
position= add64ul(position, chunk); position= add64ul(position, chunk);
nbytes -= chunk; nbytes -= chunk;
count -= chunk; count -= chunk;
@ -2231,7 +2213,7 @@ unsigned nr_req; /* length of request vector */
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE; if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
if ((s=sys_insw(wn->base_cmd + REG_DATA, if ((s=sys_insw(wn->base_cmd + REG_DATA,
SELF, tmp_buf, chunk)) != OK) SELF, tmp_buf, chunk)) != OK)
panic(w_name(),"Call to sys_insw() failed", s); panic("Call to sys_insw() failed: %d", s);
count -= chunk; count -= chunk;
} }
} }
@ -2275,7 +2257,7 @@ int do_dma;
/* Select Master/Slave drive */ /* Select Master/Slave drive */
if ((s=sys_outb(wn->base_cmd + REG_DRIVE, wn->ldhpref)) != OK) if ((s=sys_outb(wn->base_cmd + REG_DRIVE, wn->ldhpref)) != OK)
panic(w_name(),"Couldn't select master/ slave drive",s); panic("Couldn't select master/ slave drive: %d", s);
if (!w_waitfor(STATUS_BSY | STATUS_DRQ, 0)) { if (!w_waitfor(STATUS_BSY | STATUS_DRQ, 0)) {
printf("%s: atapi_sendpacket: drive not ready\n", w_name()); printf("%s: atapi_sendpacket: drive not ready\n", w_name());
@ -2303,7 +2285,7 @@ int do_dma;
pv_set(outbyte[5], wn->base_cmd + REG_COMMAND, w_command); pv_set(outbyte[5], wn->base_cmd + REG_COMMAND, w_command);
if (atapi_debug) printf("cmd: %x ", w_command); if (atapi_debug) printf("cmd: %x ", w_command);
if ((s=sys_voutb(outbyte,6)) != OK) if ((s=sys_voutb(outbyte,6)) != OK)
panic(w_name(),"Couldn't write registers with sys_voutb()",s); panic("Couldn't write registers with sys_voutb(): %d", s);
if (!w_waitfor(STATUS_BSY | STATUS_DRQ, STATUS_DRQ)) { if (!w_waitfor(STATUS_BSY | STATUS_DRQ, STATUS_DRQ)) {
printf("%s: timeout (BSY|DRQ -> DRQ)\n", w_name()); printf("%s: timeout (BSY|DRQ -> DRQ)\n", w_name());
@ -2313,7 +2295,7 @@ int do_dma;
/* Send the command packet to the device. */ /* Send the command packet to the device. */
if ((s=sys_outsw(wn->base_cmd + REG_DATA, SELF, packet, ATAPI_PACKETSIZE)) != OK) if ((s=sys_outsw(wn->base_cmd + REG_DATA, SELF, packet, ATAPI_PACKETSIZE)) != OK)
panic(w_name(),"sys_outsw() failed", s); panic("sys_outsw() failed: %d", s);
return(OK); return(OK);
} }
@ -2415,8 +2397,7 @@ PRIVATE void ack_irqs(unsigned int irqs)
if (sys_inb((wini[drive].base_cmd + REG_STATUS), if (sys_inb((wini[drive].base_cmd + REG_STATUS),
&w_status) != OK) &w_status) != OK)
{ {
panic(w_name(), "couldn't ack irq on drive %d\n", panic("couldn't ack irq on drive: %d", drive);
drive);
} }
wini[drive].w_status= w_status; wini[drive].w_status= w_status;
sys_inb(wini[drive].base_dma + DMA_STATUS, &w_status); sys_inb(wini[drive].base_dma + DMA_STATUS, &w_status);
@ -2490,7 +2471,7 @@ PRIVATE int atapi_intr_wait(int do_dma, size_t max)
inbyte[2].port = wn->base_cmd + REG_CNT_HI; inbyte[2].port = wn->base_cmd + REG_CNT_HI;
inbyte[3].port = wn->base_cmd + REG_IRR; inbyte[3].port = wn->base_cmd + REG_IRR;
if ((s=sys_vinb(inbyte, 4)) != OK) if ((s=sys_vinb(inbyte, 4)) != OK)
panic(w_name(),"ATAPI failed sys_vinb()", s); panic("ATAPI failed sys_vinb(): %d", s);
e = inbyte[0].value; e = inbyte[0].value;
len = inbyte[1].value; len = inbyte[1].value;
len |= inbyte[2].value << 8; len |= inbyte[2].value << 8;
@ -2549,7 +2530,7 @@ PRIVATE int at_voutb(int line, pvb_pair_t *pvb, int n)
printf("at_wini%d: sys_voutb failed: %d pvb (%d):\n", w_instance, s, n); printf("at_wini%d: sys_voutb failed: %d pvb (%d):\n", w_instance, s, n);
for(i = 0; i < n; i++) for(i = 0; i < n; i++)
printf("%2d: %4x -> %4x\n", i, pvb[i].value, pvb[i].port); printf("%2d: %4x -> %4x\n", i, pvb[i].value, pvb[i].port);
panic(w_name(), "sys_voutb failed", NO_NUM); panic("sys_voutb failed");
} }
PRIVATE int at_vinb(int line, pvb_pair_t *pvb, int n) PRIVATE int at_vinb(int line, pvb_pair_t *pvb, int n)
@ -2560,7 +2541,7 @@ PRIVATE int at_vinb(int line, pvb_pair_t *pvb, int n)
printf("at_wini%d: sys_vinb failed: %d pvb (%d):\n", w_instance, s, n); printf("at_wini%d: sys_vinb failed: %d pvb (%d):\n", w_instance, s, n);
for(i = 0; i < n; i++) for(i = 0; i < n; i++)
printf("%2d: %4x\n", i, pvb[i].port); printf("%2d: %4x\n", i, pvb[i].port);
panic(w_name(), "sys_vinb failed", NO_NUM); panic("sys_vinb failed");
} }
PRIVATE int at_out(int line, u32_t port, u32_t value, PRIVATE int at_out(int line, u32_t port, u32_t value,
@ -2572,7 +2553,7 @@ PRIVATE int at_out(int line, u32_t port, u32_t value,
return OK; return OK;
printf("at_wini%d: line %d: %s failed: %d; %x -> %x\n", printf("at_wini%d: line %d: %s failed: %d; %x -> %x\n",
w_instance, line, typename, s, value, port); w_instance, line, typename, s, value, port);
panic(w_name(), "sys_out failed", NO_NUM); panic("sys_out failed");
} }
@ -2585,7 +2566,7 @@ PRIVATE int at_in(int line, u32_t port, u32_t *value,
return OK; return OK;
printf("at_wini%d: line %d: %s failed: %d; port %x\n", printf("at_wini%d: line %d: %s failed: %d; port %x\n",
w_instance, line, typename, s, value, port); w_instance, line, typename, s, value, port);
panic(w_name(), "sys_in failed", NO_NUM); panic("sys_in failed");
} }

View file

@ -531,21 +531,21 @@ PRIVATE void atl2_init(int devind)
*/ */
state.base = vm_map_phys(SELF, (void *) bar, ATL2_MMAP_SIZE); state.base = vm_map_phys(SELF, (void *) bar, ATL2_MMAP_SIZE);
if (state.base == MAP_FAILED) if (state.base == MAP_FAILED)
panic("atl2", "unable to map in registers", NO_NUM); panic("unable to map in registers");
if ((r = atl2_alloc_dma()) != OK) if ((r = atl2_alloc_dma()) != OK)
panic("atl2", "unable to allocate DMA buffers", r); panic("unable to allocate DMA buffers: %d", r);
state.irq = pci_attr_r8(devind, PCI_ILR); state.irq = pci_attr_r8(devind, PCI_ILR);
if ((r = sys_irqsetpolicy(state.irq, 0, &state.hook_id)) != OK) if ((r = sys_irqsetpolicy(state.irq, 0, &state.hook_id)) != OK)
panic("atl2", "unable to register IRQ", r); panic("unable to register IRQ: %d", r);
if (!atl2_reset()) if (!atl2_reset())
panic("atl2", "unable to reset hardware", NO_NUM); panic("unable to reset hardware");
if ((r = sys_irqenable(&state.hook_id)) != OK) if ((r = sys_irqenable(&state.hook_id)) != OK)
panic("atl2", "unable to enable IRQ", r); panic("unable to enable IRQ: %d", r);
atl2_get_hwaddr(); atl2_get_hwaddr();
@ -746,7 +746,7 @@ PRIVATE void atl2_reply(void)
m.DL_COUNT)); m.DL_COUNT));
if ((r = send(state.task_endpt, &m)) != OK) if ((r = send(state.task_endpt, &m)) != OK)
panic("atl2", "unable to reply", r); panic("unable to reply: %d", r);
state.flags &= ~(ATL2_FLAG_PACK_SENT | ATL2_FLAG_PACK_RCVD); state.flags &= ~(ATL2_FLAG_PACK_SENT | ATL2_FLAG_PACK_RCVD);
state.recv_count = 0; state.recv_count = 0;
@ -805,7 +805,7 @@ PRIVATE void atl2_readv(message *m, int from_int)
r = sys_safecopyfrom(m->DL_PROC, m->DL_GRANT, off, r = sys_safecopyfrom(m->DL_PROC, m->DL_GRANT, off,
(vir_bytes) iovec, batch * sizeof(iovec[0]), D); (vir_bytes) iovec, batch * sizeof(iovec[0]), D);
if (r != OK) if (r != OK)
panic("atl2", "vector copy failed", r); panic("vector copy failed: %d", r);
/* Copy out each element in the batch, until we run out. */ /* Copy out each element in the batch, until we run out. */
for (j = 0, iovp = iovec; j < batch && left > 0; j++, iovp++) { for (j = 0, iovp = iovec; j < batch && left > 0; j++, iovp++) {
@ -814,7 +814,7 @@ PRIVATE void atl2_readv(message *m, int from_int)
r = sys_safecopyto(m->DL_PROC, iovp->iov_grant, 0, r = sys_safecopyto(m->DL_PROC, iovp->iov_grant, 0,
(vir_bytes) pos, size, D); (vir_bytes) pos, size, D);
if (r != OK) if (r != OK)
panic("atl2", "safe copy failed", r); panic("safe copy failed: %d", r);
pos += size; pos += size;
left -= size; left -= size;
@ -908,7 +908,7 @@ PRIVATE void atl2_writev(message *m, int from_int)
r = sys_safecopyfrom(m->DL_PROC, m->DL_GRANT, off, r = sys_safecopyfrom(m->DL_PROC, m->DL_GRANT, off,
(vir_bytes) iovec, batch * sizeof(iovec[0]), D); (vir_bytes) iovec, batch * sizeof(iovec[0]), D);
if (r != OK) if (r != OK)
panic("atl2", "vector copy failed", r); panic("vector copy failed: %d", r);
/* Copy in each element in the batch. */ /* Copy in each element in the batch. */
for (j = 0, iovp = iovec; j < batch; j++, iovp++) { for (j = 0, iovp = iovec; j < batch; j++, iovp++) {
@ -924,7 +924,7 @@ PRIVATE void atl2_writev(message *m, int from_int)
(vir_bytes) (state.txd_base + pos), (vir_bytes) (state.txd_base + pos),
skip, D); skip, D);
if (r != OK) if (r != OK)
panic("atl2", "safe copy failed", r); panic("safe copy failed: %d", r);
pos = 0; pos = 0;
} }
@ -932,7 +932,7 @@ PRIVATE void atl2_writev(message *m, int from_int)
(vir_bytes) (state.txd_base + pos), (vir_bytes) (state.txd_base + pos),
size - skip, D); size - skip, D);
if (r != OK) if (r != OK)
panic("atl2", "safe copy failed", r); panic("safe copy failed: %d", r);
pos = (pos + size - skip) % ATL2_TXD_BUFSIZE; pos = (pos + size - skip) % ATL2_TXD_BUFSIZE;
left -= size; left -= size;
@ -1029,7 +1029,7 @@ PRIVATE void atl2_intr(message *m)
ATL2_WRITE_U32(ATL2_ISR_REG, 0); ATL2_WRITE_U32(ATL2_ISR_REG, 0);
if ((r = sys_irqenable(&state.hook_id)) != OK) if ((r = sys_irqenable(&state.hook_id)) != OK)
panic("atl2", "unable to enable IRQ", r); panic("unable to enable IRQ: %d", r);
/* Attempt to satisfy pending write and read requests. */ /* Attempt to satisfy pending write and read requests. */
if (try_write) if (try_write)
@ -1135,7 +1135,7 @@ PRIVATE void atl2_shutdown(void)
atl2_stop(); atl2_stop();
if ((r = sys_irqrmpolicy(&state.hook_id)) != OK) if ((r = sys_irqrmpolicy(&state.hook_id)) != OK)
panic("atl2", "unable to deregister IRQ", r); panic("unable to deregister IRQ: %d", r);
free_contig(state.txd_base, ATL2_TXD_BUFSIZE); free_contig(state.txd_base, ATL2_TXD_BUFSIZE);
free_contig(state.txs_base, ATL2_TXS_COUNT * sizeof(u32_t)); free_contig(state.txs_base, ATL2_TXS_COUNT * sizeof(u32_t));
@ -1251,7 +1251,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
devind = atl2_probe(instance); devind = atl2_probe(instance);
if (devind < 0) if (devind < 0)
panic("atl2", "no matching device found", NO_NUM); panic("no matching device found");
/* Initialize the device. */ /* Initialize the device. */
atl2_init(devind); atl2_init(devind);
@ -1310,7 +1310,7 @@ int main(int argc, char **argv)
while (TRUE) { while (TRUE) {
if ((r = sef_receive(ANY, &m)) != OK) if ((r = sef_receive(ANY, &m)) != OK)
panic("atl2", "sef_receive failed", r); panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) { if (is_notify(m.m_type)) {
switch (m.m_source) { switch (m.m_source) {

View file

@ -432,7 +432,7 @@ PUBLIC int sb16_inb(int port) {
int s, value = -1; int s, value = -1;
if ((s=sys_inb(port, &value)) != OK) if ((s=sys_inb(port, &value)) != OK)
panic("SB16DSP","sys_inb() failed", s); panic("sys_inb() failed: %d", s);
return value; return value;
} }
@ -443,5 +443,5 @@ PUBLIC void sb16_outb(int port, int value) {
int s; int s;
if ((s=sys_outb(port, value)) != OK) if ((s=sys_outb(port, value)) != OK)
panic("SB16DSP","sys_outb() failed", s); panic("sys_outb() failed: %d", s);
} }

View file

@ -255,7 +255,7 @@ unsigned nr_req; /* length of request vector */
0, (vir_bytes) (bios_buf_v+count), 0, (vir_bytes) (bios_buf_v+count),
chunk, D); chunk, D);
if (r != OK) if (r != OK)
panic(ME, "copy failed", r); panic("copy failed: %d", r);
} else { } else {
memcpy(bios_buf_v+count, memcpy(bios_buf_v+count,
(char *) iop->iov_addr, chunk); (char *) iop->iov_addr, chunk);
@ -299,7 +299,7 @@ unsigned nr_req; /* length of request vector */
r= sys_int86(&reg86); r= sys_int86(&reg86);
if (r != OK) if (r != OK)
panic(ME, "BIOS call failed", r); panic("BIOS call failed: %d", r);
if (reg86.u.w.f & 0x0001) { if (reg86.u.w.f & 0x0001) {
/* An error occurred, try again sector by sector unless */ /* An error occurred, try again sector by sector unless */
@ -321,7 +321,7 @@ unsigned nr_req; /* length of request vector */
chunk, D); chunk, D);
if (r != OK) if (r != OK)
panic(ME, "sys_vircopy failed", r); panic("sys_vircopy failed: %d", r);
} else { } else {
memcpy((char *) iop->iov_addr, memcpy((char *) iop->iov_addr,
bios_buf_v+count, chunk); bios_buf_v+count, chunk);
@ -413,11 +413,11 @@ PRIVATE void w_init()
/* Ask the system task for a suitable buffer */ /* Ask the system task for a suitable buffer */
if(!(bios_buf_v = alloc_contig(BIOSBUF, AC_LOWER1M, &bios_buf_phys))) { if(!(bios_buf_v = alloc_contig(BIOSBUF, AC_LOWER1M, &bios_buf_phys))) {
panic(ME, "allocating bios buffer failed", ENOMEM); panic("allocating bios buffer failed: %d", ENOMEM);
} }
if (bios_buf_phys+BIOSBUF > 0x100000) if (bios_buf_phys+BIOSBUF > 0x100000)
panic(ME, "bad BIOS buffer, phys", bios_buf_phys); panic("bad BIOS buffer / phys: %d", bios_buf_phys);
#if 0 #if 0
printf("bios_wini: got buffer size %d, virtual 0x%x, phys 0x%x\n", printf("bios_wini: got buffer size %d, virtual 0x%x, phys 0x%x\n",
BIOSBUF, bios_buf_v, bios_buf_phys); BIOSBUF, bios_buf_v, bios_buf_phys);
@ -446,7 +446,7 @@ PRIVATE void w_init()
reg86.u.b.dl = drive_id; reg86.u.b.dl = drive_id;
r= sys_int86(&reg86); r= sys_int86(&reg86);
if (r != OK) if (r != OK)
panic(ME, "BIOS call failed", r); panic("BIOS call failed: %d", r);
nr_drives = !(reg86.u.w.f & 0x0001) ? reg86.u.b.dl : drive; nr_drives = !(reg86.u.w.f & 0x0001) ? reg86.u.b.dl : drive;
if (drive_id >= 0x80 + nr_drives) continue; if (drive_id >= 0x80 + nr_drives) continue;
@ -466,7 +466,7 @@ PRIVATE void w_init()
if (pc_at) { if (pc_at) {
r= sys_int86(&reg86); r= sys_int86(&reg86);
if (r != OK) if (r != OK)
panic(ME, "BIOS call failed", r); panic("BIOS call failed: %d", r);
} }
if (!(reg86.u.w.f & 0x0001) && reg86.u.w.bx == 0xAA55 if (!(reg86.u.w.f & 0x0001) && reg86.u.w.bx == 0xAA55
@ -481,7 +481,7 @@ PRIVATE void w_init()
r= sys_int86(&reg86); r= sys_int86(&reg86);
if (r != OK) if (r != OK)
panic(ME, "BIOS call failed", r); panic("BIOS call failed: %d", r);
if (!(reg86.u.w.f & 0x0001)) { if (!(reg86.u.w.f & 0x0001)) {
wn->int13ext = 1; /* Extensions can be used. */ wn->int13ext = 1; /* Extensions can be used. */

View file

@ -104,7 +104,7 @@ int main(int argc, char *argv[])
while (TRUE) while (TRUE)
{ {
if ((r= sef_receive(ANY, &m)) != OK) if ((r= sef_receive(ANY, &m)) != OK)
panic(str_DevName, "minix msg sef_receive failed", r); panic("minix msg sef_receive failed: %d", r);
if(is_notify(m.m_type)) { if(is_notify(m.m_type)) {
switch(_ENDPOINT_P(m.m_source)) { switch(_ENDPOINT_P(m.m_source)) {
@ -147,7 +147,7 @@ int main(int argc, char *argv[])
default: default:
printf("message 0x%lx; %d from %d\n", printf("message 0x%lx; %d from %d\n",
m.m_type, m.m_type-DL_RQ_BASE, m.m_source); m.m_type, m.m_type-DL_RQ_BASE, m.m_source);
panic(str_DevName, "illegal message", m.m_type); panic("illegal message: %d", m.m_type);
} }
} }
} }
@ -159,7 +159,7 @@ PRIVATE void do_get_stat_s(message * mp)
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) if (port < 0 || port >= DE_PORT_NR)
panic(str_DevName, str_PortErrMsg, port); panic(str_PortErrMsg, port);
dep = &de_table[port]; dep = &de_table[port];
dep->de_client = mp->DL_PROC; dep->de_client = mp->DL_PROC;
@ -167,14 +167,14 @@ PRIVATE void do_get_stat_s(message * mp)
if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes)&dep->de_stat, (vir_bytes)&dep->de_stat,
(vir_bytes) sizeof(dep->de_stat), 0)) != OK) (vir_bytes) sizeof(dep->de_stat), 0)) != OK)
panic(str_DevName, str_CopyErrMsg, rc); panic(str_CopyErrMsg, rc);
mp->m_type = DL_STAT_REPLY; mp->m_type = DL_STAT_REPLY;
mp->DL_PORT = port; mp->DL_PORT = port;
mp->DL_STAT = OK; mp->DL_STAT = OK;
rc = send(mp->m_source, mp); rc = send(mp->m_source, mp);
if( rc != OK ) if( rc != OK )
panic(str_DevName, str_StatErrMsg, rc); panic(str_StatErrMsg, rc);
return; return;
} }
@ -244,7 +244,7 @@ PRIVATE void do_conf(message * mp)
*(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address; *(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address;
if (send(mp->m_source, &reply_mess) != OK) if (send(mp->m_source, &reply_mess) != OK)
panic(str_DevName, str_SendErrMsg, mp->m_source); panic(str_SendErrMsg, mp->m_source);
return; return;
} }
@ -259,7 +259,7 @@ message *mp;
mp->m_type= DL_NAME_REPLY; mp->m_type= DL_NAME_REPLY;
r = send(mp->m_source, mp); r = send(mp->m_source, mp);
if (r!= OK) if (r!= OK)
panic(str_DevName, "do_getname: send failed", r); panic("do_getname: send failed: %d", r);
} }
PRIVATE void do_reply(dpeth_t * dep, int err, int may_block) PRIVATE void do_reply(dpeth_t * dep, int err, int may_block)
@ -285,7 +285,7 @@ PRIVATE void do_reply(dpeth_t * dep, int err, int may_block)
} }
if(status < 0) if(status < 0)
panic(dep->de_name, str_SendErrMsg, status); panic(str_SendErrMsg, status);
dep->de_read_s = 0; dep->de_read_s = 0;
dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV); dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV);
@ -325,7 +325,7 @@ PRIVATE int de_probe(dpeth_t *dep){
dep->de_irq = pci_attr_r8(devind, PCI_ILR); dep->de_irq = pci_attr_r8(devind, PCI_ILR);
if (dep->de_base_port < DE_MIN_BASE_ADDR) if (dep->de_base_port < DE_MIN_BASE_ADDR)
panic(str_DevName,"de_probe: base address invalid ", dep->de_base_port); panic("de_probe: base address invalid: %d", dep->de_base_port);
DEBUG(printf("%s: using I/O address 0x%lx, IRQ %d\n", DEBUG(printf("%s: using I/O address 0x%lx, IRQ %d\n",
dep->de_name, (unsigned long)dep->de_base_port, dep->de_name, (unsigned long)dep->de_base_port,
@ -443,7 +443,7 @@ PRIVATE void do_vread_s(message * mp, int from_int)
iovec_dat_s_t *iovp = NULL; iovec_dat_s_t *iovp = NULL;
if (mp->DL_PORT < 0 || mp->DL_PORT >= DE_PORT_NR) if (mp->DL_PORT < 0 || mp->DL_PORT >= DE_PORT_NR)
panic(dep->de_name, str_PortErrMsg, mp->DL_PORT); panic(str_PortErrMsg, mp->DL_PORT);
dep = &de_table[mp->DL_PORT]; dep = &de_table[mp->DL_PORT];
dep->de_client = mp->DL_PROC; dep->de_client = mp->DL_PROC;
@ -488,7 +488,7 @@ PRIVATE void do_vread_s(message * mp, int from_int)
dep->de_read_iovec.iod_iovec_offset = 0; dep->de_read_iovec.iod_iovec_offset = 0;
size = de_calc_iov_size(&dep->de_read_iovec); size = de_calc_iov_size(&dep->de_read_iovec);
if (size < ETH_MAX_PACK_SIZE) if (size < ETH_MAX_PACK_SIZE)
panic(str_DevName, str_SizeErrMsg, size); panic(str_SizeErrMsg, size);
/* Copy buffer to user area and clear ownage */ /* Copy buffer to user area and clear ownage */
size = (descr->descr->des[DES0]&DES0_FL)>>DES0_FL_SHIFT; size = (descr->descr->des[DES0]&DES0_FL)>>DES0_FL_SHIFT;
@ -526,7 +526,7 @@ PRIVATE void do_vread_s(message * mp, int from_int)
r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0,
(vir_bytes)buffer, bytes, D); (vir_bytes)buffer, bytes, D);
if (r != OK) if (r != OK)
panic(str_DevName, str_CopyErrMsg, r); panic(str_CopyErrMsg, r);
buffer += bytes; buffer += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
@ -624,7 +624,7 @@ PRIVATE void de_first_init(dpeth_t *dep)
/* translate buffers physical address */ /* translate buffers physical address */
r = sys_umap(SELF, VM_D, loc_descr->buf1, temp, r = sys_umap(SELF, VM_D, loc_descr->buf1, temp,
&(loc_descr->descr->des[DES_BUF1])); &(loc_descr->descr->des[DES_BUF1]));
if(r != OK) panic(dep->de_name, "umap failed", r); if(r != OK) panic("umap failed: %d", r);
loc_descr->descr->des[DES_BUF2] = 0; loc_descr->descr->des[DES_BUF2] = 0;
memset(&loc_descr->descr->des[DES0],0,sizeof(u32_t)); memset(&loc_descr->descr->des[DES0],0,sizeof(u32_t));
loc_descr->descr->des[DES1] = temp; loc_descr->descr->des[DES1] = temp;
@ -639,11 +639,11 @@ PRIVATE void de_first_init(dpeth_t *dep)
/* record physical location of two first descriptor */ /* record physical location of two first descriptor */
r = sys_umap(SELF, VM_D, dep->descr[DESCR_RECV][0].descr, r = sys_umap(SELF, VM_D, dep->descr[DESCR_RECV][0].descr,
sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_RECV]); sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_RECV]);
if(r != OK) panic(str_DevName, str_UmapErrMsg, r); if(r != OK) panic(str_UmapErrMsg, r);
r = sys_umap(SELF, VM_D, dep->descr[DESCR_TRAN][0].descr, r = sys_umap(SELF, VM_D, dep->descr[DESCR_TRAN][0].descr,
sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_TRAN]); sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_TRAN]);
if(r != OK) panic(str_DevName, str_UmapErrMsg, r); if(r != OK) panic(str_UmapErrMsg, r);
DEBUG(printf("Descr: head tran=[%08X] head recv=[%08X]\n", DEBUG(printf("Descr: head tran=[%08X] head recv=[%08X]\n",
dep->sendrecv_descr_phys_addr[DESCR_TRAN], dep->sendrecv_descr_phys_addr[DESCR_TRAN],
@ -656,12 +656,12 @@ PRIVATE void de_first_init(dpeth_t *dep)
r = sys_umap(SELF, VM_D, &(loc_descr->descr), sizeof(de_descr_t), r = sys_umap(SELF, VM_D, &(loc_descr->descr), sizeof(de_descr_t),
&temp); &temp);
if(r != OK) if(r != OK)
panic(str_DevName, str_UmapErrMsg, r); panic(str_UmapErrMsg, r);
if( ((loc_descr->descr->des[DES_BUF1] & 0x3) != 0) || if( ((loc_descr->descr->des[DES_BUF1] & 0x3) != 0) ||
((loc_descr->descr->des[DES_BUF2] & 0x3) != 0) || ((loc_descr->descr->des[DES_BUF2] & 0x3) != 0) ||
((temp&0x3)!=0) ) ((temp&0x3)!=0) )
panic(str_DevName, str_AlignErrMsg, temp); panic(str_AlignErrMsg, temp);
loc_descr++; loc_descr++;
} }
@ -686,7 +686,7 @@ PRIVATE void do_interrupt(dpeth_t *dep){
val = io_inl(CSR_ADDR(dep, CSR5)); val = io_inl(CSR_ADDR(dep, CSR5));
if(val & CSR5_AIS){ if(val & CSR5_AIS){
panic(dep->de_name, "Abnormal Int CSR5=", val); panic("Abnormal Int CSR5=: %d", val);
} }
if( (dep->de_flags & DEF_READING) && (val & CSR5_RI) ){ if( (dep->de_flags & DEF_READING) && (val & CSR5_RI) ){
@ -793,7 +793,7 @@ PRIVATE void de_get_userdata_s(int user_proc, cp_grant_id_t grant,
len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t); len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t);
rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D); rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D);
if (rc != OK) if (rc != OK)
panic(str_DevName, str_CopyErrMsg, rc); panic(str_CopyErrMsg, rc);
return; return;
} }
@ -815,7 +815,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){
char *buffer = NULL; char *buffer = NULL;
if( mp->DL_PORT < 0 || mp->DL_PORT >= DE_PORT_NR) if( mp->DL_PORT < 0 || mp->DL_PORT >= DE_PORT_NR)
panic(str_DevName, str_PortErrMsg, mp->DL_PORT); panic(str_PortErrMsg, mp->DL_PORT);
dep = &de_table[mp->DL_PORT]; dep = &de_table[mp->DL_PORT];
dep->de_client = mp->DL_PROC; dep->de_client = mp->DL_PROC;
@ -823,7 +823,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){
if (dep->de_mode == DEM_ENABLED) { if (dep->de_mode == DEM_ENABLED) {
if (!from_int && (dep->de_flags & DEF_SENDING)) if (!from_int && (dep->de_flags & DEF_SENDING))
panic(str_DevName, str_BusyErrMsg, NO_NUM); panic(str_BusyErrMsg);
descr = &dep->descr[DESCR_TRAN][dep->cur_descr[DESCR_TRAN]]; descr = &dep->descr[DESCR_TRAN][dep->cur_descr[DESCR_TRAN]];
@ -845,7 +845,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){
iovp->iod_iovec_offset = 0; iovp->iod_iovec_offset = 0;
totalsize = size = de_calc_iov_size(iovp); totalsize = size = de_calc_iov_size(iovp);
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE) if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)
panic(str_DevName, str_SizeErrMsg, size); panic(str_SizeErrMsg, size);
dep->bytes_tx += size; dep->bytes_tx += size;
dep->de_stat.ets_packetT++; dep->de_stat.ets_packetT++;
@ -859,7 +859,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){
r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant,
0, (vir_bytes)buffer, bytes, D); 0, (vir_bytes)buffer, bytes, D);
if (r != OK) if (r != OK)
panic(str_DevName, str_CopyErrMsg, r); panic(str_CopyErrMsg, r);
buffer += bytes; buffer += bytes;
if (++ix >= IOVEC_NR) { if (++ix >= IOVEC_NR) {
@ -889,7 +889,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){
suspend: suspend:
if(from_int) if(from_int)
panic(str_DevName, "should not happen", 0); panic("should not happen: %d", 0);
dep->de_stat.ets_transDef++; dep->de_stat.ets_transDef++;
dep->de_flags |= DEF_SENDING; dep->de_flags |= DEF_SENDING;

View file

@ -96,7 +96,7 @@ dpeth_t * dep;
/* Set interrupt level for 3c503 */ /* Set interrupt level for 3c503 */
irq = (dep->de_irq &= ~DEI_DEFAULT); /* Strip the default flag. */ irq = (dep->de_irq &= ~DEI_DEFAULT); /* Strip the default flag. */
if (irq == 9) irq = 2; if (irq == 9) irq = 2;
if (irq < 2 || irq > 5) panic("", "bad 3c503 irq configuration", irq); if (irq < 2 || irq > 5) panic("bad 3c503 irq configuration: %d", irq);
outb_el2(dep, EL2_IDCFG, (0x04 << irq)); outb_el2(dep, EL2_IDCFG, (0x04 << irq));
outb_el2(dep, EL2_DRQCNT, 0x08); /* Set burst size to 8 */ outb_el2(dep, EL2_DRQCNT, 0x08); /* Set burst size to 8 */

View file

@ -220,10 +220,8 @@ PRIVATE int handle_hw_intr(void)
dp_check_ints(dep); dp_check_ints(dep);
do_int(dep); do_int(dep);
r= sys_irqenable(&dep->de_hook); r= sys_irqenable(&dep->de_hook);
if (r != OK) if (r != OK) {
{ panic("unable enable interrupts: %d", r);
panic("DP8390",
"unable enable interrupts", r);
} }
} }
} }
@ -252,7 +250,7 @@ int main(int argc, char *argv[])
while (TRUE) while (TRUE)
{ {
if ((r= sef_receive(ANY, &m)) != OK) if ((r= sef_receive(ANY, &m)) != OK)
panic("", "dp8390: sef_receive failed", r); panic("dp8390: sef_receive failed: %d", r);
if (is_notify(m.m_type)) { if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) { switch (_ENDPOINT_P(m.m_source)) {
@ -274,8 +272,8 @@ int main(int argc, char *argv[])
printf("dp8390: notify from CLOCK\n"); printf("dp8390: notify from CLOCK\n");
break; break;
default: default:
panic("", "dp8390: illegal notify from", panic("dp8390: illegal notify from: %d",
m.m_source); m.m_source);
} }
/* done, get a new message */ /* done, get a new message */
@ -296,7 +294,7 @@ int main(int argc, char *argv[])
case DL_GETNAME: do_getname(&m); break; case DL_GETNAME: do_getname(&m); break;
case DL_STOP: do_stop(&m); break; case DL_STOP: do_stop(&m); break;
default: default:
panic("", "dp8390: illegal message", m.m_type); panic("dp8390: illegal message: %d", m.m_type);
} }
} }
} }
@ -328,10 +326,8 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
system_hz = sys_hz(); system_hz = sys_hz();
if (env_argc < 1) if (env_argc < 1) {
{ panic("A head which at this time has no name");
panic("DP8390",
"A head which at this time has no name", NO_NUM);
} }
(progname=strrchr(env_argv[0],'/')) ? progname++ (progname=strrchr(env_argv[0],'/')) ? progname++
: (progname=env_argv[0]); : (progname=env_argv[0]);
@ -493,7 +489,7 @@ int vectored;
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= DE_PORT_NR) if (port < 0 || port >= DE_PORT_NR)
panic("", "dp8390: illegal port", port); panic("dp8390: illegal port: %d", port);
dep= &de_table[port]; dep= &de_table[port];
dep->de_client= mp->DL_PROC; dep->de_client= mp->DL_PROC;
@ -507,13 +503,13 @@ int vectored;
assert(dep->de_mode == DEM_ENABLED); assert(dep->de_mode == DEM_ENABLED);
assert(dep->de_flags & DEF_ENABLED); assert(dep->de_flags & DEF_ENABLED);
if (dep->de_flags & DEF_SEND_AVAIL) if (dep->de_flags & DEF_SEND_AVAIL)
panic("", "dp8390: send already in progress", NO_NUM); panic("dp8390: send already in progress");
sendq_head= dep->de_sendq_head; sendq_head= dep->de_sendq_head;
if (dep->de_sendq[sendq_head].sq_filled) if (dep->de_sendq[sendq_head].sq_filled)
{ {
if (from_int) if (from_int)
panic("", "dp8390: should not be sending\n", NO_NUM); panic("dp8390: should not be sending");
dep->de_sendmsg= *mp; dep->de_sendmsg= *mp;
dep->de_flags |= DEF_SEND_AVAIL; dep->de_flags |= DEF_SEND_AVAIL;
reply(dep, OK, FALSE); reply(dep, OK, FALSE);
@ -546,7 +542,7 @@ int vectored;
} }
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
{ {
panic("", "dp8390: invalid packet size", size); panic("dp8390: invalid packet size: %d", size);
} }
(dep->de_user2nicf)(dep, &dep->de_write_iovec, 0, (dep->de_user2nicf)(dep, &dep->de_write_iovec, 0,
dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE, dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE,
@ -594,7 +590,7 @@ int from_int;
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= DE_PORT_NR) if (port < 0 || port >= DE_PORT_NR)
panic("", "dp8390: illegal port", port); panic("dp8390: illegal port: %d", port);
dep= &de_table[port]; dep= &de_table[port];
dep->de_client= mp->DL_PROC; dep->de_client= mp->DL_PROC;
@ -608,13 +604,13 @@ int from_int;
assert(dep->de_mode == DEM_ENABLED); assert(dep->de_mode == DEM_ENABLED);
assert(dep->de_flags & DEF_ENABLED); assert(dep->de_flags & DEF_ENABLED);
if (dep->de_flags & DEF_SEND_AVAIL) if (dep->de_flags & DEF_SEND_AVAIL)
panic("", "dp8390: send already in progress", NO_NUM); panic("dp8390: send already in progress");
sendq_head= dep->de_sendq_head; sendq_head= dep->de_sendq_head;
if (dep->de_sendq[sendq_head].sq_filled) if (dep->de_sendq[sendq_head].sq_filled)
{ {
if (from_int) if (from_int)
panic("", "dp8390: should not be sending\n", NO_NUM); panic("dp8390: should not be sending");
dep->de_sendmsg= *mp; dep->de_sendmsg= *mp;
dep->de_flags |= DEF_SEND_AVAIL; dep->de_flags |= DEF_SEND_AVAIL;
reply(dep, OK, FALSE); reply(dep, OK, FALSE);
@ -636,7 +632,7 @@ int from_int;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
{ {
panic("", "dp8390: invalid packet size", size); panic("dp8390: invalid packet size: %d", size);
} }
(dep->de_user2nicf_s)(dep, &dep->de_write_iovec_s, 0, (dep->de_user2nicf_s)(dep, &dep->de_write_iovec_s, 0,
dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE, dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE,
@ -684,7 +680,7 @@ int vectored;
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= DE_PORT_NR) if (port < 0 || port >= DE_PORT_NR)
panic("", "dp8390: illegal port", port); panic("dp8390: illegal port: %d", port);
dep= &de_table[port]; dep= &de_table[port];
dep->de_client= mp->DL_PROC; dep->de_client= mp->DL_PROC;
if (dep->de_mode == DEM_SINK) if (dep->de_mode == DEM_SINK)
@ -696,7 +692,7 @@ int vectored;
assert(dep->de_flags & DEF_ENABLED); assert(dep->de_flags & DEF_ENABLED);
if(dep->de_flags & DEF_READING) if(dep->de_flags & DEF_READING)
panic("", "dp8390: read already in progress", NO_NUM); panic("dp8390: read already in progress");
dep->de_safecopy_read= 0; dep->de_safecopy_read= 0;
@ -724,7 +720,7 @@ int vectored;
size= count; size= count;
} }
if (size < ETH_MAX_PACK_SIZE_TAGGED) if (size < ETH_MAX_PACK_SIZE_TAGGED)
panic("", "dp8390: wrong packet size", size); panic("dp8390: wrong packet size: %d", size);
dep->de_flags |= DEF_READING; dep->de_flags |= DEF_READING;
dp_recv(dep); dp_recv(dep);
@ -753,7 +749,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= DE_PORT_NR) if (port < 0 || port >= DE_PORT_NR)
panic("", "dp8390: illegal port", port); panic("dp8390: illegal port: %d", port);
dep= &de_table[port]; dep= &de_table[port];
dep->de_client= mp->DL_PROC; dep->de_client= mp->DL_PROC;
if (dep->de_mode == DEM_SINK) if (dep->de_mode == DEM_SINK)
@ -767,7 +763,7 @@ message *mp;
dep->de_safecopy_read= 1; dep->de_safecopy_read= 1;
if(dep->de_flags & DEF_READING) if(dep->de_flags & DEF_READING)
panic("", "dp8390: read already in progress", NO_NUM); panic("dp8390: read already in progress");
get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0, get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0,
(count > IOVEC_NR ? IOVEC_NR : count) * (count > IOVEC_NR ? IOVEC_NR : count) *
@ -782,7 +778,7 @@ message *mp;
size= calc_iovec_size_s(&dep->de_tmp_iovec_s); size= calc_iovec_size_s(&dep->de_tmp_iovec_s);
if (size < ETH_MAX_PACK_SIZE_TAGGED) if (size < ETH_MAX_PACK_SIZE_TAGGED)
panic("", "dp8390: wrong packet size", size); panic("dp8390: wrong packet size: %d", size);
dep->de_flags |= DEF_READING; dep->de_flags |= DEF_READING;
dp_recv(dep); dp_recv(dep);
@ -893,7 +889,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) if (port < 0 || port >= DE_PORT_NR)
panic("", "dp8390: illegal port", port); panic("dp8390: illegal port: %d", port);
dep= &de_table[port]; dep= &de_table[port];
dep->de_client= mp->DL_PROC; dep->de_client= mp->DL_PROC;
if (dep->de_mode == DEM_SINK) if (dep->de_mode == DEM_SINK)
@ -906,7 +902,7 @@ message *mp;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic(__FILE__, "do_getstat: send failed: %d\n", r); panic("do_getstat: send failed: %d", r);
return; return;
} }
assert(dep->de_mode == DEM_ENABLED); assert(dep->de_mode == DEM_ENABLED);
@ -924,7 +920,7 @@ message *mp;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic(__FILE__, "do_getstat: send failed: %d\n", r); panic("do_getstat: send failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -938,7 +934,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) if (port < 0 || port >= DE_PORT_NR)
panic("", "dp8390: illegal port", port); panic("dp8390: illegal port: %d", port);
dep= &de_table[port]; dep= &de_table[port];
dep->de_client= mp->DL_PROC; dep->de_client= mp->DL_PROC;
if (dep->de_mode == DEM_SINK) if (dep->de_mode == DEM_SINK)
@ -951,7 +947,7 @@ message *mp;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic(__FILE__, "do_getstat: send failed: %d\n", r); panic("do_getstat: send failed: %d", r);
return; return;
} }
assert(dep->de_mode == DEM_ENABLED); assert(dep->de_mode == DEM_ENABLED);
@ -969,7 +965,7 @@ message *mp;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic(__FILE__, "do_getstat: send failed: %d\n", r); panic("do_getstat: send failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -985,7 +981,7 @@ message *mp;
mp->m_type= DL_NAME_REPLY; mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("dp8390", "do_getname: send failed: %d\n", r); panic("do_getname: send failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -1000,7 +996,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) if (port < 0 || port >= DE_PORT_NR)
panic("", "dp8390: illegal port", port); panic("dp8390: illegal port: %d", port);
dep= &de_table[port]; dep= &de_table[port];
if (dep->de_mode == DEM_SINK) if (dep->de_mode == DEM_SINK)
return; return;
@ -1141,12 +1137,12 @@ dpeth_t *dep;
dep->de_hook = dep->de_irq; dep->de_hook = dep->de_irq;
r= sys_irqsetpolicy(dep->de_irq, 0, &dep->de_hook); r= sys_irqsetpolicy(dep->de_irq, 0, &dep->de_hook);
if (r != OK) if (r != OK)
panic("DP8390", "sys_irqsetpolicy failed", r); panic("sys_irqsetpolicy failed: %d", r);
r= sys_irqenable(&dep->de_hook); r= sys_irqenable(&dep->de_hook);
if (r != OK) if (r != OK)
{ {
panic("DP8390", "unable enable interrupts", r); panic("unable enable interrupts: %d", r);
} }
} }
@ -1242,7 +1238,7 @@ dpeth_t *dep;
int size, sendq_tail; int size, sendq_tail;
if (!(dep->de_flags & DEF_ENABLED)) if (!(dep->de_flags & DEF_ENABLED))
panic("", "dp8390: got premature interrupt", NO_NUM); panic("dp8390: got premature interrupt");
for(;;) for(;;)
{ {
@ -1486,7 +1482,7 @@ dpeth_t *dep;
case DL_WRITEV: do_vwrite(&dep->de_sendmsg, TRUE, TRUE); break; case DL_WRITEV: do_vwrite(&dep->de_sendmsg, TRUE, TRUE); break;
case DL_WRITEV_S: do_vwrite_s(&dep->de_sendmsg, TRUE); break; case DL_WRITEV_S: do_vwrite_s(&dep->de_sendmsg, TRUE); break;
default: default:
panic("", "dp8390: wrong type", dep->de_sendmsg.m_type); panic("dp8390: wrong type: %d", dep->de_sendmsg.m_type);
break; break;
} }
} }
@ -1662,7 +1658,7 @@ vir_bytes count;
iovp->iod_iovec[i].iov_addr + offset, iovp->iod_iovec[i].iov_addr + offset,
SELF, D, vir_hw, bytes); SELF, D, vir_hw, bytes);
if (r != OK) if (r != OK)
panic("DP8390", "dp_user2nic: sys_vircopy failed", r); panic("dp_user2nic: sys_vircopy failed: %d", r);
count -= bytes; count -= bytes;
vir_hw += bytes; vir_hw += bytes;
@ -1709,10 +1705,8 @@ vir_bytes count;
r= sys_safecopyfrom(iovp->iod_proc_nr, r= sys_safecopyfrom(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset, iovp->iod_iovec[i].iov_grant, offset,
vir_hw, bytes, D); vir_hw, bytes, D);
if (r != OK) if (r != OK) {
{ panic("dp_user2nic_s: sys_safecopyfrom failed: %d", r);
panic("DP8390",
"dp_user2nic_s: sys_safecopyfrom failed", r);
} }
count -= bytes; count -= bytes;
@ -1776,7 +1770,7 @@ vir_bytes count;
} }
if (i == 100) if (i == 100)
{ {
panic("", "dp8390: remote dma failed to complete", NO_NUM); panic("dp8390: remote dma failed to complete");
} }
} }
@ -1822,11 +1816,9 @@ vir_bytes count;
r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr, r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset, bytes); iovp->iod_iovec[i].iov_grant, offset, bytes);
if (r != OK) if (r != OK) {
{ panic("dp_pio8_user2nic_s: sys_safe_outsb failed: %d",
panic(__FILE__, r);
"dp_pio8_user2nic_s: sys_safe_outsb failed",
r);
} }
count -= bytes; count -= bytes;
offset += bytes; offset += bytes;
@ -1840,7 +1832,7 @@ vir_bytes count;
} }
if (i == 100) if (i == 100)
{ {
panic("", "dp8390: remote dma failed to complete", NO_NUM); panic("dp8390: remote dma failed to complete");
} }
} }
@ -1896,10 +1888,8 @@ vir_bytes count;
{ {
r= sys_vircopy(user_proc, D, vir_user, r= sys_vircopy(user_proc, D, vir_user,
SELF, D, (vir_bytes)&two_bytes[1], 1); SELF, D, (vir_bytes)&two_bytes[1], 1);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_user2nic: sys_vircopy failed: %d",
panic("DP8390",
"dp_pio16_user2nic: sys_vircopy failed",
r); r);
} }
outw(dep->de_data_port, *(u16_t *)two_bytes); outw(dep->de_data_port, *(u16_t *)two_bytes);
@ -1926,10 +1916,8 @@ vir_bytes count;
assert(bytes == 1); assert(bytes == 1);
r= sys_vircopy(user_proc, D, vir_user, r= sys_vircopy(user_proc, D, vir_user,
SELF, D, (vir_bytes)&two_bytes[0], 1); SELF, D, (vir_bytes)&two_bytes[0], 1);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_user2nic: sys_vircopy failed: %d",
panic("DP8390",
"dp_pio16_user2nic: sys_vircopy failed",
r); r);
} }
count--; count--;
@ -1951,7 +1939,7 @@ vir_bytes count;
} }
if (i == 100) if (i == 100)
{ {
panic("", "dp8390: remote dma failed to complete", NO_NUM); panic("dp8390: remote dma failed to complete");
} }
} }
@ -2007,11 +1995,8 @@ vir_bytes count;
{ {
r= sys_safecopyfrom(user_proc, gid, offset, r= sys_safecopyfrom(user_proc, gid, offset,
(vir_bytes)&two_bytes[1], 1, D); (vir_bytes)&two_bytes[1], 1, D);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_user2nic: sys_safecopyfrom failed: %d", r);
panic("DP8390",
"dp_pio16_user2nic: sys_safecopyfrom failed",
r);
} }
outw(dep->de_data_port, *(u16_t *)two_bytes); outw(dep->de_data_port, *(u16_t *)two_bytes);
count--; count--;
@ -2026,11 +2011,8 @@ vir_bytes count;
{ {
r= sys_safe_outsw(dep->de_data_port, user_proc, r= sys_safe_outsw(dep->de_data_port, user_proc,
gid, offset, ecount); gid, offset, ecount);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_user2nic: sys_safe_outsw failed: %d", r);
panic("DP8390",
"dp_pio16_user2nic: sys_safe_outsw failed",
r);
} }
count -= ecount; count -= ecount;
offset += ecount; offset += ecount;
@ -2041,11 +2023,8 @@ vir_bytes count;
assert(bytes == 1); assert(bytes == 1);
r= sys_safecopyfrom(user_proc, gid, offset, r= sys_safecopyfrom(user_proc, gid, offset,
(vir_bytes)&two_bytes[0], 1, D); (vir_bytes)&two_bytes[0], 1, D);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_user2nic: sys_safecopyfrom failed: %d", r);
panic("DP8390",
"dp_pio16_user2nic: sys_safecopyfrom failed",
r);
} }
count--; count--;
offset++; offset++;
@ -2065,7 +2044,7 @@ vir_bytes count;
} }
if (i == 100) if (i == 100)
{ {
panic("", "dp8390: remote dma failed to complete", NO_NUM); panic("dp8390: remote dma failed to complete");
} }
} }
@ -2107,7 +2086,7 @@ vir_bytes count;
iovp->iod_proc_nr, D, iovp->iod_proc_nr, D,
iovp->iod_iovec[i].iov_addr + offset, bytes); iovp->iod_iovec[i].iov_addr + offset, bytes);
if (r != OK) if (r != OK)
panic("DP8390", "dp_nic2user: sys_vircopy failed", r); panic("dp_nic2user: sys_vircopy failed: %d", r);
count -= bytes; count -= bytes;
vir_hw += bytes; vir_hw += bytes;
@ -2155,8 +2134,7 @@ vir_bytes count;
iovp->iod_iovec[i].iov_grant, offset, iovp->iod_iovec[i].iov_grant, offset,
vir_hw, bytes, D); vir_hw, bytes, D);
if (r != OK) if (r != OK)
panic("DP8390", panic("dp_nic2user_s: sys_safecopyto failed: %d", r);
"dp_nic2user_s: sys_safecopyto failed", r);
count -= bytes; count -= bytes;
vir_hw += bytes; vir_hw += bytes;
@ -2251,10 +2229,8 @@ vir_bytes count;
r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr, r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset, bytes); iovp->iod_iovec[i].iov_grant, offset, bytes);
if (r != OK) if (r != OK) {
{ panic("dp_pio8_nic2user_s: sys_safe_insb failed: %d", r);
panic(__FILE__,
"dp_pio8_nic2user_s: sys_safe_insb failed", r);
} }
count -= bytes; count -= bytes;
offset += bytes; offset += bytes;
@ -2313,10 +2289,8 @@ vir_bytes count;
{ {
r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[1], r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[1],
user_proc, D, vir_user, 1); user_proc, D, vir_user, 1);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_nic2user: sys_vircopy failed: %d",
panic("DP8390",
"dp_pio16_nic2user: sys_vircopy failed",
r); r);
} }
count--; count--;
@ -2343,11 +2317,8 @@ vir_bytes count;
*(u16_t *)two_bytes= inw(dep->de_data_port); *(u16_t *)two_bytes= inw(dep->de_data_port);
r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[0], r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[0],
user_proc, D, vir_user, 1); user_proc, D, vir_user, 1);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_nic2user: sys_vircopy failed: %d", r);
panic("DP8390",
"dp_pio16_nic2user: sys_vircopy failed",
r);
} }
count--; count--;
offset++; offset++;
@ -2410,11 +2381,8 @@ vir_bytes count;
{ {
r= sys_safecopyto(user_proc, gid, offset, r= sys_safecopyto(user_proc, gid, offset,
(vir_bytes)&two_bytes[1], 1, D); (vir_bytes)&two_bytes[1], 1, D);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_nic2user: sys_safecopyto failed: %d", r);
panic("DP8390",
"dp_pio16_nic2user: sys_safecopyto failed",
r);
} }
count--; count--;
offset++; offset++;
@ -2428,11 +2396,9 @@ vir_bytes count;
{ {
r= sys_safe_insw(dep->de_data_port, user_proc, gid, r= sys_safe_insw(dep->de_data_port, user_proc, gid,
offset, ecount); offset, ecount);
if (r != OK) if (r != OK) {
{ panic("dp_pio16_nic2user: sys_safe_insw failed: %d",
panic("DP8390", r);
"dp_pio16_nic2user: sys_safe_insw failed",
r);
} }
count -= ecount; count -= ecount;
offset += ecount; offset += ecount;
@ -2446,8 +2412,7 @@ vir_bytes count;
(vir_bytes)&two_bytes[0], 1, D); (vir_bytes)&two_bytes[0], 1, D);
if (r != OK) if (r != OK)
{ {
panic("DP8390", panic("dp_pio16_nic2user: sys_safecopyto failed: %d",
"dp_pio16_nic2user: sys_safecopyto failed",
r); r);
} }
count--; count--;
@ -2602,7 +2567,7 @@ dpeth_t *dep;
*/ */
buf= malloc(size); buf= malloc(size);
if (buf == NULL) if (buf == NULL)
panic(__FILE__, "map_hw_buffer: cannot malloc size", size); panic("map_hw_buffer: cannot malloc size: %d", size);
o= I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE); o= I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE);
abuf= buf + o; abuf= buf + o;
printf("buf at 0x%x, abuf at 0x%x\n", buf, abuf); printf("buf at 0x%x, abuf at 0x%x\n", buf, abuf);
@ -2614,7 +2579,7 @@ dpeth_t *dep;
r = ENOSYS; r = ENOSYS;
#endif #endif
if (r != OK) if (r != OK)
panic(__FILE__, "map_hw_buffer: sys_vm_map failed", r); panic("map_hw_buffer: sys_vm_map failed: %d", r);
dep->de_locmem = abuf; dep->de_locmem = abuf;
} }
@ -2709,7 +2674,7 @@ int may_block;
} }
if (r < 0) if (r < 0)
panic("", "dp8390: send failed:", r); panic("dp8390: send failed: %d", r);
dep->de_read_s = 0; dep->de_read_s = 0;
dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV); dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV);
@ -2723,7 +2688,7 @@ message *req;
message *reply_mess; message *reply_mess;
{ {
if (send(req->m_source, reply_mess) != OK) if (send(req->m_source, reply_mess) != OK)
panic("", "dp8390: unable to mess_reply", NO_NUM); panic("dp8390: unable to mess_reply");
} }
/*===========================================================================* /*===========================================================================*
@ -2740,7 +2705,7 @@ void *loc_addr;
r= sys_vircopy(user_proc, D, user_addr, r= sys_vircopy(user_proc, D, user_addr,
SELF, D, (vir_bytes)loc_addr, count); SELF, D, (vir_bytes)loc_addr, count);
if (r != OK) if (r != OK)
panic("DP8390", "get_userdata: sys_vircopy failed", r); panic("get_userdata: sys_vircopy failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -2758,7 +2723,7 @@ void *loc_addr;
r= sys_safecopyfrom(user_proc, grant, offset, r= sys_safecopyfrom(user_proc, grant, offset,
(vir_bytes)loc_addr, count, D); (vir_bytes)loc_addr, count, D);
if (r != OK) if (r != OK)
panic("DP8390", "get_userdata: sys_safecopyfrom failed", r); panic("get_userdata: sys_safecopyfrom failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -2775,7 +2740,7 @@ void *loc_addr;
r= sys_vircopy(SELF, D, (vir_bytes)loc_addr, r= sys_vircopy(SELF, D, (vir_bytes)loc_addr,
user_proc, D, user_addr, count); user_proc, D, user_addr, count);
if (r != OK) if (r != OK)
panic("DP8390", "put_userdata: sys_vircopy failed", r); panic("put_userdata: sys_vircopy failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -2792,7 +2757,7 @@ void *loc_addr;
r= sys_safecopyto(user_proc, grant, 0, (vir_bytes)loc_addr, r= sys_safecopyto(user_proc, grant, 0, (vir_bytes)loc_addr,
count, D); count, D);
if (r != OK) if (r != OK)
panic("DP8390", "put_userdata: sys_safecopyto failed", r); panic("put_userdata: sys_safecopyto failed: %d", r);
} }
u8_t inb(port_t port) u8_t inb(port_t port)
@ -2804,7 +2769,7 @@ u8_t inb(port_t port)
if (r != OK) if (r != OK)
{ {
printf("inb failed for port 0x%x\n", port); printf("inb failed for port 0x%x\n", port);
panic("DP8390","sys_inb failed", r); panic("sys_inb failed: %d", r);
} }
return value; return value;
} }
@ -2816,7 +2781,7 @@ u16_t inw(port_t port)
r= sys_inw(port, &value); r= sys_inw(port, &value);
if (r != OK) if (r != OK)
panic("DP8390", "sys_inw failed", r); panic("sys_inw failed: %d", r);
return (u16_t) value; return (u16_t) value;
} }
@ -2826,7 +2791,7 @@ void outb(port_t port, u8_t value)
r= sys_outb(port, value); r= sys_outb(port, value);
if (r != OK) if (r != OK)
panic("DP8390", "sys_outb failed", r); panic("sys_outb failed: %d", r);
} }
void outw(port_t port, u16_t value) void outw(port_t port, u16_t value)
@ -2835,7 +2800,7 @@ void outw(port_t port, u16_t value)
r= sys_outw(port, value); r= sys_outw(port, value);
if (r != OK) if (r != OK)
panic("DP8390", "sys_outw failed", r); panic("sys_outw failed: %d", r);
} }
static void insb(port_t port, void *buf, size_t size) static void insb(port_t port, void *buf, size_t size)
@ -2854,7 +2819,7 @@ static void do_vir_insb(port_t port, int proc, vir_bytes buf, size_t size)
r= sys_insb(port, proc, (void *) buf, size); r= sys_insb(port, proc, (void *) buf, size);
if (r != OK) if (r != OK)
panic("DP8390", "sys_sdevio failed", r); panic("sys_sdevio failed: %d", r);
} }
static void do_vir_insw(port_t port, int proc, vir_bytes buf, size_t size) static void do_vir_insw(port_t port, int proc, vir_bytes buf, size_t size)
@ -2863,7 +2828,7 @@ static void do_vir_insw(port_t port, int proc, vir_bytes buf, size_t size)
r= sys_insw(port, proc, (void *) buf, size); r= sys_insw(port, proc, (void *) buf, size);
if (r != OK) if (r != OK)
panic("DP8390", "sys_sdevio failed", r); panic("sys_sdevio failed: %d", r);
} }
static void do_vir_outsb(port_t port, int proc, vir_bytes buf, size_t size) static void do_vir_outsb(port_t port, int proc, vir_bytes buf, size_t size)
@ -2872,7 +2837,7 @@ static void do_vir_outsb(port_t port, int proc, vir_bytes buf, size_t size)
r= sys_outsb(port, proc, (void *) buf, size); r= sys_outsb(port, proc, (void *) buf, size);
if (r != OK) if (r != OK)
panic("DP8390", "sys_sdevio failed", r); panic("sys_sdevio failed: %d", r);
} }
static void do_vir_outsw(port_t port, int proc, vir_bytes buf, size_t size) static void do_vir_outsw(port_t port, int proc, vir_bytes buf, size_t size)
@ -2881,7 +2846,7 @@ static void do_vir_outsw(port_t port, int proc, vir_bytes buf, size_t size)
r= sys_outsw(port, proc, (void *) buf, size); r= sys_outsw(port, proc, (void *) buf, size);
if (r != OK) if (r != OK)
panic("DP8390", "sys_sdevio failed", r); panic("sys_sdevio failed: %d", r);
} }
/* /*

View file

@ -84,11 +84,8 @@ struct dpeth *dep;
continue; continue;
if (pcitab[i].did != did) if (pcitab[i].did != did)
continue; continue;
if (pcitab[i].checkclass) if (pcitab[i].checkclass) {
{ panic("rtl_probe: class check not implemented");
panic("",
"rtl_probe: class check not implemented",
NO_NUM);
} }
break; break;
} }
@ -121,7 +118,7 @@ struct dpeth *dep;
bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0; bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
if (bar < 0x400) if (bar < 0x400)
panic("", "base address is not properly configured", NO_NUM); panic("base address is not properly configured");
dep->de_base_port= bar; dep->de_base_port= bar;
@ -340,7 +337,7 @@ u16_t w;
micro_delay(1); micro_delay(1);
} }
if (!(inb_reg3(dep, 1) & 1)) if (!(inb_reg3(dep, 1) & 1))
panic("", "set_ee_word: device remains busy", NO_NUM); panic("set_ee_word: device remains busy");
} }
static void ee_wds(dep) static void ee_wds(dep)

View file

@ -153,7 +153,7 @@ static void el1_send(dpeth_t * dep, int from_int, int pktsize)
txbuff->client = dep->de_client; txbuff->client = dep->de_client;
user2mem(dep, txbuff); user2mem(dep, txbuff);
} else } else
panic(dep->de_name, "out of memory for Tx", NO_NUM); panic("out of memory for Tx");
} else if ((txbuff = dep->de_xmitq_head) != NULL) { } else if ((txbuff = dep->de_xmitq_head) != NULL) {
@ -167,10 +167,10 @@ static void el1_send(dpeth_t * dep, int from_int, int pktsize)
pktsize = txbuff->size; pktsize = txbuff->size;
} else } else
panic(dep->de_name, "should not be sending ", NO_NUM); panic("should not be sending ");
if ((dep->de_flags & DEF_XMIT_BUSY)) { if ((dep->de_flags & DEF_XMIT_BUSY)) {
if (from_int) panic(dep->de_name, "should not be sending ", NO_NUM); if (from_int) panic("should not be sending ");
getuptime(&now); getuptime(&now);
if ((now - dep->de_xmit_start) > 4) { if ((now - dep->de_xmit_start) > 4) {
/* Transmitter timed out */ /* Transmitter timed out */

View file

@ -81,7 +81,7 @@ static void el2_init(dpeth_t * dep)
/* Set interrupt level for 3c503 */ /* Set interrupt level for 3c503 */
irq = (dep->de_irq &= ~DEI_DEFAULT); /* Strip the default flag. */ irq = (dep->de_irq &= ~DEI_DEFAULT); /* Strip the default flag. */
if (irq == 9) irq = 2; if (irq == 9) irq = 2;
if (irq < 2 || irq > 5) panic(dep->de_name, "bad 3c503 irq configuration", irq); if (irq < 2 || irq > 5) panic("bad 3c503 irq configuration: %d", irq);
outb_el2(dep, EL2_IDCFG, (0x04 << irq)); outb_el2(dep, EL2_IDCFG, (0x04 << irq));
outb_el2(dep, EL2_DRQCNT, 0x08); /* Set burst size to 8 */ outb_el2(dep, EL2_DRQCNT, 0x08); /* Set burst size to 8 */

View file

@ -131,7 +131,7 @@ static void el3_write_fifo(dpeth_t * dep, int pktsize)
r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr, r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, 0, bytes); iovp->iod_iovec[ix].iov_grant, 0, bytes);
if (r != OK) if (r != OK)
panic(__FILE__, "el3_write_fifo: sys_safe_outsb failed", r); panic("el3_write_fifo: sys_safe_outsb failed: %d", r);
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
dp_next_iovec(iovp); dp_next_iovec(iovp);
@ -416,11 +416,11 @@ static void el3_open(dpeth_t * dep)
AddrCfgReg = ((AddrCfgReg & EL3_CONFIG_IOBASE_MASK) << 4) + EL3_IO_BASE_ADDR; AddrCfgReg = ((AddrCfgReg & EL3_CONFIG_IOBASE_MASK) << 4) + EL3_IO_BASE_ADDR;
if (AddrCfgReg != dep->de_base_port) if (AddrCfgReg != dep->de_base_port)
panic(dep->de_name, "Bad I/O port for Etherlink board", NO_NUM); panic("Bad I/O port for Etherlink board");
ResCfgReg >>= 12; ResCfgReg >>= 12;
dep->de_irq &= NOT(DEI_DEFAULT); /* Strips the default flag */ dep->de_irq &= NOT(DEI_DEFAULT); /* Strips the default flag */
if (ResCfgReg != dep->de_irq) panic(dep->de_name, "Bad IRQ for Etherlink board", NO_NUM); if (ResCfgReg != dep->de_irq) panic("Bad IRQ for Etherlink board");
SetWindow(WNO_Setup); SetWindow(WNO_Setup);

View file

@ -76,7 +76,7 @@ static void ns_start_xmit(dpeth_t * dep, int size, int pageno)
*/ */
static void mem_getblock(dpeth_t *dep, u16_t offset, int size, void *dst) static void mem_getblock(dpeth_t *dep, u16_t offset, int size, void *dst)
{ {
panic(__FILE__, "mem_getblock: not converted to safecopies", NO_NUM); panic("mem_getblock: not converted to safecopies");
#if 0 #if 0
sys_nic2mem(dep->de_linmem + offset, SELF, dst, size); sys_nic2mem(dep->de_linmem + offset, SELF, dst, size);
return; return;
@ -93,7 +93,7 @@ static void mem_nic2user(dpeth_t * dep, int pageno, int pktsize)
iovec_dat_s_t *iovp = &dep->de_read_iovec; iovec_dat_s_t *iovp = &dep->de_read_iovec;
int bytes, ix = 0; int bytes, ix = 0;
panic(__FILE__, "mem_nic2user: not converted to safecopies", NO_NUM); panic("mem_nic2user: not converted to safecopies");
#if 0 #if 0
/* Computes shared memory address (skipping receive header) */ /* Computes shared memory address (skipping receive header) */
@ -141,7 +141,7 @@ static void mem_user2nic(dpeth_t *dep, int pageno, int pktsize)
iovec_dat_s_t *iovp = &dep->de_write_iovec; iovec_dat_s_t *iovp = &dep->de_write_iovec;
int bytes, ix = 0; int bytes, ix = 0;
panic(__FILE__, "mem_user2nic: not converted to safecopies", NO_NUM); panic("mem_user2nic: not converted to safecopies");
#if 0 #if 0
/* Computes shared memory address */ /* Computes shared memory address */
@ -217,10 +217,8 @@ static void pio_nic2user(dpeth_t *dep, int pageno, int pktsize)
bytes = dep->de_stoppage * DP_PAGESIZE - offset; bytes = dep->de_stoppage * DP_PAGESIZE - offset;
r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr, r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, iov_offset, bytes); iovp->iod_iovec[ix].iov_grant, iov_offset, bytes);
if (r != OK) if (r != OK) {
{ panic("pio_nic2user: sys_safe_insb failed: %d", r);
panic(__FILE__, "pio_nic2user: sys_safe_insb failed",
r);
} }
pktsize -= bytes; pktsize -= bytes;
iov_offset += bytes; iov_offset += bytes;
@ -232,7 +230,7 @@ static void pio_nic2user(dpeth_t *dep, int pageno, int pktsize)
r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr, r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, iov_offset, bytes); iovp->iod_iovec[ix].iov_grant, iov_offset, bytes);
if (r != OK) if (r != OK)
panic(__FILE__, "pio_nic2user: sys_safe_insb failed", r); panic("pio_nic2user: sys_safe_insb failed: %d", r);
offset += bytes; offset += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
@ -264,7 +262,7 @@ static void pio_user2nic(dpeth_t *dep, int pageno, int pktsize)
r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr, r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr,
iovp->iod_iovec[ix].iov_grant, 0, bytes); iovp->iod_iovec[ix].iov_grant, 0, bytes);
if (r != OK) if (r != OK)
panic(__FILE__, "pio_user2nic: sys_safe_outsb failed", r); panic("pio_user2nic: sys_safe_outsb failed: %d", r);
if (++ix >= IOVEC_NR) { /* Next buffer of I/O vector */ if (++ix >= IOVEC_NR) { /* Next buffer of I/O vector */
dp_next_iovec(iovp); dp_next_iovec(iovp);
@ -277,7 +275,7 @@ static void pio_user2nic(dpeth_t *dep, int pageno, int pktsize)
if (inb_reg0(dep, DP_ISR) & ISR_RDC) break; if (inb_reg0(dep, DP_ISR) & ISR_RDC) break;
} }
if (ix == 100) { if (ix == 100) {
panic(dep->de_name, RdmaErrMsg, NO_NUM); panic(RdmaErrMsg);
} }
return; return;
} }
@ -331,7 +329,7 @@ static void ns_send(dpeth_t * dep, int from_int, int size)
int queue; int queue;
if (queue = dep->de_sendq_head, dep->de_sendq[queue].sq_filled) { if (queue = dep->de_sendq_head, dep->de_sendq[queue].sq_filled) {
if (from_int) panic(dep->de_name, "should not be sending ", NO_NUM); if (from_int) panic("should not be sending ");
dep->de_send_s = size; dep->de_send_s = size;
return; return;
} }
@ -654,7 +652,7 @@ static void dp_pio16_user2nic(dpeth_t *dep, int pageno, int pktsize)
if (bytes > pktsize) bytes = pktsize; if (bytes > pktsize) bytes = pktsize;
phys_user = numap(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_addr, bytes); phys_user = numap(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_addr, bytes);
if (!phys_user) panic(dep->de_name, UmapErrMsg, NO_NUM); if (!phys_user) panic(UmapErrMsg);
if (odd_byte) { if (odd_byte) {
phys_copy(phys_user, phys_2bytes + 1, (phys_bytes) 1); phys_copy(phys_user, phys_2bytes + 1, (phys_bytes) 1);
@ -691,7 +689,7 @@ static void dp_pio16_user2nic(dpeth_t *dep, int pageno, int pktsize)
if (inb_reg0(dep, DP_ISR) & ISR_RDC) break; if (inb_reg0(dep, DP_ISR) & ISR_RDC) break;
} }
if (ix == 100) { if (ix == 100) {
panic(dep->de_name, RdmaErrMsg, NO_NUM); panic(RdmaErrMsg);
} }
return; return;
} }
@ -727,7 +725,7 @@ static void dp_pio16_nic2user(dpeth_t * dep, int nic_addr, int count)
phys_user = numap(iovp->iod_proc_nr, phys_user = numap(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_addr, bytes); iovp->iod_iovec[i].iov_addr, bytes);
if (!phys_user) panic(dep->de_name, UmapErrMsg, NO_NUM); if (!phys_user) panic(UmapErrMsg);
if (odd_byte) { if (odd_byte) {
phys_copy(phys_2bytes + 1, phys_user, (phys_bytes) 1); phys_copy(phys_2bytes + 1, phys_user, (phys_bytes) 1);
count--; count--;

View file

@ -118,7 +118,7 @@ static void reply(dpeth_t * dep, int err, int m_type)
dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV); dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV);
} else if (status != ELOCKED || err == OK) } else if (status != ELOCKED || err == OK)
panic(dep->de_name, SendErrMsg, status); panic(SendErrMsg, status);
return; return;
} }
@ -236,7 +236,7 @@ static void get_userdata_s(int user_proc, cp_grant_id_t grant,
len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t); len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t);
if ((rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D)) != OK) if ((rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D)) != OK)
panic(DevName, CopyErrMsg, rc); panic(CopyErrMsg, rc);
return; return;
} }
@ -351,7 +351,7 @@ static void do_init(message * mp)
reply_mess.m3_i2 = DE_PORT_NR; reply_mess.m3_i2 = DE_PORT_NR;
DEBUG(printf("\t reply %d\n", reply_mess.m_type)); DEBUG(printf("\t reply %d\n", reply_mess.m_type));
if (send(mp->m_source, &reply_mess) != OK) /* Can't send */ if (send(mp->m_source, &reply_mess) != OK) /* Can't send */
panic(portname, SendErrMsg, mp->m_source); panic(SendErrMsg, mp->m_source);
return; return;
} }
@ -402,7 +402,7 @@ static void do_vwrite_s(message * mp)
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */ if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
panic(__FILE__, PortErrMsg, EINVAL); panic(PortErrMsg, EINVAL);
dep = &de_table[port]; dep = &de_table[port];
dep->de_client = mp->DL_PROC; dep->de_client = mp->DL_PROC;
@ -410,7 +410,7 @@ static void do_vwrite_s(message * mp)
if (dep->de_mode == DEM_ENABLED) { if (dep->de_mode == DEM_ENABLED) {
if (dep->de_flags & DEF_SENDING) /* Is sending in progress? */ if (dep->de_flags & DEF_SENDING) /* Is sending in progress? */
panic(dep->de_name, "send already in progress ", NO_NUM); panic("send already in progress ");
dep->de_write_iovec.iod_proc_nr = mp->DL_PROC; dep->de_write_iovec.iod_proc_nr = mp->DL_PROC;
get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0, get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0,
@ -420,7 +420,7 @@ static void do_vwrite_s(message * mp)
dep->de_write_iovec.iod_iovec_offset = 0; dep->de_write_iovec.iod_iovec_offset = 0;
size = calc_iovec_size(&dep->de_write_iovec); size = calc_iovec_size(&dep->de_write_iovec);
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE) if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)
panic(dep->de_name, SizeErrMsg, size); panic(SizeErrMsg, size);
dep->de_flags |= DEF_SENDING; dep->de_flags |= DEF_SENDING;
(*dep->de_sendf) (dep, FALSE, size); (*dep->de_sendf) (dep, FALSE, size);
@ -443,7 +443,7 @@ static void do_vread_s(message * mp)
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */ if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
panic(__FILE__, PortErrMsg, EINVAL); panic(PortErrMsg, EINVAL);
dep = &de_table[port]; dep = &de_table[port];
dep->de_client = mp->DL_PROC; dep->de_client = mp->DL_PROC;
@ -451,7 +451,7 @@ static void do_vread_s(message * mp)
if (dep->de_mode == DEM_ENABLED) { if (dep->de_mode == DEM_ENABLED) {
if (dep->de_flags & DEF_READING) /* Reading in progress */ if (dep->de_flags & DEF_READING) /* Reading in progress */
panic(dep->de_name, "read already in progress", NO_NUM); panic("read already in progress");
dep->de_read_iovec.iod_proc_nr = mp->DL_PROC; dep->de_read_iovec.iod_proc_nr = mp->DL_PROC;
get_userdata_s(mp->DL_PROC, (cp_grant_id_t) mp->DL_GRANT, 0, get_userdata_s(mp->DL_PROC, (cp_grant_id_t) mp->DL_GRANT, 0,
@ -460,7 +460,7 @@ static void do_vread_s(message * mp)
dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
dep->de_read_iovec.iod_iovec_offset = 0; dep->de_read_iovec.iod_iovec_offset = 0;
size = calc_iovec_size(&dep->de_read_iovec); size = calc_iovec_size(&dep->de_read_iovec);
if (size < ETH_MAX_PACK_SIZE) panic(dep->de_name, SizeErrMsg, size); if (size < ETH_MAX_PACK_SIZE) panic(SizeErrMsg, size);
dep->de_flags |= DEF_READING; dep->de_flags |= DEF_READING;
(*dep->de_recvf) (dep, FALSE, size); (*dep->de_recvf) (dep, FALSE, size);
@ -486,7 +486,7 @@ static void do_getstat_s(message * mp)
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */ if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
panic(__FILE__, PortErrMsg, EINVAL); panic(PortErrMsg, EINVAL);
dep = &de_table[port]; dep = &de_table[port];
dep->de_client = mp->DL_PROC; dep->de_client = mp->DL_PROC;
@ -495,7 +495,7 @@ static void do_getstat_s(message * mp)
if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes)&dep->de_stat, (vir_bytes)&dep->de_stat,
(vir_bytes) sizeof(dep->de_stat), 0)) != OK) (vir_bytes) sizeof(dep->de_stat), 0)) != OK)
panic(DevName, CopyErrMsg, rc); panic(CopyErrMsg, rc);
reply(dep, OK, DL_STAT_REPLY); reply(dep, OK, DL_STAT_REPLY);
return; return;
} }
@ -510,7 +510,7 @@ message *mp;
mp->m_type= DL_NAME_REPLY; mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("dpeth", "do_getname: send failed: %d\n", r); panic("do_getname: send failed: %d", r);
} }
/* /*
@ -524,7 +524,7 @@ static void do_stop(message * mp)
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */ if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */
panic(__FILE__, PortErrMsg, EINVAL); panic(PortErrMsg, EINVAL);
dep = &de_table[port]; dep = &de_table[port];
if (dep->de_mode == DEM_ENABLED && (dep->de_flags & DEF_ENABLED)) { if (dep->de_mode == DEM_ENABLED && (dep->de_flags & DEF_ENABLED)) {
@ -600,7 +600,7 @@ PUBLIC int main(int argc, char **argv)
while (TRUE) { while (TRUE) {
if ((rc = sef_receive(ANY, &m)) != OK){ if ((rc = sef_receive(ANY, &m)) != OK){
panic(__FILE__, RecvErrMsg, rc); panic(RecvErrMsg, rc);
} }
DEBUG(printf("eth: got message %d, ", m.m_type)); DEBUG(printf("eth: got message %d, ", m.m_type));
@ -624,7 +624,7 @@ PUBLIC int main(int argc, char **argv)
break; break;
default: default:
/* Invalid message type */ /* Invalid message type */
panic(DevName, TypeErrMsg, m.m_type); panic(TypeErrMsg, m.m_type);
break; break;
} }
/* message processed, get another one */ /* message processed, get another one */
@ -651,7 +651,7 @@ PUBLIC int main(int argc, char **argv)
do_stop(&m); do_stop(&m);
break; break;
default: /* Invalid message type */ default: /* Invalid message type */
panic(DevName, TypeErrMsg, m.m_type); panic(TypeErrMsg, m.m_type);
break; break;
} }
} }

View file

@ -123,7 +123,7 @@ PUBLIC void mem2user(dpeth_t *dep, buff_t *rxbuff)
r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0,
(vir_bytes)buffer, bytes, D); (vir_bytes)buffer, bytes, D);
if (r != OK) if (r != OK)
panic(__FILE__, "mem2user: sys_safecopyto failed", r); panic("mem2user: sys_safecopyto failed: %d", r);
buffer += bytes; buffer += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
@ -153,7 +153,7 @@ PUBLIC void user2mem(dpeth_t *dep, buff_t *txbuff)
r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant,
0, (vir_bytes)buffer, bytes, D); 0, (vir_bytes)buffer, bytes, D);
if (r != OK) if (r != OK)
panic(__FILE__, "user2mem: sys_safecopyfrom failed", r); panic("user2mem: sys_safecopyfrom failed: %d", r);
buffer += bytes; buffer += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */

View file

@ -85,7 +85,7 @@ int main(int argc, char *argv[])
{ {
if ((r= sef_receive(ANY, &m)) != OK) if ((r= sef_receive(ANY, &m)) != OK)
{ {
panic("e1000", "sef_receive failed", r); panic("sef_receive failed: %d", r);
} }
if (is_notify(m.m_type)) if (is_notify(m.m_type))
{ {
@ -113,7 +113,7 @@ int main(int argc, char *argv[])
case DL_GETSTAT_S: e1000_getstat_s(&m); break; case DL_GETSTAT_S: e1000_getstat_s(&m); break;
case DL_GETNAME: e1000_getname(&m); break; case DL_GETNAME: e1000_getname(&m); break;
default: default:
panic("e1000", "illegal message", m.m_type); panic("illegal message: %d", m.m_type);
} }
} }
} }
@ -145,7 +145,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Verify command-line arguments. */ /* Verify command-line arguments. */
if (env_argc < 1) if (env_argc < 1)
{ {
panic("e1000", "no program name given in argc/argv", NO_NUM); panic("no program name given in argc/argv");
} }
else else
(progname = strrchr(env_argv[0],'/')) ? progname++ (progname = strrchr(env_argv[0],'/')) ? progname++
@ -157,7 +157,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Perform calibration. */ /* Perform calibration. */
if((r = tsc_calibrate()) != OK) if((r = tsc_calibrate()) != OK)
{ {
panic("e1000", "tsc_calibrate failed", r); panic("tsc_calibrate failed: %d", r);
} }
/* Try to notify inet that we are present (again) */ /* Try to notify inet that we are present (again) */
if ((r = ds_retrieve_label_num("inet", &tasknr)) == OK) if ((r = ds_retrieve_label_num("inet", &tasknr)) == OK)
@ -308,7 +308,7 @@ PRIVATE int e1000_probe(e1000_t *e)
/* Reserve PCI resources found. */ /* Reserve PCI resources found. */
if ((r = pci_reserve_ok(devind)) != OK) if ((r = pci_reserve_ok(devind)) != OK)
{ {
panic("e1000", "failed to reserve PCI device", r); panic("failed to reserve PCI device: %d", r);
} }
/* Read PCI configuration. */ /* Read PCI configuration. */
e->irq = pci_attr_r8(devind, PCI_ILR); e->irq = pci_attr_r8(devind, PCI_ILR);
@ -316,10 +316,8 @@ PRIVATE int e1000_probe(e1000_t *e)
0x20000); 0x20000);
/* Verify mapped registers. */ /* Verify mapped registers. */
if (e->regs == (u8_t *) -1) if (e->regs == (u8_t *) -1) {
{ panic("failed to map hardware registers from PCI");
panic("e1000", "failed to map hardware registers from PCI\n",
NO_NUM);
} }
/* Optionally map flash memory. */ /* Optionally map flash memory. */
if (pci_attr_r32(devind, PCI_BAR_3)) if (pci_attr_r32(devind, PCI_BAR_3))
@ -368,11 +366,11 @@ e1000_t *e;
*/ */
if ((r = sys_irqsetpolicy(e->irq, 0, &e->irq_hook)) != OK) if ((r = sys_irqsetpolicy(e->irq, 0, &e->irq_hook)) != OK)
{ {
panic(e->name, "sys_irqsetpolicy failed", r); panic("sys_irqsetpolicy failed: %d", r);
} }
if ((r = sys_irqenable(&e->irq_hook)) != OK) if ((r = sys_irqenable(&e->irq_hook)) != OK)
{ {
panic(e->name, "sys_irqenable failed", r); panic("sys_irqenable failed: %d", r);
} }
/* Reset hardware. */ /* Reset hardware. */
e1000_reset_hw(e); e1000_reset_hw(e);
@ -487,10 +485,8 @@ e1000_t *e;
{ {
if ((e->rx_desc = alloc_contig(sizeof(e1000_rx_desc_t) * if ((e->rx_desc = alloc_contig(sizeof(e1000_rx_desc_t) *
e->rx_desc_count, AC_ALIGN4K, e->rx_desc_count, AC_ALIGN4K,
&rx_desc_p)) == NULL) &rx_desc_p)) == NULL) {
{ panic("failed to allocate RX descriptors");
panic(e->name, "failed to allocate RX descriptors",
NO_NUM);
} }
memset(e->rx_desc, 0, sizeof(e1000_rx_desc_t) * e->rx_desc_count); memset(e->rx_desc, 0, sizeof(e1000_rx_desc_t) * e->rx_desc_count);
@ -503,7 +499,7 @@ e1000_t *e;
if ((e->rx_buffer = alloc_contig(e->rx_buffer_size, if ((e->rx_buffer = alloc_contig(e->rx_buffer_size,
AC_ALIGN4K, &rx_buff_p)) == NULL) AC_ALIGN4K, &rx_buff_p)) == NULL)
{ {
panic(e->name, "failed to allocate RX buffers", NO_NUM); panic("failed to allocate RX buffers");
} }
/* Setup receive descriptors. */ /* Setup receive descriptors. */
for (i = 0; i < E1000_RXDESC_NR; i++) for (i = 0; i < E1000_RXDESC_NR; i++)
@ -518,10 +514,8 @@ e1000_t *e;
{ {
if ((e->tx_desc = alloc_contig(sizeof(e1000_tx_desc_t) * if ((e->tx_desc = alloc_contig(sizeof(e1000_tx_desc_t) *
e->tx_desc_count, AC_ALIGN4K, e->tx_desc_count, AC_ALIGN4K,
&tx_desc_p)) == NULL) &tx_desc_p)) == NULL) {
{ panic("failed to allocate TX descriptors");
panic(e->name, "failed to allocate TX descriptors",
NO_NUM);
} }
memset(e->tx_desc, 0, sizeof(e1000_tx_desc_t) * e->tx_desc_count); memset(e->tx_desc, 0, sizeof(e1000_tx_desc_t) * e->tx_desc_count);
@ -534,7 +528,7 @@ e1000_t *e;
if ((e->tx_buffer = alloc_contig(e->tx_buffer_size, if ((e->tx_buffer = alloc_contig(e->tx_buffer_size,
AC_ALIGN4K, &tx_buff_p)) == NULL) AC_ALIGN4K, &tx_buff_p)) == NULL)
{ {
panic(e->name, "failed to allocate TX buffers", NO_NUM); panic("failed to allocate TX buffers");
} }
/* Setup transmit descriptors. */ /* Setup transmit descriptors. */
for (i = 0; i < E1000_RXDESC_NR; i++) for (i = 0; i < E1000_RXDESC_NR; i++)
@ -614,7 +608,7 @@ int from_int;
(vir_bytes) iovec, e->tx_message.DL_COUNT * (vir_bytes) iovec, e->tx_message.DL_COUNT *
sizeof(iovec_s_t), D)) != OK) sizeof(iovec_s_t), D)) != OK)
{ {
panic(e->name, "sys_safecopyfrom() failed", r); panic("sys_safecopyfrom() failed: %d", r);
} }
/* Find the head, tail and current descriptors. */ /* Find the head, tail and current descriptors. */
head = e1000_reg_read(e, E1000_REG_TDH); head = e1000_reg_read(e, E1000_REG_TDH);
@ -638,7 +632,7 @@ int from_int;
(tail * E1000_IOBUF_SIZE), (tail * E1000_IOBUF_SIZE),
size, D)) != OK) size, D)) != OK)
{ {
panic(e->name, "sys_safecopyfrom() failed", r); panic("sys_safecopyfrom() failed: %d", r);
} }
/* Mark this descriptor ready. */ /* Mark this descriptor ready. */
desc->status = 0; desc->status = 0;
@ -702,7 +696,7 @@ int from_int;
(vir_bytes) iovec, e->rx_message.DL_COUNT * (vir_bytes) iovec, e->rx_message.DL_COUNT *
sizeof(iovec_s_t), D)) != OK) sizeof(iovec_s_t), D)) != OK)
{ {
panic(e->name, "sys_safecopyfrom() failed", r); panic("sys_safecopyfrom() failed: %d", r);
} }
/* Find the head, tail and current descriptors. */ /* Find the head, tail and current descriptors. */
head = e1000_reg_read(e, E1000_REG_RDH); head = e1000_reg_read(e, E1000_REG_RDH);
@ -737,7 +731,7 @@ int from_int;
(cur * E1000_IOBUF_SIZE), (cur * E1000_IOBUF_SIZE),
size, D)) != OK) size, D)) != OK)
{ {
panic(e->name, "sys_safecopyto() failed", r); panic("sys_safecopyto() failed: %d", r);
} }
bytes += size; bytes += size;
} }
@ -790,7 +784,7 @@ message *mp;
mp->DL_PORT = mp->DL_PORT; mp->DL_PORT = mp->DL_PORT;
mp->DL_STAT = OK; mp->DL_STAT = OK;
if((r=send(mp->m_source, mp)) != OK) if((r=send(mp->m_source, mp)) != OK)
panic("e1000", "e1000_getstat: send() failed", r); panic("e1000_getstat: send() failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -811,7 +805,7 @@ message *mp;
mp->m_type = DL_NAME_REPLY; mp->m_type = DL_NAME_REPLY;
if ((r = send(mp->m_source, mp)) != OK) if ((r = send(mp->m_source, mp)) != OK)
{ {
panic("e1000", "e1000_getname: send() failed", r); panic("e1000_getname: send() failed: %d", r);
} }
} }
@ -837,7 +831,7 @@ message *mp;
/* Re-enable interrupts. */ /* Re-enable interrupts. */
if (sys_irqenable(&e->irq_hook) != OK) if (sys_irqenable(&e->irq_hook) != OK)
{ {
panic("e1000", "failed to re-enable IRQ", NO_NUM); panic("failed to re-enable IRQ");
} }
/* Read the Interrupt Cause Read register. */ /* Read the Interrupt Cause Read register. */
@ -908,7 +902,7 @@ int num;
*/ */
if (num < 0 || num >= E1000_PORT_NR) if (num < 0 || num >= E1000_PORT_NR)
{ {
panic("e1000", "invalid port number given", num); panic("invalid port number given: %d", num);
} }
/* /*
@ -916,7 +910,7 @@ int num;
*/ */
if (!(e1000_table[num].status & E1000_DETECTED)) if (!(e1000_table[num].status & E1000_DETECTED))
{ {
panic("e1000", "inactive port number given", num); panic("inactive port number given: %d", num);
} }
return &e1000_table[num]; return &e1000_table[num];
} }
@ -1260,7 +1254,7 @@ int may_block;
/* Acknowledge to INET. */ /* Acknowledge to INET. */
if ((r = send(e->client, &msg)) != OK) if ((r = send(e->client, &msg)) != OK)
{ {
panic("e1000", "send() failed", r); panic("send() failed: %d", r);
} }
} }
@ -1273,6 +1267,6 @@ message *reply_mess;
{ {
if (send(req->m_source, reply_mess) != OK) if (send(req->m_source, reply_mess) != OK)
{ {
panic("e1000", "unable to send reply message", NO_NUM); panic("unable to send reply message");
} }
} }

View file

@ -61,7 +61,7 @@ static int driver_open(int which)
gid = cpf_grant_direct(driver[which].endpt, gid = cpf_grant_direct(driver[which].endpt,
(vir_bytes) &part, sizeof(part), CPF_WRITE); (vir_bytes) &part, sizeof(part), CPF_WRITE);
if(!GRANT_VALID(gid)) if(!GRANT_VALID(gid))
panic(__FILE__, "invalid grant", gid); panic("invalid grant: %d", gid);
msg.m_type = DEV_IOCTL_S; msg.m_type = DEV_IOCTL_S;
msg.REQUEST = DIOCGETP; msg.REQUEST = DIOCGETP;
@ -165,7 +165,7 @@ void driver_init(void)
check_driver(DRIVER_MAIN); check_driver(DRIVER_MAIN);
} }
else if (driver_open(DRIVER_MAIN) != OK) { else if (driver_open(DRIVER_MAIN) != OK) {
panic(__FILE__, "unhandled driver_open failure", NO_NUM); panic("unhandled driver_open failure");
} }
if(USE_MIRROR) { if(USE_MIRROR) {
@ -174,7 +174,7 @@ void driver_init(void)
if(!strcmp(driver[DRIVER_MAIN].label, if(!strcmp(driver[DRIVER_MAIN].label,
driver[DRIVER_BACKUP].label)) { driver[DRIVER_BACKUP].label)) {
panic(__FILE__, "same driver: not tested", NO_NUM); panic("same driver: not tested");
} }
r = ds_retrieve_label_num(driver[DRIVER_BACKUP].label, r = ds_retrieve_label_num(driver[DRIVER_BACKUP].label,
@ -186,8 +186,7 @@ void driver_init(void)
check_driver(DRIVER_BACKUP); check_driver(DRIVER_BACKUP);
} }
else if (driver_open(DRIVER_BACKUP) != OK) { else if (driver_open(DRIVER_BACKUP) != OK) {
panic(__FILE__, "unhandled driver_open failure", panic("unhandled driver_open failure");
NO_NUM);
} }
} }
} }
@ -377,7 +376,7 @@ static int check_problem(int which, int problem, int retries, int *tell_rs)
break; break;
default: default:
panic(__FILE__, "invalid problem", problem); panic("invalid problem: %d", problem);
} }
/* At this point, the driver will be restarted. */ /* At this point, the driver will be restarted. */
@ -441,7 +440,7 @@ static void restart_driver(int which, int tell_rs)
r = sendrec(RS_PROC_NR, &msg); r = sendrec(RS_PROC_NR, &msg);
if (r != OK || msg.m_type != OK) if (r != OK || msg.m_type != OK)
panic(__FILE__, "RS request failed", r); panic("RS request failed: %d", r);
#if DEBUG #if DEBUG
printf("Filter: RS call succeeded\n"); printf("Filter: RS call succeeded\n");
@ -545,7 +544,7 @@ static int flt_senda(message *mess, int which)
r = senda(amsgtable, 2); r = senda(amsgtable, 2);
if(r != OK) if(r != OK)
panic(__FILE__, "senda returned error", r); panic("senda returned error: %d", r);
return r; return r;
} }
@ -585,7 +584,7 @@ static int flt_receive(message *mess, int which)
for (;;) { for (;;) {
r = sef_receive(ANY, mess); r = sef_receive(ANY, mess);
if(r != OK) if(r != OK)
panic(__FILE__, "sef_receive returned error", r); panic("sef_receive returned error: %d", r);
if(mess->m_source == CLOCK && is_notify(mess->m_type)) { if(mess->m_source == CLOCK && is_notify(mess->m_type)) {
if (mess->NOTIFY_TIMESTAMP < flt_alarm(-1)) { if (mess->NOTIFY_TIMESTAMP < flt_alarm(-1)) {
@ -727,7 +726,7 @@ static int do_sendrec_both(message *m1, message *m2)
} else if (ma.m_source == driver[DRIVER_BACKUP].endpt) { } else if (ma.m_source == driver[DRIVER_BACKUP].endpt) {
which = DRIVER_MAIN; which = DRIVER_MAIN;
} else { } else {
panic(__FILE__, "message from unexpected source", panic("message from unexpected source: %d",
ma.m_source); ma.m_source);
} }
@ -822,7 +821,7 @@ static int single_grant(endpoint_t endpt, vir_bytes buf, int access,
grant = cpf_grant_direct(endpt, buf, chunk, access); grant = cpf_grant_direct(endpt, buf, chunk, access);
if (!GRANT_VALID(grant)) if (!GRANT_VALID(grant))
panic(__FILE__, "invalid grant", grant); panic("invalid grant: %d", grant);
vector[count].iov_grant = grant; vector[count].iov_grant = grant;
vector[count].iov_size = chunk; vector[count].iov_size = chunk;
@ -836,7 +835,7 @@ static int single_grant(endpoint_t endpt, vir_bytes buf, int access,
sizeof(vector[0]) * count, CPF_READ | CPF_WRITE); sizeof(vector[0]) * count, CPF_READ | CPF_WRITE);
if (!GRANT_VALID(*gid)) if (!GRANT_VALID(*gid))
panic(__FILE__, "invalid grant", *gid); panic("invalid grant: %d", *gid);
return count; return count;
} }

View file

@ -189,7 +189,7 @@ static int do_vrdwt(int flag_rw)
grants = m_in.COUNT; grants = m_in.COUNT;
if((r = sys_safecopyfrom(who_e, grant_id, 0, (vir_bytes) iov_proc, if((r = sys_safecopyfrom(who_e, grant_id, 0, (vir_bytes) iov_proc,
grants * sizeof(iovec_t), D)) != OK) { grants * sizeof(iovec_t), D)) != OK) {
panic(__FILE__, "copying in grant vector failed", r); panic("copying in grant vector failed: %d", r);
} }
pos = make64(m_in.POSITION, m_in.HIGHPOS); pos = make64(m_in.POSITION, m_in.HIGHPOS);
@ -240,7 +240,7 @@ static int do_vrdwt(int flag_rw)
/* Copy the caller's grant-table back. */ /* Copy the caller's grant-table back. */
if((r = sys_safecopyto(who_e, grant_id, 0, (vir_bytes) iov_proc, if((r = sys_safecopyto(who_e, grant_id, 0, (vir_bytes) iov_proc,
grants * sizeof(iovec_t), D)) != OK) { grants * sizeof(iovec_t), D)) != OK) {
panic(__FILE__, "copying out grant vector failed", r); panic("copying out grant vector failed: %d", r);
} }
flt_free(buffer, size, buf_array); flt_free(buffer, size, buf_array);
@ -405,7 +405,7 @@ int main(int argc, char *argv[])
for (;;) { for (;;) {
/* Wait for request. */ /* Wait for request. */
if(sef_receive(ANY, &m_in) != OK) { if(sef_receive(ANY, &m_in) != OK) {
panic(__FILE__, "sef_receive failed", NO_NUM); panic("sef_receive failed");
} }
#if DEBUG2 #if DEBUG2
@ -480,7 +480,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
} }
if ((buf_array = flt_malloc(BUF_SIZE, NULL, 0)) == NULL) if ((buf_array = flt_malloc(BUF_SIZE, NULL, 0)) == NULL)
panic(__FILE__, "no memory available", NO_NUM); panic("no memory available");
sum_init(); sum_init();

View file

@ -28,7 +28,7 @@ void sum_init(void)
rb1_array = flt_malloc(SBUF_SIZE, NULL, 0); rb1_array = flt_malloc(SBUF_SIZE, NULL, 0);
if (ext_array == NULL || rb0_array == NULL || rb1_array == NULL) if (ext_array == NULL || rb0_array == NULL || rb1_array == NULL)
panic(__FILE__, "no memory available", NO_NUM); panic("no memory available");
} }
/*===========================================================================* /*===========================================================================*
@ -92,7 +92,7 @@ static void calc_sum(unsigned sector, char *data, char *sum)
break; break;
default: default:
panic(__FILE__, "invalid checksum type", SUM_TYPE); panic("invalid checksum type: %d", SUM_TYPE);
} }
} }
@ -252,12 +252,12 @@ static int make_sum(sector_t current_sector, sector_t sectors_left)
size = sectors_left * SECTOR_SIZE; size = sectors_left * SECTOR_SIZE;
if (group_left != NR_SUM_SEC - sector_in_group) if (group_left != NR_SUM_SEC - sector_in_group)
panic(__FILE__, "group_left assertion", 0); panic("group_left assertion: %d", 0);
gap = group_left - sectors_left; gap = group_left - sectors_left;
if (gap <= 0) if (gap <= 0)
panic(__FILE__, "gap assertion", 0); panic("gap assertion: %d", 0);
if ((r = read_sectors(extp + size, if ((r = read_sectors(extp + size,
LOG2PHYS(current_sector) + sectors_left, LOG2PHYS(current_sector) + sectors_left,

View file

@ -21,7 +21,7 @@ char *flt_malloc(size_t size, char *sbuf, size_t ssize)
return sbuf; return sbuf;
if(!(p = alloc_contig(size, 0, NULL))) if(!(p = alloc_contig(size, 0, NULL)))
panic(__FILE__, "out of memory", size); panic("out of memory: %d", size);
return p; return p;
} }
@ -66,17 +66,17 @@ clock_t flt_alarm(clock_t dt)
r = sys_setalarm(dt, 0); r = sys_setalarm(dt, 0);
if(r != OK) if(r != OK)
panic(__FILE__, "sys_setalarm failed", r); panic("sys_setalarm failed: %d", r);
if(dt == 0) { if(dt == 0) {
if(!next_alarm) if(!next_alarm)
panic(__FILE__, "clearing unset alarm", r); panic("clearing unset alarm: %d", r);
next_alarm = 0; next_alarm = 0;
} else { } else {
if(next_alarm) if(next_alarm)
panic(__FILE__, "overwriting alarm", r); panic("overwriting alarm: %d", r);
if ((r = getuptime(&next_alarm)) != OK) if ((r = getuptime(&next_alarm)) != OK)
panic(__FILE__, "getuptime failed", r); panic("getuptime failed: %d", r);
next_alarm += dt; next_alarm += dt;
} }

View file

@ -344,7 +344,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
if(!(floppy_buf = alloc_contig(2*DMA_BUF_SIZE, if(!(floppy_buf = alloc_contig(2*DMA_BUF_SIZE,
AC_LOWER16M | AC_ALIGN4K, &floppy_buf_phys))) AC_LOWER16M | AC_ALIGN4K, &floppy_buf_phys)))
panic("FLOPPY", "couldn't allocate dma buffer", NO_NUM); panic("couldn't allocate dma buffer");
f_next_timeout = TMR_NEVER; f_next_timeout = TMR_NEVER;
tmr_inittimer(&f_tmr_timeout); tmr_inittimer(&f_tmr_timeout);
@ -361,9 +361,9 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
*/ */
irq_hook_id = FLOPPY_IRQ; irq_hook_id = FLOPPY_IRQ;
if ((s=sys_irqsetpolicy(FLOPPY_IRQ, 0, &irq_hook_id )) != OK) if ((s=sys_irqsetpolicy(FLOPPY_IRQ, 0, &irq_hook_id )) != OK)
panic("FLOPPY", "Couldn't set IRQ policy", s); panic("Couldn't set IRQ policy: %d", s);
if ((s=sys_irqenable(&irq_hook_id)) != OK) if ((s=sys_irqenable(&irq_hook_id)) != OK)
panic("FLOPPY", "Couldn't enable IRQs", s); panic("Couldn't enable IRQs: %d", s);
/* Ignore signals */ /* Ignore signals */
signal(SIGHUP, SIG_IGN); signal(SIGHUP, SIG_IGN);
@ -384,7 +384,7 @@ PRIVATE void f_expire_tmrs(struct driver *dp, message *m_ptr)
/* Get the current time to compare the timers against. */ /* Get the current time to compare the timers against. */
if ((s=getuptime(&now)) != OK) if ((s=getuptime(&now)) != OK)
panic("FLOPPY","Couldn't get uptime from clock.", s); panic("Couldn't get uptime from clock: %d", s);
/* Scan the timers queue for expired timers. Dispatch the watchdog function /* Scan the timers queue for expired timers. Dispatch the watchdog function
* for each expired timers. FLOPPY watchdog functions are f_tmr_timeout() * for each expired timers. FLOPPY watchdog functions are f_tmr_timeout()
@ -396,7 +396,7 @@ PRIVATE void f_expire_tmrs(struct driver *dp, message *m_ptr)
} else { /* set new sync alarm */ } else { /* set new sync alarm */
f_next_timeout = f_timers->tmr_exp_time; f_next_timeout = f_timers->tmr_exp_time;
if ((s=sys_setalarm(f_next_timeout, 1)) != OK) if ((s=sys_setalarm(f_next_timeout, 1)) != OK)
panic("FLOPPY","Couldn't set synchronous alarm.", s); panic("Couldn't set synchronous alarm: %d", s);
} }
} }
@ -413,7 +413,7 @@ tmr_func_t watchdog; /* watchdog function to be called */
/* Get the current time. */ /* Get the current time. */
if ((s=getuptime(&now)) != OK) if ((s=getuptime(&now)) != OK)
panic("FLOPPY","Couldn't get uptime from clock.", s); panic("Couldn't get uptime from clock: %d", s);
/* Add the timer to the local timer queue. */ /* Add the timer to the local timer queue. */
tmrs_settimer(&f_timers, tp, now + delta, watchdog, NULL); tmrs_settimer(&f_timers, tp, now + delta, watchdog, NULL);
@ -425,7 +425,7 @@ tmr_func_t watchdog; /* watchdog function to be called */
if (f_timers->tmr_exp_time != f_next_timeout) { if (f_timers->tmr_exp_time != f_next_timeout) {
f_next_timeout = f_timers->tmr_exp_time; f_next_timeout = f_timers->tmr_exp_time;
if ((s=sys_setalarm(f_next_timeout, 1)) != OK) if ((s=sys_setalarm(f_next_timeout, 1)) != OK)
panic("FLOPPY","Couldn't set synchronous alarm.", s); panic("Couldn't set synchronous alarm: %d", s);
} }
} }
@ -544,7 +544,7 @@ unsigned nr_req; /* length of request vector */
SECTOR_SIZE + iov_offset, (vir_bytes) &fmt_param, SECTOR_SIZE + iov_offset, (vir_bytes) &fmt_param,
(phys_bytes) sizeof(fmt_param), D); (phys_bytes) sizeof(fmt_param), D);
if(s != OK) if(s != OK)
panic("FLOPPY", "sys_safecopyfrom failed", s); panic("sys_safecopyfrom failed: %d", s);
} else { } else {
memcpy(&fmt_param, (void *) (iov->iov_addr + memcpy(&fmt_param, (void *) (iov->iov_addr +
SECTOR_SIZE + iov_offset), SECTOR_SIZE + iov_offset),
@ -611,7 +611,7 @@ unsigned nr_req; /* length of request vector */
cmd[2] = SPEC2; cmd[2] = SPEC2;
(void) fdc_command(cmd, 3); (void) fdc_command(cmd, 3);
if ((s=sys_outb(FDC_RATE, f_dp->rate)) != OK) if ((s=sys_outb(FDC_RATE, f_dp->rate)) != OK)
panic("FLOPPY","Sys_outb failed", s); panic("Sys_outb failed: %d", s);
prev_dp = f_dp; prev_dp = f_dp;
} }
@ -649,7 +649,7 @@ unsigned nr_req; /* length of request vector */
(vir_bytes) floppy_buf, (vir_bytes) floppy_buf,
(phys_bytes) SECTOR_SIZE, D); (phys_bytes) SECTOR_SIZE, D);
if(s != OK) if(s != OK)
panic("FLOPPY", "sys_safecopyfrom failed", s); panic("sys_safecopyfrom failed: %d", s);
} else { } else {
memcpy(floppy_buf, (void *) (*ug + *up), SECTOR_SIZE); memcpy(floppy_buf, (void *) (*ug + *up), SECTOR_SIZE);
} }
@ -675,7 +675,7 @@ unsigned nr_req; /* length of request vector */
(vir_bytes) floppy_buf, (vir_bytes) floppy_buf,
(phys_bytes) SECTOR_SIZE, D); (phys_bytes) SECTOR_SIZE, D);
if(s != OK) if(s != OK)
panic("FLOPPY", "sys_safecopyto failed", s); panic("sys_safecopyto failed: %d", s);
} else { } else {
memcpy((void *) (*ug + *up), floppy_buf, SECTOR_SIZE); memcpy((void *) (*ug + *up), floppy_buf, SECTOR_SIZE);
} }
@ -745,7 +745,7 @@ PRIVATE int dma_setup(
/* First check the DMA memory address not to exceed maximum. */ /* First check the DMA memory address not to exceed maximum. */
if (floppy_buf_phys != (floppy_buf_phys & DMA_ADDR_MASK)) { if (floppy_buf_phys != (floppy_buf_phys & DMA_ADDR_MASK)) {
report("FLOPPY", "DMA denied because address out of range", NO_NUM); printf("floppy: DMA denied because address out of range");
return(EIO); return(EIO);
} }
@ -763,7 +763,7 @@ PRIVATE int dma_setup(
pv_set(byte_out[8], DMA_INIT, 2); /* some sort of enable */ pv_set(byte_out[8], DMA_INIT, 2); /* some sort of enable */
if ((s=sys_voutb(byte_out, 9)) != OK) if ((s=sys_voutb(byte_out, 9)) != OK)
panic("FLOPPY","Sys_voutb in dma_setup() failed", s); panic("Sys_voutb in dma_setup() failed: %d", s);
return(OK); return(OK);
} }
@ -791,7 +791,7 @@ PRIVATE void start_motor(void)
if ((s=sys_outb(DOR, if ((s=sys_outb(DOR,
(motor_status << MOTOR_SHIFT) | ENABLE_INT | f_drive)) != OK) (motor_status << MOTOR_SHIFT) | ENABLE_INT | f_drive)) != OK)
panic("FLOPPY","Sys_outb in start_motor() failed", s); panic("Sys_outb in start_motor() failed: %d", s);
/* If the motor was already running, we don't have to wait for it. */ /* If the motor was already running, we don't have to wait for it. */
if (running) return; /* motor was already running */ if (running) return; /* motor was already running */
@ -831,7 +831,7 @@ PRIVATE void stop_motor(timer_t *tp)
int s; int s;
motor_status &= ~(1 << tmr_arg(tp)->ta_int); motor_status &= ~(1 << tmr_arg(tp)->ta_int);
if ((s=sys_outb(DOR, (motor_status << MOTOR_SHIFT) | ENABLE_INT)) != OK) if ((s=sys_outb(DOR, (motor_status << MOTOR_SHIFT) | ENABLE_INT)) != OK)
panic("FLOPPY","Sys_outb in stop_motor() failed", s); panic("Sys_outb in stop_motor() failed: %d", s);
} }
/*===========================================================================* /*===========================================================================*
@ -843,7 +843,7 @@ PRIVATE void floppy_stop(struct driver *dp, sigset_t *set)
int s; int s;
if (sigismember(set, SIGTERM)) { if (sigismember(set, SIGTERM)) {
if ((s=sys_outb(DOR, ENABLE_INT)) != OK) if ((s=sys_outb(DOR, ENABLE_INT)) != OK)
panic("FLOPPY","Sys_outb in floppy_stop() failed", s); panic("Sys_outb in floppy_stop() failed: %d", s);
exit(0); exit(0);
} }
} }
@ -1010,20 +1010,20 @@ PRIVATE int fdc_results(void)
* the perfection of the mirror. * the perfection of the mirror.
*/ */
if ((s=sys_inb(FDC_STATUS, &status)) != OK) if ((s=sys_inb(FDC_STATUS, &status)) != OK)
panic("FLOPPY","Sys_inb in fdc_results() failed", s); panic("Sys_inb in fdc_results() failed: %d", s);
status &= (MASTER | DIRECTION | CTL_BUSY); status &= (MASTER | DIRECTION | CTL_BUSY);
if (status == (MASTER | DIRECTION | CTL_BUSY)) { if (status == (MASTER | DIRECTION | CTL_BUSY)) {
unsigned long tmp_r; unsigned long tmp_r;
if (result_nr >= MAX_RESULTS) break; /* too many results */ if (result_nr >= MAX_RESULTS) break; /* too many results */
if ((s=sys_inb(FDC_DATA, &tmp_r)) != OK) if ((s=sys_inb(FDC_DATA, &tmp_r)) != OK)
panic("FLOPPY","Sys_inb in fdc_results() failed", s); panic("Sys_inb in fdc_results() failed: %d", s);
f_results[result_nr] = tmp_r; f_results[result_nr] = tmp_r;
result_nr ++; result_nr ++;
continue; continue;
} }
if (status == MASTER) { /* all read */ if (status == MASTER) { /* all read */
if ((s=sys_irqenable(&irq_hook_id)) != OK) if ((s=sys_irqenable(&irq_hook_id)) != OK)
panic("FLOPPY", "Couldn't enable IRQs", s); panic("Couldn't enable IRQs: %d", s);
return(OK); /* only good exit */ return(OK); /* only good exit */
} }
@ -1032,7 +1032,7 @@ PRIVATE int fdc_results(void)
need_reset = TRUE; /* controller chip must be reset */ need_reset = TRUE; /* controller chip must be reset */
if ((s=sys_irqenable(&irq_hook_id)) != OK) if ((s=sys_irqenable(&irq_hook_id)) != OK)
panic("FLOPPY", "Couldn't enable IRQs", s); panic("Couldn't enable IRQs: %d", s);
return(ERR_STATUS); return(ERR_STATUS);
} }
@ -1087,12 +1087,12 @@ PRIVATE void fdc_out(
return; return;
} }
if ((s=sys_inb(FDC_STATUS, &status)) != OK) if ((s=sys_inb(FDC_STATUS, &status)) != OK)
panic("FLOPPY","Sys_inb in fdc_out() failed", s); panic("Sys_inb in fdc_out() failed: %d", s);
} }
while ((status & (MASTER | DIRECTION)) != (MASTER | 0)); while ((status & (MASTER | DIRECTION)) != (MASTER | 0));
if ((s=sys_outb(FDC_DATA, val)) != OK) if ((s=sys_outb(FDC_DATA, val)) != OK)
panic("FLOPPY","Sys_outb in fdc_out() failed", s); panic("Sys_outb in fdc_out() failed: %d", s);
} }
/*===========================================================================* /*===========================================================================*
@ -1166,7 +1166,7 @@ PRIVATE void f_reset(void)
pv_set(byte_out[0], DOR, 0); /* strobe reset bit low */ pv_set(byte_out[0], DOR, 0); /* strobe reset bit low */
pv_set(byte_out[1], DOR, ENABLE_INT); /* strobe it high again */ pv_set(byte_out[1], DOR, ENABLE_INT); /* strobe it high again */
if ((s=sys_voutb(byte_out, 2)) != OK) if ((s=sys_voutb(byte_out, 2)) != OK)
panic("FLOPPY", "Sys_voutb in f_reset() failed", s); panic("Sys_voutb in f_reset() failed: %d", s);
/* A synchronous alarm timer was set in fdc_command. Expect an interrupt, /* A synchronous alarm timer was set in fdc_command. Expect an interrupt,
* but be prepared to handle a timeout. * but be prepared to handle a timeout.

View file

@ -278,7 +278,7 @@ PRIVATE void handle_hw_intr(void)
r= sys_irqenable(&fp->fxp_hook); r= sys_irqenable(&fp->fxp_hook);
if (r != OK) { if (r != OK) {
panic("FXP", "unable enable interrupts", r); panic("unable enable interrupts: %d", r);
} }
if (!fp->fxp_got_int) if (!fp->fxp_got_int)
@ -310,7 +310,7 @@ int main(int argc, char *argv[])
while (TRUE) while (TRUE)
{ {
if ((r= sef_receive(ANY, &m)) != OK) if ((r= sef_receive(ANY, &m)) != OK)
panic("FXP","sef_receive failed", r); panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) { if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) { switch (_ENDPOINT_P(m.m_source)) {
@ -332,7 +332,7 @@ int main(int argc, char *argv[])
fxp_expire_timers(); fxp_expire_timers();
break; break;
default: default:
panic("FXP"," illegal notify from", m.m_source); panic(" illegal notify from: %d", m.m_source);
} }
/* get new message */ /* get new message */
@ -352,7 +352,7 @@ int main(int argc, char *argv[])
case DL_GETSTAT_S: fxp_getstat_s(&m); break; case DL_GETSTAT_S: fxp_getstat_s(&m); break;
case DL_GETNAME: fxp_getname(&m); break; case DL_GETNAME: fxp_getname(&m); break;
default: default:
panic("FXP"," illegal message", m.m_type); panic(" illegal message: %d", m.m_type);
} }
} }
} }
@ -387,7 +387,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
system_hz = sys_hz(); system_hz = sys_hz();
if (env_argc < 1) if (env_argc < 1)
panic("FXP", "A head which at this time has no name", NO_NUM); panic("A head which at this time has no name");
(progname=strrchr(env_argv[0],'/')) ? progname++ (progname=strrchr(env_argv[0],'/')) ? progname++
: (progname=env_argv[0]); : (progname=env_argv[0]);
@ -398,12 +398,12 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
eth_ign_proto= htons((u16_t) v); eth_ign_proto= htons((u16_t) v);
if(!(fxp_table = alloc_contig(ft, 0, &fxp_table_phys))) if(!(fxp_table = alloc_contig(ft, 0, &fxp_table_phys)))
panic("FXP","couldn't allocate table", ENOMEM); panic("couldn't allocate table: %d", ENOMEM);
memset(fxp_table, 0, ft); memset(fxp_table, 0, ft);
if((r=tsc_calibrate()) != OK) if((r=tsc_calibrate()) != OK)
panic("FXP","tsc_calibrate failed", r); panic("tsc_calibrate failed: %d", r);
/* Try to notify inet that we are present (again) */ /* Try to notify inet that we are present (again) */
r= ds_retrieve_label_num("inet", &tasknr); r= ds_retrieve_label_num("inet", &tasknr);
@ -595,10 +595,8 @@ static int fxp_probe(fxp_t *fp)
continue; continue;
if (pcitab_fxp[i].did != did) if (pcitab_fxp[i].did != did)
continue; continue;
if (pcitab_fxp[i].checkclass) if (pcitab_fxp[i].checkclass) {
{ panic("fxp_probe: class check not implemented");
panic("FXP","fxp_probe: class check not implemented",
NO_NUM);
} }
break; break;
} }
@ -630,10 +628,8 @@ static int fxp_probe(fxp_t *fp)
pci_reserve(devind); pci_reserve(devind);
bar= pci_attr_r32(devind, PCI_BAR_2) & 0xffffffe0; bar= pci_attr_r32(devind, PCI_BAR_2) & 0xffffffe0;
if (bar < 0x400) if (bar < 0x400) {
{ panic("fxp_probe: base address is not properly configured");
panic("FXP","fxp_probe: base address is not properly configured",
NO_NUM);
} }
fp->fxp_base_port= bar; fp->fxp_base_port= bar;
@ -819,7 +815,7 @@ fxp_t *fp;
} }
break; break;
default: default:
panic("FXP","fxp_conf_hw: bad device type", fp->fxp_type); panic("fxp_conf_hw: bad device type: %d", fp->fxp_type);
} }
#if VERBOSE #if VERBOSE
@ -852,13 +848,13 @@ fxp_t *fp;
fp->fxp_hook = fp->fxp_irq; fp->fxp_hook = fp->fxp_irq;
r= sys_irqsetpolicy(fp->fxp_irq, 0, &fp->fxp_hook); r= sys_irqsetpolicy(fp->fxp_irq, 0, &fp->fxp_hook);
if (r != OK) if (r != OK)
panic("FXP","sys_irqsetpolicy failed", r); panic("sys_irqsetpolicy failed: %d", r);
fxp_reset_hw(fp); fxp_reset_hw(fp);
r= sys_irqenable(&fp->fxp_hook); r= sys_irqenable(&fp->fxp_hook);
if (r != OK) if (r != OK)
panic("FXP","sys_irqenable failed", r); panic("sys_irqenable failed: %d", r);
/* Reset PHY? */ /* Reset PHY? */
@ -868,7 +864,7 @@ fxp_t *fp;
r= sys_umap(SELF, VM_D, (vir_bytes)&fp->fxp_stat, sizeof(fp->fxp_stat), r= sys_umap(SELF, VM_D, (vir_bytes)&fp->fxp_stat, sizeof(fp->fxp_stat),
&bus_addr); &bus_addr);
if (r != OK) if (r != OK)
panic("FXP","sys_umap failed", r); panic("sys_umap failed: %d", r);
fxp_cu_ptr_cmd(fp, SC_CU_LOAD_DCA, bus_addr, TRUE /* check idle */); fxp_cu_ptr_cmd(fp, SC_CU_LOAD_DCA, bus_addr, TRUE /* check idle */);
/* Ack previous interrupts */ /* Ack previous interrupts */
@ -920,10 +916,8 @@ fxp_t *fp;
tot_bufsize += 4096 - (tot_bufsize % 4096); tot_bufsize += 4096 - (tot_bufsize % 4096);
alloc_bufsize= tot_bufsize; alloc_bufsize= tot_bufsize;
alloc_buf= alloc_contig(alloc_bufsize, AC_ALIGN4K, &ph); alloc_buf= alloc_contig(alloc_bufsize, AC_ALIGN4K, &ph);
if (alloc_buf == NULL) if (alloc_buf == NULL) {
{ panic("fxp_init_buf: unable to alloc_contig size: %d", alloc_bufsize);
panic(__FILE__, "fxp_init_buf: unable to alloc_contig size",
alloc_bufsize);
} }
buf= (phys_bytes)alloc_buf; buf= (phys_bytes)alloc_buf;
@ -936,7 +930,7 @@ fxp_t *fp;
r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_rx_buf, rx_totbufsize, r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_rx_buf, rx_totbufsize,
&fp->fxp_rx_busaddr); &fp->fxp_rx_busaddr);
if (r != OK) if (r != OK)
panic("FXP","sys_umap failed", r); panic("sys_umap failed: %d", r);
#if 0 #if 0
printf("fxp_init_buf: got phys 0x%x for vir 0x%x\n", printf("fxp_init_buf: got phys 0x%x for vir 0x%x\n",
@ -952,7 +946,7 @@ fxp_t *fp;
r= sys_umap(SELF, VM_D, (vir_bytes)&rfdp[1], r= sys_umap(SELF, VM_D, (vir_bytes)&rfdp[1],
sizeof(rfdp[1]), &rfdp->rfd_linkaddr); sizeof(rfdp[1]), &rfdp->rfd_linkaddr);
if (r != OK) if (r != OK)
panic("FXP","sys_umap failed", r); panic("sys_umap failed: %d", r);
} }
else else
{ {
@ -970,7 +964,7 @@ fxp_t *fp;
r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_tx_buf, r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_tx_buf,
(phys_bytes)tx_totbufsize, &fp->fxp_tx_busaddr); (phys_bytes)tx_totbufsize, &fp->fxp_tx_busaddr);
if (r != OK) if (r != OK)
panic("FXP","sys_umap failed", r); panic("sys_umap failed: %d", r);
for (i= 0, txp= fp->fxp_tx_buf; i<fp->fxp_tx_nbuf; i++, txp++) for (i= 0, txp= fp->fxp_tx_buf; i<fp->fxp_tx_nbuf; i++, txp++)
{ {
@ -982,7 +976,7 @@ fxp_t *fp;
(phys_bytes)sizeof(txp[1]), (phys_bytes)sizeof(txp[1]),
&txp->tx_linkaddr); &txp->tx_linkaddr);
if (r != OK) if (r != OK)
panic("FXP","sys_umap failed", r); panic("sys_umap failed: %d", r);
} }
else else
{ {
@ -1065,7 +1059,7 @@ static void fxp_confaddr(fxp_t *fp)
r= sys_umap(SELF, VM_D, (vir_bytes)&tmpbufp->ias, r= sys_umap(SELF, VM_D, (vir_bytes)&tmpbufp->ias,
(phys_bytes)sizeof(tmpbufp->ias), &bus_addr); (phys_bytes)sizeof(tmpbufp->ias), &bus_addr);
if (r != OK) if (r != OK)
panic("FXP","sys_umap failed", r); panic("sys_umap failed: %d", r);
fxp_cu_ptr_cmd(fp, SC_CU_START, bus_addr, TRUE /* check idle */); fxp_cu_ptr_cmd(fp, SC_CU_START, bus_addr, TRUE /* check idle */);
@ -1077,9 +1071,9 @@ static void fxp_confaddr(fxp_t *fp)
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000)); } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000));
if (!(tmpbufp->ias.ias_status & CBL_F_C)) if (!(tmpbufp->ias.ias_status & CBL_F_C))
panic("FXP","fxp_confaddr: CU command failed to complete", NO_NUM); panic("fxp_confaddr: CU command failed to complete");
if (!(tmpbufp->ias.ias_status & CBL_F_OK)) if (!(tmpbufp->ias.ias_status & CBL_F_OK))
panic("FXP","fxp_confaddr: CU command failed", NO_NUM); panic("fxp_confaddr: CU command failed");
#if VERBOSE #if VERBOSE
printf("%s: hardware ethernet address: ", fp->fxp_name); printf("%s: hardware ethernet address: ", fp->fxp_name);
@ -1141,7 +1135,7 @@ int vectored;
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR) if (dl_port < 0 || dl_port >= FXP_PORT_NR)
panic("FXP","fxp_writev: illegal port", dl_port); panic("fxp_writev: illegal port: %d", dl_port);
fp= &fxp_table[dl_port]; fp= &fxp_table[dl_port];
fxp_client= mp->DL_PROC; fxp_client= mp->DL_PROC;
fp->fxp_client= fxp_client; fp->fxp_client= fxp_client;
@ -1203,42 +1197,38 @@ int vectored;
SELF, D, (vir_bytes)fp->fxp_iovec, SELF, D, (vir_bytes)fp->fxp_iovec,
n * sizeof(fp->fxp_iovec[0])); n * sizeof(fp->fxp_iovec[0]));
if (r != OK) if (r != OK)
panic("FXP","fxp_writev: sys_vircopy failed", r); panic("fxp_writev: sys_vircopy failed: %d", r);
for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++) for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++)
{ {
s= iovp->iov_size; s= iovp->iov_size;
if (size + s > ETH_MAX_PACK_SIZE_TAGGED) if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
{ panic("fxp_writev: invalid packet size");
panic("FXP","fxp_writev: invalid packet size",
NO_NUM);
} }
r= sys_vircopy(fxp_client, D, iovp->iov_addr, r= sys_vircopy(fxp_client, D, iovp->iov_addr,
SELF, D, (vir_bytes)(txp->tx_buf+o), SELF, D, (vir_bytes)(txp->tx_buf+o),
s); s);
if (r != OK) if (r != OK) {
{ panic("fxp_writev: sys_vircopy failed: %d", r);
panic("FXP","fxp_writev: sys_vircopy failed",
r);
} }
size += s; size += s;
o += s; o += s;
} }
} }
if (size < ETH_MIN_PACK_SIZE) if (size < ETH_MIN_PACK_SIZE)
panic("FXP","fxp_writev: invalid packet size", size); panic("fxp_writev: invalid packet size: %d", size);
} }
else else
{ {
size= mp->DL_COUNT; size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
panic("FXP","fxp_writev: invalid packet size", size); panic("fxp_writev: invalid packet size: %d", size);
r= sys_vircopy(fxp_client, D, (vir_bytes)mp->DL_ADDR, r= sys_vircopy(fxp_client, D, (vir_bytes)mp->DL_ADDR,
SELF, D, (vir_bytes)txp->tx_buf, size); SELF, D, (vir_bytes)txp->tx_buf, size);
if (r != OK) if (r != OK)
panic("FXP","fxp_writev: sys_vircopy failed", r); panic("fxp_writev: sys_vircopy failed: %d", r);
} }
txp->tx_status= 0; txp->tx_status= 0;
@ -1276,7 +1266,7 @@ int vectored;
suspend: suspend:
if (from_int) if (from_int)
panic("FXP","fxp: should not be sending\n", NO_NUM); panic("fxp: should not be sending");
fp->fxp_tx_mess= *mp; fp->fxp_tx_mess= *mp;
reply(fp, OK, FALSE); reply(fp, OK, FALSE);
@ -1299,7 +1289,7 @@ static void fxp_writev_s(message *mp, int from_int)
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR) if (dl_port < 0 || dl_port >= FXP_PORT_NR)
panic("FXP","fxp_writev: illegal port", dl_port); panic("fxp_writev: illegal port: %d", dl_port);
fp= &fxp_table[dl_port]; fp= &fxp_table[dl_port];
fxp_client= mp->DL_PROC; fxp_client= mp->DL_PROC;
fp->fxp_client= fxp_client; fp->fxp_client= fxp_client;
@ -1359,31 +1349,26 @@ static void fxp_writev_s(message *mp, int from_int)
(vir_bytes)fp->fxp_iovec_s, (vir_bytes)fp->fxp_iovec_s,
n * sizeof(fp->fxp_iovec_s[0]), D); n * sizeof(fp->fxp_iovec_s[0]), D);
if (r != OK) if (r != OK)
panic("FXP","fxp_writev: sys_safecopyfrom failed", r); panic("fxp_writev: sys_safecopyfrom failed: %d", r);
for (j= 0, iovp= fp->fxp_iovec_s; j<n; j++, iovp++) for (j= 0, iovp= fp->fxp_iovec_s; j<n; j++, iovp++)
{ {
s= iovp->iov_size; s= iovp->iov_size;
if (size + s > ETH_MAX_PACK_SIZE_TAGGED) if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
{ panic("fxp_writev: invalid packet size: %d", size + s);
panic("FXP","fxp_writev: invalid packet size",
size + s);
} }
r= sys_safecopyfrom(fxp_client, iovp->iov_grant, r= sys_safecopyfrom(fxp_client, iovp->iov_grant,
0, (vir_bytes)(txp->tx_buf+o), s, D); 0, (vir_bytes)(txp->tx_buf+o), s, D);
if (r != OK) if (r != OK) {
{ panic("fxp_writev_s: sys_safecopyfrom failed: %d", r);
panic("FXP",
"fxp_writev_s: sys_safecopyfrom failed",
r);
} }
size += s; size += s;
o += s; o += s;
} }
} }
if (size < ETH_MIN_PACK_SIZE) if (size < ETH_MIN_PACK_SIZE)
panic("FXP","fxp_writev: invalid packet size", size); panic("fxp_writev: invalid packet size: %d", size);
txp->tx_status= 0; txp->tx_status= 0;
txp->tx_command= TXC_EL | CBL_XMIT; txp->tx_command= TXC_EL | CBL_XMIT;
@ -1420,7 +1405,7 @@ static void fxp_writev_s(message *mp, int from_int)
suspend: suspend:
if (from_int) if (from_int)
panic("FXP","fxp: should not be sending\n", NO_NUM); panic("fxp: should not be sending");
fp->fxp_tx_mess= *mp; fp->fxp_tx_mess= *mp;
reply(fp, OK, FALSE); reply(fp, OK, FALSE);
@ -1449,7 +1434,7 @@ int vectored;
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR) if (dl_port < 0 || dl_port >= FXP_PORT_NR)
panic("FXP","fxp_readv: illegal port", dl_port); panic("fxp_readv: illegal port: %d", dl_port);
fp= &fxp_table[dl_port]; fp= &fxp_table[dl_port];
fxp_client= mp->DL_PROC; fxp_client= mp->DL_PROC;
fp->fxp_client= fxp_client; fp->fxp_client= fxp_client;
@ -1502,7 +1487,7 @@ int vectored;
SELF, D, (vir_bytes)fp->fxp_iovec, SELF, D, (vir_bytes)fp->fxp_iovec,
n * sizeof(fp->fxp_iovec[0])); n * sizeof(fp->fxp_iovec[0]));
if (r != OK) if (r != OK)
panic("FXP","fxp_readv: sys_vircopy failed", r); panic("fxp_readv: sys_vircopy failed: %d", r);
for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++) for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++)
{ {
@ -1516,10 +1501,8 @@ int vectored;
r= sys_vircopy(SELF, D, r= sys_vircopy(SELF, D,
(vir_bytes)(rfdp->rfd_buf+o), (vir_bytes)(rfdp->rfd_buf+o),
fxp_client, D, iovp->iov_addr, s); fxp_client, D, iovp->iov_addr, s);
if (r != OK) if (r != OK) {
{ panic("fxp_readv: sys_vircopy failed: %d", r);
panic("FXP","fxp_readv: sys_vircopy failed",
r);
} }
size += s; size += s;
@ -1629,7 +1612,7 @@ int from_int;
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR) if (dl_port < 0 || dl_port >= FXP_PORT_NR)
panic("FXP","fxp_readv: illegal port", dl_port); panic("fxp_readv: illegal port: %d", dl_port);
fp= &fxp_table[dl_port]; fp= &fxp_table[dl_port];
fxp_client= mp->DL_PROC; fxp_client= mp->DL_PROC;
fp->fxp_client= fxp_client; fp->fxp_client= fxp_client;
@ -1681,7 +1664,7 @@ int from_int;
(vir_bytes)fp->fxp_iovec_s, (vir_bytes)fp->fxp_iovec_s,
n * sizeof(fp->fxp_iovec_s[0]), D); n * sizeof(fp->fxp_iovec_s[0]), D);
if (r != OK) if (r != OK)
panic("FXP","fxp_readv_s: sys_safecopyfrom failed", r); panic("fxp_readv_s: sys_safecopyfrom failed: %d", r);
for (j= 0, iovp= fp->fxp_iovec_s; j<n; j++, iovp++) for (j= 0, iovp= fp->fxp_iovec_s; j<n; j++, iovp++)
{ {
@ -1696,8 +1679,7 @@ int from_int;
0, (vir_bytes)(rfdp->rfd_buf+o), s, D); 0, (vir_bytes)(rfdp->rfd_buf+o), s, D);
if (r != OK) if (r != OK)
{ {
panic("FXP","fxp_readv: sys_safecopyto failed", panic("fxp_readv: sys_safecopyto failed: %d", r);
r);
} }
size += s; size += s;
@ -1799,7 +1781,7 @@ fxp_t *fp;
r= sys_umap(SELF, VM_D, (vir_bytes)&tmpbufp->cc, r= sys_umap(SELF, VM_D, (vir_bytes)&tmpbufp->cc,
(phys_bytes)sizeof(tmpbufp->cc), &bus_addr); (phys_bytes)sizeof(tmpbufp->cc), &bus_addr);
if (r != OK) if (r != OK)
panic("FXP","sys_umap failed", r); panic("sys_umap failed: %d", r);
fxp_cu_ptr_cmd(fp, SC_CU_START, bus_addr, TRUE /* check idle */); fxp_cu_ptr_cmd(fp, SC_CU_START, bus_addr, TRUE /* check idle */);
@ -1811,9 +1793,9 @@ fxp_t *fp;
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000)); } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000));
if (!(tmpbufp->cc.cc_status & CBL_F_C)) if (!(tmpbufp->cc.cc_status & CBL_F_C))
panic("FXP","fxp_do_conf: CU command failed to complete", NO_NUM); panic("fxp_do_conf: CU command failed to complete");
if (!(tmpbufp->cc.cc_status & CBL_F_OK)) if (!(tmpbufp->cc.cc_status & CBL_F_OK))
panic("FXP","fxp_do_conf: CU command failed", NO_NUM); panic("fxp_do_conf: CU command failed");
} }
@ -1836,7 +1818,7 @@ int check_idle;
{ {
/* Consistency check. Make sure that CU is idle */ /* Consistency check. Make sure that CU is idle */
if ((fxp_inb(port, SCB_STATUS) & SS_CUS_MASK) != SS_CU_IDLE) if ((fxp_inb(port, SCB_STATUS) & SS_CUS_MASK) != SS_CU_IDLE)
panic("FXP","fxp_cu_ptr_cmd: CU is not idle", NO_NUM); panic("fxp_cu_ptr_cmd: CU is not idle");
} }
fxp_outl(port, SCB_POINTER, bus_addr); fxp_outl(port, SCB_POINTER, bus_addr);
@ -1854,7 +1836,7 @@ int check_idle;
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000)); } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000));
if ((scb_cmd & SC_CUC_MASK) != SC_CU_NOP) if ((scb_cmd & SC_CUC_MASK) != SC_CU_NOP)
panic("FXP","fxp_cu_ptr_cmd: CU does not accept command", NO_NUM); panic("fxp_cu_ptr_cmd: CU does not accept command");
} }
/*===========================================================================* /*===========================================================================*
@ -1876,7 +1858,7 @@ int check_idle;
{ {
/* Consistency check, make sure that RU is idle */ /* Consistency check, make sure that RU is idle */
if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_IDLE) if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_IDLE)
panic("FXP","fxp_ru_ptr_cmd: RU is not idle", NO_NUM); panic("fxp_ru_ptr_cmd: RU is not idle");
} }
fxp_outl(port, SCB_POINTER, bus_addr); fxp_outl(port, SCB_POINTER, bus_addr);
@ -1891,7 +1873,7 @@ int check_idle;
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000)); } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000));
if ((scb_cmd & SC_RUC_MASK) != SC_RU_NOP) if ((scb_cmd & SC_RUC_MASK) != SC_RU_NOP)
panic("FXP","fxp_ru_ptr_cmd: RU does not accept command", NO_NUM); panic("fxp_ru_ptr_cmd: RU does not accept command");
} }
/*===========================================================================* /*===========================================================================*
@ -1921,7 +1903,7 @@ fxp_t *fp;
/* Make sure that RU is in the 'No resources' state */ /* Make sure that RU is in the 'No resources' state */
if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_NORES) if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_NORES)
panic("FXP","fxp_restart_ru: RU is in an unexpected state", NO_NUM); panic("fxp_restart_ru: RU is in an unexpected state");
fxp_ru_ptr_cmd(fp, SC_RU_START, fp->fxp_rx_busaddr, fxp_ru_ptr_cmd(fp, SC_RU_START, fp->fxp_rx_busaddr,
FALSE /* do not check idle */); FALSE /* do not check idle */);
@ -1941,7 +1923,7 @@ message *mp;
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR) if (dl_port < 0 || dl_port >= FXP_PORT_NR)
panic("FXP","fxp_getstat: illegal port", dl_port); panic("fxp_getstat: illegal port: %d", dl_port);
fp= &fxp_table[dl_port]; fp= &fxp_table[dl_port];
fp->fxp_client= mp->DL_PROC; fp->fxp_client= mp->DL_PROC;
@ -1964,9 +1946,9 @@ message *mp;
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000)); } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000));
if (*p == 0) if (*p == 0)
panic("FXP","fxp_getstat: CU command failed to complete", NO_NUM); panic("fxp_getstat: CU command failed to complete");
if (*p != SCM_DSC) if (*p != SCM_DSC)
panic("FXP","fxp_getstat: bad magic", NO_NUM); panic("fxp_getstat: bad magic");
stats.ets_recvErr= stats.ets_recvErr=
fp->fxp_stat.sc_rx_crc + fp->fxp_stat.sc_rx_crc +
@ -1997,14 +1979,14 @@ message *mp;
r= sys_vircopy(SELF, D, (vir_bytes)&stats, r= sys_vircopy(SELF, D, (vir_bytes)&stats,
mp->DL_PROC, D, (vir_bytes) mp->DL_ADDR, sizeof(stats)); mp->DL_PROC, D, (vir_bytes) mp->DL_ADDR, sizeof(stats));
if (r != OK) if (r != OK)
panic(__FILE__,"fxp_getstat: sys_vircopy failed", r); panic("fxp_getstat: sys_vircopy failed: %d", r);
mp->m_type= DL_STAT_REPLY; mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= dl_port; mp->DL_PORT= dl_port;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic(__FILE__, "fxp_getstat: send failed: %d\n", r); panic("fxp_getstat: send failed: %d", r);
} }
@ -2021,7 +2003,7 @@ static void fxp_getstat_s(message *mp)
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
if (dl_port < 0 || dl_port >= FXP_PORT_NR) if (dl_port < 0 || dl_port >= FXP_PORT_NR)
panic("FXP","fxp_getstat: illegal port", dl_port); panic("fxp_getstat: illegal port: %d", dl_port);
fp= &fxp_table[dl_port]; fp= &fxp_table[dl_port];
fp->fxp_client= mp->DL_PROC; fp->fxp_client= mp->DL_PROC;
@ -2044,9 +2026,9 @@ static void fxp_getstat_s(message *mp)
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000)); } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000));
if (*p == 0) if (*p == 0)
panic("FXP","fxp_getstat: CU command failed to complete", NO_NUM); panic("fxp_getstat: CU command failed to complete");
if (*p != SCM_DSC) if (*p != SCM_DSC)
panic("FXP","fxp_getstat: bad magic", NO_NUM); panic("fxp_getstat: bad magic");
stats.ets_recvErr= stats.ets_recvErr=
fp->fxp_stat.sc_rx_crc + fp->fxp_stat.sc_rx_crc +
@ -2077,14 +2059,14 @@ static void fxp_getstat_s(message *mp)
r= sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes)&stats, r= sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes)&stats,
sizeof(stats), D); sizeof(stats), D);
if (r != OK) if (r != OK)
panic(__FILE__,"fxp_getstat_s: sys_safecopyto failed", r); panic("fxp_getstat_s: sys_safecopyto failed: %d", r);
mp->m_type= DL_STAT_REPLY; mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= dl_port; mp->DL_PORT= dl_port;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic(__FILE__, "fxp_getstat_s: send failed: %d\n", r); panic("fxp_getstat_s: send failed: %d", r);
} }
@ -2100,7 +2082,7 @@ static void fxp_getname(message *mp)
mp->m_type= DL_NAME_REPLY; mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("FXP", "fxp_getname: send failed", r); panic("fxp_getname: send failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -2687,7 +2669,7 @@ int may_block;
} }
if (r < 0) if (r < 0)
panic("FXP","fxp: send failed:", r); panic("fxp: send failed: %d", r);
fp->fxp_read_s = 0; fp->fxp_read_s = 0;
fp->fxp_flags &= ~(FF_PACK_SENT | FF_PACK_RECV); fp->fxp_flags &= ~(FF_PACK_SENT | FF_PACK_RECV);
@ -2701,7 +2683,7 @@ message *req;
message *reply_mess; message *reply_mess;
{ {
if (send(req->m_source, reply_mess) != OK) if (send(req->m_source, reply_mess) != OK)
panic("FXP","fxp: unable to mess_reply", NO_NUM); panic("fxp: unable to mess_reply");
} }
/*===========================================================================* /*===========================================================================*
@ -2802,7 +2784,7 @@ fxp_t *fp;
break; break;
} }
if (i >= 32) if (i >= 32)
panic("FXP","eeprom_addrsize: failed", NO_NUM); panic("eeprom_addrsize: failed");
fp->fxp_ee_addrlen= i+1; fp->fxp_ee_addrlen= i+1;
/* Discard 16 data bits */ /* Discard 16 data bits */
@ -2839,7 +2821,7 @@ int reg;
fp->fxp_mii_busy++; fp->fxp_mii_busy++;
if (!(fxp_inl(port, CSR_MDI_CTL) & CM_READY)) if (!(fxp_inl(port, CSR_MDI_CTL) & CM_READY))
panic("FXP","mii_read: MDI not ready", NO_NUM); panic("mii_read: MDI not ready");
fxp_outl(port, CSR_MDI_CTL, CM_READ | (1 << CM_PHYADDR_SHIFT) | fxp_outl(port, CSR_MDI_CTL, CM_READ | (1 << CM_PHYADDR_SHIFT) |
(reg << CM_REG_SHIFT)); (reg << CM_REG_SHIFT));
@ -2851,7 +2833,7 @@ int reg;
} while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000)); } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000));
if (!(v & CM_READY)) if (!(v & CM_READY))
panic("FXP","mii_read: MDI not ready after command", NO_NUM); panic("mii_read: MDI not ready after command");
fp->fxp_mii_busy--; fp->fxp_mii_busy--;
assert(!fp->fxp_mii_busy); assert(!fp->fxp_mii_busy);
@ -2873,7 +2855,7 @@ tmr_func_t watchdog; /* watchdog function to be called */
/* Get the current time. */ /* Get the current time. */
r= getuptime(&now); r= getuptime(&now);
if (r != OK) if (r != OK)
panic("FXP","unable to get uptime from clock", r); panic("unable to get uptime from clock: %d", r);
/* Add the timer to the local timer queue. */ /* Add the timer to the local timer queue. */
tmrs_settimer(&fxp_timers, tp, now + delta, watchdog, NULL); tmrs_settimer(&fxp_timers, tp, now + delta, watchdog, NULL);
@ -2891,7 +2873,7 @@ tmr_func_t watchdog; /* watchdog function to be called */
#endif #endif
r= sys_setalarm(fxp_next_timeout, 1); r= sys_setalarm(fxp_next_timeout, 1);
if (r != OK) if (r != OK)
panic("FXP","unable to set synchronous alarm", r); panic("unable to set synchronous alarm: %d", r);
} }
} }
@ -2909,7 +2891,7 @@ PRIVATE void fxp_expire_timers()
/* Get the current time to compare the timers against. */ /* Get the current time to compare the timers against. */
r= getuptime(&now); r= getuptime(&now);
if (r != OK) if (r != OK)
panic("FXP","Unable to get uptime from clock.", r); panic("Unable to get uptime from clock: %d", r);
/* Scan the timers queue for expired timers. Dispatch the watchdog function /* Scan the timers queue for expired timers. Dispatch the watchdog function
* for each expired timers. Possibly a new alarm call must be scheduled. * for each expired timers. Possibly a new alarm call must be scheduled.
@ -2922,7 +2904,7 @@ PRIVATE void fxp_expire_timers()
fxp_next_timeout = fxp_timers->tmr_exp_time; fxp_next_timeout = fxp_timers->tmr_exp_time;
r= sys_setalarm(fxp_next_timeout, 1); r= sys_setalarm(fxp_next_timeout, 1);
if (r != OK) if (r != OK)
panic("FXP","Unable to set synchronous alarm.", r); panic("Unable to set synchronous alarm: %d", r);
} }
} }
@ -2933,7 +2915,7 @@ static u8_t do_inb(port_t port)
r= sys_inb(port, &value); r= sys_inb(port, &value);
if (r != OK) if (r != OK)
panic("FXP","sys_inb failed", r); panic("sys_inb failed: %d", r);
return value; return value;
} }
@ -2944,7 +2926,7 @@ static u32_t do_inl(port_t port)
r= sys_inl(port, &value); r= sys_inl(port, &value);
if (r != OK) if (r != OK)
panic("FXP","sys_inl failed", r); panic("sys_inl failed: %d", r);
return value; return value;
} }
@ -2954,7 +2936,7 @@ static void do_outb(port_t port, u8_t value)
r= sys_outb(port, value); r= sys_outb(port, value);
if (r != OK) if (r != OK)
panic("FXP","sys_outb failed", r); panic("sys_outb failed: %d", r);
} }
static void do_outl(port_t port, u32_t value) static void do_outl(port_t port, u32_t value)
@ -2963,7 +2945,7 @@ static void do_outl(port_t port, u32_t value)
r= sys_outl(port, value); r= sys_outl(port, value);
if (r != OK) if (r != OK)
panic("FXP","sys_outl failed", r); panic("sys_outl failed: %d", r);
} }
PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func) PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func)

View file

@ -147,7 +147,7 @@ unsigned long vir2phys( unsigned long x )
if ( (r=sys_umap( SELF, VM_D, x, 4, &value )) != OK ) { if ( (r=sys_umap( SELF, VM_D, x, 4, &value )) != OK ) {
printf("lance: umap of 0x%lx failed\n",x ); printf("lance: umap of 0x%lx failed\n",x );
panic( "lance", "sys_umap failed", r ); panic("sys_umap failed: %d", r);
} }
return value; return value;
@ -289,7 +289,7 @@ void main( int argc, char **argv )
} }
if ((r= sef_receive(ANY, &m)) != OK) if ((r= sef_receive(ANY, &m)) != OK)
panic( "lance", "sef_receive failed", r); panic("sef_receive failed: %d", r);
for (i=0;i<EC_PORT_NR_MAX;++i) for (i=0;i<EC_PORT_NR_MAX;++i)
{ {
@ -329,7 +329,7 @@ void main( int argc, char **argv )
break; break;
} }
default: default:
panic( "lance", "illegal notify source", m.m_source); panic("illegal notify source: %d", m.m_source);
} }
/* get next message */ /* get next message */
@ -357,7 +357,7 @@ void main( int argc, char **argv )
do_getname(&m); do_getname(&m);
break; break;
default: default:
panic( "lance", "illegal message", m.m_type); panic("illegal message: %d", m.m_type);
} }
} }
} }
@ -516,7 +516,7 @@ message *mp;
pci_init(); pci_init();
if(!lance_buf && !(lance_buf = alloc_contig(LANCE_BUF_SIZE, AC_ALIGN4K|AC_LOWER16M, &lance_buf_phys))) { if(!lance_buf && !(lance_buf = alloc_contig(LANCE_BUF_SIZE, AC_ALIGN4K|AC_LOWER16M, &lance_buf_phys))) {
panic( "lance", "alloc_contig failed", LANCE_BUF_SIZE); panic("alloc_contig failed: %d", LANCE_BUF_SIZE);
} }
port = mp->DL_PORT; port = mp->DL_PORT;
@ -542,7 +542,7 @@ message *mp;
} }
else else
{ {
report( "LANCE", "DMA denied because address out of range", NO_NUM ); printf("LANCE: DMA denied because address out of range\n" );
} }
if (ec->mode == EC_DISABLED) if (ec->mode == EC_DISABLED)
@ -744,7 +744,7 @@ int may_block;
reply.DL_COUNT = ec->read_s; reply.DL_COUNT = ec->read_s;
if ((r=getuptime(&now)) != OK) if ((r=getuptime(&now)) != OK)
panic("lance", "getuptime() failed:", r); panic("getuptime() failed: %d", r);
reply.DL_CLCK = now; reply.DL_CLCK = now;
r = send(ec->client, &reply); r = send(ec->client, &reply);
@ -753,7 +753,7 @@ int may_block;
return; return;
} }
if (r < 0) if (r < 0)
panic( "lance", "send failed:", r); panic("send failed: %d", r);
ec->read_s = 0; ec->read_s = 0;
ec->flags &= ~(ECF_PACK_SEND | ECF_PACK_RECV); ec->flags &= ~(ECF_PACK_SEND | ECF_PACK_RECV);
@ -768,7 +768,7 @@ message *req;
message *reply_mess; message *reply_mess;
{ {
if (send(req->m_source, reply_mess) != OK) if (send(req->m_source, reply_mess) != OK)
panic( "lance", "unable to mess_reply", NO_NUM); panic("unable to mess_reply");
} }
@ -867,7 +867,7 @@ ether_card_t *ec;
unsigned short ioaddr = ec->ec_port; unsigned short ioaddr = ec->ec_port;
if (!(ec->flags & ECF_ENABLED)) if (!(ec->flags & ECF_ENABLED))
panic( "lance", "got premature interrupt", NO_NUM); panic("got premature interrupt");
for (;;) for (;;)
{ {
@ -959,7 +959,7 @@ ether_card_t *ec;
} }
else else
{ {
panic( "lance", "got premature TX INT...", NO_NUM); panic("got premature TX INT..");
} }
if (check==1) if (check==1)
{ {
@ -1065,7 +1065,7 @@ ether_card_t *ec;
{ {
case DL_WRITEV_S: do_vwrite_s(&ec->sendmsg, TRUE); break; case DL_WRITEV_S: do_vwrite_s(&ec->sendmsg, TRUE); break;
default: default:
panic( "lance", "wrong type:", ec->sendmsg.m_type); panic("wrong type: %d", ec->sendmsg.m_type);
break; break;
} }
} }
@ -1088,8 +1088,7 @@ static void do_vread_s(message *mp)
(count > IOVEC_NR ? IOVEC_NR : count) * (count > IOVEC_NR ? IOVEC_NR : count) *
sizeof(iovec_s_t), D); sizeof(iovec_s_t), D);
if (r != OK) if (r != OK)
panic(__FILE__, panic("do_vread_s: sys_safecopyfrom failed: %d", r);
"do_vread_s: sys_safecopyfrom failed: %d\n", r);
ec->read_iovec.iod_iovec_s = count; ec->read_iovec.iod_iovec_s = count;
ec->read_iovec.iod_proc_nr = mp->DL_PROC; ec->read_iovec.iod_proc_nr = mp->DL_PROC;
ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
@ -1207,9 +1206,7 @@ int from_int;
(count > IOVEC_NR ? IOVEC_NR : count) * (count > IOVEC_NR ? IOVEC_NR : count) *
sizeof(iovec_s_t), D); sizeof(iovec_s_t), D);
if (r != OK) if (r != OK)
panic(__FILE__, panic("do_vwrite_s: sys_safecopyfrom failed: %d", r);
"do_vwrite_s: sys_safecopyfrom failed: %d\n", r);
ec->write_iovec.iod_iovec_s = count; ec->write_iovec.iod_iovec_s = count;
ec->write_iovec.iod_proc_nr = mp->DL_PROC; ec->write_iovec.iod_proc_nr = mp->DL_PROC;
ec->write_iovec.iod_grant = mp->DL_GRANT; ec->write_iovec.iod_grant = mp->DL_GRANT;
@ -1283,7 +1280,7 @@ vir_bytes count;
if ( (r=sys_safecopyfrom(iovp->iod_proc_nr, if ( (r=sys_safecopyfrom(iovp->iod_proc_nr,
iovp->iod_iovec[i].iov_grant, offset, iovp->iod_iovec[i].iov_grant, offset,
nic_addr, bytes, D )) != OK ) nic_addr, bytes, D )) != OK )
panic( __FILE__, "ec_user2nic: sys_safecopyfrom failed", r ); panic("ec_user2nic: sys_safecopyfrom failed: %d", r);
count -= bytes; count -= bytes;
nic_addr += bytes; nic_addr += bytes;
@ -1323,7 +1320,7 @@ vir_bytes count;
bytes = count; bytes = count;
if ( (r=sys_safecopyto( iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant, if ( (r=sys_safecopyto( iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant,
offset, nic_addr, bytes, D )) != OK ) offset, nic_addr, bytes, D )) != OK )
panic( __FILE__, "ec_nic2user: sys_safecopyto failed: ", r ); panic("ec_nic2user: sys_safecopyto failed: %d", r);
count -= bytes; count -= bytes;
nic_addr += bytes; nic_addr += bytes;
@ -1374,8 +1371,7 @@ iovec_dat_t *iovp;
IOVEC_NR : iovp->iod_iovec_s) * IOVEC_NR : iovp->iod_iovec_s) *
sizeof(iovec_s_t), D); sizeof(iovec_s_t), D);
if (r != OK) if (r != OK)
panic(__FILE__, panic("ec_next_iovec: sys_safecopyfrom failed: %d", r);
"ec_next_iovec: sys_safecopyfrom failed: %d\n", r);
} }
@ -1390,7 +1386,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= EC_PORT_NR_MAX) if (port < 0 || port >= EC_PORT_NR_MAX)
panic( "lance", "illegal port", port); panic("illegal port: %d", port);
ec= &ec_table[port]; ec= &ec_table[port];
ec->client= mp->DL_PROC; ec->client= mp->DL_PROC;
@ -1399,15 +1395,14 @@ message *mp;
(vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat), D); (vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat), D);
if (r != OK) if (r != OK)
panic(__FILE__, panic("do_getstat_s: sys_safecopyto failed: %d", r);
"do_getstat_s: sys_safecopyto failed: %d\n", r);
mp->m_type= DL_STAT_REPLY; mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= port; mp->DL_PORT= port;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic(__FILE__, "do_getstat_s: send failed: %d\n", r); panic("do_getstat_s: send failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -1422,7 +1417,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= EC_PORT_NR_MAX) if (port < 0 || port >= EC_PORT_NR_MAX)
panic( "lance", "illegal port", port); panic("illegal port: %d", port);
ec = &ec_table[port]; ec = &ec_table[port];
if (!(ec->flags & ECF_ENABLED)) if (!(ec->flags & ECF_ENABLED))
@ -1516,10 +1511,8 @@ ether_card_t *ec;
continue; continue;
if (pcitab[i].did != did) if (pcitab[i].did != did)
continue; continue;
if (pcitab[i].checkclass) if (pcitab[i].checkclass) {
{ panic("class check not implemented");
panic("lance",
"class check not implemented", NO_NUM);
} }
break; break;
} }
@ -1610,7 +1603,7 @@ message *mp;
mp->m_type= DL_NAME_REPLY; mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("LANCE", "do_getname: send failed", r); panic("do_getname: send failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -1731,7 +1724,7 @@ static u8_t in_byte(port_t port)
r= sys_inb(port, &value); r= sys_inb(port, &value);
if (r != OK) if (r != OK)
panic("lance","sys_inb failed", r); panic("sys_inb failed: %d", r);
return value; return value;
} }
@ -1745,7 +1738,7 @@ static u16_t in_word(port_t port)
r= sys_inw(port, &value); r= sys_inw(port, &value);
if (r != OK) if (r != OK)
panic("lance","sys_inw failed", r); panic("sys_inw failed: %d", r);
return value; return value;
} }
@ -1759,7 +1752,7 @@ static void out_word(port_t port, u16_t value)
r= sys_outw(port, value); r= sys_outw(port, value);
if (r != OK) if (r != OK)
panic("lance","sys_outw failed", r); panic("sys_outw failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*

View file

@ -146,7 +146,7 @@ int type; /* Driver type (DRIVER_STD or DRIVER_ASYN) */
int s; int s;
/* Wait for a request to read or write a disk block. */ /* Wait for a request to read or write a disk block. */
if ((s=sef_receive(ANY, &mess)) != OK) if ((s=sef_receive(ANY, &mess)) != OK)
panic((*dp->dr_name)(),"sef_receive() failed", s); panic("sef_receive() failed: %d", s);
} }
device_caller = mess.m_source; device_caller = mess.m_source;
@ -239,7 +239,7 @@ send_reply:
break; break;
default: default:
panic(__FILE__, "unknown driver type", type); panic("unknown driver type: %d", type);
} }
} }
} }
@ -256,7 +256,7 @@ PUBLIC void init_buffer(void)
*/ */
if(!(tmp_buf = alloc_contig(2*DMA_BUF_SIZE, AC_ALIGN4K, &tmp_phys))) if(!(tmp_buf = alloc_contig(2*DMA_BUF_SIZE, AC_ALIGN4K, &tmp_phys)))
panic(__FILE__, "can't allocate tmp_buf", DMA_BUF_SIZE); panic("can't allocate tmp_buf: %d", DMA_BUF_SIZE);
} }
/*===========================================================================* /*===========================================================================*
@ -317,7 +317,7 @@ message *mp; /* pointer to read or write message */
if (OK != sys_safecopyfrom(mp->m_source, (vir_bytes) mp->IO_GRANT, if (OK != sys_safecopyfrom(mp->m_source, (vir_bytes) mp->IO_GRANT,
0, (vir_bytes) iovec, iovec_size, D)) { 0, (vir_bytes) iovec, iovec_size, D)) {
panic((*dp->dr_name)(),"bad I/O vector by", mp->m_source); panic("bad I/O vector by: %d", mp->m_source);
} }
/* Prepare for I/O. */ /* Prepare for I/O. */
@ -331,7 +331,7 @@ message *mp; /* pointer to read or write message */
/* Copy the I/O vector back to the caller. */ /* Copy the I/O vector back to the caller. */
if (OK != sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT, if (OK != sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT,
0, (vir_bytes) iovec, iovec_size, D)) { 0, (vir_bytes) iovec, iovec_size, D)) {
panic((*dp->dr_name)(),"couldn't return I/O vector", mp->m_source); panic("couldn't return I/O vector: %d", mp->m_source);
} }
return(r); return(r);
@ -485,7 +485,7 @@ PUBLIC int mq_queue(message *m)
mq_t *mq, *mi; mq_t *mq, *mi;
if(!(mq = mq_get())) if(!(mq = mq_get()))
panic("libdriver","mq_queue: mq_get failed", NO_NUM); panic("mq_queue: mq_get failed");
memcpy(&mq->mq_mess, m, sizeof(mq->mq_mess)); memcpy(&mq->mq_mess, m, sizeof(mq->mq_mess));
mq->mq_next = NULL; mq->mq_next = NULL;
if(!queue_head) { if(!queue_head) {

View file

@ -40,9 +40,6 @@ endpoint_t from; /* who sent this message? */
CPF_WRITE); CPF_WRITE);
if (gid == -1) if (gid == -1)
{ {
#if 0
report("LOG","cpf_grant_direct failed for TTY", errno);
#endif
return EDONTREPLY; return EDONTREPLY;
} }
@ -55,7 +52,7 @@ endpoint_t from; /* who sent this message? */
if (r == OK) r= mess.m_type; if (r == OK) r= mess.m_type;
if (r != OK) if (r != OK)
{ {
report("LOG","couldn't get copy of kmessages from TTY", r); printf("log: couldn't get copy of kmessages from TTY: %d\n", r);
return EDONTREPLY; return EDONTREPLY;
} }
} }
@ -63,7 +60,7 @@ endpoint_t from; /* who sent this message? */
{ {
/* Try to get a fresh copy of the buffer with kernel messages. */ /* Try to get a fresh copy of the buffer with kernel messages. */
if ((r=sys_getkmessages(&kmess)) != OK) { if ((r=sys_getkmessages(&kmess)) != OK) {
report("LOG","couldn't get copy of kmessages", r); printf("log: couldn't get copy of kmessages: %d\n", r);
return EDONTREPLY; return EDONTREPLY;
} }
prev_nextp= &kernel_prev_next; prev_nextp= &kernel_prev_next;

View file

@ -128,11 +128,11 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
sa.sa_handler = SIG_MESS; sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sa.sa_flags = 0; sa.sa_flags = 0;
if (sigaction(SIGTERM,&sa,NULL)<0) panic("MEM","sigaction failed", errno); if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno);
/* Initialize all minor devices one by one. */ /* Initialize all minor devices one by one. */
if (OK != (s=sys_getkinfo(&kinfo))) { if (OK != (s=sys_getkinfo(&kinfo))) {
panic("MEM","Couldn't get kernel information.",s); panic("Couldn't get kernel information: %d", s);
} }
#if 0 #if 0
@ -255,7 +255,7 @@ unsigned nr_req; /* length of request vector */
dev_vaddr + position, count, D); dev_vaddr + position, count, D);
} }
if(r != OK) { if(r != OK) {
panic("MEM","I/O copy failed",r); panic("I/O copy failed: %d", r);
} }
break; break;
@ -287,7 +287,7 @@ unsigned nr_req; /* length of request vector */
if(!any_mapped || pagestart_mapped != pagestart) { if(!any_mapped || pagestart_mapped != pagestart) {
if(any_mapped) { if(any_mapped) {
if(vm_unmap_phys(SELF, vaddr, I386_PAGE_SIZE) != OK) if(vm_unmap_phys(SELF, vaddr, I386_PAGE_SIZE) != OK)
panic("MEM","vm_unmap_phys failed",NO_NUM); panic("vm_unmap_phys failed");
any_mapped = 0; any_mapped = 0;
} }
vaddr = vm_map_phys(SELF, (void *) pagestart, I386_PAGE_SIZE); vaddr = vm_map_phys(SELF, (void *) pagestart, I386_PAGE_SIZE);
@ -331,7 +331,7 @@ unsigned nr_req; /* length of request vector */
s=sys_safecopyto(proc_nr, user_vir, s=sys_safecopyto(proc_nr, user_vir,
vir_offset+suboffset, (vir_bytes) dev_zero, chunk, D); vir_offset+suboffset, (vir_bytes) dev_zero, chunk, D);
if(s != OK) if(s != OK)
report("MEM","sys_safecopyto failed", s); printf("MEM: sys_safecopyto failed: %d\n", s);
left -= chunk; left -= chunk;
suboffset += chunk; suboffset += chunk;
} }
@ -372,7 +372,7 @@ message *m_ptr;
} }
if(m_device < 0 || m_device >= NR_DEVS) { if(m_device < 0 || m_device >= NR_DEVS) {
panic("MEM","wrong m_device",m_device); panic("wrong m_device: %d", m_device);
} }
openct[m_device]++; openct[m_device]++;
@ -392,11 +392,11 @@ message *m_ptr;
if (m_prepare(m_ptr->DEVICE) == NIL_DEV) return(ENXIO); if (m_prepare(m_ptr->DEVICE) == NIL_DEV) return(ENXIO);
if(m_device < 0 || m_device >= NR_DEVS) { if(m_device < 0 || m_device >= NR_DEVS) {
panic("MEM","wrong m_device",m_device); panic("wrong m_device: %d", m_device);
} }
if(openct[m_device] < 1) { if(openct[m_device] < 1) {
panic("MEM","closed too often",NO_NUM); panic("closed too often");
} }
openct[m_device]--; openct[m_device]--;
@ -449,7 +449,7 @@ message *m_ptr; /* pointer to control message */
if(m_vaddrs[dev]) { if(m_vaddrs[dev]) {
u32_t size; u32_t size;
if(ex64hi(dv->dv_size)) { if(ex64hi(dv->dv_size)) {
panic("MEM","huge old ramdisk", NO_NUM); panic("huge old ramdisk");
} }
size = ex64lo(dv->dv_size); size = ex64lo(dv->dv_size);
free((void *) m_vaddrs[dev]); free((void *) m_vaddrs[dev]);

View file

@ -248,7 +248,7 @@ int main(int argc, char *argv[]) {
while (TRUE) { while (TRUE) {
if ((r = sef_receive (ANY, &m)) != OK) if ((r = sef_receive (ANY, &m)) != OK)
panic(__FILE__, "orinoco: sef_receive failed", NO_NUM); panic("orinoco: sef_receive failed");
if (is_notify(m.m_type)) { if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) { switch (_ENDPOINT_P(m.m_source)) {
@ -275,8 +275,7 @@ int main(int argc, char *argv[]) {
break; break;
} }
default: default:
panic(__FILE__, panic("orinoco: illegal notify from: %d",
"orinoco: illegal notify from:",
m.m_source); m.m_source);
} }
@ -316,7 +315,7 @@ int main(int argc, char *argv[]) {
or_getname(&m); or_getname(&m);
break; break;
default: default:
panic(__FILE__,"orinoco: illegal message:", m.m_type); panic("orinoco: illegal message: %d", m.m_type);
} }
} }
} }
@ -406,7 +405,7 @@ static void or_getname(message *mp) {
r = send(mp->m_source, mp); r = send(mp->m_source, mp);
if(r != OK) { if(r != OK) {
panic(__FILE__, "or_getname: send failed", r); panic("or_getname: send failed: %d", r);
} }
} }
@ -465,7 +464,7 @@ static void or_reset() {
u16_t irqmask; u16_t irqmask;
if (OK != (r = getuptime(&now))) if (OK != (r = getuptime(&now)))
panic(__FILE__, "orinoco: getuptime() failed:", r); panic("orinoco: getuptime() failed: %d", r);
if(now - last_reset < system_hz * 10) { if(now - last_reset < system_hz * 10) {
printf("Resetting card too often. Going to reset driver\n"); printf("Resetting card too often. Going to reset driver\n");
@ -706,8 +705,7 @@ static int or_probe (t_or * orp) {
if (pcitab[i].did != did) if (pcitab[i].did != did)
continue; continue;
if (pcitab[i].checkclass) { if (pcitab[i].checkclass) {
panic(__FILE__, "or_probe:class check not implmnted", panic("or_probe:class check not implmnted");
NO_NUM);
} }
/* we have found the card in the pci bus */ /* we have found the card in the pci bus */
break; break;
@ -769,7 +767,7 @@ static void map_hw_buffer(t_or *orp) {
buf = (char *)malloc(size); buf = (char *)malloc(size);
if(buf == NULL) if(buf == NULL)
panic(__FILE__, "map_hw_buffer: cannot malloc size:", size); panic("map_hw_buffer: cannot malloc size: %d", size);
/* Let the mapped memory by I386_PAGE_SIZE aligned */ /* Let the mapped memory by I386_PAGE_SIZE aligned */
o = I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE); o = I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE);
@ -783,7 +781,7 @@ static void map_hw_buffer(t_or *orp) {
#endif #endif
if(r!=OK) if(r!=OK)
panic(__FILE__, "map_hw_buffer: sys_vm_map failed:", r); panic("map_hw_buffer: sys_vm_map failed: %d", r);
hw->locmem = abuf; hw->locmem = abuf;
@ -814,8 +812,7 @@ static u32_t or_get_bar (int devind, t_or * orp) {
bar = pci_attr_r32 (devind, PCI_BAR) & 0xffffffe0; bar = pci_attr_r32 (devind, PCI_BAR) & 0xffffffe0;
if ((bar & 0x3ff) >= 0x100 - 32 || bar < 0x400) if ((bar & 0x3ff) >= 0x100 - 32 || bar < 0x400)
panic(__FILE__,"base address isn't properly configured", panic("base address isn't properly configured");
NO_NUM);
/* In I/O space registers are 2 bytes wide, without any spacing /* In I/O space registers are 2 bytes wide, without any spacing
* in between */ * in between */
@ -827,7 +824,7 @@ static u32_t or_get_bar (int devind, t_or * orp) {
orp->or_name, bar, orp->or_irq); orp->or_name, bar, orp->or_irq);
} }
panic(__FILE__, "Not implemente yet", NO_NUM); panic("Not implemente yet");
/* Although we are able to find the desired bar and irq for an /* Although we are able to find the desired bar and irq for an
* I/O spaced card, we haven't implemented the right register * I/O spaced card, we haven't implemented the right register
* accessing functions. This wouldn't be difficult, but we were * accessing functions. This wouldn't be difficult, but we were
@ -1347,7 +1344,7 @@ static void or_watchdog_f(timer_t *tp) {
static void mess_reply (message * req, message * reply_mess) { static void mess_reply (message * req, message * reply_mess) {
if (send (req->m_source, reply_mess) != 0) if (send (req->m_source, reply_mess) != 0)
panic(__FILE__, "orinoco: unable to mess_reply", NO_NUM); panic("orinoco: unable to mess_reply");
} }
@ -1379,7 +1376,7 @@ static void or_writev (message * mp, int from_int, int vectored) {
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= OR_PORT_NR) if (port < 0 || port >= OR_PORT_NR)
panic(__FILE__, "orinoco: illegal port", NO_NUM); panic("orinoco: illegal port");
or_client = mp->DL_PROC; or_client = mp->DL_PROC;
orp = &or_table[port]; orp = &or_table[port];
@ -1555,7 +1552,7 @@ static void or_writev_s (message * mp, int from_int) {
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= OR_PORT_NR) if (port < 0 || port >= OR_PORT_NR)
panic(__FILE__, "orinoco: illegal port", NO_NUM); panic("orinoco: illegal port");
or_client = mp->DL_PROC; or_client = mp->DL_PROC;
orp = &or_table[port]; orp = &or_table[port];
@ -1745,7 +1742,7 @@ static void reply (t_or * orp, int err, int may_block) {
reply.DL_COUNT = orp->or_read_s; reply.DL_COUNT = orp->or_read_s;
if (OK != (r = getuptime(&now))) if (OK != (r = getuptime(&now)))
panic(__FILE__, "orinoco: getuptime() failed:", r); panic("orinoco: getuptime() failed: %d", r);
reply.DL_CLCK = now; reply.DL_CLCK = now;
r = send (orp->or_client, &reply); r = send (orp->or_client, &reply);
@ -1755,7 +1752,7 @@ static void reply (t_or * orp, int err, int may_block) {
} }
if (r < 0) if (r < 0)
panic(__FILE__, "orinoco: send failed:", r); panic("orinoco: send failed: %d", r);
orp->or_read_s = 0; orp->or_read_s = 0;
orp->or_flags &= ~(OR_F_PACK_SENT | OR_F_PACK_RECV); orp->or_flags &= ~(OR_F_PACK_SENT | OR_F_PACK_RECV);
@ -1995,7 +1992,7 @@ static void or_readv (message * mp, int from_int, int vectored) {
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= OR_PORT_NR) if (dl_port < 0 || dl_port >= OR_PORT_NR)
panic(__FILE__, "orinoco: illegal port:", dl_port); panic("orinoco: illegal port: %d", dl_port);
orp = &or_table[dl_port]; orp = &or_table[dl_port];
or_client = mp->DL_PROC; or_client = mp->DL_PROC;
@ -2116,7 +2113,7 @@ static void or_readv_s (message * mp, int from_int) {
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= OR_PORT_NR) if (dl_port < 0 || dl_port >= OR_PORT_NR)
panic(__FILE__, "orinoco: illegal port:", dl_port); panic("orinoco: illegal port: %d", dl_port);
orp = &or_table[dl_port]; orp = &or_table[dl_port];
or_client = mp->DL_PROC; or_client = mp->DL_PROC;
@ -2162,8 +2159,7 @@ static void or_readv_s (message * mp, int from_int) {
(vir_bytes)orp->or_iovec_s, (vir_bytes)orp->or_iovec_s,
n * sizeof(orp->or_iovec_s[0]), D); n * sizeof(orp->or_iovec_s[0]), D);
if (cps != OK) if (cps != OK)
panic(__FILE__, panic("orinoco: warning: sys_safecopytp failed: %d", cps);
"orinoco: warning, sys_safecopytp failed:", cps);
for (j = 0, iovp = orp->or_iovec_s; j < n; j++, iovp++) { for (j = 0, iovp = orp->or_iovec_s; j < n; j++, iovp++) {
s = iovp->iov_size; s = iovp->iov_size;
@ -2174,9 +2170,7 @@ static void or_readv_s (message * mp, int from_int) {
cps = sys_safecopyto(or_client, iovp->iov_grant, 0, cps = sys_safecopyto(or_client, iovp->iov_grant, 0,
(vir_bytes) databuf + o, s, D); (vir_bytes) databuf + o, s, D);
if (cps != OK) if (cps != OK)
panic(__FILE__, panic("orinoco: warning: sys_safecopy failed: %d", cps);
"orinoco: warning, sys_safecopy failed:",
cps);
size += s; size += s;
if (size == length) if (size == length)
@ -2336,7 +2330,7 @@ static void or_getstat (message * mp) {
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= OR_PORT_NR) if (port < 0 || port >= OR_PORT_NR)
panic(__FILE__, "orinoco: illegal port:", port); panic("orinoco: illegal port: %d", port);
orp = &or_table[port]; orp = &or_table[port];
orp->or_client = mp->DL_PROC; orp->or_client = mp->DL_PROC;
@ -2348,7 +2342,7 @@ static void or_getstat (message * mp) {
r = sys_datacopy(SELF, (vir_bytes)&stats, mp->DL_PROC, r = sys_datacopy(SELF, (vir_bytes)&stats, mp->DL_PROC,
(vir_bytes) mp->DL_ADDR, sizeof(stats)); (vir_bytes) mp->DL_ADDR, sizeof(stats));
if(r != OK) { if(r != OK) {
panic(__FILE__, "or_getstat: send failed:", r); panic("or_getstat: send failed: %d", r);
} }
mp->m_type = DL_STAT_REPLY; mp->m_type = DL_STAT_REPLY;
@ -2357,7 +2351,7 @@ static void or_getstat (message * mp) {
r = send(mp->m_source, mp); r = send(mp->m_source, mp);
if(r != OK) if(r != OK)
panic(__FILE__, "orinoco: getstat failed:", r); panic("orinoco: getstat failed: %d", r);
/*reply (orp, OK, FALSE);*/ /*reply (orp, OK, FALSE);*/
@ -2376,7 +2370,7 @@ static void or_getstat_s (message * mp) {
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= OR_PORT_NR) if (port < 0 || port >= OR_PORT_NR)
panic(__FILE__, "orinoco: illegal port:", port); panic("orinoco: illegal port: %d", port);
assert(port==0); assert(port==0);
orp = &or_table[port]; orp = &or_table[port];
orp->or_client = mp->DL_PROC; orp->or_client = mp->DL_PROC;
@ -2389,7 +2383,7 @@ static void or_getstat_s (message * mp) {
r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D); (vir_bytes) &stats, sizeof(stats), D);
if(r != OK) { if(r != OK) {
panic(__FILE__, "or_getstat_s: sys_safecopyto failed:", r); panic("or_getstat_s: sys_safecopyto failed: %d", r);
} }
mp->m_type = DL_STAT_REPLY; mp->m_type = DL_STAT_REPLY;
@ -2398,6 +2392,6 @@ static void or_getstat_s (message * mp) {
r = send(mp->m_source, mp); r = send(mp->m_source, mp);
if(r != OK) if(r != OK)
panic(__FILE__, "orinoco: getstat_s failed:", r); panic("orinoco: getstat_s failed: %d", r);
} }

View file

@ -173,12 +173,12 @@ PUBLIC int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Map all the services in the boot image. */ /* Map all the services in the boot image. */
if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0, if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) { (vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {
panic("pci", "sys_safecopyfrom failed", r); panic("sys_safecopyfrom failed: %d", r);
} }
for(i=0;i < NR_BOOT_PROCS;i++) { for(i=0;i < NR_BOOT_PROCS;i++) {
if(rprocpub[i].in_use) { if(rprocpub[i].in_use) {
if((r = map_service(&rprocpub[i])) != OK) { if((r = map_service(&rprocpub[i])) != OK) {
panic("pci", "unable to map service", r); panic("unable to map service: %d", r);
} }
} }
} }
@ -696,7 +696,7 @@ PRIVATE void pci_intel_init()
#endif #endif
if (nr_pcibus >= NR_PCIBUS) if (nr_pcibus >= NR_PCIBUS)
panic("PCI","too many PCI busses", nr_pcibus); panic("too many PCI busses: %d", nr_pcibus);
busind= nr_pcibus; busind= nr_pcibus;
nr_pcibus++; nr_pcibus++;
pcibus[busind].pb_type= PBT_INTEL_HOST; pcibus[busind].pb_type= PBT_INTEL_HOST;
@ -766,7 +766,7 @@ PRIVATE void probe_bus(int busind)
printf("probe_bus(%d)\n", busind); printf("probe_bus(%d)\n", busind);
#endif #endif
if (nr_pcidev >= NR_PCIDEV) if (nr_pcidev >= NR_PCIDEV)
panic("PCI","too many PCI devices", nr_pcidev); panic("too many PCI devices: %d", nr_pcidev);
devind= nr_pcidev; devind= nr_pcidev;
busnr= pcibus[busind].pb_busnr; busnr= pcibus[busind].pb_busnr;
@ -894,7 +894,7 @@ printf("probe_bus(%d)\n", busind);
#endif #endif
if (nr_pcidev >= NR_PCIDEV) if (nr_pcidev >= NR_PCIDEV)
panic("PCI","too many PCI devices", nr_pcidev); panic("too many PCI devices: %d", nr_pcidev);
devind= nr_pcidev; devind= nr_pcidev;
if (func == 0 && !(headt & PHT_MULTIFUNC)) if (func == 0 && !(headt & PHT_MULTIFUNC))
@ -1373,7 +1373,7 @@ PRIVATE void complete_bars(void)
r= env_get_param("memory", memstr, sizeof(memstr)); r= env_get_param("memory", memstr, sizeof(memstr));
if (r != OK) if (r != OK)
panic("pci", "env_get_param failed", r); panic("env_get_param failed: %d", r);
/* Set memgap_low to just above physical memory */ /* Set memgap_low to just above physical memory */
memgap_low= 0; memgap_low= 0;
@ -1444,7 +1444,7 @@ PRIVATE void complete_bars(void)
{ {
printf("PCI: bad memory gap: [0x%x .. 0x%x>\n", printf("PCI: bad memory gap: [0x%x .. 0x%x>\n",
memgap_low, memgap_high); memgap_low, memgap_high);
panic(NULL, NULL, NO_NUM); panic(NULL);
} }
iogap_high= 0x10000; iogap_high= 0x10000;
@ -1488,7 +1488,7 @@ PRIVATE void complete_bars(void)
printf("iogap_high too low, should panic\n"); printf("iogap_high too low, should panic\n");
} }
else else
panic("pci", "iogap_high too low", iogap_high); panic("iogap_high too low: %d", iogap_high);
} }
if (debug) if (debug)
printf("I/O range = [0x%x..0x%x>\n", iogap_low, iogap_high); printf("I/O range = [0x%x..0x%x>\n", iogap_low, iogap_high);
@ -1507,7 +1507,7 @@ PRIVATE void complete_bars(void)
base= memgap_high-size; base= memgap_high-size;
base &= ~(u32_t)(size-1); base &= ~(u32_t)(size-1);
if (base < memgap_low) if (base < memgap_low)
panic("pci", "memory base too low", base); panic("memory base too low: %d", base);
memgap_high= base; memgap_high= base;
bar_nr= pcidev[i].pd_bar[j].pb_nr; bar_nr= pcidev[i].pd_bar[j].pb_nr;
reg= PCI_BAR + 4*bar_nr; reg= PCI_BAR + 4*bar_nr;
@ -1542,7 +1542,7 @@ PRIVATE void complete_bars(void)
base &= 0xfcff; base &= 0xfcff;
if (base < iogap_low) if (base < iogap_low)
panic("pci", "I/O base too low", base); panic("I/O base too low: %d", base);
iogap_high= base; iogap_high= base;
bar_nr= pcidev[i].pd_bar[j].pb_nr; bar_nr= pcidev[i].pd_bar[j].pb_nr;
@ -1581,7 +1581,7 @@ PRIVATE void complete_bars(void)
bad_mem_string: bad_mem_string:
printf("PCI: bad memory environment string '%s'\n", memstr); printf("PCI: bad memory environment string '%s'\n", memstr);
panic(NULL, NULL, NO_NUM); panic(NULL);
} }
/*===========================================================================* /*===========================================================================*
@ -1607,7 +1607,7 @@ u32_t io_size;
return; return;
} }
if (type != PBT_CARDBUS) if (type != PBT_CARDBUS)
panic("pci", "update_bridge4dev_io: strange bus type", type); panic("update_bridge4dev_io: strange bus type: %d", type);
if (debug) if (debug)
{ {
@ -1727,7 +1727,7 @@ int busind;
r= do_sis_isabr(bridge_dev); r= do_sis_isabr(bridge_dev);
break; break;
default: default:
panic("PCI","unknown ISA bridge type", type); panic("unknown ISA bridge type: %d", type);
} }
return r; return r;
} }
@ -1847,7 +1847,7 @@ int busind;
sbusn= pci_attr_r8_u(devind, PPB_SECBN); sbusn= pci_attr_r8_u(devind, PPB_SECBN);
if (nr_pcibus >= NR_PCIBUS) if (nr_pcibus >= NR_PCIBUS)
panic("PCI","too many PCI busses", nr_pcibus); panic("too many PCI busses: %d", nr_pcibus);
ind= nr_pcibus; ind= nr_pcibus;
nr_pcibus++; nr_pcibus++;
pcibus[ind].pb_type= PBT_PCIBRIDGE; pcibus[ind].pb_type= PBT_PCIBRIDGE;
@ -1878,7 +1878,7 @@ int busind;
pcibus[ind].pb_wsts= pcibr_via_wsts; pcibus[ind].pb_wsts= pcibr_via_wsts;
break; break;
default: default:
panic("PCI","unknown PCI-PCI bridge type", type); panic("unknown PCI-PCI bridge type: %d", type);
} }
if (debug) if (debug)
{ {
@ -1913,7 +1913,7 @@ int busnr;
if (pcibus[i].pb_busnr == busnr) if (pcibus[i].pb_busnr == busnr)
return i; return i;
} }
panic("pci", "get_busind: can't find bus", busnr); panic("get_busind: can't find bus: %d", busnr);
} }
/*===========================================================================* /*===========================================================================*
@ -1981,7 +1981,7 @@ PRIVATE int do_amd_isabr(int devind)
/* Fake a device with the required function */ /* Fake a device with the required function */
if (nr_pcidev >= NR_PCIDEV) if (nr_pcidev >= NR_PCIDEV)
panic("PCI","too many PCI devices", nr_pcidev); panic("too many PCI devices: %d", nr_pcidev);
xdevind= nr_pcidev; xdevind= nr_pcidev;
pcidev[xdevind].pd_busnr= busnr; pcidev[xdevind].pd_busnr= busnr;
pcidev[xdevind].pd_dev= dev; pcidev[xdevind].pd_dev= dev;

View file

@ -197,7 +197,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
sa.sa_handler = SIG_MESS; sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sa.sa_flags = 0; sa.sa_flags = 0;
if (sigaction(SIGTERM,&sa,NULL)<0) panic("PRN","sigaction failed", errno); if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno);
return(OK); return(OK);
} }
@ -258,7 +258,7 @@ int safe; /* use virtual addresses or grant id's? */
while (--retries > 0) { while (--retries > 0) {
if(sys_inb(port_base + 1, &status) != OK) { if(sys_inb(port_base + 1, &status) != OK) {
printf("printer: sys_inb of %x failed\n", port_base+1); printf("printer: sys_inb of %x failed\n", port_base+1);
panic(__FILE__,"sys_inb failed", NO_NUM); panic("sys_inb failed");
} }
if ((status & ON_LINE)) { /* printer online! */ if ((status & ON_LINE)) { /* printer online! */
prepare_output(); prepare_output();
@ -387,21 +387,21 @@ PRIVATE void do_initialize()
/* Get the base port for first printer. */ /* Get the base port for first printer. */
if(sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR, if(sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR,
SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE) != OK) { SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE) != OK) {
panic(__FILE__, "do_initialize: sys_vircopy failed", NO_NUM); panic("do_initialize: sys_vircopy failed");
} }
if(sys_outb(port_base + 2, INIT_PRINTER) != OK) { if(sys_outb(port_base + 2, INIT_PRINTER) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2); printf("printer: sys_outb of %x failed\n", port_base+2);
panic(__FILE__, "do_initialize: sys_outb init failed", NO_NUM); panic("do_initialize: sys_outb init failed");
} }
micro_delay(1000000/20); /* easily satisfies Centronics minimum */ micro_delay(1000000/20); /* easily satisfies Centronics minimum */
if(sys_outb(port_base + 2, PR_SELECT) != OK) { if(sys_outb(port_base + 2, PR_SELECT) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2); printf("printer: sys_outb of %x failed\n", port_base+2);
panic(__FILE__, "do_initialize: sys_outb select failed", NO_NUM); panic("do_initialize: sys_outb select failed");
} }
irq_hook_id = 0; irq_hook_id = 0;
if(sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id) != OK || if(sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id) != OK ||
sys_irqenable(&irq_hook_id) != OK) { sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__, "do_initialize: irq enabling failed", NO_NUM); panic("do_initialize: irq enabling failed");
} }
} }
@ -453,10 +453,10 @@ PRIVATE void do_printer_output()
*/ */
if(sys_outb(port_base + 2, PR_SELECT) != OK) { if(sys_outb(port_base + 2, PR_SELECT) != OK) {
printf("printer: sys_outb of %x failed\n", port_base+2); printf("printer: sys_outb of %x failed\n", port_base+2);
panic(__FILE__,"sys_outb failed", NO_NUM); panic("sys_outb failed");
} }
if(sys_irqenable(&irq_hook_id) != OK) { if(sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__,"sys_irqenable failed", NO_NUM); panic("sys_irqenable failed");
} }
return; return;
} }
@ -467,7 +467,7 @@ PRIVATE void do_printer_output()
*/ */
if(sys_inb(port_base + 1, &status) != OK) { if(sys_inb(port_base + 1, &status) != OK) {
printf("printer: sys_inb of %x failed\n", port_base+1); printf("printer: sys_inb of %x failed\n", port_base+1);
panic(__FILE__,"sys_inb failed", NO_NUM); panic("sys_inb failed");
} }
if ((status & STATUS_MASK) == BUSY_STATUS) { if ((status & STATUS_MASK) == BUSY_STATUS) {
/* Still busy with last output. This normally happens /* Still busy with last output. This normally happens
@ -477,7 +477,7 @@ PRIVATE void do_printer_output()
* interrupts. It may happen after a spurious interrupt. * interrupts. It may happen after a spurious interrupt.
*/ */
if(sys_irqenable(&irq_hook_id) != OK) { if(sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__, "sys_irqenable failed\n", NO_NUM); panic("sys_irqenable failed");
} }
return; return;
} }
@ -489,7 +489,7 @@ PRIVATE void do_printer_output()
pv_set(char_out[2], port_base+2, NEGATE_STROBE); pv_set(char_out[2], port_base+2, NEGATE_STROBE);
if(sys_voutb(char_out, 3) != OK) { if(sys_voutb(char_out, 3) != OK) {
/* request series of port outb */ /* request series of port outb */
panic(__FILE__, "sys_voutb failed\n", NO_NUM); panic("sys_voutb failed");
} }
user_vir_d++; user_vir_d++;
@ -499,7 +499,7 @@ PRIVATE void do_printer_output()
done_status = status; done_status = status;
output_done(); output_done();
if(sys_irqenable(&irq_hook_id) != OK) { if(sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__, "sys_irqenable failed\n", NO_NUM); panic("sys_irqenable failed");
} }
return; return;
} }
@ -510,7 +510,7 @@ PRIVATE void do_printer_output()
done_status = OK; done_status = OK;
output_done(); output_done();
if(sys_irqenable(&irq_hook_id) != OK) { if(sys_irqenable(&irq_hook_id) != OK) {
panic(__FILE__, "sys_irqenable failed\n", NO_NUM); panic("sys_irqenable failed");
} }
} }

View file

@ -102,7 +102,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Retrieve first randomness buffer with parameters. */ /* Retrieve first randomness buffer with parameters. */
if (OK != (s=sys_getrandomness(&krandom))) { if (OK != (s=sys_getrandomness(&krandom))) {
report("RANDOM", "sys_getrandomness failed", s); printf("RANDOM: sys_getrandomness failed: %d\n", s);
exit(1); exit(1);
} }
@ -317,7 +317,7 @@ message *m_ptr; /* pointer to alarm message */
/* Schedule new alarm for next m_random call. */ /* Schedule new alarm for next m_random call. */
if (OK != (s=sys_setalarm(KRANDOM_PERIOD, 0))) if (OK != (s=sys_setalarm(KRANDOM_PERIOD, 0)))
report("RANDOM", "sys_setalarm failed", s); printf("RANDOM: sys_setalarm failed: %d\n", s);
} }
/*============================================================================* /*============================================================================*

View file

@ -73,7 +73,7 @@ int count;
printf("random_update: got %d samples for source %d\n", count, source); printf("random_update: got %d samples for source %d\n", count, source);
#endif #endif
if (source < 0 || source >= TOTAL_SOURCES) if (source < 0 || source >= TOTAL_SOURCES)
panic("memory", "random_update: bad source", source); panic("random_update: bad source: %d", source);
for (i= 0; i<count; i++) for (i= 0; i<count; i++)
add_sample(source, buf[i]); add_sample(source, buf[i]);
reseed(); reseed();

View file

@ -215,7 +215,7 @@ int main(int argc, char *argv[])
while (TRUE) while (TRUE)
{ {
if ((r= sef_receive(ANY, &m)) != OK) if ((r= sef_receive(ANY, &m)) != OK)
panic("rtl8139","sef_receive failed", r); panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) { if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) { switch (_ENDPOINT_P(m.m_source)) {
@ -255,8 +255,8 @@ int main(int argc, char *argv[])
break; break;
} }
default: default:
panic("rtl8139","illegal notify from", panic("illegal notify from: %d",
m.m_source); m.m_source);
} }
/* done, get nwe message */ /* done, get nwe message */
@ -279,7 +279,7 @@ int main(int argc, char *argv[])
case DL_STOP: do_stop(&m); break; case DL_STOP: do_stop(&m); break;
#endif #endif
default: default:
panic("rtl8139","illegal message", m.m_type); panic("illegal message: %d", m.m_type);
} }
} }
} }
@ -610,10 +610,8 @@ re_t *rep;
continue; continue;
if (pcitab[i].did != did) if (pcitab[i].did != did)
continue; continue;
if (pcitab[i].checkclass) if (pcitab[i].checkclass) {
{ panic("class check not implemented");
panic("rtl_probe",
"class check not implemented", NO_NUM);
} }
break; break;
} }
@ -645,10 +643,8 @@ re_t *rep;
pci_reserve(devind); pci_reserve(devind);
/* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */ /* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */
bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0; bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
if (bar < 0x400) if (bar < 0x400) {
{ panic("base address is not properly configured");
panic("rtl_probe",
"base address is not properly configured", NO_NUM);
} }
rep->re_base_port= bar; rep->re_base_port= bar;
@ -720,7 +716,7 @@ re_t *rep;
#define BUF_ALIGNMENT (64*1024) #define BUF_ALIGNMENT (64*1024)
if(!(mallocbuf = alloc_contig(BUF_ALIGNMENT + tot_bufsize, 0, &buf))) { if(!(mallocbuf = alloc_contig(BUF_ALIGNMENT + tot_bufsize, 0, &buf))) {
panic("RTL8139","Couldn't allocate kernel buffer",NO_NUM); panic("Couldn't allocate kernel buffer");
} }
/* click-align mallocced buffer. this is what we used to get /* click-align mallocced buffer. this is what we used to get
@ -816,7 +812,7 @@ re_t *rep;
break; break;
} while (getuptime(&t1)==OK && (t1-t0) < system_hz); } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
if (rl_inb(port, RL_BMCR) & MII_CTRL_RST) if (rl_inb(port, RL_BMCR) & MII_CTRL_RST)
panic("rtl8139","reset PHY failed to complete", NO_NUM); panic("reset PHY failed to complete");
#endif #endif
/* Reset the device */ /* Reset the device */
@ -995,7 +991,7 @@ static void rl_readv(message *mp, int from_int, int vectored)
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= RE_PORT_NR) if (dl_port < 0 || dl_port >= RE_PORT_NR)
panic("rtl8139"," illegal port", dl_port); panic(" illegal port: %d", dl_port);
rep= &re_table[dl_port]; rep= &re_table[dl_port];
re_client= mp->DL_PROC; re_client= mp->DL_PROC;
rep->re_client= re_client; rep->re_client= re_client;
@ -1048,7 +1044,7 @@ static void rl_readv(message *mp, int from_int, int vectored)
printf("rxstat = 0x%08lx\n", rxstat); printf("rxstat = 0x%08lx\n", rxstat);
printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n", printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n",
d_start, d_end, rxstat); d_start, d_end, rxstat);
panic("rtl8139","received packet not OK", NO_NUM); panic("received packet not OK");
} }
totlen= (rxstat >> RL_RXS_LEN_S); totlen= (rxstat >> RL_RXS_LEN_S);
if (totlen < 8 || totlen > 2*ETH_MAX_PACK_SIZE) if (totlen < 8 || totlen > 2*ETH_MAX_PACK_SIZE)
@ -1060,7 +1056,7 @@ static void rl_readv(message *mp, int from_int, int vectored)
printf( printf(
"d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n", "d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n",
d_start, d_end, totlen, rxstat); d_start, d_end, totlen, rxstat);
panic(NULL, NULL, NO_NUM); panic(NULL);
} }
#if 0 #if 0
@ -1167,9 +1163,9 @@ static void rl_readv(message *mp, int from_int, int vectored)
#if 0 #if 0
size= mp->DL_COUNT; size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
panic("rtl8139","invalid packet size", size); panic("invalid packet size: %d", size);
if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR, size, &phys_user)) if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR, size, &phys_user))
panic("rtl8139","umap_local failed", NO_NUM); panic("umap_local failed");
p= rep->re_tx[tx_head].ret_buf; p= rep->re_tx[tx_head].ret_buf;
cps = sys_abscopy(phys_user, p, size); cps = sys_abscopy(phys_user, p, size);
@ -1243,7 +1239,7 @@ static void rl_readv_s(message *mp, int from_int)
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= RE_PORT_NR) if (dl_port < 0 || dl_port >= RE_PORT_NR)
panic("rtl8139"," illegal port", dl_port); panic(" illegal port: %d", dl_port);
rep= &re_table[dl_port]; rep= &re_table[dl_port];
re_client= mp->DL_PROC; re_client= mp->DL_PROC;
rep->re_client= re_client; rep->re_client= re_client;
@ -1296,7 +1292,7 @@ static void rl_readv_s(message *mp, int from_int)
printf("rxstat = 0x%08lx\n", rxstat); printf("rxstat = 0x%08lx\n", rxstat);
printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n", printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n",
d_start, d_end, rxstat); d_start, d_end, rxstat);
panic("rtl8139","received packet not OK", NO_NUM); panic("received packet not OK");
} }
totlen= (rxstat >> RL_RXS_LEN_S); totlen= (rxstat >> RL_RXS_LEN_S);
if (totlen < 8 || totlen > 2*ETH_MAX_PACK_SIZE) if (totlen < 8 || totlen > 2*ETH_MAX_PACK_SIZE)
@ -1308,7 +1304,7 @@ static void rl_readv_s(message *mp, int from_int)
printf( printf(
"d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n", "d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n",
d_start, d_end, totlen, rxstat); d_start, d_end, totlen, rxstat);
panic(NULL, NULL, NO_NUM); panic(NULL);
} }
#if 0 #if 0
@ -1337,9 +1333,8 @@ static void rl_readv_s(message *mp, int from_int)
cps = sys_safecopyfrom(re_client, mp->DL_GRANT, iov_offset, cps = sys_safecopyfrom(re_client, mp->DL_GRANT, iov_offset,
(vir_bytes) rep->re_iovec_s, (vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D); n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) if (cps != OK) {
{ panic("rl_readv_s: sys_safecopyfrom failed: %d",
panic(__FILE__, "rl_readv_s: sys_safecopyfrom failed",
cps); cps);
} }
@ -1354,7 +1349,7 @@ static void rl_readv_s(message *mp, int from_int)
#if 0 #if 0
if (sys_umap(re_client, D, iovp->iov_addr, s, &dst_phys) != OK) if (sys_umap(re_client, D, iovp->iov_addr, s, &dst_phys) != OK)
panic("rtl8139","umap_local failed\n", NO_NUM); panic("umap_local failed");
#endif #endif
if (o >= RX_BUFSIZE) if (o >= RX_BUFSIZE)
@ -1371,20 +1366,15 @@ static void rl_readv_s(message *mp, int from_int)
cps = sys_safecopyto(re_client, cps = sys_safecopyto(re_client,
iovp->iov_grant, 0, iovp->iov_grant, 0,
(vir_bytes) rep->v_re_rx_buf+o, s1, D); (vir_bytes) rep->v_re_rx_buf+o, s1, D);
if (cps != OK) if (cps != OK) {
{ panic("rl_readv_s: sys_safecopyto failed: %d",
panic(__FILE__, cps);
"rl_readv_s: sys_safecopyto failed",
cps);
} }
cps = sys_safecopyto(re_client, cps = sys_safecopyto(re_client,
iovp->iov_grant, s1, iovp->iov_grant, s1,
(vir_bytes) rep->v_re_rx_buf, s-s1, S); (vir_bytes) rep->v_re_rx_buf, s-s1, S);
if (cps != OK) if (cps != OK) {
{ panic("rl_readv_s: sys_safecopyto failed: %d", cps);
panic(__FILE__,
"rl_readv_s: sys_safecopyto failed",
cps);
} }
} }
else else
@ -1393,9 +1383,7 @@ static void rl_readv_s(message *mp, int from_int)
iovp->iov_grant, 0, iovp->iov_grant, 0,
(vir_bytes) rep->v_re_rx_buf+o, s, D); (vir_bytes) rep->v_re_rx_buf+o, s, D);
if (cps != OK) if (cps != OK)
panic(__FILE__, panic("rl_readv_s: sys_safecopyto failed: %d", cps);
"rl_readv_s: sys_safecopyto failed",
cps);
} }
size += s; size += s;
@ -1474,7 +1462,7 @@ static void rl_writev(message *mp, int from_int, int vectored)
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= RE_PORT_NR) if (port < 0 || port >= RE_PORT_NR)
panic("rtl8139","illegal port", port); panic("illegal port: %d", port);
rep= &re_table[port]; rep= &re_table[port];
re_client= mp->DL_PROC; re_client= mp->DL_PROC;
rep->re_client= re_client; rep->re_client= re_client;
@ -1532,14 +1520,12 @@ if (cps != OK) printf("RTL8139: warning, sys_vircopy failed: %d\n", cps);
for (j= 0, iovp= rep->re_iovec; j<n; j++, iovp++) for (j= 0, iovp= rep->re_iovec; j<n; j++, iovp++)
{ {
s= iovp->iov_size; s= iovp->iov_size;
if (size + s > ETH_MAX_PACK_SIZE_TAGGED) if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
{ panic("invalid packet size");
panic("rtl8139","invalid packet size",
NO_NUM);
} }
if (OK != sys_umap(re_client, D, iovp->iov_addr, s, &phys_user)) if (OK != sys_umap(re_client, D, iovp->iov_addr, s, &phys_user))
panic("rtl8139","umap_local failed\n", NO_NUM); panic("umap_local failed");
cps = sys_vircopy(re_client, D, iovp->iov_addr, cps = sys_vircopy(re_client, D, iovp->iov_addr,
SELF, D, (vir_bytes) ret, s); SELF, D, (vir_bytes) ret, s);
@ -1549,13 +1535,13 @@ if (cps != OK) printf("RTL8139: warning, sys_vircopy failed: %d\n", cps);
} }
} }
if (size < ETH_MIN_PACK_SIZE) if (size < ETH_MIN_PACK_SIZE)
panic("rtl8139","invalid packet size", size); panic("invalid packet size: %d", size);
} }
else else
{ {
size= mp->DL_COUNT; size= mp->DL_COUNT;
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
panic("rtl8139","invalid packet size", size); panic("invalid packet size: %d", size);
ret = rep->re_tx[tx_head].v_ret_buf; ret = rep->re_tx[tx_head].v_ret_buf;
cps = sys_vircopy(re_client, D, (vir_bytes)mp->DL_ADDR, cps = sys_vircopy(re_client, D, (vir_bytes)mp->DL_ADDR,
SELF, D, (vir_bytes) ret, size); SELF, D, (vir_bytes) ret, size);
@ -1595,7 +1581,7 @@ suspend:
#endif #endif
if (from_int) if (from_int)
panic("rtl8139","should not be sending\n", NO_NUM); panic("should not be sending");
rep->re_tx_mess= *mp; rep->re_tx_mess= *mp;
reply(rep, OK, FALSE); reply(rep, OK, FALSE);
@ -1617,7 +1603,7 @@ static void rl_writev_s(message *mp, int from_int)
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= RE_PORT_NR) if (port < 0 || port >= RE_PORT_NR)
panic("rtl8139","illegal port", port); panic("illegal port: %d", port);
rep= &re_table[port]; rep= &re_table[port];
re_client= mp->DL_PROC; re_client= mp->DL_PROC;
rep->re_client= re_client; rep->re_client= re_client;
@ -1666,34 +1652,27 @@ static void rl_writev_s(message *mp, int from_int)
cps = sys_safecopyfrom(re_client, mp->DL_GRANT, iov_offset, cps = sys_safecopyfrom(re_client, mp->DL_GRANT, iov_offset,
(vir_bytes) rep->re_iovec_s, (vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D); n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) if (cps != OK) {
{ panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
panic(__FILE__, "rl_writev_s: sys_safecopyfrom failed",
cps);
} }
for (j= 0, iovp= rep->re_iovec_s; j<n; j++, iovp++) for (j= 0, iovp= rep->re_iovec_s; j<n; j++, iovp++)
{ {
s= iovp->iov_size; s= iovp->iov_size;
if (size + s > ETH_MAX_PACK_SIZE_TAGGED) if (size + s > ETH_MAX_PACK_SIZE_TAGGED) {
{ panic("invalid packet size");
panic("rtl8139","invalid packet size",
NO_NUM);
} }
cps = sys_safecopyfrom(re_client, iovp->iov_grant, 0, cps = sys_safecopyfrom(re_client, iovp->iov_grant, 0,
(vir_bytes) ret, s, D); (vir_bytes) ret, s, D);
if (cps != OK) if (cps != OK) {
{ panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
panic(__FILE__,
"rl_writev_s: sys_safecopyfrom failed",
cps);
} }
size += s; size += s;
ret += s; ret += s;
} }
} }
if (size < ETH_MIN_PACK_SIZE) if (size < ETH_MIN_PACK_SIZE)
panic("rtl8139","invalid packet size", size); panic("invalid packet size: %d", size);
rl_outl(rep->re_base_port, RL_TSD0+tx_head*4, rl_outl(rep->re_base_port, RL_TSD0+tx_head*4,
rep->re_ertxth | size); rep->re_ertxth | size);
@ -1728,7 +1707,7 @@ suspend:
#endif #endif
if (from_int) if (from_int)
panic("rtl8139","should not be sending\n", NO_NUM); panic("should not be sending");
rep->re_tx_mess= *mp; rep->re_tx_mess= *mp;
reply(rep, OK, FALSE); reply(rep, OK, FALSE);
@ -2152,7 +2131,7 @@ re_t *rep;
break; break;
} while (getuptime(&t1)==OK && (t1-t0) < system_hz); } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
if (rl_inb(port, RL_CR) & RL_CR_RE) if (rl_inb(port, RL_CR) & RL_CR_RE)
panic("rtl8139","cannot disable receiver", NO_NUM); panic("cannot disable receiver");
#if 0 #if 0
printf("RBSTART = 0x%08x\n", rl_inl(port, RL_RBSTART)); printf("RBSTART = 0x%08x\n", rl_inl(port, RL_RBSTART));
@ -2200,7 +2179,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR) if (port < 0 || port >= RE_PORT_NR)
panic("rtl8139","illegal port", port); panic("illegal port: %d", port);
rep= &re_table[port]; rep= &re_table[port];
rep->re_client= mp->DL_PROC; rep->re_client= mp->DL_PROC;
@ -2212,14 +2191,14 @@ message *mp;
r = sys_datacopy(SELF, (vir_bytes) &stats, mp->DL_PROC, r = sys_datacopy(SELF, (vir_bytes) &stats, mp->DL_PROC,
(vir_bytes) mp->DL_ADDR, sizeof(stats)); (vir_bytes) mp->DL_ADDR, sizeof(stats));
if (r != OK) if (r != OK)
panic(__FILE__, "rl_getstat: sys_datacopy failed", r); panic("rl_getstat: sys_datacopy failed: %d", r);
mp->m_type= DL_STAT_REPLY; mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= port; mp->DL_PORT= port;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("RTL8139", "rl_getstat: send failed: %d\n", r); panic("rl_getstat: send failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -2234,7 +2213,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR) if (port < 0 || port >= RE_PORT_NR)
panic("rtl8139","illegal port", port); panic("illegal port: %d", port);
rep= &re_table[port]; rep= &re_table[port];
rep->re_client= mp->DL_PROC; rep->re_client= mp->DL_PROC;
@ -2246,14 +2225,14 @@ message *mp;
r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D); (vir_bytes) &stats, sizeof(stats), D);
if (r != OK) if (r != OK)
panic(__FILE__, "rl_getstat_s: sys_safecopyto failed", r); panic("rl_getstat_s: sys_safecopyto failed: %d", r);
mp->m_type= DL_STAT_REPLY; mp->m_type= DL_STAT_REPLY;
mp->DL_PORT= port; mp->DL_PORT= port;
mp->DL_STAT= OK; mp->DL_STAT= OK;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("RTL8139", "rl_getstat_s: send failed: %d\n", r); panic("rl_getstat_s: send failed: %d", r);
} }
@ -2270,7 +2249,7 @@ message *mp;
mp->m_type= DL_NAME_REPLY; mp->m_type= DL_NAME_REPLY;
r= send(mp->m_source, mp); r= send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("RTL8139", "rl_getname: send failed: %d\n", r); panic("rl_getname: send failed: %d", r);
} }
@ -2299,7 +2278,7 @@ int may_block;
reply.DL_STAT = status | ((u32_t) err << 16); reply.DL_STAT = status | ((u32_t) err << 16);
reply.DL_COUNT = rep->re_read_s; reply.DL_COUNT = rep->re_read_s;
if (OK != (r = getuptime(&now))) if (OK != (r = getuptime(&now)))
panic("rtl8139","getuptime() failed:", r); panic("getuptime() failed: %d", r);
reply.DL_CLCK = now; reply.DL_CLCK = now;
r= send(rep->re_client, &reply); r= send(rep->re_client, &reply);
@ -2314,7 +2293,7 @@ int may_block;
if (r < 0) { if (r < 0) {
printf("RTL8139 tried sending to %d, type %d\n", rep->re_client, reply.m_type); printf("RTL8139 tried sending to %d, type %d\n", rep->re_client, reply.m_type);
panic("rtl8139","send failed:", r); panic("send failed: %d", r);
} }
rep->re_read_s = 0; rep->re_read_s = 0;
@ -2329,7 +2308,7 @@ message *req;
message *reply_mess; message *reply_mess;
{ {
if (send(req->m_source, reply_mess) != OK) if (send(req->m_source, reply_mess) != OK)
panic("rtl8139","unable to mess_reply", NO_NUM); panic("unable to mess_reply");
} }
#if 0 #if 0
@ -2553,10 +2532,8 @@ re_t *rep;
if (!(rl_inb(port, RL_CR) & RL_CR_TE)) if (!(rl_inb(port, RL_CR) & RL_CR_TE))
break; break;
} while (getuptime(&t1)==OK && (t1-t0) < system_hz); } while (getuptime(&t1)==OK && (t1-t0) < system_hz);
if (rl_inb(port, RL_CR) & RL_CR_TE) if (rl_inb(port, RL_CR) & RL_CR_TE) {
{ panic("cannot disable transmitter");
panic("rtl8139","cannot disable transmitter",
NO_NUM);
} }
rl_outb(port, RL_CR, cr | RL_CR_TE); rl_outb(port, RL_CR, cr | RL_CR_TE);
@ -2963,7 +2940,7 @@ u16_t w;
break; break;
} while (getuptime(&t1) == OK && (t1 == t0)); } while (getuptime(&t1) == OK && (t1 == t0));
if (!(inb_reg3(dep, 1) & 1)) if (!(inb_reg3(dep, 1) & 1))
panic("set_ee_word","device remains busy", NO_NUM); panic("device remains busy");
} }
static void ee_wds(dep) static void ee_wds(dep)

View file

@ -296,7 +296,7 @@ int main(int argc, char *argv[])
while (TRUE) { while (TRUE) {
if ((r = sef_receive(ANY, &m)) != OK) if ((r = sef_receive(ANY, &m)) != OK)
panic("rtl8169", "sef_receive failed", r); panic("sef_receive failed: %d", r);
if (is_notify(m.m_type)) { if (is_notify(m.m_type)) {
switch (_ENDPOINT_P(m.m_source)) { switch (_ENDPOINT_P(m.m_source)) {
@ -333,8 +333,7 @@ int main(int argc, char *argv[])
break; break;
} }
default: default:
panic("rtl8169", "illegal notify from", panic("illegal notify from: %d", m.m_type);
m.m_type);
} }
/* done, get nwe message */ /* done, get nwe message */
@ -349,7 +348,7 @@ int main(int argc, char *argv[])
case DL_GETSTAT_S: rl_getstat_s(&m); break; case DL_GETSTAT_S: rl_getstat_s(&m); break;
case DL_GETNAME: rl_getname(&m); break; case DL_GETNAME: rl_getname(&m); break;
default: default:
panic("rtl8169", "illegal message", m.m_type); panic("illegal message: %d", m.m_type);
} }
} }
} }
@ -750,8 +749,7 @@ re_t *rep;
if (pcitab[i].did != did) if (pcitab[i].did != did)
continue; continue;
if (pcitab[i].checkclass) { if (pcitab[i].checkclass) {
panic("rtl_probe", panic("class check not implemented");
"class check not implemented", NO_NUM);
} }
break; break;
} }
@ -780,8 +778,7 @@ re_t *rep;
pci_reserve(devind); pci_reserve(devind);
bar = pci_attr_r32(devind, PCI_BAR) & 0xffffffe0; bar = pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
if (bar < 0x400) { if (bar < 0x400) {
panic("rtl_probe", panic("base address is not properly configured");
"base address is not properly configured", NO_NUM);
} }
rep->re_base_port = bar; rep->re_base_port = bar;
@ -855,7 +852,7 @@ re_t *rep;
tot_bufsize += 4096 - (tot_bufsize % 4096); tot_bufsize += 4096 - (tot_bufsize % 4096);
if (!(mallocbuf = alloc_contig(tot_bufsize, AC_ALIGN64K, &buf))) if (!(mallocbuf = alloc_contig(tot_bufsize, AC_ALIGN64K, &buf)))
panic("RTL8169", "Couldn't allocate kernel buffer", NO_NUM); panic("Couldn't allocate kernel buffer");
/* Rx Descriptor */ /* Rx Descriptor */
rep->re_rx_desc = (re_desc *)mallocbuf; rep->re_rx_desc = (re_desc *)mallocbuf;
@ -1279,7 +1276,7 @@ void transmittest(re_t *rep)
message m; message m;
int r; int r;
if ((r = sef_receive(ANY, &m)) != OK) if ((r = sef_receive(ANY, &m)) != OK)
panic("rtl8169", "sef_receive failed", r); panic("sef_receive failed: %d", r);
} while(m.m_source != HARDWARE); } while(m.m_source != HARDWARE);
assert(!(rep->re_flags & REF_SEND_AVAIL)); assert(!(rep->re_flags & REF_SEND_AVAIL));
rep->re_flags |= REF_SEND_AVAIL; rep->re_flags |= REF_SEND_AVAIL;
@ -1306,7 +1303,7 @@ static void rl_readv_s(message *mp, int from_int)
dl_port = mp->DL_PORT; dl_port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (dl_port < 0 || dl_port >= RE_PORT_NR) if (dl_port < 0 || dl_port >= RE_PORT_NR)
panic("rtl8169", " illegal port", dl_port); panic(" illegal port: %d", dl_port);
rep = &re_table[dl_port]; rep = &re_table[dl_port];
re_client = mp->DL_PROC; re_client = mp->DL_PROC;
rep->re_client = re_client; rep->re_client = re_client;
@ -1355,7 +1352,7 @@ readvs_loop:
/* Someting went wrong */ /* Someting went wrong */
printf("rl_readv_s: bad length (%u) in status 0x%08lx\n", printf("rl_readv_s: bad length (%u) in status 0x%08lx\n",
totlen, rxstat); totlen, rxstat);
panic(NULL, NULL, NO_NUM); panic(NULL);
} }
/* Should subtract the CRC */ /* Should subtract the CRC */
@ -1372,8 +1369,7 @@ readvs_loop:
(vir_bytes) rep->re_iovec_s, (vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D); n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) { if (cps != OK) {
panic(__FILE__, "rl_readv_s: sys_safecopyfrom failed", panic("rl_readv_s: sys_safecopyfrom failed: %d", cps);
cps);
} }
for (j = 0, iovp = rep->re_iovec_s; j < n; j++, iovp++) { for (j = 0, iovp = rep->re_iovec_s; j < n; j++, iovp++) {
@ -1386,8 +1382,7 @@ readvs_loop:
cps = sys_safecopyto(re_client, iovp->iov_grant, 0, cps = sys_safecopyto(re_client, iovp->iov_grant, 0,
(vir_bytes) rep->re_rx[index].v_ret_buf + size, s, D); (vir_bytes) rep->re_rx[index].v_ret_buf + size, s, D);
if (cps != OK) if (cps != OK)
panic(__FILE__, panic("rl_readv_s: sys_safecopyto failed: %d", cps);
"rl_readv_s: sys_safecopyto failed", cps);
size += s; size += s;
if (size == packlen) if (size == packlen)
@ -1449,7 +1444,7 @@ static void rl_writev_s(message *mp, int from_int)
port = mp->DL_PORT; port = mp->DL_PORT;
count = mp->DL_COUNT; count = mp->DL_COUNT;
if (port < 0 || port >= RE_PORT_NR) if (port < 0 || port >= RE_PORT_NR)
panic("rtl8169", "illegal port", port); panic("illegal port: %d", port);
rep = &re_table[port]; rep = &re_table[port];
assert(mp); assert(mp);
assert(port >= 0 && port < RE_PORT_NR); assert(port >= 0 && port < RE_PORT_NR);
@ -1516,21 +1511,18 @@ static void rl_writev_s(message *mp, int from_int)
(vir_bytes) rep->re_iovec_s, (vir_bytes) rep->re_iovec_s,
n * sizeof(rep->re_iovec_s[0]), D); n * sizeof(rep->re_iovec_s[0]), D);
if (cps != OK) { if (cps != OK) {
panic(__FILE__, "rl_writev_s: sys_safecopyfrom failed", panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
cps);
} }
for (j = 0, iovp = rep->re_iovec_s; j < n; j++, iovp++) { for (j = 0, iovp = rep->re_iovec_s; j < n; j++, iovp++) {
s = iovp->iov_size; s = iovp->iov_size;
if (size + s > ETH_MAX_PACK_SIZE_TAGGED) if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
panic("rtl8169", "invalid packet size", NO_NUM); panic("invalid packet size");
cps = sys_safecopyfrom(re_client, iovp->iov_grant, 0, cps = sys_safecopyfrom(re_client, iovp->iov_grant, 0,
(vir_bytes) ret, s, D); (vir_bytes) ret, s, D);
if (cps != OK) { if (cps != OK) {
panic(__FILE__, panic("rl_writev_s: sys_safecopyfrom failed: %d", cps);
"rl_writev_s: sys_safecopyfrom failed",
cps);
} }
size += s; size += s;
ret += s; ret += s;
@ -1538,7 +1530,7 @@ static void rl_writev_s(message *mp, int from_int)
} }
assert(desc); assert(desc);
if (size < ETH_MIN_PACK_SIZE) if (size < ETH_MIN_PACK_SIZE)
panic("rtl8169", "invalid packet size", size); panic("invalid packet size: %d", size);
rep->re_tx[tx_head].ret_busy = TRUE; rep->re_tx[tx_head].ret_busy = TRUE;
@ -1567,7 +1559,7 @@ static void rl_writev_s(message *mp, int from_int)
suspend: suspend:
if (from_int) if (from_int)
panic("rtl8169", "should not be sending\n", NO_NUM); panic("should not be sending");
rep->re_tx_mess = *mp; rep->re_tx_mess = *mp;
reply(rep, OK, FALSE); reply(rep, OK, FALSE);
@ -1673,7 +1665,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR) if (port < 0 || port >= RE_PORT_NR)
panic("rtl8169", "illegal port", port); panic("illegal port: %d", port);
rep = &re_table[port]; rep = &re_table[port];
rep->re_client = mp->DL_PROC; rep->re_client = mp->DL_PROC;
@ -1685,14 +1677,14 @@ message *mp;
r = sys_datacopy(SELF, (vir_bytes) &stats, mp->DL_PROC, r = sys_datacopy(SELF, (vir_bytes) &stats, mp->DL_PROC,
(vir_bytes) mp->DL_ADDR, sizeof(stats)); (vir_bytes) mp->DL_ADDR, sizeof(stats));
if (r != OK) if (r != OK)
panic(__FILE__, "rl_getstat: sys_datacopy failed", r); panic("rl_getstat: sys_datacopy failed: %d", r);
mp->m_type = DL_STAT_REPLY; mp->m_type = DL_STAT_REPLY;
mp->DL_PORT = port; mp->DL_PORT = port;
mp->DL_STAT = OK; mp->DL_STAT = OK;
r = send(mp->m_source, mp); r = send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("RTL8169", "rl_getstat: send failed: %d\n", r); panic("rl_getstat: send failed: %d", r);
} }
/*===========================================================================* /*===========================================================================*
@ -1707,7 +1699,7 @@ message *mp;
port = mp->DL_PORT; port = mp->DL_PORT;
if (port < 0 || port >= RE_PORT_NR) if (port < 0 || port >= RE_PORT_NR)
panic("rtl8169", "illegal port", port); panic("illegal port: %d", port);
rep = &re_table[port]; rep = &re_table[port];
rep->re_client = mp->DL_PROC; rep->re_client = mp->DL_PROC;
@ -1719,14 +1711,14 @@ message *mp;
r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0,
(vir_bytes) &stats, sizeof(stats), D); (vir_bytes) &stats, sizeof(stats), D);
if (r != OK) if (r != OK)
panic(__FILE__, "rl_getstat_s: sys_safecopyto failed", r); panic("rl_getstat_s: sys_safecopyto failed: %d", r);
mp->m_type = DL_STAT_REPLY; mp->m_type = DL_STAT_REPLY;
mp->DL_PORT = port; mp->DL_PORT = port;
mp->DL_STAT = OK; mp->DL_STAT = OK;
r = send(mp->m_source, mp); r = send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("RTL8169", "rl_getstat_s: send failed: %d\n", r); panic("rl_getstat_s: send failed: %d", r);
} }
@ -1743,7 +1735,7 @@ message *mp;
mp->m_type = DL_NAME_REPLY; mp->m_type = DL_NAME_REPLY;
r = send(mp->m_source, mp); r = send(mp->m_source, mp);
if (r != OK) if (r != OK)
panic("RTL8169", "rl_getname: send failed: %d\n", r); panic("rl_getname: send failed: %d", r);
} }
@ -1772,7 +1764,7 @@ int may_block;
reply.DL_STAT = status | ((u32_t) err << 16); reply.DL_STAT = status | ((u32_t) err << 16);
reply.DL_COUNT = rep->re_read_s; reply.DL_COUNT = rep->re_read_s;
if (OK != (r = getuptime(&now))) if (OK != (r = getuptime(&now)))
panic("rtl8169", "getuptime() failed:", r); panic("getuptime() failed: %d", r);
reply.DL_CLCK = now; reply.DL_CLCK = now;
r = send(rep->re_client, &reply); r = send(rep->re_client, &reply);
@ -1785,7 +1777,7 @@ int may_block;
if (r < 0) { if (r < 0) {
printf("RTL8169 tried sending to %d, type %d\n", printf("RTL8169 tried sending to %d, type %d\n",
rep->re_client, reply.m_type); rep->re_client, reply.m_type);
panic("rtl8169", "send failed:", r); panic("send failed: %d", r);
} }
rep->re_read_s = 0; rep->re_read_s = 0;
@ -1800,7 +1792,7 @@ message *req;
message *reply_mess; message *reply_mess;
{ {
if (send(req->m_source, reply_mess) != OK) if (send(req->m_source, reply_mess) != OK)
panic("rtl8169", "unable to mess_reply", NO_NUM); panic("unable to mess_reply");
} }
static void dump_phy(re_t *rep) static void dump_phy(re_t *rep)

View file

@ -27,7 +27,7 @@ int port;
unsigned long value; unsigned long value;
if ((s=sys_inb(port, &value)) != OK) if ((s=sys_inb(port, &value)) != OK)
panic("SB16DSP","sys_inb() failed", s); panic("sys_inb() failed: %d", s);
return value; return value;
} }
@ -43,5 +43,5 @@ int value;
int s; int s;
if ((s=sys_outb(port, value)) != OK) if ((s=sys_outb(port, value)) != OK)
panic("SB16DSP","sys_outb() failed", s); panic("sys_outb() failed: %d", s);
} }

View file

@ -182,7 +182,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
DmaPhys += left; DmaPhys += left;
} }
#else /* CHIP != INTEL */ #else /* CHIP != INTEL */
panic("SB16DSP","initialization failed, CHIP != INTEL", 0); panic("initialization failed: CHIP != INTEL: %d", 0);
#endif /* CHIP == INTEL */ #endif /* CHIP == INTEL */
return(OK); return(OK);
@ -452,9 +452,9 @@ PRIVATE int dsp_init()
/* register interrupt vector and enable irq */ /* register interrupt vector and enable irq */
if ((s=sys_irqsetpolicy(SB_IRQ, IRQ_REENABLE, &irq_hook_id )) != OK) if ((s=sys_irqsetpolicy(SB_IRQ, IRQ_REENABLE, &irq_hook_id )) != OK)
panic("SB16DSP", "Couldn't set IRQ policy", s); panic("Couldn't set IRQ policy: %d", s);
if ((s=sys_irqenable(&irq_hook_id)) != OK) if ((s=sys_irqenable(&irq_hook_id)) != OK)
panic("SB16DSP", "Couldn't enable IRQ", s); panic("Couldn't enable IRQ: %d", s);
DspAvail = 1; DspAvail = 1;
return OK; return OK;

View file

@ -78,7 +78,7 @@ int main(int argc, char *argv[])
{ {
r= sef_receive(ANY, &m); r= sef_receive(ANY, &m);
if (r != OK) if (r != OK)
panic("ti1225", "sef_receive failed", r); panic("sef_receive failed: %d", r);
printf("ti1225: got message %u from %d\n", printf("ti1225: got message %u from %d\n",
m.m_type, m.m_source); m.m_type, m.m_source);
} }
@ -116,16 +116,16 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
: (progname=env_argv[0]); : (progname=env_argv[0]);
if((r=tsc_calibrate()) != OK) if((r=tsc_calibrate()) != OK)
panic("ti1225", "tsc_calibrate failed", r); panic("tsc_calibrate failed: %d", r);
debug= 0; debug= 0;
while (c= getopt(env_argc, env_argv, "d?"), c != -1) while (c= getopt(env_argc, env_argv, "d?"), c != -1)
{ {
switch(c) switch(c)
{ {
case '?': panic("ti1225", "Usage: ti1225 [-d]", NO_NUM); case '?': panic("Usage: ti1225 [-d]");
case 'd': debug++; break; case 'd': debug++; break;
default: panic("ti1225", "getopt failed", NO_NUM); default: panic("getopt failed");
} }
} }
@ -151,11 +151,8 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
continue; continue;
if (pcitab_ti[i].did != did) if (pcitab_ti[i].did != did)
continue; continue;
if (pcitab_ti[i].checkclass) if (pcitab_ti[i].checkclass) {
{ panic("fxp_probe: class check not implemented");
panic("ti1225",
"fxp_probe: class check not implemented",
NO_NUM);
} }
break; break;
} }
@ -236,7 +233,7 @@ struct port *pp;
} }
if (v32 == 0) if (v32 == 0)
panic("ti1225", "bad legacy-mode base address 0x%x\n", v32); panic("bad legacy-mode base address: %d", v32);
pp->p_exca_port= v32; pp->p_exca_port= v32;
if (debug) if (debug)
@ -249,7 +246,7 @@ struct port *pp;
pp->p_hook = pp->p_irq; pp->p_hook = pp->p_irq;
r= sys_irqsetpolicy(pp->p_irq, 0, &pp->p_hook); r= sys_irqsetpolicy(pp->p_irq, 0, &pp->p_hook);
if (r != OK) if (r != OK)
panic("ti1225","sys_irqsetpolicy failed", r); panic("sys_irqsetpolicy failed: %d", r);
#endif #endif
/* Clear CBB_BC_INTEXCA */ /* Clear CBB_BC_INTEXCA */
@ -279,7 +276,7 @@ struct port *pp;
#if USE_INTS #if USE_INTS
r= sys_irqenable(&pp->p_hook); r= sys_irqenable(&pp->p_hook);
if (r != OK) if (r != OK)
panic("ti1225","unable enable interrupts", r); panic("unable enable interrupts: %d", r);
#endif #endif
} }
@ -308,7 +305,7 @@ PRIVATE void map_regs(struct port *pp, u32_t base)
r = ENOSYS; r = ENOSYS;
#endif #endif
if (r != OK) if (r != OK)
panic("ti1225", "map_regs: sys_vm_map failed", r); panic("map_regs: sys_vm_map failed: %d", r);
} }
PRIVATE void do_int(pp) PRIVATE void do_int(pp)
@ -489,7 +486,7 @@ struct port *pp;
#if USE_INTS #if USE_INTS
r= sys_irqenable(&pp->p_hook); r= sys_irqenable(&pp->p_hook);
if (r != OK) if (r != OK)
panic("ti1225","unable enable interrupts", r); panic("unable enable interrupts: %d", r);
#endif #endif
} }
@ -502,7 +499,7 @@ PRIVATE u8_t do_inb(port_t port)
r= sys_inb(port, &value); r= sys_inb(port, &value);
if (r != OK) if (r != OK)
panic("ti1225","sys_inb failed", r); panic("sys_inb failed: %d", r);
return value; return value;
} }
@ -512,7 +509,7 @@ PRIVATE void do_outb(port_t port, u8_t value)
r= sys_outb(port, value); r= sys_outb(port, value);
if (r != OK) if (r != OK)
panic("ti1225","sys_outb failed", r); panic("sys_outb failed: %d", r);
} }

View file

@ -773,7 +773,7 @@ PRIVATE void beep()
/* Fetch current time in advance to prevent beeping delay. */ /* Fetch current time in advance to prevent beeping delay. */
if ((s=getuptime(&now)) != OK) if ((s=getuptime(&now)) != OK)
panic("TTY","Console couldn't get clock's uptime.", s); panic("Console couldn't get clock's uptime: %d", s);
if (!beeping) { if (!beeping) {
/* Set timer channel 2, square wave, with given frequency. */ /* Set timer channel 2, square wave, with given frequency. */
pv_set(char_out[0], TIMER_MODE, 0xB6); pv_set(char_out[0], TIMER_MODE, 0xB6);
@ -790,7 +790,7 @@ PRIVATE void beep()
if (tty_timers->tmr_exp_time != tty_next_timeout) { if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time; tty_next_timeout = tty_timers->tmr_exp_time;
if ((s=sys_setalarm(tty_next_timeout, 1)) != OK) if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
panic("TTY","Console couldn't set alarm.", s); panic("Console couldn't set alarm: %d", s);
} }
} }
@ -901,7 +901,7 @@ clock_t dur;
/* Fetch current time in advance to prevent beeping delay. */ /* Fetch current time in advance to prevent beeping delay. */
if ((s=getuptime(&now)) != OK) if ((s=getuptime(&now)) != OK)
panic("TTY","Console couldn't get clock's uptime.", s); panic("Console couldn't get clock's uptime: %d", s);
if (!beeping) { if (!beeping) {
/* Set timer channel 2, square wave, with given frequency. */ /* Set timer channel 2, square wave, with given frequency. */
pv_set(char_out[0], TIMER_MODE, 0xB6); pv_set(char_out[0], TIMER_MODE, 0xB6);
@ -918,7 +918,7 @@ clock_t dur;
if (tty_timers->tmr_exp_time != tty_next_timeout) { if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time; tty_next_timeout = tty_timers->tmr_exp_time;
if ((s=sys_setalarm(tty_next_timeout, 1)) != OK) if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
panic("TTY","Console couldn't set alarm.", s); panic("Console couldn't set alarm: %d", s);
} }
} }
@ -994,12 +994,12 @@ tty_t *tp;
console_memory = vm_map_phys(SELF, (void *) vid_base, vid_size); console_memory = vm_map_phys(SELF, (void *) vid_base, vid_size);
if(console_memory == MAP_FAILED) if(console_memory == MAP_FAILED)
panic("TTY","Console couldn't map video memory", NO_NUM); panic("Console couldn't map video memory");
font_memory = vm_map_phys(SELF, (void *)GA_VIDEO_ADDRESS, GA_FONT_SIZE); font_memory = vm_map_phys(SELF, (void *)GA_VIDEO_ADDRESS, GA_FONT_SIZE);
if(font_memory == MAP_FAILED) if(font_memory == MAP_FAILED)
panic("TTY","Console couldn't map font memory", NO_NUM); panic("Console couldn't map font memory");
vid_size >>= 1; /* word count */ vid_size >>= 1; /* word count */
@ -1050,10 +1050,6 @@ PUBLIC void kputc(int c)
return; return;
#endif #endif
#if 0
if (panicing)
#endif
cons_putk(c);
if (c != 0) { if (c != 0) {
kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */ kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */
if (kmess.km_size < _KMESS_BUF_SIZE) if (kmess.km_size < _KMESS_BUF_SIZE)

View file

@ -259,7 +259,7 @@ message *m;
if (kbdp->offset + n > KBD_BUFSZ) if (kbdp->offset + n > KBD_BUFSZ)
n= KBD_BUFSZ-kbdp->offset; n= KBD_BUFSZ-kbdp->offset;
if (n <= 0) if (n <= 0)
panic("TTY", "do_kbd(READ): bad n", n); panic("do_kbd(READ): bad n: %d", n);
if(safecopy) { if(safecopy) {
r= sys_safecopyto(m->IO_ENDPT, (vir_bytes) m->ADDRESS, 0, r= sys_safecopyto(m->IO_ENDPT, (vir_bytes) m->ADDRESS, 0,
(vir_bytes) &kbdp->buf[kbdp->offset], n, D); (vir_bytes) &kbdp->buf[kbdp->offset], n, D);
@ -427,7 +427,7 @@ message *m;
if (kbdp->offset + n > KBD_BUFSZ) if (kbdp->offset + n > KBD_BUFSZ)
n= KBD_BUFSZ-kbdp->offset; n= KBD_BUFSZ-kbdp->offset;
if (n <= 0) if (n <= 0)
panic("TTY", "kbd_status: bad n", n); panic("kbd_status: bad n: %d", n);
kbdp->req_size= 0; kbdp->req_size= 0;
if(kbdp->req_safe) { if(kbdp->req_safe) {
r= sys_safecopyto(kbdp->req_proc, kbdp->req_addr_g, 0, r= sys_safecopyto(kbdp->req_proc, kbdp->req_addr_g, 0,
@ -519,7 +519,7 @@ message *m_ptr;
if (isaux) if (isaux)
kbdp= &kbdaux; kbdp= &kbdaux;
else if (kbd.nr_open && !panicing) else if (kbd.nr_open)
kbdp= &kbd; kbdp= &kbd;
else else
kbdp= NULL; kbdp= NULL;
@ -707,13 +707,13 @@ PRIVATE void kbd_send()
* alarm. * alarm.
*/ */
if ((r= getuptime(&now)) != OK) if ((r= getuptime(&now)) != OK)
panic("TTY","Keyboard couldn't get clock's uptime.", r); panic("Keyboard couldn't get clock's uptime: %d", r);
tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog, tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog,
NULL); NULL);
if (tty_timers->tmr_exp_time != tty_next_timeout) { if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time; tty_next_timeout = tty_timers->tmr_exp_time;
if ((r= sys_setalarm(tty_next_timeout, 1)) != OK) if ((r= sys_setalarm(tty_next_timeout, 1)) != OK)
panic("TTY","Keyboard couldn't set alarm.", r); panic("Keyboard couldn't set alarm: %d", r);
} }
kbd_watchdog_set= 1; kbd_watchdog_set= 1;
} }
@ -919,7 +919,7 @@ PRIVATE int kbc_read()
#if 0 #if 0
while (micro_elapsed(&ms) < 1000000); while (micro_elapsed(&ms) < 1000000);
#endif #endif
panic("TTY", "kbc_read failed to complete", NO_NUM); panic("kbc_read failed to complete");
return EINVAL; return EINVAL;
} }
@ -1017,18 +1017,18 @@ PUBLIC void kb_init_once(void)
/* Set interrupt handler and enable keyboard IRQ. */ /* Set interrupt handler and enable keyboard IRQ. */
irq_hook_id = KEYBOARD_IRQ; /* id to be returned on interrupt */ irq_hook_id = KEYBOARD_IRQ; /* id to be returned on interrupt */
if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK) if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
panic("TTY", "Couldn't set keyboard IRQ policy", i); panic("Couldn't set keyboard IRQ policy: %d", i);
if ((i=sys_irqenable(&irq_hook_id)) != OK) if ((i=sys_irqenable(&irq_hook_id)) != OK)
panic("TTY", "Couldn't enable keyboard IRQs", i); panic("Couldn't enable keyboard IRQs: %d", i);
kbd_irq_set |= (1 << KEYBOARD_IRQ); kbd_irq_set |= (1 << KEYBOARD_IRQ);
/* Set AUX interrupt handler and enable AUX IRQ. */ /* Set AUX interrupt handler and enable AUX IRQ. */
aux_irq_hook_id = KBD_AUX_IRQ; /* id to be returned on interrupt */ aux_irq_hook_id = KBD_AUX_IRQ; /* id to be returned on interrupt */
if ((i=sys_irqsetpolicy(KBD_AUX_IRQ, IRQ_REENABLE, if ((i=sys_irqsetpolicy(KBD_AUX_IRQ, IRQ_REENABLE,
&aux_irq_hook_id)) != OK) &aux_irq_hook_id)) != OK)
panic("TTY", "Couldn't set AUX IRQ policy", i); panic("Couldn't set AUX IRQ policy: %d", i);
if ((i=sys_irqenable(&aux_irq_hook_id)) != OK) if ((i=sys_irqenable(&aux_irq_hook_id)) != OK)
panic("TTY", "Couldn't enable AUX IRQs", i); panic("Couldn't enable AUX IRQs: %d", i);
kbd_irq_set |= (1 << KBD_AUX_IRQ); kbd_irq_set |= (1 << KBD_AUX_IRQ);
/* Disable the keyboard and aux */ /* Disable the keyboard and aux */
@ -1319,13 +1319,13 @@ timer_t *tmrp;
kbd_alive= 0; kbd_alive= 0;
if ((r= getuptime(&now)) != OK) if ((r= getuptime(&now)) != OK)
panic("TTY","Keyboard couldn't get clock's uptime.", r); panic("Keyboard couldn't get clock's uptime: %d", r);
tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog, tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog,
NULL); NULL);
if (tty_timers->tmr_exp_time != tty_next_timeout) { if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time; tty_next_timeout = tty_timers->tmr_exp_time;
if ((r= sys_setalarm(tty_next_timeout, 1)) != OK) if ((r= sys_setalarm(tty_next_timeout, 1)) != OK)
panic("TTY","Keyboard couldn't set alarm.", r); panic("Keyboard couldn't set alarm: %d", r);
} }
kbd_watchdog_set= 1; kbd_watchdog_set= 1;
} }

View file

@ -171,7 +171,7 @@ PUBLIC int main(void)
/* Get a request message. */ /* Get a request message. */
r= sef_receive(ANY, &tty_mess); r= sef_receive(ANY, &tty_mess);
if (r != 0) if (r != 0)
panic("TTY", "sef_receive failed with %d", r); panic("sef_receive failed with: %d", r);
/* First handle all kernel notification types that the TTY supports. /* First handle all kernel notification types that the TTY supports.
* - An alarm went off, expire all timers and handle the events. * - An alarm went off, expire all timers and handle the events.
@ -342,7 +342,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Get kernel environment (protected_mode, pc_at and ega are needed). */ /* Get kernel environment (protected_mode, pc_at and ega are needed). */
if (OK != (r=sys_getmachine(&machine))) { if (OK != (r=sys_getmachine(&machine))) {
panic("TTY","Couldn't obtain kernel environment.", r); panic("Couldn't obtain kernel environment: %d", r);
} }
/* Initialize the TTY driver. */ /* Initialize the TTY driver. */
@ -1538,9 +1538,8 @@ int status; /* reply code */
* placeholder for something that is not supposed to be a message. * placeholder for something that is not supposed to be a message.
*/ */
if(code == TTY_REVIVE) { if(code == TTY_REVIVE) {
panicing = 1;
printf("%s:%d: ", file, line); printf("%s:%d: ", file, line);
panic("TTY","tty_reply sending TTY_REVIVE", NO_NUM); panic("tty_reply sending TTY_REVIVE");
} }
status = sendnb(replyee, &tty_mess); status = sendnb(replyee, &tty_mess);
@ -1565,7 +1564,7 @@ int mayflush;
if (tp->tty_pgrp != 0) { if (tp->tty_pgrp != 0) {
if (OK != (status = sys_kill(tp->tty_pgrp, sig))) { if (OK != (status = sys_kill(tp->tty_pgrp, sig))) {
panic("TTY","Error, call to sys_kill failed", status); panic("Error; call to sys_kill failed: %d", status);
} }
} }
@ -1668,7 +1667,7 @@ PRIVATE void expire_timers(void)
/* Get the current time to compare the timers against. */ /* Get the current time to compare the timers against. */
if ((s=getuptime(&now)) != OK) if ((s=getuptime(&now)) != OK)
panic("TTY","Couldn't get uptime from clock.", s); panic("Couldn't get uptime from clock: %d", s);
/* Scan the queue of timers for expired timers. This dispatch the watchdog /* Scan the queue of timers for expired timers. This dispatch the watchdog
* functions of expired timers. Possibly a new alarm call must be scheduled. * functions of expired timers. Possibly a new alarm call must be scheduled.
@ -1678,7 +1677,7 @@ PRIVATE void expire_timers(void)
else { /* set new sync alarm */ else { /* set new sync alarm */
tty_next_timeout = tty_timers->tmr_exp_time; tty_next_timeout = tty_timers->tmr_exp_time;
if ((s=sys_setalarm(tty_next_timeout, 1)) != OK) if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
panic("TTY","Couldn't set synchronous alarm.", s); panic("Couldn't set synchronous alarm: %d", s);
} }
} }
@ -1695,7 +1694,7 @@ int enable; /* set timer if true, otherwise unset */
/* Get the current time to calculate the timeout time. */ /* Get the current time to calculate the timeout time. */
if ((s=getuptime(&now)) != OK) if ((s=getuptime(&now)) != OK)
panic("TTY","Couldn't get uptime from clock.", s); panic("Couldn't get uptime from clock: %d", s);
if (enable) { if (enable) {
exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (system_hz/10); exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (system_hz/10);
/* Set a new timer for enabling the TTY events flags. */ /* Set a new timer for enabling the TTY events flags. */
@ -1714,7 +1713,7 @@ int enable; /* set timer if true, otherwise unset */
else if (tty_timers->tmr_exp_time != tty_next_timeout) { else if (tty_timers->tmr_exp_time != tty_next_timeout) {
tty_next_timeout = tty_timers->tmr_exp_time; tty_next_timeout = tty_timers->tmr_exp_time;
if ((s=sys_setalarm(tty_next_timeout, 1)) != OK) if ((s=sys_setalarm(tty_next_timeout, 1)) != OK)
panic("TTY","Couldn't set synchronous alarm.", s); panic("Couldn't set synchronous alarm: %d", s);
} }
} }

View file

@ -111,8 +111,6 @@ extern u32_t system_hz; /* system clock frequency */
extern unsigned long kbd_irq_set; extern unsigned long kbd_irq_set;
extern unsigned long rs_irq_set; extern unsigned long rs_irq_set;
extern int panicing; /* From panic.c in sysutil */
/* Values for the fields. */ /* Values for the fields. */
#define NOT_ESCAPED 0 /* previous character is not LNEXT (^V) */ #define NOT_ESCAPED 0 /* previous character is not LNEXT (^V) */
#define ESCAPED 1 /* previous character was LNEXT (^V) */ #define ESCAPED 1 /* previous character was LNEXT (^V) */

View file

@ -60,7 +60,6 @@
#define BYTE 0377 /* mask for 8 bits */ #define BYTE 0377 /* mask for 8 bits */
#define READING 0 /* copy data to user */ #define READING 0 /* copy data to user */
#define WRITING 1 /* copy data from user */ #define WRITING 1 /* copy data from user */
#define NO_NUM 0x8000 /* used as numerical argument to panic() */
#define NIL_PTR (char *) 0 /* generally useful expression */ #define NIL_PTR (char *) 0 /* generally useful expression */
#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */ #define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */

View file

@ -32,7 +32,7 @@ typedef struct { u16_t port; u32_t value; } pvl_pair_t;
printf("%s:%d: actual port: 0x%x != 0x%lx || " \ printf("%s:%d: actual port: 0x%x != 0x%lx || " \
"actual value: 0x%x != 0x%lx\n", \ "actual value: 0x%x != 0x%lx\n", \
__FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \ __FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \
panic(__FILE__, "pv_set(" #pv ", " #p ", " #v ")", NO_NUM); \ panic("pv_set(" #pv ", " #p ", " #v ")"); \
} \ } \
} while(0) } while(0)

View file

@ -44,8 +44,7 @@ _PROTOTYPE( int fkey_ctl, (int req, int *fkeys, int *sfkeys) );
_PROTOTYPE( int printf, (const char *fmt, ...)); _PROTOTYPE( int printf, (const char *fmt, ...));
_PROTOTYPE( void kputc, (int c)); _PROTOTYPE( void kputc, (int c));
_PROTOTYPE( void report, (char *who, char *mess, int num)); _PROTOTYPE( void panic, (const char *fmt, ...));
_PROTOTYPE( void panic, (char *who, char *mess, int num));
_PROTOTYPE( int getuptime, (clock_t *ticks)); _PROTOTYPE( int getuptime, (clock_t *ticks));
_PROTOTYPE( int getuptime2, (clock_t *ticks, time_t *boottime)); _PROTOTYPE( int getuptime2, (clock_t *ticks, time_t *boottime));
_PROTOTYPE( int tickdelay, (clock_t ticks)); _PROTOTYPE( int tickdelay, (clock_t ticks));
@ -65,7 +64,7 @@ _PROTOTYPE( void get_randomness, (struct k_randomness *, int));
#define asynsend(ep, msg) asynsend3(ep, msg, 0) #define asynsend(ep, msg) asynsend3(ep, msg, 0)
_PROTOTYPE( int asynsend3, (endpoint_t ep, message *msg, int flags)); _PROTOTYPE( int asynsend3, (endpoint_t ep, message *msg, int flags));
#define ASSERT(c) if(!(c)) { panic(__FILE__, "assert " #c " failed at line", __LINE__); } #define ASSERT(c) if(!(c)) { panic("%s:%d: assert %s failed", __FILE__, __LINE__, #c); }
/* timing library */ /* timing library */
#define TIMING_CATEGORIES 20 #define TIMING_CATEGORIES 20

View file

@ -167,7 +167,7 @@ struct memory {
#define STATICINIT(v, n) \ #define STATICINIT(v, n) \
if(!(v)) { \ if(!(v)) { \
if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \ if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \
panic(__FILE__, "allocating " #v " failed", n); \ panic("allocating " #v " failed: %d", n); \
} \ } \
} }

View file

@ -48,8 +48,7 @@ struct proc *p;
return ESRCH; return ESRCH;
pagefaults = rp->p_nextpagefault; pagefaults = rp->p_nextpagefault;
if(!RTS_ISSET(rp, RTS_PAGEFAULT)) if(!RTS_ISSET(rp, RTS_PAGEFAULT))
minix_panic("non-PAGEFAULT process on pagefault chain", panic( "non-PAGEFAULT process on pagefault chain: %d", rp->p_endpoint);
rp->p_endpoint);
m_ptr->SVMCTL_PF_WHO = rp->p_endpoint; m_ptr->SVMCTL_PF_WHO = rp->p_endpoint;
m_ptr->SVMCTL_PF_I386_CR2 = rp->p_pagefault.pf_virtual; m_ptr->SVMCTL_PF_I386_CR2 = rp->p_pagefault.pf_virtual;
m_ptr->SVMCTL_PF_I386_ERR = rp->p_pagefault.pf_flags; m_ptr->SVMCTL_PF_I386_ERR = rp->p_pagefault.pf_flags;

View file

@ -70,7 +70,7 @@ void pagefault( struct proc *pr,
proc_stacktrace(proc_addr(SYSTEM)); proc_stacktrace(proc_addr(SYSTEM));
} }
printf("pc of pagefault: 0x%lx\n", frame->eip); printf("pc of pagefault: 0x%lx\n", frame->eip);
minix_panic("page fault in system process", pr->p_endpoint); panic("page fault in system process: %d", pr->p_endpoint);
return; return;
} }
@ -163,8 +163,7 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
frame->eip = (reg_t) __user_copy_msg_pointer_failure; frame->eip = (reg_t) __user_copy_msg_pointer_failure;
return; return;
default: default:
minix_panic("Copy involving a user pointer " panic("Copy involving a user pointer failed unexpectedly!");
"failed unexpectedly!", NO_NUM);
} }
} }
} }
@ -216,11 +215,11 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
(unsigned) saved_proc->p_reg.pc); (unsigned) saved_proc->p_reg.pc);
proc_stacktrace(saved_proc); proc_stacktrace(saved_proc);
minix_panic("exception in a kernel task", saved_proc->p_endpoint); panic("exception in a kernel task: %d", saved_proc->p_endpoint);
} }
else { else {
/* in an early stage of boot process we don't have processes yet */ /* in an early stage of boot process we don't have processes yet */
minix_panic("exception in kernel while booting", NO_NUM); panic("exception in kernel while booting");
} }
} }

View file

@ -48,7 +48,7 @@ FORWARD _PROTOTYPE( void vm_enable_paging, (void) );
PUBLIC void vm_init(struct proc *newptproc) PUBLIC void vm_init(struct proc *newptproc)
{ {
if(vm_running) if(vm_running)
minix_panic("vm_init: vm_running", NO_NUM); panic("vm_init: vm_running");
switch_address_space(newptproc); switch_address_space(newptproc);
vm_enable_paging(); vm_enable_paging();
vm_running = 1; vm_running = 1;
@ -198,7 +198,7 @@ PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
NOREC_RETURN(linlincopy, EFAULT_DST); NOREC_RETURN(linlincopy, EFAULT_DST);
} }
minix_panic("lin_lin_copy fault out of range", NO_NUM); panic("lin_lin_copy fault out of range");
/* Not reached. */ /* Not reached. */
NOREC_RETURN(linlincopy, EFAULT); NOREC_RETURN(linlincopy, EFAULT);
@ -229,7 +229,7 @@ PRIVATE u32_t phys_get32(phys_bytes addr)
if((r=lin_lin_copy(NULL, addr, if((r=lin_lin_copy(NULL, addr,
proc_addr(SYSTEM), vir2phys(&v), sizeof(v))) != OK) { proc_addr(SYSTEM), vir2phys(&v), sizeof(v))) != OK) {
minix_panic("lin_lin_copy for phys_get32 failed", r); panic("lin_lin_copy for phys_get32 failed: %d", r);
} }
return v; return v;
@ -364,7 +364,7 @@ vir_bytes bytes; /* # of bytes to be copied */
phys_bytes seg_base; phys_bytes seg_base;
if(seg != T && seg != D && seg != S) if(seg != T && seg != D && seg != S)
minix_panic("umap_local: wrong seg", seg); panic("umap_local: wrong seg: %d", seg);
if (bytes <= 0) return( (phys_bytes) 0); if (bytes <= 0) return( (phys_bytes) 0);
if (vir_addr + bytes <= vir_addr) return 0; /* overflow */ if (vir_addr + bytes <= vir_addr) return 0; /* overflow */
@ -413,7 +413,7 @@ vir_bytes bytes; /* # of bytes to be copied */
phys = 0; phys = 0;
} }
if(phys == 0) if(phys == 0)
minix_panic("vm_lookup returned phys", phys); panic("vm_lookup returned phys: %d", phys);
} }
@ -603,7 +603,7 @@ int delivermsg(struct proc *rp)
printf("vir: 0x%lx lin was: 0x%lx umap now: 0x%lx\n", printf("vir: 0x%lx lin was: 0x%lx umap now: 0x%lx\n",
rp->p_delivermsg_vir, rp->p_delivermsg_lin, rp->p_delivermsg_vir, rp->p_delivermsg_lin,
umap_local(rp, D, rp->p_delivermsg_vir, sizeof(message))); umap_local(rp, D, rp->p_delivermsg_vir, sizeof(message)));
minix_panic("that's wrong", NO_NUM); panic("that's wrong");
} }
#endif #endif
@ -847,7 +847,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
struct proc *target; struct proc *target;
phys_bytes lin; phys_bytes lin;
if(r != EFAULT_SRC && r != EFAULT_DST) if(r != EFAULT_SRC && r != EFAULT_DST)
minix_panic("lin_lin_copy failed", r); panic("lin_lin_copy failed: %d", r);
if(!vmcheck || !caller) { if(!vmcheck || !caller) {
NOREC_RETURN(virtualcopy, r); NOREC_RETURN(virtualcopy, r);
} }
@ -861,7 +861,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
lin = phys_addr[_DST_]; lin = phys_addr[_DST_];
target = procs[_DST_]; target = procs[_DST_];
} else { } else {
minix_panic("r strange", r); panic("r strange: %d", r);
} }
#if 0 #if 0

View file

@ -648,9 +648,8 @@ copr_return:
jmp restart jmp restart
copr_not_available_in_kernel: copr_not_available_in_kernel:
movl $NO_NUM, 4(%esp)
movl $0, (%esp) movl $0, (%esp)
call minix_panic call panic
double_fault: double_fault:
EXCEPTION_ERR_CODE(DOUBLE_FAULT_VECTOR) EXCEPTION_ERR_CODE(DOUBLE_FAULT_VECTOR)

View file

@ -135,7 +135,7 @@ PUBLIC void prot_init(void)
/* Click-round kernel. */ /* Click-round kernel. */
if(kinfo.data_base % CLICK_SIZE) if(kinfo.data_base % CLICK_SIZE)
minix_panic("kinfo.data_base not aligned", NO_NUM); panic("kinfo.data_base not aligned");
kinfo.data_size = (phys_bytes) (CLICK_CEIL(kinfo.data_size)); kinfo.data_size = (phys_bytes) (CLICK_CEIL(kinfo.data_size));
/* Build gdt and idt pointers in GDT where the BIOS expects them. */ /* Build gdt and idt pointers in GDT where the BIOS expects them. */
@ -330,7 +330,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
} }
if(fail) { if(fail) {
printf("%d/%d checks failed\n", fail, checked); printf("%d/%d checks failed\n", fail, checked);
minix_panic("wrong", fail); panic("wrong: %d", fail);
} }
} }
@ -391,7 +391,7 @@ PUBLIC void printseg(char *banner, int iscs, struct proc *pr, u32_t selector)
} }
if(desc->granularity & 0x20) { /* reserved */ if(desc->granularity & 0x20) { /* reserved */
minix_panic("granularity reserved field set", NO_NUM); panic("granularity reserved field set");
} }
if(!(desc->access & PRESENT)) if(!(desc->access & PRESENT))

View file

@ -118,7 +118,7 @@ void arch_watchdog_lockup(struct nmi_frame * frame)
frame->cs, frame->cs,
frame->eflags frame->eflags
); );
minix_panic("Kernel lockup\n", NO_NUM); panic("Kernel lockup");
} }
void i386_watchdog_start(void) void i386_watchdog_start(void)

View file

@ -24,8 +24,7 @@ check_runqueues_f(char *file, int line)
FIXME("check_runqueues being done"); FIXME("check_runqueues being done");
#define MYPANIC(msg) { \ #define MYPANIC(msg) { \
printf("check_runqueues:%s:%d: %s\n", file, line, msg); \ panic("check_runqueues:%s:%d: %s\n", file, line, msg); \
minix_panic("check_runqueues failed", NO_NUM); \
} }
for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) { for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) {

View file

@ -60,20 +60,18 @@
#if DEBUG_VMASSERT #if DEBUG_VMASSERT
#define vmassert(t) { \ #define vmassert(t) { \
if(!(t)) { minix_panic("vm: assert " #t " failed in " __FILE__, __LINE__); } } if(!(t)) { panic("kernel:%s:%d: assert %s failed", __FILE__, __LINE__, #t); } }
#else #else
#define vmassert(t) { } #define vmassert(t) { }
#endif #endif
#define NOT_REACHABLE do { \ #define NOT_REACHABLE do { \
printf("NOT_REACHABLE at %s:%d\n", __FILE__, __LINE__); \ panic("NOT_REACHABLE at %s:%d", __FILE__, __LINE__); \
minix_panic("execution at an unexpected location\n", NO_NUM); \
for(;;); \ for(;;); \
} while(0) } while(0)
#define NOT_IMPLEMENTED do { \ #define NOT_IMPLEMENTED do { \
printf("NOT_IMPLEMENTED at %s:%d\n", __FILE__, __LINE__); \ panic("NOT_IMPLEMENTED at %s:%d", __FILE__, __LINE__); \
minix_panic("NOT_IMPLEMENTED", NO_NUM); \
} while(0) } while(0)
#ifdef CONFIG_BOOT_VERBOSE #ifdef CONFIG_BOOT_VERBOSE

View file

@ -32,7 +32,7 @@ PUBLIC void put_irq_handler( irq_hook_t* hook, int irq, irq_handler_t handler)
unsigned long bitmap; unsigned long bitmap;
if( irq < 0 || irq >= NR_IRQ_VECTORS ) if( irq < 0 || irq >= NR_IRQ_VECTORS )
minix_panic("invalid call to put_irq_handler", irq); panic("invalid call to put_irq_handler: %d", irq);
line = &irq_handlers[irq]; line = &irq_handlers[irq];
@ -48,7 +48,7 @@ PUBLIC void put_irq_handler( irq_hook_t* hook, int irq, irq_handler_t handler)
if (!(bitmap & id)) break; if (!(bitmap & id)) break;
if(id == 0) if(id == 0)
minix_panic("Too many handlers for irq", irq); panic("Too many handlers for irq: %d", irq);
hook->next = NULL; hook->next = NULL;
hook->handler = handler; hook->handler = handler;
@ -76,7 +76,7 @@ PUBLIC void rm_irq_handler( irq_hook_t* hook ) {
irq_hook_t **line; irq_hook_t **line;
if( irq < 0 || irq >= NR_IRQ_VECTORS ) if( irq < 0 || irq >= NR_IRQ_VECTORS )
minix_panic("invalid call to rm_irq_handler", irq); panic("invalid call to rm_irq_handler: %d", irq);
/* disable the irq. */ /* disable the irq. */
irq_actids[hook->irq] |= hook->id; irq_actids[hook->irq] |= hook->id;

View file

@ -241,10 +241,10 @@ PUBLIC void main()
/* /*
* enable timer interrupts and clock task on the boot CPU * enable timer interrupts and clock task on the boot CPU
*/ */
if (boot_cpu_init_timer(system_hz)) { if (boot_cpu_init_timer(system_hz)) {
minix_panic("FATAL : failed to initialize timer interrupts, " panic( "FATAL : failed to initialize timer interrupts; "
"cannot continue without any clock source!", "cannot continue without any clock source!");
NO_NUM);
} }
/* Warnings for sanity checks that take time. These warnings are printed /* Warnings for sanity checks that take time. These warnings are printed

View file

@ -210,8 +210,7 @@ check_misc_flags:
#if DEBUG_SCHED_CHECK #if DEBUG_SCHED_CHECK
if (proc_ptr->p_misc_flags & MF_SC_ACTIVE) if (proc_ptr->p_misc_flags & MF_SC_ACTIVE)
minix_panic("MF_SC_ACTIVE and MF_SC_DEFER set", panic("MF_SC_ACTIVE and MF_SC_DEFER set");
NO_NUM);
#endif #endif
arch_do_syscall(proc_ptr); arch_do_syscall(proc_ptr);
@ -311,7 +310,7 @@ long bit_map; /* notification event set or flags */
#if DEBUG_SCHED_CHECK #if DEBUG_SCHED_CHECK
if (caller_ptr->p_misc_flags & MF_SC_ACTIVE) if (caller_ptr->p_misc_flags & MF_SC_ACTIVE)
minix_panic("MF_SC_ACTIVE already set", NO_NUM); panic("MF_SC_ACTIVE already set");
#endif #endif
/* Set a flag to allow reliable tracing of leaving the system call. */ /* Set a flag to allow reliable tracing of leaving the system call. */
@ -322,7 +321,7 @@ long bit_map; /* notification event set or flags */
if(caller_ptr->p_misc_flags & MF_DELIVERMSG) { if(caller_ptr->p_misc_flags & MF_DELIVERMSG) {
printf("sys_call: MF_DELIVERMSG on for %s / %d\n", printf("sys_call: MF_DELIVERMSG on for %s / %d\n",
caller_ptr->p_name, caller_ptr->p_endpoint); caller_ptr->p_name, caller_ptr->p_endpoint);
minix_panic("MF_DELIVERMSG on", NO_NUM); panic("MF_DELIVERMSG on");
} }
#endif #endif
@ -699,7 +698,7 @@ int flags;
vmassert(!(caller_ptr->p_misc_flags & MF_DELIVERMSG)); vmassert(!(caller_ptr->p_misc_flags & MF_DELIVERMSG));
vmassert(src_e == ANY || hisep == src_e); vmassert(src_e == ANY || hisep == src_e);
if((r=QueueMess(hisep, vir2phys(&m), caller_ptr)) != OK) { if((r=QueueMess(hisep, vir2phys(&m), caller_ptr)) != OK) {
minix_panic("mini_receive: local QueueMess failed", NO_NUM); panic("mini_receive: local QueueMess failed");
} }
return(OK); /* report success */ return(OK); /* report success */
} }
@ -794,7 +793,7 @@ endpoint_t dst_e; /* which process to notify */
BuildNotifyMessage(&m, proc_nr(caller_ptr), dst_ptr); BuildNotifyMessage(&m, proc_nr(caller_ptr), dst_ptr);
vmassert(!(dst_ptr->p_misc_flags & MF_DELIVERMSG)); vmassert(!(dst_ptr->p_misc_flags & MF_DELIVERMSG));
if((r=QueueMess(caller_ptr->p_endpoint, vir2phys(&m), dst_ptr)) != OK) { if((r=QueueMess(caller_ptr->p_endpoint, vir2phys(&m), dst_ptr)) != OK) {
minix_panic("mini_notify: local QueueMess failed", NO_NUM); panic("mini_notify: local QueueMess failed");
} }
RTS_UNSET(dst_ptr, RTS_RECEIVING); RTS_UNSET(dst_ptr, RTS_RECEIVING);
return(OK); return(OK);
@ -1165,7 +1164,7 @@ register struct proc *rp; /* this process is now runnable */
NOREC_ENTER(enqueuefunc); NOREC_ENTER(enqueuefunc);
#if DEBUG_SCHED_CHECK #if DEBUG_SCHED_CHECK
if (rp->p_ready) minix_panic("enqueue already ready process", NO_NUM); if (rp->p_ready) panic("enqueue already ready process");
#endif #endif
/* Determine where to insert to process. */ /* Determine where to insert to process. */
@ -1224,7 +1223,7 @@ PRIVATE void enqueue_head(struct proc *rp)
int q = rp->p_priority; /* scheduling queue to use */ int q = rp->p_priority; /* scheduling queue to use */
#if DEBUG_SCHED_CHECK #if DEBUG_SCHED_CHECK
if (rp->p_ready) minix_panic("enqueue already ready process", NO_NUM); if (rp->p_ready) panic("enqueue already ready process");
#endif #endif
/* /*
@ -1271,12 +1270,12 @@ register struct proc *rp; /* this process is no longer runnable */
/* Side-effect for kernel: check if the task's stack still is ok? */ /* Side-effect for kernel: check if the task's stack still is ok? */
if (iskernelp(rp)) { if (iskernelp(rp)) {
if (*priv(rp)->s_stack_guard != STACK_GUARD) if (*priv(rp)->s_stack_guard != STACK_GUARD)
minix_panic("stack overrun by task", proc_nr(rp)); panic("stack overrun by task: %d", proc_nr(rp));
} }
#endif #endif
#if DEBUG_SCHED_CHECK #if DEBUG_SCHED_CHECK
if (! rp->p_ready) minix_panic("dequeue() already unready process", NO_NUM); if (! rp->p_ready) panic("dequeue() already unready process");
#endif #endif
/* Now make sure that the process is not in its ready queue. Remove the /* Now make sure that the process is not in its ready queue. Remove the
@ -1466,7 +1465,7 @@ int *p, fatalflag;
#endif #endif
} else ok = 1; } else ok = 1;
if(!ok && fatalflag) { if(!ok && fatalflag) {
minix_panic("invalid endpoint ", e); panic("invalid endpoint: %d", e);
} }
return ok; return ok;
} }

View file

@ -35,9 +35,6 @@ _PROTOTYPE( void main, (void) );
_PROTOTYPE( void prepare_shutdown, (int how) ); _PROTOTYPE( void prepare_shutdown, (int how) );
_PROTOTYPE( void minix_shutdown, (struct timer *tp) ); _PROTOTYPE( void minix_shutdown, (struct timer *tp) );
/* utility.c */
_PROTOTYPE( void minix_panic, (char *s, int n) );
/* proc.c */ /* proc.c */
_PROTOTYPE( int do_ipc, (int call_nr, int src_dst, _PROTOTYPE( int do_ipc, (int call_nr, int src_dst,
message *m_ptr, long bit_map) ); message *m_ptr, long bit_map) );

View file

@ -324,7 +324,7 @@ PUBLIC void send_sig(int proc_nr, int sig_nr)
register struct proc *rp; register struct proc *rp;
if(!isokprocn(proc_nr) || isemptyn(proc_nr)) if(!isokprocn(proc_nr) || isemptyn(proc_nr))
minix_panic("send_sig to empty process", proc_nr); panic("send_sig to empty process: %d", proc_nr);
rp = proc_addr(proc_nr); rp = proc_addr(proc_nr);
sigaddset(&priv(rp)->s_sig_pending, sig_nr); sigaddset(&priv(rp)->s_sig_pending, sig_nr);
@ -354,7 +354,7 @@ int sig_nr; /* signal to be sent */
register struct proc *rp; register struct proc *rp;
if (proc_nr == PM_PROC_NR) if (proc_nr == PM_PROC_NR)
minix_panic("cause_sig: PM gets signal", NO_NUM); panic("cause_sig: PM gets signal");
/* Check if the signal is already pending. Process it otherwise. */ /* Check if the signal is already pending. Process it otherwise. */
rp = proc_addr(proc_nr); rp = proc_addr(proc_nr);
@ -458,7 +458,7 @@ register struct proc *rc; /* slot of process to clean up */
register struct proc *rp; /* iterate over process table */ register struct proc *rp; /* iterate over process table */
register struct proc **xpp; /* iterate over caller queue */ register struct proc **xpp; /* iterate over caller queue */
if(isemptyp(rc)) minix_panic("clear_proc: empty process", rc->p_endpoint); if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint);
if(rc->p_endpoint == PM_PROC_NR || rc->p_endpoint == VFS_PROC_NR || if(rc->p_endpoint == PM_PROC_NR || rc->p_endpoint == VFS_PROC_NR ||
rc->p_endpoint == VM_PROC_NR) rc->p_endpoint == VM_PROC_NR)
@ -468,7 +468,7 @@ register struct proc *rc; /* slot of process to clean up */
*/ */
printf("died: "); printf("died: ");
proc_stacktrace(rc); proc_stacktrace(rc);
minix_panic("system process died", rc->p_endpoint); panic("system process died: %d", rc->p_endpoint);
} }
/* Make sure that the exiting process is no longer scheduled. */ /* Make sure that the exiting process is no longer scheduled. */

View file

@ -147,7 +147,7 @@ irq_hook_t *hook;
* automatically get their interrupt hooks unhooked. * automatically get their interrupt hooks unhooked.
*/ */
if(!isokendpt(hook->proc_nr_e, &proc_nr)) if(!isokendpt(hook->proc_nr_e, &proc_nr))
minix_panic("invalid interrupt handler", hook->proc_nr_e); panic("invalid interrupt handler: %d", hook->proc_nr_e);
/* Add a bit for this interrupt to the process' pending interrupts. When /* Add a bit for this interrupt to the process' pending interrupts. When
* sending the notification message, this bit map will be magically set * sending the notification message, this bit map will be magically set

View file

@ -350,7 +350,7 @@ PUBLIC int do_safecopy(struct proc * caller, message * m_ptr)
src_seg = m_ptr->SCP_SEG; src_seg = m_ptr->SCP_SEG;
dst_seg = D; dst_seg = D;
access = CPF_WRITE; access = CPF_WRITE;
} else minix_panic("Impossible system call nr. ", m_ptr->m_type); } else panic("Impossible system call nr.: %d", m_ptr->m_type);
return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint, return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint,
(cp_grant_id_t) m_ptr->SCP_GID, src_seg, dst_seg, (cp_grant_id_t) m_ptr->SCP_GID, src_seg, dst_seg,

View file

@ -47,7 +47,7 @@ PUBLIC int do_sysctl(struct proc * caller, message * m_ptr)
return(EINVAL); return(EINVAL);
} }
minix_panic("do_sysctl: can't happen", NO_NUM); panic("do_sysctl: can't happen");
return(OK); return(OK);
} }

View file

@ -91,7 +91,7 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr)
return EFAULT; return EFAULT;
} }
if(phys_addr == 0) if(phys_addr == 0)
minix_panic("vm_lookup returned zero physical address", NO_NUM); panic("vm_lookup returned zero physical address");
break; break;
default: default:
if((r=arch_umap(targetpr, offset, count, seg_type, &lin_addr)) if((r=arch_umap(targetpr, offset, count, seg_type, &lin_addr))

View file

@ -158,7 +158,7 @@ PUBLIC int do_vdevio(struct proc * caller, message * m_ptr)
return(OK); return(OK);
bad: bad:
minix_panic("do_vdevio: unaligned port", port); panic("do_vdevio: unaligned port: %d", port);
return EPERM; return EPERM;
} }

View file

@ -56,8 +56,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
#if 0 #if 0
if(!RTS_ISSET(target, RTS_VMREQTARGET)) { if(!RTS_ISSET(target, RTS_VMREQTARGET)) {
printf("set stack: %s\n", rp->p_vmrequest.stacktrace); printf("set stack: %s\n", rp->p_vmrequest.stacktrace);
minix_panic("RTS_VMREQTARGET not set for target", panic( "RTS_VMREQTARGET not set for target");
NO_NUM);
} }
#endif #endif
#endif #endif
@ -95,7 +94,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
(void *) rp->p_endpoint; (void *) rp->p_endpoint;
break; break;
default: default:
minix_panic("VMREQUEST wrong type", NO_NUM); panic("VMREQUEST wrong type");
} }
rp->p_vmrequest.vmresult = VMSUSPEND; rp->p_vmrequest.vmresult = VMSUSPEND;
@ -148,8 +147,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
printf("suspended with stack: %s\n", printf("suspended with stack: %s\n",
p->p_vmrequest.stacktrace); p->p_vmrequest.stacktrace);
#endif #endif
minix_panic("strange request type", panic( "strange request type: %d",p->p_vmrequest.type);
p->p_vmrequest.type);
} }
RTS_UNSET(p, RTS_VMREQUEST); RTS_UNSET(p, RTS_VMREQUEST);
@ -157,17 +155,17 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
case VMCTL_ENABLE_PAGING: case VMCTL_ENABLE_PAGING:
if(vm_running) if(vm_running)
minix_panic("do_vmctl: paging already enabled", NO_NUM); panic("do_vmctl: paging already enabled");
vm_init(p); vm_init(p);
if(!vm_running) if(!vm_running)
minix_panic("do_vmctl: paging enabling failed", NO_NUM); panic("do_vmctl: paging enabling failed");
vmassert(p->p_delivermsg_lin == vmassert(p->p_delivermsg_lin ==
umap_local(p, D, p->p_delivermsg_vir, sizeof(message))); umap_local(p, D, p->p_delivermsg_vir, sizeof(message)));
if ((err = arch_enable_paging()) != OK) { if ((err = arch_enable_paging()) != OK) {
return err; return err;
} }
if(newmap(caller, p, (struct mem_map *) m_ptr->SVMCTL_VALUE) != OK) if(newmap(caller, p, (struct mem_map *) m_ptr->SVMCTL_VALUE) != OK)
minix_panic("do_vmctl: newmap failed", NO_NUM); panic("do_vmctl: newmap failed");
FIXLINMSG(p); FIXLINMSG(p);
vmassert(p->p_delivermsg_lin); vmassert(p->p_delivermsg_lin);
return OK; return OK;

View file

@ -1,42 +1,35 @@
/* This file contains a collection of miscellaneous procedures: /* This file contains a collection of miscellaneous procedures:
* minix_panic: abort MINIX due to a fatal error * panic: abort MINIX due to a fatal error
* kputc: buffered putc used by kernel printf * kputc: buffered putc used by kernel printf
*/ */
#include "kernel.h" #include "kernel.h"
#include "proc.h" #include "proc.h"
#include <minix/syslib.h>
#include <unistd.h> #include <unistd.h>
#include <stdarg.h>
#include <signal.h> #include <signal.h>
#include <minix/sys_config.h> #include <minix/sys_config.h>
/*===========================================================================* #define ARE_PANICING 0xDEADC0FF
* panic *
*===========================================================================*/
PUBLIC void panic(char *what, char *mess,int nr)
{
/* This function is for when a library call wants to panic.
* The library call calls printf() and tries to exit a process,
* which isn't applicable in the kernel.
*/
minix_panic(mess, nr);
}
/*===========================================================================* /*===========================================================================*
* minix_panic * * panic *
*===========================================================================*/ *===========================================================================*/
PUBLIC void minix_panic(char *mess,int nr) PUBLIC void panic(const char *fmt, ...)
{ {
/* The system has run aground of a fatal kernel error. Terminate execution. */ va_list arg;
if (minix_panicing++) { /* The system has run aground of a fatal kernel error. Terminate execution. */
if (minix_panicing == ARE_PANICING) {
arch_monitor(); arch_monitor();
} }
minix_panicing = ARE_PANICING;
if (mess != NULL) { if (fmt != NULL) {
printf("kernel panic: %s", mess); printf("kernel panic: ");
if(nr != NO_NUM) va_start(arg, fmt);
printf(" %d", nr); vprintf(fmt, arg);
printf("\n"); printf("\n");
} }

View file

@ -103,7 +103,6 @@ SRCS= \
env_prefix.c \ env_prefix.c \
fkey_ctl.c \ fkey_ctl.c \
tsc_util.c \ tsc_util.c \
report.c \
read_tsc.S \ read_tsc.S \
read_tsc_64.c \ read_tsc_64.c \
ser_putc.c \ ser_putc.c \
@ -111,6 +110,7 @@ SRCS= \
sys_hz.c \ sys_hz.c \
timing.c \ timing.c \
profile_extern.c \ profile_extern.c \
profile.c profile.c \
vprintf.c
.include <minix.lib.mk> .include <minix.lib.mk>

View file

@ -68,7 +68,7 @@ void *alloc_contig(size_t len, int flags, phys_bytes *phys)
/* Get physical address, if requested. */ /* Get physical address, if requested. */
if(phys != NULL && sys_umap_data_fb(SELF, buf, len, phys) != OK) if(phys != NULL && sys_umap_data_fb(SELF, buf, len, phys) != OK)
panic("alloc_contig.c", "sys_umap_data_fb failed", NO_NUM); panic("sys_umap_data_fb failed");
return (void *) buf; return (void *) buf;
} }

View file

@ -9,6 +9,5 @@
#include <minix/sysutil.h> #include <minix/sysutil.h>
void __bad_assertion(const char *mess) { void __bad_assertion(const char *mess) {
printf("%s", mess); panic("%s", mess);
panic(NULL, NULL, NO_NUM);
} }

View file

@ -79,7 +79,7 @@ int fl;
/* Tell the kernel to stop processing */ /* Tell the kernel to stop processing */
r= senda(NULL, 0); r= senda(NULL, 0);
if (r != OK) if (r != OK)
panic(__FILE__, "asynsend: senda failed", r); panic("asynsend: senda failed: %d", r);
dst_ind= 0; dst_ind= 0;
for (src_ind= first_slot; src_ind<next_slot; src_ind++) for (src_ind= first_slot; src_ind<next_slot; src_ind++)
@ -112,7 +112,7 @@ int fl;
first_slot= 0; first_slot= 0;
next_slot= dst_ind; next_slot= dst_ind;
if (next_slot >= ASYN_NR) if (next_slot >= ASYN_NR)
panic(__FILE__, "asynsend: msgtable full", NO_NUM); panic("asynsend: msgtable full");
} }
fl |= AMF_VALID; fl |= AMF_VALID;

View file

@ -14,6 +14,6 @@ char *key; /* environment variable whose value is bogus */
printf("WARNING: env_get_param() failed in env_panic(): %d\n", s); printf("WARNING: env_get_param() failed in env_panic(): %d\n", s);
} }
printf("Bad environment setting: '%s = %s'\n", key, value); printf("Bad environment setting: '%s = %s'\n", key, value);
panic("","", NO_NUM); panic("");
} }

View file

@ -3,189 +3,19 @@
*/ */
#define nil 0 #define nil 0
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include <stddef.h> #include <stddef.h>
#include <limits.h> #include <limits.h>
#define isdigit(c) ((unsigned) ((c) - '0') < (unsigned) 10)
#if !__STDC__
/* Classic C stuff, ignore. */
void kputc();
int printf(fmt) char *fmt;
#else
/* Printf() uses kputc() to print characters. */
void kputc(int c);
#define count_kputc(c) do { charcount++; kputc(c); } while(0)
int printf(const char *fmt, ...) int printf(const char *fmt, ...)
#endif
{ {
int c, charcount = 0; int n;
enum { LEFT, RIGHT } adjust; va_list ap;
enum { LONG, INT } intsize;
int fill;
int width, max, len, base;
static char X2C_tab[]= "0123456789ABCDEF";
static char x2c_tab[]= "0123456789abcdef";
char *x2c;
char *p;
long i;
unsigned long u;
char temp[8 * sizeof(long) / 3 + 2];
va_list argp; va_start(ap, fmt);
n = vprintf(fmt, ap);
va_end(ap);
va_start(argp, fmt); return n;
while ((c= *fmt++) != 0) {
if (c != '%') {
/* Ordinary character. */
count_kputc(c);
continue;
}
/* Format specifier of the form:
* %[adjust][fill][width][.max]keys
*/
c= *fmt++;
adjust= RIGHT;
if (c == '-') {
adjust= LEFT;
c= *fmt++;
}
fill= ' ';
if (c == '0') {
fill= '0';
c= *fmt++;
}
width= 0;
if (c == '*') {
/* Width is specified as an argument, e.g. %*d. */
width= va_arg(argp, int);
c= *fmt++;
} else
if (isdigit(c)) {
/* A number tells the width, e.g. %10d. */
do {
width= width * 10 + (c - '0');
} while (isdigit(c= *fmt++));
}
max= INT_MAX;
if (c == '.') {
/* Max field length coming up. */
if ((c= *fmt++) == '*') {
max= va_arg(argp, int);
c= *fmt++;
} else
if (isdigit(c)) {
max= 0;
do {
max= max * 10 + (c - '0');
} while (isdigit(c= *fmt++));
}
}
/* Set a few flags to the default. */
x2c= x2c_tab;
i= 0;
base= 10;
intsize= INT;
if (c == 'l' || c == 'L') {
/* "Long" key, e.g. %ld. */
intsize= LONG;
c= *fmt++;
}
if (c == 0) break;
switch (c) {
/* Decimal. */
case 'd':
i= intsize == LONG ? va_arg(argp, long)
: va_arg(argp, int);
u= i < 0 ? -i : i;
goto int2ascii;
/* Octal. */
case 'o':
base= 010;
goto getint;
/* Pointer, interpret as %X or %lX. */
case 'p':
if (sizeof(char *) > sizeof(int)) intsize= LONG;
/* Hexadecimal. %X prints upper case A-F, not %lx. */
case 'X':
x2c= X2C_tab;
case 'x':
base= 0x10;
goto getint;
/* Unsigned decimal. */
case 'u':
getint:
u= intsize == LONG ? va_arg(argp, unsigned long)
: va_arg(argp, unsigned int);
int2ascii:
p= temp + sizeof(temp)-1;
*p= 0;
do {
*--p= x2c[(ptrdiff_t) (u % base)];
} while ((u /= base) > 0);
goto string_length;
/* A character. */
case 'c':
p= temp;
*p= va_arg(argp, int);
len= 1;
goto string_print;
/* Simply a percent. */
case '%':
p= temp;
*p= '%';
len= 1;
goto string_print;
/* A string. The other cases will join in here. */
case 's':
p= va_arg(argp, char *);
string_length:
for (len= 0; p[len] != 0 && len < max; len++) {}
string_print:
width -= len;
if (i < 0) width--;
if (fill == '0' && i < 0) count_kputc('-');
if (adjust == RIGHT) {
while (width > 0) { count_kputc(fill); width--; }
}
if (fill == ' ' && i < 0) count_kputc('-');
while (len > 0) { count_kputc((unsigned char) *p++); len--; }
while (width > 0) { count_kputc(fill); width--; }
break;
/* Unrecognized format key, echo it back. */
default:
count_kputc('%');
count_kputc(c);
}
}
/* Mark the end with a null (should be something else, like -1). */
kputc(0);
va_end(argp);
return charcount;
} }
/*
* $PchId: kprintf.c,v 1.5 1996/04/11 06:59:05 philip Exp $
*/

View file

@ -1,19 +1,15 @@
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <stdarg.h>
#include <minix/sysutil.h> #include <minix/sysutil.h>
#include "syslib.h" #include "syslib.h"
int panicing= 0;
/*===========================================================================* /*===========================================================================*
* panic * * panic *
*===========================================================================*/ *===========================================================================*/
PUBLIC void panic(who, mess, num) PUBLIC void panic(const char *fmt, ...)
char *who; /* server identification */
char *mess; /* message format string */
int num; /* number to go with format string */
{ {
/* Something awful has happened. Panics are caused when an internal /* Something awful has happened. Panics are caused when an internal
* inconsistency is detected, e.g., a programming error or illegal * inconsistency is detected, e.g., a programming error or illegal
@ -23,24 +19,29 @@ int num; /* number to go with format string */
endpoint_t me = NONE; endpoint_t me = NONE;
char name[20]; char name[20];
void (*suicide)(void); void (*suicide)(void);
static int panicing= 0;
va_list args;
if(panicing) return; if(panicing) return;
panicing= 1; panicing= 1;
if(sys_whoami(&me, name, sizeof(name)) == OK && me != NONE) if(sys_whoami(&me, name, sizeof(name)) == OK && me != NONE)
printf("%s(%d): ", name, me); printf("%s(%d): panic: ", name, me);
else else
printf("(sys_whoami failed): "); printf("(sys_whoami failed): panic: ");
if(fmt) {
va_start(args, fmt);
vprintf(fmt, args);
va_end(fmt);
} else {
printf("no message\n");
}
printf("\n");
printf("syslib:panic.c: stacktrace: "); printf("syslib:panic.c: stacktrace: ");
util_stacktrace(); util_stacktrace();
if (NULL != who && NULL != mess) {
if (num != NO_NUM) {
printf("Panic in %s: %s: %d\n", who, mess, num);
} else {
printf("Panic in %s: %s\n", who, mess);
}
}
/* Try exit */ /* Try exit */
_exit(1); _exit(1);

View file

@ -22,10 +22,10 @@ int port;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_attr_r16: can't talk to PCI", r); panic("pci_attr_r16: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_attr_r16: got bad reply from PCI", m.m_type); panic("pci_attr_r16: got bad reply from PCI: %d", m.m_type);
return m.m2_l1; return m.m2_l1;
} }

View file

@ -22,10 +22,10 @@ int port;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_attr_r32: can't talk to PCI", r); panic("pci_attr_r32: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_attr_r32: got bad reply from PCI", m.m_type); panic("pci_attr_r32: got bad reply from PCI: %d", m.m_type);
return m.m2_l1; return m.m2_l1;
} }

View file

@ -22,10 +22,10 @@ int port;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_attr_r8: can't talk to PCI", r); panic("pci_attr_r8: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_attr_r8: got bad reply from PCI", m.m_type); panic("pci_attr_r8: got bad reply from PCI: %d", m.m_type);
return m.m2_l1; return m.m2_l1;
} }

View file

@ -24,9 +24,9 @@ u16_t value;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_attr_w16: can't talk to PCI", r); panic("pci_attr_w16: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_attr_w16: got bad reply from PCI", m.m_type); panic("pci_attr_w16: got bad reply from PCI: %d", m.m_type);
} }

View file

@ -24,9 +24,9 @@ u32_t value;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_attr_w32: can't talk to PCI", r); panic("pci_attr_w32: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_attr_w32: got bad reply from PCI", m.m_type); panic("pci_attr_w32: got bad reply from PCI: %d", m.m_type);
} }

View file

@ -24,9 +24,9 @@ u8_t value;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_attr_w8: can't talk to PCI", r); panic("pci_attr_w8: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_attr_w8: got bad reply from PCI", m.m_type); panic("pci_attr_w8: got bad reply from PCI: %d", m.m_type);
} }

View file

@ -24,9 +24,7 @@ endpoint_t proc_ep;
r= ds_retrieve_label_num("pci", &u32); r= ds_retrieve_label_num("pci", &u32);
if (r != 0) if (r != 0)
{ {
panic("syslib/" __FILE__, panic("pci_del_acl: _pm_findproc failed for 'pci': %d", r);
"pci_del_acl: _pm_findproc failed for 'pci'",
r);
} }
pci_procnr = u32; pci_procnr = u32;
} }
@ -37,7 +35,7 @@ endpoint_t proc_ep;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_del_acl: can't talk to PCI", r); panic("pci_del_acl: can't talk to PCI: %d", r);
return m.m_type; return m.m_type;
} }

View file

@ -37,7 +37,7 @@ u16_t did;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
cpf_revoke(gid); cpf_revoke(gid);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_dev_name: can't talk to PCI", r); panic("pci_dev_name: can't talk to PCI: %d", r);
if (m.m_type == ENOENT) if (m.m_type == ENOENT)
{ {
@ -47,7 +47,7 @@ u16_t did;
return NULL; /* No name for this device */ return NULL; /* No name for this device */
} }
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_dev_name: got bad reply from PCI", m.m_type); panic("pci_dev_name: got bad reply from PCI: %d", m.m_type);
name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL
* terminated. * terminated.

View file

@ -25,7 +25,7 @@ int *devindp;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_find_dev: can't talk to PCI", r); panic("pci_find_dev: can't talk to PCI: %d", r);
if (m.m_type == 1) if (m.m_type == 1)
{ {
@ -35,7 +35,7 @@ int *devindp;
return 1; return 1;
} }
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_find_dev: got bad reply from PCI", m.m_type); panic("pci_find_dev: got bad reply from PCI: %d", m.m_type);
printf("pci_find_dev: got nothing\n"); printf("pci_find_dev: got nothing\n");
return 0; return 0;

View file

@ -20,7 +20,7 @@ u16_t *didp;
m.m_type= BUSC_PCI_FIRST_DEV; m.m_type= BUSC_PCI_FIRST_DEV;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_first_dev: can't talk to PCI", r); panic("pci_first_dev: can't talk to PCI: %d", r);
if (m.m_type == 1) if (m.m_type == 1)
{ {
*devindp= m.m1_i1; *devindp= m.m1_i1;
@ -33,7 +33,7 @@ u16_t *didp;
return 1; return 1;
} }
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_first_dev: got bad reply from PCI", m.m_type); panic("pci_first_dev: got bad reply from PCI: %d", m.m_type);
#if DEBUG #if DEBUG
printf("pci_first_dev: got nothing\n"); printf("pci_first_dev: got nothing\n");

View file

@ -22,10 +22,10 @@ u16_t *didp;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_ids: can't talk to PCI", r); panic("pci_ids: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_ids: got bad reply from PCI", m.m_type); panic("pci_ids: got bad reply from PCI: %d", m.m_type);
*vidp= m.m1_i1; *vidp= m.m1_i1;
*didp= m.m1_i2; *didp= m.m1_i2;
printf("pci_ids: %04x/%04x\n", *vidp, *didp); printf("pci_ids: %04x/%04x\n", *vidp, *didp);

View file

@ -24,7 +24,7 @@ char *name;
r= ds_retrieve_label_num("pci", &u32); r= ds_retrieve_label_num("pci", &u32);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_init1: ds_retrieve_label_num failed for 'pci'", r); panic("pci_init1: ds_retrieve_label_num failed for 'pci': %d", r);
pci_procnr= u32; pci_procnr= u32;
m.m_type= BUSC_PCI_INIT; m.m_type= BUSC_PCI_INIT;
@ -39,8 +39,8 @@ char *name;
} }
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_init1: can't talk to PCI", r); panic("pci_init1: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_init1: got bad reply from PCI", m.m_type); panic("pci_init1: got bad reply from PCI: %d", m.m_type);
} }

View file

@ -22,7 +22,7 @@ u16_t *didp;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_next_dev: can't talk to PCI", r); panic("pci_next_dev: can't talk to PCI: %d", r);
if (m.m_type == 1) if (m.m_type == 1)
{ {
@ -36,7 +36,7 @@ u16_t *didp;
return 1; return 1;
} }
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_next_dev: got bad reply from PCI", m.m_type); panic("pci_next_dev: got bad reply from PCI: %d", m.m_type);
return 0; return 0;
} }

View file

@ -20,12 +20,11 @@ u8_t busnr;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_rescan_bus: can't talk to PCI", r); panic("pci_rescan_bus: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
{ {
panic("syslib/" __FILE__, "pci_rescan_bus: got bad reply from PCI", panic("pci_rescan_bus: got bad reply from PCI: %d", m.m_type);
m.m_type);
} }
} }

View file

@ -20,10 +20,10 @@ int devind;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_reserve: can't talk to PCI", r); panic("pci_reserve: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_reserve: got bad reply from PCI", m.m_type); panic("pci_reserve: got bad reply from PCI: %d", m.m_type);
} }
/*===========================================================================* /*===========================================================================*

View file

@ -25,9 +25,7 @@ struct rs_pci *rs_pci;
r= ds_retrieve_label_num("pci", &u32); r= ds_retrieve_label_num("pci", &u32);
if (r != 0) if (r != 0)
{ {
panic("syslib/" __FILE__, panic("pci_set_acl: ds_retrieve_label_num failed for 'pci': %d", r);
"pci_set_acl: ds_retrieve_label_num failed for 'pci'",
r);
} }
pci_procnr = u32; pci_procnr = u32;
} }
@ -48,7 +46,7 @@ struct rs_pci *rs_pci;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
cpf_revoke(gid); cpf_revoke(gid);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_set_acl: can't talk to PCI", r); panic("pci_set_acl: can't talk to PCI: %d", r);
return m.m_type; return m.m_type;
} }

View file

@ -35,10 +35,10 @@ int devind;
r= sendrec(pci_procnr, &m); r= sendrec(pci_procnr, &m);
cpf_revoke(gid); cpf_revoke(gid);
if (r != 0) if (r != 0)
panic("syslib/" __FILE__, "pci_slot_name: can't talk to PCI", r); panic("pci_slot_name: can't talk to PCI: %d", r);
if (m.m_type != 0) if (m.m_type != 0)
panic("syslib/" __FILE__, "pci_slot_name: got bad reply from PCI", m.m_type); panic("pci_slot_name: got bad reply from PCI: %d", m.m_type);
name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL
* terminated. * terminated.

View file

@ -1,20 +0,0 @@
#include "sysutil.h"
/*===========================================================================*
* report *
*===========================================================================*/
PUBLIC void report(who, mess, num)
char *who; /* server identification */
char *mess; /* message format to print */
int num; /* number to go with the message */
{
/* Display a message for a server. */
if (num != NO_NUM) {
printf("%s: %s %d\n", who, mess, num);
} else {
printf("%s: %s\n", who, mess);
}
}

View file

@ -48,22 +48,22 @@ PUBLIC void sef_startup()
/* Intercept SEF Init requests. */ /* Intercept SEF Init requests. */
if(sef_self_endpoint == RS_PROC_NR) { if(sef_self_endpoint == RS_PROC_NR) {
if((r = do_sef_rs_init()) != OK) { if((r = do_sef_rs_init()) != OK) {
panic("SEF", "unable to complete init", r); panic("unable to complete init: %d", r);
} }
} }
else { else {
message m; message m;
if((r = receive(RS_PROC_NR, &m)) != OK) { if((r = receive(RS_PROC_NR, &m)) != OK) {
panic("SEF", "unable to receive from RS", r); panic("unable to receive from RS: %d", r);
} }
if(IS_SEF_INIT_REQUEST(&m)) { if(IS_SEF_INIT_REQUEST(&m)) {
if((r = do_sef_init_request(&m)) != OK) { if((r = do_sef_init_request(&m)) != OK) {
panic("SEF", "unable to process init request", r); panic("unable to process init request: %d", r);
} }
} }
else { else {
panic("SEF", "unable to receive init request", NO_NUM); panic("unable to receive init request");
} }
} }
#endif #endif

View file

@ -122,7 +122,7 @@ PUBLIC void sef_lu_ready(int result)
m.RS_LU_RESULT = result; m.RS_LU_RESULT = result;
r = sendrec(RS_PROC_NR, &m); r = sendrec(RS_PROC_NR, &m);
if ( r != OK) { if ( r != OK) {
panic("SEF", "sendrec failed", r); panic("sendrec failed: %d", r);
} }
} }

View file

@ -22,7 +22,7 @@ void util_timer_start(util_timingdata_t *timingdata, char *name)
} }
if (timingdata->starttimes[HIGHCOUNT]) { if (timingdata->starttimes[HIGHCOUNT]) {
panic(__FILE__, "restart timer?", NO_NUM); panic("restart timer?");
return; return;
} }
@ -37,7 +37,7 @@ void util_timer_end(util_timingdata_t *timingdata)
read_tsc(&h, &l); read_tsc(&h, &l);
if (!timingdata->starttimes[HIGHCOUNT]) { if (!timingdata->starttimes[HIGHCOUNT]) {
panic(__FILE__, "timer stopped but not started", NO_NUM); panic("timer stopped but not started");
return; return;
} }
if (timingdata->starttimes[HIGHCOUNT] == h) { if (timingdata->starttimes[HIGHCOUNT] == h) {
@ -73,7 +73,7 @@ void util_timer_end(util_timingdata_t *timingdata)
timingdata->binsize; timingdata->binsize;
if (bin < 0 || bin >= TIMING_POINTS) { if (bin < 0 || bin >= TIMING_POINTS) {
/* not serious, but can't happen, so shouldn't */ /* not serious, but can't happen, so shouldn't */
panic(__FILE__, "bin out of range", bin); panic("bin out of range: %d", bin);
} else { } else {
timingdata->lock_timings[bin]++; timingdata->lock_timings[bin]++;
timingdata->measurements++; timingdata->measurements++;

View file

@ -17,7 +17,7 @@
if(!calibrated) { \ if(!calibrated) { \
int r; \ int r; \
if((r=tsc_calibrate()) != OK) \ if((r=tsc_calibrate()) != OK) \
panic(__FILE__, "calibrate failed\n", r); \ panic("calibrate failed: %d", r); \
} }
static u32_t calib_tsc, Hz = 0; static u32_t calib_tsc, Hz = 0;
@ -48,9 +48,7 @@ tsc_calibrate(void)
diff = sub64(end, start); diff = sub64(end, start);
if(ex64hi(diff) != 0) if(ex64hi(diff) != 0)
panic(__FILE__, panic("tsc_calibrate: CALIBRATE_TICKS too high for TSC frequency");
"tsc_calibrate: CALIBRATE_TICKS too high "
"for TSC frequency\n", NO_NUM);
calib_tsc = ex64lo(diff); calib_tsc = ex64lo(diff);
#if 0 #if 0
printf("tsc_calibrate: " printf("tsc_calibrate: "

175
lib/libsys/vprintf.c Normal file
View file

@ -0,0 +1,175 @@
#include <stdarg.h>
#include <stddef.h>
#include <ctype.h>
#include <limits.h>
/* vprintf() uses kputc() to print characters. */
void kputc(int c);
#define count_kputc(c) do { charcount++; kputc(c); } while(0)
int vprintf(const char *fmt, va_list argp)
{
int c, charcount = 0;
enum { LEFT, RIGHT } adjust;
enum { LONG, INT } intsize;
int fill;
int width, max, len, base;
static char X2C_tab[]= "0123456789ABCDEF";
static char x2c_tab[]= "0123456789abcdef";
char *x2c;
char *p;
long i;
unsigned long u;
char temp[8 * sizeof(long) / 3 + 2];
while ((c= *fmt++) != 0) {
if (c != '%') {
/* Ordinary character. */
count_kputc(c);
continue;
}
/* Format specifier of the form:
* %[adjust][fill][width][.max]keys
*/
c= *fmt++;
adjust= RIGHT;
if (c == '-') {
adjust= LEFT;
c= *fmt++;
}
fill= ' ';
if (c == '0') {
fill= '0';
c= *fmt++;
}
width= 0;
if (c == '*') {
/* Width is specified as an argument, e.g. %*d. */
width= va_arg(argp, int);
c= *fmt++;
} else
if (isdigit(c)) {
/* A number tells the width, e.g. %10d. */
do {
width= width * 10 + (c - '0');
} while (isdigit(c= *fmt++));
}
max= INT_MAX;
if (c == '.') {
/* Max field length coming up. */
if ((c= *fmt++) == '*') {
max= va_arg(argp, int);
c= *fmt++;
} else
if (isdigit(c)) {
max= 0;
do {
max= max * 10 + (c - '0');
} while (isdigit(c= *fmt++));
}
}
/* Set a few flags to the default. */
x2c= x2c_tab;
i= 0;
base= 10;
intsize= INT;
if (c == 'l' || c == 'L') {
/* "Long" key, e.g. %ld. */
intsize= LONG;
c= *fmt++;
}
if (c == 0) break;
switch (c) {
/* Decimal. */
case 'd':
i= intsize == LONG ? va_arg(argp, long)
: va_arg(argp, int);
u= i < 0 ? -i : i;
goto int2ascii;
/* Octal. */
case 'o':
base= 010;
goto getint;
/* Pointer, interpret as %X or %lX. */
case 'p':
if (sizeof(char *) > sizeof(int)) intsize= LONG;
/* Hexadecimal. %X prints upper case A-F, not %lx. */
case 'X':
x2c= X2C_tab;
case 'x':
base= 0x10;
goto getint;
/* Unsigned decimal. */
case 'u':
getint:
u= intsize == LONG ? va_arg(argp, unsigned long)
: va_arg(argp, unsigned int);
int2ascii:
p= temp + sizeof(temp)-1;
*p= 0;
do {
*--p= x2c[(ptrdiff_t) (u % base)];
} while ((u /= base) > 0);
goto string_length;
/* A character. */
case 'c':
p= temp;
*p= va_arg(argp, int);
len= 1;
goto string_print;
/* Simply a percent. */
case '%':
p= temp;
*p= '%';
len= 1;
goto string_print;
/* A string. The other cases will join in here. */
case 's':
p= va_arg(argp, char *);
string_length:
for (len= 0; p[len] != 0 && len < max; len++) {}
string_print:
width -= len;
if (i < 0) width--;
if (fill == '0' && i < 0) count_kputc('-');
if (adjust == RIGHT) {
while (width > 0) { count_kputc(fill); width--; }
}
if (fill == ' ' && i < 0) count_kputc('-');
while (len > 0) { count_kputc((unsigned char) *p++); len--; }
while (width > 0) { count_kputc(fill); width--; }
break;
/* Unrecognized format key, echo it back. */
default:
count_kputc('%');
count_kputc(c);
}
}
/* Mark the end with a null (should be something else, like -1). */
kputc(0);
return charcount;
}
/*
* $PchId: kprintf.c,v 1.5 1996/04/11 06:59:05 philip Exp $
*/

View file

@ -52,7 +52,7 @@ PUBLIC int main(int argc, char **argv)
sig_handler(); sig_handler();
break; break;
default: default:
report("DS","warning, got illegal notify from:", printf("DS: warning, got illegal notify from: %d\n",
m.m_source); m.m_source);
result = EINVAL; result = EINVAL;
goto send_reply; goto send_reply;
@ -87,7 +87,7 @@ PUBLIC int main(int argc, char **argv)
result = do_getsysinfo(&m); result = do_getsysinfo(&m);
break; break;
default: default:
report("DS","warning, got illegal request from:", m.m_source); printf("DS: warning, got illegal request from %d\n", m.m_source);
result = EINVAL; result = EINVAL;
} }
@ -153,7 +153,7 @@ message *m_ptr; /* message buffer */
int status = 0; int status = 0;
status = sef_receive(ANY, m_ptr); /* this blocks until message arrives */ status = sef_receive(ANY, m_ptr); /* this blocks until message arrives */
if (OK != status) if (OK != status)
panic("DS","failed to receive message!", status); panic("failed to receive message!: %d", status);
who_e = m_ptr->m_source; /* message arrived! set sender */ who_e = m_ptr->m_source; /* message arrived! set sender */
callnr = m_ptr->m_type; /* set function call number */ callnr = m_ptr->m_type; /* set function call number */
} }

View file

@ -266,12 +266,12 @@ PUBLIC int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Map all the services in the boot image. */ /* Map all the services in the boot image. */
if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0, if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) { (vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {
panic("DS", "sys_safecopyfrom failed", r); panic("sys_safecopyfrom failed: %d", r);
} }
for(i=0;i < NR_BOOT_PROCS;i++) { for(i=0;i < NR_BOOT_PROCS;i++) {
if(rprocpub[i].in_use) { if(rprocpub[i].in_use) {
if((r = map_service(&rprocpub[i])) != OK) { if((r = map_service(&rprocpub[i])) != OK) {
panic("DS", "unable to map service", r); panic("unable to map service: %d", r);
} }
} }
} }

View file

@ -120,7 +120,7 @@ struct inode *ino;
ino->i_ref++; ino->i_ref++;
if (ino->i_ref == 0) if (ino->i_ref == 0)
panic("HGFS", "inode reference count wrapped", NO_NUM); panic("inode reference count wrapped");
} }
/*===========================================================================* /*===========================================================================*

View file

@ -176,7 +176,7 @@ endpoint_t *who_e;
int r; int r;
if ((r = sef_receive(ANY, &m_in)) != OK) if ((r = sef_receive(ANY, &m_in)) != OK)
panic("HGFS", "receive failed", r); panic("receive failed: %d", r);
*who_e = m_in.m_source; *who_e = m_in.m_source;

View file

@ -329,7 +329,7 @@ PUBLIC void inet_panic()
{ {
printf("\ninet stacktrace: "); printf("\ninet stacktrace: ");
util_stacktrace(); util_stacktrace();
(panic)("INET","aborted due to a panic",NO_NUM); (panic)("aborted due to a panic");
for(;;); for(;;);
} }

View file

@ -63,7 +63,7 @@ int map;
else s = fkey_unmap(&fkeys, &sfkeys); else s = fkey_unmap(&fkeys, &sfkeys);
if (s != OK) if (s != OK)
report("IS", "warning, fkey_ctl failed:", s); printf("IS: warning, fkey_ctl failed: %d\n", s);
} }
/*===========================================================================* /*===========================================================================*
@ -82,7 +82,7 @@ message *m; /* notification message */
m->m_type = FKEY_CONTROL; m->m_type = FKEY_CONTROL;
m->FKEY_REQUEST = FKEY_EVENTS; m->FKEY_REQUEST = FKEY_EVENTS;
if (OK != (s=sendrec(TTY_PROC_NR, m))) if (OK != (s=sendrec(TTY_PROC_NR, m)))
report("IS", "warning, sendrec to TTY failed", s); printf("IS: warning, sendrec to TTY failed: %d\n", s);
/* Now check which keys were pressed: F1-F12, SF1-SF12. */ /* Now check which keys were pressed: F1-F12, SF1-SF12. */
for(h=0; h < NHOOKS; h++) for(h=0; h < NHOOKS; h++)

Some files were not shown because too many files have changed in this diff Show more