Disabled comments from FXP driver with #define VERBOSE 0.

Fixed all troubles reported at shutdown.
No more illegal FS calls by dead processes.
This commit is contained in:
Jorrit Herder 2005-08-03 16:58:22 +00:00
parent 89cf745fe2
commit 3f28baac83
9 changed files with 41 additions and 52 deletions

View file

@ -533,10 +533,12 @@ fxp_t *fp;
}
dname= pci_dev_name(vid, did);
#if VERBOSE
if (!dname)
dname= "unknown device";
printf("%s: %s (%04x/%04x) at %s\n",
fp->fxp_name, dname, vid, did, pci_slot_name(devind));
#endif
pci_reserve(devind);
bar= pci_attr_r32(devind, PCI_BAR_2) & 0xffffffe0;
@ -582,10 +584,12 @@ fxp_t *fp;
case FXP_REV_82551_2: str= "82551(2)"; break; /* 0x10 */
}
#if VERBOSE
if (str)
printf("%s: device revision: %s\n", fp->fxp_name, str);
else
printf("%s: unknown revision: 0x%x\n", fp->fxp_name, rev);
#endif
if (fp->fxp_type == FT_UNKNOWN)
{
@ -660,9 +664,11 @@ fxp_t *fp;
fp->fxp_conf_bytes[20]= CCB20_PFCL | CCB20_RES1;
fp->fxp_conf_bytes[21]= CCB21_RES21;
#if VERBOSE
for (i= 0; i<CC_BYTES_NR; i++)
printf("%d: %0x, ", i, fp->fxp_conf_bytes[i]);
printf("\n");
#endif
mwi= 0; /* Do we want "Memory Write and Invalidate"? */
ext_stat1= 0; /* Do we want extended statistical counters? */
@ -706,9 +712,11 @@ fxp_t *fp;
panic("FXP","fxp_conf_hw: bad device type", fp->fxp_type);
}
#if VERBOSE
for (i= 0; i<CC_BYTES_NR; i++)
printf("%d: %0x, ", i, fp->fxp_conf_bytes[i]);
printf("\n");
#endif
}
@ -930,8 +938,6 @@ fxp_t *fp;
#if 0
if (i != 0 && i != 6) env_panic(eakey); /* It's all or nothing */
#else
printf("not checking for env_panic\n");
#endif
if (i == 0)
@ -970,6 +976,7 @@ fxp_t *fp;
if (!(ias.ias_status & CBL_F_OK))
panic("FXP","fxp_confaddr: CU command failed", NO_NUM);
#if VERBOSE
printf("%s: hardware ethernet address: ", fp->fxp_name);
for (i= 0; i<6; i++)
{
@ -977,6 +984,7 @@ fxp_t *fp;
i < 5 ? ":" : "");
}
printf("\n");
#endif
}
/*===========================================================================*
@ -1910,7 +1918,9 @@ fxp_t *fp;
fp->fxp_link_up= link_up;
if (!link_up)
{
#if VERBOSE
printf("%s: link down\n", fp->fxp_name);
#endif
return;
}
@ -1920,7 +1930,9 @@ fxp_t *fp;
model= ((mii_id2 & MII_PL_MODEL_MASK) >> MII_PL_MODEL_SHIFT);
rev= (mii_id2 & MII_PL_REV_MASK);
#if VERBOSE
printf("OUI 0x%06lx, Model 0x%02x, Revision 0x%x\n", oui, model, rev);
#endif
if (mii_ctrl & (MII_CTRL_LB|MII_CTRL_PD|MII_CTRL_ISO))
{
@ -2309,8 +2321,10 @@ fxp_t *fp;
fxp_outb(port, CSR_EEPROM, 0); /* Disable EEPROM */
micro_delay(EECS_DELAY);
#if VERBOSE
printf("%s EEPROM address length: %d\n",
fp->fxp_name, fp->fxp_ee_addrlen);
#endif
}
@ -2377,8 +2391,10 @@ tmr_func_t watchdog; /* watchdog function to be called */
fxp_timers->tmr_exp_time < fxp_next_timeout)
{
fxp_next_timeout= fxp_timers->tmr_exp_time;
#if VERBOSE
printf("fxp_set_timer: calling sys_setalarm for %d (now+%d)\n",
fxp_next_timeout, fxp_next_timeout-now);
#endif
r= sys_setalarm(fxp_next_timeout, 1);
if (r != OK)
panic("FXP","unable to set synchronous alarm", r);

View file

@ -7,6 +7,8 @@ and 82562 fast ethernet controllers.
Created: Nov 2004 by Philip Homburg <philip@f-mnx.phicoh.com>
*/
#define VERBOSE 0 /* display output during intialization */
/* Revisions in PCI_REV */
#define FXP_REV_82557A 0x01
#define FXP_REV_82557B 0x02

View file

@ -82,7 +82,8 @@ PUBLIC void main()
printf("FS, warning illegal %d system call by %d\n", call_nr, who);
} else if (fp->fp_pid == PID_FREE) {
error = ENOSYS;
printf("FS, bad process, who = %d, call_nr = %d\n", who, call_nr);
printf("FS, bad process, who = %d, call_nr = %d, slot1 = %d\n", who, call_nr, m_in.slot1);
} else {
error = (*call_vec[call_nr])();
}

View file

@ -245,6 +245,11 @@ PUBLIC void main()
clck_tick(&mq->mq_mess);
mq_free(mq);
}
else if (mq->mq_mess.m_type == SYS_SIG)
{
/* signaled */
/* probably SIGTERM */
}
#endif
else
{

View file

@ -260,7 +260,7 @@ PRIVATE void pm_init()
total_clicks = minix_clicks + free_clicks;
printf(" total %u KB,", click_to_round_k(total_clicks));
printf(" system %u KB,", click_to_round_k(minix_clicks));
printf(" available %u KB.\n", click_to_round_k(free_clicks));
printf(" free %u KB.\n", click_to_round_k(free_clicks));
}

View file

@ -162,8 +162,8 @@ PUBLIC int do_reboot()
return(EINVAL);
}
tell_fs(REBOOT,0,0,0); /* tell FS to prepare for shutdown */
check_sig(-1, SIGKILL); /* kill all processes except init */
tell_fs(REBOOT,0,0,0); /* tell FS to prepare for shutdown */
/* Ask the kernel to abort. All system services, including the PM, will
* get a HARD_STOP notification. Await the notification in the main loop.
@ -234,19 +234,8 @@ PUBLIC int do_svrctl()
req = m_in.svrctl_req;
ptr = (vir_bytes) m_in.svrctl_argp;
/* Is the request for the kernel? Forward it, except for SYSGETENV. */
if (((req >> 8) & 0xFF) == 'S') {
/* Binary compatibility check. */
if (req == SYSGETENV) {
printf("SYSGETENV by %d (fix!)\n", who);
req = MMGETPARAM;
}
else
/* Simply forward call to the SYSTEM task. */
return(sys_svrctl(who, req, mp->mp_effuid == SUPER_USER, ptr));
}
/* Is the request indeed for the MM? */
if (((req >> 8) & 0xFF) != 'M') return(EINVAL);
/* Control operations local to the PM. */
switch(req) {
@ -324,37 +313,6 @@ PUBLIC int do_svrctl()
return OK;
}
case MMSIGNON: {
#if DEAD_CODE
/* A user process becomes a task. Simulate an exit by
* releasing a waiting parent and disinheriting children.
*/
struct mproc *rmp;
pid_t pidarg;
if (mp->mp_effuid != SUPER_USER) return(EPERM);
rmp = &mproc[mp->mp_parent];
tell_fs(EXIT, who, 0, 0);
pidarg = rmp->mp_wpid;
if ((rmp->mp_flags & WAITING) && (pidarg == -1
|| pidarg == mp->mp_pid || -pidarg == mp->mp_procgrp))
{
/* Wake up the parent. */
rmp->mp_reply.reply_res2 = 0;
setreply(mp->mp_parent, mp->mp_pid);
rmp->mp_flags &= ~WAITING;
}
/* Disinherit children. */
for (rmp = &mproc[0]; rmp < &mproc[NR_PROCS]; rmp++) {
if ((rmp->mp_flags & IN_USE) && rmp->mp_parent == who) {
rmp->mp_parent = INIT_PROC_NR;
}
}
#endif
return(OK); }
#if ENABLE_SWAP
case MMSWAPON: {

View file

@ -546,7 +546,6 @@ int signo; /* signal to send to process (0 to _NSIG) */
&& mp->mp_effuid != rmp->mp_realuid
&& mp->mp_realuid != rmp->mp_effuid
&& mp->mp_effuid != rmp->mp_effuid) {
DEBUG(m_in.pid == 11, printf("PM: check_sig, EPERM\n"));
error_code = EPERM;
continue;
}
@ -558,7 +557,6 @@ int signo; /* signal to send to process (0 to _NSIG) */
* signal may be caught, blocked, ignored, or cause process
* termination, possibly with core dump.
*/
DEBUG(m_in.pid == 11, printf("PM: calling sig_proc with signo %d\n", signo));
sig_proc(rmp, signo);
if (proc_id > 0) break; /* only one process being signaled */

View file

@ -80,14 +80,16 @@ PUBLIC int do_start(message *m_ptr)
dev_style = STYLE_DEV;
if ((s=mapdriver(child_proc_nr, major_nr, dev_style)) < 0) {
#if VERBOSE
printf("SM: '%s %s', major %d, pid %d, proc_nr %d",
command, arg_buf, major_nr, child_pid, child_proc_nr);
#endif
report("SM", "couldn't map driver", errno);
}
}
if ((s = _taskcall(SYSTEM, SYS_PRIVCTL, &m)) < 0) /* set privileges */
report("SM", "_taskcall to SYSTEM failed", s); /* to let child run */
#if DEAD_CODE
#if VERBOSE
printf("SM: started '%s %s', major %d, pid %d, proc_nr %d",
command, arg_buf, major_nr, child_pid, child_proc_nr);
#endif
@ -113,7 +115,9 @@ PUBLIC int do_exit(message *m_ptr)
pid_t exit_pid;
int exit_status;
#if VERBOSE
printf("SM: got SIGCHLD signal, doing wait to get exited child.\n");
#endif
/* See which child exited and what the exit status is. This is done in a
* loop because multiple childs may have exited, all reported by one
@ -122,12 +126,15 @@ PUBLIC int do_exit(message *m_ptr)
*/
while ( (exit_pid = waitpid(-1, &exit_status, WNOHANG)) != 0 ) {
#if VERBOSE
printf("SM: pid %d,", exit_pid);
if (WIFSIGNALED(exit_status)) {
printf("killed, signal number %d\n", WTERMSIG(exit_status));
} else if (WIFEXITED(exit_status)) {
printf("normal exit, status %d\n", WEXITSTATUS(exit_status));
}
#endif
}
return(OK);
}

View file

@ -7,6 +7,8 @@
#define _SYSTEM 1 /* get OK and negative error codes */
#define _MINIX 1 /* tell headers to include MINIX stuff */
#define VERBOSE 0 /* display diagnostics */
#include <ansi.h>
#include <sys/types.h>
#include <limits.h>