Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3002
b: refs/heads/master
c: d7152fe
h: refs/heads/master
v: v3
  • Loading branch information
David Gibson authored and Paul Mackerras committed Jun 23, 2005
1 parent f4f9d9b commit fd4f014
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dad32bbf43b496bcd32a83f73a1e7fd0a02cfd3e
refs/heads/master: d7152fe14cad075d6dd4ee4194acd131aed0244e
62 changes: 61 additions & 1 deletion trunk/arch/ppc64/kernel/maple_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,77 @@ extern int maple_pci_get_legacy_ide_irq(struct pci_dev *dev, int channel);
extern void generic_find_legacy_serial_ports(u64 *physport,
unsigned int *default_speed);


static void maple_restart(char *cmd)
{
unsigned int maple_nvram_base;
unsigned int maple_nvram_offset;
unsigned int maple_nvram_command;
struct device_node *rtcs;

/* find NVRAM device */
rtcs = find_compatible_devices("nvram", "AMD8111");
if (rtcs && rtcs->addrs) {
maple_nvram_base = rtcs->addrs[0].address;
} else {
printk(KERN_EMERG "Maple: Unable to find NVRAM\n");
printk(KERN_EMERG "Maple: Manual Restart Required\n");
return;
}

/* find service processor device */
rtcs = find_devices("service-processor");
if (!rtcs) {
printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
printk(KERN_EMERG "Maple: Manual Restart Required\n");
return;
}
maple_nvram_offset = *(unsigned int*) get_property(rtcs,
"restart-addr", NULL);
maple_nvram_command = *(unsigned int*) get_property(rtcs,
"restart-value", NULL);

/* send command */
outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
for (;;) ;
}

static void maple_power_off(void)
{
unsigned int maple_nvram_base;
unsigned int maple_nvram_offset;
unsigned int maple_nvram_command;
struct device_node *rtcs;

/* find NVRAM device */
rtcs = find_compatible_devices("nvram", "AMD8111");
if (rtcs && rtcs->addrs) {
maple_nvram_base = rtcs->addrs[0].address;
} else {
printk(KERN_EMERG "Maple: Unable to find NVRAM\n");
printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
return;
}

/* find service processor device */
rtcs = find_devices("service-processor");
if (!rtcs) {
printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
return;
}
maple_nvram_offset = *(unsigned int*) get_property(rtcs,
"power-off-addr", NULL);
maple_nvram_command = *(unsigned int*) get_property(rtcs,
"power-off-value", NULL);

/* send command */
outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
for (;;) ;
}

static void maple_halt(void)
{
maple_power_off();
}

#ifdef CONFIG_SMP
Expand Down
18 changes: 18 additions & 0 deletions trunk/arch/ppc64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,12 @@ void machine_restart(char *cmd)
if (ppc_md.nvram_sync)
ppc_md.nvram_sync();
ppc_md.restart(cmd);
#ifdef CONFIG_SMP
smp_send_stop();
#endif
printk(KERN_EMERG "System Halted, OK to turn off power\n");
local_irq_disable();
while (1) ;
}

EXPORT_SYMBOL(machine_restart);
Expand All @@ -692,6 +698,12 @@ void machine_power_off(void)
if (ppc_md.nvram_sync)
ppc_md.nvram_sync();
ppc_md.power_off();
#ifdef CONFIG_SMP
smp_send_stop();
#endif
printk(KERN_EMERG "System Halted, OK to turn off power\n");
local_irq_disable();
while (1) ;
}

EXPORT_SYMBOL(machine_power_off);
Expand All @@ -701,6 +713,12 @@ void machine_halt(void)
if (ppc_md.nvram_sync)
ppc_md.nvram_sync();
ppc_md.halt();
#ifdef CONFIG_SMP
smp_send_stop();
#endif
printk(KERN_EMERG "System Halted, OK to turn off power\n");
local_irq_disable();
while (1) ;
}

EXPORT_SYMBOL(machine_halt);
Expand Down

0 comments on commit fd4f014

Please sign in to comment.