Changeset 6fc0edd in mainline


Ignore:
Timestamp:
2011-01-06T16:37:53Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b590c21
Parents:
0777f4c5
Message:

more robust interrupt processing

Location:
uspace/srv/hw/netif/dp8390
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/netif/dp8390/dp8390.c

    r0777f4c5 r6fc0edd  
    478478}
    479479
    480 void dp_check_ints(dpeth_t *dep)
    481 {
    482         int isr, tsr;
     480void dp_check_ints(dpeth_t *dep, int isr)
     481{
     482        int tsr;
    483483        int size, sendq_tail;
    484484       
     
    486486                fprintf(stderr, "dp8390: got premature interrupt\n");
    487487       
    488         for (;;) {
    489                 isr = inb_reg0(dep, DP_ISR);
    490                 if (!isr)
    491                         break;
    492                
     488        for (; isr; isr = inb_reg0(dep, DP_ISR)) {
    493489                outb_reg0(dep, DP_ISR, isr);
    494490               
     
    524520                       
    525521                        if (!(dep->de_sendq[sendq_tail].sq_filled)) {
    526                                 /* Software bug? */
    527                                 assert(false);
    528                                
    529522                                /* Or hardware bug? */
    530523                                printf("%s: transmit interrupt, but not sending\n", dep->de_name);
     
    601594}
    602595
    603 /*===========================================================================*
    604  *                              dp_recv                                      *
    605  *===========================================================================*/
    606 static void dp_recv(dep)
    607 dpeth_t *dep;
     596static void dp_recv(dpeth_t *dep)
    608597{
    609598        dp_rcvhdr_t header;
  • uspace/srv/hw/netif/dp8390/dp8390.h

    r0777f4c5 r6fc0edd  
    263263        phys_bytes de_linmem;
    264264        int de_irq;
    265         int de_int_pending;
    266         dp_initf_t de_initf;
    267         dp_stopf_t de_stopf;
     265        dp_initf_t de_initf;
     266        dp_stopf_t de_stopf;
    268267        char de_name[sizeof("dp8390#n")];
    269268       
  • uspace/srv/hw/netif/dp8390/dp8390_drv.h

    r0777f4c5 r6fc0edd  
    5656 *  @param[in,out] dep The network interface structure.
    5757 */
    58 void dp_check_ints(dpeth_t *dep);
     58void dp_check_ints(dpeth_t *dep, int isr);
    5959
    6060/** Probes and initializes the network interface.
  • uspace/srv/hw/netif/dp8390/dp8390_module.c

    r0777f4c5 r6fc0edd  
    5858#define NAME  "dp8390"
    5959
    60 /** Returns the device from the interrupt call.
     60/** Return the device from the interrupt call.
     61 *
    6162 *  @param[in] call The interrupt call.
    62  */
    63 #define IRQ_GET_DEVICE(call)  (device_id_t) IPC_GET_IMETHOD(*call)
     63 *
     64 */
     65#define IRQ_GET_DEVICE(call)  ((device_id_t) IPC_GET_IMETHOD(call))
     66
     67/** Return the ISR from the interrupt call.
     68 *
     69 *  @param[in] call The interrupt call.
     70 *
     71 */
     72#define IRQ_GET_ISR(call)  ((int) IPC_GET_ARG2(call))
    6473
    6574/** DP8390 kernel interrupt command sequence.
     
    7281        },
    7382        {
     83                .cmd = CMD_BTEST,
     84                .value = 0x7f,
     85                .srcarg = 2,
     86                .dstarg = 3,
     87        },
     88        {
    7489                .cmd = CMD_PREDICATE,
    75                 .value = 1,
    76                 .srcarg = 2
     90                .value = 2,
     91                .srcarg = 3
     92        },
     93        {
     94                .cmd = CMD_PIO_WRITE_8,
     95                .addr = NULL,
     96                .value = 0xff
    7797        },
    7898        {
     
    101121        int phone;
    102122       
    103         device_id = IRQ_GET_DEVICE(call);
     123        device_id = IRQ_GET_DEVICE(*call);
    104124        fibril_rwlock_write_lock(&netif_globals.lock);
    105125       
     
    117137        assert(dep->de_flags & DEF_ENABLED);
    118138       
    119         dep->de_int_pending = 0;
    120         dp_check_ints(dep);
     139        dp_check_ints(dep, IRQ_GET_ISR(*call));
    121140       
    122141        if (dep->received_queue) {
     
    279298               
    280299                if (do_pwrite(dep, packet, false) != EBUSY)
    281                         netif_pq_release(packet_get_id(packet));\
     300                        netif_pq_release(packet_get_id(packet));
    282301               
    283302                packet = next;
     
    295314                dep = (dpeth_t *) device->specific;
    296315                dp8390_cmds[0].addr = (void *) (uintptr_t) (dep->de_dp8390_port + DP_ISR);
    297                 dp8390_cmds[2].addr = dp8390_cmds[0].addr;
     316                dp8390_cmds[3].addr = dp8390_cmds[0].addr;
    298317               
    299318                rc = ipc_register_irq(dep->de_irq, device->device_id, device->device_id, &dp8390_code);
Note: See TracChangeset for help on using the changeset viewer.