diff options
author | Justus Winter <justus@gnupg.org> | 2016-02-25 18:46:32 +0100 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2016-02-25 18:46:32 +0100 |
commit | 9ad7eb46b65b7324dd5f2c6f5568b6a0e033a5f4 (patch) | |
tree | aab92d03e843bcc7423124b2ec069ccb6be8e7e4 /device/ds_routines.c | |
parent | e7e91cc329b6a064d9703829911e940d7395d0a3 (diff) |
70_dde.patch
Diffstat (limited to 'device/ds_routines.c')
-rw-r--r-- | device/ds_routines.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/device/ds_routines.c b/device/ds_routines.c index dbff7f8..4f6b345 100644 --- a/device/ds_routines.c +++ b/device/ds_routines.c @@ -318,6 +318,43 @@ ds_device_map (device_t dev, vm_prot_t prot, vm_offset_t offset, offset, size, pager, unmap); } +io_return_t +experimental_device_intr_register (ipc_port_t master_port, int line, + int id, int flags, ipc_port_t receive_port) +{ +#ifdef MACH_XEN + return D_INVALID_OPERATION; +#else /* MACH_XEN */ + extern int install_user_intr_handler (unsigned int line, + unsigned long flags, + ipc_port_t dest); + io_return_t ret; + + /* Open must be called on the master device port. */ + if (master_port != master_device_port) + return D_INVALID_OPERATION; + + /* XXX: move to arch-specific */ + if (line < 0 || line >= 16) + return D_INVALID_OPERATION; + + ret = insert_intr_entry (line, receive_port); + if (ret) + return ret; + // TODO The original port should be replaced + // when the same device driver calls it again, + // in order to handle the case that the device driver crashes and restarts. + ret = install_user_intr_handler (line, flags, receive_port); + + /* If the port is installed successfully, increase its reference by 1. + * Thus, the port won't be destroyed after its task is terminated. */ + if (ret == 0) + ip_reference (receive_port); + + return ret; +#endif /* MACH_XEN */ +} + boolean_t ds_notify (mach_msg_header_t *msg) { @@ -1798,6 +1835,24 @@ device_writev_trap (mach_device_t device, dev_mode_t mode, return (result); } +kern_return_t +experimental_device_intr_enable(ipc_port_t master_port, int line, char status) +{ +#ifdef MACH_XEN + return D_INVALID_OPERATION; +#else /* MACH_XEN */ + if (master_port != master_device_port) + return D_INVALID_OPERATION; + + if (status) + /* TODO: better name for generic-to-arch-specific call */ + enable_irq (line); + else + disable_irq (line); + return 0; +#endif /* MACH_XEN */ +} + struct device_emulation_ops mach_device_emulation_ops = { (void*) mach_device_reference, |