Extend the FDT interrupt API to support masking and unmasking IRQs.
authorpatrick <patrick@openbsd.org>
Wed, 8 Aug 2018 11:06:33 +0000 (11:06 +0000)
committerpatrick <patrick@openbsd.org>
Wed, 8 Aug 2018 11:06:33 +0000 (11:06 +0000)
Discussed with kettenis@

sys/arch/arm/include/fdt.h
sys/arch/arm64/arm64/intr.c
sys/arch/arm64/include/fdt.h
sys/arch/arm64/include/intr.h
sys/arch/armv7/armv7/intr.c
sys/arch/armv7/include/intr.h

index a0f571e..8269c3f 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdt.h,v 1.8 2018/08/06 10:52:30 patrick Exp $ */
+/* $OpenBSD: fdt.h,v 1.9 2018/08/08 11:06:33 patrick Exp $ */
 /*
  * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
  *
@@ -40,10 +40,12 @@ extern bus_space_tag_t fdt_cons_bs_tag;
 
 void *fdt_find_cons(const char *);
 
+#define fdt_intr_enable arm_intr_enable
 #define fdt_intr_establish arm_intr_establish_fdt
 #define fdt_intr_establish_idx arm_intr_establish_fdt_idx
 #define fdt_intr_establish_imap arm_intr_establish_fdt_imap
 #define fdt_intr_establish_msi arm_intr_establish_fdt_msi
+#define fdt_intr_disable arm_intr_disable
 #define fdt_intr_disestablish arm_intr_disestablish_fdt
 #define fdt_intr_get_parent arm_intr_get_parent
 #define fdt_intr_parent_establish arm_intr_parent_establish_fdt
index 96e2796..8daaaf1 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.12 2018/07/30 10:56:00 kettenis Exp $ */
+/* $OpenBSD: intr.c,v 1.13 2018/08/08 11:06:33 patrick Exp $ */
 /*
  * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
  *
@@ -463,6 +463,26 @@ arm_intr_disestablish_fdt(void *cookie)
        free(ih, M_DEVBUF, sizeof(*ih));
 }
 
+void
+arm_intr_enable(void *cookie)
+{
+       struct arm_intr_handle *ih = cookie;
+       struct interrupt_controller *ic = ih->ih_ic;
+
+       KASSERT(ic->ic_enable != NULL);
+       ic->ic_enable(ih->ih_ih);
+}
+
+void
+arm_intr_disable(void *cookie)
+{
+       struct arm_intr_handle *ih = cookie;
+       struct interrupt_controller *ic = ih->ih_ic;
+
+       KASSERT(ic->ic_disable != NULL);
+       ic->ic_disable(ih->ih_ih);
+}
+
 /*
  * Some interrupt controllers transparently forward interrupts to
  * their parent.  Such interrupt controllers can use this function to
index 0ae8b4f..86df93d 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdt.h,v 1.5 2018/08/06 10:52:30 patrick Exp $ */
+/* $OpenBSD: fdt.h,v 1.6 2018/08/08 11:06:33 patrick Exp $ */
 /*
  * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
  *
@@ -40,10 +40,12 @@ extern bus_space_tag_t fdt_cons_bs_tag;
 
 void *fdt_find_cons(const char *);
 
+#define fdt_intr_enable arm_intr_enable
 #define fdt_intr_establish arm_intr_establish_fdt
 #define fdt_intr_establish_idx arm_intr_establish_fdt_idx
 #define fdt_intr_establish_imap arm_intr_establish_fdt_imap
 #define fdt_intr_establish_msi arm_intr_establish_fdt_msi
+#define fdt_intr_disable arm_intr_disable
 #define fdt_intr_disestablish arm_intr_disestablish_fdt
 #define fdt_intr_get_parent arm_intr_get_parent
 #define fdt_intr_parent_establish arm_intr_parent_establish_fdt
index 45c7406..0f70286 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: intr.h,v 1.10 2018/04/09 18:35:13 kettenis Exp $ */
+/*     $OpenBSD: intr.h,v 1.11 2018/08/08 11:06:33 patrick Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Opsycon AB  (www.opsycon.se / www.opsycon.com)
@@ -142,6 +142,8 @@ struct interrupt_controller {
        void    *(*ic_establish_msi)(void *, uint64_t *, uint64_t *, int,
                    int (*)(void *), void *, char *);
        void     (*ic_disestablish)(void *);
+       void     (*ic_enable)(void *);
+       void     (*ic_disable)(void *);
        void     (*ic_route)(void *, int, struct cpu_info *);
        void     (*ic_cpu_enable)(void);
 
@@ -161,6 +163,8 @@ void        *arm_intr_establish_fdt_imap(int, int *, int, int, int (*)(void *),
 void   *arm_intr_establish_fdt_msi(int, uint64_t *, uint64_t *, int ,
            int (*)(void *), void *, char *);
 void    arm_intr_disestablish_fdt(void *);
+void    arm_intr_enable(void *);
+void    arm_intr_disable(void *);
 void    arm_intr_route(void *, int, struct cpu_info *);
 void    arm_intr_cpu_enable(void);
 void   *arm_intr_parent_establish_fdt(void *, int *, int,
index 5de9d0a..0e81fc4 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.13 2018/07/06 13:08:10 patrick Exp $ */
+/* $OpenBSD: intr.c,v 1.14 2018/08/08 11:06:33 patrick Exp $ */
 /*
  * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
  *
@@ -434,6 +434,26 @@ arm_intr_disestablish_fdt(void *cookie)
        free(ih, M_DEVBUF, sizeof(*ih));
 }
 
+void
+arm_intr_enable(void *cookie)
+{
+       struct arm_intr_handle *ih = cookie;
+       struct interrupt_controller *ic = ih->ih_ic;
+
+       KASSERT(ic->ic_enable != NULL);
+       ic->ic_enable(ih->ih_ih);
+}
+
+void
+arm_intr_disable(void *cookie)
+{
+       struct arm_intr_handle *ih = cookie;
+       struct interrupt_controller *ic = ih->ih_ic;
+
+       KASSERT(ic->ic_disable != NULL);
+       ic->ic_disable(ih->ih_ih);
+}
+
 /*
  * Some interrupt controllers transparently forward interrupts to
  * their parent.  Such interrupt controllers can use this function to
index 61ff23e..96c17d8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: intr.h,v 1.8 2018/07/06 13:08:10 patrick Exp $        */
+/*     $OpenBSD: intr.h,v 1.9 2018/08/08 11:06:33 patrick Exp $        */
 /*     $NetBSD: intr.h,v 1.12 2003/06/16 20:00:59 thorpej Exp $        */
 
 /*
@@ -156,6 +156,8 @@ struct interrupt_controller {
        void    *(*ic_establish_msi)(void *, uint64_t *, uint64_t *, int,
                    int (*)(void *), void *, char *);
        void     (*ic_disestablish)(void *);
+       void     (*ic_enable)(void *);
+       void     (*ic_disable)(void *);
        void     (*ic_route)(void *, int, struct cpu_info *);
 
        LIST_ENTRY(interrupt_controller) ic_list;
@@ -174,6 +176,8 @@ void        *arm_intr_establish_fdt_imap(int, int *, int, int, int (*)(void *),
 void   *arm_intr_establish_fdt_msi(int, uint64_t *, uint64_t *, int ,
            int (*)(void *), void *, char *);
 void    arm_intr_disestablish_fdt(void *);
+void    arm_intr_enable(void *);
+void    arm_intr_disable(void *);
 void    arm_intr_route(void *, int, struct cpu_info *);
 
 void   *arm_intr_parent_establish_fdt(void *, int *, int,