Changeset bdc5c516 in mainline


Ignore:
Timestamp:
2006-05-03T08:18:01Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
22cf454d
Parents:
cc35e88
Message:

Added commands for accessing ia32 portspace in irq top-half.

Location:
generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • generic/include/ipc/irq.h

    rcc35e88 rbdc5c516  
    4141        CMD_MEM_WRITE_4,
    4242        CMD_MEM_WRITE_8,
     43        CMD_PORT_READ_1,
     44        CMD_PORT_WRITE_1,
    4345        CMD_LAST
    4446} irq_cmd_type;
  • generic/src/ipc/irq.c

    rcc35e88 rbdc5c516  
    2727 */
    2828
     29/** IRQ notification framework
     30 *
     31 * This framework allows applications to register to receive a notification
     32 * when interrupt is detected. The application may provide a simple 'top-half'
     33 * handler as part of its registration, which can perform simple operations
     34 * (read/write port/memory, add information to notification ipc message).
     35 *
     36 * The structure of a notification message is as follows:
     37 * - METHOD: IPC_M_INTERRUPT
     38 * - ARG1: interrupt number
     39 * - ARG2: payload modified by a 'top-half' handler
     40 * - ARG3: interrupt counter (may be needed to assure correct order
     41 *         in multithreaded drivers)
     42 */
     43
    2944#include <arch.h>
    3045#include <mm/slab.h>
     
    3247#include <ipc/ipc.h>
    3348#include <ipc/irq.h>
     49#include <atomic.h>
    3450
    3551typedef struct {
     
    3753        answerbox_t *box;
    3854        irq_code_t *code;
     55        atomic_t counter;
    3956} ipc_irq_t;
    4057
     
    7895                        *((__u64 *)code->cmds[i].addr) = code->cmds[i].value;
    7996                        break;
     97#if defined(ia32) || defined(amd64)
     98                case CMD_PORT_READ_1:
     99                        IPC_SET_ARG2(call->data, inb((long)code->cmds[i].addr));
     100                        break;
     101                case CMD_PORT_WRITE_1:
     102                        outb((long)code->cmds[i].addr, code->cmds[i].value);
     103                        break;
     104#endif
    80105                default:
    81106                        break;
     
    154179        irq_conns[irq].box = box;
    155180        irq_conns[irq].code = code;
     181        atomic_set(&irq_conns[irq].counter, 0);
    156182        spinlock_unlock(&irq_conns[irq].lock);
    157183        interrupts_restore(ipl);
     
    176202                IPC_SET_METHOD(call->data, IPC_M_INTERRUPT);
    177203                IPC_SET_ARG1(call->data, irq);
     204                IPC_SET_ARG3(call->data, atomic_preinc(&irq_conns[irq].counter));
    178205
    179206                /* Execute code to handle irq */
Note: See TracChangeset for help on using the changeset viewer.