Changeset 7c34b28f in mainline


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)
Files:
4 added
29 edited
5 moved

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    r3d5e190 r7c34b28f  
    3030
    3131RD_SRVS_ESSENTIAL += \
    32         $(USPACE_PATH)/srv/hw/char/i8042/i8042
     32        $(USPACE_PATH)/srv/hw/char/i8042/i8042 \
     33        $(USPACE_PATH)/srv/hw/irc/apic/apic \
     34        $(USPACE_PATH)/srv/hw/irc/i8259/i8259
    3335
    3436RD_SRVS_NON_ESSENTIAL += \
     
    4143        isa \
    4244        ns8250
    43        
     45
    4446RD_DRV_CFG += \
    4547        isa/isa.dev
  • boot/arch/sparc64/Makefile.inc

    r3d5e190 r7c34b28f  
    4343
    4444RD_SRVS_ESSENTIAL += \
    45         $(USPACE_PATH)/srv/hw/cir/fhc/fhc \
    46         $(USPACE_PATH)/srv/hw/cir/obio/obio
     45        $(USPACE_PATH)/srv/hw/irc/fhc/fhc \
     46        $(USPACE_PATH)/srv/hw/irc/obio/obio
    4747
    4848SOURCES = \
  • kernel/arch/amd64/include/interrupt.h

    r3d5e190 r7c34b28f  
    7474extern void (* enable_irqs_function)(uint16_t);
    7575extern void (* eoi_function)(void);
     76extern const char *irqs_info;
    7677
    7778extern void interrupt_init(void);
  • kernel/arch/amd64/src/amd64.c

    r3d5e190 r7c34b28f  
    235235#endif
    236236       
    237         /*
    238          * This nasty hack should also go away ASAP.
    239          */
    240         trap_virtual_enable_irqs(1 << IRQ_DP8390);
     237        if (irqs_info != NULL)
     238                sysinfo_set_item_val(irqs_info, NULL, true);
     239       
    241240        sysinfo_set_item_val("netif.dp8390.inr", NULL, IRQ_DP8390);
    242241}
  • kernel/arch/amd64/src/interrupt.c

    r3d5e190 r7c34b28f  
    6262void (* enable_irqs_function)(uint16_t irqmask) = NULL;
    6363void (* eoi_function)(void) = NULL;
     64const char *irqs_info = NULL;
    6465
    6566void istate_decode(istate_t *istate)
  • kernel/arch/ia32/include/interrupt.h

    r3d5e190 r7c34b28f  
    7474extern void (* enable_irqs_function)(uint16_t);
    7575extern void (* eoi_function)(void);
     76extern const char *irqs_info;
    7677
    7778extern void interrupt_init(void);
  • kernel/arch/ia32/src/drivers/i8259.c

    r3d5e190 r7c34b28f  
    8686        disable_irqs_function = pic_disable_irqs;
    8787        eoi_function = pic_eoi;
     88        irqs_info = "i8259";
    8889
    8990        pic_disable_irqs(0xffff);               /* disable all irq's */
  • kernel/arch/ia32/src/ia32.c

    r3d5e190 r7c34b28f  
    193193#endif
    194194       
    195         /*
    196          * This nasty hack should also go away ASAP.
    197          */
    198         trap_virtual_enable_irqs(1 << IRQ_DP8390);
     195        if (irqs_info != NULL)
     196                sysinfo_set_item_val(irqs_info, NULL, true);
     197       
    199198        sysinfo_set_item_val("netif.dp8390.inr", NULL, IRQ_DP8390);
    200199}
  • kernel/arch/ia32/src/interrupt.c

    r3d5e190 r7c34b28f  
    6262void (* enable_irqs_function)(uint16_t irqmask) = NULL;
    6363void (* eoi_function)(void) = NULL;
     64const char *irqs_info = NULL;
    6465
    6566void istate_decode(istate_t *istate)
  • kernel/arch/ia32/src/smp/apic.c

    r3d5e190 r7c34b28f  
    178178        disable_irqs_function = io_apic_disable_irqs;
    179179        eoi_function = l_apic_eoi;
     180        irqs_info = "apic";
    180181       
    181182        /*
  • uspace/Makefile

    r3d5e190 r7c34b28f  
    108108
    109109ifeq ($(UARCH),amd64)
    110         DIRS += drv/rootpc
    111         DIRS += drv/pciintel
    112         DIRS += drv/isa
    113         DIRS += drv/ns8250
     110        DIRS += \
     111                drv/rootpc \
     112                drv/pciintel \
     113                drv/isa \
     114                drv/ns8250 \
     115                srv/hw/irc/apic \
     116                srv/hw/irc/i8259
    114117endif
    115118
    116119ifeq ($(UARCH),ia32)
    117         DIRS += drv/rootpc
    118         DIRS += drv/pciintel
    119         DIRS += drv/isa
    120         DIRS += drv/ns8250
     120        DIRS += \
     121                drv/rootpc \
     122                drv/pciintel \
     123                drv/isa \
     124                drv/ns8250 \
     125                srv/hw/irc/apic \
     126                srv/hw/irc/i8259
    121127endif
    122128
     
    127133ifeq ($(UARCH),sparc64)
    128134        DIRS += \
    129                 srv/hw/cir/fhc \
    130                 srv/hw/cir/obio
     135                srv/hw/irc/fhc \
     136                srv/hw/irc/obio
    131137endif
    132138
  • uspace/app/init/init.c

    r3d5e190 r7c34b28f  
    273273        mount_tmpfs();
    274274       
     275        spawn("/srv/apic");
     276        spawn("/srv/i8259");
    275277        spawn("/srv/fhc");
    276278        spawn("/srv/obio");
  • uspace/lib/c/include/ipc/irc.h

    r3d5e190 r7c34b28f  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
    35 #ifndef LIBC_BUS_H_
    36 #define LIBC_BUS_H_
     35#ifndef LIBC_IRC_H_
     36#define LIBC_IRC_H_
    3737
    3838#include <ipc/ipc.h>
    3939
    4040typedef enum {
    41         BUS_CLEAR_INTERRUPT = IPC_FIRST_USER_METHOD
    42 } bus_request_t;
     41        IRC_ENABLE_INTERRUPT = IPC_FIRST_USER_METHOD,
     42        IRC_CLEAR_INTERRUPT
     43} irc_request_t;
    4344
    4445#endif
  • uspace/lib/c/include/ipc/services.h

    r3d5e190 r7c34b28f  
    4949        SERVICE_FHC,
    5050        SERVICE_OBIO,
     51        SERVICE_APIC,
     52        SERVICE_I8259,
    5153        SERVICE_CLIPBOARD,
    5254        SERVICE_NETWORKING,
  • uspace/lib/net/generic/generic.c

    r3d5e190 r7c34b28f  
    100100int
    101101generic_get_addr_req(int phone, int message, device_id_t device_id,
    102     measured_string_t **address, char ** data)
     102    measured_string_t **address, uint8_t **data)
    103103{
    104104        aid_t message_id;
     
    112112        message_id = async_send_1(phone, (sysarg_t) message,
    113113            (sysarg_t) device_id, NULL);
    114         string = measured_strings_return(phone, address, data, 1);
     114        string = measured_strings_return(phone, address, (char **) data, 1);
    115115        async_wait_for(message_id, &result);
    116116
  • uspace/lib/net/include/generic.h

    r3d5e190 r7c34b28f  
    5050extern int generic_device_req_remote(int, int, device_id_t, int, services_t);
    5151extern int generic_get_addr_req(int, int, device_id_t, measured_string_t **,
    52     char **);
     52    uint8_t **);
    5353extern int generic_packet_size_req_remote(int, int, device_id_t,
    5454    packet_dimension_t *);
  • uspace/lib/net/include/netif_local.h

    r3d5e190 r7c34b28f  
    196196
    197197extern int netif_get_addr_req_local(int, device_id_t, measured_string_t **,
    198     char **);
     198    uint8_t **);
    199199extern int netif_probe_req_local(int, device_id_t, int, int);
    200200extern int netif_send_msg_local(int, device_id_t, packet_t *, services_t);
  • uspace/lib/net/include/netif_remote.h

    r3d5e190 r7c34b28f  
    4242
    4343extern int netif_get_addr_req_remote(int, device_id_t, measured_string_t **,
    44     char **);
     44    uint8_t **);
    4545extern int netif_probe_req_remote(int, device_id_t, int, int);
    4646extern int netif_send_msg_remote(int, device_id_t, packet_t *, services_t);
  • uspace/lib/net/netif/netif_local.c

    r3d5e190 r7c34b28f  
    203203 */
    204204int netif_get_addr_req_local(int netif_phone, device_id_t device_id,
    205     measured_string_t **address, char **data)
     205    measured_string_t **address, uint8_t **data)
    206206{
    207207        int rc;
     
    221221        fibril_rwlock_read_unlock(&netif_globals.lock);
    222222       
    223         *data = (**address).value;
     223        *data = (uint8_t *) (**address).value;
    224224       
    225225        return rc;
  • uspace/lib/net/netif/netif_remote.c

    r3d5e190 r7c34b28f  
    6060 */
    6161int netif_get_addr_req_remote(int netif_phone, device_id_t device_id,
    62     measured_string_t **address, char **data)
     62    measured_string_t **address, uint8_t **data)
    6363{
    6464        return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id,
  • uspace/srv/hid/kbd/port/ns16550.c

    r3d5e190 r7c34b28f  
    3636
    3737#include <ipc/ipc.h>
    38 #include <ipc/bus.h>
     38#include <ipc/irc.h>
    3939#include <async.h>
    4040#include <sysinfo.h>
     
    122122       
    123123        if (cir_service)
    124                 async_msg_1(cir_phone, BUS_CLEAR_INTERRUPT,
     124                async_msg_1(cir_phone, IRC_CLEAR_INTERRUPT,
    125125                    IPC_GET_IMETHOD(*call));
    126126}
  • uspace/srv/hid/kbd/port/z8530.c

    r3d5e190 r7c34b28f  
    3636
    3737#include <ipc/ipc.h>
    38 #include <ipc/bus.h>
     38#include <ipc/irc.h>
    3939#include <async.h>
    4040#include <sysinfo.h>
     
    110110       
    111111        if (cir_service)
    112                 async_msg_1(cir_phone, BUS_CLEAR_INTERRUPT,
     112                async_msg_1(cir_phone, IRC_CLEAR_INTERRUPT,
    113113                    IPC_GET_IMETHOD(*call));
    114114}
  • uspace/srv/hw/irc/fhc/fhc.c

    r3d5e190 r7c34b28f  
    3838#include <ipc/ipc.h>
    3939#include <ipc/services.h>
    40 #include <ipc/bus.h>
     40#include <ipc/irc.h>
    4141#include <ipc/ns.h>
    4242#include <sysinfo.h>
     
    8383                callid = async_get_call(&call);
    8484                switch (IPC_GET_IMETHOD(call)) {
    85                 case BUS_CLEAR_INTERRUPT:
     85                case IRC_ENABLE_INTERRUPT:
     86                        /* Noop */
     87                        ipc_answer_0(callid, EOK);
     88                        break;
     89                case IRC_CLEAR_INTERRUPT:
    8690                        inr = IPC_GET_ARG1(call);
    8791                        switch (inr) {
  • uspace/srv/hw/irc/obio/obio.c

    r3d5e190 r7c34b28f  
    4444#include <ipc/ipc.h>
    4545#include <ipc/services.h>
    46 #include <ipc/bus.h>
     46#include <ipc/irc.h>
    4747#include <ipc/ns.h>
    4848#include <sysinfo.h>
     
    9393                callid = async_get_call(&call);
    9494                switch (IPC_GET_IMETHOD(call)) {
    95                 case BUS_CLEAR_INTERRUPT:
     95                case IRC_ENABLE_INTERRUPT:
     96                        /* Noop */
     97                        ipc_answer_0(callid, EOK);
     98                        break;
     99                case IRC_CLEAR_INTERRUPT:
    96100                        inr = IPC_GET_ARG1(call);
    97101                        base_virt[OBIO_CIR(inr & INO_MASK)] = 0;
  • uspace/srv/hw/netif/dp8390/dp8390.c

    r3d5e190 r7c34b28f  
    263263        printf("Ethernet address ");
    264264        for (i = 0; i < 6; i++)
    265                 printf("%x%c", dep->de_address.ea_addr[i], i < 5 ? ':' : '\n');
     265                printf("%02x%c", dep->de_address.ea_addr[i], i < 5 ? ':' : '\n');
    266266       
    267267        /*
  • uspace/srv/hw/netif/dp8390/dp8390.h

    r3d5e190 r7c34b28f  
    245245#define outb_reg1(dep, reg, data)  (outb(dep->de_dp8390_port + reg, data))
    246246
    247 #define SENDQ_NR     2  /* Maximum size of the send queue */
     247#define SENDQ_NR     1  /* Maximum size of the send queue */
    248248#define SENDQ_PAGES  6  /* 6 * DP_PAGESIZE >= 1514 bytes */
    249249
  • 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}
  • uspace/srv/net/il/arp/arp.c

    r3d5e190 r7c34b28f  
    215215        (*proto)->service = service;
    216216        (*proto)->addr = address;
    217         (*proto)->addr_data = address->value;
     217        (*proto)->addr_data = (uint8_t *) address->value;
    218218       
    219219        rc = arp_addr_initialize(&(*proto)->addresses);
     
    267267                        free(proto->addr_data);
    268268                        proto->addr = address;
    269                         proto->addr_data = address->value;
     269                        proto->addr_data = (uint8_t *) address->value;
    270270                } else {
    271271                        rc = arp_proto_create(&proto, protocol, address);
  • uspace/srv/net/il/arp/arp.h

    r3d5e190 r7c34b28f  
    9696        measured_string_t *addr;
    9797        /** Actual device hardware address data. */
    98         char *addr_data;
     98        uint8_t *addr_data;
    9999        /** Broadcast device hardware address. */
    100100        measured_string_t *broadcast_addr;
    101101        /** Broadcast device hardware address data. */
    102         char *broadcast_data;
     102        uint8_t *broadcast_data;
    103103        /** Device identifier. */
    104104        device_id_t device_id;
     
    142142        measured_string_t *addr;
    143143        /** Actual device protocol address data. */
    144         char *addr_data;
     144        uint8_t *addr_data;
    145145        /** Address map. */
    146146        arp_addr_t addresses;
     
    154154         * Hardware address for the translation. NULL denotes an incomplete
    155155         * record with possible waiters.
    156          */ 
     156         */
    157157        measured_string_t *hw_addr;
    158158        /** Condition variable used for waiting for completion of the record. */
  • uspace/srv/net/nil/eth/eth.c

    r3d5e190 r7c34b28f  
    407407       
    408408        printf("%s: Device registered (id: %d, service: %d: mtu: %zu, "
    409             "mac: %x:%x:%x:%x:%x:%x, flags: 0x%x)\n",
     409            "mac: %02x:%02x:%02x:%02x:%02x:%02x, flags: 0x%x)\n",
    410410            NAME, device->device_id, device->service, device->mtu,
    411411            device->addr_data[0], device->addr_data[1],
  • uspace/srv/net/nil/eth/eth.h

    r3d5e190 r7c34b28f  
    9191        /** Actual device hardware address. */
    9292        measured_string_t *addr;
     93       
    9394        /** Actual device hardware address data. */
    94         char *addr_data;
     95        uint8_t *addr_data;
    9596};
    9697
  • uspace/srv/net/nil/nildummy/nildummy.h

    r3d5e190 r7c34b28f  
    7878        measured_string_t *addr;
    7979        /** Actual device hardware address data. */
    80         char *addr_data;
     80        uint8_t *addr_data;
    8181};
    8282
Note: See TracChangeset for help on using the changeset viewer.