Changeset aedff4f in rtems-libbsd


Ignore:
Timestamp:
07/25/19 08:20:19 (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5-freebsd-12, 6-freebsd-12
Children:
017b09f
Parents:
bd6b20c
git-author:
Sebastian Huber <sebastian.huber@…> (07/25/19 08:20:19)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/23/19 08:26:34)
Message:

CONFIG_INTRHOOK(9): Call handlers after boot

This enables adding drivers on demand which use this service after
initialization.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/kern/subr_autoconf.c

    rbd6b20c raedff4f  
    6464static struct mtx intr_config_hook_lock;
    6565MTX_SYSINIT(intr_config_hook, &intr_config_hook_lock, "intr config", MTX_DEF);
     66#ifdef __rtems__
     67static bool intr_boot_done;
     68#endif /* __rtems__ */
    6669
    6770/* ARGSUSED */
     
    175178                }
    176179        }
     180#ifdef __rtems__
     181        intr_boot_done = true;
     182#endif /* __rtems__ */
    177183        mtx_unlock(&intr_config_hook_lock);
    178184        TSUNWAIT("config hooks");
     
    191197{
    192198        struct intr_config_hook *hook_entry;
     199#ifdef __rtems__
     200        bool run;
     201#endif /* __rtems__ */
    193202
    194203        TSHOLD("config hooks");
     
    206215        if (next_to_notify == NULL)
    207216                next_to_notify = hook;
     217#ifdef __rtems__
     218        run = intr_boot_done;
     219#endif /* __rtems__ */
    208220        mtx_unlock(&intr_config_hook_lock);
    209221#ifndef __rtems__
    210222        if (cold == 0)
     223#else /* __rtems__ */
     224        if (run)
     225#endif /* __rtems__ */
    211226                /*
    212227                 * XXX Call from a task since not all drivers expect
     
    215230                /* XXX Sufficient for modules loaded after initial config??? */
    216231                run_interrupt_driven_config_hooks();   
    217 #endif /* __rtems__ */
    218232        return (0);
    219233}
  • testsuite/swi01/swi_test.c

    rbd6b20c raedff4f  
    11/*
    2  * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2012, 2019 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
    5  *  Obere Lagerstr. 30
     5 *  Dornierstr. 4
    66 *  82178 Puchheim
    77 *  Germany
     
    3838
    3939#include <sys/types.h>
    40 #include <sys/systm.h>
    41 
    4240#include <sys/param.h>
    4341#include <sys/bus.h>
    4442#include <sys/interrupt.h>
     43#include <sys/kernel.h>
     44#include <sys/systm.h>
    4545
    4646#define SWI_TEST_THREAD_PRIO (0)
     
    193193       
    194194        assert(argument == HANDLER_NOT_VISITED);
     195}
     196
     197static void
     198ich_func(void *arg)
     199{
     200        int *invocations;
     201
     202        invocations = arg;
     203        ++(*invocations);
     204}
     205
     206static void
     207test_config_intrhook_establish(void)
     208{
     209        int invocations;
     210        struct intr_config_hook hook = {
     211                .ich_func = ich_func,
     212                .ich_arg = &invocations
     213        };
     214
     215        printf("== Test config_intrhook_establish().\n");
     216
     217        invocations = 0;
     218        config_intrhook_establish(&hook);
     219        assert(invocations == 1);
    195220}
    196221
     
    205230        swi_test_error_handler_null();
    206231        swi_test_error_has_allready_exclusive();
    207 }
    208 
     232        test_config_intrhook_establish();
     233}
     234
Note: See TracChangeset for help on using the changeset viewer.