Changeset ee50130 in mainline


Ignore:
Timestamp:
2017-06-28T19:32:20Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f4ae95a
Parents:
39b0a51
Message:

Improve cstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ddi/irq.c

    r39b0a51 ree50130  
    3434 * @brief IRQ dispatcher.
    3535 *
    36  * This file provides means of connecting IRQs with particular
    37  * devices and logic for dispatching interrupts to IRQ handlers
    38  * defined by those devices.
     36 * This file provides means of connecting IRQs with particular devices and logic
     37 * for dispatching interrupts to IRQ handlers defined by those devices.
    3938 *
    4039 * This code is designed to support:
     
    4645 * Note about architectures.
    4746 *
    48  * Some architectures has the term IRQ well defined. Examples
    49  * of such architectures include amd64, ia32 and mips32. Some
    50  * other architectures, such as sparc64, don't use the term
    51  * at all. In those cases, we boldly step forward and define what
    52  * an IRQ is.
    53  *
    54  * The implementation is generic enough and still allows the
    55  * architectures to use the hardware layout effectively.
    56  * For instance, on amd64 and ia32, where there is only 16
    57  * IRQs, the irq_hash_table can be optimized to a one-dimensional
    58  * array. Next, when it is known that the IRQ numbers (aka INR's)
    59  * are unique, the claim functions can always return IRQ_ACCEPT.
     47 * Some architectures have the term IRQ well defined. Examples of such
     48 * architectures include amd64, ia32 and mips32. Some other architectures, such
     49 * as sparc64, don't use the term at all. In those cases, we boldly step forward
     50 * and define what an IRQ is.
     51 *
     52 * The implementation is generic enough and still allows the architectures to
     53 * use the hardware layout effectively.  For instance, on amd64 and ia32, where
     54 * there is only 16 IRQs, the irq_hash_table can be optimized to a
     55 * one-dimensional array. Next, when it is known that the IRQ numbers (aka
     56 * INR's) are unique, the claim functions can always return IRQ_ACCEPT.
    6057 *
    6158 *
    6259 * Note about the irq_hash_table.
    6360 *
    64  * The hash table is configured to use two keys: inr and devno.
    65  * However, the hash index is computed only from inr. Moreover,
    66  * if devno is -1, the match is based on the return value of
    67  * the claim() function instead of on devno.
     61 * The hash table is configured to use two keys: inr and devno.  However, the
     62 * hash index is computed only from inr. Moreover, if devno is -1, the match is
     63 * based on the return value of the claim() function instead of on devno.
    6864 */
    6965
     
    10298
    10399/**
    104  * Hash table operations for cases when we know that
    105  * there will be collisions between different keys.
    106  *
     100 * Hash table operations for cases when we know that there will be collisions
     101 * between different keys.
    107102 */
    108103static size_t irq_ht_hash(sysarg_t *key);
     
    117112
    118113/**
    119  * Hash table operations for cases when we know that
    120  * there will be no collisions between different keys.
    121  * However, there might be still collisions among
     114 * Hash table operations for cases when we know that there will be no collisions
     115 * between different keys.  However, there might be still collisions among
    122116 * elements with single key (sharing of one IRQ).
    123  *
    124117 */
    125118static size_t irq_lin_hash(sysarg_t *key);
     
    151144
    152145        /*
    153          * Be smart about the choice of the hash table operations.
    154          * In cases in which inrs equals the requested number of
    155          * chains (i.e. where there is no collision between
    156          * different keys), we can use optimized set of operations.
     146         * Be smart about the choice of the hash table operations.  In cases in
     147         * which inrs equals the requested number of chains (i.e. where there is
     148         * no collision between different keys), we can use optimized set of
     149         * operations.
    157150         */
    158151        if (inrs == chains) {
     
    188181/** Register IRQ for device.
    189182 *
    190  * The irq structure must be filled with information
    191  * about the interrupt source and with the claim()
    192  * function pointer and handler() function pointer.
     183 * The irq structure must be filled with information about the interrupt source
     184 * and with the claim() function pointer and handler() function pointer.
    193185 *
    194186 * @param irq IRQ structure belonging to a device.
    195  *
    196  * @return True on success, false on failure.
    197187 *
    198188 */
     
    259249/** Dispatch the IRQ.
    260250 *
    261  * We assume this function is only called from interrupt
    262  * context (i.e. that interrupts are disabled prior to
    263  * this call).
    264  *
    265  * This function attempts to lookup a fitting IRQ
    266  * structure. In case of success, return with interrupts
    267  * disabled and holding the respective structure.
     251 * We assume this function is only called from interrupt context (i.e. that
     252 * interrupts are disabled prior to this call).
     253 *
     254 * This function attempts to lookup a fitting IRQ structure. In case of success,
     255 * return with interrupts disabled and holding the respective structure.
    268256 *
    269257 * @param inr Interrupt number (aka inr or irq).
    270258 *
    271  * @return IRQ structure of the respective device or NULL.
     259 * @return IRQ structure of the respective device
     260 * @return NULL if no IRQ structure found
    272261 *
    273262 */
     
    275264{
    276265        /*
    277          * If the kernel console override is on,
    278          * then try first the kernel handlers
    279          * and eventually fall back to uspace
    280          * handlers.
     266         * If the kernel console override is on, then try first the kernel
     267         * handlers and eventually fall back to uspace handlers.
    281268         *
    282          * In the usual case the uspace handlers
    283          * have precedence.
     269         * In the usual case the uspace handlers have precedence.
    284270         */
    285271       
     
    301287/** Compute hash index for the key.
    302288 *
    303  * This function computes hash index into
    304  * the IRQ hash table for which there
    305  * can be collisions between different
    306  * INRs.
     289 * This function computes hash index into the IRQ hash table for which there can
     290 * be collisions between different INRs.
    307291 *
    308292 * The devno is not used to compute the hash.
     
    321305/** Compare hash table element with a key.
    322306 *
    323  * There are two things to note about this function.
    324  * First, it is used for the more complex architecture setup
    325  * in which there are way too many interrupt numbers (i.e. inr's)
    326  * to arrange the hash table so that collisions occur only
    327  * among same inrs of different devnos. So the explicit check
    328  * for inr match must be done.
    329  * Second, if devno is -1, the second key (i.e. devno) is not
    330  * used for the match and the result of the claim() function
    331  * is used instead.
     307 * There are two things to note about this function.  First, it is used for the
     308 * more complex architecture setup in which there are way too many interrupt
     309 * numbers (i.e. inr's) to arrange the hash table so that collisions occur only
     310 * among same inrs of different devnos. So the explicit check for inr match must
     311 * be done.  Second, if devno is -1, the second key (i.e. devno) is not used for
     312 * the match and the result of the claim() function is used instead.
    332313 *
    333314 * This function assumes interrupts are already disabled.
    334315 *
    335316 * @param key  Keys (i.e. inr and devno).
    336  * @param keys This is 2.
     317 * @param keys This is 2. 
    337318 * @param item The item to compare the key with.
    338319 *
    339  * @return True on match or false otherwise.
     320 * @return true on match
     321 * @return false on no match
    340322 *
    341323 */
     
    378360/** Compute hash index for the key.
    379361 *
    380  * This function computes hash index into
    381  * the IRQ hash table for which there
    382  * are no collisions between different
    383  * INRs.
     362 * This function computes hash index into the IRQ hash table for which there are
     363 * no collisions between different INRs.
    384364 *
    385365 * @param key The first of the keys is inr and the second is devno or -1.
     
    396376/** Compare hash table element with a key.
    397377 *
    398  * There are two things to note about this function.
    399  * First, it is used for the less complex architecture setup
    400  * in which there are not too many interrupt numbers (i.e. inr's)
    401  * to arrange the hash table so that collisions occur only
    402  * among same inrs of different devnos. So the explicit check
    403  * for inr match is not done.
    404  * Second, if devno is -1, the second key (i.e. devno) is not
    405  * used for the match and the result of the claim() function
    406  * is used instead.
     378 * There are two things to note about this function.  First, it is used for the
     379 * less complex architecture setup in which there are not too many interrupt
     380 * numbers (i.e. inr's) to arrange the hash table so that collisions occur only
     381 * among same inrs of different devnos. So the explicit check for inr match is
     382 * not done.  Second, if devno is -1, the second key (i.e. devno) is not used
     383 * for the match and the result of the claim() function is used instead.
    407384 *
    408385 * This function assumes interrupts are already disabled.
    409386 *
    410387 * @param key  Keys (i.e. inr and devno).
    411  * @param keys This is 2.
     388 * @param keys This is 2. 
    412389 * @param item The item to compare the key with.
    413390 *
    414  * @return True on match or false otherwise.
     391 * @return true on match
     392 * @return false on no match
    415393 *
    416394 */
Note: See TracChangeset for help on using the changeset viewer.