Cleaned up src/lib/utils library. Renamed server_ functions to more logical
names. All system processes can now either use panic() or report() from libutils, or redefine their own function. Assertions are done via the standard <assert.h> functionality.
This commit is contained in:
parent
75689debe3
commit
6d23f072f3
|
@ -44,7 +44,7 @@ a = $d/drivers.h $b/interrupt.h $b/bios.h \
|
||||||
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
||||||
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
||||||
$m/syslib.h $s/types.h \
|
$m/syslib.h $s/types.h \
|
||||||
$m/utils.h $m/serverassert.h $m/devio.h
|
$m/utils.h $m/devio.h
|
||||||
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
|
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,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 */
|
||||||
if ((s=sys_vircopy(SELF, BIOS_SEG, NR_HD_DRIVES_ADDR,
|
if ((s=sys_vircopy(SELF, BIOS_SEG, NR_HD_DRIVES_ADDR,
|
||||||
SELF, D, (vir_bytes) params, NR_HD_DRIVES_SIZE)) != OK)
|
SELF, D, (vir_bytes) params, NR_HD_DRIVES_SIZE)) != OK)
|
||||||
server_panic(w_name(), "Couldn't read BIOS", s);
|
panic(w_name(), "Couldn't read BIOS", 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 < MAX_DRIVES; drive++, wn++) {
|
for (drive = 0, wn = wini; drive < MAX_DRIVES; drive++, wn++) {
|
||||||
|
@ -275,13 +275,13 @@ PRIVATE void init_params()
|
||||||
size = (drive == 0) ? BIOS_HD0_PARAMS_SIZE:BIOS_HD1_PARAMS_SIZE;
|
size = (drive == 0) ? BIOS_HD0_PARAMS_SIZE:BIOS_HD1_PARAMS_SIZE;
|
||||||
if ((s=sys_vircopy(SELF, BIOS_SEG, vector,
|
if ((s=sys_vircopy(SELF, BIOS_SEG, vector,
|
||||||
SELF, D, (vir_bytes) parv, size)) != OK)
|
SELF, D, (vir_bytes) parv, size)) != OK)
|
||||||
server_panic(w_name(), "Couldn't read BIOS", s);
|
panic(w_name(), "Couldn't read BIOS", s);
|
||||||
|
|
||||||
/* Calculate the address of the parameters and copy them */
|
/* Calculate the address of the parameters and copy them */
|
||||||
if ((s=sys_vircopy(
|
if ((s=sys_vircopy(
|
||||||
SELF, BIOS_SEG, hclick_to_physb(parv[1]) + parv[0],
|
SELF, BIOS_SEG, hclick_to_physb(parv[1]) + parv[0],
|
||||||
SELF, D, (phys_bytes) params, 16L))!=OK)
|
SELF, D, (phys_bytes) params, 16L))!=OK)
|
||||||
server_panic(w_name(),"Couldn't copy parameters", s);
|
panic(w_name(),"Couldn't copy parameters", 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);
|
||||||
|
@ -393,7 +393,7 @@ PRIVATE int w_identify()
|
||||||
|
|
||||||
/* Device information. */
|
/* Device information. */
|
||||||
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK)
|
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK)
|
||||||
server_panic(w_name(),"Call to sys_insw() failed", s);
|
panic(w_name(),"Call to sys_insw() failed", s);
|
||||||
|
|
||||||
/* Why are the strings byte swapped??? */
|
/* Why are the strings byte swapped??? */
|
||||||
for (i = 0; i < 40; i++) id_string[i] = id_byte(27)[i^1];
|
for (i = 0; i < 40; i++) id_string[i] = id_byte(27)[i^1];
|
||||||
|
@ -430,7 +430,7 @@ PRIVATE int w_identify()
|
||||||
|
|
||||||
/* Device information. */
|
/* Device information. */
|
||||||
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, 512)) != OK)
|
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, 512)) != OK)
|
||||||
server_panic(w_name(),"Call to sys_insw() failed", s);
|
panic(w_name(),"Call to sys_insw() failed", s);
|
||||||
|
|
||||||
/* Why are the strings byte swapped??? */
|
/* Why are the strings byte swapped??? */
|
||||||
for (i = 0; i < 40; i++) id_string[i] = id_byte(27)[i^1];
|
for (i = 0; i < 40; i++) id_string[i] = id_byte(27)[i^1];
|
||||||
|
@ -463,9 +463,9 @@ PRIVATE int w_identify()
|
||||||
/* Everything looks OK; register IRQ so we can stop polling. */
|
/* Everything looks OK; register IRQ so we can stop polling. */
|
||||||
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;
|
||||||
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)
|
||||||
server_panic("AT", "coudn't set IRQ policy", s);
|
panic(w_name(), "coudn't set IRQ policy", s);
|
||||||
if ((s=sys_irqenable(&wn->irq_hook_id)) != OK)
|
if ((s=sys_irqenable(&wn->irq_hook_id)) != OK)
|
||||||
server_panic("AT", "coudn't enable IRQ line", s);
|
panic(w_name(), "coudn't enable IRQ line", s);
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ unsigned nr_req; /* length of request vector */
|
||||||
/* An error, send data to the bit bucket. */
|
/* An error, send data to the bit bucket. */
|
||||||
if (w_status & STATUS_DRQ) {
|
if (w_status & STATUS_DRQ) {
|
||||||
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK)
|
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK)
|
||||||
server_panic(w_name(),"Call to sys_insw() failed", s);
|
panic(w_name(),"Call to sys_insw() failed", s);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -617,10 +617,10 @@ unsigned nr_req; /* length of request vector */
|
||||||
/* Copy bytes to or from the device's buffer. */
|
/* Copy bytes to or from the device's buffer. */
|
||||||
if (opcode == DEV_GATHER) {
|
if (opcode == DEV_GATHER) {
|
||||||
if ((s=sys_insw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, SECTOR_SIZE)) != OK)
|
if ((s=sys_insw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, SECTOR_SIZE)) != OK)
|
||||||
server_panic(w_name(),"Call to sys_insw() failed", s);
|
panic(w_name(),"Call to sys_insw() failed", s);
|
||||||
} else {
|
} else {
|
||||||
if ((s=sys_outsw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, SECTOR_SIZE)) != OK)
|
if ((s=sys_outsw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, SECTOR_SIZE)) != OK)
|
||||||
server_panic(w_name(),"Call to sys_insw() failed", s);
|
panic(w_name(),"Call to sys_insw() failed", s);
|
||||||
|
|
||||||
/* Data sent, wait for an interrupt. */
|
/* Data sent, wait for an interrupt. */
|
||||||
if ((r = at_intr_wait()) != OK) break;
|
if ((r = at_intr_wait()) != OK) break;
|
||||||
|
@ -668,7 +668,7 @@ struct command *cmd; /* Command block */
|
||||||
|
|
||||||
/* Select drive. */
|
/* Select drive. */
|
||||||
if ((s=sys_outb(base + REG_LDH, cmd->ldh)) != OK)
|
if ((s=sys_outb(base + REG_LDH, cmd->ldh)) != OK)
|
||||||
server_panic(w_name(),"Couldn't write register to select drive",s);
|
panic(w_name(),"Couldn't write register to select drive",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());
|
||||||
|
@ -693,7 +693,7 @@ struct command *cmd; /* Command block */
|
||||||
pv_set(outbyte[5], base + REG_CYL_HI, cmd->cyl_hi);
|
pv_set(outbyte[5], base + REG_CYL_HI, cmd->cyl_hi);
|
||||||
pv_set(outbyte[6], base + REG_COMMAND, cmd->command);
|
pv_set(outbyte[6], base + REG_COMMAND, cmd->command);
|
||||||
if ((s=sys_voutb(outbyte,7)) != OK)
|
if ((s=sys_voutb(outbyte,7)) != OK)
|
||||||
server_panic("AT_WINI","Couldn't write registers with sys_voutb()",s);
|
panic(w_name(),"Couldn't write registers with sys_voutb()",s);
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,16 +788,15 @@ PRIVATE int w_reset()
|
||||||
struct wini *wn;
|
struct wini *wn;
|
||||||
|
|
||||||
/* Wait for any internal drive recovery. */
|
/* Wait for any internal drive recovery. */
|
||||||
tick_delay(RECOVERY_TICKS);
|
tickdelay(RECOVERY_TICKS);
|
||||||
|
|
||||||
|
|
||||||
/* Strobe reset bit */
|
/* Strobe reset bit */
|
||||||
if ((s=sys_outb(wn->base + REG_CTL, CTL_RESET)) != OK)
|
if ((s=sys_outb(wn->base + REG_CTL, CTL_RESET)) != OK)
|
||||||
server_panic("AT_WINI","Couldn't strobe reset bit",s);
|
panic(w_name(),"Couldn't strobe reset bit",s);
|
||||||
tick_delay(DELAY_TICKS);
|
tickdelay(DELAY_TICKS);
|
||||||
if ((s=sys_outb(wn->base + REG_CTL, 0)) != OK)
|
if ((s=sys_outb(wn->base + REG_CTL, 0)) != OK)
|
||||||
server_panic("AT_WINI","Couldn't strobe reset bit",s);
|
panic(w_name(),"Couldn't strobe reset bit",s);
|
||||||
tick_delay(DELAY_TICKS);
|
tickdelay(DELAY_TICKS);
|
||||||
|
|
||||||
/* Wait for controller ready */
|
/* Wait for controller ready */
|
||||||
if (!w_waitfor(STATUS_BSY, 0)) {
|
if (!w_waitfor(STATUS_BSY, 0)) {
|
||||||
|
@ -858,7 +857,7 @@ PRIVATE int at_intr_wait()
|
||||||
r = OK;
|
r = OK;
|
||||||
} else {
|
} else {
|
||||||
if ((s=sys_inb(w_wn->base + REG_ERROR, &inbval)) != OK)
|
if ((s=sys_inb(w_wn->base + REG_ERROR, &inbval)) != OK)
|
||||||
server_panic(w_name(),"Couldn't read register",s);
|
panic(w_name(),"Couldn't read register",s);
|
||||||
if ((w_status & STATUS_ERR) && (inbval & ERROR_BB)) {
|
if ((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 {
|
||||||
|
@ -887,7 +886,7 @@ int value; /* required status */
|
||||||
getuptime(&t0);
|
getuptime(&t0);
|
||||||
do {
|
do {
|
||||||
if ((s=sys_inb(w_wn->base + REG_STATUS, &w_status)) != OK)
|
if ((s=sys_inb(w_wn->base + REG_STATUS, &w_status)) != OK)
|
||||||
server_panic(w_name(),"Couldn't read register",s);
|
panic(w_name(),"Couldn't read register",s);
|
||||||
if ((w_status & mask) == value) {
|
if ((w_status & mask) == value) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1027,7 +1026,7 @@ unsigned nr_req; /* length of request vector */
|
||||||
if (chunk > count) chunk = count;
|
if (chunk > count) chunk = count;
|
||||||
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
|
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
|
||||||
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, chunk)) != OK)
|
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, chunk)) != OK)
|
||||||
server_panic(w_name(),"Call to sys_insw() failed", s);
|
panic(w_name(),"Call to sys_insw() failed", s);
|
||||||
before -= chunk;
|
before -= chunk;
|
||||||
count -= chunk;
|
count -= chunk;
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +1036,7 @@ unsigned nr_req; /* length of request vector */
|
||||||
if (chunk > count) chunk = count;
|
if (chunk > count) chunk = count;
|
||||||
if (chunk > iov->iov_size) chunk = iov->iov_size;
|
if (chunk > iov->iov_size) chunk = iov->iov_size;
|
||||||
if ((s=sys_insw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, chunk)) != OK)
|
if ((s=sys_insw(wn->base + REG_DATA, proc_nr, (void *) iov->iov_addr, chunk)) != OK)
|
||||||
server_panic(w_name(),"Call to sys_insw() failed", s);
|
panic(w_name(),"Call to sys_insw() failed", s);
|
||||||
position += chunk;
|
position += chunk;
|
||||||
nbytes -= chunk;
|
nbytes -= chunk;
|
||||||
count -= chunk;
|
count -= chunk;
|
||||||
|
@ -1054,7 +1053,7 @@ unsigned nr_req; /* length of request vector */
|
||||||
chunk = count;
|
chunk = count;
|
||||||
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
|
if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE;
|
||||||
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, chunk)) != OK)
|
if ((s=sys_insw(wn->base + REG_DATA, SELF, tmp_buf, chunk)) != OK)
|
||||||
server_panic(w_name(),"Call to sys_insw() failed", s);
|
panic(w_name(),"Call to sys_insw() failed", s);
|
||||||
count -= chunk;
|
count -= chunk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1087,7 +1086,7 @@ unsigned cnt;
|
||||||
|
|
||||||
/* Select Master/Slave drive */
|
/* Select Master/Slave drive */
|
||||||
if ((s=sys_outb(wn->base + REG_DRIVE, wn->ldhpref)) != OK)
|
if ((s=sys_outb(wn->base + REG_DRIVE, wn->ldhpref)) != OK)
|
||||||
server_panic("AT_WINI","Couldn't select master/ slave drive",s);
|
panic(w_name(),"Couldn't select master/ slave drive",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());
|
||||||
|
@ -1114,7 +1113,7 @@ unsigned cnt;
|
||||||
pv_set(outbyte[4], wn->base + REG_CNT_HI, (cnt >> 8) & 0xFF);
|
pv_set(outbyte[4], wn->base + REG_CNT_HI, (cnt >> 8) & 0xFF);
|
||||||
pv_set(outbyte[5], wn->base + REG_COMMAND, w_command);
|
pv_set(outbyte[5], wn->base + REG_COMMAND, w_command);
|
||||||
if ((s=sys_voutb(outbyte,6)) != OK)
|
if ((s=sys_voutb(outbyte,6)) != OK)
|
||||||
server_panic("AT_WINI","Couldn't write registers with sys_voutb()",s);
|
panic(w_name(),"Couldn't write registers with sys_voutb()",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");
|
printf("%s: timeout (BSY|DRQ -> DRQ)\n");
|
||||||
|
@ -1124,7 +1123,7 @@ unsigned cnt;
|
||||||
|
|
||||||
/* Send the command packet to the device. */
|
/* Send the command packet to the device. */
|
||||||
if ((s=sys_outsw(wn->base + REG_DATA, SELF, packet, 12)) != OK)
|
if ((s=sys_outsw(wn->base + REG_DATA, SELF, packet, 12)) != OK)
|
||||||
server_panic(w_name(),"sys_outsw() failed", s);
|
panic(w_name(),"sys_outsw() failed", s);
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1153,7 +1152,7 @@ PRIVATE int atapi_intr_wait()
|
||||||
inbyte[2].port = wn->base + REG_CNT_HI;
|
inbyte[2].port = wn->base + REG_CNT_HI;
|
||||||
inbyte[3].port = wn->base + REG_IRR;
|
inbyte[3].port = wn->base + REG_IRR;
|
||||||
if ((s=sys_vinb(inbyte, 4)) != OK)
|
if ((s=sys_vinb(inbyte, 4)) != OK)
|
||||||
server_panic(w_name(),"ATAPI failed sys_vinb()", s);
|
panic(w_name(),"ATAPI failed sys_vinb()", 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;
|
||||||
|
|
|
@ -43,7 +43,7 @@ a = $d/drivers.h $b/interrupt.h $b/bios.h \
|
||||||
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
||||||
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
||||||
$m/syslib.h $s/types.h \
|
$m/syslib.h $s/types.h \
|
||||||
$m/utils.h $m/serverassert.h $m/devio.h
|
$m/utils.h $m/devio.h
|
||||||
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
|
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -299,9 +299,9 @@ PUBLIC void main()
|
||||||
|
|
||||||
/* Set IRQ policy, only request notifications. */
|
/* Set IRQ policy, only request notifications. */
|
||||||
if ((s=sys_irqsetpolicy(FLOPPY_IRQ, 0, &irq_hook_id )) != OK)
|
if ((s=sys_irqsetpolicy(FLOPPY_IRQ, 0, &irq_hook_id )) != OK)
|
||||||
server_panic("FLOPPY", "Couldn't set IRQ policy", s);
|
panic("FLOPPY", "Couldn't set IRQ policy", s);
|
||||||
if ((s=sys_irqenable(&irq_hook_id)) != OK)
|
if ((s=sys_irqenable(&irq_hook_id)) != OK)
|
||||||
server_panic("FLOPPY", "Couldn't enable IRQs", s);
|
panic("FLOPPY", "Couldn't enable IRQs", s);
|
||||||
|
|
||||||
printf("FLOPPY: user-level floppy disk driver initialized\n");
|
printf("FLOPPY: user-level floppy disk driver initialized\n");
|
||||||
driver_task(&f_dtab);
|
driver_task(&f_dtab);
|
||||||
|
@ -322,7 +322,7 @@ PRIVATE void f_expire_tmrs(struct driver *dp)
|
||||||
|
|
||||||
/* Get the current time to compare the timers against. */
|
/* Get the current time to compare the timers against. */
|
||||||
if ((s=sys_getuptime(&now)) != OK)
|
if ((s=sys_getuptime(&now)) != OK)
|
||||||
server_panic("FLOPPY","Couldn't get uptime from clock.", s);
|
panic("FLOPPY","Couldn't get uptime from clock.", 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()
|
||||||
|
@ -334,7 +334,7 @@ PRIVATE void f_expire_tmrs(struct driver *dp)
|
||||||
} 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_syncalrm(SELF, f_next_timeout, 1)) != OK)
|
if ((s=sys_syncalrm(SELF, f_next_timeout, 1)) != OK)
|
||||||
server_panic("FLOPPY","Couldn't set synchronous alarm.", s);
|
panic("FLOPPY","Couldn't set synchronous alarm.", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ tmr_func_t watchdog; /* watchdog function to be called */
|
||||||
|
|
||||||
/* Get the current time. */
|
/* Get the current time. */
|
||||||
if ((s=sys_getuptime(&now)) != OK)
|
if ((s=sys_getuptime(&now)) != OK)
|
||||||
server_panic("FLOPPY","Couldn't get uptime from clock.", s);
|
panic("FLOPPY","Couldn't get uptime from clock.", 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);
|
tmrs_settimer(&f_timers, tp, now + delta, watchdog);
|
||||||
|
@ -363,7 +363,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_syncalrm(SELF, f_next_timeout, 1)) != OK)
|
if ((s=sys_syncalrm(SELF, f_next_timeout, 1)) != OK)
|
||||||
server_panic("FLOPPY","Couldn't set synchronous alarm.", s);
|
panic("FLOPPY","Couldn't set synchronous alarm.", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ unsigned nr_req; /* length of request vector */
|
||||||
if ((s=sys_datacopy(proc_nr, iov->iov_addr + SECTOR_SIZE,
|
if ((s=sys_datacopy(proc_nr, iov->iov_addr + SECTOR_SIZE,
|
||||||
SELF, (vir_bytes) &fmt_param,
|
SELF, (vir_bytes) &fmt_param,
|
||||||
(phys_bytes) sizeof(fmt_param))) != OK)
|
(phys_bytes) sizeof(fmt_param))) != OK)
|
||||||
server_panic("FLOPPY", "Sys_vircopy failed", s);
|
panic("FLOPPY", "Sys_vircopy failed", s);
|
||||||
|
|
||||||
/* Check that the number of sectors in the data is reasonable,
|
/* Check that the number of sectors in the data is reasonable,
|
||||||
* to avoid division by 0. Leave checking of other data to
|
* to avoid division by 0. Leave checking of other data to
|
||||||
|
@ -525,7 +525,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)
|
||||||
server_panic("FLOPPY","Sys_outb failed", s);
|
panic("FLOPPY","Sys_outb failed", s);
|
||||||
prev_dp = f_dp;
|
prev_dp = f_dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ unsigned nr_req; /* length of request vector */
|
||||||
if((s=sys_datacopy(proc_nr, *up, SELF,
|
if((s=sys_datacopy(proc_nr, *up, SELF,
|
||||||
(vir_bytes) tmp_buf,
|
(vir_bytes) tmp_buf,
|
||||||
(phys_bytes) SECTOR_SIZE)) != OK)
|
(phys_bytes) SECTOR_SIZE)) != OK)
|
||||||
server_panic("FLOPPY", "Sys_vircopy failed", s);
|
panic("FLOPPY", "Sys_vircopy failed", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up the DMA chip and perform the transfer. */
|
/* Set up the DMA chip and perform the transfer. */
|
||||||
|
@ -575,7 +575,7 @@ unsigned nr_req; /* length of request vector */
|
||||||
if((s=sys_datacopy(SELF, (vir_bytes) tmp_buf,
|
if((s=sys_datacopy(SELF, (vir_bytes) tmp_buf,
|
||||||
proc_nr, *up,
|
proc_nr, *up,
|
||||||
(phys_bytes) SECTOR_SIZE)) != OK)
|
(phys_bytes) SECTOR_SIZE)) != OK)
|
||||||
server_panic("FLOPPY", "Sys_vircopy failed", s);
|
panic("FLOPPY", "Sys_vircopy failed", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r != OK) {
|
if (r != OK) {
|
||||||
|
@ -649,7 +649,7 @@ int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||||
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)
|
||||||
server_panic("FLOPPY","Sys_voutb in dma_setup() failed", s);
|
panic("FLOPPY","Sys_voutb in dma_setup() failed", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ PRIVATE void start_motor()
|
||||||
|
|
||||||
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)
|
||||||
server_panic("FLOPPY","Sys_outb in start_motor() failed", s);
|
panic("FLOPPY","Sys_outb in start_motor() failed", 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 */
|
||||||
|
@ -711,7 +711,7 @@ 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)
|
||||||
server_panic("FLOPPY","Sys_outb in stop_motor() failed", s);
|
panic("FLOPPY","Sys_outb in stop_motor() failed", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ PRIVATE void floppy_stop(struct driver *dp)
|
||||||
/* Stop all activity and cleanly exit with the system. */
|
/* Stop all activity and cleanly exit with the system. */
|
||||||
int s;
|
int s;
|
||||||
if ((s=sys_outb(DOR, ENABLE_INT)) != OK)
|
if ((s=sys_outb(DOR, ENABLE_INT)) != OK)
|
||||||
server_panic("FLOPPY","Sys_outb in floppy_stop() failed", s);
|
panic("FLOPPY","Sys_outb in floppy_stop() failed", s);
|
||||||
sys_exit(0);
|
sys_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,18 +882,18 @@ PRIVATE int fdc_results()
|
||||||
* 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)
|
||||||
server_panic("FLOPPY","Sys_inb in fdc_results() failed", s);
|
panic("FLOPPY","Sys_inb in fdc_results() failed", s);
|
||||||
status &= (MASTER | DIRECTION | CTL_BUSY);
|
status &= (MASTER | DIRECTION | CTL_BUSY);
|
||||||
if (status == (MASTER | DIRECTION | CTL_BUSY)) {
|
if (status == (MASTER | DIRECTION | CTL_BUSY)) {
|
||||||
if (result_nr >= MAX_RESULTS) break; /* too many results */
|
if (result_nr >= MAX_RESULTS) break; /* too many results */
|
||||||
if ((s=sys_inb(FDC_DATA, &f_results[result_nr])) != OK)
|
if ((s=sys_inb(FDC_DATA, &f_results[result_nr])) != OK)
|
||||||
server_panic("FLOPPY","Sys_inb in fdc_results() failed", s);
|
panic("FLOPPY","Sys_inb in fdc_results() failed", s);
|
||||||
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)
|
||||||
server_panic("FLOPPY", "Couldn't enable IRQs", s);
|
panic("FLOPPY", "Couldn't enable IRQs", s);
|
||||||
|
|
||||||
return(OK); /* only good exit */
|
return(OK); /* only good exit */
|
||||||
}
|
}
|
||||||
|
@ -902,7 +902,7 @@ PRIVATE int fdc_results()
|
||||||
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)
|
||||||
server_panic("FLOPPY", "Couldn't enable IRQs", s);
|
panic("FLOPPY", "Couldn't enable IRQs", s);
|
||||||
return(ERR_STATUS);
|
return(ERR_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,12 +957,12 @@ int val; /* write this byte to floppy disk controller */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((s=sys_inb(FDC_STATUS, &status)) != OK)
|
if ((s=sys_inb(FDC_STATUS, &status)) != OK)
|
||||||
server_panic("FLOPPY","Sys_inb in fdc_out() failed", s);
|
panic("FLOPPY","Sys_inb in fdc_out() failed", 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)
|
||||||
server_panic("FLOPPY","Sys_outb in fdc_out() failed", s);
|
panic("FLOPPY","Sys_outb in fdc_out() failed", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1038,7 +1038,7 @@ PRIVATE void f_reset()
|
||||||
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)
|
||||||
server_panic("FLOPPY", "Sys_voutb in f_reset() failed", s);
|
panic("FLOPPY", "Sys_voutb in f_reset() failed", s);
|
||||||
|
|
||||||
/* A synchronous alarm timer was set in fdc_command. Expect a HARD_INT
|
/* A synchronous alarm timer was set in fdc_command. Expect a HARD_INT
|
||||||
* message to collect the reset interrupt, but be prepared to handle the
|
* message to collect the reset interrupt, but be prepared to handle the
|
||||||
|
|
|
@ -41,7 +41,7 @@ a = $d/drivers.h $b/interrupt.h $b/bios.h \
|
||||||
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
||||||
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
||||||
$m/syslib.h $s/types.h \
|
$m/syslib.h $s/types.h \
|
||||||
$m/utils.h $m/serverassert.h $m/devio.h
|
$m/utils.h $m/devio.h
|
||||||
|
|
||||||
fxp.o: $a
|
fxp.o: $a
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,6 @@ typedef int irq_hook_t;
|
||||||
#define structof(type, field, ptr) \
|
#define structof(type, field, ptr) \
|
||||||
((type *) (((char *) (ptr)) - offsetof(type, field)))
|
((type *) (((char *) (ptr)) - offsetof(type, field)))
|
||||||
|
|
||||||
#define panic(m,n) server_panic("FXP",(m),(n))
|
|
||||||
#define MICROS_TO_TICKS(m) (((m)*HZ/1000000)+1)
|
#define MICROS_TO_TICKS(m) (((m)*HZ/1000000)+1)
|
||||||
|
|
||||||
static timer_t *fxp_timers= NULL;
|
static timer_t *fxp_timers= NULL;
|
||||||
|
@ -286,7 +285,7 @@ int main(void)
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
if ((r= receive(ANY, &m)) != OK)
|
if ((r= receive(ANY, &m)) != OK)
|
||||||
panic("fxp: receive failed", r);
|
panic("FXP","receive failed", r);
|
||||||
|
|
||||||
switch (m.m_type)
|
switch (m.m_type)
|
||||||
{
|
{
|
||||||
|
@ -307,7 +306,7 @@ int main(void)
|
||||||
|
|
||||||
r= sys_irqenable(&fp->fxp_hook);
|
r= sys_irqenable(&fp->fxp_hook);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("unable enable interrupts", r);
|
panic("FXP","unable enable interrupts", r);
|
||||||
|
|
||||||
if (!fp->fxp_got_int)
|
if (!fp->fxp_got_int)
|
||||||
continue;
|
continue;
|
||||||
|
@ -319,7 +318,7 @@ int main(void)
|
||||||
case HARD_STOP: fxp_stop(); break;
|
case HARD_STOP: fxp_stop(); break;
|
||||||
case SYN_ALARM: fxp_expire_timers(); break;
|
case SYN_ALARM: fxp_expire_timers(); break;
|
||||||
default:
|
default:
|
||||||
panic("fxp: illegal message", m.m_type);
|
panic("FXP"," illegal message", m.m_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,7 +512,7 @@ fxp_t *fp;
|
||||||
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);
|
NO_NUM);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -546,7 +545,7 @@ fxp_t *fp;
|
||||||
bar= pci_attr_r32(devind, PCI_BAR_2) & 0xffffffe0;
|
bar= pci_attr_r32(devind, PCI_BAR_2) & 0xffffffe0;
|
||||||
if ((bar & 0x3ff) >= 0x100-32 || bar < 0x400)
|
if ((bar & 0x3ff) >= 0x100-32 || bar < 0x400)
|
||||||
{
|
{
|
||||||
panic("fxp_probe: base address is not properly configured",
|
panic("FXP","fxp_probe: base address is not properly configured",
|
||||||
NO_NUM);
|
NO_NUM);
|
||||||
}
|
}
|
||||||
fp->fxp_base_port= bar;
|
fp->fxp_base_port= bar;
|
||||||
|
@ -707,7 +706,7 @@ fxp_t *fp;
|
||||||
fp->fxp_conf_bytes[18] |= CCB18_LROK;
|
fp->fxp_conf_bytes[18] |= CCB18_LROK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
panic("fxp_conf_hw: bad device type", fp->fxp_type);
|
panic("FXP","fxp_conf_hw: bad device type", fp->fxp_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i= 0; i<CC_BYTES_NR; i++)
|
for (i= 0; i<CC_BYTES_NR; i++)
|
||||||
|
@ -736,13 +735,13 @@ fxp_t *fp;
|
||||||
/* set the interrupt handler */
|
/* set the interrupt handler */
|
||||||
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("sys_irqsetpolicy failed", r);
|
panic("FXP","sys_irqsetpolicy failed", 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("sys_irqenable failed", r);
|
panic("FXP","sys_irqenable failed", r);
|
||||||
|
|
||||||
/* Reset PHY? */
|
/* Reset PHY? */
|
||||||
|
|
||||||
|
@ -752,7 +751,7 @@ fxp_t *fp;
|
||||||
r= sys_umap(SELF, D, (vir_bytes)&fp->fxp_stat, sizeof(fp->fxp_stat),
|
r= sys_umap(SELF, D, (vir_bytes)&fp->fxp_stat, sizeof(fp->fxp_stat),
|
||||||
&bus_addr);
|
&bus_addr);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("sys_umap failed", r);
|
panic("FXP","sys_umap failed", 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 */
|
||||||
|
@ -807,7 +806,9 @@ fxp_t *fp;
|
||||||
assert(first_time);
|
assert(first_time);
|
||||||
first_time= 0;
|
first_time= 0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
assert(tot_bufsize <= buffer);
|
assert(tot_bufsize <= buffer);
|
||||||
|
#endif
|
||||||
buf= (phys_bytes)buffer;
|
buf= (phys_bytes)buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,7 +816,7 @@ fxp_t *fp;
|
||||||
r= sys_umap(SELF, D, (vir_bytes)buf, rx_totbufsize,
|
r= sys_umap(SELF, D, (vir_bytes)buf, rx_totbufsize,
|
||||||
&fp->fxp_rx_busaddr);
|
&fp->fxp_rx_busaddr);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("sys_umap failed", r);
|
panic("FXP","sys_umap failed", r);
|
||||||
for (i= 0, rfdp= fp->fxp_rx_buf; i<fp->fxp_rx_nbuf; i++, rfdp++)
|
for (i= 0, rfdp= fp->fxp_rx_buf; i<fp->fxp_rx_nbuf; i++, rfdp++)
|
||||||
{
|
{
|
||||||
rfdp->rfd_status= 0;
|
rfdp->rfd_status= 0;
|
||||||
|
@ -825,7 +826,7 @@ fxp_t *fp;
|
||||||
r= sys_umap(SELF, D, (vir_bytes)&rfdp[1],
|
r= sys_umap(SELF, D, (vir_bytes)&rfdp[1],
|
||||||
sizeof(rfdp[1]), &rfdp->rfd_linkaddr);
|
sizeof(rfdp[1]), &rfdp->rfd_linkaddr);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("sys_umap failed", r);
|
panic("FXP","sys_umap failed", r);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -843,7 +844,7 @@ fxp_t *fp;
|
||||||
r= sys_umap(SELF, D, (vir_bytes)fp->fxp_tx_buf,
|
r= sys_umap(SELF, 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("sys_umap failed", r);
|
panic("FXP","sys_umap failed", 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++)
|
||||||
{
|
{
|
||||||
|
@ -855,7 +856,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("sys_umap failed", r);
|
panic("FXP","sys_umap failed", r);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -883,7 +884,7 @@ fxp_t *fp;
|
||||||
|
|
||||||
/* Reset device */
|
/* Reset device */
|
||||||
fxp_outl(port, CSR_PORT, CP_CMD_SOFT_RESET);
|
fxp_outl(port, CSR_PORT, CP_CMD_SOFT_RESET);
|
||||||
tick_delay(MICROS_TO_TICKS(CSR_PORT_RESET_DELAY));
|
tickdelay(MICROS_TO_TICKS(CSR_PORT_RESET_DELAY));
|
||||||
|
|
||||||
/* Disable interrupts */
|
/* Disable interrupts */
|
||||||
fxp_outb(port, SCB_INT_MASK, SIM_M);
|
fxp_outb(port, SCB_INT_MASK, SIM_M);
|
||||||
|
@ -954,7 +955,7 @@ fxp_t *fp;
|
||||||
r= sys_umap(SELF, D, (vir_bytes)&ias, (phys_bytes)sizeof(ias),
|
r= sys_umap(SELF, D, (vir_bytes)&ias, (phys_bytes)sizeof(ias),
|
||||||
&bus_addr);
|
&bus_addr);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("sys_umap failed", r);
|
panic("FXP","sys_umap failed", 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 */);
|
||||||
|
|
||||||
|
@ -966,9 +967,9 @@ fxp_t *fp;
|
||||||
} while (getuptime(&t1)==OK && (t1-t0) < MICROS_TO_TICKS(1000));
|
} while (getuptime(&t1)==OK && (t1-t0) < MICROS_TO_TICKS(1000));
|
||||||
|
|
||||||
if (!(ias.ias_status & CBL_F_C))
|
if (!(ias.ias_status & CBL_F_C))
|
||||||
panic("fxp_confaddr: CU command failed to complete", NO_NUM);
|
panic("FXP","fxp_confaddr: CU command failed to complete", NO_NUM);
|
||||||
if (!(ias.ias_status & CBL_F_OK))
|
if (!(ias.ias_status & CBL_F_OK))
|
||||||
panic("fxp_confaddr: CU command failed", NO_NUM);
|
panic("FXP","fxp_confaddr: CU command failed", NO_NUM);
|
||||||
|
|
||||||
printf("%s: hardware ethernet address: ", fp->fxp_name);
|
printf("%s: hardware ethernet address: ", fp->fxp_name);
|
||||||
for (i= 0; i<6; i++)
|
for (i= 0; i<6; i++)
|
||||||
|
@ -1029,7 +1030,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_writev: illegal port", dl_port);
|
panic("FXP","fxp_writev: illegal port", 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;
|
||||||
|
@ -1092,14 +1093,14 @@ 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_writev: sys_vircopy failed", r);
|
panic("FXP","fxp_writev: sys_vircopy failed", 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);
|
NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,7 +1109,7 @@ int vectored;
|
||||||
s);
|
s);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
{
|
{
|
||||||
panic("fxp_writev: sys_vircopy failed",
|
panic("FXP","fxp_writev: sys_vircopy failed",
|
||||||
r);
|
r);
|
||||||
}
|
}
|
||||||
size += s;
|
size += s;
|
||||||
|
@ -1116,18 +1117,18 @@ int vectored;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (size < ETH_MIN_PACK_SIZE)
|
if (size < ETH_MIN_PACK_SIZE)
|
||||||
panic("fxp_writev: invalid packet size", size);
|
panic("FXP","fxp_writev: invalid packet size", 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_writev: invalid packet size", size);
|
panic("FXP","fxp_writev: invalid packet size", 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_writev: sys_vircopy failed", r);
|
panic("FXP","fxp_writev: sys_vircopy failed", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
txp->tx_status= 0;
|
txp->tx_status= 0;
|
||||||
|
@ -1165,7 +1166,7 @@ int vectored;
|
||||||
|
|
||||||
suspend:
|
suspend:
|
||||||
if (from_int)
|
if (from_int)
|
||||||
panic("fxp: should not be sending\n", NO_NUM);
|
panic("FXP","fxp: should not be sending\n", NO_NUM);
|
||||||
|
|
||||||
fp->fxp_tx_mess= *mp;
|
fp->fxp_tx_mess= *mp;
|
||||||
reply(fp, OK, FALSE);
|
reply(fp, OK, FALSE);
|
||||||
|
@ -1195,7 +1196,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_readv: illegal port", dl_port);
|
panic("FXP","fxp_readv: illegal port", 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;
|
||||||
|
@ -1248,7 +1249,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_readv: sys_vircopy failed", r);
|
panic("FXP","fxp_readv: sys_vircopy failed", r);
|
||||||
|
|
||||||
for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++)
|
for (j= 0, iovp= fp->fxp_iovec; j<n; j++, iovp++)
|
||||||
{
|
{
|
||||||
|
@ -1264,7 +1265,7 @@ int vectored;
|
||||||
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",
|
panic("FXP","fxp_readv: sys_vircopy failed",
|
||||||
r);
|
r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1373,7 +1374,7 @@ fxp_t *fp;
|
||||||
r= sys_umap(SELF, D, (vir_bytes)&cc, (phys_bytes)sizeof(cc),
|
r= sys_umap(SELF, D, (vir_bytes)&cc, (phys_bytes)sizeof(cc),
|
||||||
&bus_addr);
|
&bus_addr);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("sys_umap failed", r);
|
panic("FXP","sys_umap failed", 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 */);
|
||||||
|
|
||||||
|
@ -1385,9 +1386,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 (!(cc.cc_status & CBL_F_C))
|
if (!(cc.cc_status & CBL_F_C))
|
||||||
panic("fxp_do_conf: CU command failed to complete", NO_NUM);
|
panic("FXP","fxp_do_conf: CU command failed to complete", NO_NUM);
|
||||||
if (!(cc.cc_status & CBL_F_OK))
|
if (!(cc.cc_status & CBL_F_OK))
|
||||||
panic("fxp_do_conf: CU command failed", NO_NUM);
|
panic("FXP","fxp_do_conf: CU command failed", NO_NUM);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1411,7 +1412,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_cu_ptr_cmd: CU is not idle", NO_NUM);
|
panic("FXP","fxp_cu_ptr_cmd: CU is not idle", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
fxp_outl(port, SCB_POINTER, bus_addr);
|
fxp_outl(port, SCB_POINTER, bus_addr);
|
||||||
|
@ -1429,7 +1430,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_CUC_MASK) != SC_CU_NOP)
|
if ((scb_cmd & SC_CUC_MASK) != SC_CU_NOP)
|
||||||
panic("fxp_cu_ptr_cmd: CU does not accept command", NO_NUM);
|
panic("FXP","fxp_cu_ptr_cmd: CU does not accept command", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1452,7 +1453,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_ru_ptr_cmd: RU is not idle", NO_NUM);
|
panic("FXP","fxp_ru_ptr_cmd: RU is not idle", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
fxp_outl(port, SCB_POINTER, bus_addr);
|
fxp_outl(port, SCB_POINTER, bus_addr);
|
||||||
|
@ -1467,7 +1468,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_ru_ptr_cmd: RU does not accept command", NO_NUM);
|
panic("FXP","fxp_ru_ptr_cmd: RU does not accept command", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1498,7 +1499,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_restart_ru: RU is in an unexpected state", NO_NUM);
|
panic("FXP","fxp_restart_ru: RU is in an unexpected state", NO_NUM);
|
||||||
|
|
||||||
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 */);
|
||||||
|
@ -1520,7 +1521,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_getstat: illegal port", dl_port);
|
panic("FXP","fxp_getstat: illegal port", dl_port);
|
||||||
fp= &fxp_table[dl_port];
|
fp= &fxp_table[dl_port];
|
||||||
fp->fxp_client= mp->DL_PROC;
|
fp->fxp_client= mp->DL_PROC;
|
||||||
|
|
||||||
|
@ -1545,9 +1546,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_getstat: CU command failed to complete", NO_NUM);
|
panic("FXP","fxp_getstat: CU command failed to complete", NO_NUM);
|
||||||
if (*p != SCM_DSC)
|
if (*p != SCM_DSC)
|
||||||
panic("fxp_getstat: bad magic", NO_NUM);
|
panic("FXP","fxp_getstat: bad magic", NO_NUM);
|
||||||
|
|
||||||
stats.ets_recvErr=
|
stats.ets_recvErr=
|
||||||
fp->fxp_stat.sc_rx_crc +
|
fp->fxp_stat.sc_rx_crc +
|
||||||
|
@ -2159,7 +2160,7 @@ int may_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
panic("fxp: send failed:", r);
|
panic("FXP","fxp: send failed:", 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);
|
||||||
|
@ -2174,7 +2175,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: unable to mess_reply", NO_NUM);
|
panic("FXP","fxp: unable to mess_reply", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2192,7 +2193,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("put_userdata: sys_vircopy failed", r);
|
panic("FXP","put_userdata: sys_vircopy failed", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2295,7 +2296,7 @@ fxp_t *fp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i >= 32)
|
if (i >= 32)
|
||||||
panic("eeprom_addrsize: failed", NO_NUM);
|
panic("FXP","eeprom_addrsize: failed", NO_NUM);
|
||||||
fp->fxp_ee_addrlen= i+1;
|
fp->fxp_ee_addrlen= i+1;
|
||||||
|
|
||||||
/* Discard 16 data bits */
|
/* Discard 16 data bits */
|
||||||
|
@ -2331,7 +2332,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("mii_read: MDI not ready", NO_NUM);
|
panic("FXP","mii_read: MDI not ready", NO_NUM);
|
||||||
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));
|
||||||
|
|
||||||
|
@ -2343,7 +2344,7 @@ int reg;
|
||||||
} while (getuptime(&t1)==OK && (t1-t0) < MICROS_TO_TICKS(1000));
|
} while (getuptime(&t1)==OK && (t1-t0) < MICROS_TO_TICKS(1000));
|
||||||
|
|
||||||
if (!(v & CM_READY))
|
if (!(v & CM_READY))
|
||||||
panic("mii_read: MDI not ready after command", NO_NUM);
|
panic("FXP","mii_read: MDI not ready after command", NO_NUM);
|
||||||
|
|
||||||
fp->fxp_mii_busy--;
|
fp->fxp_mii_busy--;
|
||||||
assert(!fp->fxp_mii_busy);
|
assert(!fp->fxp_mii_busy);
|
||||||
|
@ -2365,7 +2366,7 @@ tmr_func_t watchdog; /* watchdog function to be called */
|
||||||
/* Get the current time. */
|
/* Get the current time. */
|
||||||
r= sys_getuptime(&now);
|
r= sys_getuptime(&now);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("unable to get uptime from clock", r);
|
panic("FXP","unable to get uptime from clock", 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);
|
tmrs_settimer(&fxp_timers, tp, now + delta, watchdog);
|
||||||
|
@ -2381,7 +2382,7 @@ tmr_func_t watchdog; /* watchdog function to be called */
|
||||||
fxp_next_timeout, fxp_next_timeout-now);
|
fxp_next_timeout, fxp_next_timeout-now);
|
||||||
r= sys_syncalrm(SELF, fxp_next_timeout, 1);
|
r= sys_syncalrm(SELF, fxp_next_timeout, 1);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("unable to set synchronous alarm", r);
|
panic("FXP","unable to set synchronous alarm", r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2401,7 +2402,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= sys_getuptime(&now);
|
r= sys_getuptime(&now);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("Unable to get uptime from clock.", r);
|
panic("FXP","Unable to get uptime from clock.", 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.
|
||||||
|
@ -2414,13 +2415,13 @@ PRIVATE void fxp_expire_timers()
|
||||||
fxp_next_timeout = fxp_timers->tmr_exp_time;
|
fxp_next_timeout = fxp_timers->tmr_exp_time;
|
||||||
r= sys_syncalrm(SELF, fxp_next_timeout, 1);
|
r= sys_syncalrm(SELF, fxp_next_timeout, 1);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
panic("Unable to set synchronous alarm.", r);
|
panic("FXP","Unable to set synchronous alarm.", r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void micro_delay(unsigned long usecs)
|
static void micro_delay(unsigned long usecs)
|
||||||
{
|
{
|
||||||
tick_delay(MICROS_TO_TICKS(usecs));
|
tickdelay(MICROS_TO_TICKS(usecs));
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8_t do_inb(port_t port)
|
static u8_t do_inb(port_t port)
|
||||||
|
@ -2430,7 +2431,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("sys_inb failed", r);
|
panic("FXP","sys_inb failed", r);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2441,7 +2442,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("sys_inl failed", r);
|
panic("FXP","sys_inl failed", r);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2451,7 +2452,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("sys_outb failed", r);
|
panic("FXP","sys_outb failed", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_outl(port_t port, u32_t value)
|
static void do_outl(port_t port, u32_t value)
|
||||||
|
@ -2460,7 +2461,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("sys_outl failed", r);
|
panic("FXP","sys_outl failed", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ENABLE_FXP */
|
#endif /* ENABLE_FXP */
|
||||||
|
|
|
@ -217,7 +217,7 @@ message *mp; /* pointer to read or write message */
|
||||||
|
|
||||||
if (OK != sys_datacopy(mp->m_source, (vir_bytes) mp->ADDRESS,
|
if (OK != sys_datacopy(mp->m_source, (vir_bytes) mp->ADDRESS,
|
||||||
SELF, (vir_bytes) iovec, iovec_size))
|
SELF, (vir_bytes) iovec, iovec_size))
|
||||||
server_panic((*dp->dr_name)(),"bad I/O vector by", mp->m_source);
|
panic((*dp->dr_name)(),"bad I/O vector by", mp->m_source);
|
||||||
iov = iovec;
|
iov = iovec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../drivers.h"
|
#include "../drivers.h"
|
||||||
|
#define NDEBUG /* disable assertions */
|
||||||
|
#include <assert.h>
|
||||||
#include <minix/com.h>
|
#include <minix/com.h>
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
|
|
||||||
|
@ -31,7 +33,6 @@ Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <minix/utils.h>
|
#include <minix/utils.h>
|
||||||
INIT_SERVER_ASSERT
|
|
||||||
|
|
||||||
#define NR_PCIBUS 2
|
#define NR_PCIBUS 2
|
||||||
#define NR_PCIDEV 40
|
#define NR_PCIDEV 40
|
||||||
|
@ -154,7 +155,7 @@ PUBLIC void pci_init()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We don't expect to interrupted */
|
/* We don't expect to interrupted */
|
||||||
server_assert(first_time == 1);
|
assert(first_time == 1);
|
||||||
first_time= -1;
|
first_time= -1;
|
||||||
|
|
||||||
/* Only Intel (compatible) PCI controllers are supported at the
|
/* Only Intel (compatible) PCI controllers are supported at the
|
||||||
|
@ -248,8 +249,8 @@ u16_t *didp;
|
||||||
PUBLIC void pci_reserve(devind)
|
PUBLIC void pci_reserve(devind)
|
||||||
int devind;
|
int devind;
|
||||||
{
|
{
|
||||||
server_assert(devind <= nr_pcidev);
|
assert(devind <= nr_pcidev);
|
||||||
server_assert(!pcidev[devind].pd_inuse);
|
assert(!pcidev[devind].pd_inuse);
|
||||||
pcidev[devind].pd_inuse= 1;
|
pcidev[devind].pd_inuse= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +263,7 @@ int devind;
|
||||||
u16_t *vidp;
|
u16_t *vidp;
|
||||||
u16_t *didp;
|
u16_t *didp;
|
||||||
{
|
{
|
||||||
server_assert(devind <= nr_pcidev);
|
assert(devind <= nr_pcidev);
|
||||||
*vidp= pcidev[devind].pd_vid;
|
*vidp= pcidev[devind].pd_vid;
|
||||||
*didp= pcidev[devind].pd_did;
|
*didp= pcidev[devind].pd_did;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +436,7 @@ PRIVATE void pci_intel_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nr_pcibus >= NR_PCIBUS)
|
if (nr_pcibus >= NR_PCIBUS)
|
||||||
server_panic("PCI","too many PCI busses", nr_pcibus);
|
panic("PCI","too many PCI busses", nr_pcibus);
|
||||||
busind= nr_pcibus;
|
busind= nr_pcibus;
|
||||||
nr_pcibus++;
|
nr_pcibus++;
|
||||||
pcibus[busind].pb_type= PBT_INTEL;
|
pcibus[busind].pb_type= PBT_INTEL;
|
||||||
|
@ -497,7 +498,7 @@ 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)
|
||||||
server_panic("PCI","too many PCI devices", nr_pcidev);
|
panic("PCI","too many PCI devices", nr_pcidev);
|
||||||
devind= nr_pcidev;
|
devind= nr_pcidev;
|
||||||
|
|
||||||
for (dev= 0; dev<32; dev++)
|
for (dev= 0; dev<32; dev++)
|
||||||
|
@ -571,7 +572,7 @@ printf("probe_bus(%d)\n", busind);
|
||||||
pcidev[devind].pd_inuse= 0;
|
pcidev[devind].pd_inuse= 0;
|
||||||
|
|
||||||
if (nr_pcidev >= NR_PCIDEV)
|
if (nr_pcidev >= NR_PCIDEV)
|
||||||
server_panic("PCI","too many PCI devices", nr_pcidev);
|
panic("PCI","too many PCI devices", nr_pcidev);
|
||||||
devind= nr_pcidev;
|
devind= nr_pcidev;
|
||||||
|
|
||||||
if (func == 0 && !(headt & PHT_MULTIFUNC))
|
if (func == 0 && !(headt & PHT_MULTIFUNC))
|
||||||
|
@ -662,7 +663,7 @@ int busind;
|
||||||
r= do_sis_isabr(bridge_dev);
|
r= do_sis_isabr(bridge_dev);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
server_panic("PCI","unknown ISA bridge type", type);
|
panic("PCI","unknown ISA bridge type", type);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -723,7 +724,7 @@ int busind;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (nr_pcibus >= NR_PCIBUS)
|
if (nr_pcibus >= NR_PCIBUS)
|
||||||
server_panic("PCI","too many PCI busses", nr_pcibus);
|
panic("PCI","too many PCI busses", nr_pcibus);
|
||||||
ind= nr_pcibus;
|
ind= nr_pcibus;
|
||||||
nr_pcibus++;
|
nr_pcibus++;
|
||||||
pcibus[ind].pb_type= PBT_PCIBRIDGE;
|
pcibus[ind].pb_type= PBT_PCIBRIDGE;
|
||||||
|
@ -747,7 +748,7 @@ int busind;
|
||||||
pcibus[ind].pb_wsts= pcibr_via_wsts;
|
pcibus[ind].pb_wsts= pcibr_via_wsts;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
server_panic("PCI","unknown PCI-PCI bridge type", type);
|
panic("PCI","unknown PCI-PCI bridge type", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
probe_bus(ind);
|
probe_bus(ind);
|
||||||
|
@ -796,7 +797,7 @@ int devind;
|
||||||
{
|
{
|
||||||
printf("IRQ %d is not level triggered\n",
|
printf("IRQ %d is not level triggered\n",
|
||||||
irq);
|
irq);
|
||||||
server_panic(NULL,NULL, NO_NUM);
|
panic(NULL,NULL, NO_NUM);
|
||||||
}
|
}
|
||||||
irq_mode_pci(irq);
|
irq_mode_pci(irq);
|
||||||
}
|
}
|
||||||
|
@ -821,7 +822,7 @@ 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)
|
||||||
server_panic("PCI","too many PCI devices", nr_pcidev);
|
panic("PCI","too many PCI devices", nr_pcidev);
|
||||||
xdevind= nr_pcidev;
|
xdevind= nr_pcidev;
|
||||||
pcidev[xdevind].pd_busind= bus;
|
pcidev[xdevind].pd_busind= bus;
|
||||||
pcidev[xdevind].pd_dev= dev;
|
pcidev[xdevind].pd_dev= dev;
|
||||||
|
@ -848,7 +849,7 @@ int devind;
|
||||||
{
|
{
|
||||||
printf("IRQ %d is not level triggered\n",
|
printf("IRQ %d is not level triggered\n",
|
||||||
irq);
|
irq);
|
||||||
server_panic(NULL, NULL, NO_NUM);
|
panic(NULL, NULL, NO_NUM);
|
||||||
}
|
}
|
||||||
irq_mode_pci(irq);
|
irq_mode_pci(irq);
|
||||||
}
|
}
|
||||||
|
@ -924,7 +925,7 @@ int devind;
|
||||||
irq= pci_attr_r8(devind, VIA_ISABR_IRQ_R1) >> 4;
|
irq= pci_attr_r8(devind, VIA_ISABR_IRQ_R1) >> 4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
server_assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
irq &= 0xf;
|
irq &= 0xf;
|
||||||
if (!irq)
|
if (!irq)
|
||||||
|
@ -940,7 +941,7 @@ int devind;
|
||||||
{
|
{
|
||||||
printf("IRQ %d is not level triggered\n",
|
printf("IRQ %d is not level triggered\n",
|
||||||
irq);
|
irq);
|
||||||
server_panic(NULL, NULL, NO_NUM);
|
panic(NULL, NULL, NO_NUM);
|
||||||
}
|
}
|
||||||
irq_mode_pci(irq);
|
irq_mode_pci(irq);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ a = $d/drivers.h $b/interrupt.h $b/bios.h \
|
||||||
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
||||||
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
||||||
$m/syslib.h $s/types.h \
|
$m/syslib.h $s/types.h \
|
||||||
$m/utils.h $m/serverassert.h $m/devio.h
|
$m/utils.h $m/devio.h
|
||||||
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
|
l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -250,10 +250,10 @@ PRIVATE void m_init()
|
||||||
|
|
||||||
/* Get memory addresses from the kernel. */
|
/* Get memory addresses from the kernel. */
|
||||||
if (OK != (s=sys_getmemchunks(&mem))) {
|
if (OK != (s=sys_getmemchunks(&mem))) {
|
||||||
server_panic("MEM","Couldn't get memory chunks.",s);
|
panic("MEM","Couldn't get memory chunks.",s);
|
||||||
}
|
}
|
||||||
if (OK != (s=sys_getkinfo(&kinfo))) {
|
if (OK != (s=sys_getkinfo(&kinfo))) {
|
||||||
server_panic("MEM","Couldn't get kernel information.",s);
|
panic("MEM","Couldn't get kernel information.",s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install remote segment for /dev/kmem memory. */
|
/* Install remote segment for /dev/kmem memory. */
|
||||||
|
@ -261,7 +261,7 @@ PRIVATE void m_init()
|
||||||
m_geom[KMEM_DEV].dv_size = cvul64(kinfo.kmem_size);
|
m_geom[KMEM_DEV].dv_size = cvul64(kinfo.kmem_size);
|
||||||
if (OK != (s=sys_segctl(&m_seg[KMEM_DEV], (u16_t *) &s, (vir_bytes *) &s,
|
if (OK != (s=sys_segctl(&m_seg[KMEM_DEV], (u16_t *) &s, (vir_bytes *) &s,
|
||||||
kinfo.kmem_base, kinfo.kmem_size))) {
|
kinfo.kmem_base, kinfo.kmem_size))) {
|
||||||
server_panic("MEM","Couldn't install remote segment.",s);
|
panic("MEM","Couldn't install remote segment.",s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install remote segment for /dev/boot memory, if enabled. */
|
/* Install remote segment for /dev/boot memory, if enabled. */
|
||||||
|
@ -270,7 +270,7 @@ PRIVATE void m_init()
|
||||||
if (kinfo.bootdev_base > 0) {
|
if (kinfo.bootdev_base > 0) {
|
||||||
if (OK != (s=sys_segctl(&m_seg[BOOT_DEV], (u16_t *) &s, (vir_bytes *) &s,
|
if (OK != (s=sys_segctl(&m_seg[BOOT_DEV], (u16_t *) &s, (vir_bytes *) &s,
|
||||||
kinfo.bootdev_base, kinfo.bootdev_size))) {
|
kinfo.bootdev_base, kinfo.bootdev_size))) {
|
||||||
server_panic("MEM","Couldn't install remote segment.",s);
|
panic("MEM","Couldn't install remote segment.",s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ PRIVATE void m_init()
|
||||||
/* Set up memory ranges for /dev/mem. */
|
/* Set up memory ranges for /dev/mem. */
|
||||||
#if (CHIP == INTEL)
|
#if (CHIP == INTEL)
|
||||||
if (OK != (s=sys_getmachine(&machine))) {
|
if (OK != (s=sys_getmachine(&machine))) {
|
||||||
server_panic("MEM","Couldn't get machine information.",s);
|
panic("MEM","Couldn't get machine information.",s);
|
||||||
}
|
}
|
||||||
if (! machine.protected) {
|
if (! machine.protected) {
|
||||||
m_geom[MEM_DEV].dv_size = cvul64(0x100000); /* 1M for 8086 systems */
|
m_geom[MEM_DEV].dv_size = cvul64(0x100000); /* 1M for 8086 systems */
|
||||||
|
@ -334,19 +334,19 @@ message *m_ptr; /* pointer to control message */
|
||||||
/* Try to allocate a piece of memory for the RAM disk. */
|
/* Try to allocate a piece of memory for the RAM disk. */
|
||||||
ramdev_size = m_ptr->POSITION;
|
ramdev_size = m_ptr->POSITION;
|
||||||
if (OK != (s=alloc_mem(ramdev_size, &ramdev_base)))
|
if (OK != (s=alloc_mem(ramdev_size, &ramdev_base)))
|
||||||
server_panic("MEM","Couldn't allocate kernel memory", s);
|
panic("MEM","Couldn't allocate kernel memory", s);
|
||||||
dv->dv_base = cvul64(ramdev_base);
|
dv->dv_base = cvul64(ramdev_base);
|
||||||
dv->dv_size = cvul64(ramdev_size);
|
dv->dv_size = cvul64(ramdev_size);
|
||||||
printf("Test MEM: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size);
|
printf("Test MEM: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size);
|
||||||
|
|
||||||
if (OK != (s=sys_kmalloc(ramdev_size, &ramdev_base)))
|
if (OK != (s=sys_kmalloc(ramdev_size, &ramdev_base)))
|
||||||
server_panic("MEM","Couldn't allocate kernel memory", s);
|
panic("MEM","Couldn't allocate kernel memory", s);
|
||||||
dv->dv_base = cvul64(ramdev_base);
|
dv->dv_base = cvul64(ramdev_base);
|
||||||
dv->dv_size = cvul64(ramdev_size);
|
dv->dv_size = cvul64(ramdev_size);
|
||||||
printf("Real MEM: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size);
|
printf("Real MEM: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size);
|
||||||
if (OK != (s=sys_segctl(&m_seg[RAM_DEV], (u16_t *) &s, (vir_bytes *) &s,
|
if (OK != (s=sys_segctl(&m_seg[RAM_DEV], (u16_t *) &s, (vir_bytes *) &s,
|
||||||
ramdev_base, ramdev_size))) {
|
ramdev_base, ramdev_size))) {
|
||||||
server_panic("MEM","Couldn't install remote segment.",s);
|
panic("MEM","Couldn't install remote segment.",s);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ a = $d/drivers.h $b/interrupt.h $b/bios.h \
|
||||||
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
||||||
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
||||||
$m/syslib.h $s/types.h \
|
$m/syslib.h $s/types.h \
|
||||||
$m/utils.h $m/serverassert.h $m/devio.h
|
$m/utils.h $m/devio.h
|
||||||
|
|
||||||
printer.o: $a
|
printer.o: $a
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ register message *m_ptr; /* pointer to the newly arrived message */
|
||||||
do_printer_output();
|
do_printer_output();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tick_delay(30); /* wait before retry */
|
tickdelay(30); /* wait before retry */
|
||||||
}
|
}
|
||||||
/* If we reach this point, the printer was not online in time. */
|
/* If we reach this point, the printer was not online in time. */
|
||||||
done_status = status;
|
done_status = status;
|
||||||
|
@ -283,7 +283,7 @@ PRIVATE void do_initialize()
|
||||||
sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR,
|
sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR,
|
||||||
SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE);
|
SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE);
|
||||||
sys_outb(port_base + 2, INIT_PRINTER);
|
sys_outb(port_base + 2, INIT_PRINTER);
|
||||||
tick_delay(1); /* easily satisfies Centronics minimum */
|
tickdelay(1); /* easily satisfies Centronics minimum */
|
||||||
/* was 2 millisecs; now is ~17 millisecs */
|
/* was 2 millisecs; now is ~17 millisecs */
|
||||||
sys_outb(port_base + 2, SELECT);
|
sys_outb(port_base + 2, SELECT);
|
||||||
sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id);
|
sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id);
|
||||||
|
|
|
@ -44,7 +44,7 @@ a = $d/drivers.h $b/interrupt.h $b/bios.h \
|
||||||
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
||||||
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
||||||
$m/syslib.h $s/types.h \
|
$m/syslib.h $s/types.h \
|
||||||
$m/utils.h $m/serverassert.h $m/devio.h
|
$m/utils.h $m/devio.h
|
||||||
l = $d/libpci/pci.h $d/libpci/pci.c $d/libpci/pci_table.c
|
l = $d/libpci/pci.h $d/libpci/pci.c $d/libpci/pci_table.c
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#define NDEBUG /* disable assertions */
|
||||||
|
#include <assert.h>
|
||||||
#include <minix/com.h>
|
#include <minix/com.h>
|
||||||
#include <minix/keymap.h>
|
#include <minix/keymap.h>
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
|
@ -91,7 +93,6 @@
|
||||||
#include "../libpci/pci.h"
|
#include "../libpci/pci.h"
|
||||||
#include "rtl8139.h"
|
#include "rtl8139.h"
|
||||||
|
|
||||||
INIT_SERVER_ASSERT
|
|
||||||
|
|
||||||
#define RX_BUFSIZE RL_RCR_RBLEN_64K_SIZE
|
#define RX_BUFSIZE RL_RCR_RBLEN_64K_SIZE
|
||||||
#define RX_BUFBITS RL_RCR_RBLEN_64K
|
#define RX_BUFBITS RL_RCR_RBLEN_64K
|
||||||
|
@ -318,7 +319,7 @@ void main(void)
|
||||||
long v;
|
long v;
|
||||||
|
|
||||||
if ((v=get_proc_nr(&rl_tasknr, NULL)) != OK)
|
if ((v=get_proc_nr(&rl_tasknr, NULL)) != OK)
|
||||||
server_panic("RTL8139", "Couldn't get own proc nr", v);
|
panic("RTL8139", "Couldn't get own proc nr", v);
|
||||||
|
|
||||||
v= 0;
|
v= 0;
|
||||||
(void) env_parse("ETH_IGN_PROTO", "x", 0, &v, 0x0000L, 0xFFFFL);
|
(void) env_parse("ETH_IGN_PROTO", "x", 0, &v, 0x0000L, 0xFFFFL);
|
||||||
|
@ -337,7 +338,7 @@ void main(void)
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
if ((r= receive(ANY, &m)) != OK)
|
if ((r= receive(ANY, &m)) != OK)
|
||||||
server_panic("rtl8139","receive failed", r);
|
panic("rtl8139","receive failed", r);
|
||||||
|
|
||||||
switch (m.m_type)
|
switch (m.m_type)
|
||||||
{
|
{
|
||||||
|
@ -379,7 +380,7 @@ void main(void)
|
||||||
case FKEY_PRESSED: rtl8139_dump(&m); break;
|
case FKEY_PRESSED: rtl8139_dump(&m); break;
|
||||||
case HARD_STOP: rtl8139_stop(); break;
|
case HARD_STOP: rtl8139_stop(); break;
|
||||||
default:
|
default:
|
||||||
server_panic("rtl8139","illegal message", m.m_type);
|
panic("rtl8139","illegal message", m.m_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,7 +396,7 @@ static void check_int_events(void)
|
||||||
if (!rep->re_got_int)
|
if (!rep->re_got_int)
|
||||||
continue;
|
continue;
|
||||||
rep->re_got_int= 0;
|
rep->re_got_int= 0;
|
||||||
server_assert(rep->re_flags & REF_ENABLED);
|
assert(rep->re_flags & REF_ENABLED);
|
||||||
rl_check_ints(rep);
|
rl_check_ints(rep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -533,8 +534,8 @@ message *mp;
|
||||||
rl_report_link(rep);
|
rl_report_link(rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
server_assert(rep->re_mode == REM_ENABLED);
|
assert(rep->re_mode == REM_ENABLED);
|
||||||
server_assert(rep->re_flags & REF_ENABLED);
|
assert(rep->re_flags & REF_ENABLED);
|
||||||
|
|
||||||
rep->re_flags &= ~(REF_PROMISC | REF_MULTI | REF_BROAD);
|
rep->re_flags &= ~(REF_PROMISC | REF_MULTI | REF_BROAD);
|
||||||
|
|
||||||
|
@ -650,7 +651,7 @@ re_t *rep;
|
||||||
continue;
|
continue;
|
||||||
if (pcitab[i].checkclass)
|
if (pcitab[i].checkclass)
|
||||||
{
|
{
|
||||||
server_panic("rtl_probe",
|
panic("rtl_probe",
|
||||||
"class check not implemented", NO_NUM);
|
"class check not implemented", NO_NUM);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -682,7 +683,7 @@ re_t *rep;
|
||||||
/* 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 & 0x3ff) >= 0x100-32 || bar < 0x400)
|
if ((bar & 0x3ff) >= 0x100-32 || bar < 0x400)
|
||||||
server_panic("rtl_probe",
|
panic("rtl_probe",
|
||||||
"base address is not properly configured", NO_NUM);
|
"base address is not properly configured", NO_NUM);
|
||||||
rep->re_base_port= bar;
|
rep->re_base_port= bar;
|
||||||
|
|
||||||
|
@ -768,7 +769,7 @@ re_t *rep;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (OK != (i=sys_kmalloc(tot_bufsize, &buf)))
|
if (OK != (i=sys_kmalloc(tot_bufsize, &buf)))
|
||||||
server_panic("RTL8139","Couldn't allocate kernel buffer",i);
|
panic("RTL8139","Couldn't allocate kernel buffer",i);
|
||||||
printf("RTL8139: real %uK buffer at 0x%06x\n", tot_bufsize, buf);
|
printf("RTL8139: real %uK buffer at 0x%06x\n", tot_bufsize, buf);
|
||||||
#endif
|
#endif
|
||||||
for (i= 0; i<N_TX_BUF; i++)
|
for (i= 0; i<N_TX_BUF; i++)
|
||||||
|
@ -849,7 +850,7 @@ re_t *rep;
|
||||||
break;
|
break;
|
||||||
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
|
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
|
||||||
if (rl_inb(port, RL_BMCR) & MII_CTRL_RST)
|
if (rl_inb(port, RL_BMCR) & MII_CTRL_RST)
|
||||||
server_panic("rtl8139","reset PHY failed to complete", NO_NUM);
|
panic("rtl8139","reset PHY failed to complete", NO_NUM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Reset the device */
|
/* Reset the device */
|
||||||
|
@ -860,7 +861,7 @@ re_t *rep;
|
||||||
break;
|
break;
|
||||||
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
|
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
|
||||||
if (rl_inb(port, RL_CR) & RL_CR_RST)
|
if (rl_inb(port, RL_CR) & RL_CR_RST)
|
||||||
server_panic("rtl8139","reset failed to complete", NO_NUM);
|
panic("rtl8139","reset failed to complete", NO_NUM);
|
||||||
|
|
||||||
t= rl_inl(port, RL_TCR);
|
t= rl_inl(port, RL_TCR);
|
||||||
switch(t & (RL_TCR_HWVER_AM | RL_TCR_HWVER_BM))
|
switch(t & (RL_TCR_HWVER_AM | RL_TCR_HWVER_BM))
|
||||||
|
@ -904,7 +905,7 @@ re_t *rep;
|
||||||
bus_buf= vm_1phys2bus(rep->re_tx[i].ret_buf);
|
bus_buf= vm_1phys2bus(rep->re_tx[i].ret_buf);
|
||||||
rl_outl(port, RL_TSAD0+i*4, bus_buf);
|
rl_outl(port, RL_TSAD0+i*4, bus_buf);
|
||||||
t= rl_inl(port, RL_TSD0+i*4);
|
t= rl_inl(port, RL_TSD0+i*4);
|
||||||
server_assert(t & RL_TSD_OWN);
|
assert(t & RL_TSD_OWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1028,7 +1029,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 >= RE_PORT_NR)
|
if (dl_port < 0 || dl_port >= RE_PORT_NR)
|
||||||
server_panic("rtl8139"," illegal port", dl_port);
|
panic("rtl8139"," illegal port", 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;
|
||||||
|
@ -1036,8 +1037,8 @@ int vectored;
|
||||||
if (rep->re_clear_rx)
|
if (rep->re_clear_rx)
|
||||||
goto suspend; /* Buffer overflow */
|
goto suspend; /* Buffer overflow */
|
||||||
|
|
||||||
server_assert(rep->re_mode == REM_ENABLED);
|
assert(rep->re_mode == REM_ENABLED);
|
||||||
server_assert(rep->re_flags & REF_ENABLED);
|
assert(rep->re_flags & REF_ENABLED);
|
||||||
|
|
||||||
port= rep->re_base_port;
|
port= rep->re_base_port;
|
||||||
|
|
||||||
|
@ -1083,7 +1084,7 @@ 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);
|
||||||
server_panic("rtl8139","received packet not OK", NO_NUM);
|
panic("rtl8139","received packet not OK", NO_NUM);
|
||||||
}
|
}
|
||||||
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)
|
||||||
|
@ -1095,7 +1096,7 @@ 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);
|
||||||
server_panic(NULL, NULL, NO_NUM);
|
panic(NULL, NULL, NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1136,22 +1137,22 @@ int vectored;
|
||||||
s= iovp->iov_size;
|
s= iovp->iov_size;
|
||||||
if (size + s > packlen)
|
if (size + s > packlen)
|
||||||
{
|
{
|
||||||
server_assert(packlen > size);
|
assert(packlen > size);
|
||||||
s= packlen-size;
|
s= packlen-size;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
server_panic("rtl8139","umap_local failed\n", NO_NUM);
|
panic("rtl8139","umap_local failed\n", NO_NUM);
|
||||||
|
|
||||||
if (o >= RX_BUFSIZE)
|
if (o >= RX_BUFSIZE)
|
||||||
{
|
{
|
||||||
o -= RX_BUFSIZE;
|
o -= RX_BUFSIZE;
|
||||||
server_assert(o < RX_BUFSIZE);
|
assert(o < RX_BUFSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o+s > RX_BUFSIZE)
|
if (o+s > RX_BUFSIZE)
|
||||||
{
|
{
|
||||||
server_assert(o<RX_BUFSIZE);
|
assert(o<RX_BUFSIZE);
|
||||||
s1= RX_BUFSIZE-o;
|
s1= RX_BUFSIZE-o;
|
||||||
|
|
||||||
cps = sys_abscopy(src_phys+o, dst_phys, s1);
|
cps = sys_abscopy(src_phys+o, dst_phys, s1);
|
||||||
|
@ -1175,18 +1176,18 @@ int vectored;
|
||||||
}
|
}
|
||||||
if (size < packlen)
|
if (size < packlen)
|
||||||
{
|
{
|
||||||
server_assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server_assert(0);
|
assert(0);
|
||||||
#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)
|
||||||
server_panic("rtl8139","invalid packet size", size);
|
panic("rtl8139","invalid packet size", 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))
|
||||||
server_panic("rtl8139","umap_local failed", NO_NUM);
|
panic("rtl8139","umap_local failed", NO_NUM);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -1217,7 +1218,7 @@ int vectored;
|
||||||
if (l >= RX_BUFSIZE)
|
if (l >= RX_BUFSIZE)
|
||||||
{
|
{
|
||||||
l -= RX_BUFSIZE;
|
l -= RX_BUFSIZE;
|
||||||
server_assert(l < RX_BUFSIZE);
|
assert(l < RX_BUFSIZE);
|
||||||
}
|
}
|
||||||
rl_outw(port, RL_CAPR, l-RL_CAPR_DATA_OFF);
|
rl_outw(port, RL_CAPR, l-RL_CAPR_DATA_OFF);
|
||||||
|
|
||||||
|
@ -1229,14 +1230,14 @@ int vectored;
|
||||||
suspend:
|
suspend:
|
||||||
if (from_int)
|
if (from_int)
|
||||||
{
|
{
|
||||||
server_assert(rep->re_flags & REF_READING);
|
assert(rep->re_flags & REF_READING);
|
||||||
|
|
||||||
/* No need to store any state */
|
/* No need to store any state */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep->re_rx_mess= *mp;
|
rep->re_rx_mess= *mp;
|
||||||
server_assert(!(rep->re_flags & REF_READING));
|
assert(!(rep->re_flags & REF_READING));
|
||||||
rep->re_flags |= REF_READING;
|
rep->re_flags |= REF_READING;
|
||||||
|
|
||||||
reply(rep, OK, FALSE);
|
reply(rep, OK, FALSE);
|
||||||
|
@ -1260,17 +1261,17 @@ 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)
|
||||||
server_panic("rtl8139","illegal port", port);
|
panic("rtl8139","illegal port", 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;
|
||||||
|
|
||||||
server_assert(rep->re_mode == REM_ENABLED);
|
assert(rep->re_mode == REM_ENABLED);
|
||||||
server_assert(rep->re_flags & REF_ENABLED);
|
assert(rep->re_flags & REF_ENABLED);
|
||||||
|
|
||||||
if (from_int)
|
if (from_int)
|
||||||
{
|
{
|
||||||
server_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;
|
||||||
rep->re_send_int= FALSE;
|
rep->re_send_int= FALSE;
|
||||||
rep->re_tx_alive= TRUE;
|
rep->re_tx_alive= TRUE;
|
||||||
|
@ -1279,7 +1280,7 @@ int vectored;
|
||||||
tx_head= rep->re_tx_head;
|
tx_head= rep->re_tx_head;
|
||||||
if (rep->re_tx[tx_head].ret_busy)
|
if (rep->re_tx[tx_head].ret_busy)
|
||||||
{
|
{
|
||||||
server_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;
|
||||||
if (rep->re_tx[tx_head].ret_busy)
|
if (rep->re_tx[tx_head].ret_busy)
|
||||||
goto suspend;
|
goto suspend;
|
||||||
|
@ -1295,15 +1296,15 @@ int vectored;
|
||||||
rep->re_send_int= FALSE;
|
rep->re_send_int= FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
server_assert(!(rep->re_flags & REF_SEND_AVAIL));
|
assert(!(rep->re_flags & REF_SEND_AVAIL));
|
||||||
server_assert(!(rep->re_flags & REF_PACK_SENT));
|
assert(!(rep->re_flags & REF_PACK_SENT));
|
||||||
|
|
||||||
if (vectored)
|
if (vectored)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR,
|
if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR,
|
||||||
count * sizeof(rep->re_iovec[0]), &iov_src))
|
count * sizeof(rep->re_iovec[0]), &iov_src))
|
||||||
server_panic("rtl8139","umap_local failed", NO_NUM);
|
panic("rtl8139","umap_local failed", NO_NUM);
|
||||||
|
|
||||||
size= 0;
|
size= 0;
|
||||||
p= rep->re_tx[tx_head].ret_buf;
|
p= rep->re_tx[tx_head].ret_buf;
|
||||||
|
@ -1322,12 +1323,12 @@ int vectored;
|
||||||
s= iovp->iov_size;
|
s= iovp->iov_size;
|
||||||
if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
|
if (size + s > ETH_MAX_PACK_SIZE_TAGGED)
|
||||||
{
|
{
|
||||||
server_panic("rtl8139","invalid packet size",
|
panic("rtl8139","invalid packet size",
|
||||||
NO_NUM);
|
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))
|
||||||
server_panic("rtl8139","umap_local failed\n", NO_NUM);
|
panic("rtl8139","umap_local failed\n", NO_NUM);
|
||||||
|
|
||||||
cps = sys_abscopy(phys_user, p, s);
|
cps = sys_abscopy(phys_user, p, s);
|
||||||
if (cps != OK) printf("RTL8139: warning, sys_abscopy failed: %d\n", cps);
|
if (cps != OK) printf("RTL8139: warning, sys_abscopy failed: %d\n", cps);
|
||||||
|
@ -1336,15 +1337,15 @@ int vectored;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (size < ETH_MIN_PACK_SIZE)
|
if (size < ETH_MIN_PACK_SIZE)
|
||||||
server_panic("rtl8139","invalid packet size", size);
|
panic("rtl8139","invalid packet size", 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)
|
||||||
server_panic("rtl8139","invalid packet size", size);
|
panic("rtl8139","invalid packet size", 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))
|
||||||
server_panic("rtl8139","umap_local failed\n", NO_NUM);
|
panic("rtl8139","umap_local failed\n", NO_NUM);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -1357,7 +1358,7 @@ int vectored;
|
||||||
|
|
||||||
if (++tx_head == N_TX_BUF)
|
if (++tx_head == N_TX_BUF)
|
||||||
tx_head= 0;
|
tx_head= 0;
|
||||||
server_assert(tx_head < RL_N_TX);
|
assert(tx_head < RL_N_TX);
|
||||||
rep->re_tx_head= tx_head;
|
rep->re_tx_head= tx_head;
|
||||||
|
|
||||||
rep->re_flags |= REF_PACK_SENT;
|
rep->re_flags |= REF_PACK_SENT;
|
||||||
|
@ -1384,7 +1385,7 @@ suspend:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (from_int)
|
if (from_int)
|
||||||
server_panic("rtl8139","should not be sending\n", NO_NUM);
|
panic("rtl8139","should not be sending\n", NO_NUM);
|
||||||
|
|
||||||
rep->re_tx_mess= *mp;
|
rep->re_tx_mess= *mp;
|
||||||
reply(rep, OK, FALSE);
|
reply(rep, OK, FALSE);
|
||||||
|
@ -1449,7 +1450,7 @@ re_t *rep;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server_assert(rep->re_rx_mess.m_type == DL_READ);
|
assert(rep->re_rx_mess.m_type == DL_READ);
|
||||||
rl_readv(&rep->re_rx_mess, TRUE /* from int */,
|
rl_readv(&rep->re_rx_mess, TRUE /* from int */,
|
||||||
FALSE /* !vectored */);
|
FALSE /* !vectored */);
|
||||||
}
|
}
|
||||||
|
@ -1469,7 +1470,7 @@ re_t *rep;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server_assert(rep->re_tx_mess.m_type == DL_WRITE);
|
assert(rep->re_tx_mess.m_type == DL_WRITE);
|
||||||
rl_writev(&rep->re_tx_mess, TRUE /* from int */,
|
rl_writev(&rep->re_tx_mess, TRUE /* from int */,
|
||||||
FALSE /* !vectored */);
|
FALSE /* !vectored */);
|
||||||
}
|
}
|
||||||
|
@ -1800,7 +1801,7 @@ re_t *rep;
|
||||||
break;
|
break;
|
||||||
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
|
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
|
||||||
if (rl_inb(port, RL_CR) & RL_CR_RE)
|
if (rl_inb(port, RL_CR) & RL_CR_RE)
|
||||||
server_panic("rtl8139","cannot disable receiver", NO_NUM);
|
panic("rtl8139","cannot disable receiver", NO_NUM);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("RBSTART = 0x%08x\n", rl_inl(port, RL_RBSTART));
|
printf("RBSTART = 0x%08x\n", rl_inl(port, RL_RBSTART));
|
||||||
|
@ -1848,12 +1849,12 @@ message *mp;
|
||||||
|
|
||||||
port = mp->DL_PORT;
|
port = mp->DL_PORT;
|
||||||
if (port < 0 || port >= RE_PORT_NR)
|
if (port < 0 || port >= RE_PORT_NR)
|
||||||
server_panic("rtl8139","illegal port", port);
|
panic("rtl8139","illegal port", port);
|
||||||
rep= &re_table[port];
|
rep= &re_table[port];
|
||||||
rep->re_client= mp->DL_PROC;
|
rep->re_client= mp->DL_PROC;
|
||||||
|
|
||||||
server_assert(rep->re_mode == REM_ENABLED);
|
assert(rep->re_mode == REM_ENABLED);
|
||||||
server_assert(rep->re_flags & REF_ENABLED);
|
assert(rep->re_flags & REF_ENABLED);
|
||||||
|
|
||||||
stats= rep->re_stat;
|
stats= rep->re_stat;
|
||||||
|
|
||||||
|
@ -1888,7 +1889,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 = sys_getuptime(&now)))
|
if (OK != (r = sys_getuptime(&now)))
|
||||||
server_panic("dp8390","sys_getuptime() failed:", r);
|
panic("dp8390","sys_getuptime() failed:", r);
|
||||||
reply.DL_CLCK = now;
|
reply.DL_CLCK = now;
|
||||||
|
|
||||||
r= send(rep->re_client, &reply);
|
r= send(rep->re_client, &reply);
|
||||||
|
@ -1900,7 +1901,7 @@ int may_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
server_panic("dp8390","send failed:", r);
|
panic("dp8390","send failed:", r);
|
||||||
|
|
||||||
rep->re_read_s = 0;
|
rep->re_read_s = 0;
|
||||||
rep->re_flags &= ~(REF_PACK_SENT | REF_PACK_RECV);
|
rep->re_flags &= ~(REF_PACK_SENT | REF_PACK_RECV);
|
||||||
|
@ -1916,7 +1917,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)
|
||||||
server_panic("rtl8139","unable to mess_reply", NO_NUM);
|
panic("rtl8139","unable to mess_reply", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
@ -2160,7 +2161,7 @@ re_t *rep;
|
||||||
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
|
} while (getuptime(&t1)==OK && (t1-t0) < HZ);
|
||||||
if (rl_inb(port, RL_CR) & RL_CR_TE)
|
if (rl_inb(port, RL_CR) & RL_CR_TE)
|
||||||
{
|
{
|
||||||
server_panic("rtl8139","cannot disable transmitter",
|
panic("rtl8139","cannot disable transmitter",
|
||||||
NO_NUM);
|
NO_NUM);
|
||||||
}
|
}
|
||||||
rl_outb(port, RL_CR, cr | RL_CR_TE);
|
rl_outb(port, RL_CR, cr | RL_CR_TE);
|
||||||
|
@ -2229,7 +2230,7 @@ re_t *rep;
|
||||||
break;
|
break;
|
||||||
if (++tx_tail >= N_TX_BUF)
|
if (++tx_tail >= N_TX_BUF)
|
||||||
tx_tail= 0;
|
tx_tail= 0;
|
||||||
server_assert(tx_tail < RL_N_TX);
|
assert(tx_tail < RL_N_TX);
|
||||||
rep->re_tx_tail= tx_tail;
|
rep->re_tx_tail= tx_tail;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2247,7 +2248,7 @@ re_t *rep;
|
||||||
{
|
{
|
||||||
printf("rl_handler, TABT, TSD%d = 0x%04lx\n",
|
printf("rl_handler, TABT, TSD%d = 0x%04lx\n",
|
||||||
tx_tail, tsd);
|
tx_tail, tsd);
|
||||||
server_assert(0); /* CLRABT is not all that
|
assert(0); /* CLRABT is not all that
|
||||||
* effective, why not?
|
* effective, why not?
|
||||||
*/
|
*/
|
||||||
rep->re_stat.ets_transAb++;
|
rep->re_stat.ets_transAb++;
|
||||||
|
@ -2296,7 +2297,7 @@ re_t *rep;
|
||||||
|
|
||||||
if (++tx_tail >= N_TX_BUF)
|
if (++tx_tail >= N_TX_BUF)
|
||||||
tx_tail= 0;
|
tx_tail= 0;
|
||||||
server_assert(tx_tail < RL_N_TX);
|
assert(tx_tail < RL_N_TX);
|
||||||
rep->re_tx_tail= tx_tail;
|
rep->re_tx_tail= tx_tail;
|
||||||
|
|
||||||
if (rep->re_flags & REF_SEND_AVAIL)
|
if (rep->re_flags & REF_SEND_AVAIL)
|
||||||
|
@ -2312,7 +2313,7 @@ re_t *rep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server_assert(i < 2*N_TX_BUF);
|
assert(i < 2*N_TX_BUF);
|
||||||
}
|
}
|
||||||
if (isr)
|
if (isr)
|
||||||
{
|
{
|
||||||
|
@ -2340,7 +2341,7 @@ timer_t *tp;
|
||||||
#if __minix_vmd
|
#if __minix_vmd
|
||||||
tmr_arg_ut t_arg;
|
tmr_arg_ut t_arg;
|
||||||
|
|
||||||
server_assert(tp == &rl_watchdog);
|
assert(tp == &rl_watchdog);
|
||||||
t_arg.ta_int= 0;
|
t_arg.ta_int= 0;
|
||||||
tmra_settimer(&rl_watchdog, get_uptime()+HZ, rl_watchdog_f, t_arg);
|
tmra_settimer(&rl_watchdog, get_uptime()+HZ, rl_watchdog_f, t_arg);
|
||||||
#else
|
#else
|
||||||
|
@ -2471,10 +2472,10 @@ dpeth_t *dep;
|
||||||
|
|
||||||
ee_wds(dep);
|
ee_wds(dep);
|
||||||
|
|
||||||
server_assert(get_ee_word(dep, 0x78/2) == 0x10ec);
|
assert(get_ee_word(dep, 0x78/2) == 0x10ec);
|
||||||
server_assert(get_ee_word(dep, 0x7A/2) == 0x8029);
|
assert(get_ee_word(dep, 0x7A/2) == 0x8029);
|
||||||
server_assert(get_ee_word(dep, 0x7C/2) == 0x10ec);
|
assert(get_ee_word(dep, 0x7C/2) == 0x10ec);
|
||||||
server_assert(get_ee_word(dep, 0x7E/2) == 0x8029);
|
assert(get_ee_word(dep, 0x7E/2) == 0x8029);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == sys_getkenv("RTL8029XXX",10+1, val, sizeof(val)))
|
if (0 == sys_getkenv("RTL8029XXX",10+1, val, sizeof(val)))
|
||||||
|
@ -2485,7 +2486,7 @@ dpeth_t *dep;
|
||||||
|
|
||||||
ee_wds(dep);
|
ee_wds(dep);
|
||||||
|
|
||||||
server_assert(get_ee_word(dep, 0x76/2) == 0x8029);
|
assert(get_ee_word(dep, 0x76/2) == 0x8029);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2599,7 +2600,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))
|
||||||
server_panic("set_ee_word","device remains busy", NO_NUM);
|
panic("set_ee_word","device remains busy", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ee_wds(dep)
|
static void ee_wds(dep)
|
||||||
|
|
|
@ -43,7 +43,7 @@ a = $d/drivers.h $b/interrupt.h $b/bios.h \
|
||||||
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
$i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \
|
||||||
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
$m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \
|
||||||
$m/syslib.h $s/types.h \
|
$m/syslib.h $s/types.h \
|
||||||
$m/utils.h $m/serverassert.h $m/devio.h
|
$m/utils.h $m/devio.h
|
||||||
|
|
||||||
tty.o: tty.h $a
|
tty.o: tty.h $a
|
||||||
console.o: tty.h $a
|
console.o: tty.h $a
|
||||||
|
|
|
@ -744,7 +744,7 @@ PRIVATE void beep()
|
||||||
|
|
||||||
/* Fetch current time in advance to prevent beeping delay. */
|
/* Fetch current time in advance to prevent beeping delay. */
|
||||||
if ((s=sys_getuptime(&now)) != OK)
|
if ((s=sys_getuptime(&now)) != OK)
|
||||||
server_panic("TTY","Console couldn't get clock's uptime.", s);
|
panic("TTY","Console couldn't get clock's uptime.", 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);
|
||||||
|
@ -761,7 +761,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_syncalrm(SELF, tty_next_timeout, 1)) != OK)
|
if ((s=sys_syncalrm(SELF, tty_next_timeout, 1)) != OK)
|
||||||
server_panic("TTY","Console couldn't set syn alarm.", s);
|
panic("TTY","Console couldn't set syn alarm.", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
#include <minix/keymap.h>
|
#include <minix/keymap.h>
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "keymaps/us-std.src"
|
#include "keymaps/us-std.src"
|
||||||
#include "../../kernel/kernel.h"
|
#include "../../kernel/const.h"
|
||||||
|
#include "../../kernel/type.h"
|
||||||
#include "../../kernel/proc.h"
|
#include "../../kernel/proc.h"
|
||||||
|
|
||||||
int irq_hook_id = -1;
|
int irq_hook_id = -1;
|
||||||
|
@ -382,9 +383,9 @@ tty_t *tp;
|
||||||
|
|
||||||
/* Set interrupt handler and enable keyboard IRQ. */
|
/* Set interrupt handler and enable keyboard IRQ. */
|
||||||
if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
|
if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK)
|
||||||
server_panic("TTY", "Couldn't set keyboard IRQ policy", i);
|
panic("TTY", "Couldn't set keyboard IRQ policy", i);
|
||||||
if ((i=sys_irqenable(&irq_hook_id)) != OK)
|
if ((i=sys_irqenable(&irq_hook_id)) != OK)
|
||||||
server_panic("TTY", "Couldn't enable keyboard IRQs", i);
|
panic("TTY", "Couldn't enable keyboard IRQs", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +585,7 @@ message *m; /* request message to TTY */
|
||||||
(void) scan_keyboard(); /* ack any old input */
|
(void) scan_keyboard(); /* ack any old input */
|
||||||
quiet = scan_keyboard();/* quiescent value (0 on PC, last code on AT)*/
|
quiet = scan_keyboard();/* quiescent value (0 on PC, last code on AT)*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
tick_delay(10);
|
tickdelay(10);
|
||||||
/* See if there are pending request for output, but don't block.
|
/* See if there are pending request for output, but don't block.
|
||||||
* Diagnostics can span multiple printf()s, so do it in a loop.
|
* Diagnostics can span multiple printf()s, so do it in a loop.
|
||||||
*/
|
*/
|
||||||
|
@ -594,7 +595,7 @@ message *m; /* request message to TTY */
|
||||||
case DIAGNOSTICS: do_diagnostics(m); break;
|
case DIAGNOSTICS: do_diagnostics(m); break;
|
||||||
default: ; /* do nothing */
|
default: ; /* do nothing */
|
||||||
}
|
}
|
||||||
tick_delay(1); /* allow more */
|
tickdelay(1); /* allow more */
|
||||||
}
|
}
|
||||||
code = scan_keyboard();
|
code = scan_keyboard();
|
||||||
if (code != quiet) {
|
if (code != quiet) {
|
||||||
|
|
|
@ -167,7 +167,7 @@ PUBLIC void main(void)
|
||||||
|
|
||||||
/* Get kernel environment (protected_mode, pc_at and ega are needed). */
|
/* Get kernel environment (protected_mode, pc_at and ega are needed). */
|
||||||
if (OK != (s=sys_getmachine(&machine))) {
|
if (OK != (s=sys_getmachine(&machine))) {
|
||||||
server_panic("TTY","Couldn't obtain kernel environment.", s);
|
panic("TTY","Couldn't obtain kernel environment.", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("User-level TTY driver alive!\n");
|
printf("User-level TTY driver alive!\n");
|
||||||
|
@ -1309,7 +1309,7 @@ int status; /* reply code */
|
||||||
tty_mess.REP_PROC_NR = proc_nr;
|
tty_mess.REP_PROC_NR = proc_nr;
|
||||||
tty_mess.REP_STATUS = status;
|
tty_mess.REP_STATUS = status;
|
||||||
if ((status = send(replyee, &tty_mess)) != OK) {
|
if ((status = send(replyee, &tty_mess)) != OK) {
|
||||||
server_panic("TTY","tty_reply failed, status\n", status);
|
panic("TTY","tty_reply failed, status\n", status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1330,7 +1330,7 @@ int sig; /* SIGINT, SIGQUIT, SIGKILL or SIGHUP */
|
||||||
|
|
||||||
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)))
|
||||||
server_panic("TTY","Error, call to sys_kill failed", status);
|
panic("TTY","Error, call to sys_kill failed", status);
|
||||||
|
|
||||||
if (!(tp->tty_termios.c_lflag & NOFLSH)) {
|
if (!(tp->tty_termios.c_lflag & NOFLSH)) {
|
||||||
tp->tty_incount = tp->tty_eotct = 0; /* kill earlier input */
|
tp->tty_incount = tp->tty_eotct = 0; /* kill earlier input */
|
||||||
|
@ -1406,7 +1406,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=sys_getuptime(&now)) != OK)
|
if ((s=sys_getuptime(&now)) != OK)
|
||||||
server_panic("TTY","Couldn't get uptime from clock.", s);
|
panic("TTY","Couldn't get uptime from clock.", 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.
|
||||||
|
@ -1416,7 +1416,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_syncalrm(SELF, tty_next_timeout, 1)) != OK)
|
if ((s=sys_syncalrm(SELF, tty_next_timeout, 1)) != OK)
|
||||||
server_panic("TTY","Couldn't set synchronous alarm.", s);
|
panic("TTY","Couldn't set synchronous alarm.", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1433,7 +1433,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=sys_getuptime(&now)) != OK)
|
if ((s=sys_getuptime(&now)) != OK)
|
||||||
server_panic("TTY","Couldn't get uptime from clock.", s);
|
panic("TTY","Couldn't get uptime from clock.", s);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (HZ/10);
|
exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (HZ/10);
|
||||||
/* Set a new timer for enabling the TTY events flags. */
|
/* Set a new timer for enabling the TTY events flags. */
|
||||||
|
@ -1452,7 +1452,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_syncalrm(SELF, tty_next_timeout, 1)) != OK)
|
if ((s=sys_syncalrm(SELF, tty_next_timeout, 1)) != OK)
|
||||||
server_panic("TTY","Couldn't set synchronous alarm.", s);
|
panic("TTY","Couldn't set synchronous alarm.", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,20 +17,20 @@
|
||||||
#include <ansi.h>
|
#include <ansi.h>
|
||||||
|
|
||||||
#include <minix/const.h>
|
#include <minix/const.h>
|
||||||
|
#include <minix/com.h>
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
#include <minix/callnr.h>
|
#include <minix/callnr.h>
|
||||||
|
|
||||||
#include <minix/ipc.h>
|
#include <minix/ipc.h>
|
||||||
|
|
||||||
#define MM 0
|
#define MM PM_PROC_NR
|
||||||
#define FS 1
|
#define FS FS_PROC_NR
|
||||||
|
|
||||||
_PROTOTYPE( int __execve, (const char *_path, char *const _argv[],
|
_PROTOTYPE( int __execve, (const char *_path, char *const _argv[],
|
||||||
char *const _envp[], int _nargs, int _nenvps) );
|
char *const _envp[], int _nargs, int _nenvps) );
|
||||||
_PROTOTYPE( int _syscall, (int _who, int _syscallnr, message *_msgptr) );
|
_PROTOTYPE( int _syscall, (int _who, int _syscallnr, message *_msgptr) );
|
||||||
_PROTOTYPE( void _loadname, (const char *_name, message *_msgptr) );
|
_PROTOTYPE( void _loadname, (const char *_name, message *_msgptr) );
|
||||||
_PROTOTYPE( int _len, (const char *_s) );
|
_PROTOTYPE( int _len, (const char *_s) );
|
||||||
_PROTOTYPE( void panic, (const char *_message, int _errnum) );
|
|
||||||
_PROTOTYPE( void _begsig, (int _dummy) );
|
_PROTOTYPE( void _begsig, (int _dummy) );
|
||||||
|
|
||||||
#endif /* _LIB_H */
|
#endif /* _LIB_H */
|
||||||
|
|
|
@ -176,18 +176,6 @@
|
||||||
# define DL_BROAD_REQ 0x8
|
# define DL_BROAD_REQ 0x8
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* CLOCK request types and field names *
|
|
||||||
*===========================================================================*/
|
|
||||||
|
|
||||||
/* Clock library calls are dispatched via a call vector, so be careful when
|
|
||||||
* modifying the clock call numbers. The numbers here determine which call
|
|
||||||
* is made from the call vector.
|
|
||||||
*/
|
|
||||||
# define CLK_SIGNALRM 1 /* clk_signalrm(proc_nr, ticks) */
|
|
||||||
# define CLK_SYNCALRM 6 /* clk_syncalrm(proc_nr,exp_time,abs_time) */
|
|
||||||
# define CLK_FLAGALRM 7 /* clk_flagalrm(ticks, flag_ptr) */
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* SYSTASK request types and field names *
|
* SYSTASK request types and field names *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
@ -213,7 +201,7 @@
|
||||||
|
|
||||||
# define SYS_SIGNALRM 15 /* sys_signalrm(proc_nr, ticks) */
|
# define SYS_SIGNALRM 15 /* sys_signalrm(proc_nr, ticks) */
|
||||||
# define SYS_SYNCALRM 16 /* sys_syncalrm(proc_nr,exp_time,abs_time) */
|
# define SYS_SYNCALRM 16 /* sys_syncalrm(proc_nr,exp_time,abs_time) */
|
||||||
# define SYS_FLAGALRM 17 /* sys_flagalrm(ticks, flag_ptr) */
|
|
||||||
# define SYS_PHYSVCOPY 18 /* sys_physvcopy(vec_ptr, vec_size) */
|
# define SYS_PHYSVCOPY 18 /* sys_physvcopy(vec_ptr, vec_size) */
|
||||||
# define SYS_SVRCTL 19 /* sys_svrctl(proc_nr, req, argp) */
|
# define SYS_SVRCTL 19 /* sys_svrctl(proc_nr, req, argp) */
|
||||||
# define SYS_SDEVIO 20 /* sys_sdevio(port, proc_nr, buf, count) */
|
# define SYS_SDEVIO 20 /* sys_sdevio(port, proc_nr, buf, count) */
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
#ifndef __SERVERASSERT_H
|
|
||||||
#define __SERVERASSERT_H
|
|
||||||
|
|
||||||
/* This file contains functions and macros used for debugging within
|
|
||||||
* system servers. Also see <assert.h> which is used in regular programs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NDEBUG /* 8086 must do without training wheels. */
|
|
||||||
#define NDEBUG (_WORD_SIZE == 2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !NDEBUG
|
|
||||||
|
|
||||||
#define INIT_SERVER_ASSERT static char *server_assert_file= __FILE__;
|
|
||||||
|
|
||||||
void server_assert_failed(char *file, int line, char *what);
|
|
||||||
void server_compare_failed(char *file, int line, int lhs, char *what, int rhs);
|
|
||||||
|
|
||||||
#define server_assert(x) (!(x) ? server_assert_failed( \
|
|
||||||
server_assert_file, __LINE__, #x) : (void) 0)
|
|
||||||
#define server_compare(a,t,b) (!((a) t (b)) ? server_compare_failed( \
|
|
||||||
server_assert_file, __LINE__, (a), #a " " #t " " #b, (b)) : (void) 0)
|
|
||||||
|
|
||||||
|
|
||||||
#else /* NDEBUG */
|
|
||||||
|
|
||||||
#define INIT_SERVER_ASSERT /* nothing */
|
|
||||||
|
|
||||||
#define server_assert(x) (void) 0
|
|
||||||
#define server_compare(a,t,b) (void) 0
|
|
||||||
|
|
||||||
#endif /* NDEBUG */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __SERVERASSERT_H */
|
|
||||||
|
|
|
@ -7,11 +7,12 @@
|
||||||
* Mar 15, 2004 by Jorrit N. Herder
|
* Mar 15, 2004 by Jorrit N. Herder
|
||||||
*
|
*
|
||||||
* Changes:
|
* Changes:
|
||||||
* Mar 18, 2005: added tick_delay
|
* May 31, 2005: added getuptime
|
||||||
|
* Mar 18, 2005: added tickdelay
|
||||||
* Mar 15, 2005: added get_proc_nr
|
* Mar 15, 2005: added get_proc_nr
|
||||||
* Oct 01, 2004: added env_parse, env_prefix, env_panic
|
* Oct 01, 2004: added env_parse, env_prefix, env_panic
|
||||||
* Jul 13, 2004: added fkey_ctl
|
* Jul 13, 2004: added fkey_ctl
|
||||||
* Apr 28, 2004: added server_report, server_panic, server_assert
|
* Apr 28, 2004: added report, panic
|
||||||
* Mar 31, 2004: setup like other libraries, such as syslib
|
* Mar 31, 2004: setup like other libraries, such as syslib
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -20,8 +21,6 @@
|
||||||
* Miscellaneous helper functions.
|
* Miscellaneous helper functions.
|
||||||
*==========================================================================*/
|
*==========================================================================*/
|
||||||
|
|
||||||
#include <minix/serverassert.h>
|
|
||||||
|
|
||||||
/* Environment parsing return values. */
|
/* Environment parsing return values. */
|
||||||
#define EP_BUF_SIZE 128 /* local buffer for env value */
|
#define EP_BUF_SIZE 128 /* local buffer for env value */
|
||||||
#define EP_UNSET 0 /* variable not set */
|
#define EP_UNSET 0 /* variable not set */
|
||||||
|
@ -40,13 +39,14 @@ _PROTOTYPE(int env_parse, (char *env, char *fmt, int field, long *param,
|
||||||
#define fkey_disable(fkey) fkey_ctl(fkey, 0)
|
#define fkey_disable(fkey) fkey_ctl(fkey, 0)
|
||||||
_PROTOTYPE(int fkey_ctl, (int fkey_code, int enable_disable) );
|
_PROTOTYPE(int fkey_ctl, (int fkey_code, int enable_disable) );
|
||||||
|
|
||||||
_PROTOTYPE(void server_report, (char *who, char *mess, int num) );
|
|
||||||
_PROTOTYPE(void server_panic, (char *who, char *mess, int num) );
|
|
||||||
|
|
||||||
_PROTOTYPE(int get_proc_nr, (int *proc_nr, char *proc_name) );
|
_PROTOTYPE(int get_proc_nr, (int *proc_nr, char *proc_name) );
|
||||||
|
|
||||||
|
_PROTOTYPE(void report, (char *who, char *mess, int num));
|
||||||
|
_PROTOTYPE(void panic, (char *who, char *mess, int num));
|
||||||
|
|
||||||
_PROTOTYPE(int getuptime, (clock_t *ticks));
|
_PROTOTYPE(int getuptime, (clock_t *ticks));
|
||||||
_PROTOTYPE(int tick_delay, (clock_t ticks));
|
_PROTOTYPE(int tickdelay, (clock_t ticks));
|
||||||
|
|
||||||
#endif /* _EXTRALIB_H */
|
#endif /* _EXTRALIB_H */
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#define IDLE 0
|
#define IO_IDLE 0
|
||||||
#define INPROGRESS 1
|
#define IO_INPROGRESS 1
|
||||||
#define RESULT 2
|
#define IO_RESULT 2
|
||||||
|
|
||||||
#define OP_NOOP 0
|
#define OP_NOOP 0
|
||||||
#define OP_READ 1
|
#define OP_READ 1
|
||||||
|
@ -35,7 +35,7 @@ static asynchio_t *asyn_current;
|
||||||
|
|
||||||
void asyn_init(asynchio_t *asyn)
|
void asyn_init(asynchio_t *asyn)
|
||||||
{
|
{
|
||||||
asyn->state= IDLE;
|
asyn->state= IO_IDLE;
|
||||||
asyn->op= OP_NOOP;
|
asyn->op= OP_NOOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,20 +43,20 @@ static ssize_t operation(int op, asynchio_t *asyn, int fd, int req,
|
||||||
void *data, ssize_t count)
|
void *data, ssize_t count)
|
||||||
{
|
{
|
||||||
switch (asyn->state) {
|
switch (asyn->state) {
|
||||||
case INPROGRESS:
|
case IO_INPROGRESS:
|
||||||
if (asyn_current != asyn && asyn->op != op) abort();
|
if (asyn_current != asyn && asyn->op != op) abort();
|
||||||
/*FALL THROUGH*/
|
/*FALL THROUGH*/
|
||||||
case IDLE:
|
case IO_IDLE:
|
||||||
asyn_current= asyn;
|
asyn_current= asyn;
|
||||||
asyn->op= op;
|
asyn->op= op;
|
||||||
asyn->fd= fd;
|
asyn->fd= fd;
|
||||||
asyn->req= req;
|
asyn->req= req;
|
||||||
asyn->data= data;
|
asyn->data= data;
|
||||||
asyn->count= count;
|
asyn->count= count;
|
||||||
asyn->state= INPROGRESS;
|
asyn->state= IO_INPROGRESS;
|
||||||
errno= EINPROGRESS;
|
errno= EINPROGRESS;
|
||||||
return -1;
|
return -1;
|
||||||
case RESULT:
|
case IO_RESULT:
|
||||||
if (asyn_current != asyn && asyn->op != op) abort();
|
if (asyn_current != asyn && asyn->op != op) abort();
|
||||||
errno= asyn->errno;
|
errno= asyn->errno;
|
||||||
return asyn->count;
|
return asyn->count;
|
||||||
|
@ -92,8 +92,8 @@ int asyn_wait(asynchio_t *asyn, int flags, struct timeval *to)
|
||||||
if (asyn_current != asyn) abort();
|
if (asyn_current != asyn) abort();
|
||||||
if (flags & ASYN_NONBLOCK) abort();
|
if (flags & ASYN_NONBLOCK) abort();
|
||||||
|
|
||||||
if (asyn->state == RESULT) {
|
if (asyn->state == IO_RESULT) {
|
||||||
asyn->state= IDLE;
|
asyn->state= IO_IDLE;
|
||||||
asyn->op= OP_NOOP;
|
asyn->op= OP_NOOP;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ int asyn_wait(asynchio_t *asyn, int flags, struct timeval *to)
|
||||||
errno= EINTR;
|
errno= EINTR;
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
asyn->state= RESULT;
|
asyn->state= IO_RESULT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ OBJECTS = \
|
||||||
$(LIBSYS)(sys_voutw.o) \
|
$(LIBSYS)(sys_voutw.o) \
|
||||||
$(LIBSYS)(sys_voutl.o) \
|
$(LIBSYS)(sys_voutl.o) \
|
||||||
$(LIBSYS)(sys_signalrm.o) \
|
$(LIBSYS)(sys_signalrm.o) \
|
||||||
$(LIBSYS)(sys_flagalrm.o) \
|
|
||||||
$(LIBSYS)(sys_syncalrm.o) \
|
$(LIBSYS)(sys_syncalrm.o) \
|
||||||
$(LIBSYS)(sys_physzero.o) \
|
$(LIBSYS)(sys_physzero.o) \
|
||||||
$(LIBSYS)(taskcall.o) \
|
$(LIBSYS)(taskcall.o) \
|
||||||
|
@ -160,9 +159,6 @@ $(LIBSYS)(sys_vinl.o): sys_vinl.c
|
||||||
$(LIBSYS)(sys_signalrm.o): sys_signalrm.c
|
$(LIBSYS)(sys_signalrm.o): sys_signalrm.c
|
||||||
$(CC1) sys_signalrm.c
|
$(CC1) sys_signalrm.c
|
||||||
|
|
||||||
$(LIBSYS)(sys_flagalrm.o): sys_flagalrm.c
|
|
||||||
$(CC1) sys_flagalrm.c
|
|
||||||
|
|
||||||
$(LIBSYS)(sys_syncalrm.o): sys_syncalrm.c
|
$(LIBSYS)(sys_syncalrm.o): sys_syncalrm.c
|
||||||
$(CC1) sys_syncalrm.c
|
$(CC1) sys_syncalrm.c
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#include "syslib.h"
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* sys_flagalrm *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC int sys_flagalrm(ticks, flag_ptr)
|
|
||||||
clock_t ticks; /* number of ticks until the flag is set */
|
|
||||||
int *flag_ptr; /* pointer to timeout flag to be set */
|
|
||||||
{
|
|
||||||
/* Make a call to the clock to schedule a timeout flag alarm for the caller. */
|
|
||||||
message m;
|
|
||||||
|
|
||||||
if (flag_ptr != NULL) /* expect the worst */
|
|
||||||
*flag_ptr = 0; /* reset timeout flag first */
|
|
||||||
m.m_type = SYS_FLAGALRM; /* alarm type requested */
|
|
||||||
m.ALRM_PROC_NR = SELF; /* m_source will be used */
|
|
||||||
m.ALRM_EXP_TIME = ticks; /* alarm is due after ticks */
|
|
||||||
m.ALRM_ABS_TIME = 0; /* ticks are relative to now */
|
|
||||||
m.ALRM_FLAG_PTR = (char *) flag_ptr;
|
|
||||||
return _taskcall(SYSTASK, SYS_FLAGALRM, &m);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,16 @@ LIBUTILS = ../libutils.a
|
||||||
all: $(LIBUTILS)
|
all: $(LIBUTILS)
|
||||||
|
|
||||||
OBJECTS = \
|
OBJECTS = \
|
||||||
$(LIBUTILS)(tick_delay.o) \
|
$(LIBUTILS)(tickdelay.o) \
|
||||||
$(LIBUTILS)(get_upt.o) \
|
$(LIBUTILS)(getuptime.o) \
|
||||||
$(LIBUTILS)(get_mon_prm.o) \
|
$(LIBUTILS)(get_mon_prm.o) \
|
||||||
$(LIBUTILS)(env_parse.o) \
|
$(LIBUTILS)(env_parse.o) \
|
||||||
$(LIBUTILS)(env_panic.o) \
|
$(LIBUTILS)(env_panic.o) \
|
||||||
$(LIBUTILS)(env_prefix.o) \
|
$(LIBUTILS)(env_prefix.o) \
|
||||||
$(LIBUTILS)(fkey_ctl.o) \
|
$(LIBUTILS)(fkey_ctl.o) \
|
||||||
$(LIBUTILS)(get_proc_nr.o) \
|
$(LIBUTILS)(get_proc_nr.o) \
|
||||||
$(LIBUTILS)(srvr_assert.o) \
|
$(LIBUTILS)(panic.o) \
|
||||||
$(LIBUTILS)(srvr_panic.o) \
|
$(LIBUTILS)(report.o) \
|
||||||
$(LIBUTILS)(srvr_report.o) \
|
|
||||||
$(LIBUTILS)(taskcall.o) \
|
$(LIBUTILS)(taskcall.o) \
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,11 +24,11 @@ $(LIBUTILS): $(OBJECTS)
|
||||||
aal cr $@ *.o
|
aal cr $@ *.o
|
||||||
rm *.o
|
rm *.o
|
||||||
|
|
||||||
$(LIBUTILS)(get_upt.o): get_upt.c
|
$(LIBUTILS)(getuptime.o): getuptime.c
|
||||||
$(CC1) get_upt.c
|
$(CC1) getuptime.c
|
||||||
|
|
||||||
$(LIBUTILS)(tick_delay.o): tick_delay.c
|
$(LIBUTILS)(tickdelay.o): tickdelay.c
|
||||||
$(CC1) tick_delay.c
|
$(CC1) tickdelay.c
|
||||||
|
|
||||||
$(LIBUTILS)(get_mon_prm.o): get_mon_prm.c
|
$(LIBUTILS)(get_mon_prm.o): get_mon_prm.c
|
||||||
$(CC1) get_mon_prm.c
|
$(CC1) get_mon_prm.c
|
||||||
|
@ -49,14 +48,11 @@ $(LIBUTILS)(fkey_ctl.o): fkey_ctl.c
|
||||||
$(LIBUTILS)(get_proc_nr.o): get_proc_nr.c
|
$(LIBUTILS)(get_proc_nr.o): get_proc_nr.c
|
||||||
$(CC1) get_proc_nr.c
|
$(CC1) get_proc_nr.c
|
||||||
|
|
||||||
$(LIBUTILS)(srvr_assert.o): srvr_assert.c
|
$(LIBUTILS)(panic.o): panic.c
|
||||||
$(CC1) srvr_assert.c
|
$(CC1) panic.c
|
||||||
|
|
||||||
$(LIBUTILS)(srvr_panic.o): srvr_panic.c
|
$(LIBUTILS)(report.o): report.c
|
||||||
$(CC1) srvr_panic.c
|
$(CC1) report.c
|
||||||
|
|
||||||
$(LIBUTILS)(srvr_report.o): srvr_report.c
|
|
||||||
$(CC1) srvr_report.c
|
|
||||||
|
|
||||||
$(LIBUTILS)(taskcall.o): taskcall.c
|
$(LIBUTILS)(taskcall.o): taskcall.c
|
||||||
$(CC1) taskcall.c
|
$(CC1) taskcall.c
|
||||||
|
|
|
@ -14,6 +14,6 @@ char *key; /* environment variable whose value is bogus */
|
||||||
printf("WARNING: sys_getkenv() failed in env_panic(): %d\n", s);
|
printf("WARNING: sys_getkenv() 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);
|
||||||
server_panic("","", NO_NUM);
|
panic("","", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@ long min, max; /* minimum and maximum values for the parameter */
|
||||||
long newpar;
|
long newpar;
|
||||||
int s, i = 0, radix, r;
|
int s, i = 0, radix, r;
|
||||||
|
|
||||||
#if DEAD_CODE
|
|
||||||
if ((s=sys_getkenv(env, strlen(env), value, sizeof(value))) != 0) {
|
|
||||||
#endif
|
|
||||||
if ((s=get_mon_param(env, value, sizeof(value))) != 0) {
|
if ((s=get_mon_param(env, value, sizeof(value))) != 0) {
|
||||||
if (s == ESRCH) return(EP_UNSET); /* only error allowed */
|
if (s == ESRCH) return(EP_UNSET); /* only error allowed */
|
||||||
printf("WARNING: sys_getkenv() failed in env_parse(): %d\n",s);
|
printf("WARNING: sys_getkenv() failed in env_parse(): %d\n",s);
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <unistd.h> /* need RBT_PANIC flag */
|
|
||||||
|
|
||||||
PRIVATE int panicking; /* inhibits recursive panics */
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* server_panic *
|
* panic *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void server_panic(who, mess, num)
|
PUBLIC void panic(who, mess, num)
|
||||||
char *who; /* server identification */
|
char *who; /* server identification */
|
||||||
char *mess; /* message format string */
|
char *mess; /* message format string */
|
||||||
int num; /* number to go with format string */
|
int num; /* number to go with format string */
|
||||||
|
@ -17,8 +14,6 @@ int num; /* number to go with format string */
|
||||||
*/
|
*/
|
||||||
message m;
|
message m;
|
||||||
|
|
||||||
if (panicking) return; /* already a panic */
|
|
||||||
panicking = TRUE; /* prevent recursive panics */
|
|
||||||
if (NULL != who && NULL != mess) {
|
if (NULL != who && NULL != mess) {
|
||||||
if (num != NO_NUM) {
|
if (num != NO_NUM) {
|
||||||
printf("Panic in %s: %s: %d\n", who, mess, num);
|
printf("Panic in %s: %s: %d\n", who, mess, num);
|
|
@ -1,9 +1,9 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* server_report *
|
* report *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void server_report(who, mess, num)
|
PUBLIC void report(who, mess, num)
|
||||||
char *who; /* server identification */
|
char *who; /* server identification */
|
||||||
char *mess; /* message format to print */
|
char *mess; /* message format to print */
|
||||||
int num; /* number to go with the message */
|
int num; /* number to go with the message */
|
|
@ -1,38 +0,0 @@
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
/* This file contains two very related procedures for debugging purposes:
|
|
||||||
* server_assert_failed
|
|
||||||
* server_compare_failed
|
|
||||||
* Also see <minix/serverassert.h>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !NDEBUG
|
|
||||||
/*=========================================================================*
|
|
||||||
* server_assert_failed *
|
|
||||||
*=========================================================================*/
|
|
||||||
PUBLIC void server_assert_failed(file, line, what)
|
|
||||||
char *file;
|
|
||||||
int line;
|
|
||||||
char *what;
|
|
||||||
{
|
|
||||||
printf("server panic at %s(%d): assertion \"%s\" failed\n",
|
|
||||||
file, line, what);
|
|
||||||
server_panic(NULL, NULL, NO_NUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*=========================================================================*
|
|
||||||
* server_compare_failed *
|
|
||||||
*=========================================================================*/
|
|
||||||
PUBLIC void server_compare_failed(file, line, lhs, what, rhs)
|
|
||||||
char *file;
|
|
||||||
int line;
|
|
||||||
int lhs;
|
|
||||||
char *what;
|
|
||||||
int rhs;
|
|
||||||
{
|
|
||||||
printf("server panic at %s(%d): compare (%d) %s (%d) failed\n",
|
|
||||||
file, line, lhs, what, rhs);
|
|
||||||
server_panic(NULL, NULL, NO_NUM);
|
|
||||||
}
|
|
||||||
#endif /* !NDEBUG */
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* tick_delay *
|
* tickdelay *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int tick_delay(ticks)
|
PUBLIC int tickdelay(ticks)
|
||||||
long ticks; /* number of ticks to wait */
|
long ticks; /* number of ticks to wait */
|
||||||
{
|
{
|
||||||
/* This function uses the synchronous alarm to delay for a while. This works
|
/* This function uses the synchronous alarm to delay for a while. This works
|
|
@ -69,7 +69,7 @@ int only_search; /* if NO_READ, don't read, else act normal */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Desired block is not on available chain. Take oldest block ('front'). */
|
/* Desired block is not on available chain. Take oldest block ('front'). */
|
||||||
if ((bp = front) == NIL_BUF) panic("all buffers in use", NR_BUFS);
|
if ((bp = front) == NIL_BUF) panic(__FILE__,"all buffers in use", NR_BUFS);
|
||||||
rm_lru(bp);
|
rm_lru(bp);
|
||||||
|
|
||||||
/* Remove the block that was just taken from its hash chain. */
|
/* Remove the block that was just taken from its hash chain. */
|
||||||
|
|
|
@ -45,7 +45,7 @@ int flags; /* mode bits and flags */
|
||||||
if (major >= max_major) major = 0;
|
if (major >= max_major) major = 0;
|
||||||
dp = &dmap[major];
|
dp = &dmap[major];
|
||||||
r = (*dp->dmap_opcl)(DEV_OPEN, dev, proc, flags);
|
r = (*dp->dmap_opcl)(DEV_OPEN, dev, proc, flags);
|
||||||
if (r == SUSPEND) panic("Suspend on open from", dp->dmap_driver);
|
if (r == SUSPEND) panic(__FILE__,"suspend on open from", dp->dmap_driver);
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ message *mess_ptr; /* pointer to message for task */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (r != OK) {
|
if (r != OK) {
|
||||||
if (r == EDEADDST) return; /* give up */
|
if (r == EDEADDST) return; /* give up */
|
||||||
else panic("call_task: can't send/receive", r);
|
else panic(__FILE__,"call_task: can't send/receive", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Did the process we did the sendrec() for get a result? */
|
/* Did the process we did the sendrec() for get a result? */
|
||||||
|
|
|
@ -113,11 +113,11 @@ PRIVATE void get_work()
|
||||||
reviving--;
|
reviving--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
panic("get_work couldn't revive anyone", NO_NUM);
|
panic(__FILE__,"get_work couldn't revive anyone", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normal case. No one to revive. */
|
/* Normal case. No one to revive. */
|
||||||
if (receive(ANY, &m_in) != OK) panic("fs receive error", NO_NUM);
|
if (receive(ANY, &m_in) != OK) panic(__FILE__,"fs receive error", NO_NUM);
|
||||||
who = m_in.m_source;
|
who = m_in.m_source;
|
||||||
call_nr = m_in.m_type;
|
call_nr = m_in.m_type;
|
||||||
}
|
}
|
||||||
|
@ -180,11 +180,11 @@ PRIVATE void fs_init()
|
||||||
/* Certain relations must hold for the file system to work at all. Some
|
/* Certain relations must hold for the file system to work at all. Some
|
||||||
* extra block_size requirements are checked at super-block-read-in time.
|
* extra block_size requirements are checked at super-block-read-in time.
|
||||||
*/
|
*/
|
||||||
if (OPEN_MAX > 127) panic("OPEN_MAX > 127", NO_NUM);
|
if (OPEN_MAX > 127) panic(__FILE__,"OPEN_MAX > 127", NO_NUM);
|
||||||
if (NR_BUFS < 6) panic("NR_BUFS < 6", NO_NUM);
|
if (NR_BUFS < 6) panic(__FILE__,"NR_BUFS < 6", NO_NUM);
|
||||||
if (V1_INODE_SIZE != 32) panic("V1 inode size != 32", NO_NUM);
|
if (V1_INODE_SIZE != 32) panic(__FILE__,"V1 inode size != 32", NO_NUM);
|
||||||
if (V2_INODE_SIZE != 64) panic("V2 inode size != 64", NO_NUM);
|
if (V2_INODE_SIZE != 64) panic(__FILE__,"V2 inode size != 64", NO_NUM);
|
||||||
if (OPEN_MAX > 8 * sizeof(long)) panic("Too few bits in fp_cloexec", NO_NUM);
|
if (OPEN_MAX > 8 * sizeof(long)) panic(__FILE__,"Too few bits in fp_cloexec", NO_NUM);
|
||||||
|
|
||||||
/* The following initializations are needed to let dev_opcl succeed .*/
|
/* The following initializations are needed to let dev_opcl succeed .*/
|
||||||
fp = (struct fproc *) NULL;
|
fp = (struct fproc *) NULL;
|
||||||
|
@ -203,7 +203,7 @@ PRIVATE void fs_init()
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
if (OK != (s=receive(PM_PROC_NR, &mess)))
|
if (OK != (s=receive(PM_PROC_NR, &mess)))
|
||||||
panic("FS couldn't receive from PM", s);
|
panic(__FILE__,"FS couldn't receive from PM", s);
|
||||||
if (NONE == mess.PR_PROC_NR) break;
|
if (NONE == mess.PR_PROC_NR) break;
|
||||||
|
|
||||||
fp = &fproc[mess.PR_PROC_NR];
|
fp = &fproc[mess.PR_PROC_NR];
|
||||||
|
@ -275,19 +275,20 @@ PRIVATE void load_ram(void)
|
||||||
|
|
||||||
/* Open the root device. */
|
/* Open the root device. */
|
||||||
if (dev_open(root_dev, FS_PROC_NR, R_BIT|W_BIT) != OK) {
|
if (dev_open(root_dev, FS_PROC_NR, R_BIT|W_BIT) != OK) {
|
||||||
panic("Cannot open root device",NO_NUM);
|
panic(__FILE__,"Cannot open root device",NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we must initialize a ram disk, get details from the image device. */
|
/* If we must initialize a ram disk, get details from the image device. */
|
||||||
if (root_dev == DEV_RAM || root_dev != image_dev) {
|
if (root_dev == DEV_RAM || root_dev != image_dev) {
|
||||||
u32_t fsmax;
|
u32_t fsmax;
|
||||||
if (dev_open(image_dev, FS_PROC_NR, R_BIT) != OK)
|
if (dev_open(image_dev, FS_PROC_NR, R_BIT) != OK)
|
||||||
panic("Cannot open RAM image device", NO_NUM);
|
panic(__FILE__,"Cannot open RAM image device", NO_NUM);
|
||||||
|
|
||||||
/* Get size of RAM disk image from the super block. */
|
/* Get size of RAM disk image from the super block. */
|
||||||
sp = &super_block[0];
|
sp = &super_block[0];
|
||||||
sp->s_dev = image_dev;
|
sp->s_dev = image_dev;
|
||||||
if (read_super(sp) != OK) panic("Bad RAM disk image FS", NO_NUM);
|
if (read_super(sp) != OK)
|
||||||
|
panic(__FILE__,"Bad RAM disk image FS", NO_NUM);
|
||||||
|
|
||||||
lcount = sp->s_zones << sp->s_log_zone_size; /* # blks on root dev*/
|
lcount = sp->s_zones << sp->s_log_zone_size; /* # blks on root dev*/
|
||||||
|
|
||||||
|
@ -309,7 +310,7 @@ PRIVATE void load_ram(void)
|
||||||
m_out.REQUEST = MIOCRAMSIZE;
|
m_out.REQUEST = MIOCRAMSIZE;
|
||||||
m_out.POSITION = ram_size_kb*1024;
|
m_out.POSITION = ram_size_kb*1024;
|
||||||
if (sendrec(MEMORY, &m_out) != OK || m_out.REP_STATUS != OK)
|
if (sendrec(MEMORY, &m_out) != OK || m_out.REP_STATUS != OK)
|
||||||
panic("Can't set RAM disk size", NO_NUM);
|
panic(__FILE__,"can't set RAM disk size", NO_NUM);
|
||||||
|
|
||||||
|
|
||||||
#if ENABLE_CACHE2
|
#if ENABLE_CACHE2
|
||||||
|
@ -335,7 +336,7 @@ PRIVATE void load_ram(void)
|
||||||
if(block_size_ram != block_size_image) {
|
if(block_size_ram != block_size_image) {
|
||||||
printf("ram block size: %d image block size: %d\n",
|
printf("ram block size: %d image block size: %d\n",
|
||||||
block_size_ram, block_size_image);
|
block_size_ram, block_size_image);
|
||||||
panic("Sorry, ram disk and image disk block sizes have to be the same.", NO_NUM);
|
panic(__FILE__,"ram disk and image disk block sizes must match", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (b = 0; b < (block_t) lcount; b++) {
|
for (b = 0; b < (block_t) lcount; b++) {
|
||||||
|
@ -401,7 +402,7 @@ dev_t super_dev; /* place to get superblock from */
|
||||||
rip = get_inode(super_dev, ROOT_INODE); /* inode for root dir */
|
rip = get_inode(super_dev, ROOT_INODE); /* inode for root dir */
|
||||||
if ( (rip->i_mode & I_TYPE) != I_DIRECTORY || rip->i_nlinks < 3) bad++;
|
if ( (rip->i_mode & I_TYPE) != I_DIRECTORY || rip->i_nlinks < 3) bad++;
|
||||||
}
|
}
|
||||||
if (bad) panic("Invalid root file system", NO_NUM);
|
if (bad) panic(__FILE__,"Invalid root file system", NO_NUM);
|
||||||
|
|
||||||
sp->s_imount = rip;
|
sp->s_imount = rip;
|
||||||
dup_inode(rip);
|
dup_inode(rip);
|
||||||
|
|
|
@ -290,7 +290,7 @@ int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
||||||
bp = get_block(ldir_ptr->i_dev, b, NORMAL); /* get a dir block */
|
bp = get_block(ldir_ptr->i_dev, b, NORMAL); /* get a dir block */
|
||||||
|
|
||||||
if(bp == NO_BLOCK)
|
if(bp == NO_BLOCK)
|
||||||
panic("get_block returned NO_BLOCK", NO_NUM);
|
panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM);
|
||||||
|
|
||||||
/* Search a directory block. */
|
/* Search a directory block. */
|
||||||
for (dp = &bp->b_dir[0]; dp < &bp->b_dir[NR_DIR_ENTRIES(ldir_ptr->i_sp->s_block_size)]; dp++) {
|
for (dp = &bp->b_dir[0]; dp < &bp->b_dir[NR_DIR_ENTRIES(ldir_ptr->i_sp->s_block_size)]; dp++) {
|
||||||
|
|
|
@ -60,7 +60,8 @@ PUBLIC int do_pipe()
|
||||||
return(err_code);
|
return(err_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read_only(rip) != OK) panic("pipe device is read only", NO_NUM);
|
if (read_only(rip) != OK)
|
||||||
|
panic(__FILE__,"pipe device is read only", NO_NUM);
|
||||||
|
|
||||||
rip->i_pipe = I_PIPE;
|
rip->i_pipe = I_PIPE;
|
||||||
rip->i_mode &= ~I_REGULAR;
|
rip->i_mode &= ~I_REGULAR;
|
||||||
|
@ -225,7 +226,7 @@ int bytes; /* if hanging on task, how many bytes read */
|
||||||
register struct fproc *rfp;
|
register struct fproc *rfp;
|
||||||
register int task;
|
register int task;
|
||||||
|
|
||||||
if (proc_nr < 0 || proc_nr >= NR_PROCS) panic("revive err", proc_nr);
|
if (proc_nr < 0 || proc_nr >= NR_PROCS) panic(__FILE__,"revive err", proc_nr);
|
||||||
rfp = &fproc[proc_nr];
|
rfp = &fproc[proc_nr];
|
||||||
if (rfp->fp_suspended == NOT_SUSPENDED || rfp->fp_revived == REVIVING)return;
|
if (rfp->fp_suspended == NOT_SUSPENDED || rfp->fp_revived == REVIVING)return;
|
||||||
|
|
||||||
|
@ -269,7 +270,7 @@ PUBLIC int do_unpause()
|
||||||
|
|
||||||
if (who > PM_PROC_NR) return(EPERM);
|
if (who > PM_PROC_NR) return(EPERM);
|
||||||
proc_nr = m_in.pro;
|
proc_nr = m_in.pro;
|
||||||
if (proc_nr < 0 || proc_nr >= NR_PROCS) panic("unpause err 1", proc_nr);
|
if (proc_nr < 0 || proc_nr >= NR_PROCS) panic(__FILE__,"unpause err 1", proc_nr);
|
||||||
rfp = &fproc[proc_nr];
|
rfp = &fproc[proc_nr];
|
||||||
if (rfp->fp_suspended == NOT_SUSPENDED) return(OK);
|
if (rfp->fp_suspended == NOT_SUSPENDED) return(OK);
|
||||||
task = -rfp->fp_task;
|
task = -rfp->fp_task;
|
||||||
|
@ -286,7 +287,8 @@ PUBLIC int do_unpause()
|
||||||
|
|
||||||
default: /* process trying to do device I/O (e.g. tty)*/
|
default: /* process trying to do device I/O (e.g. tty)*/
|
||||||
fild = (rfp->fp_fd >> 8) & BYTE;/* extract file descriptor */
|
fild = (rfp->fp_fd >> 8) & BYTE;/* extract file descriptor */
|
||||||
if (fild < 0 || fild >= OPEN_MAX)panic("unpause err 2",NO_NUM);
|
if (fild < 0 || fild >= OPEN_MAX)
|
||||||
|
panic(__FILE__,"unpause err 2",NO_NUM);
|
||||||
f = rfp->fp_filp[fild];
|
f = rfp->fp_filp[fild];
|
||||||
dev = (dev_t) f->filp_ino->i_zone[0]; /* device hung on */
|
dev = (dev_t) f->filp_ino->i_zone[0]; /* device hung on */
|
||||||
mess.TTY_LINE = (dev >> MINOR) & BYTE;
|
mess.TTY_LINE = (dev >> MINOR) & BYTE;
|
||||||
|
|
|
@ -164,7 +164,7 @@ _PROTOTYPE( unsigned conv2, (int norm, int w) );
|
||||||
_PROTOTYPE( long conv4, (int norm, long x) );
|
_PROTOTYPE( long conv4, (int norm, long x) );
|
||||||
_PROTOTYPE( int fetch_name, (char *path, int len, int flag) );
|
_PROTOTYPE( int fetch_name, (char *path, int len, int flag) );
|
||||||
_PROTOTYPE( int no_sys, (void) );
|
_PROTOTYPE( int no_sys, (void) );
|
||||||
_PROTOTYPE( void panic, (char *format, int num) );
|
_PROTOTYPE( void panic, (char *who, char *mess, int num) );
|
||||||
|
|
||||||
/* write.c */
|
/* write.c */
|
||||||
_PROTOTYPE( void clear_zone, (struct inode *rip, off_t pos, int flag) );
|
_PROTOTYPE( void clear_zone, (struct inode *rip, off_t pos, int flag) );
|
||||||
|
|
|
@ -79,7 +79,7 @@ int rw_flag; /* READING or WRITING */
|
||||||
* it means something has gone wrong we can't repair now.
|
* it means something has gone wrong we can't repair now.
|
||||||
*/
|
*/
|
||||||
if(copy_queue_used != 0) {
|
if(copy_queue_used != 0) {
|
||||||
panic("copy queue size nonzero when entering read_write().",
|
panic(__FILE__,"copy queue size nonzero when entering read_write().",
|
||||||
copy_queue_used);
|
copy_queue_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +124,13 @@ int rw_flag; /* READING or WRITING */
|
||||||
|
|
||||||
if((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) {
|
if((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) {
|
||||||
if(rip->i_zone[0] == NO_DEV)
|
if(rip->i_zone[0] == NO_DEV)
|
||||||
panic("read_write tries to read from character device NO_DEV", NO_NUM);
|
panic(__FILE__,"read_write tries to read from character device NO_DEV", NO_NUM);
|
||||||
block_size = get_block_size(rip->i_zone[0]);
|
block_size = get_block_size(rip->i_zone[0]);
|
||||||
}
|
}
|
||||||
if((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) {
|
if((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) {
|
||||||
f_size = LONG_MAX;
|
f_size = LONG_MAX;
|
||||||
if(rip->i_zone[0] == NO_DEV)
|
if(rip->i_zone[0] == NO_DEV)
|
||||||
panic("read_write tries to read from block device NO_DEV", NO_NUM);
|
panic(__FILE__,"read_write tries to read from block device NO_DEV", NO_NUM);
|
||||||
block_size = get_block_size(rip->i_zone[0]);
|
block_size = get_block_size(rip->i_zone[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ int *completed; /* number of bytes copied */
|
||||||
|
|
||||||
/* In all cases, bp now points to a valid buffer. */
|
/* In all cases, bp now points to a valid buffer. */
|
||||||
if(bp == NIL_BUF) {
|
if(bp == NIL_BUF) {
|
||||||
panic("bp not valid in rw_chunk, this can't happen", NO_NUM);
|
panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM);
|
||||||
}
|
}
|
||||||
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
|
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
|
||||||
position >= rip->i_size && off == 0) {
|
position >= rip->i_size && off == 0) {
|
||||||
|
@ -348,20 +348,20 @@ int *completed; /* number of bytes copied */
|
||||||
#else
|
#else
|
||||||
/* have to copy a buffer now. remember to do it. */
|
/* have to copy a buffer now. remember to do it. */
|
||||||
if(copy_queue_used < 0 || copy_queue_used > COPY_QUEUE_LEN) {
|
if(copy_queue_used < 0 || copy_queue_used > COPY_QUEUE_LEN) {
|
||||||
panic("copy_queue_used illegal size", copy_queue_used);
|
panic(__FILE__,"copy_queue_used illegal size", copy_queue_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(copy_queue_used == COPY_QUEUE_LEN) {
|
if(copy_queue_used == COPY_QUEUE_LEN) {
|
||||||
r = rw_chunk_finish(completed);
|
r = rw_chunk_finish(completed);
|
||||||
if(copy_queue_used != 0) {
|
if(copy_queue_used != 0) {
|
||||||
panic("copy_queue_used nonzero", copy_queue_used);
|
panic(__FILE__,"copy_queue_used nonzero", copy_queue_used);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = copy_queue_used++;
|
entry = copy_queue_used++;
|
||||||
|
|
||||||
if(entry < 0 || entry >= COPY_QUEUE_LEN) {
|
if(entry < 0 || entry >= COPY_QUEUE_LEN) {
|
||||||
panic("entry illegal slot", entry);
|
panic(__FILE__,"entry illegal slot", entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_queue[entry].bp = bp;
|
copy_queue[entry].bp = bp;
|
||||||
|
@ -422,7 +422,7 @@ PRIVATE int rw_chunk_finish(int *completed)
|
||||||
m.VCP_VEC_ADDR = (char *) vir_cp_req;
|
m.VCP_VEC_ADDR = (char *) vir_cp_req;
|
||||||
|
|
||||||
if((r=sendrec(SYSTASK, &m)) < 0) {
|
if((r=sendrec(SYSTASK, &m)) < 0) {
|
||||||
panic("rw_chunk_finish: virvcopy sendrec failed", r);
|
panic(__FILE__,"rw_chunk_finish: virvcopy sendrec failed", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
*completed = total;
|
*completed = total;
|
||||||
|
@ -524,7 +524,7 @@ int index; /* index into *bp */
|
||||||
(zone < (zone_t) sp->s_firstdatazone || zone >= sp->s_zones)) {
|
(zone < (zone_t) sp->s_firstdatazone || zone >= sp->s_zones)) {
|
||||||
printf("Illegal zone number %ld in indirect block, index %d\n",
|
printf("Illegal zone number %ld in indirect block, index %d\n",
|
||||||
(long) zone, index);
|
(long) zone, index);
|
||||||
panic("check file system", NO_NUM);
|
panic(__FILE__,"check file system", NO_NUM);
|
||||||
}
|
}
|
||||||
return(zone);
|
return(zone);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ bit_t origin; /* number of bit to start searching at */
|
||||||
bit_t i, b;
|
bit_t i, b;
|
||||||
|
|
||||||
if (sp->s_rd_only)
|
if (sp->s_rd_only)
|
||||||
panic("can't allocate bit on read-only filesys.", NO_NUM);
|
panic(__FILE__,"can't allocate bit on read-only filesys.", NO_NUM);
|
||||||
|
|
||||||
if (map == IMAP) {
|
if (map == IMAP) {
|
||||||
start_block = START_BLOCK;
|
start_block = START_BLOCK;
|
||||||
|
@ -112,7 +112,7 @@ bit_t bit_returned; /* number of bit to insert into the map */
|
||||||
block_t start_block;
|
block_t start_block;
|
||||||
|
|
||||||
if (sp->s_rd_only)
|
if (sp->s_rd_only)
|
||||||
panic("can't free bit on read-only filesys.", NO_NUM);
|
panic(__FILE__,"can't free bit on read-only filesys.", NO_NUM);
|
||||||
|
|
||||||
if (map == IMAP) {
|
if (map == IMAP) {
|
||||||
start_block = START_BLOCK;
|
start_block = START_BLOCK;
|
||||||
|
@ -128,7 +128,7 @@ bit_t bit_returned; /* number of bit to insert into the map */
|
||||||
|
|
||||||
k = conv2(sp->s_native, (int) bp->b_bitmap[word]);
|
k = conv2(sp->s_native, (int) bp->b_bitmap[word]);
|
||||||
if (!(k & mask)) {
|
if (!(k & mask)) {
|
||||||
panic(map == IMAP ? "tried to free unused inode" :
|
panic(__FILE__,map == IMAP ? "tried to free unused inode" :
|
||||||
"tried to free unused block", NO_NUM);
|
"tried to free unused block", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,13 +151,13 @@ dev_t dev; /* device number whose super_block is sought */
|
||||||
register struct super_block *sp;
|
register struct super_block *sp;
|
||||||
|
|
||||||
if(dev == NO_DEV)
|
if(dev == NO_DEV)
|
||||||
panic("request for super_block of NO_DEV in get_super()", NO_NUM);
|
panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
|
||||||
|
|
||||||
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
|
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
|
||||||
if (sp->s_dev == dev) return(sp);
|
if (sp->s_dev == dev) return(sp);
|
||||||
|
|
||||||
/* Search failed. Something wrong. */
|
/* Search failed. Something wrong. */
|
||||||
panic("can't find superblock for device (in decimal)", (int) dev);
|
panic(__FILE__,"can't find superblock for device (in decimal)", (int) dev);
|
||||||
|
|
||||||
return(NIL_SUPER); /* to keep the compiler and lint quiet */
|
return(NIL_SUPER); /* to keep the compiler and lint quiet */
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ PUBLIC int get_block_size(dev_t dev)
|
||||||
register struct super_block *sp;
|
register struct super_block *sp;
|
||||||
|
|
||||||
if(dev == NO_DEV)
|
if(dev == NO_DEV)
|
||||||
panic("request for block size of NO_DEV in get_block_size()", NO_NUM);
|
panic(__FILE__,"request for block size of NO_DEV", NO_NUM);
|
||||||
|
|
||||||
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
|
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
|
||||||
if (sp->s_dev == dev)
|
if (sp->s_dev == dev)
|
||||||
|
@ -219,7 +219,7 @@ register struct super_block *sp; /* pointer to a superblock */
|
||||||
|
|
||||||
dev = sp->s_dev; /* save device (will be overwritten by copy) */
|
dev = sp->s_dev; /* save device (will be overwritten by copy) */
|
||||||
if(dev == NO_DEV)
|
if(dev == NO_DEV)
|
||||||
panic("request for super_block of NO_DEV in read_super()", NO_NUM);
|
panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
|
||||||
r = dev_io(DEV_READ, dev, FS_PROC_NR,
|
r = dev_io(DEV_READ, dev, FS_PROC_NR,
|
||||||
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0);
|
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0);
|
||||||
if(r != MIN_BLOCK_SIZE) {
|
if(r != MIN_BLOCK_SIZE) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ PUBLIC time_t clock_time()
|
||||||
register int k;
|
register int k;
|
||||||
clock_t uptime;
|
clock_t uptime;
|
||||||
|
|
||||||
if ( (k=sys_getuptime(&uptime)) != OK) panic("clock_time err", k);
|
if ( (k=sys_getuptime(&uptime)) != OK) panic(__FILE__,"clock_time err", k);
|
||||||
return( (time_t) (boottime + (uptime/HZ)));
|
return( (time_t) (boottime + (uptime/HZ)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +93,10 @@ PUBLIC int no_sys()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* panic *
|
* panic *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void panic(format, num)
|
PUBLIC void panic(who, mess, num)
|
||||||
char *format; /* format string */
|
char *who; /* who caused the panic */
|
||||||
int num; /* number to go with format string */
|
char *mess; /* panic message string */
|
||||||
|
int num; /* number to go with it */
|
||||||
{
|
{
|
||||||
/* 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 value of a
|
* inconsistency is detected, e.g., a programming error or illegal value of a
|
||||||
|
@ -106,12 +107,10 @@ int num; /* number to go with format string */
|
||||||
if (panicking) return; /* do not panic during a sync */
|
if (panicking) return; /* do not panic during a sync */
|
||||||
panicking = TRUE; /* prevent another panic during the sync */
|
panicking = TRUE; /* prevent another panic during the sync */
|
||||||
|
|
||||||
printf("File system panic: %s ", format);
|
printf("FS panic (%s): %s ", who, mess);
|
||||||
if (num != NO_NUM) printf("%d",num);
|
if (num != NO_NUM) printf("%d",num);
|
||||||
(void) do_sync(); /* flush everything to the disk */
|
(void) do_sync(); /* flush everything to the disk */
|
||||||
sys_exit(1);
|
sys_exit(1);
|
||||||
printf("FS: I'm still alive after exit!\n");
|
|
||||||
while(1) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -225,21 +225,21 @@ int line;
|
||||||
printf("panic at %s, %d: ", file, line);
|
printf("panic at %s, %d: ", file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC void panic()
|
PUBLIC void inet_panic()
|
||||||
{
|
{
|
||||||
printf("\ninet stacktrace: ");
|
printf("\ninet stacktrace: ");
|
||||||
stacktrace();
|
stacktrace();
|
||||||
server_panic("INET","aborted due to a panic",NO_NUM);
|
panic("INET","aborted due to a panic",NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* CRAMPED */
|
#else /* CRAMPED */
|
||||||
|
|
||||||
PUBLIC void panic(file, line)
|
PUBLIC void inet_panic(file, line)
|
||||||
char *file;
|
char *file;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
printf("panic at %s, %d\n", file, line);
|
printf("panic at %s, %d\n", file, line);
|
||||||
server_panic("INET","aborted due to a panic",NO_NUM);
|
panic("INET","aborted due to a panic",NO_NUM);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ char *what;
|
||||||
{
|
{
|
||||||
panic0(file, line);
|
panic0(file, line);
|
||||||
printf("assertion \"%s\" failed", what);
|
printf("assertion \"%s\" failed", what);
|
||||||
panic();
|
inet_panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ int rhs;
|
||||||
{
|
{
|
||||||
panic0(file, line);
|
panic0(file, line);
|
||||||
printf("compare (%d) %s (%d) failed", lhs, what, rhs);
|
printf("compare (%d) %s (%d) failed", lhs, what, rhs);
|
||||||
panic();
|
inet_panic();
|
||||||
}
|
}
|
||||||
#endif /* !NDEBUG */
|
#endif /* !NDEBUG */
|
||||||
|
|
||||||
|
|
|
@ -63,16 +63,16 @@ typedef int ioreq_t;
|
||||||
#if CRAMPED
|
#if CRAMPED
|
||||||
|
|
||||||
/* Minimum panic info. */
|
/* Minimum panic info. */
|
||||||
#define ip_panic(print_list) panic(this_file, __LINE__)
|
#define ip_panic(print_list) inet_panic(this_file, __LINE__)
|
||||||
_PROTOTYPE( void panic, (char *file, int line) );
|
_PROTOTYPE( void inet_panic, (char *file, int line) );
|
||||||
|
|
||||||
#else /* !CRAMPED */
|
#else /* !CRAMPED */
|
||||||
|
|
||||||
/* Maximum panic info. */
|
/* Maximum panic info. */
|
||||||
#define ip_panic(print_list) \
|
#define ip_panic(print_list) \
|
||||||
(panic0(this_file, __LINE__), printf print_list, panic())
|
(panic0(this_file, __LINE__), printf print_list, inet_panic())
|
||||||
_PROTOTYPE( void panic0, (char *file, int line) );
|
_PROTOTYPE( void panic0, (char *file, int line) );
|
||||||
_PROTOTYPE( void panic, (void) );
|
_PROTOTYPE( void inet_panic, (void) );
|
||||||
|
|
||||||
#endif /* !CRAMPED */
|
#endif /* !CRAMPED */
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ a = is.h proto.h glo.h \
|
||||||
$i/unistd.h $i/stdlib.h $i/stdio.h $i/ansi.h $i/limits.h $i/errno.h \
|
$i/unistd.h $i/stdlib.h $i/stdio.h $i/ansi.h $i/limits.h $i/errno.h \
|
||||||
$s/types.h $m/config.h $m/type.h $m/const.h $m/com.h $m/keymap.h \
|
$s/types.h $m/config.h $m/type.h $m/const.h $m/com.h $m/keymap.h \
|
||||||
$m/syslib.h $s/types.h \
|
$m/syslib.h $s/types.h \
|
||||||
$m/utils.h $m/serverassert.h $m/devio.h
|
$m/utils.h $m/devio.h
|
||||||
|
|
||||||
main.o: $a
|
main.o: $a
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ message *m; /* notification 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("Couldn't get copy of kmessages", r);
|
report("IS","couldn't get copy of kmessages", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ PRIVATE void kmessages_dmp()
|
||||||
|
|
||||||
/* Try to get a copy of the kernel messages. */
|
/* Try to get a copy of the kernel messages. */
|
||||||
if ((r = sys_getkmessages(&kmess)) != OK) {
|
if ((r = sys_getkmessages(&kmess)) != OK) {
|
||||||
report("warning: couldn't get copy of kmessages", r);
|
report("IS","warning: couldn't get copy of kmessages", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ PRIVATE void monparams_dmp()
|
||||||
|
|
||||||
/* Try to get a copy of the boot monitor parameters. */
|
/* Try to get a copy of the boot monitor parameters. */
|
||||||
if ((r = sys_getmonparams(val, sizeof(val))) != OK) {
|
if ((r = sys_getmonparams(val, sizeof(val))) != OK) {
|
||||||
report("warning: couldn't get copy of monitor params", r);
|
report("IS","warning: couldn't get copy of monitor params", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ PRIVATE void irqtab_dmp()
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((r = sys_getirqhooks(irq_hooks)) != OK) {
|
if ((r = sys_getirqhooks(irq_hooks)) != OK) {
|
||||||
report("warning: couldn't get copy of irq hooks", r);
|
report("IS","warning: couldn't get copy of irq hooks", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ PRIVATE void image_dmp()
|
||||||
char* priorities[] = {"task", "higher","high", "normal", "low", "lower", "user","idle"};
|
char* priorities[] = {"task", "higher","high", "normal", "low", "lower", "user","idle"};
|
||||||
|
|
||||||
if ((r = sys_getimage(image)) != OK) {
|
if ((r = sys_getimage(image)) != OK) {
|
||||||
report("warning: couldn't get copy of image table", r);
|
report("IS","warning: couldn't get copy of image table", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("Image table dump showing all processes included in system image.\n");
|
printf("Image table dump showing all processes included in system image.\n");
|
||||||
|
@ -307,12 +307,12 @@ PRIVATE void sched_dmp()
|
||||||
|
|
||||||
/* First obtain a scheduling information. */
|
/* First obtain a scheduling information. */
|
||||||
if ((r = sys_getschedinfo(proc, rdy_head)) != OK) {
|
if ((r = sys_getschedinfo(proc, rdy_head)) != OK) {
|
||||||
report("warning: couldn't get copy of process table", r);
|
report("IS","warning: couldn't get copy of process table", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Then obtain kernel addresses to correct pointer information. */
|
/* Then obtain kernel addresses to correct pointer information. */
|
||||||
if ((r = sys_getkinfo(&kinfo)) != OK) {
|
if ((r = sys_getkinfo(&kinfo)) != OK) {
|
||||||
report("warning: couldn't get kernel addresses", r);
|
report("IS","warning: couldn't get kernel addresses", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,11 +351,11 @@ PRIVATE void kenv_dmp()
|
||||||
struct machine machine;
|
struct machine machine;
|
||||||
int r;
|
int r;
|
||||||
if ((r = sys_getkinfo(&kinfo)) != OK) {
|
if ((r = sys_getkinfo(&kinfo)) != OK) {
|
||||||
report("warning: couldn't get copy of kernel info struct", r);
|
report("IS","warning: couldn't get copy of kernel info struct", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((r = sys_getmachine(&machine)) != OK) {
|
if ((r = sys_getmachine(&machine)) != OK) {
|
||||||
report("warning: couldn't get copy of kernel machine struct", r);
|
report("IS","warning: couldn't get copy of kernel machine struct", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ PRIVATE void memchunks_dmp()
|
||||||
int i,r;
|
int i,r;
|
||||||
struct memory mem[NR_MEMS];
|
struct memory mem[NR_MEMS];
|
||||||
if ((r = sys_getmemchunks(mem)) != OK) {
|
if ((r = sys_getmemchunks(mem)) != OK) {
|
||||||
report("warning: couldn't get copy of mem chunks", r);
|
report("IS","warning: couldn't get copy of mem chunks", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ PRIVATE void sendmask_dmp()
|
||||||
|
|
||||||
/* First obtain a fresh copy of the current process table. */
|
/* First obtain a fresh copy of the current process table. */
|
||||||
if ((r = sys_getproctab(proc)) != OK) {
|
if ((r = sys_getproctab(proc)) != OK) {
|
||||||
report("warning: couldn't get copy of process table", r);
|
report("IS","warning: couldn't get copy of process table", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ PRIVATE void proctab_dmp()
|
||||||
|
|
||||||
/* First obtain a fresh copy of the current process table. */
|
/* First obtain a fresh copy of the current process table. */
|
||||||
if ((r = sys_getproctab(proc)) != OK) {
|
if ((r = sys_getproctab(proc)) != OK) {
|
||||||
report("warning: couldn't get copy of process table", r);
|
report("IS","warning: couldn't get copy of process table", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ PRIVATE void memmap_dmp()
|
||||||
|
|
||||||
/* First obtain a fresh copy of the current process table. */
|
/* First obtain a fresh copy of the current process table. */
|
||||||
if ((r = sys_getproctab(proc)) != OK) {
|
if ((r = sys_getproctab(proc)) != OK) {
|
||||||
report("warning: couldn't get copy of process table", r);
|
report("IS","warning: couldn't get copy of process table", r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,21 +80,6 @@ PUBLIC void main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* report *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC void report(mess, num)
|
|
||||||
char *mess; /* message format to print */
|
|
||||||
int num; /* number to go with the message */
|
|
||||||
{
|
|
||||||
if (num != NO_NUM) {
|
|
||||||
printf("IS: %s %d\n", mess, num);
|
|
||||||
} else {
|
|
||||||
printf("IS: %s\n", mess);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* init_server *
|
* init_server *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
@ -128,7 +113,7 @@ PRIVATE void get_work()
|
||||||
int status = 0;
|
int status = 0;
|
||||||
status = receive(ANY, &m_in); /* this blocks until message arrives */
|
status = receive(ANY, &m_in); /* this blocks until message arrives */
|
||||||
if (OK != status)
|
if (OK != status)
|
||||||
server_panic("IS","failed to receive message!", status);
|
panic("IS","failed to receive message!", status);
|
||||||
who = m_in.m_source; /* message arrived! set sender */
|
who = m_in.m_source; /* message arrived! set sender */
|
||||||
callnr = m_in.m_type; /* set function call number */
|
callnr = m_in.m_type; /* set function call number */
|
||||||
}
|
}
|
||||||
|
@ -145,7 +130,7 @@ int result; /* report result to replyee */
|
||||||
m_out.m_type = result; /* build reply message */
|
m_out.m_type = result; /* build reply message */
|
||||||
send_status = send(who, &m_out); /* send the message */
|
send_status = send(who, &m_out); /* send the message */
|
||||||
if (OK != send_status)
|
if (OK != send_status)
|
||||||
server_panic("IS", "unable to send reply!", send_status);
|
panic("IS", "unable to send reply!", send_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
_PROTOTYPE( void main, (void) );
|
_PROTOTYPE( void main, (void) );
|
||||||
_PROTOTYPE( void report, (char *, int n) );
|
|
||||||
|
|
||||||
/* putk.c */
|
/* putk.c */
|
||||||
_PROTOTYPE( void kputc, (int c) );
|
_PROTOTYPE( void kputc, (int c) );
|
||||||
|
|
|
@ -108,7 +108,8 @@ phys_clicks clicks; /* number of clicks to free */
|
||||||
register struct hole *hp, *new_ptr, *prev_ptr;
|
register struct hole *hp, *new_ptr, *prev_ptr;
|
||||||
|
|
||||||
if (clicks == 0) return;
|
if (clicks == 0) return;
|
||||||
if ( (new_ptr = free_slots) == NIL_HOLE) panic("Hole table full", NO_NUM);
|
if ( (new_ptr = free_slots) == NIL_HOLE)
|
||||||
|
panic(__FILE__,"hole table full", NO_NUM);
|
||||||
new_ptr->h_base = base;
|
new_ptr->h_base = base;
|
||||||
new_ptr->h_len = clicks;
|
new_ptr->h_len = clicks;
|
||||||
free_slots = new_ptr->h_next;
|
free_slots = new_ptr->h_next;
|
||||||
|
@ -219,7 +220,7 @@ phys_clicks *free; /* memory size summaries */
|
||||||
|
|
||||||
/* Get a copy of the physical memory chunks found at the kernel. */
|
/* Get a copy of the physical memory chunks found at the kernel. */
|
||||||
if ((i=sys_getmemchunks(mem)) != OK)
|
if ((i=sys_getmemchunks(mem)) != OK)
|
||||||
panic("PM couldn't get mem chunks",i);
|
panic(__FILE__,"couldn't get mem chunks",i);
|
||||||
|
|
||||||
/* Put all holes on the free list. */
|
/* Put all holes on the free list. */
|
||||||
for (hp = &hole[0]; hp < &hole[NR_HOLES]; hp++) hp->h_next = hp + 1;
|
for (hp = &hole[0]; hp < &hole[NR_HOLES]; hp++) hp->h_next = hp + 1;
|
||||||
|
|
|
@ -50,7 +50,7 @@ PUBLIC int do_brk()
|
||||||
}
|
}
|
||||||
new_clicks -= rmp->mp_seg[D].mem_vir;
|
new_clicks -= rmp->mp_seg[D].mem_vir;
|
||||||
if ((r=get_stack_ptr(who, &new_sp)) != OK) /* ask kernel for sp value */
|
if ((r=get_stack_ptr(who, &new_sp)) != OK) /* ask kernel for sp value */
|
||||||
panic("PM couldn't get stack pointer", r);
|
panic(__FILE__,"couldn't get stack pointer", r);
|
||||||
r = adjust(rmp, new_clicks, new_sp);
|
r = adjust(rmp, new_clicks, new_sp);
|
||||||
rmp->mp_reply.reply_ptr = (r == OK ? m_in.addr : (char *) -1);
|
rmp->mp_reply.reply_ptr = (r == OK ? m_in.addr : (char *) -1);
|
||||||
return(r); /* return new address or -1 */
|
return(r); /* return new address or -1 */
|
||||||
|
|
|
@ -129,7 +129,7 @@ PUBLIC int do_exec()
|
||||||
src = (vir_bytes) mbuf;
|
src = (vir_bytes) mbuf;
|
||||||
r = sys_datacopy(PM_PROC_NR, (vir_bytes) src,
|
r = sys_datacopy(PM_PROC_NR, (vir_bytes) src,
|
||||||
who, (vir_bytes) vsp, (phys_bytes)stk_bytes);
|
who, (vir_bytes) vsp, (phys_bytes)stk_bytes);
|
||||||
if (r != OK) panic("do_exec stack copy err on", who);
|
if (r != OK) panic(__FILE__,"do_exec stack copy err on", who);
|
||||||
|
|
||||||
/* Read in text and data segments. */
|
/* Read in text and data segments. */
|
||||||
if (sh_mp != NULL) {
|
if (sh_mp != NULL) {
|
||||||
|
@ -381,7 +381,7 @@ phys_bytes tot_bytes; /* total memory to allocate, including gap */
|
||||||
count = MIN(bytes, (phys_bytes) sizeof(zero));
|
count = MIN(bytes, (phys_bytes) sizeof(zero));
|
||||||
if ((s=sys_physcopy(PM_PROC_NR, D, (phys_bytes) zero,
|
if ((s=sys_physcopy(PM_PROC_NR, D, (phys_bytes) zero,
|
||||||
NONE, PHYS_SEG, base, count)) != OK) {
|
NONE, PHYS_SEG, base, count)) != OK) {
|
||||||
panic("new_mem can't zero", s);
|
panic(__FILE__,"new_mem can't zero", s);
|
||||||
}
|
}
|
||||||
base += count;
|
base += count;
|
||||||
bytes -= count;
|
bytes -= count;
|
||||||
|
|
|
@ -64,7 +64,7 @@ PUBLIC int do_fork()
|
||||||
child_abs = (phys_bytes) child_base << CLICK_SHIFT;
|
child_abs = (phys_bytes) child_base << CLICK_SHIFT;
|
||||||
parent_abs = (phys_bytes) rmp->mp_seg[D].mem_phys << CLICK_SHIFT;
|
parent_abs = (phys_bytes) rmp->mp_seg[D].mem_phys << CLICK_SHIFT;
|
||||||
i = sys_abscopy(parent_abs, child_abs, prog_bytes);
|
i = sys_abscopy(parent_abs, child_abs, prog_bytes);
|
||||||
if (i < 0) panic("do_fork can't copy", i);
|
if (i < 0) panic(__FILE__,"do_fork can't copy", i);
|
||||||
|
|
||||||
/* Find a slot in 'mproc' for the child process. A slot must exist. */
|
/* Find a slot in 'mproc' for the child process. A slot must exist. */
|
||||||
for (rmc = &mproc[0]; rmc < &mproc[NR_PROCS]; rmc++)
|
for (rmc = &mproc[0]; rmc < &mproc[NR_PROCS]; rmc++)
|
||||||
|
|
|
@ -77,7 +77,7 @@ PUBLIC void main()
|
||||||
for (proc_nr=0, rmp=mproc; proc_nr < NR_PROCS; proc_nr++, rmp++) {
|
for (proc_nr=0, rmp=mproc; proc_nr < NR_PROCS; proc_nr++, rmp++) {
|
||||||
if ((rmp->mp_flags & (REPLY | ONSWAP)) == REPLY) {
|
if ((rmp->mp_flags & (REPLY | ONSWAP)) == REPLY) {
|
||||||
if ((s=send(proc_nr, &rmp->mp_reply)) != OK) {
|
if ((s=send(proc_nr, &rmp->mp_reply)) != OK) {
|
||||||
panic("PM can't reply to", proc_nr);
|
panic(__FILE__,"PM can't reply to", proc_nr);
|
||||||
}
|
}
|
||||||
rmp->mp_flags &= ~REPLY;
|
rmp->mp_flags &= ~REPLY;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ PUBLIC void main()
|
||||||
PRIVATE void get_work()
|
PRIVATE void get_work()
|
||||||
{
|
{
|
||||||
/* Wait for the next message and extract useful information from it. */
|
/* Wait for the next message and extract useful information from it. */
|
||||||
if (receive(ANY, &m_in) != OK) panic("PM receive error", NO_NUM);
|
if (receive(ANY, &m_in) != OK) panic(__FILE__,"PM receive error", NO_NUM);
|
||||||
who = m_in.m_source; /* who sent the message */
|
who = m_in.m_source; /* who sent the message */
|
||||||
call_nr = m_in.m_type; /* system call number */
|
call_nr = m_in.m_type; /* system call number */
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ PRIVATE void pm_init()
|
||||||
|
|
||||||
/* Get the memory map of the kernel to see how much memory it uses. */
|
/* Get the memory map of the kernel to see how much memory it uses. */
|
||||||
if ((s=get_mem_map(SYSTASK, kernel_map)) != OK)
|
if ((s=get_mem_map(SYSTASK, kernel_map)) != OK)
|
||||||
panic("PM couldn't get proc entry of SYSTASK",s);
|
panic(__FILE__,"PM couldn't get proc entry of SYSTASK",s);
|
||||||
minix_clicks = (kernel_map[S].mem_phys + kernel_map[S].mem_len)
|
minix_clicks = (kernel_map[S].mem_phys + kernel_map[S].mem_len)
|
||||||
- kernel_map[T].mem_phys;
|
- kernel_map[T].mem_phys;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ PRIVATE void pm_init()
|
||||||
|
|
||||||
/* Get memory map for this process from the kernel. */
|
/* Get memory map for this process from the kernel. */
|
||||||
if ((s=get_mem_map(ip->proc_nr, rmp->mp_seg)) != OK)
|
if ((s=get_mem_map(ip->proc_nr, rmp->mp_seg)) != OK)
|
||||||
panic("couldn't get process entry",s);
|
panic(__FILE__,"couldn't get process entry",s);
|
||||||
if (rmp->mp_seg[T].mem_len != 0) rmp->mp_flags |= SEPARATE;
|
if (rmp->mp_seg[T].mem_len != 0) rmp->mp_flags |= SEPARATE;
|
||||||
minix_clicks += rmp->mp_seg[S].mem_phys +
|
minix_clicks += rmp->mp_seg[S].mem_phys +
|
||||||
rmp->mp_seg[S].mem_len - rmp->mp_seg[T].mem_phys;
|
rmp->mp_seg[S].mem_len - rmp->mp_seg[T].mem_phys;
|
||||||
|
@ -194,14 +194,14 @@ PRIVATE void pm_init()
|
||||||
mess.PR_PROC_NR = ip->proc_nr;
|
mess.PR_PROC_NR = ip->proc_nr;
|
||||||
mess.PR_PID = rmp->mp_pid;
|
mess.PR_PID = rmp->mp_pid;
|
||||||
if (OK != (s=send(FS_PROC_NR, &mess)))
|
if (OK != (s=send(FS_PROC_NR, &mess)))
|
||||||
panic("PM can't sync up with FS", s);
|
panic(__FILE__,"PM can't sync up with FS", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell FS no more SYSTEM processes follow and synchronize. */
|
/* Tell FS no more SYSTEM processes follow and synchronize. */
|
||||||
mess.PR_PROC_NR = NONE;
|
mess.PR_PROC_NR = NONE;
|
||||||
if (sendrec(FS_PROC_NR, &mess) != OK || mess.m_type != OK)
|
if (sendrec(FS_PROC_NR, &mess) != OK || mess.m_type != OK)
|
||||||
panic("PM can't sync up with FS", NO_NUM);
|
panic(__FILE__,"PM can't sync up with FS", NO_NUM);
|
||||||
|
|
||||||
/* INIT process is somewhat special. */
|
/* INIT process is somewhat special. */
|
||||||
sigemptyset(&mproc[INIT_PROC_NR].mp_ignore);
|
sigemptyset(&mproc[INIT_PROC_NR].mp_ignore);
|
||||||
|
|
|
@ -67,7 +67,7 @@ _PROTOTYPE( void setreply, (int proc_nr, int result) );
|
||||||
/* signal.c */
|
/* signal.c */
|
||||||
_PROTOTYPE( int do_alarm, (void) );
|
_PROTOTYPE( int do_alarm, (void) );
|
||||||
_PROTOTYPE( int do_kill, (void) );
|
_PROTOTYPE( int do_kill, (void) );
|
||||||
_PROTOTYPE( int ksig_pending, (void) );
|
_PROTOTYPE( int ksig_pending, (void) );
|
||||||
_PROTOTYPE( int do_pause, (void) );
|
_PROTOTYPE( int do_pause, (void) );
|
||||||
_PROTOTYPE( int set_alarm, (int proc_nr, int sec) );
|
_PROTOTYPE( int set_alarm, (int proc_nr, int sec) );
|
||||||
_PROTOTYPE( int check_sig, (pid_t proc_id, int signo) );
|
_PROTOTYPE( int check_sig, (pid_t proc_id, int signo) );
|
||||||
|
@ -82,7 +82,7 @@ _PROTOTYPE( void check_pending, (struct mproc *rmp) );
|
||||||
/* time.c */
|
/* time.c */
|
||||||
_PROTOTYPE( int do_stime, (void) );
|
_PROTOTYPE( int do_stime, (void) );
|
||||||
_PROTOTYPE( int do_time, (void) );
|
_PROTOTYPE( int do_time, (void) );
|
||||||
_PROTOTYPE( int do_times, (void) );
|
_PROTOTYPE( int do_times, (void) );
|
||||||
|
|
||||||
/* trace.c */
|
/* trace.c */
|
||||||
_PROTOTYPE( int do_trace, (void) );
|
_PROTOTYPE( int do_trace, (void) );
|
||||||
|
@ -92,8 +92,8 @@ _PROTOTYPE( void stop_proc, (struct mproc *rmp, int sig_nr) );
|
||||||
_PROTOTYPE( pid_t get_free_pid, (void) );
|
_PROTOTYPE( pid_t get_free_pid, (void) );
|
||||||
_PROTOTYPE( int allowed, (char *name_buf, struct stat *s_buf, int mask) );
|
_PROTOTYPE( int allowed, (char *name_buf, struct stat *s_buf, int mask) );
|
||||||
_PROTOTYPE( int no_sys, (void) );
|
_PROTOTYPE( int no_sys, (void) );
|
||||||
_PROTOTYPE( void panic, (char *format, int num) );
|
_PROTOTYPE( void panic, (char *who, char *mess, int num) );
|
||||||
_PROTOTYPE( void tell_fs, (int what, int p1, int p2, int p3) );
|
_PROTOTYPE( void tell_fs, (int what, int p1, int p2, int p3) );
|
||||||
_PROTOTYPE( int get_stack_ptr, (int proc_nr, vir_bytes *sp) );
|
_PROTOTYPE( int get_stack_ptr, (int proc_nr, vir_bytes *sp) );
|
||||||
_PROTOTYPE( int get_mem_map, (int proc_nr, struct mem_map *mem_map) );
|
_PROTOTYPE( int get_mem_map, (int proc_nr, struct mem_map *mem_map) );
|
||||||
|
|
||||||
|
|
|
@ -315,7 +315,7 @@ int sec; /* how many seconds delay before the signal */
|
||||||
ticks = LONG_MAX; /* eternity (really TMR_NEVER) */
|
ticks = LONG_MAX; /* eternity (really TMR_NEVER) */
|
||||||
|
|
||||||
if ((s=sys_signalrm(proc_nr, &ticks)) != OK)
|
if ((s=sys_signalrm(proc_nr, &ticks)) != OK)
|
||||||
panic("PM couldn't set signal alarm", s);
|
panic(__FILE__,"couldn't set signal alarm", s);
|
||||||
|
|
||||||
remaining = (int) ((ticks + (HZ-1))/HZ);
|
remaining = (int) ((ticks + (HZ-1))/HZ);
|
||||||
if (remaining < 0) remaining = INT_MAX; /* true value is too large */
|
if (remaining < 0) remaining = INT_MAX; /* true value is too large */
|
||||||
|
@ -364,7 +364,7 @@ int signo; /* signal to send to process (1 to _NSIG) */
|
||||||
if ((rmp->mp_flags & (IN_USE | ZOMBIE)) != IN_USE) {
|
if ((rmp->mp_flags & (IN_USE | ZOMBIE)) != IN_USE) {
|
||||||
printf("PM: signal %d sent to %s process %d\n",
|
printf("PM: signal %d sent to %s process %d\n",
|
||||||
(rmp->mp_flags & ZOMBIE) ? "zombie" : "dead", signo, slot);
|
(rmp->mp_flags & ZOMBIE) ? "zombie" : "dead", signo, slot);
|
||||||
panic("", NO_NUM);
|
panic(__FILE__,"", NO_NUM);
|
||||||
}
|
}
|
||||||
if ((rmp->mp_flags & TRACED) && signo != SIGKILL) {
|
if ((rmp->mp_flags & TRACED) && signo != SIGKILL) {
|
||||||
/* A traced process has special handling. */
|
/* A traced process has special handling. */
|
||||||
|
@ -396,7 +396,7 @@ int signo; /* signal to send to process (1 to _NSIG) */
|
||||||
sm.sm_sighandler = (vir_bytes) rmp->mp_sigact[signo].sa_handler;
|
sm.sm_sighandler = (vir_bytes) rmp->mp_sigact[signo].sa_handler;
|
||||||
sm.sm_sigreturn = rmp->mp_sigreturn;
|
sm.sm_sigreturn = rmp->mp_sigreturn;
|
||||||
if ((s=get_stack_ptr(slot, &new_sp)) != OK)
|
if ((s=get_stack_ptr(slot, &new_sp)) != OK)
|
||||||
panic("PM couldn't get new stack pointer",s);
|
panic(__FILE__,"couldn't get new stack pointer",s);
|
||||||
sm.sm_stkptr = new_sp;
|
sm.sm_stkptr = new_sp;
|
||||||
|
|
||||||
/* Make room for the sigcontext and sigframe struct. */
|
/* Make room for the sigcontext and sigframe struct. */
|
||||||
|
@ -600,7 +600,7 @@ register struct mproc *rmp; /* whose core is to be dumped */
|
||||||
* Maybe make SAFETY_BYTES a parameter.
|
* Maybe make SAFETY_BYTES a parameter.
|
||||||
*/
|
*/
|
||||||
if ((s=get_stack_ptr(slot, ¤t_sp)) != OK)
|
if ((s=get_stack_ptr(slot, ¤t_sp)) != OK)
|
||||||
panic("PM couldn't get new stack pointer",s);
|
panic(__FILE__,"couldn't get new stack pointer",s);
|
||||||
adjust(rmp, rmp->mp_seg[D].mem_len, current_sp);
|
adjust(rmp, rmp->mp_seg[D].mem_len, current_sp);
|
||||||
|
|
||||||
/* Write the memory map of all segments to begin the core file. */
|
/* Write the memory map of all segments to begin the core file. */
|
||||||
|
|
|
@ -30,7 +30,7 @@ PUBLIC int do_time()
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
if ( (s=sys_getuptime(&uptime)) != OK)
|
if ( (s=sys_getuptime(&uptime)) != OK)
|
||||||
panic("PM: warning, do_time couldn't get uptime", s);
|
panic(__FILE__,"do_time couldn't get uptime", s);
|
||||||
|
|
||||||
mp->mp_reply.reply_time = (time_t) (boottime + (uptime/HZ));
|
mp->mp_reply.reply_time = (time_t) (boottime + (uptime/HZ));
|
||||||
return(OK);
|
return(OK);
|
||||||
|
@ -53,7 +53,7 @@ PUBLIC int do_stime()
|
||||||
return(EPERM);
|
return(EPERM);
|
||||||
}
|
}
|
||||||
if ( (s=sys_getuptime(&uptime)) != OK)
|
if ( (s=sys_getuptime(&uptime)) != OK)
|
||||||
panic("PM: warning, do_stime couldn't get uptime", s);
|
panic(__FILE__,"do_stime couldn't get uptime", s);
|
||||||
boottime = (long) m_in.stime - (uptime/HZ);
|
boottime = (long) m_in.stime - (uptime/HZ);
|
||||||
|
|
||||||
/* Also inform FS about the new system time. */
|
/* Also inform FS about the new system time. */
|
||||||
|
@ -74,7 +74,7 @@ PUBLIC int do_times()
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
if (OK != (s=sys_times(who, t)))
|
if (OK != (s=sys_times(who, t)))
|
||||||
panic("PM: warning, do_times couldn't get times", s);
|
panic(__FILE__,"do_times couldn't get times", s);
|
||||||
rmp->mp_reply.reply_t1 = t[0]; /* user time */
|
rmp->mp_reply.reply_t1 = t[0]; /* user time */
|
||||||
rmp->mp_reply.reply_t2 = t[1]; /* system time */
|
rmp->mp_reply.reply_t2 = t[1]; /* system time */
|
||||||
rmp->mp_reply.reply_t3 = rmp->mp_child_utime; /* child user time */
|
rmp->mp_reply.reply_t3 = rmp->mp_child_utime; /* child user time */
|
||||||
|
|
|
@ -78,7 +78,7 @@ int mask; /* R_BIT, W_BIT, or X_BIT */
|
||||||
save_errno = errno; /* open might fail, e.g. from ENFILE */
|
save_errno = errno; /* open might fail, e.g. from ENFILE */
|
||||||
tell_fs(SETUID, PM_PROC_NR, (int) mp->mp_effuid, (int) mp->mp_effuid);
|
tell_fs(SETUID, PM_PROC_NR, (int) mp->mp_effuid, (int) mp->mp_effuid);
|
||||||
if (fd < 0) return(-save_errno);
|
if (fd < 0) return(-save_errno);
|
||||||
if (fstat(fd, s_buf) < 0) panic("allowed: fstat failed", NO_NUM);
|
if (fstat(fd, s_buf) < 0) panic(__FILE__,"allowed: fstat failed", NO_NUM);
|
||||||
|
|
||||||
/* Only regular files can be executed. */
|
/* Only regular files can be executed. */
|
||||||
if (mask == X_BIT && (s_buf->st_mode & I_TYPE) != I_REGULAR) {
|
if (mask == X_BIT && (s_buf->st_mode & I_TYPE) != I_REGULAR) {
|
||||||
|
@ -103,16 +103,17 @@ PUBLIC int no_sys()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* panic *
|
* panic *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void panic(format, num)
|
PUBLIC void panic(who, mess, num)
|
||||||
char *format; /* format string */
|
char *who; /* who caused the panic */
|
||||||
int num; /* number to go with format string */
|
char *mess; /* panic message string */
|
||||||
|
int num; /* number to go with it */
|
||||||
{
|
{
|
||||||
/* An unrecoverable error has occurred. Panics are caused when an internal
|
/* An unrecoverable error has occurred. Panics are caused when an internal
|
||||||
* inconsistency is detected, e.g., a programming error or illegal value of a
|
* inconsistency is detected, e.g., a programming error or illegal value of a
|
||||||
* defined constant. The process manager decides to shut down. This results
|
* defined constant. The process manager decides to shut down. This results
|
||||||
* in a HARD_STOP notification to all system processes to allow local cleanup.
|
* in a HARD_STOP notification to all system processes to allow local cleanup.
|
||||||
*/
|
*/
|
||||||
printf("Process manager panic: %s", format);
|
printf("PM panic (%s): %s", who, mess);
|
||||||
if (num != NO_NUM) printf(": %d",num);
|
if (num != NO_NUM) printf(": %d",num);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
sys_abort(RBT_PANIC);
|
sys_abort(RBT_PANIC);
|
||||||
|
|
Loading…
Reference in a new issue