   * $FreeBSD: src/sys/sys/timetc.h,v 1.62 2010/09/14 08:48:06 mav Exp $
   */
  
+@@ -16,6 +22,8 @@
+ #error "no user-serviceable parts inside"
+ #endif
+ 
++#include "opt_ffclock.h"
++
+ /*-
+  * `struct timecounter' is the interface between the hardware which implements
+  * a timecounter and the MI code which uses this to keep track of time.
+@@ -62,6 +70,14 @@ struct timecounter {
+ 		/* Pointer to the timecounter's private parts. */
+ 	struct timecounter	*tc_next;
+ 		/* Pointer to the next timecounter. */
++#ifdef FFCLOCK
++	uint64_t (*tc_get_timecount_64) (struct timecounter *);
++		/*
++		 * This function reads the counter and return a 64 bit unsigned int.
++		 * It is used for the passthrough mode, required by feed-forward
++		 * clocks in a virtual system (eg. Xen)
++		 */
++#endif 
+ };
+ 
+ extern struct timecounter *timecounter;

  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
diff -aur --unidirectional-new-file sys/net/bpf.h FreeBSD-CURRENT/net/bpf.h
--- sys/net/bpf.h	2010-12-09 15:46:09.000000000 +1100
+++ FreeBSD-CURRENT/net/bpf.h	2010-12-09 16:27:51.000000000 +1100
@@ -7,6 +7,12 @@
  * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
  * Berkeley Laboratory.

  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -324,6 +330,49 @@ void	getbintime(struct bintime *bt);
 void	getnanotime(struct timespec *tsp);
 void	getmicrotime(struct timeval *tvp);
 
+/* FFCLOCK specific */
+typedef uint64_t ffcounter_t;
+
+/* Feed-Forward Clock synchronisation structure */
+
+struct ffclock_data
+{
+	/* phat as an int shifted phat_shift to the left */
+	uint64_t phat_int;
+	/* Record of last time update from synchronization algorithm as an int */
+	uint64_t time_int;
+	/* The counter value to convert in seconds */
+	ffcounter_t ffcounter;
+	/* the shift amount for phat_int */
+	uint8_t phat_shift;
+	/* the shift amount for time_int */
+	uint8_t time_shift;
+	/* Warn if stamp is over this many bits */
+	uint8_t countdiff_maxbits;
+};
+
+struct ffclock_estimate
+{
+	volatile uint8_t gen;
+	struct ffclock_data cdata;
+};
+
+/* Current estimate and old one, no locking on the timestamping side */
+struct feedforward_clock
+{
+	volatile uint8_t updated;
+	struct ffclock_estimate *cest;
+	struct ffclock_estimate *ocest;
+	struct ffclock_estimate *ucest;
+};
+
+
+
+ffcounter_t read_ffcounter(void);
+void ffcounter2bintime(ffcounter_t *ffcounter, struct bintime *bt);
+/* FFCLOCK */
+
+
 /* Other functions */
 int	itimerdecr(struct itimerval *itp, int usec);
 int	itimerfix(struct timeval *tv);
diff -apur --unidirectional-new-file sys/sys/timepps.h FreeBSD-CURRENT/sys/timepps.h
--- sys/sys/timepps.h	2010-12-09 17:45:11.000000000 +1100
+++ FreeBSD-CURRENT/sys/timepps.h	2010-12-09 17:45:32.000000000 +1100
@@ -6,6 +6,12 @@
  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
  * ----------------------------------------------------------------------------
