Commit 1a86c1cb authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/home/davem/BK/sparc-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents a4d37b10 c7e40dab
...@@ -34,6 +34,11 @@ CONFIG_SPARC32 ...@@ -34,6 +34,11 @@ CONFIG_SPARC32
maintains both the SPARC32 and SPARC64 ports; its web page is maintains both the SPARC32 and SPARC64 ports; its web page is
available at <http://www.ultralinux.org/>. available at <http://www.ultralinux.org/>.
SPARC power management support
CONFIG_SUN_PM
Enable power management and CPU standby features on supported
SPARC platforms.
CONFIG_BLK_DEV_FD CONFIG_BLK_DEV_FD
If you want to use the floppy disk drive(s) of your PC under Linux, If you want to use the floppy disk drive(s) of your PC under Linux,
say Y. Information about this driver, especially important for IBM say Y. Information about this driver, especially important for IBM
......
...@@ -38,6 +38,7 @@ define_bool CONFIG_SUN_AUXIO y ...@@ -38,6 +38,7 @@ define_bool CONFIG_SUN_AUXIO y
define_bool CONFIG_SUN_IO y define_bool CONFIG_SUN_IO y
define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y
define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n
define_bool CONFIG_SUN_PM y
bool 'Support for SUN4 machines (disables SUN4[CDM] support)' CONFIG_SUN4 bool 'Support for SUN4 machines (disables SUN4[CDM] support)' CONFIG_SUN4
if [ "$CONFIG_SUN4" != "y" ]; then if [ "$CONFIG_SUN4" != "y" ]; then
......
...@@ -48,6 +48,7 @@ CONFIG_SUN_AUXIO=y ...@@ -48,6 +48,7 @@ CONFIG_SUN_AUXIO=y
CONFIG_SUN_IO=y CONFIG_SUN_IO=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y CONFIG_RWSEM_GENERIC_SPINLOCK=y
# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
CONFIG_SUN_PM=y
# CONFIG_SUN4 is not set # CONFIG_SUN4 is not set
# CONFIG_PCI is not set # CONFIG_PCI is not set
CONFIG_SUN_OPENPROMFS=m CONFIG_SUN_OPENPROMFS=m
......
...@@ -32,6 +32,7 @@ obj-$(CONFIG_SUN4) += sun4setup.o ...@@ -32,6 +32,7 @@ obj-$(CONFIG_SUN4) += sun4setup.o
obj-$(CONFIG_SMP) += trampoline.o smp.o sun4m_smp.o sun4d_smp.o obj-$(CONFIG_SMP) += trampoline.o smp.o sun4m_smp.o sun4d_smp.o
obj-$(CONFIG_SUN_AUXIO) += auxio.o obj-$(CONFIG_SUN_AUXIO) += auxio.o
obj-$(CONFIG_PCI) += ebus.o obj-$(CONFIG_PCI) += ebus.o
obj-$(CONFIG_SUN_PM) += apc.o pmc.o
ifdef CONFIG_SUNOS_EMUL ifdef CONFIG_SUNOS_EMUL
obj-y += sys_sunos.o sunos_ioctl.o obj-y += sys_sunos.o sunos_ioctl.o
......
/* apc - Driver implementation for power management functions
* of Aurora Personality Chip (APC) on SPARCstation-4/5 and
* derivatives.
*
* Copyright (c) 2002 Eric Brower (ebrower@usa.net)
*/
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/pm.h>
#include <asm/io.h>
#include <asm/sbus.h>
#include <asm/oplib.h>
#include <asm/uaccess.h>
#include <asm/auxio.h>
#include <asm/apc.h>
/* Debugging
*
* #define APC_DEBUG_LED
* #define APC_NO_IDLE
*/
#define APC_MINOR MISC_DYNAMIC_MINOR
#define APC_OBPNAME "power-management"
#define APC_DEVNAME "apc"
volatile static u8 *regs;
static int apc_regsize;
#define apc_readb(offs) (sbus_readb(regs+offs))
#define apc_writeb(val, offs) (sbus_writeb(val, regs+offs))
/*
* CPU idle callback function
* See .../arch/sparc/kernel/process.c
*/
void apc_swift_idle(void)
{
#ifdef APC_DEBUG_LED
set_auxio(0x00, AUXIO_LED);
#endif
apc_writeb(apc_readb(APC_IDLE_REG) | APC_IDLE_ON, APC_IDLE_REG);
#ifdef APC_DEBUG_LED
set_auxio(AUXIO_LED, 0x00);
#endif
}
static inline void apc_free(void)
{
sbus_iounmap((unsigned long)regs, apc_regsize);
}
static int apc_open(struct inode *inode, struct file *f)
{
return 0;
}
static int apc_release(struct inode *inode, struct file *f)
{
return 0;
}
static int apc_ioctl(struct inode *inode, struct file *f,
unsigned int cmd, unsigned long arg)
{
__u8 inarg;
switch (cmd) {
case APCIOCGFANCTL:
if(put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, (__u8*) arg)) {
return -EFAULT;
}
break;
case APCIOCGCPWR:
if(put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, (__u8*) arg)) {
return -EFAULT;
}
break;
case APCIOCGBPORT:
if(put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, (__u8*) arg)) {
return -EFAULT;
}
break;
case APCIOCSFANCTL:
if(get_user(inarg, (__u8*) arg)) {
return -EFAULT;
}
apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
break;
case APCIOCSCPWR:
if(get_user(inarg, (__u8*) arg)) {
return -EFAULT;
}
apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
break;
case APCIOCSBPORT:
if(get_user(inarg, (__u8*) arg)) {
return -EFAULT;
}
apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
break;
default:
return -EINVAL;
};
return 0;
}
static struct file_operations apc_fops = {
ioctl: apc_ioctl,
open: apc_open,
release: apc_release,
};
static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
static int __init apc_probe(void)
{
struct sbus_bus *sbus = NULL;
struct sbus_dev *sdev = NULL;
int iTmp = 0;
for_each_sbus(sbus) {
for_each_sbusdev(sdev, sbus) {
if (!strcmp(sdev->prom_name, APC_OBPNAME)) {
goto sbus_done;
}
}
}
sbus_done:
if (!sdev) {
return -ENODEV;
}
apc_regsize = sdev->reg_addrs[0].reg_size;
regs = (u8*) sbus_ioremap(&sdev->resource[0], 0,
apc_regsize, APC_OBPNAME);
if(NULL == regs) {
printk(KERN_ERR "%s: unable to map registers\n", APC_DEVNAME);
return -ENODEV;
}
iTmp = misc_register(&apc_miscdev);
if (iTmp != 0) {
printk(KERN_ERR "%s: unable to register device\n", APC_DEVNAME);
apc_free();
return -ENODEV;
}
#ifndef APC_NO_IDLE
/* Assign power management IDLE handler */
pm_idle = apc_swift_idle;
#endif
printk(KERN_INFO "%s: power management initialized\n", APC_DEVNAME);
return 0;
}
/* This driver is not critical to the boot process
* and is easiest to ioremap when SBus is already
* initialized, so we install ourselves thusly:
*/
__initcall(apc_probe);
/* pmc - Driver implementation for power management functions
* of Power Management Controller (PMC) on SPARCstation-Voyager.
*
* Copyright (c) 2002 Eric Brower (ebrower@usa.net)
*/
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/pm.h>
#include <asm/io.h>
#include <asm/sbus.h>
#include <asm/oplib.h>
#include <asm/uaccess.h>
#include <asm/auxio.h>
/* Debug
*
* #define PMC_DEBUG_LED
* #define PMC_NO_IDLE
*/
#define PMC_MINOR MISC_DYNAMIC_MINOR
#define PMC_OBPNAME "SUNW,pmc"
#define PMC_DEVNAME "pmc"
#define PMC_IDLE_REG 0x00
#define PMC_IDLE_ON 0x01
volatile static u8 *regs;
static int pmc_regsize;
#define pmc_readb(offs) (sbus_readb(regs+offs))
#define pmc_writeb(val, offs) (sbus_writeb(val, regs+offs))
/*
* CPU idle callback function
* See .../arch/sparc/kernel/process.c
*/
void pmc_swift_idle(void)
{
#ifdef PMC_DEBUG_LED
set_auxio(0x00, AUXIO_LED);
#endif
pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG);
#ifdef PMC_DEBUG_LED
set_auxio(AUXIO_LED, 0x00);
#endif
}
static inline void pmc_free(void)
{
sbus_iounmap((unsigned long)regs, pmc_regsize);
}
static int __init pmc_probe(void)
{
struct sbus_bus *sbus = NULL;
struct sbus_dev *sdev = NULL;
for_each_sbus(sbus) {
for_each_sbusdev(sdev, sbus) {
if (!strcmp(sdev->prom_name, PMC_OBPNAME)) {
goto sbus_done;
}
}
}
sbus_done:
if (!sdev) {
return -ENODEV;
}
pmc_regsize = sdev->reg_addrs[0].reg_size;
regs = (u8*) sbus_ioremap(&sdev->resource[0], 0,
pmc_regsize, PMC_OBPNAME);
if(NULL == regs) {
printk(KERN_ERR "%s: unable to map registers\n", PMC_DEVNAME);
return -ENODEV;
}
#ifndef PMC_NO_IDLE
/* Assign power management IDLE handler */
pm_idle = pmc_swift_idle;
#endif
printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME);
return 0;
}
/* This driver is not critical to the boot process
* and is easiest to ioremap when SBus is already
* initialized, so we install ourselves thusly:
*/
__initcall(pmc_probe);
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pm.h>
#include <asm/auxio.h> #include <asm/auxio.h>
#include <asm/oplib.h> #include <asm/oplib.h>
...@@ -40,6 +41,19 @@ ...@@ -40,6 +41,19 @@
#include <asm/psr.h> #include <asm/psr.h>
#include <asm/elf.h> #include <asm/elf.h>
/*
* Power management idle function
* Set in pm platform drivers
*/
void (*pm_idle)(void);
/*
* Power-off handler instantiation for pm.h compliance
* This is done via auxio, but could be used as a fallback
* handler when auxio is not present-- unused for now...
*/
void (*pm_power_off)(void);
extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *); extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *);
struct task_struct *last_task_used_math = NULL; struct task_struct *last_task_used_math = NULL;
...@@ -91,8 +105,13 @@ int cpu_idle(void) ...@@ -91,8 +105,13 @@ int cpu_idle(void)
} }
restore_flags(flags); restore_flags(flags);
} }
check_pgt_cache();
while((!current->need_resched) && pm_idle) {
(*pm_idle)();
}
schedule(); schedule();
check_pgt_cache();
} }
ret = 0; ret = 0;
out: out:
......
...@@ -1173,9 +1173,23 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, ...@@ -1173,9 +1173,23 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
signr = dequeue_signal(&current->blocked, &info); signr = dequeue_signal(&current->blocked, &info);
spin_unlock_irq(&current->sigmask_lock); spin_unlock_irq(&current->sigmask_lock);
if (!signr) break; if (!signr)
break;
if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) { if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
/* Do the syscall restart before we let the debugger
* look at the child registers.
*/
if (restart_syscall &&
(regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
regs->u_regs[UREG_I0] == ERESTARTSYS ||
regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
/* replay the system call when we are done */
regs->u_regs[UREG_I0] = orig_i0;
regs->pc -= 4;
regs->npc -= 4;
restart_syscall = 0;
}
current->exit_code = signr; current->exit_code = signr;
current->state = TASK_STOPPED; current->state = TASK_STOPPED;
...@@ -1208,8 +1222,8 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, ...@@ -1208,8 +1222,8 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
ka = &current->sig->action[signr-1]; ka = &current->sig->action[signr-1];
if(ka->sa.sa_handler == SIG_IGN) { if (ka->sa.sa_handler == SIG_IGN) {
if(signr != SIGCHLD) if (signr != SIGCHLD)
continue; continue;
/* sys_wait4() grabs the master kernel lock, so /* sys_wait4() grabs the master kernel lock, so
...@@ -1221,12 +1235,12 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, ...@@ -1221,12 +1235,12 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
; ;
continue; continue;
} }
if(ka->sa.sa_handler == SIG_DFL) { if (ka->sa.sa_handler == SIG_DFL) {
unsigned long exit_code = signr; unsigned long exit_code = signr;
if(current->pid == 1) if (current->pid == 1)
continue; continue;
switch(signr) { switch (signr) {
case SIGCONT: case SIGCHLD: case SIGWINCH: case SIGCONT: case SIGCHLD: case SIGWINCH:
continue; continue;
...@@ -1265,8 +1279,8 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, ...@@ -1265,8 +1279,8 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
struct reg_window *rw = (struct reg_window *)regs->u_regs[UREG_FP]; struct reg_window *rw = (struct reg_window *)regs->u_regs[UREG_FP];
unsigned int ins[8]; unsigned int ins[8];
while(rw && while (rw &&
!(((unsigned long) rw) & 0x3)) { !(((unsigned long) rw) & 0x3)) {
copy_from_user(ins, &rw->ins[0], sizeof(ins)); copy_from_user(ins, &rw->ins[0], sizeof(ins));
printk("Caller[%08x](%08x,%08x,%08x,%08x,%08x,%08x)\n", ins[7], ins[0], ins[1], ins[2], ins[3], ins[4], ins[5]); printk("Caller[%08x](%08x,%08x,%08x,%08x,%08x,%08x)\n", ins[7], ins[0], ins[1], ins[2], ins[3], ins[4], ins[5]);
rw = (struct reg_window *)(unsigned long)ins[6]; rw = (struct reg_window *)(unsigned long)ins[6];
...@@ -1287,15 +1301,15 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, ...@@ -1287,15 +1301,15 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
/* NOT REACHED */ /* NOT REACHED */
} }
} }
if(restart_syscall) if (restart_syscall)
syscall_restart(orig_i0, regs, &ka->sa); syscall_restart(orig_i0, regs, &ka->sa);
handle_signal(signr, ka, &info, oldset, regs, svr4_signal); handle_signal(signr, ka, &info, oldset, regs, svr4_signal);
return 1; return 1;
} }
if(restart_syscall && if (restart_syscall &&
(regs->u_regs[UREG_I0] == ERESTARTNOHAND || (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
regs->u_regs[UREG_I0] == ERESTARTSYS || regs->u_regs[UREG_I0] == ERESTARTSYS ||
regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
/* replay the system call when we are done */ /* replay the system call when we are done */
regs->u_regs[UREG_I0] = orig_i0; regs->u_regs[UREG_I0] = orig_i0;
regs->pc -= 4; regs->pc -= 4;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
#include <linux/pci.h> #include <linux/pci.h>
#endif #endif
#include <linux/pm.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/delay.h> #include <asm/delay.h>
...@@ -295,3 +296,6 @@ EXPORT_SYMBOL_DOT(mul); ...@@ -295,3 +296,6 @@ EXPORT_SYMBOL_DOT(mul);
EXPORT_SYMBOL_DOT(umul); EXPORT_SYMBOL_DOT(umul);
EXPORT_SYMBOL_DOT(div); EXPORT_SYMBOL_DOT(div);
EXPORT_SYMBOL_DOT(udiv); EXPORT_SYMBOL_DOT(udiv);
/* Sun Power Management Idle Handler */
EXPORT_SYMBOL(pm_idle);
...@@ -50,7 +50,7 @@ sys_call_table: ...@@ -50,7 +50,7 @@ sys_call_table:
/*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write /*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
/*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 /*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
/*155*/ .long sys_fcntl64, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount /*155*/ .long sys_fcntl64, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
/*160*/ .long sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall /*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
/*165*/ .long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_setxattr /*165*/ .long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_setxattr
/*170*/ .long sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents /*170*/ .long sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
/*175*/ .long sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr /*175*/ .long sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
......
...@@ -459,7 +459,7 @@ void __init mem_init(void) ...@@ -459,7 +459,7 @@ void __init mem_init(void)
initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin)); initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin));
initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT; initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
printk("Memory: %dk available (%dk kernel code, %dk data, %dk init, %ldk highmem) [%08lx,%08lx]\n", printk(KERN_INFO "Memory: %dk available (%dk kernel code, %dk data, %dk init, %ldk highmem) [%08lx,%08lx]\n",
nr_free_pages() << (PAGE_SHIFT-10), nr_free_pages() << (PAGE_SHIFT-10),
codepages << (PAGE_SHIFT-10), codepages << (PAGE_SHIFT-10),
datapages << (PAGE_SHIFT-10), datapages << (PAGE_SHIFT-10),
...@@ -486,14 +486,14 @@ void free_initmem (void) ...@@ -486,14 +486,14 @@ void free_initmem (void)
totalram_pages++; totalram_pages++;
num_physpages++; num_physpages++;
} }
printk ("Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10); printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10);
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end) void free_initrd_mem(unsigned long start, unsigned long end)
{ {
if (start < end) if (start < end)
printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
for (; start < end; start += PAGE_SIZE) { for (; start < end; start += PAGE_SIZE) {
struct page *p = virt_to_page(start); struct page *p = virt_to_page(start);
......
...@@ -201,6 +201,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -201,6 +201,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
unsigned long error; unsigned long error;
unsigned long fd_offset; unsigned long fd_offset;
unsigned long rlim; unsigned long rlim;
unsigned long orig_thr_flags;
int retval; int retval;
ex = *((struct exec *) bprm->buf); /* exec-header */ ex = *((struct exec *) bprm->buf); /* exec-header */
...@@ -305,8 +306,14 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -305,8 +306,14 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
set_brk(current->mm->start_brk, current->mm->brk); set_brk(current->mm->start_brk, current->mm->brk);
/* Make sure STACK_TOP returns the right thing. */
orig_thr_flags = current_thread_info()->flags;
current_thread_info()->flags |= _TIF_32BIT;
retval = setup_arg_pages(bprm); retval = setup_arg_pages(bprm);
if (retval < 0) { if (retval < 0) {
current_thread_info()->flags = orig_thr_flags;
/* Someone check-me: is this error path enough? */ /* Someone check-me: is this error path enough? */
send_sig(SIGKILL, current, 0); send_sig(SIGKILL, current, 0);
return retval; return retval;
...@@ -314,7 +321,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -314,7 +321,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
current->mm->start_stack = current->mm->start_stack =
(unsigned long) create_aout32_tables((char *)bprm->p, bprm); (unsigned long) create_aout32_tables((char *)bprm->p, bprm);
if (!(test_thread_flag(TIF_32BIT))) { if (!(orig_thr_flags & _TIF_32BIT)) {
unsigned long pgd_cache; unsigned long pgd_cache;
pgd_cache = ((unsigned long)current->mm->pgd[0])<<11UL; pgd_cache = ((unsigned long)current->mm->pgd[0])<<11UL;
...@@ -323,7 +330,6 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -323,7 +330,6 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
: /* no outputs */ : /* no outputs */
: "r" (pgd_cache), : "r" (pgd_cache),
"r" (TSB_REG), "i" (ASI_DMMU)); "r" (TSB_REG), "i" (ASI_DMMU));
set_thread_flag(TIF_32BIT);
} }
start_thread32(regs, ex.a_entry, current->mm->start_stack); start_thread32(regs, ex.a_entry, current->mm->start_stack);
if (current->ptrace & PT_PTRACED) if (current->ptrace & PT_PTRACED)
......
...@@ -1436,7 +1436,9 @@ ret_from_syscall: ...@@ -1436,7 +1436,9 @@ ret_from_syscall:
* %o7 for us. Check performance counter stuff too. * %o7 for us. Check performance counter stuff too.
*/ */
andn %o7, _TIF_NEWCHILD, %l0 andn %o7, _TIF_NEWCHILD, %l0
#if CONFIG_SMP || CONFIG_PREEMPT
call schedule_tail call schedule_tail
#endif
stx %l0, [%g6 + TI_FLAGS] stx %l0, [%g6 + TI_FLAGS]
andcc %l0, _TIF_PERFCTR, %g0 andcc %l0, _TIF_PERFCTR, %g0
be,pt %icc, 1f be,pt %icc, 1f
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
#include <asm/watchdog.h> #include <asm/watchdog.h>
#include <asm/module.h> #include <asm/module.h>
#include <linux/soundcard.h> #include <linux/soundcard.h>
#include <linux/lp.h>
#include <linux/atm.h> #include <linux/atm.h>
#include <linux/atmarp.h> #include <linux/atmarp.h>
...@@ -3908,6 +3909,8 @@ COMPATIBLE_IOCTL(TCSETS) ...@@ -3908,6 +3909,8 @@ COMPATIBLE_IOCTL(TCSETS)
COMPATIBLE_IOCTL(TCSETSW) COMPATIBLE_IOCTL(TCSETSW)
COMPATIBLE_IOCTL(TCSETSF) COMPATIBLE_IOCTL(TCSETSF)
COMPATIBLE_IOCTL(TIOCLINUX) COMPATIBLE_IOCTL(TIOCLINUX)
COMPATIBLE_IOCTL(TIOCSTART)
COMPATIBLE_IOCTL(TIOCSTOP)
/* Little t */ /* Little t */
COMPATIBLE_IOCTL(TIOCGETD) COMPATIBLE_IOCTL(TIOCGETD)
COMPATIBLE_IOCTL(TIOCSETD) COMPATIBLE_IOCTL(TIOCSETD)
...@@ -3934,6 +3937,7 @@ COMPATIBLE_IOCTL(TIOCSPTLCK) ...@@ -3934,6 +3937,7 @@ COMPATIBLE_IOCTL(TIOCSPTLCK)
COMPATIBLE_IOCTL(TIOCGSERIAL) COMPATIBLE_IOCTL(TIOCGSERIAL)
COMPATIBLE_IOCTL(TIOCSSERIAL) COMPATIBLE_IOCTL(TIOCSSERIAL)
COMPATIBLE_IOCTL(TIOCSERGETLSR) COMPATIBLE_IOCTL(TIOCSERGETLSR)
COMPATIBLE_IOCTL(TIOCSLTC)
/* Big F */ /* Big F */
COMPATIBLE_IOCTL(FBIOGTYPE) COMPATIBLE_IOCTL(FBIOGTYPE)
COMPATIBLE_IOCTL(FBIOSATTR) COMPATIBLE_IOCTL(FBIOSATTR)
...@@ -3968,7 +3972,6 @@ COMPATIBLE_IOCTL(FIGETBSZ) ...@@ -3968,7 +3972,6 @@ COMPATIBLE_IOCTL(FIGETBSZ)
*/ */
COMPATIBLE_IOCTL(HDIO_GET_IDENTITY) COMPATIBLE_IOCTL(HDIO_GET_IDENTITY)
COMPATIBLE_IOCTL(HDIO_SET_DMA) COMPATIBLE_IOCTL(HDIO_SET_DMA)
COMPATIBLE_IOCTL(HDIO_SET_KEEPSETTINGS)
COMPATIBLE_IOCTL(HDIO_SET_UNMASKINTR) COMPATIBLE_IOCTL(HDIO_SET_UNMASKINTR)
COMPATIBLE_IOCTL(HDIO_SET_NOWERR) COMPATIBLE_IOCTL(HDIO_SET_NOWERR)
COMPATIBLE_IOCTL(HDIO_SET_32BIT) COMPATIBLE_IOCTL(HDIO_SET_32BIT)
...@@ -4070,6 +4073,8 @@ COMPATIBLE_IOCTL(KIOCSRATE) ...@@ -4070,6 +4073,8 @@ COMPATIBLE_IOCTL(KIOCSRATE)
COMPATIBLE_IOCTL(KIOCGRATE) COMPATIBLE_IOCTL(KIOCGRATE)
/* Big S */ /* Big S */
COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN) COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN)
COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST)
COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI)
COMPATIBLE_IOCTL(SCSI_IOCTL_DOORLOCK) COMPATIBLE_IOCTL(SCSI_IOCTL_DOORLOCK)
COMPATIBLE_IOCTL(SCSI_IOCTL_DOORUNLOCK) COMPATIBLE_IOCTL(SCSI_IOCTL_DOORUNLOCK)
COMPATIBLE_IOCTL(SCSI_IOCTL_TEST_UNIT_READY) COMPATIBLE_IOCTL(SCSI_IOCTL_TEST_UNIT_READY)
...@@ -4078,11 +4083,11 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_TAGGED_DISABLE) ...@@ -4078,11 +4083,11 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_TAGGED_DISABLE)
COMPATIBLE_IOCTL(SCSI_IOCTL_GET_BUS_NUMBER) COMPATIBLE_IOCTL(SCSI_IOCTL_GET_BUS_NUMBER)
COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND) COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND)
/* Big T */ /* Big T */
COMPATIBLE_IOCTL(TUNSETNOCSUM); COMPATIBLE_IOCTL(TUNSETNOCSUM)
COMPATIBLE_IOCTL(TUNSETDEBUG); COMPATIBLE_IOCTL(TUNSETDEBUG)
COMPATIBLE_IOCTL(TUNSETIFF); COMPATIBLE_IOCTL(TUNSETIFF)
COMPATIBLE_IOCTL(TUNSETPERSIST); COMPATIBLE_IOCTL(TUNSETPERSIST)
COMPATIBLE_IOCTL(TUNSETOWNER); COMPATIBLE_IOCTL(TUNSETOWNER)
/* Big V */ /* Big V */
COMPATIBLE_IOCTL(VT_SETMODE) COMPATIBLE_IOCTL(VT_SETMODE)
COMPATIBLE_IOCTL(VT_GETMODE) COMPATIBLE_IOCTL(VT_GETMODE)
...@@ -4234,6 +4239,7 @@ COMPATIBLE_IOCTL(PPPIOCGMRU) ...@@ -4234,6 +4239,7 @@ COMPATIBLE_IOCTL(PPPIOCGMRU)
COMPATIBLE_IOCTL(PPPIOCSMRU) COMPATIBLE_IOCTL(PPPIOCSMRU)
COMPATIBLE_IOCTL(PPPIOCSMAXCID) COMPATIBLE_IOCTL(PPPIOCSMAXCID)
COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP) COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP)
COMPATIBLE_IOCTL(LPGETSTATUS)
COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP) COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP)
COMPATIBLE_IOCTL(PPPIOCXFERUNIT) COMPATIBLE_IOCTL(PPPIOCXFERUNIT)
COMPATIBLE_IOCTL(PPPIOCGNPMODE) COMPATIBLE_IOCTL(PPPIOCGNPMODE)
...@@ -4249,8 +4255,8 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN) ...@@ -4249,8 +4255,8 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN)
COMPATIBLE_IOCTL(PPPIOCATTCHAN) COMPATIBLE_IOCTL(PPPIOCATTCHAN)
COMPATIBLE_IOCTL(PPPIOCGCHAN) COMPATIBLE_IOCTL(PPPIOCGCHAN)
/* PPPOX */ /* PPPOX */
COMPATIBLE_IOCTL(PPPOEIOCSFWD); COMPATIBLE_IOCTL(PPPOEIOCSFWD)
COMPATIBLE_IOCTL(PPPOEIOCDFWD); COMPATIBLE_IOCTL(PPPOEIOCDFWD)
/* CDROM stuff */ /* CDROM stuff */
COMPATIBLE_IOCTL(CDROMPAUSE) COMPATIBLE_IOCTL(CDROMPAUSE)
COMPATIBLE_IOCTL(CDROMRESUME) COMPATIBLE_IOCTL(CDROMRESUME)
...@@ -4650,7 +4656,6 @@ HANDLE_IOCTL(FBIOSCURSOR32, fbiogscursor) ...@@ -4650,7 +4656,6 @@ HANDLE_IOCTL(FBIOSCURSOR32, fbiogscursor)
HANDLE_IOCTL(FBIOGET_FSCREENINFO, fb_ioctl_trans) HANDLE_IOCTL(FBIOGET_FSCREENINFO, fb_ioctl_trans)
HANDLE_IOCTL(FBIOGETCMAP, fb_ioctl_trans) HANDLE_IOCTL(FBIOGETCMAP, fb_ioctl_trans)
HANDLE_IOCTL(FBIOPUTCMAP, fb_ioctl_trans) HANDLE_IOCTL(FBIOPUTCMAP, fb_ioctl_trans)
HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans)
HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans) HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans)
HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans) HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans)
HANDLE_IOCTL(HDIO_GET_32BIT, hdio_ioctl_trans) HANDLE_IOCTL(HDIO_GET_32BIT, hdio_ioctl_trans)
...@@ -4746,15 +4751,15 @@ HANDLE_IOCTL(PV_CHANGE, do_lvm_ioctl) ...@@ -4746,15 +4751,15 @@ HANDLE_IOCTL(PV_CHANGE, do_lvm_ioctl)
HANDLE_IOCTL(PV_STATUS, do_lvm_ioctl) HANDLE_IOCTL(PV_STATUS, do_lvm_ioctl)
#endif /* LVM */ #endif /* LVM */
#if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE) #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
HANDLE_IOCTL(DRM32_IOCTL_VERSION, drm32_version); HANDLE_IOCTL(DRM32_IOCTL_VERSION, drm32_version)
HANDLE_IOCTL(DRM32_IOCTL_GET_UNIQUE, drm32_getsetunique); HANDLE_IOCTL(DRM32_IOCTL_GET_UNIQUE, drm32_getsetunique)
HANDLE_IOCTL(DRM32_IOCTL_SET_UNIQUE, drm32_getsetunique); HANDLE_IOCTL(DRM32_IOCTL_SET_UNIQUE, drm32_getsetunique)
HANDLE_IOCTL(DRM32_IOCTL_ADD_MAP, drm32_addmap); HANDLE_IOCTL(DRM32_IOCTL_ADD_MAP, drm32_addmap)
HANDLE_IOCTL(DRM32_IOCTL_INFO_BUFS, drm32_info_bufs); HANDLE_IOCTL(DRM32_IOCTL_INFO_BUFS, drm32_info_bufs)
HANDLE_IOCTL(DRM32_IOCTL_FREE_BUFS, drm32_free_bufs); HANDLE_IOCTL(DRM32_IOCTL_FREE_BUFS, drm32_free_bufs)
HANDLE_IOCTL(DRM32_IOCTL_MAP_BUFS, drm32_map_bufs); HANDLE_IOCTL(DRM32_IOCTL_MAP_BUFS, drm32_map_bufs)
HANDLE_IOCTL(DRM32_IOCTL_DMA, drm32_dma); HANDLE_IOCTL(DRM32_IOCTL_DMA, drm32_dma)
HANDLE_IOCTL(DRM32_IOCTL_RES_CTX, drm32_res_ctx); HANDLE_IOCTL(DRM32_IOCTL_RES_CTX, drm32_res_ctx)
#endif /* DRM */ #endif /* DRM */
#if 0 #if 0
HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl) HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl)
......
...@@ -42,6 +42,13 @@ ...@@ -42,6 +42,13 @@
/* #define VERBOSE_SHOWREGS */ /* #define VERBOSE_SHOWREGS */
/*
* Nothing special yet...
*/
void default_idle(void)
{
}
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
/* /*
...@@ -107,10 +114,8 @@ void kpreempt_maybe(void) ...@@ -107,10 +114,8 @@ void kpreempt_maybe(void)
if (local_irq_count(cpu) == 0 && if (local_irq_count(cpu) == 0 &&
local_bh_count(cpu) == 0 && local_bh_count(cpu) == 0 &&
test_thread_flag(TIF_NEED_RESCHED)) { test_thread_flag(TIF_NEED_RESCHED))
current->state = TASK_RUNNING;
schedule(); schedule();
}
} }
#endif #endif
...@@ -423,6 +428,9 @@ void flush_thread(void) ...@@ -423,6 +428,9 @@ void flush_thread(void)
{ {
struct thread_info *t = current_thread_info(); struct thread_info *t = current_thread_info();
if (t->flags & _TIF_ABI_PENDING)
t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT);
if (t->task->mm) { if (t->task->mm) {
unsigned long pgd_cache = 0UL; unsigned long pgd_cache = 0UL;
if (test_thread_flag(TIF_32BIT)) { if (test_thread_flag(TIF_32BIT)) {
......
...@@ -620,11 +620,10 @@ asmlinkage void syscall_trace(void) ...@@ -620,11 +620,10 @@ asmlinkage void syscall_trace(void)
if (!(current->ptrace & PT_PTRACED)) if (!(current->ptrace & PT_PTRACED))
return; return;
current->exit_code = SIGTRAP; current->exit_code = SIGTRAP;
preempt_disable();
current->state = TASK_STOPPED; current->state = TASK_STOPPED;
notify_parent(current, SIGCHLD); notify_parent(current, SIGCHLD);
schedule(); schedule();
preempt_enable();
/* /*
* this isn't the same as continuing with a signal, but it will do * this isn't the same as continuing with a signal, but it will do
* for normal use. strace only continues with a signal if the * for normal use. strace only continues with a signal if the
......
...@@ -274,12 +274,12 @@ to_kernel: ...@@ -274,12 +274,12 @@ to_kernel:
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
ldsw [%g6 + TI_PRE_COUNT], %l5 ldsw [%g6 + TI_PRE_COUNT], %l5
brnz %l5, kern_fpucheck brnz %l5, kern_fpucheck
add %l5, 1, %l6 sethi %hi(PREEMPT_ACTIVE), %l6
stw %l6, [%g6 + TI_PRE_COUNT] stw %l6, [%g6 + TI_PRE_COUNT]
call kpreempt_maybe call kpreempt_maybe
nop nop
ba,pt %xcc, rtrap ba,pt %xcc, rtrap
stw %l5, [%g6 + TI_PRE_COUNT] stw %g0, [%g6 + TI_PRE_COUNT]
#endif #endif
kern_fpucheck: ldub [%g6 + TI_FPDEPTH], %l5 kern_fpucheck: ldub [%g6 + TI_FPDEPTH], %l5
brz,pt %l5, rt_continue brz,pt %l5, rt_continue
......
...@@ -709,15 +709,28 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs, ...@@ -709,15 +709,28 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs,
signr = dequeue_signal(&current->blocked, &info); signr = dequeue_signal(&current->blocked, &info);
spin_unlock_irq(&current->sigmask_lock); spin_unlock_irq(&current->sigmask_lock);
if (!signr) break; if (!signr)
break;
if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) { if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
/* Do the syscall restart before we let the debugger
* look at the child registers.
*/
if (restart_syscall &&
(regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
regs->u_regs[UREG_I0] == ERESTARTSYS ||
regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
/* replay the system call when we are done */
regs->u_regs[UREG_I0] = orig_i0;
regs->tpc -= 4;
regs->tnpc -= 4;
restart_syscall = 0;
}
current->exit_code = signr; current->exit_code = signr;
preempt_disable();
current->state = TASK_STOPPED; current->state = TASK_STOPPED;
notify_parent(current, SIGCHLD); notify_parent(current, SIGCHLD);
schedule(); schedule();
preempt_enable();
if (!(signr = current->exit_code)) if (!(signr = current->exit_code))
continue; continue;
current->exit_code = 0; current->exit_code = 0;
...@@ -771,15 +784,13 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs, ...@@ -771,15 +784,13 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs,
case SIGSTOP: { case SIGSTOP: {
struct signal_struct *sig; struct signal_struct *sig;
current->state = TASK_STOPPED;
current->exit_code = signr; current->exit_code = signr;
sig = current->parent->sig; sig = current->parent->sig;
preempt_disable();
current->state = TASK_STOPPED;
if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags &
SA_NOCLDSTOP)) SA_NOCLDSTOP))
notify_parent(current, SIGCHLD); notify_parent(current, SIGCHLD);
schedule(); schedule();
preempt_enable();
continue; continue;
} }
......
...@@ -1383,15 +1383,28 @@ int do_signal32(sigset_t *oldset, struct pt_regs * regs, ...@@ -1383,15 +1383,28 @@ int do_signal32(sigset_t *oldset, struct pt_regs * regs,
signr = dequeue_signal(&current->blocked, &info); signr = dequeue_signal(&current->blocked, &info);
spin_unlock_irq(&current->sigmask_lock); spin_unlock_irq(&current->sigmask_lock);
if (!signr) break; if (!signr)
break;
if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) { if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
/* Do the syscall restart before we let the debugger
* look at the child registers.
*/
if (restart_syscall &&
(regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
regs->u_regs[UREG_I0] == ERESTARTSYS ||
regs->u_regs[UREG_I0] == ERESTARTNOINTR)) {
/* replay the system call when we are done */
regs->u_regs[UREG_I0] = orig_i0;
regs->tpc -= 4;
regs->tnpc -= 4;
restart_syscall = 0;
}
current->exit_code = signr; current->exit_code = signr;
preempt_disable();
current->state = TASK_STOPPED; current->state = TASK_STOPPED;
notify_parent(current, SIGCHLD); notify_parent(current, SIGCHLD);
schedule(); schedule();
preempt_enable();
if (!(signr = current->exit_code)) if (!(signr = current->exit_code))
continue; continue;
current->exit_code = 0; current->exit_code = 0;
...@@ -1445,15 +1458,13 @@ int do_signal32(sigset_t *oldset, struct pt_regs * regs, ...@@ -1445,15 +1458,13 @@ int do_signal32(sigset_t *oldset, struct pt_regs * regs,
case SIGSTOP: { case SIGSTOP: {
struct signal_struct *sig; struct signal_struct *sig;
current->state = TASK_STOPPED;
current->exit_code = signr; current->exit_code = signr;
sig = current->parent->sig; sig = current->parent->sig;
preempt_disable();
current->state = TASK_STOPPED;
if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags &
SA_NOCLDSTOP)) SA_NOCLDSTOP))
notify_parent(current, SIGCHLD); notify_parent(current, SIGCHLD);
schedule(); schedule();
preempt_enable();
continue; continue;
} }
case SIGQUIT: case SIGILL: case SIGTRAP: case SIGQUIT: case SIGILL: case SIGTRAP:
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <asm/head.h> #include <asm/head.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <asm/tlbflush.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/page.h> #include <asm/page.h>
...@@ -614,6 +615,7 @@ void smp_call_function_client(int irq, struct pt_regs *regs) ...@@ -614,6 +615,7 @@ void smp_call_function_client(int irq, struct pt_regs *regs)
extern unsigned long xcall_flush_tlb_page; extern unsigned long xcall_flush_tlb_page;
extern unsigned long xcall_flush_tlb_mm; extern unsigned long xcall_flush_tlb_mm;
extern unsigned long xcall_flush_tlb_range; extern unsigned long xcall_flush_tlb_range;
extern unsigned long xcall_flush_tlb_kernel_range;
extern unsigned long xcall_flush_tlb_all; extern unsigned long xcall_flush_tlb_all;
extern unsigned long xcall_tlbcachesync; extern unsigned long xcall_tlbcachesync;
extern unsigned long xcall_flush_cache_all; extern unsigned long xcall_flush_cache_all;
...@@ -848,6 +850,18 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, ...@@ -848,6 +850,18 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
} }
} }
void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
start &= PAGE_MASK;
end = PAGE_ALIGN(end);
if (start != end) {
smp_cross_call(&xcall_flush_tlb_kernel_range,
0, start, end);
__flush_tlb_kernel_range(start, end);
}
}
void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page) void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page)
{ {
{ {
...@@ -1153,7 +1167,6 @@ cycles_t cacheflush_time; ...@@ -1153,7 +1167,6 @@ cycles_t cacheflush_time;
unsigned long cache_decay_ticks; unsigned long cache_decay_ticks;
extern unsigned long cheetah_tune_scheduling(void); extern unsigned long cheetah_tune_scheduling(void);
extern unsigned long timer_ticks_per_usec_quotient;
static void __init smp_tune_scheduling(void) static void __init smp_tune_scheduling(void)
{ {
...@@ -1196,24 +1209,39 @@ static void __init smp_tune_scheduling(void) ...@@ -1196,24 +1209,39 @@ static void __init smp_tune_scheduling(void)
*((volatile unsigned long *)p); *((volatile unsigned long *)p);
/* Now the real measurement. */ /* Now the real measurement. */
__asm__ __volatile__(" if (!SPARC64_USE_STICK) {
b,pt %%xcc, 1f __asm__ __volatile__("b,pt %%xcc, 1f\n\t"
rd %%tick, %0 " rd %%tick, %0\n\t"
".align 64\n"
.align 64 "1:\tldx [%2 + 0x000], %%g1\n\t"
1: ldx [%2 + 0x000], %%g1 "ldx [%2 + 0x040], %%g2\n\t"
ldx [%2 + 0x040], %%g2 "ldx [%2 + 0x080], %%g3\n\t"
ldx [%2 + 0x080], %%g3 "ldx [%2 + 0x0c0], %%g5\n\t"
ldx [%2 + 0x0c0], %%g5 "add %2, 0x100, %2\n\t"
add %2, 0x100, %2 "cmp %2, %4\n\t"
cmp %2, %4 "bne,pt %%xcc, 1b\n\t"
bne,pt %%xcc, 1b " nop\n\t"
nop "rd %%tick, %1\n\t"
: "=&r" (tick1), "=&r" (tick2), "=&r" (flush_base)
rd %%tick, %1" : "2" (flush_base), "r" (flush_base + ecache_size)
: "=&r" (tick1), "=&r" (tick2), "=&r" (flush_base) : "g1", "g2", "g3", "g5");
: "2" (flush_base), "r" (flush_base + ecache_size) } else {
: "g1", "g2", "g3", "g5"); __asm__ __volatile__("b,pt %%xcc, 1f\n\t"
" rd %%asr24, %0\n\t"
".align 64\n"
"1:\tldx [%2 + 0x000], %%g1\n\t"
"ldx [%2 + 0x040], %%g2\n\t"
"ldx [%2 + 0x080], %%g3\n\t"
"ldx [%2 + 0x0c0], %%g5\n\t"
"add %2, 0x100, %2\n\t"
"cmp %2, %4\n\t"
"bne,pt %%xcc, 1b\n\t"
" nop\n\t"
"rd %%asr24, %1\n\t"
: "=&r" (tick1), "=&r" (tick2), "=&r" (flush_base)
: "2" (flush_base), "r" (flush_base + ecache_size)
: "g1", "g2", "g3", "g5");
}
__restore_flags(flags); __restore_flags(flags);
...@@ -1230,10 +1258,8 @@ static void __init smp_tune_scheduling(void) ...@@ -1230,10 +1258,8 @@ static void __init smp_tune_scheduling(void)
(ecache_size << 1)); (ecache_size << 1));
} }
report: report:
/* Convert cpu ticks to jiffie ticks. */ /* Convert ticks/sticks to jiffies. */
cache_decay_ticks = ((long)cacheflush_time * timer_ticks_per_usec_quotient); cache_decay_ticks = cacheflush_time / timer_tick_offset;
cache_decay_ticks >>= 32UL;
cache_decay_ticks = (cache_decay_ticks * HZ) / 1000;
printk("Using heuristic of %ld cycles, %ld ticks.\n", printk("Using heuristic of %ld cycles, %ld ticks.\n",
cacheflush_time, cache_decay_ticks); cacheflush_time, cache_decay_ticks);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <asm/checksum.h> #include <asm/checksum.h>
#include <asm/fpumacro.h> #include <asm/fpumacro.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/cacheflush.h>
#ifdef CONFIG_SBUS #ifdef CONFIG_SBUS
#include <asm/sbus.h> #include <asm/sbus.h>
#include <asm/dma.h> #include <asm/dma.h>
......
...@@ -4160,7 +4160,7 @@ struct __sysctl_args32 { ...@@ -4160,7 +4160,7 @@ struct __sysctl_args32 {
u32 __unused[4]; u32 __unused[4];
}; };
extern asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
{ {
struct __sysctl_args32 tmp; struct __sysctl_args32 tmp;
int error; int error;
...@@ -4197,3 +4197,53 @@ extern asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) ...@@ -4197,3 +4197,53 @@ extern asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
} }
return error; return error;
} }
extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
u32 *user_mask_ptr)
{
unsigned long kernel_mask;
mm_segment_t old_fs;
int ret;
if (get_user(kernel_mask, user_mask_ptr))
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_setaffinity(pid,
/* XXX Nice api... */
sizeof(kernel_mask),
&kernel_mask);
set_fs(old_fs);
return ret;
}
extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage int sys32_sched_getaffinity(__kernel_pid_t32 pid, unsigned int len,
u32 *user_mask_ptr)
{
unsigned long kernel_mask;
mm_segment_t old_fs;
int ret;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sched_getaffinity(pid,
/* XXX Nice api... */
sizeof(kernel_mask),
&kernel_mask);
set_fs(old_fs);
if (ret == 0) {
if (put_user(kernel_mask, user_mask_ptr))
ret = -EFAULT;
}
return ret;
}
...@@ -51,7 +51,7 @@ sys_call_table32: ...@@ -51,7 +51,7 @@ sys_call_table32:
.word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write .word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 /*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
.word sys32_fcntl64, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount .word sys32_fcntl64, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount
/*160*/ .word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall /*160*/ .word sys32_sched_setaffinity, sys32_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
.word sys32_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys_setxattr .word sys32_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys_setxattr
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents /*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
.word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
...@@ -110,7 +110,7 @@ sys_call_table: ...@@ -110,7 +110,7 @@ sys_call_table:
.word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write .word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 /*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
.word sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount .word sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
/*160*/ .word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_utrap_install /*160*/ .word sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_utrap_install
.word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_setxattr .word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_setxattr
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents /*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
.word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/init.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -397,7 +398,7 @@ extern unsigned int cheetah_fecc_trap_vector[], cheetah_fecc_trap_vector_tl1[]; ...@@ -397,7 +398,7 @@ extern unsigned int cheetah_fecc_trap_vector[], cheetah_fecc_trap_vector_tl1[];
extern unsigned int cheetah_cee_trap_vector[], cheetah_cee_trap_vector_tl1[]; extern unsigned int cheetah_cee_trap_vector[], cheetah_cee_trap_vector_tl1[];
extern unsigned int cheetah_deferred_trap_vector[], cheetah_deferred_trap_vector_tl1[]; extern unsigned int cheetah_deferred_trap_vector[], cheetah_deferred_trap_vector_tl1[];
void cheetah_ecache_flush_init(void) void __init cheetah_ecache_flush_init(void)
{ {
unsigned long largest_size, smallest_linesize, order; unsigned long largest_size, smallest_linesize, order;
char type[16]; char type[16];
...@@ -528,12 +529,39 @@ static void cheetah_flush_ecache_line(unsigned long physaddr) ...@@ -528,12 +529,39 @@ static void cheetah_flush_ecache_line(unsigned long physaddr)
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
unsigned long cheetah_tune_scheduling(void) unsigned long __init cheetah_tune_scheduling(void)
{ {
unsigned long tick1, tick2, raw; unsigned long tick1, tick2, raw;
unsigned long flush_base = ecache_flush_physbase;
unsigned long flush_linesize = ecache_flush_linesize;
unsigned long flush_size = ecache_flush_size;
/* Run through the whole cache to guarentee the timed loop
* is really displacing cache lines.
*/
__asm__ __volatile__("1: subcc %0, %4, %0\n\t"
" bne,pt %%xcc, 1b\n\t"
" ldxa [%2 + %0] %3, %%g0\n\t"
: "=&r" (flush_size)
: "0" (flush_size), "r" (flush_base),
"i" (ASI_PHYS_USE_EC), "r" (flush_linesize));
/* The flush area is 2 X Ecache-size, so cut this in half for
* the timed loop.
*/
flush_base = ecache_flush_physbase;
flush_linesize = ecache_flush_linesize;
flush_size = ecache_flush_size >> 1;
__asm__ __volatile__("rd %%tick, %0" : "=r" (tick1)); __asm__ __volatile__("rd %%tick, %0" : "=r" (tick1));
cheetah_flush_ecache();
__asm__ __volatile__("1: subcc %0, %4, %0\n\t"
" bne,pt %%xcc, 1b\n\t"
" ldxa [%2 + %0] %3, %%g0\n\t"
: "=&r" (flush_size)
: "0" (flush_size), "r" (flush_base),
"i" (ASI_PHYS_USE_EC), "r" (flush_linesize));
__asm__ __volatile__("rd %%tick, %0" : "=r" (tick2)); __asm__ __volatile__("rd %%tick, %0" : "=r" (tick2));
raw = (tick2 - tick1); raw = (tick2 - tick1);
...@@ -1257,7 +1285,7 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned ...@@ -1257,7 +1285,7 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned
/* "Recoverable" here means we try to yank the page from ever /* "Recoverable" here means we try to yank the page from ever
* being newly used again. This depends upon a few things: * being newly used again. This depends upon a few things:
* 1) Must be main memory, and AFAR must be valid. * 1) Must be main memory, and AFAR must be valid.
* 2) If we trapped from use, OK. * 2) If we trapped from user, OK.
* 3) Else, if we trapped from kernel we must find exception * 3) Else, if we trapped from kernel we must find exception
* table entry (ie. we have to have been accessing user * table entry (ie. we have to have been accessing user
* space). * space).
...@@ -1678,7 +1706,7 @@ void do_getpsr(struct pt_regs *regs) ...@@ -1678,7 +1706,7 @@ void do_getpsr(struct pt_regs *regs)
extern void thread_info_offsets_are_bolixed_dave(void); extern void thread_info_offsets_are_bolixed_dave(void);
/* Only invoked on boot processor. */ /* Only invoked on boot processor. */
void trap_init(void) void __init trap_init(void)
{ {
/* Compile time sanity check. */ /* Compile time sanity check. */
if (TI_TASK != offsetof(struct thread_info, task) || if (TI_TASK != offsetof(struct thread_info, task) ||
......
/* $Id: math.c,v 1.12 2002/02/09 19:49:31 davem Exp $ /* $Id: math.c,v 1.11 1999/12/20 05:02:25 davem Exp $
* arch/sparc64/math-emu/math.c * arch/sparc64/math-emu/math.c
* *
* Copyright (C) 1997,1999 Jakub Jelinek (jj@ultra.linux.cz) * Copyright (C) 1997,1999 Jakub Jelinek (jj@ultra.linux.cz)
...@@ -58,6 +58,12 @@ ...@@ -58,6 +58,12 @@
#define FSTOD 0x0c9 #define FSTOD 0x0c9
#define FSTOI 0x0d1 #define FSTOI 0x0d1
#define FDTOI 0x0d2 #define FDTOI 0x0d2
#define FXTOS 0x084 /* Only Ultra-III generates this. */
#define FXTOD 0x088 /* Only Ultra-III generates this. */
#if 0 /* Optimized inline in sparc64/kernel/entry.S */
#define FITOS 0x0c4 /* Only Ultra-III generates this. */
#endif
#define FITOD 0x0c8 /* Only Ultra-III generates this. */
/* FPOP2 */ /* FPOP2 */
#define FCMPQ 0x053 #define FCMPQ 0x053
#define FCMPEQ 0x057 #define FCMPEQ 0x057
...@@ -98,18 +104,18 @@ static inline int record_exception(struct pt_regs *regs, int eflag) ...@@ -98,18 +104,18 @@ static inline int record_exception(struct pt_regs *regs, int eflag)
would_trap = (fsr & ((long)eflag << FSR_TEM_SHIFT)) != 0UL; would_trap = (fsr & ((long)eflag << FSR_TEM_SHIFT)) != 0UL;
/* If trapping, we only want to signal one bit. */ /* If trapping, we only want to signal one bit. */
if (would_trap != 0) { if(would_trap != 0) {
eflag &= ((fsr & FSR_TEM_MASK) >> FSR_TEM_SHIFT); eflag &= ((fsr & FSR_TEM_MASK) >> FSR_TEM_SHIFT);
if ((eflag & (eflag - 1)) != 0) { if((eflag & (eflag - 1)) != 0) {
if (eflag & FP_EX_INVALID) if(eflag & FP_EX_INVALID)
eflag = FP_EX_INVALID; eflag = FP_EX_INVALID;
else if (eflag & FP_EX_OVERFLOW) else if(eflag & FP_EX_OVERFLOW)
eflag = FP_EX_OVERFLOW; eflag = FP_EX_OVERFLOW;
else if (eflag & FP_EX_UNDERFLOW) else if(eflag & FP_EX_UNDERFLOW)
eflag = FP_EX_UNDERFLOW; eflag = FP_EX_UNDERFLOW;
else if (eflag & FP_EX_DIVZERO) else if(eflag & FP_EX_DIVZERO)
eflag = FP_EX_DIVZERO; eflag = FP_EX_DIVZERO;
else if (eflag & FP_EX_INEXACT) else if(eflag & FP_EX_INEXACT)
eflag = FP_EX_INEXACT; eflag = FP_EX_INEXACT;
} }
} }
...@@ -129,11 +135,11 @@ static inline int record_exception(struct pt_regs *regs, int eflag) ...@@ -129,11 +135,11 @@ static inline int record_exception(struct pt_regs *regs, int eflag)
* CEXC just generated is OR'd into the * CEXC just generated is OR'd into the
* existing value of AEXC. * existing value of AEXC.
*/ */
if (would_trap == 0) if(would_trap == 0)
fsr |= ((long)eflag << FSR_AEXC_SHIFT); fsr |= ((long)eflag << FSR_AEXC_SHIFT);
/* If trapping, indicate fault trap type IEEE. */ /* If trapping, indicate fault trap type IEEE. */
if (would_trap != 0) if(would_trap != 0)
fsr |= (1UL << 14); fsr |= (1UL << 14);
current_thread_info()->xfsr[0] = fsr; current_thread_info()->xfsr[0] = fsr;
...@@ -141,7 +147,7 @@ static inline int record_exception(struct pt_regs *regs, int eflag) ...@@ -141,7 +147,7 @@ static inline int record_exception(struct pt_regs *regs, int eflag)
/* If we will not trap, advance the program counter over /* If we will not trap, advance the program counter over
* the instruction being handled. * the instruction being handled.
*/ */
if (would_trap == 0) { if(would_trap == 0) {
regs->tpc = regs->tnpc; regs->tpc = regs->tnpc;
regs->tnpc += 4; regs->tnpc += 4;
} }
...@@ -176,9 +182,9 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f) ...@@ -176,9 +182,9 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f)
long XR, xfsr; long XR, xfsr;
if (tstate & TSTATE_PRIV) if (tstate & TSTATE_PRIV)
die_if_kernel("FPQuad from kernel", regs); die_if_kernel("unfinished/unimplemented FPop from kernel", regs);
if (test_thread_flag(TIF_32BIT)) if (test_thread_flag(TIF_32BIT))
pc &= 0xffffffff; pc = (u32)pc;
if (get_user(insn, (u32 *)pc) != -EFAULT) { if (get_user(insn, (u32 *)pc) != -EFAULT) {
if ((insn & 0xc1f80000) == 0x81a00000) /* FPOP1 */ { if ((insn & 0xc1f80000) == 0x81a00000) /* FPOP1 */ {
switch ((insn >> 5) & 0x1ff) { switch ((insn >> 5) & 0x1ff) {
...@@ -218,6 +224,14 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f) ...@@ -218,6 +224,14 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f)
case FSTOD: TYPE(2,2,1,1,1,0,0); break; case FSTOD: TYPE(2,2,1,1,1,0,0); break;
case FSTOI: TYPE(2,1,0,1,1,0,0); break; case FSTOI: TYPE(2,1,0,1,1,0,0); break;
case FDTOI: TYPE(2,1,0,2,1,0,0); break; case FDTOI: TYPE(2,1,0,2,1,0,0); break;
/* Only Ultra-III generates these */
case FXTOS: TYPE(2,1,1,2,0,0,0); break;
case FXTOD: TYPE(2,2,1,2,0,0,0); break;
#if 0 /* Optimized inline in sparc64/kernel/entry.S */
case FITOS: TYPE(2,1,1,1,0,0,0); break;
#endif
case FITOD: TYPE(2,2,1,1,0,0,0); break;
} }
} }
else if ((insn & 0xc1f80000) == 0x81a80000) /* FPOP2 */ { else if ((insn & 0xc1f80000) == 0x81a80000) /* FPOP2 */ {
...@@ -421,6 +435,13 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f) ...@@ -421,6 +435,13 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f)
/* int to float */ /* int to float */
case FITOQ: IR = rs2->s; FP_FROM_INT_Q (QR, IR, 32, int); break; case FITOQ: IR = rs2->s; FP_FROM_INT_Q (QR, IR, 32, int); break;
case FXTOQ: XR = rs2->d; FP_FROM_INT_Q (QR, XR, 64, long); break; case FXTOQ: XR = rs2->d; FP_FROM_INT_Q (QR, XR, 64, long); break;
/* Only Ultra-III generates these */
case FXTOS: XR = rs2->d; FP_FROM_INT_S (SR, XR, 64, long); break;
case FXTOD: XR = rs2->d; FP_FROM_INT_D (DR, XR, 64, long); break;
#if 0 /* Optimized inline in sparc64/kernel/entry.S */
case FITOS: IR = rs2->s; FP_FROM_INT_S (SR, IR, 32, int); break;
#endif
case FITOD: IR = rs2->s; FP_FROM_INT_D (DR, IR, 32, int); break;
/* float to float */ /* float to float */
case FSTOD: FP_CONV (D, S, 1, 1, DR, SB); break; case FSTOD: FP_CONV (D, S, 1, 1, DR, SB); break;
case FSTOQ: FP_CONV (Q, S, 2, 1, QR, SB); break; case FSTOQ: FP_CONV (Q, S, 2, 1, QR, SB); break;
...@@ -459,7 +480,7 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f) ...@@ -459,7 +480,7 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f)
} }
} }
if (_fex != 0) if(_fex != 0)
return record_exception(regs, _fex); return record_exception(regs, _fex);
/* Success and no exceptions detected. */ /* Success and no exceptions detected. */
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/tlbflush.h>
static inline void forget_pte(pte_t page) static inline void forget_pte(pte_t page)
{ {
......
...@@ -201,6 +201,23 @@ __cheetah_flush_tlb_range: ...@@ -201,6 +201,23 @@ __cheetah_flush_tlb_range:
retl retl
/*IC19*/ wrpr %g5, 0x0, %pstate /*IC19*/ wrpr %g5, 0x0, %pstate
.align 32
.globl __flush_tlb_kernel_range
__flush_tlb_kernel_range: /* %o0=start, %o1=end */
cmp %o0, %o1
be,pn %xcc, 2f
sethi %hi(PAGE_SIZE), %o4
sub %o1, %o0, %o3
sub %o3, %o4, %o3
or %o0, 0x20, %o0 ! Nucleus
1: stxa %g0, [%o0 + %o3] ASI_DMMU_DEMAP
stxa %g0, [%o0 + %o3] ASI_IMMU_DEMAP
membar #Sync
brnz,pt %o3, 1b
sub %o3, %o4, %o3
2: retl
flush %g6
__spitfire_flush_tlb_mm_slow: __spitfire_flush_tlb_mm_slow:
rdpr %pstate, %g1 rdpr %pstate, %g1
wrpr %g1, PSTATE_IE, %pstate wrpr %g1, PSTATE_IE, %pstate
...@@ -485,6 +502,26 @@ xcall_flush_tlb_range: ...@@ -485,6 +502,26 @@ xcall_flush_tlb_range:
nop nop
nop nop
.globl xcall_flush_tlb_kernel_range
xcall_flush_tlb_kernel_range:
sethi %hi(PAGE_SIZE - 1), %g2
or %g2, %lo(PAGE_SIZE - 1), %g2
andn %g1, %g2, %g1
andn %g7, %g2, %g7
sub %g7, %g1, %g3
add %g2, 1, %g2
sub %g3, %g2, %g3
or %g1, 0x20, %g1 ! Nucleus
1: stxa %g0, [%g1 + %g3] ASI_DMMU_DEMAP
stxa %g0, [%g1 + %g3] ASI_IMMU_DEMAP
membar #Sync
brnz,pt %g3, 1b
sub %g3, %g2, %g3
retry
nop
nop
nop
/* NOTE: This is SPECIAL!! We do etrap/rtrap however /* NOTE: This is SPECIAL!! We do etrap/rtrap however
* we choose to deal with the "BH's run with * we choose to deal with the "BH's run with
* %pil==15" problem (described in asm/pil.h) * %pil==15" problem (described in asm/pil.h)
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/errno.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/svr4.h> #include <asm/svr4.h>
......
...@@ -2126,9 +2126,9 @@ static void gem_init_hw(struct gem *gp, int restart_link) ...@@ -2126,9 +2126,9 @@ static void gem_init_hw(struct gem *gp, int restart_link)
*/ */
if (restart_link) if (restart_link)
gem_init_phy(gp); gem_init_phy(gp);
gem_init_pause_thresholds(gp);
gem_init_dma(gp); gem_init_dma(gp);
gem_init_mac(gp); gem_init_mac(gp);
gem_init_pause_thresholds(gp);
if (restart_link) { if (restart_link) {
/* Default aneg parameters */ /* Default aneg parameters */
...@@ -2823,7 +2823,7 @@ static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr) ...@@ -2823,7 +2823,7 @@ static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr)
dev_addr[0] = 0x08; dev_addr[0] = 0x08;
dev_addr[1] = 0x00; dev_addr[1] = 0x00;
dev_addr[2] = 0x20; dev_addr[2] = 0x20;
get_random_bytes(dev_addr, 3); get_random_bytes(dev_addr + 3, 3);
return; return;
} }
#endif /* not Sparc and not PPC */ #endif /* not Sparc and not PPC */
......
...@@ -247,7 +247,7 @@ static int default_pll __initdata = 0; ...@@ -247,7 +247,7 @@ static int default_pll __initdata = 0;
static int default_mclk __initdata = 0; static int default_mclk __initdata = 0;
#ifndef MODULE #ifndef MODULE
static const char *mode_option __initdata = NULL; static char *mode_option __initdata = NULL;
#endif #endif
#ifdef CONFIG_PPC #ifdef CONFIG_PPC
...@@ -267,33 +267,33 @@ static unsigned long phys_size[FB_MAX] __initdata = { 0, }; ...@@ -267,33 +267,33 @@ static unsigned long phys_size[FB_MAX] __initdata = { 0, };
static unsigned long phys_guiregbase[FB_MAX] __initdata = { 0, }; static unsigned long phys_guiregbase[FB_MAX] __initdata = { 0, };
#endif #endif
static const char m64n_gx[] __initdata = "mach64GX (ATI888GX00)"; static char m64n_gx[] __initdata = "mach64GX (ATI888GX00)";
static const char m64n_cx[] __initdata = "mach64CX (ATI888CX00)"; static char m64n_cx[] __initdata = "mach64CX (ATI888CX00)";
static const char m64n_ct[] __initdata = "mach64CT (ATI264CT)"; static char m64n_ct[] __initdata = "mach64CT (ATI264CT)";
static const char m64n_et[] __initdata = "mach64ET (ATI264ET)"; static char m64n_et[] __initdata = "mach64ET (ATI264ET)";
static const char m64n_vta3[] __initdata = "mach64VTA3 (ATI264VT)"; static char m64n_vta3[] __initdata = "mach64VTA3 (ATI264VT)";
static const char m64n_vta4[] __initdata = "mach64VTA4 (ATI264VT)"; static char m64n_vta4[] __initdata = "mach64VTA4 (ATI264VT)";
static const char m64n_vtb[] __initdata = "mach64VTB (ATI264VTB)"; static char m64n_vtb[] __initdata = "mach64VTB (ATI264VTB)";
static const char m64n_vt4[] __initdata = "mach64VT4 (ATI264VT4)"; static char m64n_vt4[] __initdata = "mach64VT4 (ATI264VT4)";
static const char m64n_gt[] __initdata = "3D RAGE (GT)"; static char m64n_gt[] __initdata = "3D RAGE (GT)";
static const char m64n_gtb[] __initdata = "3D RAGE II+ (GTB)"; static char m64n_gtb[] __initdata = "3D RAGE II+ (GTB)";
static const char m64n_iic_p[] __initdata = "3D RAGE IIC (PCI)"; static char m64n_iic_p[] __initdata = "3D RAGE IIC (PCI)";
static const char m64n_iic_a[] __initdata = "3D RAGE IIC (AGP)"; static char m64n_iic_a[] __initdata = "3D RAGE IIC (AGP)";
static const char m64n_lt[] __initdata = "3D RAGE LT"; static char m64n_lt[] __initdata = "3D RAGE LT";
static const char m64n_ltg[] __initdata = "3D RAGE LT-G"; static char m64n_ltg[] __initdata = "3D RAGE LT-G";
static const char m64n_gtc_ba[] __initdata = "3D RAGE PRO (BGA, AGP)"; static char m64n_gtc_ba[] __initdata = "3D RAGE PRO (BGA, AGP)";
static const char m64n_gtc_ba1[] __initdata = "3D RAGE PRO (BGA, AGP, 1x only)"; static char m64n_gtc_ba1[] __initdata = "3D RAGE PRO (BGA, AGP, 1x only)";
static const char m64n_gtc_bp[] __initdata = "3D RAGE PRO (BGA, PCI)"; static char m64n_gtc_bp[] __initdata = "3D RAGE PRO (BGA, PCI)";
static const char m64n_gtc_pp[] __initdata = "3D RAGE PRO (PQFP, PCI)"; static char m64n_gtc_pp[] __initdata = "3D RAGE PRO (PQFP, PCI)";
static const char m64n_gtc_ppl[] __initdata = "3D RAGE PRO (PQFP, PCI, limited 3D)"; static char m64n_gtc_ppl[] __initdata = "3D RAGE PRO (PQFP, PCI, limited 3D)";
static const char m64n_xl[] __initdata = "3D RAGE (XL)"; static char m64n_xl[] __initdata = "3D RAGE (XL)";
static const char m64n_ltp_a[] __initdata = "3D RAGE LT PRO (AGP)"; static char m64n_ltp_a[] __initdata = "3D RAGE LT PRO (AGP)";
static const char m64n_ltp_p[] __initdata = "3D RAGE LT PRO (PCI)"; static char m64n_ltp_p[] __initdata = "3D RAGE LT PRO (PCI)";
static const char m64n_mob_p[] __initdata = "3D RAGE Mobility (PCI)"; static char m64n_mob_p[] __initdata = "3D RAGE Mobility (PCI)";
static const char m64n_mob_a[] __initdata = "3D RAGE Mobility (AGP)"; static char m64n_mob_a[] __initdata = "3D RAGE Mobility (AGP)";
static const struct { static struct {
u16 pci_id, chip_type; u16 pci_id, chip_type;
u8 rev_mask, rev_val; u8 rev_mask, rev_val;
const char *name; const char *name;
...@@ -353,24 +353,24 @@ static const struct { ...@@ -353,24 +353,24 @@ static const struct {
#endif /* CONFIG_FB_ATY_CT */ #endif /* CONFIG_FB_ATY_CT */
}; };
static const char ram_dram[] __initdata = "DRAM"; static char ram_dram[] __initdata = "DRAM";
static const char ram_vram[] __initdata = "VRAM"; static char ram_vram[] __initdata = "VRAM";
static const char ram_edo[] __initdata = "EDO"; static char ram_edo[] __initdata = "EDO";
static const char ram_sdram[] __initdata = "SDRAM"; static char ram_sdram[] __initdata = "SDRAM";
static const char ram_sgram[] __initdata = "SGRAM"; static char ram_sgram[] __initdata = "SGRAM";
static const char ram_wram[] __initdata = "WRAM"; static char ram_wram[] __initdata = "WRAM";
static const char ram_off[] __initdata = "OFF"; static char ram_off[] __initdata = "OFF";
static const char ram_resv[] __initdata = "RESV"; static char ram_resv[] __initdata = "RESV";
#ifdef CONFIG_FB_ATY_GX #ifdef CONFIG_FB_ATY_GX
static const char *aty_gx_ram[8] __initdata = { static char *aty_gx_ram[8] __initdata = {
ram_dram, ram_vram, ram_vram, ram_dram, ram_dram, ram_vram, ram_vram, ram_dram,
ram_dram, ram_vram, ram_vram, ram_resv ram_dram, ram_vram, ram_vram, ram_resv
}; };
#endif /* CONFIG_FB_ATY_GX */ #endif /* CONFIG_FB_ATY_GX */
#ifdef CONFIG_FB_ATY_CT #ifdef CONFIG_FB_ATY_CT
static const char *aty_ct_ram[8] __initdata = { static char *aty_ct_ram[8] __initdata = {
ram_off, ram_dram, ram_edo, ram_edo, ram_off, ram_dram, ram_edo, ram_edo,
ram_sdram, ram_sgram, ram_wram, ram_resv ram_sdram, ram_sgram, ram_wram, ram_resv
}; };
......
...@@ -129,7 +129,7 @@ static struct { ...@@ -129,7 +129,7 @@ static struct {
static char curblink __initdata = 1; static char curblink __initdata = 1;
static const struct { static struct {
char name[16]; char name[16];
struct pm2fb_par par; struct pm2fb_par par;
} user_mode[] __initdata = { } user_mode[] __initdata = {
......
...@@ -804,9 +804,10 @@ static int sbusfb_blank(int blank, struct fb_info *info) ...@@ -804,9 +804,10 @@ static int sbusfb_blank(int blank, struct fb_info *info)
struct fb_info_sbusfb *fb = sbusfbinfo(info); struct fb_info_sbusfb *fb = sbusfbinfo(info);
if (blank && fb->blank) if (blank && fb->blank)
return fb->blank(fb); return fb->blank(fb);
else if (!blank && fb->unblank) else if (!blank && fb->unblank)
return fb->unblank(fb); return fb->unblank(fb);
return 0;
} }
/* /*
......
/* apc - Driver definitions for power management functions
* of Aurora Personality Chip (APC) on SPARCstation-4/5 and
* derivatives
*
* Copyright (c) 2001 Eric Brower (ebrower@usa.net)
*
*/
#ifndef _SPARC_APC_H
#define _SPARC_APC_H
#include <linux/ioctl.h>
#define APC_IOC 'A'
#define APCIOCGFANCTL _IOR(APC_IOC, 0x00, int) /* Get fan speed */
#define APCIOCSFANCTL _IOW(APC_IOC, 0x01, int) /* Set fan speed */
#define APCIOCGCPWR _IOR(APC_IOC, 0x02, int) /* Get CPOWER state */
#define APCIOCSCPWR _IOW(APC_IOC, 0x03, int) /* Set CPOWER state */
#define APCIOCGBPORT _IOR(APC_IOC, 0x04, int) /* Get BPORT state */
#define APCIOCSBPORT _IOW(APC_IOC, 0x05, int) /* Set BPORT state */
/*
* Register offsets
*/
#define APC_IDLE_REG 0x00
#define APC_FANCTL_REG 0x20
#define APC_CPOWER_REG 0x24
#define APC_BPORT_REG 0x30
#define APC_REGMASK 0x01
#define APC_BPMASK 0x03
/*
* IDLE - CPU standby values (set to initiate standby)
*/
#define APC_IDLE_ON 0x01
/*
* FANCTL - Fan speed control state values
*/
#define APC_FANCTL_HI 0x00 /* Fan speed high */
#define APC_FANCTL_LO 0x01 /* Fan speed low */
/*
* CPWR - Convenience power outlet state values
*/
#define APC_CPOWER_ON 0x00 /* Conv power on */
#define APC_CPOWER_OFF 0x01 /* Conv power off */
/*
* BPA/BPB - Read-Write "Bit Ports" state values (reset to 0 at power-on)
*
* WARNING: Internal usage of bit ports is platform dependent--
* don't modify BPORT settings unless you know what you are doing.
*
* On SS5 BPA seems to toggle onboard ethernet loopback... -E
*/
#define APC_BPORT_A 0x01 /* Bit Port A */
#define APC_BPORT_B 0x02 /* Bit Port B */
#endif /* !(_SPARC_APC_H) */
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
#define TIOCMBIC _IOW('t', 107, int) #define TIOCMBIC _IOW('t', 107, int)
#define TIOCMBIS _IOW('t', 108, int) #define TIOCMBIS _IOW('t', 108, int)
#define TIOCMSET _IOW('t', 109, int) #define TIOCMSET _IOW('t', 109, int)
#define __TIOCSTART _IO('t', 110) /* SunOS Specific */ #define TIOCSTART _IO('t', 110)
#define __TIOCSTOP _IO('t', 111) /* SunOS Specific */ #define TIOCSTOP _IO('t', 111)
#define TIOCPKT _IOW('t', 112, int) #define TIOCPKT _IOW('t', 112, int)
#define TIOCNOTTY _IO('t', 113) #define TIOCNOTTY _IO('t', 113)
#define TIOCSTI _IOW('t', 114, char) #define TIOCSTI _IOW('t', 114, char)
......
#ifndef __ARCH_SPARC_PERCPU__
#define __ARCH_SPARC_PERCPU__
#include <asm-generic/percpu.h>
#endif /* __ARCH_SPARC_PERCPU__ */
...@@ -175,8 +175,8 @@ ...@@ -175,8 +175,8 @@
#define __NR_statfs 157 /* Common */ #define __NR_statfs 157 /* Common */
#define __NR_fstatfs 158 /* Common */ #define __NR_fstatfs 158 /* Common */
#define __NR_umount 159 /* Common */ #define __NR_umount 159 /* Common */
/* #define __NR_async_daemon 160 SunOS Specific */ #define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */
/* #define __NR_getfh 161 SunOS Specific */ #define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */
#define __NR_getdomainname 162 /* SunOS Specific */ #define __NR_getdomainname 162 /* SunOS Specific */
#define __NR_setdomainname 163 /* Common */ #define __NR_setdomainname 163 /* Common */
/* #define __NR_ni_syscall 164 ENOSYS under SunOS */ /* #define __NR_ni_syscall 164 ENOSYS under SunOS */
......
#ifndef _SPARC64_CACHEFLUSH_H
#define _SPARC64_CACHEFLUSH_H
#include <linux/config.h>
#include <linux/mm.h>
/* Cache flush operations. */
/* These are the same regardless of whether this is an SMP kernel or not. */
#define flush_cache_mm(__mm) \
do { if ((__mm) == current->mm) flushw_user(); } while(0)
extern void flush_cache_range(struct vm_area_struct *, unsigned long, unsigned long);
#define flush_cache_page(vma, page) \
flush_cache_mm((vma)->vm_mm)
/*
* On spitfire, the icache doesn't snoop local stores and we don't
* use block commit stores (which invalidate icache lines) during
* module load, so we need this.
*/
extern void flush_icache_range(unsigned long start, unsigned long end);
extern void __flush_dcache_page(void *addr, int flush_icache);
extern void __flush_icache_page(unsigned long);
extern void flush_dcache_page_impl(struct page *page);
#ifdef CONFIG_SMP
extern void smp_flush_dcache_page_impl(struct page *page, int cpu);
extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
#else
#define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)
#define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)
#endif
extern void __flush_dcache_range(unsigned long start, unsigned long end);
extern void __flush_cache_all(void);
#ifndef CONFIG_SMP
#define flush_cache_all() __flush_cache_all()
#else /* CONFIG_SMP */
extern void smp_flush_cache_all(void);
#endif /* ! CONFIG_SMP */
#define flush_icache_page(vma, pg) do { } while(0)
#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
extern void flush_dcache_page(struct page *page);
/* This is unnecessary on the SpitFire since D-CACHE is write-through. */
#define flush_page_to_ram(page) do { } while (0)
#endif /* _SPARC64_CACHEFLUSH_H */
...@@ -21,8 +21,38 @@ ...@@ -21,8 +21,38 @@
typedef unsigned long elf_greg_t; typedef unsigned long elf_greg_t;
#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) #define ELF_NGREG 36
typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef elf_greg_t elf_gregset_t[ELF_NGREG];
/* Format of 64-bit elf_gregset_t is:
* G0 --> G7
* O0 --> O7
* L0 --> L7
* I0 --> I7
* TSTATE
* TPC
* TNPC
* Y
*/
#define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \
do { unsigned long *dest = &(__elf_regs[0]); \
struct pt_regs *src = (__pt_regs); \
unsigned long *sp; \
int i; \
for(i = 0; i < 16; i++) \
dest[i] = src->u_regs[i]; \
/* Don't try this at home kids... */ \
set_fs(USER_DS); \
sp = (unsigned long *) \
((src->u_regs[14] + STACK_BIAS) \
& 0xfffffffffffffff8UL); \
for(i = 0; i < 16; i++) \
__get_user(dest[i+16], &sp[i]); \
set_fs(KERNEL_DS); \
dest[32] = src->tstate; \
dest[33] = src->tpc; \
dest[34] = src->tnpc; \
dest[35] = src->y; \
} while (0);
typedef struct { typedef struct {
unsigned long pr_regs[32]; unsigned long pr_regs[32];
...@@ -69,10 +99,15 @@ typedef struct { ...@@ -69,10 +99,15 @@ typedef struct {
#ifdef __KERNEL__ #ifdef __KERNEL__
#define SET_PERSONALITY(ex, ibcs2) \ #define SET_PERSONALITY(ex, ibcs2) \
do { if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ do { unsigned long new_flags = current_thread_info()->flags; \
set_thread_flag(TIF_32BIT); \ new_flags &= _TIF_32BIT; \
if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
new_flags |= _TIF_32BIT; \
else \ else \
clear_thread_flag(TIF_32BIT); \ new_flags &= ~_TIF_32BIT; \
if ((current_thread_info()->flags & _TIF_32BIT) \
!= new_flags) \
set_thread_flag(TIF_ABI_PENDING); \
/* flush_thread will update pgd cache */ \ /* flush_thread will update pgd cache */ \
if (ibcs2) \ if (ibcs2) \
set_personality(PER_SVR4); \ set_personality(PER_SVR4); \
......
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
#define TIOCMBIC _IOW('t', 107, int) #define TIOCMBIC _IOW('t', 107, int)
#define TIOCMBIS _IOW('t', 108, int) #define TIOCMBIS _IOW('t', 108, int)
#define TIOCMSET _IOW('t', 109, int) #define TIOCMSET _IOW('t', 109, int)
#define __TIOCSTART _IO('t', 110) /* SunOS Specific */ #define TIOCSTART _IO('t', 110)
#define __TIOCSTOP _IO('t', 111) /* SunOS Specific */ #define TIOCSTOP _IO('t', 111)
#define TIOCPKT _IOW('t', 112, int) #define TIOCPKT _IOW('t', 112, int)
#define TIOCNOTTY _IO('t', 113) #define TIOCNOTTY _IO('t', 113)
#define TIOCSTI _IOW('t', 114, char) #define TIOCSTI _IOW('t', 114, char)
......
#ifndef __ARCH_SPARC64_PERCPU__
#define __ARCH_SPARC64_PERCPU__
#include <asm-generic/percpu.h>
#endif /* __ARCH_SPARC64_PERCPU__ */
...@@ -10,32 +10,6 @@ ...@@ -10,32 +10,6 @@
#include <asm/spitfire.h> #include <asm/spitfire.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
static __inline__ void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start,
unsigned long end)
{
/* Note the signed type. */
long s = start, e = end, vpte_base;
if (s > e)
/* Nobody should call us with start below VM hole and end above.
See if it is really true. */
BUG();
#if 0
/* Currently free_pgtables guarantees this. */
s &= PMD_MASK;
e = (e + PMD_SIZE - 1) & PMD_MASK;
#endif
vpte_base = (tlb_type == spitfire ?
VPTE_BASE_SPITFIRE :
VPTE_BASE_CHEETAH);
{
struct vm_area_struct vma;
vma.vm_mm = mm;
flush_tlb_range(&vma,
vpte_base + (s >> (PAGE_SHIFT - 3)),
vpte_base + (e >> (PAGE_SHIFT - 3)));
}
}
/* Page table allocation/freeing. */ /* Page table allocation/freeing. */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* Sliiiicck */ /* Sliiiicck */
......
...@@ -36,97 +36,6 @@ ...@@ -36,97 +36,6 @@
#define LOW_OBP_ADDRESS 0x00000000f0000000 #define LOW_OBP_ADDRESS 0x00000000f0000000
#define HI_OBP_ADDRESS 0x0000000100000000 #define HI_OBP_ADDRESS 0x0000000100000000
#ifndef __ASSEMBLY__
/* Cache and TLB flush operations. */
/* These are the same regardless of whether this is an SMP kernel or not. */
#define flush_cache_mm(__mm) \
do { if ((__mm) == current->mm) flushw_user(); } while(0)
extern void flush_cache_range(struct vm_area_struct *, unsigned long, unsigned long);
#define flush_cache_page(vma, page) \
flush_cache_mm((vma)->vm_mm)
struct page;
/*
* On spitfire, the icache doesn't snoop local stores and we don't
* use block commit stores (which invalidate icache lines) during
* module load, so we need this.
*/
extern void flush_icache_range(unsigned long start, unsigned long end);
extern void __flush_dcache_page(void *addr, int flush_icache);
extern void __flush_icache_page(unsigned long);
extern void flush_dcache_page_impl(struct page *page);
#ifdef CONFIG_SMP
extern void smp_flush_dcache_page_impl(struct page *page, int cpu);
extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
#else
#define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)
#define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)
#endif
extern void __flush_dcache_range(unsigned long start, unsigned long end);
extern void __flush_cache_all(void);
extern void __flush_tlb_all(void);
extern void __flush_tlb_mm(unsigned long context, unsigned long r);
extern void __flush_tlb_range(unsigned long context, unsigned long start,
unsigned long r, unsigned long end,
unsigned long pgsz, unsigned long size);
extern void __flush_tlb_page(unsigned long context, unsigned long page, unsigned long r);
#ifndef CONFIG_SMP
#define flush_cache_all() __flush_cache_all()
#define flush_tlb_all() __flush_tlb_all()
#define flush_tlb_mm(__mm) \
do { if(CTX_VALID((__mm)->context)) \
__flush_tlb_mm(CTX_HWBITS((__mm)->context), SECONDARY_CONTEXT); \
} while(0)
#define flush_tlb_range(__vma, start, end) \
do { if(CTX_VALID((__vma)->vm_mm->context)) { \
unsigned long __start = (start)&PAGE_MASK; \
unsigned long __end = PAGE_ALIGN(end); \
__flush_tlb_range(CTX_HWBITS((__vma)->vm_mm->context), __start, \
SECONDARY_CONTEXT, __end, PAGE_SIZE, \
(__end - __start)); \
} \
} while(0)
#define flush_tlb_page(vma, page) \
do { struct mm_struct *__mm = (vma)->vm_mm; \
if(CTX_VALID(__mm->context)) \
__flush_tlb_page(CTX_HWBITS(__mm->context), (page)&PAGE_MASK, \
SECONDARY_CONTEXT); \
} while(0)
#else /* CONFIG_SMP */
extern void smp_flush_cache_all(void);
extern void smp_flush_tlb_all(void);
extern void smp_flush_tlb_mm(struct mm_struct *mm);
extern void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end);
extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page);
#define flush_cache_all() smp_flush_cache_all()
#define flush_tlb_all() smp_flush_tlb_all()
#define flush_tlb_mm(mm) smp_flush_tlb_mm(mm)
#define flush_tlb_range(vma, start, end) \
smp_flush_tlb_range(vma, start, end)
#define flush_tlb_page(vma, page) \
smp_flush_tlb_page((vma)->vm_mm, page)
#endif /* ! CONFIG_SMP */
#endif /* ! __ASSEMBLY__ */
/* XXX All of this needs to be rethought so we can take advantage /* XXX All of this needs to be rethought so we can take advantage
* XXX cheetah's full 64-bit virtual address space, ie. no more hole * XXX cheetah's full 64-bit virtual address space, ie. no more hole
* XXX in the middle like on spitfire. -DaveM * XXX in the middle like on spitfire. -DaveM
...@@ -372,9 +281,6 @@ extern pgd_t swapper_pg_dir[1]; ...@@ -372,9 +281,6 @@ extern pgd_t swapper_pg_dir[1];
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
#define flush_icache_page(vma, pg) do { } while(0)
#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
/* Make a non-present pseudo-TTE. */ /* Make a non-present pseudo-TTE. */
extern inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space) extern inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space)
{ {
...@@ -454,11 +360,6 @@ extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, unsi ...@@ -454,11 +360,6 @@ extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, unsi
extern void check_pgt_cache(void); extern void check_pgt_cache(void);
extern void flush_dcache_page(struct page *page);
/* This is unnecessary on the SpitFire since D-CACHE is write-through. */
#define flush_page_to_ram(page) do { } while (0)
#endif /* !(__ASSEMBLY__) */ #endif /* !(__ASSEMBLY__) */
#endif /* !(_SPARC64_PGTABLE_H) */ #endif /* !(_SPARC64_PGTABLE_H) */
...@@ -145,9 +145,9 @@ extern void __flushw_user(void); ...@@ -145,9 +145,9 @@ extern void __flushw_user(void);
#define flush_register_windows flushw_all #define flush_register_windows flushw_all
#define prepare_to_switch flushw_all #define prepare_to_switch flushw_all
#ifndef CONFIG_DEBUG_SPINLOCk #ifndef CONFIG_DEBUG_SPINLOCK
#define CHECK_LOCKS(PREV) do { } while(0) #define CHECK_LOCKS(PREV) do { } while(0)
#else /* CONFIG_DEBUG_SPINLOCk */ #else /* CONFIG_DEBUG_SPINLOCK */
#define CHECK_LOCKS(PREV) \ #define CHECK_LOCKS(PREV) \
if ((PREV)->thread.smp_lock_count) { \ if ((PREV)->thread.smp_lock_count) { \
unsigned long rpc; \ unsigned long rpc; \
...@@ -161,7 +161,7 @@ if ((PREV)->thread.smp_lock_count) { \ ...@@ -161,7 +161,7 @@ if ((PREV)->thread.smp_lock_count) { \
printk(KERN_CRIT "(%s)[%d]: Sched caller %016lx\n", \ printk(KERN_CRIT "(%s)[%d]: Sched caller %016lx\n", \
(PREV)->comm, (PREV)->pid, rpc); \ (PREV)->comm, (PREV)->pid, rpc); \
} }
#endif /* !(CONFIG_DEBUG_SPINLOCk) */ #endif /* !(CONFIG_DEBUG_SPINLOCK) */
/* See what happens when you design the chip correctly? /* See what happens when you design the chip correctly?
* *
......
...@@ -109,6 +109,8 @@ struct thread_info { ...@@ -109,6 +109,8 @@ struct thread_info {
#define THREAD_SHIFT PAGE_SHIFT #define THREAD_SHIFT PAGE_SHIFT
#endif /* PAGE_SHIFT == 13 */ #endif /* PAGE_SHIFT == 13 */
#define PREEMPT_ACTIVE 0x4000000
/* /*
* macros/functions for gaining access to the thread information structure * macros/functions for gaining access to the thread information structure
*/ */
...@@ -193,6 +195,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); ...@@ -193,6 +195,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
#define TIF_BLKCOMMIT 9 /* use ASI_BLK_COMMIT_* in copy_user_page */ #define TIF_BLKCOMMIT 9 /* use ASI_BLK_COMMIT_* in copy_user_page */
#define TIF_POLLING_NRFLAG 10 #define TIF_POLLING_NRFLAG 10
#define TIF_ABI_PENDING 11
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
...@@ -205,6 +208,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); ...@@ -205,6 +208,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
#define _TIF_NEWCHILD (1<<TIF_NEWCHILD) #define _TIF_NEWCHILD (1<<TIF_NEWCHILD)
#define _TIF_BLKCOMMIT (1<<TIF_BLKCOMMIT) #define _TIF_BLKCOMMIT (1<<TIF_BLKCOMMIT)
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \ #define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
(_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
typedef unsigned long cycles_t; typedef unsigned long cycles_t;
#define get_cycles() \ #define get_cycles() \
({ cycles_t ret; \ ({ cycles_t ret; \
__asm__("rd %%tick, %0" : "=r" (ret)); \ __asm__ __volatile__("rd %%tick, %0" : "=r" (ret)); \
ret; \ ret; \
}) })
......
#ifndef _SPARC64_TLBFLUSH_H
#define _SPARC64_TLBFLUSH_H
#include <linux/config.h>
#include <linux/mm.h>
/* TLB flush operations. */
extern void __flush_tlb_all(void);
extern void __flush_tlb_mm(unsigned long context, unsigned long r);
extern void __flush_tlb_range(unsigned long context, unsigned long start,
unsigned long r, unsigned long end,
unsigned long pgsz, unsigned long size);
extern void __flush_tlb_page(unsigned long context, unsigned long page, unsigned long r);
extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end);
#ifndef CONFIG_SMP
#define flush_tlb_all() __flush_tlb_all()
#define flush_tlb_kernel_range(start,end) \
__flush_tlb_kernel_range(start,end)
#define flush_tlb_mm(__mm) \
do { if(CTX_VALID((__mm)->context)) \
__flush_tlb_mm(CTX_HWBITS((__mm)->context), SECONDARY_CONTEXT); \
} while(0)
#define flush_tlb_range(__vma, start, end) \
do { if(CTX_VALID((__vma)->vm_mm->context)) { \
unsigned long __start = (start)&PAGE_MASK; \
unsigned long __end = PAGE_ALIGN(end); \
__flush_tlb_range(CTX_HWBITS((__vma)->vm_mm->context), __start, \
SECONDARY_CONTEXT, __end, PAGE_SIZE, \
(__end - __start)); \
} \
} while(0)
#define flush_tlb_page(vma, page) \
do { struct mm_struct *__mm = (vma)->vm_mm; \
if(CTX_VALID(__mm->context)) \
__flush_tlb_page(CTX_HWBITS(__mm->context), (page)&PAGE_MASK, \
SECONDARY_CONTEXT); \
} while(0)
#else /* CONFIG_SMP */
extern void smp_flush_tlb_all(void);
extern void smp_flush_tlb_mm(struct mm_struct *mm);
extern void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end);
extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end);
extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page);
#define flush_cache_all() smp_flush_cache_all()
#define flush_tlb_all() smp_flush_tlb_all()
#define flush_tlb_mm(mm) smp_flush_tlb_mm(mm)
#define flush_tlb_range(vma, start, end) \
smp_flush_tlb_range(vma, start, end)
#define flush_tlb_kernel_range(start, end) \
smp_flush_tlb_kernel_range(start, end)
#define flush_tlb_page(vma, page) \
smp_flush_tlb_page((vma)->vm_mm, page)
#endif /* ! CONFIG_SMP */
static __inline__ void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start,
unsigned long end)
{
/* Note the signed type. */
long s = start, e = end, vpte_base;
if (s > e)
/* Nobody should call us with start below VM hole and end above.
See if it is really true. */
BUG();
#if 0
/* Currently free_pgtables guarantees this. */
s &= PMD_MASK;
e = (e + PMD_SIZE - 1) & PMD_MASK;
#endif
vpte_base = (tlb_type == spitfire ?
VPTE_BASE_SPITFIRE :
VPTE_BASE_CHEETAH);
{
struct vm_area_struct vma;
vma.vm_mm = mm;
flush_tlb_range(&vma,
vpte_base + (s >> (PAGE_SHIFT - 3)),
vpte_base + (e >> (PAGE_SHIFT - 3)));
}
}
#endif /* _SPARC64_TLBFLUSH_H */
...@@ -175,8 +175,8 @@ ...@@ -175,8 +175,8 @@
#define __NR_statfs 157 /* Common */ #define __NR_statfs 157 /* Common */
#define __NR_fstatfs 158 /* Common */ #define __NR_fstatfs 158 /* Common */
#define __NR_umount 159 /* Common */ #define __NR_umount 159 /* Common */
/* #define __NR_async_daemon 160 SunOS Specific */ #define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */
/* #define __NR_getfh 161 SunOS Specific */ #define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */
#define __NR_getdomainname 162 /* SunOS Specific */ #define __NR_getdomainname 162 /* SunOS Specific */
#define __NR_setdomainname 163 /* Common */ #define __NR_setdomainname 163 /* Common */
#define __NR_utrap_install 164 /* SYSV ABI/v9 required */ #define __NR_utrap_install 164 /* SYSV ABI/v9 required */
...@@ -184,24 +184,24 @@ ...@@ -184,24 +184,24 @@
/* #define __NR_exportfs 166 SunOS Specific */ /* #define __NR_exportfs 166 SunOS Specific */
#define __NR_mount 167 /* Common */ #define __NR_mount 167 /* Common */
#define __NR_ustat 168 /* Common */ #define __NR_ustat 168 /* Common */
/* #define __NR_semsys 169 SunOS Specific */ #define __NR_setxattr 169 /* SunOS: semsys */
/* #define __NR_msgsys 170 SunOS Specific */ #define __NR_lsetxattr 170 /* SunOS: msgsys */
/* #define __NR_shmsys 171 SunOS Specific */ #define __NR_fsetxattr 171 /* SunOS: shmsys */
/* #define __NR_auditsys 172 SunOS Specific */ #define __NR_getxattr 172 /* SunOS: auditsys */
/* #define __NR_rfssys 173 SunOS Specific */ #define __NR_lgetxattr 173 /* SunOS: rfssys */
#define __NR_getdents 174 /* Common */ #define __NR_getdents 174 /* Common */
#define __NR_setsid 175 /* Common */ #define __NR_setsid 175 /* Common */
#define __NR_fchdir 176 /* Common */ #define __NR_fchdir 176 /* Common */
/* #define __NR_fchroot 177 SunOS Specific */ #define __NR_fgetxattr 177 /* SunOS: fchroot */
/* #define __NR_vpixsys 178 SunOS Specific */ #define __NR_listxattr 178 /* SunOS: vpixsys */
/* #define __NR_aioread 179 SunOS Specific */ #define __NR_llistxattr 179 /* SunOS: aioread */
/* #define __NR_aiowrite 180 SunOS Specific */ #define __NR_flistxattr 180 /* SunOS: aiowrite */
/* #define __NR_aiowait 181 SunOS Specific */ #define __NR_removexattr 181 /* SunOS: aiowait */
/* #define __NR_aiocancel 182 SunOS Specific */ #define __NR_lremovexattr 182 /* SunOS: aiocancel */
#define __NR_sigpending 183 /* Common */ #define __NR_sigpending 183 /* Common */
#define __NR_query_module 184 /* Linux Specific */ #define __NR_query_module 184 /* Linux Specific */
#define __NR_setpgid 185 /* Common */ #define __NR_setpgid 185 /* Common */
/* #define __NR_pathconf 186 SunOS Specific */ #define __NR_fremovexattr 186 /* SunOS: pathconf */
#define __NR_tkill 187 /* SunOS: fpathconf */ #define __NR_tkill 187 /* SunOS: fpathconf */
/* #define __NR_sysconf 188 SunOS Specific */ /* #define __NR_sysconf 188 SunOS Specific */
#define __NR_uname 189 /* Linux Specific */ #define __NR_uname 189 /* Linux Specific */
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define __MATH_EMU_OP_COMMON_H__ #define __MATH_EMU_OP_COMMON_H__
#define _FP_DECL(wc, X) \ #define _FP_DECL(wc, X) \
_FP_I_TYPE X##_c, X##_s, X##_e; \ _FP_I_TYPE X##_c=0, X##_s=0, X##_e=0; \
_FP_FRAC_DECL_##wc(X) _FP_FRAC_DECL_##wc(X)
/* /*
...@@ -780,11 +780,12 @@ do { \ ...@@ -780,11 +780,12 @@ do { \
X##_e -= (_FP_W_TYPE_SIZE - rsize); \ X##_e -= (_FP_W_TYPE_SIZE - rsize); \
X##_e = rsize - X##_e - 1; \ X##_e = rsize - X##_e - 1; \
\ \
if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e) \
__FP_FRAC_SRS_1(r, (X##_e - _FP_WFRACBITS_##fs), rsize); \
r &= ~((rtype)1 << X##_e); \ r &= ~((rtype)1 << X##_e); \
if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e) \
__FP_FRAC_SRS_1(r, (X##_e - _FP_WFRACBITS_##fs + 1), rsize); \
_FP_FRAC_DISASSEMBLE_##wc(X, ((unsigned rtype)r), rsize); \ _FP_FRAC_DISASSEMBLE_##wc(X, ((unsigned rtype)r), rsize); \
_FP_FRAC_SLL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1)); \ if ((_FP_WFRACBITS_##fs - X##_e - 1) > 0) \
_FP_FRAC_SLL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1)); \
} \ } \
else \ else \
{ \ { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment