summaryrefslogtreecommitdiffstats
path: root/bsd_eth_drivers/libbsdport
diff options
context:
space:
mode:
Diffstat (limited to 'bsd_eth_drivers/libbsdport')
-rw-r--r--bsd_eth_drivers/libbsdport/.cvsignore1
-rw-r--r--bsd_eth_drivers/libbsdport/Makefile.am27
-rw-r--r--bsd_eth_drivers/libbsdport/Makefile.in616
-rw-r--r--bsd_eth_drivers/libbsdport/alldrv.c30
-rw-r--r--bsd_eth_drivers/libbsdport/bus.h121
-rw-r--r--bsd_eth_drivers/libbsdport/callout.h44
-rw-r--r--bsd_eth_drivers/libbsdport/devicet.c73
-rw-r--r--bsd_eth_drivers/libbsdport/ifmedia.c10
-rw-r--r--bsd_eth_drivers/libbsdport/libbsdport.h50
-rw-r--r--bsd_eth_drivers/libbsdport/libbsdport_api.h16
-rw-r--r--bsd_eth_drivers/libbsdport/libbsdport_post.h35
-rw-r--r--bsd_eth_drivers/libbsdport/miistuff.c58
-rw-r--r--bsd_eth_drivers/libbsdport/misc.c179
-rw-r--r--bsd_eth_drivers/libbsdport/mutex.h3
-rw-r--r--bsd_eth_drivers/libbsdport/rtems_callout.c31
-rw-r--r--bsd_eth_drivers/libbsdport/sysbus.c60
-rw-r--r--bsd_eth_drivers/libbsdport/taskqueue.h2
17 files changed, 664 insertions, 692 deletions
diff --git a/bsd_eth_drivers/libbsdport/.cvsignore b/bsd_eth_drivers/libbsdport/.cvsignore
new file mode 100644
index 0000000..70845e0
--- /dev/null
+++ b/bsd_eth_drivers/libbsdport/.cvsignore
@@ -0,0 +1 @@
+Makefile.in
diff --git a/bsd_eth_drivers/libbsdport/Makefile.am b/bsd_eth_drivers/libbsdport/Makefile.am
index e6e31cd..06c70c8 100644
--- a/bsd_eth_drivers/libbsdport/Makefile.am
+++ b/bsd_eth_drivers/libbsdport/Makefile.am
@@ -5,7 +5,7 @@ include $(top_srcdir)/rtems-pre.am
libbsdport_a_SOURCES = rtems_callout.c rtems_taskqueue.c rtems_udelay.c
libbsdport_a_SOURCES += ifstuff.c devicet.c alldrv.c contigmalloc.c
-libbsdport_a_SOURCES += sysbus.c malloc.c ifmedia.c
+libbsdport_a_SOURCES += sysbus.c malloc.c ifmedia.c misc.c miistuff.c
libbsdport_a_SOURCES += rtems_verscheck.h bus.h callout.h devicet.h
libbsdport_a_SOURCES += libbsdport.h libbsdport_post.h mutex.h
@@ -38,6 +38,9 @@ DUMMYHEADERS+=dummyheaders/netinet/ip6.h
DUMMYHEADERS+=dummyheaders/vm/pmap.h
DUMMYHEADERS+=dummyheaders/miibus_if.h
+DUMMYHEADERS+=dummyheaders/miidevs.h
+DUMMYHEADERS+=dummyheaders/dev/mii/brgphyreg.h
+
BUILT_SOURCES=
include ../links.am
@@ -48,25 +51,3 @@ include ../links.am
# after OBJECTS are made :-(
$(libbsdport_a_OBJECTS): $(DUMMYHEADERS) $(LINKS)
-if FALSE
-CLOBBER_ADDITIONS =
-CLOBBER_ADDITIONS += $(srcdir)/dummyheaders
-CLOBBER_ADDITIONS += $(addprefix $(srcdir)/,$(sort $(foreach n,$(LINKS),$(firstword $(subst /, ,$(n))))))
-
-dummyheaders/%:
- @if [ ! -d $(srcdir)/`dirname $@` ] ; then mkdir -p $(srcdir)/`dirname $@`; fi
- @touch $(srcdir)/$@
-
-# for each name listed in LINKS, create parent directories (if needed)
-# and a symlink to file in .
-# E.g., LINKS=a/b/c.h
-# creates a/b/c.h -> ../../c.h
-$(LINKS):
- @if [ ! -d $(srcdir)/$(dir $@) ] ; then mkdir -p $(srcdir)/$(dir $@); fi
- @ln -s `echo $@ | sed -e 's%[^/]\+[/]\+%../%g'` $(srcdir)/$@
-
-
-distclean-local:
- $(RM) -r $(CLOBBER_ADDITIONS)
-endif
-
diff --git a/bsd_eth_drivers/libbsdport/Makefile.in b/bsd_eth_drivers/libbsdport/Makefile.in
deleted file mode 100644
index 5846327..0000000
--- a/bsd_eth_drivers/libbsdport/Makefile.in
+++ /dev/null
@@ -1,616 +0,0 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-DIST_COMMON = README $(include_bsp_HEADERS) $(srcdir)/../links.am \
- $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/rtems-pre.am $(top_srcdir)/rtems.am
-# CC += @rtems_gccspecs@
-# AM_CFLAGS += @rtems_cpu_cflags@
-# CXX += @rtems_gccspecs@
-# AM_CXXFLAGS += @rtems_cpu_cflags@
-# CCAS += @rtems_gccspecs@
-# AM_CCASFLAGS += @rtems_cpu_asflags@
-# CPP += @rtems_gccspecs@
-# AM_CPPFLAGS += @rtems_cppflags@
-@OS_IS_RTEMS_TRUE@am__append_1 = -I$(top_builddir)/data/include
-@OS_IS_RTEMS_TRUE@am__append_2 = -L$(top_builddir)/data/lib
-subdir = bsd_eth_drivers/libbsdport
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/config-if-present.m4 \
- $(top_srcdir)/m4/rtems-bsplist.m4 \
- $(top_srcdir)/m4/rtems-check-libargs.m4 \
- $(top_srcdir)/m4/rtems-checkprog.m4 \
- $(top_srcdir)/m4/rtems-checktool.m4 \
- $(top_srcdir)/m4/rtems-checktop.m4 \
- $(top_srcdir)/m4/rtems-fixup-prefix.m4 \
- $(top_srcdir)/m4/rtems-isrtems.m4 \
- $(top_srcdir)/m4/rtems-makevars.m4 \
- $(top_srcdir)/m4/rtems-options.m4 \
- $(top_srcdir)/m4/rtems-setup-recurse.m4 \
- $(top_srcdir)/m4/rtems-tools.m4 \
- $(top_srcdir)/m4/rtems-trim-builddir.m4 \
- $(top_srcdir)/m4/rtems-verscheck.m4 \
- $(top_srcdir)/./m4/cvstag.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(include_bspdir)"
-libLIBRARIES_INSTALL = $(INSTALL_DATA)
-LIBRARIES = $(lib_LIBRARIES)
-ARFLAGS = cru
-libbsdport_a_AR = $(AR) $(ARFLAGS)
-libbsdport_a_LIBADD =
-am_libbsdport_a_OBJECTS = rtems_callout.$(OBJEXT) \
- rtems_taskqueue.$(OBJEXT) rtems_udelay.$(OBJEXT) \
- ifstuff.$(OBJEXT) devicet.$(OBJEXT) alldrv.$(OBJEXT) \
- contigmalloc.$(OBJEXT) sysbus.$(OBJEXT) malloc.$(OBJEXT) \
- ifmedia.$(OBJEXT)
-libbsdport_a_OBJECTS = $(am_libbsdport_a_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libbsdport_a_SOURCES)
-DIST_SOURCES = $(libbsdport_a_SOURCES)
-include_bspHEADERS_INSTALL = $(INSTALL_HEADER)
-HEADERS = $(include_bsp_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-APPEXEEXT = @APPEXEEXT@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCAS = @CCAS@
-CCASDEPMODE = @CCASDEPMODE@
-CCASFLAGS = @CCASFLAGS@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DOWNEXT = @DOWNEXT@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-ENBL_82542_SUPPORT = @ENBL_82542_SUPPORT@
-ENBL_ICH8LAN_SUPPORT = @ENBL_ICH8LAN_SUPPORT@
-EXEEXT = @EXEEXT@
-GCC = @GCC@
-HOSTCC = @HOSTCC@
-HOSTPROGRAM = @HOSTPROGRAM@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_IF_CHANGE = @INSTALL_IF_CHANGE@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-NFSLIB = @NFSLIB@
-OBJCOPY = @OBJCOPY@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-RTEMS_BSP_FAMILY = @RTEMS_BSP_FAMILY@
-RTEMS_BSP_INSTTOP = @RTEMS_BSP_INSTTOP@
-RTEMS_TILL_MAKEVARS_SET = @RTEMS_TILL_MAKEVARS_SET@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-all_subdirs = @all_subdirs@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-enable_subdirs = @enable_subdirs@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-hostbindir = @hostbindir@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-installexechostbinprogs = @installexechostbinprogs@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-rtems_bsp = @rtems_bsp@
-rtems_cpu = @rtems_cpu@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-subdirs = @subdirs@
-sysconfdir = @sysconfdir@
-system_subdir = @system_subdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
-the_distsub = @the_distsub@
-the_subdirs = @the_subdirs@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-
-# $Id$
-AUTOMAKE_OPTIONS = foreign
-AM_CPPFLAGS = -Wall $(am__append_1)
-AM_CFLAGS = -Wall
-AM_CXXFLAGS = -Wall
-AM_CCASFLAGS =
-AM_LDFLAGS = $(am__append_2)
-libbsdport_a_SOURCES = rtems_callout.c rtems_taskqueue.c \
- rtems_udelay.c ifstuff.c devicet.c alldrv.c contigmalloc.c \
- sysbus.c malloc.c ifmedia.c rtems_verscheck.h bus.h callout.h \
- devicet.h libbsdport.h libbsdport_post.h mutex.h \
- rtems_udelay.h rtems_verscheck.h taskqueue.h
-include_bsp_HEADERS = libbsdport_api.h
-lib_LIBRARIES = libbsdport.a
-@OS_IS_RTEMS_TRUE@RTEMS_BSP = @rtems_bsp@
-OBJLINK = $(CCLD) -nostdlib -Wl,-r -o $@
-OBJEXEEXT = .obj
-
-# Where tools that run on the host go
-#FIXME: where to put these?
-exechostbindir = $(hostbindir)
-include_bspdir = $(includedir)/bsp
-include_sysdir = $(includedir)/sys
-LINKS = sys/taskqueue.h sys/bus.h sys/mutex.h bsp/rtems_verscheck.h
-DUMMYHEADERS = dummyheaders/machine/bus.h \
- dummyheaders/machine/resource.h dummyheaders/dev/pci/pcivar.h \
- dummyheaders/dev/pci/pcireg.h dummyheaders/dev/mii/miivar.h \
- dummyheaders/sys/module.h dummyheaders/sys/rman.h \
- dummyheaders/sys/kthread.h dummyheaders/sys/endian.h \
- dummyheaders/net/if_vlan_var.h dummyheaders/netinet/ip6.h \
- dummyheaders/vm/pmap.h dummyheaders/miibus_if.h
-BUILT_SOURCES = $(DUMMYHEADERS) $(LINKS)
-CLOBBER_ADDITIONS = $(LINKS) $(DUMMYHEADERS)
-all: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rtems-pre.am $(top_srcdir)/rtems.am $(srcdir)/../links.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bsd_eth_drivers/libbsdport/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign bsd_eth_drivers/libbsdport/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-libLIBRARIES: $(lib_LIBRARIES)
- @$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
- @list='$(lib_LIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- f=$(am__strip_dir) \
- echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
- $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
- else :; fi; \
- done
- @$(POST_INSTALL)
- @list='$(lib_LIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- p=$(am__strip_dir) \
- echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
- $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
- else :; fi; \
- done
-
-uninstall-libLIBRARIES:
- @$(NORMAL_UNINSTALL)
- @list='$(lib_LIBRARIES)'; for p in $$list; do \
- p=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
- rm -f "$(DESTDIR)$(libdir)/$$p"; \
- done
-
-clean-libLIBRARIES:
- -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
-libbsdport.a: $(libbsdport_a_OBJECTS) $(libbsdport_a_DEPENDENCIES)
- -rm -f libbsdport.a
- $(libbsdport_a_AR) libbsdport.a $(libbsdport_a_OBJECTS) $(libbsdport_a_LIBADD)
- $(RANLIB) libbsdport.a
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alldrv.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/contigmalloc.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/devicet.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifmedia.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifstuff.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtems_callout.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtems_taskqueue.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtems_udelay.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysbus.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-install-include_bspHEADERS: $(include_bsp_HEADERS)
- @$(NORMAL_INSTALL)
- test -z "$(include_bspdir)" || $(MKDIR_P) "$(DESTDIR)$(include_bspdir)"
- @list='$(include_bsp_HEADERS)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
- echo " $(include_bspHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(include_bspdir)/$$f'"; \
- $(include_bspHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(include_bspdir)/$$f"; \
- done
-
-uninstall-include_bspHEADERS:
- @$(NORMAL_UNINSTALL)
- @list='$(include_bsp_HEADERS)'; for p in $$list; do \
- f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(include_bspdir)/$$f'"; \
- rm -f "$(DESTDIR)$(include_bspdir)/$$f"; \
- done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
-installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(include_bspdir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
- -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-clean: clean-am
-
-clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-local distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am: install-include_bspHEADERS
-
-install-dvi: install-dvi-am
-
-install-exec-am: install-libLIBRARIES
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-include_bspHEADERS uninstall-libLIBRARIES
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libLIBRARIES ctags distclean distclean-compile \
- distclean-generic distclean-local distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-include_bspHEADERS install-info install-info-am \
- install-libLIBRARIES install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
- uninstall-am uninstall-include_bspHEADERS \
- uninstall-libLIBRARIES
-
-
-preinstall:INSTALL=$(INSTALL_IF_CHANGE)
-preinstall:exec_prefix=$(prefix)
-preinstall:includedir=$(prefix)/include
-preinstall:prefix=$(abs_top_builddir)/data
-preinstall:install-data install-exec
-
-# a rule to link native programs
-#
-$(HOSTPROG)$(HOSTEXEEXT): $($(HOSTPROG)_OBJECTS) $($(HOSTPROG)_DEPENDENCIES)
- $(HOSTCC) -o $@ $($(HOSTPROG)_OBJECTS) $($(HOSTPROG)_LDADD)
-
-# another hack; if we just enter the install-exechostbinPROGRAMS:
-# target on the left then automake will not emit a rule for installation
-# :-(.
-# As a work-around we let 'configure' fill this in...
-@installexechostbinprogs@:EXEEXT=$(HOSTEXEEXT)
-
-$(DUMMYHEADERS):
- @if [ ! -d `dirname $@` ] ; then mkdir -p `dirname $@`; fi
- @touch $@
-
-$(LINKS):
- @if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@); fi
- @ln -s `echo $(dir $@) | sed -e 's%[^/]\+[/]\+%../%g'`$(srcdir)/$(notdir $@) $@
-
-distclean-local:
- $(RM) -r $(CLOBBER_ADDITIONS)
-
-#
-# I found no good way to have something made first thing.
-# all-local is made after 'all' and xxx_DEPENDENCIES are
-# after OBJECTS are made :-(
-$(libbsdport_a_OBJECTS): $(DUMMYHEADERS) $(LINKS)
-
-#dummyheaders/%:
-# @if [ ! -d $(srcdir)/`dirname $@` ] ; then mkdir -p $(srcdir)/`dirname $@`; fi
-# @touch $(srcdir)/$@
-
-# for each name listed in LINKS, create parent directories (if needed)
-# and a symlink to file in .
-# E.g., LINKS=a/b/c.h
-# creates a/b/c.h -> ../../c.h
-#$(LINKS):
-# @if [ ! -d $(srcdir)/$(dir $@) ] ; then mkdir -p $(srcdir)/$(dir $@); fi
-# @ln -s `echo $@ | sed -e 's%[^/]\+[/]\+%../%g'` $(srcdir)/$@
-
-#distclean-local:
-# $(RM) -r $(CLOBBER_ADDITIONS)
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/bsd_eth_drivers/libbsdport/alldrv.c b/bsd_eth_drivers/libbsdport/alldrv.c
index f81b95a..c68d6d1 100644
--- a/bsd_eth_drivers/libbsdport/alldrv.c
+++ b/bsd_eth_drivers/libbsdport/alldrv.c
@@ -1,14 +1,42 @@
#include <stdio.h>
#include "libbsdport_api.h"
+#include "devicet.h"
driver_t *libbsdport_netdriver_table_all[] = {
&libbsdport_em_driver,
&libbsdport_pcn_driver,
&libbsdport_le_pci_driver,
+ &libbsdport_fxp_driver,
+ &libbsdport_bge_driver,
+ &libbsdport_re_driver,
+ &libbsdport_rl_driver,
0
};
-/* weak alias defaults to a table that includes all currently supported drivers */
+driver_t libbsdport_null_driver = {0};
+
+extern driver_t libbsdport_em_driver
+ __attribute__((weak,alias("libbsdport_null_driver")));
+extern driver_t libbsdport_pcn_driver
+ __attribute__((weak,alias("libbsdport_null_driver")));
+extern driver_t libbsdport_le_pci_driver
+ __attribute__((weak,alias("libbsdport_null_driver")));
+extern driver_t libbsdport_fxp_driver
+ __attribute__((weak,alias("libbsdport_null_driver")));
+extern driver_t libbsdport_bge_driver
+ __attribute__((weak,alias("libbsdport_null_driver")));
+extern driver_t libbsdport_re_driver
+ __attribute__((weak,alias("libbsdport_null_driver")));
+extern driver_t libbsdport_rl_driver
+ __attribute__((weak,alias("libbsdport_null_driver")));
+
+
+/* weak alias defaults to a table that includes
+ * all currently supported drivers.
+ *
+ * However, the individual entires are weak aliases
+ * themselves so that you don't have to link all drivers...
+ */
extern driver_t *libbsdport_netdriver_table
[
sizeof(libbsdport_netdriver_table_all)/sizeof(libbsdport_netdriver_table_all[0])
diff --git a/bsd_eth_drivers/libbsdport/bus.h b/bsd_eth_drivers/libbsdport/bus.h
index 19cb24f..e4a9d29 100644
--- a/bsd_eth_drivers/libbsdport/bus.h
+++ b/bsd_eth_drivers/libbsdport/bus.h
@@ -17,6 +17,12 @@ typedef enum {
struct resource;
+struct resource_spec {
+ int type;
+ int rid;
+ int flags;
+};
+
typedef bus_addr_t bus_space_handle_t;
/* The 'bus_space_xxx()' inlines can be helped if the
@@ -59,7 +65,6 @@ bus_space_write_##nwidth(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
*(volatile type __attribute__((may_alias)) *)(h+o) = v; \
}\
}
-
BUS_SPACE_DECL(u_int32_t, long, 4)
BUS_SPACE_DECL(u_int16_t, word, 2)
BUS_SPACE_DECL(u_int8_t, byte, 1)
@@ -115,6 +120,8 @@ BUS_SPACE_DECL(u_int8_t, byte, 1, 8)
#error "Missing definitions of bus_space_XXX() for this CPU architecture"
#endif
+#define bus_space_write_stream_4(_t, _h, _o, _v) \
+ bus_space_write_4(_t, _h, _o, htole32(_v))
#undef BUS_SPACE_DECL
@@ -140,10 +147,17 @@ BUS_SPACE_DECL(u_int8_t, byte, 1, 8)
/* flags (1<<31) means unsupported */
#define RF_ACTIVE (1<<1)
#define RF_SHAREABLE (1<<2)
+#define RF_OPTIONAL (1<<3)
struct resource *
bus_alloc_resource_any(device_t dev, int type, int *prid, unsigned flags);
+int
+bus_alloc_resources(device_t dev, struct resource_spec *rs, struct resource **res);
+
+void
+bus_release_resources(device_t dev, const struct resource_spec *rs, struct resource **res);
+
#define FILTER_STRAY 1
#define FILTER_HANDLED 0
@@ -157,6 +171,29 @@ bus_setup_intr(device_t dev, struct resource *r, int flags, driver_filter_t filt
#define INTR_MPSAFE 0
#define INTR_TYPE_NET 0
+/*
+ * INTR_FAST handlers are already more like 'filters',
+ * i.e., they disable interrupts and schedule work
+ * on a task queue.
+ *
+ * During porting the fast handler has to be slightly
+ * rewritten (must return an int value, FILTER_HANDLED
+ * if a valid IRQ was detected and work has been scheduled
+ * and FILTER_STRAY if this device didn't interrupt).
+ *
+ * You need to then remove INTR_FAST from the flags,
+ * pass the converted handler as the 'filter' argument
+ * and a NULL handler argument to bus_setup_intr().
+ *
+ */
+extern int __INTR_FAST() __attribute__((
+ error("\n\n==> you need to convert bus_setup_intr(INTR_FAST) to new API;\n"
+ " consult <sys/bus.h>\n\n")
+));
+
+/* Barf at compile time if they try to use INTR_FAST */
+#define INTR_FAST (__INTR_FAST())
+
int
bus_teardown_intr(device_t dev, struct resource *r, void *cookiep);
@@ -177,6 +214,37 @@ rman_get_bushandle(struct resource *r);
bus_space_tag_t
rman_get_bustag(struct resource *r);
+/* Newer API (releng 7_1) */
+static inline u_int8_t bus_read_1(struct resource *r, bus_size_t o)
+{
+ return bus_space_read_1(rman_get_bustag(r), rman_get_bushandle(r), o);
+}
+
+static inline u_int16_t bus_read_2(struct resource *r, bus_size_t o)
+{
+ return bus_space_read_2(rman_get_bustag(r), rman_get_bushandle(r), o);
+}
+
+static inline u_int32_t bus_read_4(struct resource *r, bus_size_t o)
+{
+ return bus_space_read_4(rman_get_bustag(r), rman_get_bushandle(r), o);
+}
+
+static inline void bus_write_1(struct resource *r, bus_size_t o, u_int8_t v)
+{
+ bus_space_write_1(rman_get_bustag(r), rman_get_bushandle(r), o, v);
+}
+
+static inline void bus_write_2(struct resource *r, bus_size_t o, u_int16_t v)
+{
+ bus_space_write_2(rman_get_bustag(r), rman_get_bushandle(r), o, v);
+}
+
+static inline void bus_write_4(struct resource *r, bus_size_t o, u_int32_t v)
+{
+ bus_space_write_4(rman_get_bustag(r), rman_get_bushandle(r), o, v);
+}
+
#ifndef BUS_DMA_NOWAIT
/* ignored anyways */
#define BUS_DMA_NOWAIT 0
@@ -192,6 +260,20 @@ rman_get_bustag(struct resource *r);
#define BUS_DMA_COHERENT 0
#endif
+#ifndef BUS_DMA_ZERO
+/* ignored anyways */
+#define BUS_DMA_ZERO 0
+#endif
+
+#ifndef BUS_DMA_ALLOCNOW
+/* ignored anyways */
+#define BUS_DMA_ALLOCNOW 0
+#endif
+
+#ifndef BUS_DMA_ZERO
+#define BUS_DMA_ZERO 1
+#endif
+
/* unused */
#ifndef BUS_SPACE_MAXADDR
#define BUS_SPACE_MAXADDR 0xdeadbeef
@@ -223,6 +305,12 @@ typedef void *bus_dmamap_t;
int
bus_dma_tag_create(void *parent, unsigned alignment, unsigned bounds, uint32_t lowadd, uint32_t hiaddr, void (*filter)(void*), void *filterarg, unsigned maxsize, int nsegs, unsigned maxsegsize, unsigned flags, void (*lockfunc)(void*), void *lockarg, bus_dma_tag_t *ptag);
+/* Dummy NULL fcn pointer */
+#define busdma_lock_mutex 0
+
+extern uint32_t __busdma_dummy_Giant;
+#define Giant __busdma_dummy_Giant
+
void
bus_dma_tag_destroy(bus_dma_tag_t tag);
@@ -265,10 +353,10 @@ bus_get_dma_tag(device_t dev)
return 0;
}
-typedef void bus_dmamap_callback_t (void *, bus_dma_segment_t *, int, int);
+typedef void bus_dmamap_callback_t (void *arg, bus_dma_segment_t *segs, int nseg, int error);
static inline int
-bus_dmamap_load(bus_dma_tag_t tag, bus_dmamap_t map, caddr_t vaddr, bus_size_t size, void (*cb)(void *arg, bus_dma_segment_t *segs, int nseg, int error), void *arg, unsigned flags)
+bus_dmamap_load(bus_dma_tag_t tag, bus_dmamap_t map, void *vaddr, bus_size_t size, bus_dmamap_callback_t cb, void *arg, unsigned flags)
{
bus_dma_segment_t segs[1];
segs[0].ds_addr = CPU2BUSADDR(vaddr);
@@ -277,6 +365,28 @@ bus_dma_segment_t segs[1];
return 0;
}
+typedef void bus_dmamap_callback2_t (void *arg, bus_dma_segment_t *segs, int nsegs, bus_size_t mapsize, int error);
+
+static inline int
+bus_dmamap_load_mbuf(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m_head, bus_dmamap_callback2_t cb, void *arg, unsigned flags)
+{
+/* hopefully there's enough stack ... */
+bus_dma_segment_t segs[tag->maxsegs];
+struct mbuf *m;
+int n;
+bus_size_t sz;
+ for ( m=m_head, sz=0, n=0; m; m=m->m_next, n++ ) {
+ if ( n >= tag->maxsegs ) {
+ cb(arg, segs, n, sz, EFBIG);
+ return EFBIG;
+ }
+ segs[n].ds_addr = CPU2BUSADDR(mtod(m, unsigned));
+ sz += (segs[n].ds_len = m->m_len);
+ }
+ cb(arg, segs, n, sz, 0);
+ return 0;
+}
+
#define bus_dmamap_unload(tag, map) do {} while (0)
/* should we do something if we have no HW snooping ? */
@@ -285,4 +395,9 @@ bus_dma_segment_t segs[1];
#define bus_dmamap_create(tag, flags, pmap) ( *(pmap) = 0, 0 )
#define bus_dmamap_destroy(tag, map) do {} while (0)
+int
+resource_int_value(const char *name, int unit, const char *resname, int *result);
+int
+resource_long_value(const char *name, int unit, const char *resname, long *result);
+
#endif
diff --git a/bsd_eth_drivers/libbsdport/callout.h b/bsd_eth_drivers/libbsdport/callout.h
index 3f586bf..acc9de0 100644
--- a/bsd_eth_drivers/libbsdport/callout.h
+++ b/bsd_eth_drivers/libbsdport/callout.h
@@ -18,16 +18,56 @@ struct callout {
void *c_arg;
struct mtx *c_mtx;
callout_time_t c_time;
+ unsigned c_flags;
};
+#define CALLOUT_PENDING (1<<0)
+#define CALLOUT_ACTIVE (1<<1)
+
+/*
+ * Strictly, we don't need any protection
+ * because the global network semaphore
+ * takes care; however we want to
+ */
+static inline int
+callout_active(struct callout *p_c)
+{
+int rval;
+rtems_interrupt_level l;
+ rtems_interrupt_disable(l);
+ rval = p_c->c_flags & CALLOUT_ACTIVE;
+ rtems_interrupt_enable(l);
+ return rval;
+}
+
+static inline int
+callout_pending(struct callout *p_c)
+{
+int rval;
+rtems_interrupt_level l;
+ rtems_interrupt_disable(l);
+ rval = p_c->c_flags & CALLOUT_PENDING;
+ rtems_interrupt_enable(l);
+ return rval;
+}
+
+static inline void
+callout_decativate(struct callout *p_c)
+{
+rtems_interrupt_level l;
+ rtems_interrupt_disable(l);
+ p_c->c_flags &= ~CALLOUT_ACTIVE;
+ rtems_interrupt_enable(l);
+}
+
/* We cannot stop a callout that's in progress */
-void
+int
callout_stop(struct callout *c);
#define callout_drain callout_stop
-void
+int
callout_reset(struct callout *c, int ticks, void (*fn)(void*), void *arg);
void
diff --git a/bsd_eth_drivers/libbsdport/devicet.c b/bsd_eth_drivers/libbsdport/devicet.c
index f197da4..fde3975 100644
--- a/bsd_eth_drivers/libbsdport/devicet.c
+++ b/bsd_eth_drivers/libbsdport/devicet.c
@@ -12,7 +12,8 @@
#include <sys/bus.h>
#include "libbsdport_api.h"
-#undef DEBUG
+#define DEBUG 0
+int libbsdportAttachVerbose = DEBUG;
extern void real_libc_free(void*);
@@ -65,11 +66,11 @@ devattach(device_t dev, int unit, struct rtems_bsdnet_ifconfig *cfg)
{
int error;
-#ifdef DEBUG
- printf("Now attaching %s%d: (0x%x:%x.%x)\n",
- dev->name, unit,
- dev->bushdr.pci.bus, dev->bushdr.pci.dev, dev->bushdr.pci.fun);
-#endif
+ if ( libbsdportAttachVerbose ) {
+ printf("Now attaching %s%d: (0x%x:%x.%x)\n",
+ dev->name, unit,
+ dev->bushdr.pci.bus, dev->bushdr.pci.dev, dev->bushdr.pci.fun);
+ }
dev->unit = unit;
dev->ifconfig = cfg;
@@ -247,6 +248,8 @@ device_t tmpdev;
int error = 0;
int bdfunit;
+int n_bus;
+
if ( !attaching )
return ENOTSUP;
@@ -256,20 +259,33 @@ int bdfunit;
wantedunit |= 1<<31;
nm[0]=0;
}
-#ifdef DEBUG
- printf("Wanted unit is 0x%x, pattern '%s'\n", wantedunit, nm);
+ if ( libbsdportAttachVerbose )
+ printf("Wanted unit is 0x%x, pattern '%s'\n", wantedunit, nm);
+
+ n_bus = pci_bus_count();
+#ifdef __i386__
+ /* ugliest of all hacks -- RTEMS routine is currently (4.9)
+ * still broken; it reports the (0-based) highest bus number
+ * instead of the count.
+ */
+ n_bus++;
#endif
unit = 0;
for ( i=0; (dr=libbsdport_netdriver_table[i]); i++ ) {
+
+ /* unused slot ? */
+ if ( 0 == dr->name && 0 == dr->methods )
+ continue;
+
/* Find matching driver */
-#ifdef DEBUG
- printf("Trying driver '%s' ...", dr->name);
-#endif
+ if ( libbsdportAttachVerbose )
+ printf("Trying driver '%s' ...", dr->name);
+
if ( matches(dr, nm) ) {
-#ifdef DEBUG
- printf("MATCH\n");
-#endif
+
+ if ( libbsdportAttachVerbose )
+ printf("MATCH\n");
assert( dr->methods );
@@ -281,7 +297,7 @@ int bdfunit;
}
dev = devalloc(dr);
- for ( b=0; b<pci_bus_count(); b++)
+ for ( b=0; b<n_bus; b++ )
for ( d=0; d<PCI_MAX_DEVICES; d++ ) {
for ( f=0; f<pci_num_functions(b,d); f++ ) {
if ( ! pci_is_ether(b,d,f) )
@@ -293,10 +309,10 @@ int bdfunit;
bdfunit = (b<<8) | PCI_DEVFN(d,f);
-#ifdef DEBUG
- printf("Probing PCI 0x%x:%x.%x\n",
- bdfunit>>8, PCI_SLOT(bdfunit), PCI_FUNC(bdfunit));
-#endif
+ if ( libbsdportAttachVerbose ) {
+ printf("Probing PCI 0x%x:%x.%x\n",
+ bdfunit>>8, PCI_SLOT(bdfunit), PCI_FUNC(bdfunit));
+ }
/* has this device been attached already ? */
if ( (tmpdev = devattached(dev)) ) {
@@ -319,9 +335,9 @@ int bdfunit;
/* wanted unit == 0 means next avail.
* unit is acceptable.
*/
-#ifdef DEBUG
- printf("->SUCCESS\n");
-#endif
+ if ( libbsdportAttachVerbose )
+ printf("->SUCCESS\n");
+
if ( 0 == wantedunit || UNITMATCH(wantedunit, unit, bdfunit) ) {
error = devattach(dev, thisunit, cfg);
if ( !error )
@@ -331,9 +347,8 @@ int bdfunit;
break;
default:
-#ifdef DEBUG
- printf("->FAILED\n");
-#endif
+ if ( libbsdportAttachVerbose )
+ printf("->FAILED\n");
/* probe failed */
break;
}
@@ -343,9 +358,11 @@ int bdfunit;
} /* for all busses + slots */
devfree(dev); dev = 0;
} /* matching driver */
-#ifdef DEBUG
- else printf("NO MATCH\n");
-#endif
+ else
+ {
+ if ( libbsdportAttachVerbose )
+ printf("NO MATCH\n");
+ }
} /* for all drivers */
/* Nothing found */
diff --git a/bsd_eth_drivers/libbsdport/ifmedia.c b/bsd_eth_drivers/libbsdport/ifmedia.c
index 77c3bd3..dc85dfd 100644
--- a/bsd_eth_drivers/libbsdport/ifmedia.c
+++ b/bsd_eth_drivers/libbsdport/ifmedia.c
@@ -50,6 +50,16 @@ struct ifmedia_entry *ifmen, *ifmep, *ifme;
}
}
+void
+ifmedia_removeall(struct ifmedia *ifm)
+{
+struct ifmedia_entry *ifmen, *ifmep;
+ for ( ifmep = LIST_FIRST(&ifm->ifm_list); ifmep; ifmep = ifmen ) {
+ ifmen = LIST_NEXT(ifmep, ifm_list);
+ free(ifmep, M_DEVBUF);
+ }
+}
+
int
ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, u_long cmd)
{
diff --git a/bsd_eth_drivers/libbsdport/libbsdport.h b/bsd_eth_drivers/libbsdport/libbsdport.h
index 0fdd4a4..24d8da7 100644
--- a/bsd_eth_drivers/libbsdport/libbsdport.h
+++ b/bsd_eth_drivers/libbsdport/libbsdport.h
@@ -2,12 +2,19 @@
#define RTEMS_COMPAT_DEFS_H
#include <rtems.h>
-#include <sys/param.h>
+#ifndef _KERNEL
#define _KERNEL
+#endif
+#ifndef __INSIDE_RTEMS_BSD_TCPIP_STACK__
+#define __INSIDE_RTEMS_BSD_TCPIP_STACK__
+#endif
+
#include <rtems/rtems_bsdnet.h>
#include <rtems/rtems_bsdnet_internal.h>
+#include <sys/param.h>
+
#include <inttypes.h>
#include <string.h>
@@ -31,6 +38,10 @@
#include <rtems_udelay.h>
+#ifndef bswap32
+#define bswap32(_x) CPU_swap_u32(_x)
+#endif
+
#if defined(__LITTLE_ENDIAN__) || defined(__i386__)
static inline uint16_t htole16(uint16_t v) { return v; }
static inline uint32_t htole32(uint32_t v) { return v; }
@@ -128,6 +139,17 @@ static inline void membarrier_w() { asm volatile("eieio":::"memory"); }
#error "Unknown CPU endianness"
#endif
+static __inline void
+le32enc(void *pp, uint32_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = u & 0xff;
+ p[1] = (u >> 8) & 0xff;
+ p[2] = (u >> 16) & 0xff;
+ p[3] = (u >> 24) & 0xff;
+}
+
#include <mutex.h>
#include <callout.h>
@@ -175,6 +197,10 @@ static inline void membarrier_w() { asm volatile("eieio":::"memory"); }
#define PCIR_POWER_STATUS 0x4
#endif
+#ifndef PCIR_CACHELNSZ
+#define PCIR_CACHELNSZ PCI_CACHE_LINE_SIZE
+#endif
+
#ifndef PCIM_PSTAT_PME
#define PCIM_PSTAT_PME 0x8000
#endif
@@ -183,10 +209,17 @@ static inline void membarrier_w() { asm volatile("eieio":::"memory"); }
#define PCIM_PSTAT_PMEENABLE 0x0100
#endif
+#ifndef PCIM_CMD_MWRICEN
+#define PCIM_CMD_MWRICEN PCI_COMMAND_INVALIDATE
+#endif
+
#ifndef PCIY_PMG
#define PCIY_PMG 0x01
#endif
+#ifndef PCI_RF_DENSE
+#define PCI_RF_DENSE 0
+#endif
static inline uint32_t
pci_read_config(device_t dev, unsigned reg, int width)
@@ -259,6 +292,12 @@ pci_get_subdevice(device_t dev)
return pci_read_config(dev, PCIR_SUBDEV_0, 2);
}
+static inline uint8_t
+pci_get_revid(device_t dev)
+{
+ return pci_read_config(dev, PCIR_REVID, 1);
+}
+
static inline void
pci_enable_busmaster(device_t dev)
{
@@ -325,6 +364,9 @@ pci_release_msi(device_t dev) { }
#define if_link_state_change(ifp, state) do {} while (0)
+#define if_maddr_rlock(ifp) do {} while (0)
+#define if_maddr_runlock(ifp) do {} while (0)
+
/* if_name should probably be const char * but isn't */
#define if_initname(ifp, name, unit) \
do { (ifp)->if_name = (char*)(name); (ifp)->if_unit = (unit); } while (0)
@@ -362,12 +404,14 @@ contigfree(void *ptr, size_t size, int type);
#define __FBSDID(x)
#define MODULE_DEPEND(x1,x2,x3,x4,x5)
-#define mii_mediachg(mii) do {} while (0)
-
void *
real_libc_malloc(size_t);
void
real_libc_free(void*);
+extern int libbsdport_bootverbose;
+/* Try not to pollute global namespace */
+#define bootverbose libbsdport_bootverbose
+
#endif
diff --git a/bsd_eth_drivers/libbsdport/libbsdport_api.h b/bsd_eth_drivers/libbsdport/libbsdport_api.h
index 73b54b0..18e20ee 100644
--- a/bsd_eth_drivers/libbsdport/libbsdport_api.h
+++ b/bsd_eth_drivers/libbsdport/libbsdport_api.h
@@ -3,6 +3,7 @@
#include <rtems.h>
#include <rtems/rtems_bsdnet.h>
+#include <stdio.h>
/* $Id$ */
@@ -20,17 +21,30 @@ typedef struct driver driver_t;
extern driver_t *libbsdport_netdriver_table[];
/* Drivers ported so far: */
+
+/* Broadcom BCM57xx PCI */
+extern driver_t libbsdport_bge_driver;
+
/* Intel E1000 chips */
extern driver_t libbsdport_em_driver;
+
/* AMD 79C971..976 pcnet PCI */
extern driver_t libbsdport_pcn_driver;
+
+/* RealTek RTL8139C+, 8168, 8169, 8169S, 8110, 8101E, and 8111 PCI */
+extern driver_t libbsdport_re_driver;
+
+/* RealTek RTL8139 PCI */
+extern driver_t libbsdport_rl_driver;
+
/* AMD/Lance older (and later) chips; this driver also supports what 'pcn'
* does but might not be as efficient.
* NOTE: The 'le_pci' driver works with the pcnet32 (79C970A) emulation
* of qemu.
*/
extern driver_t libbsdport_le_pci_driver;
-
+/* Intel E100 chips */
+extern driver_t libbsdport_fxp_driver;
/* Generic driver attach function (can be used in rtems_bsdnet_ifconfig).
* This routine selects a driver/device combination based on
diff --git a/bsd_eth_drivers/libbsdport/libbsdport_post.h b/bsd_eth_drivers/libbsdport/libbsdport_post.h
index fcf7e2d..ca3fe04 100644
--- a/bsd_eth_drivers/libbsdport/libbsdport_post.h
+++ b/bsd_eth_drivers/libbsdport/libbsdport_post.h
@@ -10,6 +10,8 @@
#undef SYSCTL_ADD_INT
#define SYSCTL_ADD_INT(unused...) do { } while (0)
+
+#define RTEMS_SYSCTL_NOTYETSUP
#endif
#include <netinet/in.h>
@@ -22,9 +24,6 @@
#define IFF_DRV_RUNNING IFF_RUNNING
#define IFF_DRV_OACTIVE IFF_OACTIVE
-/* FIXME: should implement m_defrag() */
-#define m_defrag(m_headp, opt) NULL
-
static inline struct mbuf *
m_getcl(int how, int type, unsigned flags)
{
@@ -87,9 +86,35 @@ ether_setaddr(struct ifnet *ifp, u_int8_t *eaddr);
} while (0)
#define ETHER_SIOCMULTIFRAG(e, c, ifr, ifp) \
- ( ENETRESET != (e = (SIOCADDMULTI == (c) ? \
+ ( ((e) = (SIOCADDMULTI == (c) ? \
ether_addmulti((ifr), (struct arpcom*)(ifp)) : \
- ether_delmulti((ifr), (struct arpcom*)(ifp)) ))) \
+ ether_delmulti((ifr), (struct arpcom*)(ifp)) )), \
+ ((e) = ENETRESET == (e) ? 0 : (e)) )
#define arp_ifinit(ifp, ifa) arp_ifinit((struct arpcom *)ifp, ifa)
+
+#define mii_mediachg(mii) do {} while (0)
+
+/* find the currently active PHY; assume bootloader or firmware
+ * has set it up already.
+ *
+ * RETURNS: phy idx 0..31 or -1 on error
+ */
+int
+rtems_mii_phy_probe(struct rtems_mdio_info *mdio, void *if_softc);
+
+/*
+ * Defragment a mbuf chain, returning the shortest possible
+ * chain of mbufs and clusters. If allocation fails and
+ * this cannot be completed, NULL will be returned, but
+ * the passed in chain will be unchanged. Upon success,
+ * the original chain will be freed, and the new chain
+ * will be returned.
+ *
+ * If a non-packet header is passed in, the original
+ * mbuf (chain?) will be returned unharmed.
+ */
+struct mbuf *
+m_defrag(struct mbuf *m0, int how);
+
diff --git a/bsd_eth_drivers/libbsdport/miistuff.c b/bsd_eth_drivers/libbsdport/miistuff.c
new file mode 100644
index 0000000..b15545f
--- /dev/null
+++ b/bsd_eth_drivers/libbsdport/miistuff.c
@@ -0,0 +1,58 @@
+#include <rtems.h>
+#define _KERNEL
+#include <rtems/rtems_bsdnet.h>
+#include <rtems/rtems_bsdnet_internal.h>
+
+#include <bsp/rtems_verscheck.h>
+
+#include <sys/malloc.h>
+#include <sys/errno.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <net/if.h>
+#include <net/if_media.h>
+#include <rtems/rtems_mii_ioctl.h>
+
+#define PHY_MAX 32
+
+#undef DEBUG
+
+/* A helper to find the active PHY. We really should port
+ * the entire BSD miibus/phy support but that's a bigger
+ * project...
+ */
+int
+rtems_mii_phy_probe(struct rtems_mdio_info *mdio, void *softc)
+{
+int phy;
+uint32_t bmsr, bmcr;
+ for ( phy = 0; phy<PHY_MAX; phy++ ) {
+ if ( mdio->mdio_r(phy, softc, MII_BMSR, &bmsr) )
+ continue;
+
+ bmsr &= 0xffff;
+
+ if ( 0 == bmsr || 0xffff == bmsr )
+ continue; /* nothing here */
+
+ /* no media supported ? */
+ if ( 0 == ((BMSR_EXTSTAT | 0xfe00) & bmsr ) )
+ continue; /* probably nothing there */
+
+ if ( mdio->mdio_r(phy, softc, MII_BMCR, &bmcr) )
+ continue;
+
+ /* skip isolated or powered-down phys */
+ if ( (BMCR_PDOWN | BMCR_ISO) & bmcr )
+ continue;
+
+#ifdef DEBUG
+ printk("PHY #%u seems active; link status is %s\n", phy, BMSR_LINK & bmsr ? "UP" : "DOWN");
+#endif
+
+ /* seems we found one */
+ return phy;
+ }
+
+ return -1;
+}
diff --git a/bsd_eth_drivers/libbsdport/misc.c b/bsd_eth_drivers/libbsdport/misc.c
new file mode 100644
index 0000000..68e3c03
--- /dev/null
+++ b/bsd_eth_drivers/libbsdport/misc.c
@@ -0,0 +1,179 @@
+
+#include <libbsdport.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <sys/taskqueue.h>
+#include <sys/mbuf.h>
+
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/ethernet.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+
+#include <libbsdport_post.h>
+
+int libbsdport_bootverbose = 0;
+
+#ifdef WITNESS
+#define MBUF_CHECKSLEEP(how) do {\
+ if (how == M_WAITOK)\
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,\
+ "Sleeping in \"%s\"", __func__);\
+ } while (0)
+#else
+#define MBUF_CHECKSLEEP(how)
+#endif
+
+#define MBTOM(how)(how)
+
+u_int
+m_length(struct mbuf *m0, struct mbuf **last)
+{
+ struct mbuf *m;
+ u_int len;
+
+ len = 0;
+ for (m = m0; m != NULL; m = m->m_next) {
+ len += m->m_len;
+ if (m->m_next == NULL)
+ break;
+ }
+ if (last != NULL)
+ *last = m;
+ return (len);
+}
+
+/*
+ * Duplicate "from"'s mbuf pkthdr in "to".
+ * "from" must have M_PKTHDR set, and "to" must be empty.
+ * In particular, this does a deep copy of the packet tags.
+ */
+int
+m_dup_pkthdr(struct mbuf *to, struct mbuf *from, int how)
+{
+
+ #if 0
+ /*
+ * The mbuf allocator only initializes the pkthdr
+ * when the mbuf is allocated with MGETHDR. Many users
+ * (e.g. m_copy*, m_prepend) use MGET and then
+ * smash the pkthdr as needed causing these
+ * assertions to trip. For now just disable them.
+ */
+ M_ASSERTPKTHDR(to);
+ /* Note: with MAC, this may not be a good assertion. */
+ KASSERT(SLIST_EMPTY(&to->m_pkthdr.tags), ("m_dup_pkthdr: to has tags"));
+ #endif
+ MBUF_CHECKSLEEP(how);
+ #ifdef MAC
+ if (to->m_flags & M_PKTHDR)
+ m_tag_delete_chain(to, NULL);
+ #endif
+ to->m_flags = (from->m_flags & M_COPYFLAGS) | (to->m_flags & M_EXT);
+ if ((to->m_flags & M_EXT) == 0)
+ to->m_data = to->m_pktdat;
+ to->m_pkthdr = from->m_pkthdr;
+ return 1;
+}
+
+u_int
+m_fixhdr(struct mbuf *m0)
+{
+ u_int len;
+
+ len = m_length(m0, NULL);
+ m0->m_pkthdr.len = len;
+ return (len);
+}
+
+/*
+ * Defragment a mbuf chain, returning the shortest possible
+ * chain of mbufs and clusters. If allocation fails and
+ * this cannot be completed, NULL will be returned, but
+ * the passed in chain will be unchanged. Upon success,
+ * the original chain will be freed, and the new chain
+ * will be returned.
+ *
+ * If a non-packet header is passed in, the original
+ * mbuf (chain?) will be returned unharmed.
+ */
+struct mbuf *
+m_defrag(struct mbuf *m0, int how)
+{
+ struct mbuf *m_new = NULL, *m_final = NULL;
+ int progress = 0, length;
+
+ MBUF_CHECKSLEEP(how);
+ if (!(m0->m_flags & M_PKTHDR))
+ return (m0);
+
+ m_fixhdr(m0); /* Needed sanity check */
+
+ #ifdef MBUF_STRESS_TEST
+ if (m_defragrandomfailures) {
+ int temp = arc4random() & 0xff;
+ if (temp == 0xba)
+ goto nospace;
+ }
+ #endif
+
+ if (m0->m_pkthdr.len > MHLEN)
+ m_final = m_getcl(how, MT_DATA, M_PKTHDR);
+ else
+ m_final = m_gethdr(how, MT_DATA);
+
+ if (m_final == NULL)
+ goto nospace;
+
+ if (m_dup_pkthdr(m_final, m0, how) == 0)
+ goto nospace;
+
+ m_new = m_final;
+
+ while (progress < m0->m_pkthdr.len) {
+ length = m0->m_pkthdr.len - progress;
+ if (length > MCLBYTES)
+ length = MCLBYTES;
+
+ if (m_new == NULL) {
+ if (length > MLEN)
+ m_new = m_getcl(how, MT_DATA, 0);
+ else
+ m_new = m_get(how, MT_DATA);
+ if (m_new == NULL)
+ goto nospace;
+ }
+
+ m_copydata(m0, progress, length, mtod(m_new, caddr_t));
+ progress += length;
+ m_new->m_len = length;
+ if (m_new != m_final)
+ m_cat(m_final, m_new);
+ m_new = NULL;
+ }
+ #ifdef MBUF_STRESS_TEST
+ if (m0->m_next == NULL)
+ m_defraguseless++;
+ #endif
+ m_freem(m0);
+ m0 = m_final;
+ #ifdef MBUF_STRESS_TEST
+ m_defragpackets++;
+ m_defragbytes += m0->m_pkthdr.len;
+ #endif
+ return (m0);
+ nospace:
+ #ifdef MBUF_STRESS_TEST
+ m_defragfailure++;
+ #endif
+ if (m_final)
+ m_freem(m_final);
+ return (NULL);
+}
+
diff --git a/bsd_eth_drivers/libbsdport/mutex.h b/bsd_eth_drivers/libbsdport/mutex.h
index 5476e37..8f0b5e6 100644
--- a/bsd_eth_drivers/libbsdport/mutex.h
+++ b/bsd_eth_drivers/libbsdport/mutex.h
@@ -46,7 +46,8 @@ mtx_destroy(struct mtx *m)
}
/* what ? */
-#define MA_OWNED 1
+#define MA_OWNED 1
+#define MA_NOTOWNED 0
static inline void
mtx_assert(struct mtx *m, int what)
{
diff --git a/bsd_eth_drivers/libbsdport/rtems_callout.c b/bsd_eth_drivers/libbsdport/rtems_callout.c
index ce9a477..c041c5b 100644
--- a/bsd_eth_drivers/libbsdport/rtems_callout.c
+++ b/bsd_eth_drivers/libbsdport/rtems_callout.c
@@ -100,6 +100,9 @@ LIST_KEY_DECL(k);
n = c->c_next;
if ( c->c_time <= 0 ) {
/* this one expired */
+ rtems_interrupt_disable(k1);
+ c->c_flags &= ~ CALLOUT_PENDING;
+ rtems_interrupt_enable(k1);
c_deq(c);
if ( c->c_func )
c->c_func(c->c_arg);
@@ -173,31 +176,43 @@ bail:
/* We cannot stop a callout that's in progress */
-void
+int
callout_stop(struct callout *c)
{
+rtems_interrupt_level l;
LIST_KEY_DECL(k);
if ( !c->c_pprev )
- return; /* not currently on a list */
+ return 0; /* not currently on a list */
LIST_LOCK(k);
+ /* have to check again */
+ if ( ! c->c_pprev ) {
+ LIST_UNLOCK(k);
+ return 0;
+ }
/* remove from list */
c_deq(c);
+ rtems_interrupt_disable(l);
+ c->c_flags &= ~(CALLOUT_ACTIVE | CALLOUT_PENDING);
+ rtems_interrupt_enable(l);
LIST_UNLOCK(k);
+
+ return 1;
}
-void
+int
callout_reset(struct callout *c, int ticks, timeout_t fn, void *arg)
{
+rtems_interrupt_level l;
LIST_KEY_DECL(k);
-int i;
+int i, rval;
if ( ticks <= 0 )
ticks = 1;
- callout_stop(c);
+ rval = callout_stop(c);
c->c_func = fn;
c->c_arg = arg;
@@ -209,7 +224,13 @@ int i;
/* enqueue */
c_enq(&c_wheel[i], c);
+ rtems_interrupt_disable(l);
+ c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING);
+ rtems_interrupt_enable(l);
+
LIST_UNLOCK(k);
+
+ return rval;
}
static rtems_id callout_tid = 0;
diff --git a/bsd_eth_drivers/libbsdport/sysbus.c b/bsd_eth_drivers/libbsdport/sysbus.c
index fcd3aac..a88d7ad 100644
--- a/bsd_eth_drivers/libbsdport/sysbus.c
+++ b/bsd_eth_drivers/libbsdport/sysbus.c
@@ -96,6 +96,41 @@ int isio;
return (struct resource*)0;
}
+int
+bus_alloc_resources(device_t dev, struct resource_spec *rs,
+ struct resource **res)
+{
+ int i;
+
+ for (i = 0; rs[i].type != -1; i++)
+ res[i] = NULL;
+ for (i = 0; rs[i].type != -1; i++) {
+ res[i] = bus_alloc_resource_any(dev,
+ rs[i].type, &rs[i].rid, rs[i].flags);
+ if (res[i] == NULL && !(rs[i].flags & RF_OPTIONAL)) {
+ bus_release_resources(dev, rs, res);
+ return (ENXIO);
+ }
+ }
+ return (0);
+}
+
+void
+bus_release_resources(device_t dev, const struct resource_spec *rs,
+ struct resource **res)
+{
+ int i;
+
+ for (i = 0; rs[i].type != -1; i++)
+ if (res[i] != NULL) {
+ bus_release_resource(
+ dev, rs[i].type, rs[i].rid, res[i]);
+ res[i] = NULL;
+ }
+}
+
+
+
struct irq_cookie {
device_t dev;
driver_filter_t handler;
@@ -143,8 +178,6 @@ bus_setup_intr(device_t dev, struct resource *r, int flags, driver_filter_t filt
int rval;
struct irq_cookie *info = 0;
-
-
if ( filter && handler ) {
rtems_panic("bus_setup_intr for both: filter & handler not implemented\n");
}
@@ -154,7 +187,7 @@ struct irq_cookie *info = 0;
device_printf(dev, "bus_setup_intr: device has no driver attached\n");
return EINVAL;
} else if ( !dev->drv->methods->irq_check_dis ) {
- device_printf(dev, "bus_setup_intr: driver has no 'irq_dis' method\n");
+ device_printf(dev, "bus_setup_intr: driver has no 'irq_check_dis' method\n");
return EINVAL;
}
}
@@ -247,10 +280,13 @@ int
bus_dmamem_alloc(bus_dma_tag_t tag, void **p_vaddr, unsigned flags, bus_dmamap_t *p_map)
{
uintptr_t a;
- if ( ! (*p_map = malloc(tag->maxsize + tag->alignment, M_DEVBUF, M_NOWAIT)) )
+unsigned sz = tag->maxsize + tag->alignment;
+ if ( ! (*p_map = malloc(sz, M_DEVBUF, M_NOWAIT)) )
return ENOMEM;
a = ((uintptr_t)*p_map + tag->alignment - 1 ) & ~(tag->alignment - 1);
*p_vaddr = (void*)a;
+ if ( (BUS_DMA_ZERO & flags) )
+ memset(*p_map, 0, sz);
return 0;
}
@@ -259,3 +295,19 @@ bus_dmamem_free(bus_dma_tag_t tag, void *vaddr, bus_dmamap_t map)
{
free(map, M_DEVBUF);
}
+
+/* Dummy handle for Giant mutex */
+uint32_t __busdma_dummy_Giant = 0;
+
+int
+resource_int_value(const char *name, int unit, const char *resname, int *result)
+{
+ /* not implemented */
+ return ENOENT;
+}
+int
+resource_long_value(const char *name, int unit, const char *resname, long *result)
+{
+ /* not implemented */
+ return ENOENT;
+}
diff --git a/bsd_eth_drivers/libbsdport/taskqueue.h b/bsd_eth_drivers/libbsdport/taskqueue.h
index a341ec1..d700edf 100644
--- a/bsd_eth_drivers/libbsdport/taskqueue.h
+++ b/bsd_eth_drivers/libbsdport/taskqueue.h
@@ -31,6 +31,8 @@ taskqueue_create_fast(const char *name, int mflags, tq_enq_fn, void *ctxt);
int
taskqueue_enqueue(struct taskqueue *tq, struct task *ta);
+#define taskqueue_enqueue_fast(_q,_t) taskqueue_enqueue(_q,_t)
+
void
taskqueue_thread_enqueue(void *ctxt);