[rtems-libbsd commit] e1000 driver now compiles with fewer modifications

Joel Sherrill joel at rtems.org
Mon Mar 26 14:52:23 UTC 2012


Module:    rtems-libbsd
Branch:    master
Commit:    a52104cf463a461f6fcccd2cc6b11bd6691908c8
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=a52104cf463a461f6fcccd2cc6b11bd6691908c8

Author:    Julien Delange <julien.delange at gmail.com>
Date:      Mon Mar 26 09:51:49 2012 -0500

e1000 driver now compiles with fewer modifications

  - Change some include path in the e1000 drivers
  - Add some files from the FreeBSD source tree (modification in
    freebsd-to-rtems.py)
    - Avoid inconsistent functions declarations: the bool_t and/or
    boolean_t are not the same between rtems and freebsd so that a
    function with the prototype bool_t foobar() and another boolean_t
    foobar() does not compile on rtems. (see if_igb.c for example)
      Joel Note: These are still inconsistent on the FreeBSD side and need
                 to be addressed by them. We will just make the prototype
                 match the body until they give us a solution.

---

 freebsd-to-rtems.py                   |   11 ++-
 freebsd/dev/e1000/e1000_80003es2lan.c |    6 +-
 freebsd/dev/e1000/e1000_82540.c       |    6 +-
 freebsd/dev/e1000/e1000_82541.c       |    6 +-
 freebsd/dev/e1000/e1000_82542.c       |    6 +-
 freebsd/dev/e1000/e1000_82543.c       |    6 +-
 freebsd/dev/e1000/e1000_82571.c       |    6 +-
 freebsd/dev/e1000/e1000_82575.c       |    6 +-
 freebsd/dev/e1000/e1000_api.c         |    6 +-
 freebsd/dev/e1000/e1000_api.h         |    6 +-
 freebsd/dev/e1000/e1000_hw.h          |   40 +++++-----
 freebsd/dev/e1000/e1000_ich8lan.c     |    6 +-
 freebsd/dev/e1000/e1000_mac.c         |    6 +-
 freebsd/dev/e1000/e1000_manage.c      |    6 +-
 freebsd/dev/e1000/e1000_mbx.c         |    6 +-
 freebsd/dev/e1000/e1000_mbx.h         |    6 +-
 freebsd/dev/e1000/e1000_nvm.c         |    6 +-
 freebsd/dev/e1000/e1000_osdep.c       |    6 +-
 freebsd/dev/e1000/e1000_osdep.h       |    2 -
 freebsd/dev/e1000/e1000_phy.c         |    6 +-
 freebsd/dev/e1000/e1000_vf.c          |    8 +-
 freebsd/dev/e1000/e1000_vf.h          |   14 ++-
 freebsd/dev/e1000/if_em.c             |   12 +--
 freebsd/dev/e1000/if_igb.c            |   23 +++--
 freebsd/dev/e1000/if_lem.c            |   10 +--
 freebsd/dev/led/led.h                 |   21 +++++
 freebsd/kern/init_main.c              |    2 -
 freebsd/kern/kern_subr.c              |    5 -
 freebsd/machine/pcb.h                 |    1 +
 freebsd/machine/vm.h                  |    1 +
 freebsd/vm/pmap.h                     |    1 +
 freebsd/vm/vm.h                       |  152 +++++++++++++++++++++++++++++++++
 testsuite/usb01/Makefile              |    2 +-
 33 files changed, 288 insertions(+), 119 deletions(-)

diff --git a/freebsd-to-rtems.py b/freebsd-to-rtems.py
index aeb5ba0..aa992ee 100755
--- a/freebsd-to-rtems.py
+++ b/freebsd-to-rtems.py
@@ -474,7 +474,7 @@ rtems_headerFiles = [
 	'rtems/machine/mutex.h',
 	'rtems/machine/param.h',
 	'rtems/machine/pcpu.h',
-        #'rtems/machine/pmap.h',
+   'rtems/machine/pmap.h',
 	'rtems/machine/proc.h',
 	'rtems/machine/resource.h',
 	'rtems/machine/runq.h',
@@ -488,7 +488,6 @@ rtems_headerFiles = [
 	'rtems/machine/rtems-bsd-sysinit.h',
         'rtems/machine/rtems-bsd-select.h',
         'rtems/machine/rtems-bsd-taskqueue.h',
-        #'rtems/machine/vm.h',
 	'bsd.h',
 	]
 rtems_sourceFiles = [
@@ -1033,7 +1032,7 @@ devUsbBase.addHeaderFiles(
 		'vm/uma.h',
 		'vm/uma_int.h',
 		'vm/uma_dbg.h',
-		#'vm/vm.h',
+		'vm/vm.h',
 		#'vm/vm_page.h',
 		'fs/devfs/devfs_int.h',
 	]
@@ -1089,6 +1088,7 @@ devNet.addHeaderFiles(
 		'dev/mii/miivar.h',
 		'dev/mii/brgphyreg.h',
 		'dev/mii/icsphyreg.h',
+		'dev/led/led.h',
 		'net/bpf.h',
 		'net/ethernet.h',
 		'net/if_arp.h',
@@ -1954,6 +1954,7 @@ mm.addEmptyFiles(
 		'machine/elf.h',
 		'machine/sf_buf.h',
 		'machine/smp.h',
+        	'machine/vm.h',
 		#'machine/vmparam.h',
 		'local/opt_bce.h',
 		'local/opt_ntp.h',
@@ -1981,7 +1982,7 @@ mm.addEmptyFiles(
 		'sys/_timeval.h',
 		#'sys/vmmeter.h',
 		#'sys/vnode.h',
-		#'vm/pmap.h',
+		'vm/pmap.h',
 		#'vm/uma_int.h',
 		#'vm/uma_dbg.h',
 		#'vm/vm_extern.h',
@@ -1993,7 +1994,7 @@ mm.addEmptyFiles(
 		'geom/geom_disk.h',
 		#'sys/kdb.h',
 		#'libkern/jenkins.h',
-		#'machine/pcb.h',
+		'machine/pcb.h',
 		#'net80211/ieee80211_freebsd.h',
 		'netgraph/ng_ipfw.h',
 		#'sys/sf_buf.h',
diff --git a/freebsd/dev/e1000/e1000_80003es2lan.c b/freebsd/dev/e1000/e1000_80003es2lan.c
index 7b5101d..bec2a8a 100644
--- a/freebsd/dev/e1000/e1000_80003es2lan.c
+++ b/freebsd/dev/e1000/e1000_80003es2lan.c
@@ -39,10 +39,10 @@
  * 80003ES2LAN Gigabit Ethernet Controller (Serdes)
  */
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32  e1000_init_phy_params_80003es2lan(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_82540.c b/freebsd/dev/e1000/e1000_82540.c
index 1481036..2f2f0b0 100644
--- a/freebsd/dev/e1000/e1000_82540.c
+++ b/freebsd/dev/e1000/e1000_82540.c
@@ -45,10 +45,10 @@
  * 82546GB Gigabit Ethernet Controller
  */
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32  e1000_init_phy_params_82540(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_82541.c b/freebsd/dev/e1000/e1000_82541.c
index ca730b5..9faee5f 100644
--- a/freebsd/dev/e1000/e1000_82541.c
+++ b/freebsd/dev/e1000/e1000_82541.c
@@ -43,10 +43,10 @@
  * 82547GI Gigabit Ethernet Controller
  */
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32  e1000_init_phy_params_82541(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_82542.c b/freebsd/dev/e1000/e1000_82542.c
index 7fad75b..96687ed 100644
--- a/freebsd/dev/e1000/e1000_82542.c
+++ b/freebsd/dev/e1000/e1000_82542.c
@@ -38,10 +38,10 @@
  * 82542 Gigabit Ethernet Controller
  */
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32  e1000_init_phy_params_82542(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_82543.c b/freebsd/dev/e1000/e1000_82543.c
index 672af0e..0836cf5 100644
--- a/freebsd/dev/e1000/e1000_82543.c
+++ b/freebsd/dev/e1000/e1000_82543.c
@@ -43,10 +43,10 @@
  * 82544GC Gigabit Ethernet Controller (LOM)
  */
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32  e1000_init_phy_params_82543(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_82571.c b/freebsd/dev/e1000/e1000_82571.c
index 6b969e2..bb122d3 100644
--- a/freebsd/dev/e1000/e1000_82571.c
+++ b/freebsd/dev/e1000/e1000_82571.c
@@ -51,10 +51,10 @@
  * 82583V Gigabit Network Connection
  */
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32  e1000_init_phy_params_82571(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_82575.c b/freebsd/dev/e1000/e1000_82575.c
index 2311377..5637832 100644
--- a/freebsd/dev/e1000/e1000_82575.c
+++ b/freebsd/dev/e1000/e1000_82575.c
@@ -43,10 +43,10 @@
  * 82576 Quad Port Gigabit Mezzanine Adapter
  */
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32  e1000_init_phy_params_82575(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_api.c b/freebsd/dev/e1000/e1000_api.c
index d5b0fae..b7f7283 100644
--- a/freebsd/dev/e1000/e1000_api.c
+++ b/freebsd/dev/e1000/e1000_api.c
@@ -34,10 +34,10 @@
 ******************************************************************************/
 /*$FreeBSD$*/
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 /**
diff --git a/freebsd/dev/e1000/e1000_api.h b/freebsd/dev/e1000/e1000_api.h
index 88b2702..94af19c 100644
--- a/freebsd/dev/e1000/e1000_api.h
+++ b/freebsd/dev/e1000/e1000_api.h
@@ -35,10 +35,10 @@
 #ifndef _E1000_API_HH_
 #define _E1000_API_HH_
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_hw.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_hw.h>
+#else
+#include <freebsd/local/e1000_hw.h>
 #endif
 
 extern void    e1000_init_function_pointers_82542(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_hw.h b/freebsd/dev/e1000/e1000_hw.h
index 6400190..c51089f 100644
--- a/freebsd/dev/e1000/e1000_hw.h
+++ b/freebsd/dev/e1000/e1000_hw.h
@@ -35,14 +35,14 @@
 #ifndef _E1000_HW_HH_
 #define _E1000_HW_HH_
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_osdep.h>
-#include <freebsd/local/e1000_regs.h>
-#include <freebsd/local/e1000_defines.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_osdep.h>
 #include <freebsd/dev/e1000/e1000_regs.h>
 #include <freebsd/dev/e1000/e1000_defines.h>
+#else
+#include <freebsd/local/e1000_osdep.h>
+#include <freebsd/local/e1000_regs.h>
+#include <freebsd/local/e1000_defines.h>
 #endif
 
 struct e1000_hw;
@@ -629,18 +629,18 @@ struct e1000_host_mng_command_info {
 	u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH];
 };
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_mac.h>
-#include <freebsd/local/e1000_phy.h>
-#include <freebsd/local/e1000_nvm.h>
-#include <freebsd/local/e1000_manage.h>
-#include <freebsd/local/e1000_mbx.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_mac.h>
 #include <freebsd/dev/e1000/e1000_phy.h>
 #include <freebsd/dev/e1000/e1000_nvm.h>
 #include <freebsd/dev/e1000/e1000_manage.h>
 #include <freebsd/dev/e1000/e1000_mbx.h>
+#else
+#include <freebsd/local/e1000_mac.h>
+#include <freebsd/local/e1000_phy.h>
+#include <freebsd/local/e1000_nvm.h>
+#include <freebsd/local/e1000_manage.h>
+#include <freebsd/local/e1000_mbx.h>
 #endif
 
 struct e1000_mac_operations {
@@ -941,20 +941,20 @@ struct e1000_hw {
 	u8  revision_id;
 };
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_82541.h>
-#include <freebsd/local/e1000_82543.h>
-#include <freebsd/local/e1000_82571.h>
-#include <freebsd/local/e1000_80003es2lan.h>
-#include <freebsd/local/e1000_ich8lan.h>
-#include <freebsd/local/e1000_82575.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_82541.h>
 #include <freebsd/dev/e1000/e1000_82543.h>
 #include <freebsd/dev/e1000/e1000_82571.h>
 #include <freebsd/dev/e1000/e1000_80003es2lan.h>
 #include <freebsd/dev/e1000/e1000_ich8lan.h>
 #include <freebsd/dev/e1000/e1000_82575.h>
+#else
+#include <freebsd/local/e1000_82541.h>
+#include <freebsd/local/e1000_82543.h>
+#include <freebsd/local/e1000_82571.h>
+#include <freebsd/local/e1000_80003es2lan.h>
+#include <freebsd/local/e1000_ich8lan.h>
+#include <freebsd/local/e1000_82575.h>
 #endif
 
 /* These functions must be implemented by drivers */
diff --git a/freebsd/dev/e1000/e1000_ich8lan.c b/freebsd/dev/e1000/e1000_ich8lan.c
index 41c118e..d8c02cb 100644
--- a/freebsd/dev/e1000/e1000_ich8lan.c
+++ b/freebsd/dev/e1000/e1000_ich8lan.c
@@ -64,10 +64,10 @@
  * 82579V Gigabit Network Connection
  */
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32  e1000_init_phy_params_ich8lan(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_mac.c b/freebsd/dev/e1000/e1000_mac.c
index 90550c8..8b38ef9 100644
--- a/freebsd/dev/e1000/e1000_mac.c
+++ b/freebsd/dev/e1000/e1000_mac.c
@@ -34,10 +34,10 @@
 ******************************************************************************/
 /*$FreeBSD$*/
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_manage.c b/freebsd/dev/e1000/e1000_manage.c
index d5f0349..4198425 100644
--- a/freebsd/dev/e1000/e1000_manage.c
+++ b/freebsd/dev/e1000/e1000_manage.c
@@ -34,10 +34,10 @@
 ******************************************************************************/
 /*$FreeBSD$*/
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static u8 e1000_calculate_checksum(u8 *buffer, u32 length);
diff --git a/freebsd/dev/e1000/e1000_mbx.c b/freebsd/dev/e1000/e1000_mbx.c
index a000c01..b30ede5 100644
--- a/freebsd/dev/e1000/e1000_mbx.c
+++ b/freebsd/dev/e1000/e1000_mbx.c
@@ -34,10 +34,10 @@
 ******************************************************************************/
 /*$FreeBSD$*/
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_mbx.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_mbx.h>
+#else
+#include <freebsd/local/e1000_mnx.h>
 #endif
 
 /**
diff --git a/freebsd/dev/e1000/e1000_mbx.h b/freebsd/dev/e1000/e1000_mbx.h
index be6a325..4c70528 100644
--- a/freebsd/dev/e1000/e1000_mbx.h
+++ b/freebsd/dev/e1000/e1000_mbx.h
@@ -35,10 +35,10 @@
 #ifndef _E1000_MBX_HH_
 #define _E1000_MBX_HH_
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 /* Define mailbox register bits */
diff --git a/freebsd/dev/e1000/e1000_nvm.c b/freebsd/dev/e1000/e1000_nvm.c
index 975b4e2..cc2e9ed 100644
--- a/freebsd/dev/e1000/e1000_nvm.c
+++ b/freebsd/dev/e1000/e1000_nvm.c
@@ -34,10 +34,10 @@
 ******************************************************************************/
 /*$FreeBSD$*/
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static void e1000_reload_nvm_generic(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_osdep.c b/freebsd/dev/e1000/e1000_osdep.c
index 445a23d..bf95d85 100644
--- a/freebsd/dev/e1000/e1000_osdep.c
+++ b/freebsd/dev/e1000/e1000_osdep.c
@@ -34,10 +34,10 @@
 ******************************************************************************/
 /*$FreeBSD$*/
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 /*
diff --git a/freebsd/dev/e1000/e1000_osdep.h b/freebsd/dev/e1000/e1000_osdep.h
index bd69a10..64ea32e 100644
--- a/freebsd/dev/e1000/e1000_osdep.h
+++ b/freebsd/dev/e1000/e1000_osdep.h
@@ -50,10 +50,8 @@
 #include <freebsd/machine/bus.h>
 #include <freebsd/sys/rman.h>
 #include <freebsd/machine/resource.h>
-#ifndef __rtems__
 #include <freebsd/vm/vm.h>
 #include <freebsd/vm/pmap.h>
-#endif
 #include <freebsd/machine/clock.h>
 #include <freebsd/dev/pci/pcivar.h>
 #include <freebsd/dev/pci/pcireg.h>
diff --git a/freebsd/dev/e1000/e1000_phy.c b/freebsd/dev/e1000/e1000_phy.c
index 2a40916..5b567f4 100644
--- a/freebsd/dev/e1000/e1000_phy.c
+++ b/freebsd/dev/e1000/e1000_phy.c
@@ -34,10 +34,10 @@
 ******************************************************************************/
 /*$FreeBSD$*/
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
 static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg);
diff --git a/freebsd/dev/e1000/e1000_vf.c b/freebsd/dev/e1000/e1000_vf.c
index 7af234f..943b24e 100644
--- a/freebsd/dev/e1000/e1000_vf.c
+++ b/freebsd/dev/e1000/e1000_vf.c
@@ -34,14 +34,12 @@
 ******************************************************************************/
 /*$FreeBSD$*/
 
-
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
+#else
+#include <freebsd/local/e1000_api.h>
 #endif
 
-
 static s32       e1000_init_phy_params_vf(struct e1000_hw *hw);
 static s32       e1000_init_nvm_params_vf(struct e1000_hw *hw);
 static void      e1000_release_vf(struct e1000_hw *hw);
diff --git a/freebsd/dev/e1000/e1000_vf.h b/freebsd/dev/e1000/e1000_vf.h
index 7afa1f6..28bb4fd 100644
--- a/freebsd/dev/e1000/e1000_vf.h
+++ b/freebsd/dev/e1000/e1000_vf.h
@@ -35,14 +35,14 @@
 #ifndef _E1000_VF_HH_
 #define _E1000_VF_HH_
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_osdep.h>
-#include <freebsd/local/e1000_regs.h>
-#include <freebsd/local/e1000_defines.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_osdep.h>
 #include <freebsd/dev/e1000/e1000_regs.h>
 #include <freebsd/dev/e1000/e1000_defines.h>
+#else
+#include <freebsd/local/e1000_osdep.h>
+#include <freebsd/local/e1000_regs.h>
+#include <freebsd/local/e1000_defines.h>
 #endif
 
 struct e1000_hw;
@@ -195,7 +195,11 @@ struct e1000_vf_stats {
 	u64 gprlbc;
 };
 
+#ifdef __rtems__
+#include <freebsd/dev/e1000/e1000_mbx.h>
+#else
 #include <freebsd/local/e1000_mbx.h>
+#endif
 
 struct e1000_mac_operations {
 	/* Function pointers for the MAC. */
diff --git a/freebsd/dev/e1000/if_em.c b/freebsd/dev/e1000/if_em.c
index 6b9f4c4..bc3ac3a 100644
--- a/freebsd/dev/e1000/if_em.c
+++ b/freebsd/dev/e1000/if_em.c
@@ -79,20 +79,18 @@
 #include <freebsd/netinet/udp.h>
 
 #include <freebsd/machine/in_cksum.h>
-#ifndef __rtems__
 #include <freebsd/dev/led/led.h>
-#endif
 #include <freebsd/dev/pci/pcivar.h>
 #include <freebsd/dev/pci/pcireg.h>
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#include <freebsd/local/e1000_82571.h>
-#include <freebsd/local/if_em.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
 #include <freebsd/dev/e1000/e1000_82571.h>
 #include <freebsd/dev/e1000/if_em.h>
+#else
+#include <freebsd/local/e1000_api.h>
+#include <freebsd/local/e1000_82571.h>
+#include <freebsd/local/if_em.h>
 #endif
 
 /*********************************************************************
diff --git a/freebsd/dev/e1000/if_igb.c b/freebsd/dev/e1000/if_igb.c
index 2b231ab..f5a4e8b 100644
--- a/freebsd/dev/e1000/if_igb.c
+++ b/freebsd/dev/e1000/if_igb.c
@@ -85,20 +85,18 @@
 #include <freebsd/netinet/udp.h>
 
 #include <freebsd/machine/in_cksum.h>
-#ifndef __rtems__
 #include <freebsd/dev/led/led.h>
-#endif
 #include <freebsd/dev/pci/pcivar.h>
 #include <freebsd/dev/pci/pcireg.h>
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#include <freebsd/local/e1000_82575.h>
-#include <freebsd/local/if_igb.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
 #include <freebsd/dev/e1000/e1000_82575.h>
 #include <freebsd/dev/e1000/if_igb.h>
+#else
+#include <freebsd/local/e1000_api.h>
+#include <freebsd/local/e1000_82575.h>
+#include <freebsd/local/if_igb.h>
 #endif
 
 /*********************************************************************
@@ -222,16 +220,20 @@ static __inline	void igb_rx_discard(struct rx_ring *, int);
 static __inline void igb_rx_input(struct rx_ring *,
 		    struct ifnet *, struct mbuf *, u32);
 
+#ifdef __rtems__
+/* XXX the inconsistent prototype and body need to be reported to FreeBSD */
 static bool	igb_rxeof(struct igb_queue *, int, int *);
+#else
+static boolean_t	igb_rxeof(struct igb_queue *, int, int *);
+#endif
 static void	igb_rx_checksum(u32, struct mbuf *, u32);
 #ifdef __rtems__
-/* XXX this is an inconsistency in BSD */
+/* XXX the inconsistent prototype and body need to be reported to FreeBSD */
 static bool	igb_tx_ctx_setup(struct tx_ring *, struct mbuf *);
-static boolean_t	igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *);
 #else
 static int	igb_tx_ctx_setup(struct tx_ring *, struct mbuf *);
-static bool	igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *);
 #endif
+static boolean_t	igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *);
 static void	igb_set_promisc(struct adapter *);
 static void	igb_disable_promisc(struct adapter *);
 static void	igb_set_multi(struct adapter *);
@@ -4306,6 +4308,7 @@ igb_rx_input(struct rx_ring *rxr, struct ifnet *ifp, struct mbuf *m, u32 ptype)
  *
  *  Return TRUE if more to clean, FALSE otherwise
  *********************************************************************/
+
 static bool
 igb_rxeof(struct igb_queue *que, int count, int *done)
 {
diff --git a/freebsd/dev/e1000/if_lem.c b/freebsd/dev/e1000/if_lem.c
index 5d3e938..b0daee1 100644
--- a/freebsd/dev/e1000/if_lem.c
+++ b/freebsd/dev/e1000/if_lem.c
@@ -76,18 +76,16 @@
 #include <freebsd/netinet/udp.h>
 
 #include <freebsd/machine/in_cksum.h>
-#ifndef __rtems__
 #include <freebsd/dev/led/led.h>
-#endif
 #include <freebsd/dev/pci/pcivar.h>
 #include <freebsd/dev/pci/pcireg.h>
 
-#ifndef __rtems__
-#include <freebsd/local/e1000_api.h>
-#include <freebsd/local/if_lem.h>
-#else
+#ifdef __rtems__
 #include <freebsd/dev/e1000/e1000_api.h>
 #include <freebsd/dev/e1000/if_lem.h>
+#else
+#include <freebsd/local/e1000_api.h>
+#include <freebsd/local/if_lem.h>
 #endif
 
 /*********************************************************************
diff --git a/freebsd/dev/led/led.h b/freebsd/dev/led/led.h
new file mode 100644
index 0000000..bbf301e
--- /dev/null
+++ b/freebsd/dev/led/led.h
@@ -0,0 +1,21 @@
+/*-
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk at FreeBSD.org> wrote this file.  As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _DEV_LED_H
+#define _DEV_LED_H
+
+typedef	void led_t(void *, int);
+
+struct cdev *led_create_state(led_t *, void *, char const *, int);
+struct cdev *led_create(led_t *, void *, char const *);
+void	led_destroy(struct cdev *);
+
+#endif
diff --git a/freebsd/kern/init_main.c b/freebsd/kern/init_main.c
index 1656d43..4b308fc 100644
--- a/freebsd/kern/init_main.c
+++ b/freebsd/kern/init_main.c
@@ -110,9 +110,7 @@ struct	proc *initproc;
 
 int	boothowto = 0;		/* initialized so that it can be patched */
 SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, "");
-#endif
 int	bootverbose;
-#ifndef __rtems__
 SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0, "");
 
 /*
diff --git a/freebsd/kern/kern_subr.c b/freebsd/kern/kern_subr.c
index 072af1c..f32e875 100644
--- a/freebsd/kern/kern_subr.c
+++ b/freebsd/kern/kern_subr.c
@@ -77,7 +77,6 @@ SYSCTL_INT(_kern, KERN_IOV_MAX, iov_max, CTLFLAG_RD, NULL, UIO_MAXIOV,
 /* Declared in uipc_socket.c */
 extern int so_zero_copy_receive;
 
-#ifndef __rtems__
 /*
  * Identify the physical page mapped at the given kernel virtual
  * address.  Insert this physical page into the given address space at
@@ -373,7 +372,6 @@ again:
 	uio->uio_offset++;
 	return (0);
 }
-#endif
 
 /*
  * General routine to allocate a hash table with control of memory flags.
@@ -439,7 +437,6 @@ static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039,
 			7159, 7673, 8191, 12281, 16381, 24571, 32749 };
 #define NPRIMES (sizeof(primes) / sizeof(primes[0]))
 
-#ifndef __rtems__
 /*
  * General routine to allocate a prime number sized hash table.
  */
@@ -587,5 +584,3 @@ cloneuio(struct uio *uiop)
 	bcopy(uiop->uio_iov, uio->uio_iov, iovlen);
 	return (uio);
 }
-#endif
-
diff --git a/freebsd/machine/pcb.h b/freebsd/machine/pcb.h
new file mode 100644
index 0000000..936ffd8
--- /dev/null
+++ b/freebsd/machine/pcb.h
@@ -0,0 +1 @@
+/* EMPTY */
diff --git a/freebsd/machine/vm.h b/freebsd/machine/vm.h
new file mode 100644
index 0000000..936ffd8
--- /dev/null
+++ b/freebsd/machine/vm.h
@@ -0,0 +1 @@
+/* EMPTY */
diff --git a/freebsd/vm/pmap.h b/freebsd/vm/pmap.h
new file mode 100644
index 0000000..936ffd8
--- /dev/null
+++ b/freebsd/vm/pmap.h
@@ -0,0 +1 @@
+/* EMPTY */
diff --git a/freebsd/vm/vm.h b/freebsd/vm/vm.h
new file mode 100644
index 0000000..037ac83
--- /dev/null
+++ b/freebsd/vm/vm.h
@@ -0,0 +1,152 @@
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)vm.h	8.2 (Berkeley) 12/13/93
+ *	@(#)vm_prot.h	8.1 (Berkeley) 6/11/93
+ *	@(#)vm_inherit.h	8.1 (Berkeley) 6/11/93
+ *
+ * Copyright (c) 1987, 1990 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Authors: Avadis Tevanian, Jr., Michael Wayne Young
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution at CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef VM_H
+#define VM_H
+
+#include <freebsd/machine/vm.h>
+
+typedef char vm_inherit_t;	/* inheritance codes */
+
+#define	VM_INHERIT_SHARE	((vm_inherit_t) 0)
+#define	VM_INHERIT_COPY		((vm_inherit_t) 1)
+#define	VM_INHERIT_NONE		((vm_inherit_t) 2)
+#define	VM_INHERIT_DEFAULT	VM_INHERIT_COPY
+
+typedef u_char vm_prot_t;	/* protection codes */
+
+#define	VM_PROT_NONE		((vm_prot_t) 0x00)
+#define	VM_PROT_READ		((vm_prot_t) 0x01)
+#define	VM_PROT_WRITE		((vm_prot_t) 0x02)
+#define	VM_PROT_EXECUTE		((vm_prot_t) 0x04)
+#define	VM_PROT_OVERRIDE_WRITE	((vm_prot_t) 0x08)	/* copy-on-write */
+
+#define	VM_PROT_ALL		(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
+#define VM_PROT_RW		(VM_PROT_READ|VM_PROT_WRITE)
+#define	VM_PROT_DEFAULT		VM_PROT_ALL
+
+enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_PHYS,
+		OBJT_DEAD, OBJT_SG };
+typedef u_char objtype_t;
+
+union vm_map_object;
+typedef union vm_map_object vm_map_object_t;
+
+struct vm_map_entry;
+typedef struct vm_map_entry *vm_map_entry_t;
+
+struct vm_map;
+typedef struct vm_map *vm_map_t;
+
+struct vm_object;
+typedef struct vm_object *vm_object_t;
+
+#ifndef _KERNEL
+/*
+ * This is defined in <sys/types.h> for the kernel so that non-vm kernel
+ * sources (mainly Mach-derived ones such as ddb) don't have to include
+ * vm stuff.  Defining it there for applications might break things.
+ * Define it here for "applications" that include vm headers (e.g.,
+ * genassym).
+ */
+typedef int boolean_t;
+
+/*
+ * The exact set of memory attributes is machine dependent.  However, every
+ * machine is required to define VM_MEMATTR_DEFAULT.
+ */
+typedef	char vm_memattr_t;	/* memory attribute codes */
+
+/*
+ * This is defined in <sys/types.h> for the kernel so that vnode_if.h
+ * doesn't have to include <vm/vm.h>.
+ */
+struct vm_page;
+typedef struct vm_page *vm_page_t;
+#endif				/* _KERNEL */
+
+struct vm_reserv;
+typedef struct vm_reserv *vm_reserv_t;
+
+/*
+ * Information passed from the machine-independant VM initialization code
+ * for use by machine-dependant code (mainly for MMU support)
+ */
+struct kva_md_info {
+	vm_offset_t	buffer_sva;
+	vm_offset_t	buffer_eva;
+	vm_offset_t	clean_sva;
+	vm_offset_t	clean_eva;
+	vm_offset_t	pager_sva;
+	vm_offset_t	pager_eva;
+};
+
+extern struct kva_md_info	kmi;
+extern void vm_ksubmap_init(struct kva_md_info *);
+
+struct uidinfo;
+int swap_reserve(vm_ooffset_t incr);
+int swap_reserve_by_uid(vm_ooffset_t incr, struct uidinfo *uip);
+void swap_reserve_force(vm_ooffset_t incr);
+void swap_release(vm_ooffset_t decr);
+void swap_release_by_uid(vm_ooffset_t decr, struct uidinfo *uip);
+
+#endif				/* VM_H */
+
diff --git a/testsuite/usb01/Makefile b/testsuite/usb01/Makefile
index 6f5aae9..732a4e3 100644
--- a/testsuite/usb01/Makefile
+++ b/testsuite/usb01/Makefile
@@ -25,7 +25,7 @@ CXXFLAGS += $(CFLAGS)
 all: $(APP)
 
 $(APP): $(APP_O_FILES)
-	$(CXX) $(CXXFLAGS) $^ $(LINK_LIBS) -o $(APP)
+	$(CC) $(CXXFLAGS) $^ $(LINK_LIBS) -o $(APP)
 
 clean:
 	rm -f $(APP_O_FILES) $(APP_DEP_FILES)




More information about the vc mailing list