Changeset c028b22 in mainline for kernel/generic/src/ipc/irq.c


Ignore:
Timestamp:
2011-07-08T17:01:01Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cc1a727
Parents:
4e36219 (diff), 026793d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r4e36219 rc028b22  
    174174        irq->notif_cfg.code = code;
    175175        irq->notif_cfg.counter = 0;
     176        irq->driver_as = AS;
    176177       
    177178        /*
     
    199200       
    200201        hash_table_insert(&irq_uspace_hash_table, key, &irq->link);
    201         list_append(&irq->notif_cfg.link, &box->irq_head);
     202        list_append(&irq->notif_cfg.link, &box->irq_list);
    202203       
    203204        irq_spinlock_unlock(&box->irq_lock, false);
     
    281282        irq_spinlock_lock(&box->irq_lock, false);
    282283       
    283         while (box->irq_head.next != &box->irq_head) {
     284        while (!list_empty(&box->irq_list)) {
    284285                DEADLOCK_PROBE_INIT(p_irqlock);
    285286               
    286                 irq_t *irq = list_get_instance(box->irq_head.next, irq_t,
     287                irq_t *irq = list_get_instance(list_first(&box->irq_list), irq_t,
    287288                    notif_cfg.link);
    288289               
     
    364365                return IRQ_DECLINE;
    365366       
     367#define CMD_MEM_READ(target) \
     368do { \
     369        void *va = code->cmds[i].addr; \
     370        if (AS != irq->driver_as) \
     371                as_switch(AS, irq->driver_as); \
     372        memcpy_from_uspace(&target, va, (sizeof(target))); \
     373        if (dstarg) \
     374                scratch[dstarg] = target; \
     375} while(0)
     376
     377#define CMD_MEM_WRITE(val) \
     378do { \
     379        void *va = code->cmds[i].addr; \
     380        if (AS != irq->driver_as) \
     381                as_switch(AS, irq->driver_as); \
     382        memcpy_to_uspace(va, &val, sizeof(val)); \
     383} while (0)
     384
     385        as_t *current_as = AS;
    366386        size_t i;
    367387        for (i = 0; i < code->cmdcount; i++) {
     
    422442                        }
    423443                        break;
     444                case CMD_MEM_READ_8: {
     445                        uint8_t val;
     446                        CMD_MEM_READ(val);
     447                        break;
     448                        }
     449                case CMD_MEM_READ_16: {
     450                        uint16_t val;
     451                        CMD_MEM_READ(val);
     452                        break;
     453                        }
     454                case CMD_MEM_READ_32: {
     455                        uint32_t val;
     456                        CMD_MEM_READ(val);
     457                        break;
     458                        }
     459                case CMD_MEM_WRITE_8: {
     460                        uint8_t val = code->cmds[i].value;
     461                        CMD_MEM_WRITE(val);
     462                        break;
     463                        }
     464                case CMD_MEM_WRITE_16: {
     465                        uint16_t val = code->cmds[i].value;
     466                        CMD_MEM_WRITE(val);
     467                        break;
     468                        }
     469                case CMD_MEM_WRITE_32: {
     470                        uint32_t val = code->cmds[i].value;
     471                        CMD_MEM_WRITE(val);
     472                        break;
     473                        }
     474                case CMD_MEM_WRITE_A_8:
     475                        if (srcarg) {
     476                                uint8_t val = scratch[srcarg];
     477                                CMD_MEM_WRITE(val);
     478                        }
     479                        break;
     480                case CMD_MEM_WRITE_A_16:
     481                        if (srcarg) {
     482                                uint16_t val = scratch[srcarg];
     483                                CMD_MEM_WRITE(val);
     484                        }
     485                        break;
     486                case CMD_MEM_WRITE_A_32:
     487                        if (srcarg) {
     488                                uint32_t val = scratch[srcarg];
     489                                CMD_MEM_WRITE(val);
     490                        }
     491                        break;
    424492                case CMD_BTEST:
    425493                        if ((srcarg) && (dstarg)) {
     
    435503                        break;
    436504                case CMD_ACCEPT:
     505                        if (AS != current_as)
     506                                as_switch(AS, current_as);
    437507                        return IRQ_ACCEPT;
    438508                case CMD_DECLINE:
    439509                default:
     510                        if (AS != current_as)
     511                                as_switch(AS, current_as);
    440512                        return IRQ_DECLINE;
    441513                }
    442514        }
     515        if (AS != current_as)
     516                as_switch(AS, current_as);
    443517       
    444518        return IRQ_DECLINE;
Note: See TracChangeset for help on using the changeset viewer.