Output during initialization should be suppressed. Unless an error occurs.
Note that main() can now be main(int argc, char **argv) and arguments can
be passed when bringing up the driver.
** +------------+---------+---------+---------------+
**
** $Log$
+** Revision 1.5 2005/08/02 15:30:35 jnherder
+** Various updates to support dynamically starting drivers.
+** Output during initialization should be suppressed. Unless an error occurs.
+** Note that main() can now be main(int argc, char **argv) and arguments can
+** be passed when bringing up the driver.
+**
** Revision 1.4 2005/07/29 12:44:41 jnherder
** Small update to SYS_IRQCTL -> setting an interrupt policy now allows the caller
** to provide an index (0 .. 31) that is passed in the HARD_INT message when an
#include "dp.h"
-#if ENABLE_NETWORKING == 1
-
/*
** Local data
*/
+extern int errno;
static dpeth_t de_table[DE_PORT_NR];
static int dpeth_tasknr = ANY;
** Name: int dpeth_task(void)
** Function: Main entry for dp task
*/
-PUBLIC int main(void)
+PUBLIC int main(int argc, char **argv)
{
message m;
dpeth_t *dep;
int rc, fkeys, sfkeys;
/* Get precess number */
- if ((rc = getprocnr(&dpeth_tasknr)) != OK)
- panic(DevName, "getprocnr() failed", rc);
+ if ((dpeth_tasknr = getprocnr()) < 0)
+ panic(DevName, "getprocnr() failed", errno);
#if defined USE_IOPL
/* Request direct access to hardware I/O ports */
if ((rc = sys_enable_iop(dpeth_tasknr)) != OK)
if ((fkey_map(&fkeys, &sfkeys)) != OK)
printf("%s: couldn't program Shift+F8 key (%d)\n", DevName, errno);
+
#ifdef ETH_IGN_PROTO
{
static u16_t eth_ign_proto = 0;
}
#endif
- printf("DPETH: ethernet driver task initialized (process No. %d)\n", dpeth_tasknr);
while (TRUE) {
if ((rc = receive(ANY, &m)) != OK) panic(dep->de_name, RecvErrMsg, rc);
case DL_STOP: /* Stop device */
do_stop(&m);
break;
- case SYS_EVENT: {
+ case SYS_SIG: {
sigset_t sigset = m.NOTIFY_ARG;
if (sigismember(&sigset, SIGKSTOP)) { /* Shut down */
for (rc = 0; rc < DE_PORT_NR; rc += 1) {
return OK; /* Never reached, but keeps compiler happy */
}
-#else
-int main(void) { return 0; }
-#endif /* ENABLE_NETWORKING */
/** dp.c **/
** Interface description for ethernet device driver
**
** $Log$
+** Revision 1.2 2005/08/02 15:30:35 jnherder
+** Various updates to support dynamically starting drivers.
+** Output during initialization should be suppressed. Unless an error occurs.
+** Note that main() can now be main(int argc, char **argv) and arguments can
+** be passed when bringing up the driver.
+**
** Revision 1.1 2005/06/29 10:16:46 beng
** Import of dpeth 3c501/3c509b/.. ethernet driver by
** Giovanni Falzoni <fgalzoni@inwind.it>.
#undef ENABLE_WDETH
#undef ENABLE_DP8390
-#define ENABLE_NETWORKING ENABLE_DPETH /** (from /usr/include/minix/config.h **/
+#define ENABLE_NETWORKING 1
#define ENABLE_3C501 1 /* enable 3Com Etherlink I board */
#define ENABLE_3C503 1 /* enable 3Com Etherlink II board */
if ((s=sys_irqenable(&irq_hook_id)) != OK)
panic("FLOPPY", "Couldn't enable IRQs", s);
- printf("FLOPPY: user-level floppy disk driver initialized\n");
driver_task(&f_dtab);
}
all build: $(DRIVER)
$(DRIVER): $(OBJ) $(LIBPCI)
$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBPCI) $(LIBS)
- install -S 64w $(DRIVER)
+ install -S 256w $(DRIVER)
$(LIBPCI):
cd $d/libpci && $(MAKE)
#define printW() ((void)0)
#define vm_1phys2bus(p) (p)
-#if ENABLE_FXP
#if !ENABLE_PCI
#error PCI support not enabled
#endif
static u16_t eth_ign_proto;
static tmra_ut fxp_watchdog;
+extern int errno;
+
#define fxp_inb(port, offset) (do_inb((port) + (offset)))
#define fxp_inw(port, offset) (do_inw((port) + (offset)))
#define fxp_inl(port, offset) (do_inl((port) + (offset)))
fxp_t *fp;
long v;
- fxp_tasknr= FXP;
+ if ((fxp_tasknr= getprocnr())<0)
+ panic("FXP", "couldn't get proc nr", errno);
v= 0;
#if 0
fxp_check_ints(fp);
}
break;
- case SYS_EVENT: {
+ case SYS_SIG: {
sigset_t sigset = m.NOTIFY_ARG;
if (sigismember(&sigset, SIGKSTOP)) fxp_stop();
break;
panic("FXP","sys_outl failed", r);
}
-#endif /* ENABLE_FXP */
/*
* $PchId: fxp.c,v 1.4 2005/01/31 22:10:37 philip Exp $
#include "config.h"
#endif
-#if ENABLE_FXP
#include "mii.h"
}
}
-#endif /* ENABLE_FXP */
-
/*
* $PchId: mii.c,v 1.2 2005/01/31 22:17:26 philip Exp $
*/
/* This file contains device independent device driver interface.
*
* Changes:
- * Jul 25, 2005 added SYS_EVENT type for signals (Jorrit N. Herder)
+ * Jul 25, 2005 added SYS_SIG type for signals (Jorrit N. Herder)
* Sep 15, 2004 added SYN_ALARM type for timeouts (Jorrit N. Herder)
* Jul 23, 2004 removed kernel dependencies (Jorrit N. Herder)
* Apr 02, 1992 constructed from AT wini and floppy driver (Kees J. Bot)
case HARD_INT: /* leftover interrupt or expired timer. */
continue;
- case SYS_EVENT: (*dp->dr_signal)(dp, &mess);
+ case SYS_SIG: (*dp->dr_signal)(dp, &mess);
continue; /* don't reply */
case SYN_ALARM: (*dp->dr_alarm)(dp, &mess);
continue; /* don't reply */
#if ENABLE_PCI
#if !__minix_vmd
-#define debug 1 /* for ast */
+#define debug 0
#define irq_mode_pci(irq) ((void)0)
#endif
r = do_diagnostics(m_ptr);
break;
}
- case SYS_EVENT: {
+ case SYS_SIG: {
sigset_t sigset = m_ptr->NOTIFY_ARG;
if (sigismember(&sigset, SIGKMESS)) {
do_new_kmess(m_ptr);
PUBLIC void main(void)
{
/* Main routine of the printer task. */
-
message pr_mess; /* buffer for all incoming messages */
-#if DEAD_CODE
- struct sigaction sigact;
-
- /* Install signal handler.*/
- sigact.sa_handler = signal_handler;
- sigact.sa_mask = ~0; /* block all other signals */
- sigact.sa_flags = 0; /* default behaviour */
- printf("PRINTER calls sigaction()\n");
- if (sigaction(SIGTERM, &sigact, NULL) != OK)
- report("PRINTER","warning, sigaction() failed", errno);
-#endif
while (TRUE) {
receive(ANY, &pr_mess);
* |------------+----------+---------+----------+---------+---------|
* | HARD_INT | | | | | |
* |------------|----------|---------|----------|---------|---------|
- * | HARD_STOP | | | | | |
+ * | SYS_SIG | | | | | |
* |------------|----------|---------|----------|---------|---------|
* | DL_WRITE | port nr | proc nr | count | mode | address |
* |------------|----------|---------|----------|---------|---------|
#define printW() ((void)0)
#define vm_1phys2bus(p) (p)
-#if ENABLE_RTL8139
+#define VERBOSE 0 /* display message during init */
+
#if !ENABLE_PCI
#error PCI support not enabled
#endif
re_t *rep;
long v;
- if (getprocnr(&rl_tasknr) != OK)
+ if ((rl_tasknr = getprocnr()) < 0)
panic("RTL8139", "getprocnr failed", errno);
v= 0;
check_int_events();
break ;
case FKEY_PRESSED: rtl8139_dump(&m); break;
- case SYS_EVENT: {
+ case SYS_SIG: {
sigset_t sigset = m.NOTIFY_ARG;
if (sigismember(&sigset, SIGKSTOP)) rtl8139_stop();
break;
}
if (rep->re_mode == REM_ENABLED)
rl_init_hw(rep);
+#if VERBOSE /* load silently ... can always check status later */
rl_report_link(rep);
+#endif
}
assert(rep->re_mode == REM_ENABLED);
return 0;
}
+#if VERBOSE /* stay silent at startup, can always get status later */
dname= pci_dev_name(vid, did);
if (!dname)
dname= "unknown device";
printf("%s: ", rep->re_name);
printf("%s (%x/%x) at %s\n", dname, vid, did, pci_slot_name(devind));
+#endif
pci_reserve(devind);
/* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */
bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
if ((s=sys_irqenable(&rep->re_hook_id)) != OK)
printf("RTL8139: error, couldn't enable interrupts: %d\n", s);
+#if VERBOSE /* stay silent during startup, can always get status later */
if (rep->re_mode) {
printf("%s: model %s\n", rep->re_name, rep->re_model);
} else
rl_inl(rep->re_base_port, RL_TCR) &
(RL_TCR_HWVER_AM | RL_TCR_HWVER_BM));
}
+#endif
rl_confaddr(rep);
if (debug)
outb_reg0(dep, DP_CR, CR_PS_P0); /* back to bank 0 */
}
#endif
-#endif /* ENABLE_RTL8139 */
/*
* $PchId: rtl8139.c,v 1.3 2003/09/11 14:15:15 philip Exp $
Created: Aug 2003 by Philip Homburg <philip@cs.vu.nl>
*/
+#define ENABLE_RTL8139 1
+
#define RL_IDR 0x00 /* Ethernet address
* Note: RL_9346CR_EEM_CONFIG mode is
* required the change the ethernet
switch (m_ptr->FKEY_REQUEST) { /* see what we must do */
case FKEY_MAP: /* request for new mapping */
+ result = OK; /* assume everything will be ok*/
for (i=0; i < 12; i++) { /* check F1-F12 keys */
if (bit_isset(m_ptr->FKEY_FKEYS, i+1) ) {
if (fkey_obs[i].proc_nr == NONE) {
bit_unset(m_ptr->FKEY_FKEYS, i+1);
} else {
printf("WARNING, fkey_map failed F%d\n", i);
- result = EBUSY;
- break;
+ result = EBUSY; /* report failure, but try rest */
}
}
}
bit_unset(m_ptr->FKEY_SFKEYS, i+1);
} else {
printf("WARNING, fkey_map failed Shift F%d\n", i);
- result = EBUSY;
- break;
+ result = EBUSY; /* report failure but try rest */
}
}
}
- result = OK; /* done, new observer registered */
break;
case FKEY_UNMAP:
- result = ENOSYS; /* not yet supported (not needed) */
+ result = OK; /* assume everything will be ok*/
+ for (i=0; i < 12; i++) { /* check F1-F12 keys */
+ if (bit_isset(m_ptr->FKEY_FKEYS, i+1) ) {
+ if (fkey_obs[i].proc_nr == m_ptr->m_source) {
+ fkey_obs[i].proc_nr = NONE;
+ fkey_obs[i].events = 0;
+ bit_unset(m_ptr->FKEY_FKEYS, i+1);
+ } else {
+ result = EPERM; /* report failure, but try rest */
+ }
+ }
+ }
+ for (i=0; i < 12; i++) { /* check Shift+F1-F12 keys */
+ if (bit_isset(m_ptr->FKEY_SFKEYS, i+1) ) {
+ if (sfkey_obs[i].proc_nr == m_ptr->m_source) {
+ sfkey_obs[i].proc_nr = NONE;
+ sfkey_obs[i].events = 0;
+ bit_unset(m_ptr->FKEY_SFKEYS, i+1);
+ } else {
+ result = EPERM; /* report failure, but try rest */
+ }
+ }
+ }
break;
case FKEY_EVENTS:
m_ptr->FKEY_FKEYS = m_ptr->FKEY_SFKEYS = 0;
while (nb_receive(ANY, m) == OK) {
switch(m->m_type) {
case FKEY_CONTROL: do_fkey_ctl(m); break;
- case SYS_EVENT: do_new_kmess(m); break;
+ case SYS_SIG: do_new_kmess(m); break;
case DIAGNOSTICS: do_diagnostics(m); break;
default: ; /* do nothing */
}
* The valid messages and their parameters are:
*
* HARD_INT: output has been completed or input has arrived
- * SYS_EVENT: e.g., MINIX wants to shutdown; run code to cleanly stop
+ * SYS_SIG: e.g., MINIX wants to shutdown; run code to cleanly stop
* DEV_READ: a process wants to read from a terminal
* DEV_WRITE: a process wants to write on a terminal
* DEV_IOCTL: a process wants to change a terminal's parameters
* ---------------------------------------------------------------------------
* | HARD_INT | | | | | | |
* |-------------+---------+---------+---------+---------+---------+---------|
- * | SYS_EVENT | sig set | | | | | |
+ * | SYS_SIG | sig set | | | | | |
* |-------------+---------+---------+---------+---------+---------+---------|
* | DEV_READ |minor dev| proc nr | count | O_NONBLOCK| buf ptr |
* |-------------+---------+---------+---------+---------+---------+---------|
expire_timers(); /* run watchdogs of expired timers */
continue; /* contine to check for events */
}
- case SYS_EVENT: { /* new kernel message is available */
+ case SYS_SIG: { /* system signal */
sigset_t sigset = (sigset_t) tty_mess.NOTIFY_ARG;
if (sigismember(&sigset, SIGKSTOP)) {