diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-07-10 00:23:32 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-07-10 00:31:38 +0200 |
commit | 6054cda4de2341b9a77ec4421411725f3684006b (patch) | |
tree | 02622e721dffe9fdb73e35805de2fbf8a2a5aea8 /include/device | |
parent | 2dbf108457d0a0057cc63d5b3b89fd4da48d2a72 (diff) | |
download | gnumach-6054cda4de2341b9a77ec4421411725f3684006b.tar.gz gnumach-6054cda4de2341b9a77ec4421411725f3684006b.tar.bz2 gnumach-6054cda4de2341b9a77ec4421411725f3684006b.zip |
Add hardware interrupt notification mechanism
This allows privileged userland drivers to get notifications of hardware
interrupts.
Initial work by Zheng Da, reworked by Damien Zammit and myself.
* Makefrag.am (libkernel_a_SOURCES): Add device/intr.c and
device/intr.h.
(include_device_HEADERS): Add include/device/notify.defs and
include/device/notify.h.
* device/dev_hdr.h (name_equal): Add declaration.
* device/ds_routines.c: Include <device/intr.h>
(ds_device_intr_register, ds_device_intr_ack): New functions.
* device/intr.c, device/intr.h: New files.
* doc/mach.texi (Device Interrupt): New section.
* i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386/irq.c and
i386/i386/irq.h.
* i386/i386/irq.c, i386/i386/irq.h: New files.
* i386/i386at/conf.c: Include <device/intr.h>.
(irqname): New macro.
(dev_name_list): Add irq device.
* include/device/device.defs (device_intr_register, device_intr_ack):
New RPCs.
* include/device/notify.defs, include/device/notify.h: New files.
* kern/startup.c: Include <device/intr.h>
(start_kernel_threads): Start intr_thread thread.
* linux/dev/arch/i386/kernel/irq.c: Include <device/intr.h>
(linux_action): Add user_intr field.
(linux_intr): Call user_intr action if any.
(mask_irq, unmask_irq): Move functions to i386/i386/pic.c
(__disable_irq, __enable_irq): Move functions to i386/i386/irq.c.
(install_user_intr_handler): New function.
(request_irq): Initialize user_intr field.
* linux/src/include/asm-i386/irq.h (__disable_irq, __enable_irq): Remove
prototypes.
* i386/i386/pic.c (mask_irq, unmask_irq): New functions.
* i386/i386/pic.h (mask_irq, unmask_irq): New prototypes.
Diffstat (limited to 'include/device')
-rw-r--r-- | include/device/device.defs | 18 | ||||
-rw-r--r-- | include/device/notify.defs | 36 | ||||
-rw-r--r-- | include/device/notify.h | 34 |
3 files changed, 88 insertions, 0 deletions
diff --git a/include/device/device.defs b/include/device/device.defs index 409146f5..ec4b5bf8 100644 --- a/include/device/device.defs +++ b/include/device/device.defs @@ -142,3 +142,21 @@ routine device_set_filter( in filter : filter_array_t ); +routine device_intr_register( + device : device_t; + in id : int; + in flags : int; + in receive_port : mach_port_send_t + ); + +/* + * Acknowledge the specified interrupt notification. + */ +/* + * When an IRQ happens and an intr notification is thus sent, the IRQ line + * is kept disabled until the notification is acknowledged with this RPC + */ +routine device_intr_ack( + device : device_t; + in receive_port : mach_port_send_t); + diff --git a/include/device/notify.defs b/include/device/notify.defs new file mode 100644 index 00000000..7919b339 --- /dev/null +++ b/include/device/notify.defs @@ -0,0 +1,36 @@ +/* + * Mach Operating System + * Copyright (c) 1991,1990,1989 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ + +subsystem notify 100; + +#include <mach/std_types.defs> + +serverprefix do_; +serverdemux device_intr_notify_server; + +simpleroutine device_intr_notify( + notify : notify_port_t; + id : int); diff --git a/include/device/notify.h b/include/device/notify.h new file mode 100644 index 00000000..addf9114 --- /dev/null +++ b/include/device/notify.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010 Free Software Foundation, Inc. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * THE FREE SOFTWARE FOUNDATIONALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + */ + +/* + * Device notification definitions. + */ + +#ifndef _MACH_DEVICE_NOTIFY_H_ +#define _MACH_DEVICE_NOTIFY_H_ + +#include <mach/port.h> +#include <mach/message.h> + +typedef struct +{ + mach_msg_header_t intr_header; + mach_msg_type_t intr_type; + int id; +} device_intr_notification_t; + +#define DEVICE_INTR_NOTIFY 100 + +#endif /* _MACH_DEVICE_NOTIFY_H_ */ |