Ignore:
Timestamp:
2011-01-07T15:10:52Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
61bfc370
Parents:
3d5e190 (diff), acc7ce4 (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 small NE2000 and interrupt handling improvements

  • introduce new uspace interrupt controller drivers
    • i8259
    • APIC (only a non-functional stub yet)
  • do not pre-enable NE2000's IRQ in kernel, but use the above drivers (solves the "spurious interrupt" issue, but breaks SMP functionality because of the non-functional APIC driver)
File:
1 edited

Legend:

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

    r3d5e190 r7c34b28f  
    4141#include <err.h>
    4242#include <malloc.h>
     43#include <sysinfo.h>
    4344#include <ipc/ipc.h>
    4445#include <ipc/services.h>
     46#include <ipc/irc.h>
    4547#include <net/modules.h>
    4648#include <packet_client.h>
     
    7173 */
    7274#define IRQ_GET_ISR(call)  ((int) IPC_GET_ARG2(call))
     75
     76static int irc_service = 0;
     77static int irc_phone = -1;
    7378
    7479/** DP8390 kernel interrupt command sequence.
     
    136141}
    137142
    138 /** Changes the network interface state.
     143/** Change the network interface state.
     144 *
    139145 *  @param[in,out] device The network interface.
    140  *  @param[in] state The new state.
    141  *  @returns The new state.
     146 *  @param[in]     state  The new state.
     147 *
     148 *  @return The new state.
     149 *
    142150 */
    143151static int change_state(netif_device_t *device, device_state_t state)
     
    272280                return rc;
    273281       
    274         if (device->state != NETIF_ACTIVE){
     282        if (device->state != NETIF_ACTIVE) {
    275283                netif_pq_release(packet_get_id(packet));
    276284                return EFORWARD;
     
    312320                }
    313321               
    314                 return change_state(device, NETIF_ACTIVE);
     322                rc = change_state(device, NETIF_ACTIVE);
     323               
     324                if (irc_service)
     325                        async_msg_1(irc_phone, IRC_ENABLE_INTERRUPT, dep->de_irq);
     326               
     327                return rc;
    315328        }
    316329       
     
    334347int netif_initialize(void)
    335348{
     349        sysarg_t apic;
     350        sysarg_t i8259;
     351       
     352        if ((sysinfo_get_value("apic", &apic) == EOK) && (apic))
     353                irc_service = SERVICE_APIC;
     354        else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))
     355                irc_service = SERVICE_I8259;
     356       
     357        if (irc_service) {
     358                while (irc_phone < 0) {
     359                        irc_phone = ipc_connect_me_to_blocking(PHONE_NS, irc_service,
     360                            0, 0);
     361                }
     362        }
     363       
     364        async_set_interrupt_received(irq_handler);
     365       
    336366        sysarg_t phonehash;
    337         async_set_interrupt_received(irq_handler);
    338367        return ipc_connect_to_me(PHONE_NS, SERVICE_DP8390, 0, 0, &phonehash);
    339368}
Note: See TracChangeset for help on using the changeset viewer.