at driver timeout/error message fixes

This commit is contained in:
Ben Gras 2005-08-05 13:50:50 +00:00
parent 2888e14ed8
commit 2713ed6cde

View File

@ -172,7 +172,7 @@ struct command {
int timeout_ticks = DEF_TIMEOUT_TICKS, max_errors = MAX_ERRORS; int timeout_ticks = DEF_TIMEOUT_TICKS, max_errors = MAX_ERRORS;
int wakeup_ticks = WAKEUP; int wakeup_ticks = WAKEUP;
int w_testing = 0; int w_testing = 0, w_silent = 0;
/* Variables. */ /* Variables. */
PRIVATE struct wini { /* main drive struct, one entry per drive */ PRIVATE struct wini { /* main drive struct, one entry per drive */
@ -884,7 +884,7 @@ PRIVATE void w_timeout(void)
default: default:
/* Some other command. */ /* Some other command. */
if(w_testing) wn->state |= IGNORING; /* Kick out this drive. */ if(w_testing) wn->state |= IGNORING; /* Kick out this drive. */
else printf("%s: timeout on command %02x\n", w_name(), w_command); else if(!w_silent) printf("%s: timeout on command %02x\n", w_name(), w_command);
w_need_reset(); w_need_reset();
w_status = 0; w_status = 0;
} }
@ -1263,19 +1263,31 @@ message *m;
SELF, (vir_bytes)&timeout, sizeof(timeout))) != OK) SELF, (vir_bytes)&timeout, sizeof(timeout))) != OK)
return r; return r;
if(timeout < 1) if(timeout == 0) {
/* Restore defaults. */
timeout_ticks = DEF_TIMEOUT_TICKS;
max_errors = MAX_ERRORS;
wakeup_ticks = WAKEUP;
w_silent = 0;
} else if(timeout < 0) {
return EINVAL; return EINVAL;
} else {
prev = wakeup_ticks;
prev = wakeup_ticks; /* Set (lower) timeout, lower error
wakeup_ticks = timeout; * tolerance and set silent mode.
if(timeout_ticks > timeout) */
timeout_ticks = timeout; wakeup_ticks = timeout;
max_errors = 2;
w_silent = 1;
if((r=sys_datacopy(SELF, (vir_bytes)&prev, if(timeout_ticks > timeout)
m->PROC_NR, (vir_bytes)m->ADDRESS, sizeof(prev))) != OK) timeout_ticks = timeout;
return r;
max_errors = 2; if((r=sys_datacopy(SELF, (vir_bytes)&prev,
m->PROC_NR, (vir_bytes)m->ADDRESS, sizeof(prev))) != OK)
return r;
}
return OK; return OK;
} }