Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    rd51838f rce04ea44  
    115115}
    116116
    117 static bool isa_fun_owns_interrupt(isa_fun_t *fun, int irq)
    118 {
     117static bool isa_fun_enable_interrupt(ddf_fun_t *fnode)
     118{
     119        /* This is an old ugly way, copied from pci driver */
     120        assert(fnode);
     121        isa_fun_t *fun = isa_fun(fnode);
     122        assert(fun);
     123
    119124        const hw_resource_list_t *res = &fun->hw_resources;
    120 
    121         /* Check that specified irq really belongs to the function */
     125        assert(res);
    122126        for (size_t i = 0; i < res->count; ++i) {
    123                 if (res->resources[i].type == INTERRUPT &&
    124                     res->resources[i].res.interrupt.irq == irq) {
    125                         return true;
    126                 }
    127         }
    128 
    129         return false;
    130 }
    131 
    132 static int isa_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
    133 {
    134         isa_fun_t *fun = isa_fun(fnode);
    135 
    136         if (!isa_fun_owns_interrupt(fun, irq))
    137                 return EINVAL;
    138 
    139         return irc_enable_interrupt(irq);
    140 }
    141 
    142 static int isa_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
    143 {
    144         isa_fun_t *fun = isa_fun(fnode);
    145 
    146         if (!isa_fun_owns_interrupt(fun, irq))
    147                 return EINVAL;
    148 
    149         return irc_disable_interrupt(irq);
    150 }
    151 
    152 static int isa_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
    153 {
    154         isa_fun_t *fun = isa_fun(fnode);
    155 
    156         if (!isa_fun_owns_interrupt(fun, irq))
    157                 return EINVAL;
    158 
    159         return irc_clear_interrupt(irq);
     127                if (res->resources[i].type == INTERRUPT) {
     128                        int rc = irc_enable_interrupt(
     129                            res->resources[i].res.interrupt.irq);
     130
     131                        if (rc != EOK)
     132                                return false;
     133                }
     134        }
     135
     136        return true;
    160137}
    161138
     
    208185        .get_resource_list = isa_fun_get_resources,
    209186        .enable_interrupt = isa_fun_enable_interrupt,
    210         .disable_interrupt = isa_fun_disable_interrupt,
    211         .clear_interrupt = isa_fun_clear_interrupt,
    212187        .dma_channel_setup = isa_fun_setup_dma,
    213188        .dma_channel_remain = isa_fun_remain_dma,
     
    668643        list_initialize(&isa->functions);
    669644
    670         sess = ddf_dev_parent_sess_get(dev);
     645        sess = ddf_dev_parent_sess_create(dev);
    671646        if (sess == NULL) {
    672647                ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the "
Note: See TracChangeset for help on using the changeset viewer.