Skip to content

Commit

Permalink
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…davem/sparc-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SPARC64]: Fix two year old bug in early bootup asm.
  [SPARC64]: Update defconfig.
  [SPARC64]: Fix log message type in vio_create_one().
  [SPARC64]: Tweak assertions in sun4v_build_virq().
  [SPARC64]: Tweak kernel log messages in power_probe().
  [SPARC64]: Fix handling of multiple vdc-port nodes.
  [SPARC64]: Fix device type matching in VIO's devspec_show().
  [SPARC64]: Fix MODULE_DEVICE_TABLE() specification in VDC and VNET.
  [SPARC]: Add sys_fallocate() entries.
  [SPARC64]: Use orderly_poweroff().
  • Loading branch information
Linus Torvalds committed Jul 20, 2007
2 parents 52a2368 + 78d0012 commit 5ac12c6
Show file tree
Hide file tree
Showing 16 changed files with 136 additions and 133 deletions.
9 changes: 4 additions & 5 deletions arch/sparc/kernel/systbls.S
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* $Id: systbls.S,v 1.103 2002/02/08 03:57:14 davem Exp $
* systbls.S: System call entry point tables for OS compatibility.
/* systbls.S: System call entry point tables for OS compatibility.
* The native Linux system call table lives here also.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
*
* Based upon preliminary work which is:
*
Expand Down Expand Up @@ -80,7 +79,7 @@ sys_call_table:
/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
/*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy
/*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd, sys_eventfd
/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd, sys_eventfd, sys_fallocate

#ifdef CONFIG_SUNOS_EMUL
/* Now the SunOS syscall table. */
Expand Down Expand Up @@ -198,6 +197,6 @@ sunos_sys_table:
.long sunos_nosys, sunos_nosys, sunos_nosys
.long sunos_nosys
/*310*/ .long sunos_nosys, sunos_nosys, sunos_nosys
.long sunos_nosys
.long sunos_nosys, sunos_nosys

#endif
24 changes: 13 additions & 11 deletions arch/sparc64/defconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.22
# Tue Jul 17 01:19:52 2007
# Thu Jul 19 21:30:37 2007
#
CONFIG_SPARC=y
CONFIG_SPARC64=y
Expand All @@ -16,6 +16,7 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_NO_VIRT_TO_BUS=y
CONFIG_SPARC64_PAGE_SIZE_8KB=y
# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
# CONFIG_SPARC64_PAGE_SIZE_512KB is not set
Expand Down Expand Up @@ -148,7 +149,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_RESOURCES_64BIT=y
CONFIG_ZONE_DMA_FLAG=0
CONFIG_NR_QUICK=1
CONFIG_VIRT_TO_BUS=y
CONFIG_SBUS=y
CONFIG_SBUSCHAR=y
CONFIG_SUN_AUXIO=y
Expand Down Expand Up @@ -317,7 +317,6 @@ CONFIG_CONNECTOR=m
# CONFIG_PARPORT is not set
CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_FD is not set
# CONFIG_BLK_CPQ_DA is not set
# CONFIG_BLK_CPQ_CISS_DA is not set
# CONFIG_BLK_DEV_DAC960 is not set
# CONFIG_BLK_DEV_UMEM is not set
Expand Down Expand Up @@ -470,10 +469,6 @@ CONFIG_ISCSI_TCP=m
# CONFIG_SCSI_SUNESP is not set
# CONFIG_SCSI_SRP is not set
# CONFIG_ATA is not set

#
# Multi-device support (RAID and LVM)
#
CONFIG_MD=y
CONFIG_BLK_DEV_MD=m
CONFIG_MD_LINEAR=m
Expand Down Expand Up @@ -610,10 +605,6 @@ CONFIG_SLHC=m
# CONFIG_NETCONSOLE is not set
# CONFIG_NETPOLL is not set
# CONFIG_NET_POLL_CONTROLLER is not set

#
# ISDN subsystem
#
# CONFIG_ISDN is not set
# CONFIG_PHONE is not set

Expand Down Expand Up @@ -782,6 +773,7 @@ CONFIG_I2C_ALGOBIT=y
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
# CONFIG_SENSORS_ABITUGURU is not set
# CONFIG_SENSORS_ABITUGURU3 is not set
# CONFIG_SENSORS_AD7418 is not set
# CONFIG_SENSORS_ADM1021 is not set
# CONFIG_SENSORS_ADM1025 is not set
Expand All @@ -808,11 +800,13 @@ CONFIG_HWMON=y
# CONFIG_SENSORS_LM87 is not set
# CONFIG_SENSORS_LM90 is not set
# CONFIG_SENSORS_LM92 is not set
# CONFIG_SENSORS_LM93 is not set
# CONFIG_SENSORS_MAX1619 is not set
# CONFIG_SENSORS_MAX6650 is not set
# CONFIG_SENSORS_PC87360 is not set
# CONFIG_SENSORS_PC87427 is not set
# CONFIG_SENSORS_SIS5595 is not set
# CONFIG_SENSORS_DME1737 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
# CONFIG_SENSORS_SMSC47M192 is not set
# CONFIG_SENSORS_SMSC47B397 is not set
Expand Down Expand Up @@ -906,6 +900,7 @@ CONFIG_FB_RADEON_I2C=y
# CONFIG_PROM_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
CONFIG_FONTS=y
# CONFIG_FONT_8x8 is not set
Expand Down Expand Up @@ -1195,6 +1190,11 @@ CONFIG_USB_STORAGE=m
# DMA Devices
#

#
# Userspace I/O
#
# CONFIG_UIO is not set

#
# Misc Linux/SPARC drivers
#
Expand Down Expand Up @@ -1385,6 +1385,7 @@ CONFIG_SCHEDSTATS=y
# CONFIG_DEBUG_MUTEXES is not set
# CONFIG_DEBUG_LOCK_ALLOC is not set
# CONFIG_PROVE_LOCKING is not set
# CONFIG_LOCK_STAT is not set
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_DEBUG_KOBJECT is not set
Expand Down Expand Up @@ -1461,6 +1462,7 @@ CONFIG_CRC_CCITT=m
CONFIG_CRC16=m
# CONFIG_CRC_ITU_T is not set
CONFIG_CRC32=y
# CONFIG_CRC7 is not set
CONFIG_LIBCRC32C=m
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
Expand Down
6 changes: 2 additions & 4 deletions arch/sparc64/kernel/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/kthread.h>
#include <linux/reboot.h>
#include <linux/cpu.h>

#include <asm/ldc.h>
#include <asm/vio.h>
#include <asm/power.h>
#include <asm/mdesc.h>
#include <asm/head.h>
#include <asm/irq.h>
Expand Down Expand Up @@ -328,7 +328,7 @@ static void domain_shutdown_data(struct ldc_channel *lp,

ds_send(lp, &pkt, sizeof(pkt));

wake_up_powerd();
orderly_poweroff(true);
}

struct ds_panic_req {
Expand Down Expand Up @@ -1133,8 +1133,6 @@ static int __devinit ds_probe(struct vio_dev *vdev,

ds_info = dp;

start_powerd();

return err;

out_free_ldc:
Expand Down
1 change: 0 additions & 1 deletion arch/sparc64/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ tlb_fixup_done:
or %g6, %lo(init_thread_union), %g6
ldx [%g6 + TI_TASK], %g4
mov %sp, %l6
mov %o4, %l7

wr %g0, ASI_P, %asi
mov 1, %g1
Expand Down
4 changes: 2 additions & 2 deletions arch/sparc64/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,10 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
{
unsigned long sysino, hv_err;

BUG_ON(devhandle & ~IMAP_IGN);
BUG_ON(devino & ~IMAP_INO);
BUG_ON(devhandle & devino);

sysino = devhandle | devino;
BUG_ON(sysino & ~(IMAP_IGN | IMAP_INO));

hv_err = sun4v_vintr_set_cookie(devhandle, devino, sysino);
if (hv_err) {
Expand Down
56 changes: 52 additions & 4 deletions arch/sparc64/kernel/mdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,25 @@ void mdesc_register_notifier(struct mdesc_notifier_client *client)
mutex_unlock(&mdesc_mutex);
}

static const u64 *parent_cfg_handle(struct mdesc_handle *hp, u64 node)
{
const u64 *id;
u64 a;

id = NULL;
mdesc_for_each_arc(a, hp, node, MDESC_ARC_TYPE_BACK) {
u64 target;

target = mdesc_arc_target(hp, a);
id = mdesc_get_property(hp, target,
"cfg-handle", NULL);
if (id)
break;
}

return id;
}

/* Run 'func' on nodes which are in A but not in B. */
static void invoke_on_missing(const char *name,
struct mdesc_handle *a,
Expand All @@ -240,13 +259,42 @@ static void invoke_on_missing(const char *name,
u64 node;

mdesc_for_each_node_by_name(a, node, name) {
const u64 *id = mdesc_get_property(a, node, "id", NULL);
int found = 0;
int found = 0, is_vdc_port = 0;
const char *name_prop;
const u64 *id;
u64 fnode;

name_prop = mdesc_get_property(a, node, "name", NULL);
if (name_prop && !strcmp(name_prop, "vdc-port")) {
is_vdc_port = 1;
id = parent_cfg_handle(a, node);
} else
id = mdesc_get_property(a, node, "id", NULL);

if (!id) {
printk(KERN_ERR "MD: Cannot find ID for %s node.\n",
(name_prop ? name_prop : name));
continue;
}

mdesc_for_each_node_by_name(b, fnode, name) {
const u64 *fid = mdesc_get_property(b, fnode,
"id", NULL);
const u64 *fid;

if (is_vdc_port) {
name_prop = mdesc_get_property(b, fnode,
"name", NULL);
if (!name_prop ||
strcmp(name_prop, "vdc-port"))
continue;
fid = parent_cfg_handle(b, fnode);
if (!fid) {
printk(KERN_ERR "MD: Cannot find ID "
"for vdc-port node.\n");
continue;
}
} else
fid = mdesc_get_property(b, fnode,
"id", NULL);

if (*id == *fid) {
found = 1;
Expand Down
64 changes: 3 additions & 61 deletions arch/sparc64/kernel/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <linux/syscalls.h>
#include <linux/reboot.h>

#include <asm/system.h>
#include <asm/auxio.h>
#include <asm/prom.h>
#include <asm/of_device.h>
#include <asm/io.h>
#include <asm/power.h>
#include <asm/sstate.h>

#include <linux/unistd.h>
Expand All @@ -31,20 +31,9 @@ int scons_pwroff = 1;

static void __iomem *power_reg;

static DECLARE_WAIT_QUEUE_HEAD(powerd_wait);
static int button_pressed;

void wake_up_powerd(void)
{
if (button_pressed == 0) {
button_pressed = 1;
wake_up(&powerd_wait);
}
}

static irqreturn_t power_handler(int irq, void *dev_id)
{
wake_up_powerd();
orderly_poweroff(true);

/* FIXME: Check registers for status... */
return IRQ_HANDLED;
Expand Down Expand Up @@ -77,48 +66,6 @@ void machine_power_off(void)
void (*pm_power_off)(void) = machine_power_off;
EXPORT_SYMBOL(pm_power_off);

static int powerd(void *__unused)
{
static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
char *argv[] = { "/sbin/shutdown", "-h", "now", NULL };
DECLARE_WAITQUEUE(wait, current);

daemonize("powerd");

add_wait_queue(&powerd_wait, &wait);

for (;;) {
set_task_state(current, TASK_INTERRUPTIBLE);
if (button_pressed)
break;
flush_signals(current);
schedule();
}
__set_current_state(TASK_RUNNING);
remove_wait_queue(&powerd_wait, &wait);

/* Ok, down we go... */
button_pressed = 0;
if (kernel_execve("/sbin/shutdown", argv, envp) < 0) {
printk(KERN_ERR "powerd: shutdown execution failed\n");
machine_power_off();
}
return 0;
}

int start_powerd(void)
{
int err;

err = kernel_thread(powerd, NULL, CLONE_FS);
if (err < 0)
printk(KERN_ERR "power: Failed to start power daemon.\n");
else
printk(KERN_INFO "power: powerd running.\n");

return err;
}

static int __init has_button_interrupt(unsigned int irq, struct device_node *dp)
{
if (irq == 0xffffffff)
Expand All @@ -136,20 +83,15 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id

power_reg = of_ioremap(res, 0, 0x4, "power");

printk("%s: Control reg at %lx ... ",
printk(KERN_INFO "%s: Control reg at %lx\n",
op->node->name, res->start);

poweroff_method = machine_halt; /* able to use the standard halt */

if (has_button_interrupt(irq, op->node)) {
if (start_powerd() < 0)
return 0;

if (request_irq(irq,
power_handler, 0, "power", NULL) < 0)
printk(KERN_ERR "power: Cannot setup IRQ handler.\n");
} else {
printk(KERN_INFO "power: Not using powerd.\n");
}

return 0;
Expand Down
12 changes: 9 additions & 3 deletions arch/sparc64/kernel/sys_sparc32.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* $Id: sys_sparc32.c,v 1.184 2002/02/09 19:49:31 davem Exp $
* sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
/* sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
*
* Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1997, 2007 David S. Miller (davem@davemloft.net)
*
* These routines maintain argument size conversion between 32bit and 64bit
* environment.
Expand Down Expand Up @@ -1028,3 +1027,10 @@ long compat_sync_file_range(int fd, unsigned long off_high, unsigned long off_lo
(nb_high << 32) | nb_low,
flags);
}

asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo,
u32 lenhi, u32 lenlo)
{
return sys_fallocate(fd, mode, ((loff_t)offhi << 32) | offlo,
((loff_t)lenhi << 32) | lenlo);
}
Loading

0 comments on commit 5ac12c6

Please sign in to comment.