summaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-10-05 01:18:40 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-10-05 01:18:40 +0000
commit012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch)
tree87efc733f9b164e8c85c0336f92c8fb7eff6d183 /arch/sparc64/kernel
parent625a1589d3d6464b5d90b8a0918789e3afffd220 (diff)
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found that this kernel will only boot SMP on Origin; the UP kernel freeze soon after bootup with SCSI timeout messages. I commit this anyway since I found that the last CVS versions had the same problem.
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r--arch/sparc64/kernel/auxio.c3
-rw-r--r--arch/sparc64/kernel/central.c8
-rw-r--r--arch/sparc64/kernel/entry.S8
-rw-r--r--arch/sparc64/kernel/irq.c16
-rw-r--r--arch/sparc64/kernel/pci.c7
-rw-r--r--arch/sparc64/kernel/pci_psycho.c5
-rw-r--r--arch/sparc64/kernel/process.c3
-rw-r--r--arch/sparc64/kernel/sbus.c16
-rw-r--r--arch/sparc64/kernel/setup.c6
-rw-r--r--arch/sparc64/kernel/signal.c4
-rw-r--r--arch/sparc64/kernel/signal32.c4
-rw-r--r--arch/sparc64/kernel/starfire.c36
-rw-r--r--arch/sparc64/kernel/sys_sparc.c32
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c8
-rw-r--r--arch/sparc64/kernel/time.c56
15 files changed, 110 insertions, 102 deletions
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c
index 9be09c3b0..cc26817b4 100644
--- a/arch/sparc64/kernel/auxio.c
+++ b/arch/sparc64/kernel/auxio.c
@@ -18,6 +18,7 @@
#include <asm/sbus.h>
#include <asm/ebus.h>
#include <asm/fhc.h>
+#include <asm/starfire.h>
/* Probe and map in the Auxiliary I/O register */
unsigned long auxio_register = 0;
@@ -55,7 +56,7 @@ found_sdev:
return;
}
#endif
- if(central_bus) {
+ if(central_bus || this_is_starfire) {
auxio_register = 0UL;
return;
}
diff --git a/arch/sparc64/kernel/central.c b/arch/sparc64/kernel/central.c
index 2c4fb1355..dba732a6d 100644
--- a/arch/sparc64/kernel/central.c
+++ b/arch/sparc64/kernel/central.c
@@ -1,4 +1,4 @@
-/* $Id: central.c,v 1.13 1999/12/01 10:44:43 davem Exp $
+/* $Id: central.c,v 1.14 2000/09/21 06:25:14 anton Exp $
* central.c: Central FHC driver for Sunfire/Starfire/Wildfire.
*
* Copyright (C) 1997, 1999 David S. Miller (davem@redhat.com)
@@ -15,6 +15,7 @@
#include <asm/page.h>
#include <asm/fhc.h>
+#include <asm/starfire.h>
struct linux_central *central_bus = NULL;
struct linux_fhc *fhc_list = NULL;
@@ -254,9 +255,8 @@ void central_probe(void)
cnode = prom_finddevice("/central");
if(cnode == 0 || cnode == -1) {
- extern void starfire_check(void);
-
- starfire_check();
+ if (this_is_starfire)
+ starfire_cpu_setup();
return;
}
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index e95e0392e..fd6096ec5 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -1,4 +1,4 @@
-/* $Id: entry.S,v 1.118 2000/08/01 00:11:31 davem Exp $
+/* $Id: entry.S,v 1.120 2000/09/08 13:58:12 jj Exp $
* arch/sparc64/kernel/entry.S: Sparc64 trap low-level entry points.
*
* Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu)
@@ -911,7 +911,7 @@ sys_fork: clr %o1
mov SIGCHLD, %o0
sys_clone: flushw
movrz %o1, %fp, %o1
- nop
+ mov 0, %o3
ba,pt %xcc, do_fork
add %sp, STACK_BIAS + REGWIN_SZ, %o2
ret_from_syscall:
@@ -940,8 +940,8 @@ ret_from_syscall:
1: b,pt %xcc, ret_sys_call
ldx [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_I0], %o0
-sparc_exit: rdpr %otherwin, %g1
- wrpr %g0, (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV), %pstate
+sparc_exit: wrpr %g0, (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV), %pstate
+ rdpr %otherwin, %g1
rdpr %cansave, %g3
add %g3, %g1, %g3
wrpr %g3, 0x0, %cansave
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index 7f2e21a51..92bd3ed88 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -1,4 +1,4 @@
-/* $Id: irq.c,v 1.91 2000/08/05 10:48:40 davem Exp $
+/* $Id: irq.c,v 1.94 2000/09/21 06:27:10 anton Exp $
* irq.c: UltraSparc IRQ handling/init/registry.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -31,6 +31,7 @@
#include <asm/smp.h>
#include <asm/hardirq.h>
#include <asm/softirq.h>
+#include <asm/starfire.h>
/* Internal flag, should not be visible elsewhere at all. */
#define SA_IMAP_MASKED 0x100
@@ -123,7 +124,6 @@ int get_irq_list(char *buf)
/* Now these are always passed a true fully specified sun4u INO. */
void enable_irq(unsigned int irq)
{
- extern int this_is_starfire;
struct ino_bucket *bucket = __bucket(irq);
unsigned long imap;
unsigned long tid;
@@ -139,9 +139,6 @@ void enable_irq(unsigned int irq)
: "i" (ASI_UPA_CONFIG));
tid = ((tid & UPA_CONFIG_MID) << 9);
} else {
- extern unsigned int starfire_translate(unsigned long imap,
- unsigned int upaid);
-
tid = (starfire_translate(imap, current->processor) << 26);
}
@@ -550,7 +547,7 @@ out:
#ifdef CONFIG_SMP
-/* Who has global_irq_lock. */
+/* Who has the global irq brlock */
unsigned char global_irq_holder = NO_PROC_ID;
static void show(char * str)
@@ -608,7 +605,7 @@ again:
spin_is_locked(lock) ||
(!local_bh_count(smp_processor_id()) && spin_is_locked(&global_bh_lock))) {
if (!--count) {
- show("wait_on_irq");
+ show("get_irqlock");
count = (~0 >> 1);
}
__sti();
@@ -715,7 +712,6 @@ void handler_irq(int irq, struct pt_regs *regs)
struct ino_bucket *bp, *nbp;
int cpu = smp_processor_id();
#ifdef CONFIG_SMP
- extern int this_is_starfire;
int should_forward = (this_is_starfire == 0 &&
irq < 10 &&
current->pid != 0);
@@ -1029,7 +1025,6 @@ void init_timers(void (*cfunc)(int, void *, struct pt_regs *),
#ifdef CONFIG_SMP
static int retarget_one_irq(struct irqaction *p, int goal_cpu)
{
- extern int this_is_starfire;
struct ino_bucket *bucket = __bucket(p->mask);
unsigned long imap = bucket->imap;
unsigned int tid;
@@ -1041,9 +1036,6 @@ static int retarget_one_irq(struct irqaction *p, int goal_cpu)
if(this_is_starfire == 0) {
tid = __cpu_logical_map[goal_cpu] << 26;
} else {
- extern unsigned int starfire_translate(unsigned long imap,
- unsigned int upaid);
-
tid = (starfire_translate(imap, __cpu_logical_map[goal_cpu]) << 26);
}
upa_writel(IMAP_VALID | (tid & IMAP_TID), imap);
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index cd28d9392..24b1a7217 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -1,4 +1,4 @@
-/* $Id: pci.c,v 1.16 2000/03/01 02:53:33 davem Exp $
+/* $Id: pci.c,v 1.17 2000/09/05 06:49:44 anton Exp $
* pci.c: UltraSparc PCI controller support.
*
* Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
@@ -24,7 +24,6 @@ unsigned long pci_memspace_mask = 0xffffffffUL;
#ifndef CONFIG_PCI
/* A "nop" PCI implementation. */
-int pcibios_present(void) { return 0; }
asmlinkage int sys_pciconfig_read(unsigned long bus, unsigned long dfn,
unsigned long off, unsigned long len,
unsigned char *buf)
@@ -274,7 +273,6 @@ asmlinkage int sys_pciconfig_read(unsigned long bus,
goto out;
}
- lock_kernel();
switch(len) {
case 1:
pci_read_config_byte(dev, off, &byte);
@@ -293,7 +291,6 @@ asmlinkage int sys_pciconfig_read(unsigned long bus,
err = -EINVAL;
break;
};
- unlock_kernel();
out:
return err;
}
@@ -318,7 +315,6 @@ asmlinkage int sys_pciconfig_write(unsigned long bus,
goto out;
}
- lock_kernel();
switch(len) {
case 1:
err = get_user(byte, (u8 *)buf);
@@ -346,7 +342,6 @@ asmlinkage int sys_pciconfig_write(unsigned long bus,
break;
};
- unlock_kernel();
out:
return err;
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 8d7db0c9b..aff2de594 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -1,4 +1,4 @@
-/* $Id: pci_psycho.c,v 1.16 2000/04/15 10:06:16 davem Exp $
+/* $Id: pci_psycho.c,v 1.17 2000/09/21 06:25:14 anton Exp $
* pci_psycho.c: PSYCHO/U2P specific PCI controller support.
*
* Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu)
@@ -15,6 +15,7 @@
#include <asm/pbm.h>
#include <asm/iommu.h>
#include <asm/irq.h>
+#include <asm/starfire.h>
#include "pci_impl.h"
@@ -1254,8 +1255,6 @@ static void __init psycho_scan_bus(struct pci_controller_info *p)
static void __init psycho_iommu_init(struct pci_controller_info *p)
{
- extern int this_is_starfire;
- extern void *starfire_hookup(int);
unsigned long tsbbase, i;
u64 control;
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 21d43bb1e..1f3386d53 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.111 2000/08/16 11:13:12 davem Exp $
+/* $Id: process.c,v 1.112 2000/09/06 00:45:01 davem Exp $
* arch/sparc64/kernel/process.c
*
* Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -573,6 +573,7 @@ barf:
* do_fork().
*/
int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
+ unsigned long unused,
struct task_struct *p, struct pt_regs *regs)
{
struct thread_struct *t = &p->thread;
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
index 602ee9ca2..7baebc89e 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc64/kernel/sbus.c
@@ -1,4 +1,4 @@
-/* $Id: sbus.c,v 1.11 2000/04/14 09:13:04 davem Exp $
+/* $Id: sbus.c,v 1.12 2000/09/21 06:25:14 anton Exp $
* sbus.c: UltraSparc SBUS controller support.
*
* Copyright (C) 1999 David S. Miller (davem@redhat.com)
@@ -18,6 +18,7 @@
#include <asm/cache.h>
#include <asm/dma.h>
#include <asm/irq.h>
+#include <asm/starfire.h>
#include "iommu_common.h"
@@ -1151,15 +1152,10 @@ void __init sbus_iommu_init(int prom_node, struct sbus_bus *sbus)
upa_writeq(control, iommu->sbus_control_reg);
/* Now some Xfire specific grot... */
- {
- extern void *starfire_hookup(int);
- extern int this_is_starfire;
-
- if (this_is_starfire)
- sbus->starfire_cookie = starfire_hookup(sbus->portid);
- else
- sbus->starfire_cookie = NULL;
- }
+ if (this_is_starfire)
+ sbus->starfire_cookie = starfire_hookup(sbus->portid);
+ else
+ sbus->starfire_cookie = NULL;
sysio_register_error_handlers(sbus);
}
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 486254fb9..84cc201fd 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.55 2000/07/24 14:13:13 anton Exp $
+/* $Id: setup.c,v 1.56 2000/09/21 06:29:01 anton Exp $
* linux/arch/sparc64/kernel/setup.c
*
* Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
@@ -37,6 +37,7 @@
#include <asm/pgtable.h>
#include <asm/idprom.h>
#include <asm/head.h>
+#include <asm/starfire.h>
#ifdef CONFIG_IP_PNP
#include <net/ipconfig.h>
@@ -479,6 +480,9 @@ void __init setup_arch(char **cmdline_p)
conswitchp = &prom_con;
#endif
+ /* Work out if we are starfire early on */
+ check_if_starfire();
+
boot_flags_init(*cmdline_p);
idprom_init();
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index d1e7e4215..c2a7833fb 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -1,4 +1,4 @@
-/* $Id: signal.c,v 1.53 2000/07/30 23:12:24 davem Exp $
+/* $Id: signal.c,v 1.54 2000/09/05 21:44:54 davem Exp $
* arch/sparc64/kernel/signal.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
@@ -784,7 +784,7 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
#endif
/* fall through */
default:
- sigaddset(&current->signal, signr);
+ sigaddset(&current->pending.signal, signr);
recalc_sigpending(current);
current->flags |= PF_SIGNALED;
do_exit(exit_code);
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index efad55a1c..6d06328dd 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -1,4 +1,4 @@
-/* $Id: signal32.c,v 1.66 2000/07/27 01:05:15 davem Exp $
+/* $Id: signal32.c,v 1.67 2000/09/05 21:44:54 davem Exp $
* arch/sparc64/kernel/signal32.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
@@ -1420,7 +1420,7 @@ asmlinkage int do_signal32(sigset_t *oldset, struct pt_regs * regs,
#endif
/* fall through */
default:
- sigaddset(&current->signal, signr);
+ sigaddset(&current->pending.signal, signr);
recalc_sigpending(current);
current->flags |= PF_SIGNALED;
do_exit(exit_code);
diff --git a/arch/sparc64/kernel/starfire.c b/arch/sparc64/kernel/starfire.c
index 8ff7ea4d2..dc8f96b7a 100644
--- a/arch/sparc64/kernel/starfire.c
+++ b/arch/sparc64/kernel/starfire.c
@@ -1,7 +1,8 @@
-/* $Id: starfire.c,v 1.5 2000/01/31 04:59:12 davem Exp $
+/* $Id: starfire.c,v 1.7 2000/09/22 23:02:13 davem Exp $
* starfire.c: Starfire/E10000 support.
*
* Copyright (C) 1998 David S. Miller (davem@redhat.com)
+ * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com)
*/
#include <linux/kernel.h>
@@ -11,23 +12,31 @@
#include <asm/oplib.h>
#include <asm/smp.h>
#include <asm/upa.h>
+#include <asm/starfire.h>
-/* A few places around the kernel check this to see if
+/*
+ * A few places around the kernel check this to see if
* they need to call us to do things in a Starfire specific
* way.
*/
int this_is_starfire = 0;
-void starfire_check(void)
+void check_if_starfire(void)
{
int ssnode = prom_finddevice("/ssp-serial");
+ if(ssnode != 0 && ssnode != -1)
+ this_is_starfire = 1;
+}
- if(ssnode != 0 && ssnode != -1) {
+void starfire_cpu_setup(void)
+{
+ if (this_is_starfire) {
+/* We do this in starfire_translate - Anton */
+#if 0
int i;
- this_is_starfire = 1;
-
- /* Now must fixup cpu MIDs. OBP gave us a logical
+ /*
+ * Now must fixup cpu MIDs. OBP gave us a logical
* linear cpuid number, not the real upaid.
*/
for(i = 0; i < linux_num_cpus; i++) {
@@ -39,6 +48,7 @@ void starfire_check(void)
linux_cpus[i].mid = mid;
}
+#endif
}
}
@@ -47,7 +57,8 @@ int starfire_hard_smp_processor_id(void)
return upa_readl(0x1fff40000d0UL);
}
-/* Each Starfire board has 32 registers which perform translation
+/*
+ * Each Starfire board has 32 registers which perform translation
* and delivery of traditional interrupt packets into the extended
* Starfire hardware format. Essentially UPAID's now have 2 more
* bits than in all previous Sun5 systems.
@@ -82,6 +93,9 @@ void *starfire_hookup(int upaid)
for(i = 0; i < 32; i++) {
p->imap_slots[i] = 0UL;
p->tregs[i] = treg_base + (i * 0x10UL);
+ /* Lets play it safe and not overwrite existing mappings */
+ if (upa_readl(p->tregs[i]) != 0)
+ p->imap_slots[i] = 0xdeadbeaf;
}
p->upaid = upaid;
p->next = sflist;
@@ -116,6 +130,12 @@ unsigned int starfire_translate(unsigned long imap,
panic("Lucy in the sky....");
}
p->imap_slots[i] = imap;
+
+ /* map to real upaid */
+ upaid = (((upaid & 0x3c) << 1) |
+ ((upaid & 0x40) >> 4) |
+ (upaid & 0x3));
+
upa_writel(upaid, p->tregs[i]);
return i;
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index e869af4e6..235d34889 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc.c,v 1.45 2000/07/30 23:12:24 davem Exp $
+/* $Id: sys_sparc.c,v 1.46 2000/08/29 07:01:54 davem Exp $
* linux/arch/sparc64/kernel/sys_sparc.c
*
* This file contains various random system calls that
@@ -398,13 +398,18 @@ asmlinkage int sys_utrap_install(utrap_entry_t type, utrap_handler_t new_p,
return -EINVAL;
if (new_p == (utrap_handler_t)(long)UTH_NOCHANGE) {
if (old_p) {
- if (!current->thread.utraps)
- put_user_ret(NULL, old_p, -EFAULT);
- else
- put_user_ret((utrap_handler_t)(current->thread.utraps[type]), old_p, -EFAULT);
+ if (!current->thread.utraps) {
+ if (put_user(NULL, old_p))
+ return -EFAULT;
+ } else {
+ if (put_user((utrap_handler_t)(current->thread.utraps[type]), old_p))
+ return -EFAULT;
+ }
+ }
+ if (old_d) {
+ if (put_user(NULL, old_d))
+ return -EFAULT;
}
- if (old_d)
- put_user_ret(NULL, old_d, -EFAULT);
return 0;
}
if (!current->thread.utraps) {
@@ -431,11 +436,14 @@ asmlinkage int sys_utrap_install(utrap_entry_t type, utrap_handler_t new_p,
UT_TRAP_INSTRUCTION_31*sizeof(long));
}
}
- if (old_p)
- put_user_ret((utrap_handler_t)(current->thread.utraps[type]),
- old_p, -EFAULT);
- if (old_d)
- put_user_ret(NULL, old_d, -EFAULT);
+ if (old_p) {
+ if (put_user((utrap_handler_t)(current->thread.utraps[type]), old_p))
+ return -EFAULT;
+ }
+ if (old_d) {
+ if (put_user(NULL, old_d))
+ return -EFAULT;
+ }
current->thread.utraps[type] = (long)new_p;
return 0;
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 8683b87d7..071510bbc 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc32.c,v 1.163 2000/08/22 10:09:10 jj Exp $
+/* $Id: sys_sparc32.c,v 1.164 2000/09/14 10:42:47 davem Exp $
* sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
*
* Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -1621,7 +1621,7 @@ struct ncp_mount_data32 {
static void *do_ncp_super_data_conv(void *raw_data)
{
- struct ncp_mount_data *n = (struct ncp_mount_data *)raw_data;
+ struct ncp_mount_data news, *n = &news;
struct ncp_mount_data32 *n32 = (struct ncp_mount_data32 *)raw_data;
n->dir_mode = n32->dir_mode;
@@ -1631,6 +1631,7 @@ static void *do_ncp_super_data_conv(void *raw_data)
memmove (n->mounted_vol, n32->mounted_vol, (sizeof (n32->mounted_vol) + 3 * sizeof (unsigned int)));
n->wdog_pid = n32->wdog_pid;
n->mounted_uid = low2highuid(n32->mounted_uid);
+ memcpy(raw_data, n, sizeof(struct ncp_mount_data));
return raw_data;
}
@@ -1645,7 +1646,7 @@ struct smb_mount_data32 {
static void *do_smb_super_data_conv(void *raw_data)
{
- struct smb_mount_data *s = (struct smb_mount_data *)raw_data;
+ struct smb_mount_data news, *s = &news;
struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data;
s->version = s32->version;
@@ -1654,6 +1655,7 @@ static void *do_smb_super_data_conv(void *raw_data)
s->gid = low2highgid(s32->gid);
s->file_mode = s32->file_mode;
s->dir_mode = s32->dir_mode;
+ memcpy(raw_data, s, sizeof(struct smb_mount_data));
return raw_data;
}
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index f229ea988..0264f9418 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.28 2000/07/11 02:21:12 davem Exp $
+/* $Id: time.c,v 1.32 2000/09/22 23:02:13 davem Exp $
* time.c: UltraSparc timer and TOD clock support.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -30,6 +30,7 @@
#include <asm/fhc.h>
#include <asm/pbm.h>
#include <asm/ebus.h>
+#include <asm/starfire.h>
extern rwlock_t xtime_lock;
@@ -177,37 +178,6 @@ void timer_tick_interrupt(struct pt_regs *regs)
}
#endif
-/* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
- * Assumes input in normal date format, i.e. 1980-12-31 23:59:59
- * => year=1980, mon=12, day=31, hour=23, min=59, sec=59.
- *
- * [For the Julian calendar (which was used in Russia before 1917,
- * Britain & colonies before 1752, anywhere else before 1582,
- * and is still in use by some communities) leave out the
- * -year/100+year/400 terms, and add 10.]
- *
- * This algorithm was first published by Gauss (I think).
- *
- * WARNING: this function will overflow on 2106-02-07 06:28:16 on
- * machines were long is 32-bit! (However, as time_t is signed, we
- * will already get problems at other places on 2038-01-19 03:14:08)
- */
-static inline unsigned long mktime(unsigned int year, unsigned int mon,
- unsigned int day, unsigned int hour,
- unsigned int min, unsigned int sec)
-{
- if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */
- mon += 12; /* Puts Feb last since it has leap day */
- year -= 1;
- }
- return (((
- (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) +
- year*365 - 719499
- )*24 + hour /* now have hours */
- )*60 + min /* now have minutes */
- )*60 + sec; /* finally seconds */
-}
-
/* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */
static void __init kick_start_clock(void)
{
@@ -336,6 +306,20 @@ void __init clock_probe(void)
struct linux_ebus *ebus = NULL;
#endif
+
+ if (this_is_starfire) {
+ /* davem suggests we keep this within the 4M locked kernel image */
+ static char obp_gettod[256];
+ static u32 unix_tod;
+
+ sprintf(obp_gettod, "h# %08x unix-gettod",
+ (unsigned int) (long) &unix_tod);
+ prom_feval(obp_gettod);
+ xtime.tv_sec = unix_tod;
+ xtime.tv_usec = 0;
+ return;
+ }
+
__save_and_cli(flags);
if(central_bus != NULL) {
@@ -504,6 +488,9 @@ static __inline__ unsigned long do_gettimeoffset(void)
void do_settimeofday(struct timeval *tv)
{
+ if (this_is_starfire)
+ return;
+
write_lock_irq(&xtime_lock);
tv->tv_usec -= do_gettimeoffset();
@@ -527,7 +514,10 @@ static int set_rtc_mmss(unsigned long nowtime)
unsigned long regs = mstk48t02_regs;
u8 tmp;
- /* Not having a register set can lead to trouble. */
+ /*
+ * Not having a register set can lead to trouble.
+ * Also starfire doesnt have a tod clock.
+ */
if (!regs)
return -1;