Changeset 24abb85d in mainline for kernel/generic/src


Ignore:
Timestamp:
2017-08-18T23:27:08Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4d76cfc
Parents:
e9d15d9
Message:

Remove SYS_DEVICE_ASSIGN_DEVNO

Location:
kernel/generic/src
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/kconsole.c

    re9d15d9 r24abb85d  
    5555#include <str.h>
    5656#include <sysinfo/sysinfo.h>
    57 #include <ddi/device.h>
    5857#include <symtab.h>
    5958#include <errno.h>
  • kernel/generic/src/ddi/irq.c

    re9d15d9 r24abb85d  
    5959 * Note about the irq_hash_table.
    6060 *
    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.
     61 * The hash table is configured to use two keys: inr and mode.  However, the
     62 * hash index is computed only from inr. Moreover, if mode is IRQ_HT_MODE_CLAIM,
     63 * the match is based also on the return value of the claim(). Otherwise the
     64 * the keys do not match.
    6465 */
    6566
     
    7374#include <mem.h>
    7475#include <arch.h>
    75 
    76 #define KEY_INR    0
    77 #define KEY_DEVNO  1
    7876
    7977/** Spinlock protecting the kernel IRQ hash table.
     
    174172        link_initialize(&irq->notif_cfg.link);
    175173        irq->inr = -1;
    176         irq->devno = -1;
    177174       
    178175        irq_initialize_arch(irq);
     
    190187{
    191188        sysarg_t key[] = {
    192                 (sysarg_t) irq->inr,
    193                 (sysarg_t) irq->devno
     189                [IRQ_HT_KEY_INR] = (sysarg_t) irq->inr,
     190                [IRQ_HT_KEY_MODE] = (sysarg_t) IRQ_HT_MODE_NO_CLAIM
    194191        };
    195192       
     
    208205        link_t *lnk;
    209206        sysarg_t key[] = {
    210                 (sysarg_t) inr,
    211                 (sysarg_t) -1    /* Search will use claim() instead of devno */
     207                [IRQ_HT_KEY_INR] = (sysarg_t) inr,
     208                [IRQ_HT_KEY_MODE] = (sysarg_t) IRQ_HT_MODE_CLAIM
    212209        };
    213210       
     
    231228        link_t *lnk;
    232229        sysarg_t key[] = {
    233                 (sysarg_t) inr,
    234                 (sysarg_t) -1    /* Search will use claim() instead of devno */
     230                [IRQ_HT_KEY_INR] = (sysarg_t) inr,
     231                [IRQ_HT_KEY_MODE] = (sysarg_t) IRQ_HT_MODE_CLAIM
    235232        };
    236233       
     
    290287 * be collisions between different INRs.
    291288 *
    292  * The devno is not used to compute the hash.
    293  *
    294  * @param key The first of the keys is inr and the second is devno or -1.
     289 * The mode is not used to compute the hash.
     290 *
     291 * @param key The first of the keys is inr and the second is mode.
    295292 *
    296293 * @return Index into the hash table.
     
    299296size_t irq_ht_hash(sysarg_t key[])
    300297{
    301         inr_t inr = (inr_t) key[KEY_INR];
     298        inr_t inr = (inr_t) key[IRQ_HT_KEY_INR];
    302299        return inr % buckets;
    303300}
     
    308305 * more complex architecture setup in which there are way too many interrupt
    309306 * 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.
     307 * among same inrs of different devices. So the explicit check for inr match
     308 * must be done.  Second, if mode is IRQ_HT_MODE_CLAIM, the result of the
     309 * claim() function is used for the match. Otherwise the key does not match.
    313310 *
    314311 * This function assumes interrupts are already disabled.
    315312 *
    316  * @param key  Keys (i.e. inr and devno).
     313 * @param key  Keys (i.e. inr and mode).
    317314 * @param keys This is 2.
    318315 * @param item The item to compare the key with.
     
    325322{
    326323        irq_t *irq = hash_table_get_instance(item, irq_t, link);
    327         inr_t inr = (inr_t) key[KEY_INR];
    328         devno_t devno = (devno_t) key[KEY_DEVNO];
     324        inr_t inr = (inr_t) key[IRQ_HT_KEY_INR];
     325        irq_ht_mode_t mode = (irq_ht_mode_t) key[IRQ_HT_KEY_MODE];
    329326       
    330327        bool rv;
    331328       
    332329        irq_spinlock_lock(&irq->lock, false);
    333         if (devno == -1) {
     330        if (mode == IRQ_HT_MODE_CLAIM) {
    334331                /* Invoked by irq_dispatch_and_lock(). */
    335                 rv = ((irq->inr == inr) &&
    336                     (irq->claim(irq) == IRQ_ACCEPT));
     332                rv = ((irq->inr == inr) && (irq->claim(irq) == IRQ_ACCEPT));
    337333        } else {
    338334                /* Invoked by irq_find_and_lock(). */
    339                 rv = ((irq->inr == inr) && (irq->devno == devno));
     335                rv = false;
    340336        }
    341337       
     
    363359 * no collisions between different INRs.
    364360 *
    365  * @param key The first of the keys is inr and the second is devno or -1.
     361 * @param key The first of the keys is inr and the second is mode.
    366362 *
    367363 * @return Index into the hash table.
     
    370366size_t irq_lin_hash(sysarg_t key[])
    371367{
    372         inr_t inr = (inr_t) key[KEY_INR];
     368        inr_t inr = (inr_t) key[IRQ_HT_KEY_INR];
    373369        return inr;
    374370}
     
    385381 * This function assumes interrupts are already disabled.
    386382 *
    387  * @param key  Keys (i.e. inr and devno).
     383 * @param key  Keys (i.e. inr and mode).
    388384 * @param keys This is 2.
    389385 * @param item The item to compare the key with.
     
    396392{
    397393        irq_t *irq = list_get_instance(item, irq_t, link);
    398         devno_t devno = (devno_t) key[KEY_DEVNO];
     394        irq_ht_mode_t mode = (irq_ht_mode_t) key[IRQ_HT_KEY_MODE];
    399395        bool rv;
    400396       
    401397        irq_spinlock_lock(&irq->lock, false);
    402         if (devno == -1) {
     398        if (mode == IRQ_HT_MODE_CLAIM) {
    403399                /* Invoked by irq_dispatch_and_lock() */
    404400                rv = (irq->claim(irq) == IRQ_ACCEPT);
    405401        } else {
    406402                /* Invoked by irq_find_and_lock() */
    407                 rv = (irq->devno == devno);
     403                rv = false;
    408404        }
    409405       
  • kernel/generic/src/ipc/irq.c

    re9d15d9 r24abb85d  
    294294 * @param box     Receiving answerbox.
    295295 * @param inr     IRQ number.
    296  * @param devno   Device number.
    297296 * @param imethod Interface and method to be associated with the
    298297 *                notification.
     
    303302 *
    304303 */
    305 int ipc_irq_subscribe(answerbox_t *box, inr_t inr, devno_t devno,
    306     sysarg_t imethod, irq_code_t *ucode)
     304int ipc_irq_subscribe(answerbox_t *box, inr_t inr, sysarg_t imethod,
     305    irq_code_t *ucode)
    307306{
    308307        sysarg_t key[] = {
    309                 (sysarg_t) inr,
    310                 (sysarg_t) devno
     308                [IRQ_HT_KEY_INR] = (sysarg_t) inr,
     309                [IRQ_HT_KEY_MODE] = (sysarg_t) IRQ_HT_MODE_NO_CLAIM
    311310        };
    312311       
     
    334333        irq_t *irq = &kobj->irq;
    335334        irq_initialize(irq);
    336         irq->devno = devno;
    337335        irq->inr = inr;
    338336        irq->claim = ipc_irq_top_half_claim;
     
    349347         */
    350348        irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
    351        
    352         link_t *hlp = hash_table_find(&irq_uspace_hash_table, key);
    353         if (hlp) {
    354                 irq_t *hirq = hash_table_get_instance(hlp, irq_t, link);
    355                
    356                 /* hirq is locked */
    357                 irq_spinlock_unlock(&hirq->lock, false);
    358                 code_free(code);
    359                 irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
    360                
    361                 kobject_free(TASK, cap);
    362                 return EEXIST;
    363         }
    364        
    365         /* Locking is not really necessary, but paranoid */
    366349        irq_spinlock_lock(&irq->lock, false);
    367350        irq_spinlock_lock(&box->irq_lock, false);
  • kernel/generic/src/ipc/sysipc.c

    re9d15d9 r24abb85d  
    801801 *
    802802 * @param inr     IRQ number.
    803  * @param devno   Device number.
    804803 * @param imethod Interface and method to be associated with the notification.
    805804 * @param ucode   Uspace pointer to the top-half pseudocode.
     
    810809 *
    811810 */
    812 sysarg_t sys_ipc_irq_subscribe(inr_t inr, devno_t devno, sysarg_t imethod,
    813     irq_code_t *ucode)
     811sysarg_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod, irq_code_t *ucode)
    814812{
    815813        if (!(perm_get(TASK) & PERM_IRQ_REG))
    816814                return EPERM;
    817815       
    818         return ipc_irq_subscribe(&TASK->answerbox, inr, devno, imethod, ucode);
     816        return ipc_irq_subscribe(&TASK->answerbox, inr, imethod, ucode);
    819817}
    820818
  • kernel/generic/src/syscall/syscall.c

    re9d15d9 r24abb85d  
    4545#include <arch.h>
    4646#include <debug.h>
    47 #include <ddi/device.h>
    4847#include <interrupt.h>
    4948#include <ipc/sysipc.h>
     
    175174       
    176175        /* DDI related syscalls. */
    177         [SYS_DEVICE_ASSIGN_DEVNO] = (syshandler_t) sys_device_assign_devno,
    178176        [SYS_PHYSMEM_MAP] = (syshandler_t) sys_physmem_map,
    179177        [SYS_PHYSMEM_UNMAP] = (syshandler_t) sys_physmem_unmap,
Note: See TracChangeset for help on using the changeset viewer.