[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnumach/oskit ds_osenv.c osenv_irq.c
From: |
Roland McGrath |
Subject: |
gnumach/oskit ds_osenv.c osenv_irq.c |
Date: |
Fri, 28 Feb 2003 03:55:19 -0500 |
CVSROOT: /cvsroot/hurd
Module name: gnumach
Changes by: Roland McGrath <address@hidden> 03/02/28 03:55:19
Modified files:
oskit : ds_osenv.c osenv_irq.c
Log message:
2003-02-28 Roland McGrath <address@hidden>
* oskit/osenv_irq.c (console_irq, console_irq_handler): New variables.
(irq_alloc, irq_free): Implement special kludge with console_irq.
* oskit/ds_osenv.c (ds_osenv_init): Set console_irq before
initializing the minimal interrupt-driven console.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnumach/gnumach/oskit/ds_osenv.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnumach/gnumach/oskit/osenv_irq.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gnumach/oskit/ds_osenv.c
diff -u gnumach/oskit/ds_osenv.c:1.2 gnumach/oskit/ds_osenv.c:1.3
--- gnumach/oskit/ds_osenv.c:1.2 Mon May 27 19:01:57 2002
+++ gnumach/oskit/ds_osenv.c Fri Feb 28 03:55:18 2003
@@ -16,6 +16,8 @@
oskit_stream_t *ds_console_stream;
+extern int console_irq; /* kludge in osenv_irq.c */
+
void
ds_osenv_init (void)
@@ -44,6 +46,7 @@
param.c_lflag &= ~ECHO;
param.c_iflag &= ~ICRNL;
param.c_oflag &= ~OPOST;
+ console_irq = -1;
rc = cq_com_console_init (port, ¶m,
oskit_create_osenv_irq (),
intr,
@@ -53,6 +56,7 @@
else
{
oskit_osenv_intr_t *intr = oskit_create_osenv_intr ();
+ console_irq = -1;
rc = cq_direct_console_init (oskit_create_osenv_irq (),
intr,
oskit_create_osenv_sleep (intr),
Index: gnumach/oskit/osenv_irq.c
diff -u gnumach/oskit/osenv_irq.c:1.2 gnumach/oskit/osenv_irq.c:1.3
--- gnumach/oskit/osenv_irq.c:1.2 Mon May 27 19:01:57 2002
+++ gnumach/oskit/osenv_irq.c Fri Feb 28 03:55:18 2003
@@ -118,6 +118,16 @@
return 1;
}
+
+/* This is a special kludge for the minimal console. If console_irq is -1
+ during the first irq_alloc, we set it to the irq being allocated.
+ Thereafter, allocating that irq will silently succeed and override
+ the handler installed for the minimal console, which we save in
+ console_irq_handler; freeing that irq will restore the console handler. */
+
+int console_irq;
+static struct int_handler *console_irq_handler;
+
static OSKIT_COMDECL_U
irq_alloc(oskit_osenv_irq_t *o, int irq,
void (*handler)(void *), void *data, int flags)
@@ -153,6 +163,29 @@
temp->data = data;
temp->next = NULL;
+ /* Special hack for the minimal com and direct console devices. */
+ if (console_irq == -1) {
+ /* ds_osenv_init sets console_irq to -1 while initializing the
+ console, so we know this is the irq being allocated for it.
+ XXX we assume there is only one!
+ */
+ assert (first_time);
+ console_irq = irq;
+ }
+ else if (irq == console_irq && console_irq_handler == NULL) {
+ /* Attempting to re-allocate the console's irq.
+ This must be a real device driver taking over
+ from the minimal console. Let it. */
+ assert (! first_time);
+ assert (handlers[irq] != NULL);
+ console_irq_handler = handlers[irq];
+ osenv_log(OSENV_LOG_DEBUG,
+ "irq %d stolen from console\n", irq);
+ handlers[irq] = temp;
+ shareable[irq] = (flags & OSENV_IRQ_SHAREABLE) != 0;
+ return 0;
+ }
+
/*
* Fail if the irq is already in use
* and either the new handler or the existing handler
@@ -208,11 +241,27 @@
if (temp != NULL &&
temp->func == handler && temp->data == data &&
temp->next == NULL) {
- osenv_irq_disable(irq);
- handlers[irq] = NULL;
- intpri[irq] = SPL0;
- ivect[irq] = intnull;
- iunit[irq] = irq;
+ if (irq == console_irq) {
+ /* Special hack for the minimal console's irq.
+ Restore the console's handler now that no real
+ driver is using it.
+ XXX this is probably not actually useful since
+ the driver won't have left the device in the same
+ state the minimal console driver expects.
+ */
+ handlers[irq] = console_irq_handler;
+ shareable[irq] = 0;
+ console_irq_handler = NULL;
+ osenv_log(OSENV_LOG_DEBUG,
+ "irq %d returned to console\n", irq);
+ }
+ else {
+ osenv_irq_disable(irq);
+ handlers[irq] = NULL;
+ intpri[irq] = SPL0;
+ ivect[irq] = intnull;
+ iunit[irq] = irq;
+ }
kfree(temp, sizeof(struct int_handler));
return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnumach/oskit ds_osenv.c osenv_irq.c,
Roland McGrath <=