Changeset 984a9ba in mainline for uspace/drv/intctl


Ignore:
Timestamp:
2018-07-05T09:34:09Z (7 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63d46341
Parents:
76f566d
Message:

do not expose the call capability handler from the async framework

Keep the call capability handler encapsulated within the async framework
and do not expose it explicitly via its API. Use the pointer to
ipc_call_t as the sole object identifying an IPC call in the code that
uses the async framework.

This plugs a major leak in the abstraction and also simplifies both the
async framework (slightly) and all IPC servers.

Location:
uspace/drv/intctl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/intctl/apic/apic.c

    r76f566d r984a9ba  
    160160/** Handle one connection to APIC.
    161161 *
    162  * @param iid   Hash of the request that opened the connection.
    163162 * @param icall Call data of the request that opened the connection.
    164  * @param arg   Local argument.
    165  */
    166 static void apic_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
    167 {
    168         cap_call_handle_t chandle;
     163 * @param arg   Local argument.
     164 *
     165 */
     166static void apic_connection(ipc_call_t *icall, void *arg)
     167{
    169168        ipc_call_t call;
    170169        apic_t *apic;
     
    173172         * Answer the first IPC_M_CONNECT_ME_TO call.
    174173         */
    175         async_answer_0(icall_handle, EOK);
    176 
    177         apic = (apic_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
     174        async_answer_0(icall, EOK);
     175
     176        apic = (apic_t *) ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *) arg));
    178177
    179178        while (true) {
    180                 chandle = async_get_call(&call);
     179                async_get_call(&call);
    181180
    182181                if (!IPC_GET_IMETHOD(call)) {
    183182                        /* The other side has hung up. */
    184                         async_answer_0(chandle, EOK);
     183                        async_answer_0(&call, EOK);
    185184                        return;
    186185                }
     
    188187                switch (IPC_GET_IMETHOD(call)) {
    189188                case IRC_ENABLE_INTERRUPT:
    190                         async_answer_0(chandle, apic_enable_irq(apic,
     189                        async_answer_0(&call, apic_enable_irq(apic,
    191190                            IPC_GET_ARG1(call)));
    192191                        break;
    193192                case IRC_DISABLE_INTERRUPT:
    194193                        /* XXX TODO */
    195                         async_answer_0(chandle, EOK);
     194                        async_answer_0(&call, EOK);
    196195                        break;
    197196                case IRC_CLEAR_INTERRUPT:
    198197                        /* Noop */
    199                         async_answer_0(chandle, EOK);
     198                        async_answer_0(&call, EOK);
    200199                        break;
    201200                default:
    202                         async_answer_0(chandle, EINVAL);
     201                        async_answer_0(&call, EINVAL);
    203202                        break;
    204203                }
  • uspace/drv/intctl/i8259/i8259.c

    r76f566d r984a9ba  
    8989/** Handle one connection to i8259.
    9090 *
    91  * @param iid   Hash of the request that opened the connection.
    9291 * @param icall Call data of the request that opened the connection.
    93  * @param arg   Local argument.
    94  */
    95 static void i8259_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
    96 {
    97         cap_call_handle_t chandle;
     92 * @param arg   Local argument.
     93 *
     94 */
     95static void i8259_connection(ipc_call_t *icall, void *arg)
     96{
    9897        ipc_call_t call;
    9998        i8259_t *i8259 = NULL /* XXX */;
     
    102101         * Answer the first IPC_M_CONNECT_ME_TO call.
    103102         */
    104         async_answer_0(icall_handle, EOK);
    105 
    106         i8259 = (i8259_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
     103        async_answer_0(icall, EOK);
     104
     105        i8259 = (i8259_t *) ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *) arg));
    107106
    108107        while (true) {
    109                 chandle = async_get_call(&call);
     108                async_get_call(&call);
    110109
    111110                if (!IPC_GET_IMETHOD(call)) {
    112111                        /* The other side has hung up. */
    113                         async_answer_0(chandle, EOK);
     112                        async_answer_0(&call, EOK);
    114113                        return;
    115114                }
     
    117116                switch (IPC_GET_IMETHOD(call)) {
    118117                case IRC_ENABLE_INTERRUPT:
    119                         async_answer_0(chandle, pic_enable_irq(i8259,
     118                        async_answer_0(&call, pic_enable_irq(i8259,
    120119                            IPC_GET_ARG1(call)));
    121120                        break;
    122121                case IRC_DISABLE_INTERRUPT:
    123122                        /* XXX TODO */
    124                         async_answer_0(chandle, EOK);
     123                        async_answer_0(&call, EOK);
    125124                        break;
    126125                case IRC_CLEAR_INTERRUPT:
    127126                        /* Noop */
    128                         async_answer_0(chandle, EOK);
     127                        async_answer_0(&call, EOK);
    129128                        break;
    130129                default:
    131                         async_answer_0(chandle, EINVAL);
     130                        async_answer_0(&call, EINVAL);
    132131                        break;
    133132                }
  • uspace/drv/intctl/icp-ic/icp-ic.c

    r76f566d r984a9ba  
    6565/** Client connection handler.
    6666 *
    67  * @param iid   Hash of the request that opened the connection.
    6867 * @param icall Call data of the request that opened the connection.
    69  * @param arg   Local argument.
     68 * @param arg   Local argument.
     69 *
    7070 */
    71 static void icpic_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     71static void icpic_connection(ipc_call_t *icall, void *arg)
    7272{
    73         cap_call_handle_t chandle;
    7473        ipc_call_t call;
    7574        icpic_t *icpic;
     
    7877         * Answer the first IPC_M_CONNECT_ME_TO call.
    7978         */
    80         async_answer_0(icall_handle, EOK);
     79        async_answer_0(icall, EOK);
    8180
    82         icpic = (icpic_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
     81        icpic = (icpic_t *) ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *) arg));
    8382
    8483        while (true) {
    85                 chandle = async_get_call(&call);
     84                async_get_call(&call);
    8685
    8786                if (!IPC_GET_IMETHOD(call)) {
    8887                        /* The other side has hung up. */
    89                         async_answer_0(chandle, EOK);
     88                        async_answer_0(&call, EOK);
    9089                        return;
    9190                }
     
    9392                switch (IPC_GET_IMETHOD(call)) {
    9493                case IRC_ENABLE_INTERRUPT:
    95                         async_answer_0(chandle,
     94                        async_answer_0(&call,
    9695                            icpic_enable_irq(icpic, IPC_GET_ARG1(call)));
    9796                        break;
    9897                case IRC_DISABLE_INTERRUPT:
    9998                        /* XXX TODO */
    100                         async_answer_0(chandle, EOK);
     99                        async_answer_0(&call, EOK);
    101100                        break;
    102101                case IRC_CLEAR_INTERRUPT:
    103102                        /* Noop */
    104                         async_answer_0(chandle, EOK);
     103                        async_answer_0(&call, EOK);
    105104                        break;
    106105                default:
    107                         async_answer_0(chandle, EINVAL);
     106                        async_answer_0(&call, EINVAL);
    108107                        break;
    109108                }
  • uspace/drv/intctl/obio/obio.c

    r76f566d r984a9ba  
    6969/** Handle one connection to obio.
    7070 *
    71  * @param iid           Hash of the request that opened the connection.
    72  * @param icall         Call data of the request that opened the connection.
    73  * @param arg           Local argument.
     71 * @param icall Call data of the request that opened the connection.
     72 * @param arg   Local argument.
     73 *
    7474 */
    75 static void obio_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     75static void obio_connection(ipc_call_t *icall, void *arg)
    7676{
    77         cap_call_handle_t chandle;
    7877        ipc_call_t call;
    7978        obio_t *obio;
     
    8281         * Answer the first IPC_M_CONNECT_ME_TO call.
    8382         */
    84         async_answer_0(icall_handle, EOK);
     83        async_answer_0(icall, EOK);
    8584
    86         obio = (obio_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
     85        obio = (obio_t *) ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *) arg));
    8786
    8887        while (true) {
    8988                int inr;
    9089
    91                 chandle = async_get_call(&call);
     90                async_get_call(&call);
     91
    9292                switch (IPC_GET_IMETHOD(call)) {
    9393                case IRC_ENABLE_INTERRUPT:
     
    9595                        pio_set_64(&obio->regs[OBIO_IMR(inr & INO_MASK)],
    9696                            1UL << 31, 0);
    97                         async_answer_0(chandle, EOK);
     97                        async_answer_0(&call, EOK);
    9898                        break;
    9999                case IRC_DISABLE_INTERRUPT:
    100100                        /* XXX TODO */
    101                         async_answer_0(chandle, EOK);
     101                        async_answer_0(&call, EOK);
    102102                        break;
    103103                case IRC_CLEAR_INTERRUPT:
    104104                        inr = IPC_GET_ARG1(call);
    105105                        pio_write_64(&obio->regs[OBIO_CIR(inr & INO_MASK)], 0);
    106                         async_answer_0(chandle, EOK);
     106                        async_answer_0(&call, EOK);
    107107                        break;
    108108                default:
    109                         async_answer_0(chandle, EINVAL);
     109                        async_answer_0(&call, EINVAL);
    110110                        break;
    111111                }
Note: See TracChangeset for help on using the changeset viewer.