patch-2.1.101 linux/arch/ppc/kernel/pmac_time.c

Next file: linux/arch/ppc/kernel/ppc_htab.c
Previous file: linux/arch/ppc/kernel/pmac_support.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.100/linux/arch/ppc/kernel/pmac_time.c linux/arch/ppc/kernel/pmac_time.c
@@ -13,6 +13,7 @@
 #include <linux/param.h>
 #include <linux/string.h>
 #include <linux/mm.h>
+#include <linux/init.h>
 #include <asm/adb.h>
 #include <asm/cuda.h>
 #include <asm/pmu.h>
@@ -47,11 +48,49 @@
 /* Bits in IFR and IER */
 #define T1_INT		0x40		/* Timer 1 interrupt */
 
+__pmac
+
+unsigned long pmac_get_rtc_time(void)
+{
+	struct adb_request req;
+
+	/* Get the time from the RTC */
+	switch (adb_hardware) {
+	case ADB_VIACUDA:
+		if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
+			return 0;
+		while (!req.complete)
+			cuda_poll();
+		if (req.reply_len != 7)
+			printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
+			       req.reply_len);
+		return (req.reply[3] << 24) + (req.reply[4] << 16)
+			+ (req.reply[5] << 8) + req.reply[6] - RTC_OFFSET;
+	case ADB_VIAPMU:
+		if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
+			return 0;
+		while (!req.complete)
+			pmu_poll();
+		if (req.reply_len != 5)
+			printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
+			       req.reply_len);
+		return (req.reply[1] << 24) + (req.reply[2] << 16)
+			+ (req.reply[3] << 8) + req.reply[4] - RTC_OFFSET;
+	default:
+		return 0;
+	}
+}
+
+int pmac_set_rtc_time(unsigned long nowtime)
+{
+	return 0;
+}
+
 /*
  * Calibrate the decrementer register using VIA timer 1.
  * This is used both on powermacs and CHRP machines.
  */
-int via_calibrate_decr(void)
+__initfunc(int via_calibrate_decr(void))
 {
 	struct device_node *vias;
 	volatile unsigned char *via;
@@ -100,7 +139,7 @@
  * This was taken from the pmac time_init() when merging the prep/pmac
  * time functions.
  */
-void pmac_calibrate_decr(void)
+__initfunc(void pmac_calibrate_decr(void))
 {
 	struct device_node *cpu;
 	int freq, *fp, divisor;
@@ -127,51 +166,3 @@
 	count_period_den = freq / 1000000;
 }
 
-unsigned long
-pmac_get_rtc_time(void)
-{
-	struct adb_request req;
-
-	/* Get the time from the RTC */
-	switch (adb_hardware) {
-	case ADB_VIACUDA:
-		if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
-			return 0;
-		while (!req.complete)
-			cuda_poll();
-		if (req.reply_len != 7)
-			printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
-			       req.reply_len);
-		return (req.reply[3] << 24) + (req.reply[4] << 16)
-			+ (req.reply[5] << 8) + req.reply[6] - RTC_OFFSET;
-	case ADB_VIAPMU:
-		if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
-			return 0;
-		while (!req.complete)
-			pmu_poll();
-		if (req.reply_len != 5)
-			printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
-			       req.reply_len);
-		return (req.reply[1] << 24) + (req.reply[2] << 16)
-			+ (req.reply[3] << 8) + req.reply[4] - RTC_OFFSET;
-	default:
-		return 0;
-	}
-}
-
-int pmac_set_rtc_time(unsigned long nowtime)
-{
-	return 0;
-}
-
-/*
- * We can't do this in time_init, because via_cuda_init hasn't
- * been called at that stage.
- */
-void
-pmac_read_rtc_time(void)
-{
-	xtime.tv_sec = pmac_get_rtc_time();
-	xtime.tv_usec = 0;
-	last_rtc_update = xtime.tv_sec;
-}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov