Hello,
Damien Zammit, le ven. 10 oct. 2025 06:37:37 +0000, a ecrit:
> This allows reading irq device status 0 for the mode of the interrupt
> controller, pic or apic.
Thanks for this!
> ```
> ---
> device/intr.c | 24 ++++++++++++++++++++++++
> device/intr.h | 1 +
> i386/i386/irq.h | 6 ++++++
> i386/i386/pic.c | 2 ++
> i386/i386at/conf.c | 2 +-
> i386/i386at/ioapic.c | 3 +++
> 6 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/device/intr.c b/device/intr.c
> index 07d8acd8..b4c69508 100644
> --- a/device/intr.c
> +++ b/device/intr.c
> @@ -22,6 +22,30 @@
> #include <machine/irq.h>
> #include <ipc/ipc_space.h>
>
> +/*ARGSUSED*/
> +io_return_t irqgetstat(
> + dev_t dev,
> + dev_flavor_t flavor,
> + dev_status_t data, /* pointer to OUT array */
> + mach_msg_type_number_t *count) /* OUT */
> +{
> + io_return_t result;
> +
> + switch (flavor)
> + {
Please put this case inside ifndef MACH_XEN:
> + case IRQGETPICMODE:
> + *data = pic_mode;
> + *count = 1;
> + result = D_SUCCESS;
> + break;
> + default:
> + result = D_INVALID_OPERATION;
> + break;
> + }
> +
> + return (result);
> +}
> +
> #ifndef MACH_XEN
>
> def_simple_lock_irq_data(static, intr_lock)
> diff --git a/device/intr.h b/device/intr.h
> index cd3e0bce..2988e49c 100644
> --- a/device/intr.h
> +++ b/device/intr.h
> @@ -53,6 +53,7 @@ extern queue_head_t main_intr_queue;
> extern int install_user_intr_handler (struct irqdev *dev, int id, unsigned
> long flags, user_intr_t *e);
> extern int deliver_user_intr (struct irqdev *dev, int id, user_intr_t *e);
> extern user_intr_t *insert_intr_entry (struct irqdev *dev, int id,
> ipc_port_t receive_port);
And get the declaration outside #ifndef MACH_XEN
> +extern io_return_t irqgetstat(dev_t dev, dev_flavor_t flavor, dev_status_t
> data, mach_msg_type_number_t *count);
>
> void intr_thread (void);
> kern_return_t irq_acknowledge (ipc_port_t receive_port);
> diff --git a/i386/i386/irq.h b/i386/i386/irq.h
> index e1f41045..bb5adaa9 100644
> --- a/i386/i386/irq.h
> +++ b/i386/i386/irq.h
> @@ -15,6 +15,11 @@
> #ifndef _I386_IRQ_H
> #define _I386_IRQ_H
>
> +#define IRQGETPICMODE 0
> +# define ACPI_PICMODE_PIC 0
> +# define ACPI_PICMODE_APIC 1
> +# define ACPI_PICMODE_SAPIC 2
> +
They should ideally be put in an header to be installed in user-land,
similarly to device/tty_status.h
Samuel