#include <omega0_proto.h>
#include <l4/sys/types.h>
#include <l4/sys/ipc.h>
#include <l4/sys/ktrace.h>
#include <l4/util/util.h>
#include <l4/rmgr/librmgr.h>
#include <l4/log/l4log.h>
#include <l4/omega0/client.h>
#include <l4/util/rdtsc.h>
#include <l4/util/spin.h>
#include <l4/util/macros.h>
#include <stdio.h>
#include "globals.h"
#include "irq_threads.h"
#include "create_threads.h"
#include "config.h"
Go to the source code of this file.
Data Structures | |
struct | client_ipc_t |
Enumerations | |
enum | client_ipc_enum { RET_HANDLE, RET_REPLY, RET_WAIT } |
return codes for IPC handling functions More... | |
Functions | |
static int | signal_single_user_thread (int irq, client_chain *c, client_ipc_t *ipc) |
Signal a single user thread. Assume, the client is waiting. | |
static int | signal_user_threads (int irq, client_ipc_t *ipc) |
Signal all user threads waiting on this irq and await new request. | |
static void | irq_enable (int num) |
static int | irq_consume (int irq) |
Actually consume an irq. | |
void | check_auto_consume (int irq, client_chain *c) |
Checks if the given client is a candidate for auto-consuming an irq. | |
static int | handle_user_request (int irq, client_ipc_t *ipc) |
Handle clients requests. | |
static void | attach_irq (int num) |
Attach to a specified irq. | |
void | irq_handler (int num) |
Handler function for one irq. | |
int | attach_irqs (void) |
Initialize the local irq acceptor threads. |
Recent Fiasco extends this protocol:
Definition in file irq_threads.c.
enum client_ipc_enum |
static void attach_irq | ( | int | num | ) | [static] |
Attach to a specified irq.
If the irq is available, its available flag is set to 1, otherwise it is cleared.
Definition at line 372 of file irq_threads.c.
int attach_irqs | ( | void | ) |
Initialize the local irq acceptor threads.
This function will attach to all irqs possible and initialize the corresponding structures. At the standard-pc-x86 architecture, we have irqs 0 to 15. Try to attach to all of them. This is done by creating 16 threads, one per irq. Threads start at lthread+1.
create_threads_sync() is external to allow overloading in other pkgs.
Definition at line 519 of file irq_threads.c.
void check_auto_consume | ( | int | irq, | |
client_chain * | c | |||
) |
Checks if the given client is a candidate for auto-consuming an irq.
Auto-consuming is possible, if:
Maybe some of the conditions follow from others.
Definition at line 201 of file irq_threads.c.
static int handle_user_request | ( | int | irq, | |
client_ipc_t * | ipc | |||
) | [static] |
Handle clients requests.
Actions:
If an wait operation occures while the in_service flag is set, the client cannot handle the irq. Do nothing. At least one client should send the consume action.
If the OMEGA0_STRATEGY_AUTO_CONSUME option is set, a consume operation is automatically done if all clients are waiting an no client consumed the irq explicitely (i.e., sent a consume action).
Requests from unregistered clients are ignored silently.
If a client has to be awaken, this function uses reply-and wait and awaits the next request.
ipc | in: contains client id and its dwords. out: contains ipc parameters of newly arrived request (if retval=RET_HANDLE) |
RET_HADNLE | ipc contains the next request. Handle it. | |
RET_REPLY | Return an ipc to the client and wait for next request. | |
RET_WAIT | No additional action needed, wait for next request. | |
<0 | error, send back to client and wait for next request. |
Definition at line 249 of file irq_threads.c.
static int irq_consume | ( | int | irq | ) | [inline, static] |
Actually consume an irq.
The function checks if the IRQ is in service, and if so, it consumes it according to the current policy. After that, the in-service flag is reset.
Definition at line 176 of file irq_threads.c.
static void irq_enable | ( | int | num | ) | [inline, static] |
Enable IRQ in kernel
Definition at line 159 of file irq_threads.c.
void irq_handler | ( | int | num | ) |
Handler function for one irq.
After calling attach_irq(), return an IPC to the management thread and wait for incoming IRQs.
Definition at line 410 of file irq_threads.c.
static int signal_single_user_thread | ( | int | irq, | |
client_chain * | c, | |||
client_ipc_t * | ipc | |||
) | [static] |
Signal a single user thread. Assume, the client is waiting.
ipc | If !0, the last client-reply will await a new request. IPC will contain newly-arrived client-request uppon return. |
0 | OK. If ipc was !0, ipc contains the new client request. | |
!0 | ipc was not 0, and IPC-operation failed. Either send or receive. Anyway, don't use ipc. |
Definition at line 68 of file irq_threads.c.
static int signal_user_threads | ( | int | irq, | |
client_ipc_t * | ipc | |||
) | [static] |
Signal all user threads waiting on this irq and await new request.
ipc | If !0, the last client-reply will await a new request. IPC will contain newly-arrived client-request uppon return. |
0 | OK. If ipc was !0, ipc contains the new client request. | |
!0 | ipc was not 0, and IPC-operation failed, or none was notified. Either send receive. Anyway, don't use ipc. |
Definition at line 127 of file irq_threads.c.