[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2 libacpica] irqhelp: Add interrupt handler registration su
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 1/2 libacpica] irqhelp: Add interrupt handler registration support |
Date: |
Tue, 22 Oct 2024 01:53:39 +0200 |
Applied, thanks!
Damien Zammit, le lun. 21 oct. 2024 03:21:41 +0000, a ecrit:
> ---
> debian/patches/acgnu.diff | 34 ++++++++++++++++++++++++++---
> debian/patches/acpi-init-files.diff | 8 ++++++-
> debian/patches/add-makefile.diff | 2 +-
> 3 files changed, 39 insertions(+), 5 deletions(-)
>
> diff --git a/debian/patches/acgnu.diff b/debian/patches/acgnu.diff
> index e7f396f..df82abc 100644
> --- a/debian/patches/acgnu.diff
> +++ b/debian/patches/acgnu.diff
> @@ -163,7 +163,7 @@ Add acgnu.h and acgnuex.h
> +#endif /* __ACGNU_H__ */
> --- /dev/null
> +++ b/include/acpi/platform/acgnuex.h
> -@@ -0,0 +1,314 @@
> +@@ -0,0 +1,342 @@
> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
> +
> +#ifndef __ACGNUEX_H__
> @@ -235,8 +235,14 @@ Add acgnu.h and acgnuex.h
> +#include <limits.h>
> +#include <hurd.h>
> +#include <pciaccess.h>
> ++#include <hurd/irqhelp.h>
> +
> +#define ACPI_MAX_TABLES 128
> ++#define ACPI_MAX_GSIS 64
> ++
> ++static struct handler {
> ++ struct irq *irqhelp;
> ++} handlers[ACPI_MAX_GSIS] = {0};
> +
> +static inline acpi_status
> +acpi_os_enter_sleep(u8 sleep_state, u32 pm1a, u32 pm1b)
> @@ -393,14 +399,36 @@ Add acgnu.h and acgnuex.h
> +acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
> + void *context)
> +{
> -+ acpi_os_printf("TODO: add interrupt handler for acpi\n");
> ++ assert(gsi < ACPI_MAX_GSIS);
> ++ pthread_t irq_loop;
> ++ int err;
> ++
> ++ if (handlers[gsi].irqhelp)
> ++ irqhelp_remove_interrupt_handler (handlers[gsi].irqhelp);
> ++ handlers[gsi].irqhelp = irqhelp_install_interrupt_handler (gsi, -1, -1,
> -1, (void *)(void (*))handler, context);
> ++
> ++ err = pthread_create (&irq_loop, NULL, irqhelp_server_loop, NULL);
> ++ if (err)
> ++ {
> ++ acpi_os_printf ("ACPI: Cannot create pthread for interrupt handler
> gsi=%d\n", gsi);
> ++ irqhelp_remove_interrupt_handler (handlers[gsi].irqhelp);
> ++ handlers[gsi].irqhelp = NULL;
> ++ return 1;
> ++ }
> ++ pthread_detach (irq_loop);
> + return 0;
> +}
> +
> +static inline acpi_status
> +acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler handler)
> +{
> -+ acpi_os_printf("TODO: remove interrupt handler for acpi\n");
> ++ int err = irqhelp_remove_interrupt_handler (handlers[gsi].irqhelp);
> ++ if (err)
> ++ {
> ++ acpi_os_printf ("ACPI: Cannot deregister interrupt handler gsi=%d\n",
> gsi);
> ++ return 1;
> ++ }
> ++ handlers[gsi].irqhelp = NULL;
> + return 0;
> +}
> +
> diff --git a/debian/patches/acpi-init-files.diff
> b/debian/patches/acpi-init-files.diff
> index e277749..a0f8d61 100644
> --- a/debian/patches/acpi-init-files.diff
> +++ b/debian/patches/acpi-init-files.diff
> @@ -1,6 +1,6 @@
> --- /dev/null
> +++ b/acpi_init.c
> -@@ -0,0 +1,592 @@
> +@@ -0,0 +1,598 @@
> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
> +#include <acpi/acpi.h>
> +
> @@ -25,6 +25,7 @@
> +#include <device/device.h>
> +#include <hurd.h>
> +#include <pciaccess.h>
> ++#include <hurd/irqhelp.h>
> +
> +#define ACPI_MAX_TABLES 128
> +
> @@ -310,6 +311,11 @@
> + return AE_ERROR;
> + }
> +
> ++ if (irqhelp_init())
> ++ {
> ++ acpi_os_printf("acpi irqhelp_init: failed\n");
> ++ // FIXME: When libirqhelp is fixed: return AE_ERROR;
> ++ }
> + return AE_OK;
> +}
> +
> diff --git a/debian/patches/add-makefile.diff
> b/debian/patches/add-makefile.diff
> index a78d8d0..f9d969f 100644
> --- a/debian/patches/add-makefile.diff
> +++ b/debian/patches/add-makefile.diff
> @@ -37,7 +37,7 @@
> +PREFIX ?= /usr/local
> +libdir ?= $(PREFIX)/lib
> +
> -+LDLIBS = -lpciaccess
> ++LDLIBS = -lpciaccess -lirqhelp -lpthread
> +
> +SRCS = global_state.c \
> + acpi_init.c \
> --
> 2.45.2
>
>
>
--
Samuel
Linux, c'est simple : ça s'adresse à une machine qui est parfois un peu
maraboutée mais qui d'habitude n'a pas d'états d'âme. Sur Usenet y'a
plein d'humains et de primates, et ça devient vraiment gore par moment.
-+- TP in : Guide du linuxien pervers - "Le linuxien a-t-il une âme ?" -+-