Changeset 88f653a in libbsdport


Ignore:
Timestamp:
Jul 20, 2011, 5:25:21 PM (8 years ago)
Author:
Till Straumann <strauman@…>
Branches:
master
Children:
f552470
Parents:
9d32a19
Message:

2011-07-20 Till Straumann <Till.Straumann@…>

  • if_em/Makefile.am, if_em/e1000_osdep.h, if_em/e1000_osdep.c, if_em/if_em.c: added e1000_osdep.c which implements all os-dependent parts in a bsdnet-agnostic fashion. Hence, the low-level driver can be used w/o bsdnet. FIXES: dependency on bsdnet initialization; PCI bus header was not initialized when not used via bsdnet (lanIpBasic driver crashed).
Location:
bsd_eth_drivers
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • bsd_eth_drivers/ChangeLog

    r9d32a19 r88f653a  
    1 2010-07-23  Till Straumann <Till.Straumann@TU-Berlin.de>
     12011-07-20 Till Straumann <Till.Straumann@TU-Berlin.de>
     2       
     3        * if_em/Makefile.am, if_em/e1000_osdep.h, if_em/e1000_osdep.c,
     4        if_em/if_em.c: added e1000_osdep.c which implements all
     5        os-dependent parts in a bsdnet-agnostic fashion. Hence, the
     6        low-level driver can be used w/o bsdnet.
     7        FIXES: dependency on bsdnet initialization; PCI bus header
     8        was not initialized when not used via bsdnet (lanIpBasic driver
     9        crashed).
     10
     112010-07-23 Till Straumann <Till.Straumann@TU-Berlin.de>
    212
    313        * libbsdport/devicet.c: Initialize libbspExt.
  • bsd_eth_drivers/if_em/Makefile.am

    r9d32a19 r88f653a  
    55
    66libif_em_a_SOURCES               = if_em.c
     7libif_em_a_SOURCES              += e1000_osdep.c
    78libif_em_a_SOURCES              += e1000_80003es2lan.c e1000_82540.c e1000_82541.c
    89libif_em_a_SOURCES              += e1000_82543.c e1000_82571.c e1000_82575.c
     
    1516libif_em_a_SOURCES              += e1000_mac.h e1000_manage.h e1000_nvm.h
    1617libif_em_a_SOURCES              += e1000_osdep.h e1000_phy.h e1000_regs.h if_em.h
     18
     19if_em.$(OBJEXT): AM_SRC_CPPFLAGS=-D_KERNEL
    1720
    1821EXTRA_libif_em_a_SOURCES         = e1000_82542.c e1000_ich8lan.c
     
    3235lib_LIBRARIES                    = libif_em.a
    3336
    34 AM_CPPFLAGS                     += -D_KERNEL
    3537AM_CPPFLAGS                     += -I$(srcdir)
    3638AM_CPPFLAGS                     += -I$(srcdir)/../libbsdport -I../libbsdport  -I../libbsdport/dummyheaders
    3739AM_CPPFLAGS                     += $(CPPFLAGS_82542_SUPPORT_$(ENBL_82542_SUPPORT))
    3840AM_CPPFLAGS                     += $(CPPFLAGS_ICH8LAN_SUPPORT_$(ENBL_ICH8LAN_SUPPORT))
     41AM_CPPFLAGS                     += $(AM_SRC_CPPFLAGS)
    3942
    4043include $(top_srcdir)/rtems.am
  • bsd_eth_drivers/if_em/e1000_osdep.h

    r9d32a19 r88f653a  
    4242#include <vm/vm.h> /* for non-_KERNEL boolean_t :-( */
    4343
    44 #ifdef   _KERNEL
    45 #ifndef __INSIDE_RTEMS_BSD_TCPIP_STACK__
    46 #define __INSIDE_RTEMS_BSD_TCPIP_STACK__
    47 #endif
    48 #include <rtems/rtems_bsdnet.h>
    49 #include <rtems/rtems_bsdnet_internal.h>
    50 
    51 #include <sys/types.h>
    52 #include <sys/param.h>
    53 #include <sys/systm.h>
    54 #include <sys/mbuf.h>
    55 #include <sys/protosw.h>
    56 #include <sys/socket.h>
    57 #include <sys/malloc.h>
    58 #include <sys/kernel.h>
    59 #include <sys/bus.h>
    60 
    61 #define ASSERT(x) if(!(x)) panic("EM: x")
    62 
    6344/* The happy-fun DELAY macro is defined in /usr/src/sys/i386/include/clock.h */
    64 #define usec_delay(x) DELAY(x)
    65 #define msec_delay(x) DELAY(1000*(x))
     45#define usec_delay(x) e1000_udelay(x)
     46#define msec_delay(x) e1000_udelay(1000*(x))
    6647/* TODO: Should we be paranoid about delaying in interrupt context? */
    67 #define msec_delay_irq(x) DELAY(1000*(x))
    68 #include <rtems_udelay.h>
     48#define msec_delay_irq(x) msec_delay(x)
     49
     50void e1000_udelay(unsigned);
    6951
    7052#define MSGOUT(S, A, B)     printf(S "\n", A, B)
     
    7658        #define DEBUGOUT7(S,A,B,C,D,E,F,G)
    7759
    78 #include <devicet.h>
    79 
    80 struct e1000_osdep
    81 {
    82         uint32_t mem_bus_space_handle;
    83         uint32_t io_bus_space_handle;
    84         uint32_t flash_bus_space_handle;
    85         /* these are currently unused; present for freebsd compatibility only */
    86         uint32_t mem_bus_space_tag;
    87         uint32_t io_bus_space_tag;
    88         uint32_t flash_bus_space_tag;
    89         device_t dev;   
    90 };
    9160
    9261#define STATIC                          static
    93 #endif
    9462
    9563#ifndef FALSE
     
    11987typedef volatile uint16_t __uint16_va_t __attribute__((may_alias));
    12088
     89struct e1000_pcisig {
     90        uint16_t bus;
     91        uint8_t  dev;
     92        uint8_t  fun;
     93};
     94
    12195#ifdef NO_82542_SUPPORT
    12296#define E1000_REGISTER(hw, reg) reg
     
    219193#endif
    220194
     195#if defined(USE_LIBBSDPORT_IO) && !defined(_KERNEL)
     196#define _KERNEL
     197#endif
     198
     199#ifdef   _KERNEL
     200#ifndef __INSIDE_RTEMS_BSD_TCPIP_STACK__
     201#define __INSIDE_RTEMS_BSD_TCPIP_STACK__
     202#endif
     203#include <rtems/rtems_bsdnet.h>
     204#include <rtems/rtems_bsdnet_internal.h>
     205
     206#include <sys/types.h>
     207#include <sys/param.h>
     208#include <sys/systm.h>
     209#include <sys/mbuf.h>
     210#include <sys/protosw.h>
     211#include <sys/socket.h>
     212#include <sys/malloc.h>
     213#include <sys/kernel.h>
     214#include <sys/bus.h>
     215
     216#define ASSERT(x) if(!(x)) panic("EM: x")
     217
     218#include <devicet.h>
     219
     220struct e1000_osdep
     221{
     222        /* struct e1000_pcisig MUST be first since
     223         * 'back' pointer is cast to (struct e1000_pcisig *)
     224         * in e1000_osdep.c!
     225         */
     226        struct e1000_pcisig pcisig;
     227        uint32_t mem_bus_space_handle;
     228        uint32_t io_bus_space_handle;
     229        uint32_t flash_bus_space_handle;
     230        /* these are currently unused; present for freebsd compatibility only */
     231        uint32_t mem_bus_space_tag;
     232        uint32_t io_bus_space_tag;
     233        uint32_t flash_bus_space_tag;
     234        device_t dev;   
     235};
     236#endif
     237
    221238#ifdef USE_LIBBSDPORT_IO
    222239
  • bsd_eth_drivers/if_em/if_em.c

    r9d32a19 r88f653a  
    441441
    442442        INIT_DEBUGOUT("em_probe: begin");
     443
     444#ifdef __rtems__
     445        /* copy PCI signature to the low-level (bsd-agnostic) support
     446         * struct.
     447         */
     448        {
     449        struct adapter *adapter = device_get_softc(dev);
     450                adapter->osdep.pcisig.bus = dev->bushdr.pci.bus;
     451                adapter->osdep.pcisig.dev = dev->bushdr.pci.dev;
     452                adapter->osdep.pcisig.fun = dev->bushdr.pci.fun;
     453        }
     454#endif
    443455
    444456        pci_vendor_id = pci_get_vendor(dev);
     
    47834795}
    47844796
     4797#ifndef __rtems__
    47854798/*
    47864799 * NOTE: the following routines using the e1000
     
    48654878        return;
    48664879}
     4880#endif
    48674881
    48684882/*
Note: See TracChangeset for help on using the changeset viewer.