2005-04-17 02:20:36 +04:00
|
|
|
/*
|
2005-10-29 16:07:56 +04:00
|
|
|
* Maple (970 eval board) setup code
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
|
|
|
* (c) Copyright 2004 Benjamin Herrenschmidt (benh@kernel.crashing.org),
|
|
|
|
* IBM Corp.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define DEBUG
|
|
|
|
|
|
|
|
#include <linux/config.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/stddef.h>
|
|
|
|
#include <linux/unistd.h>
|
|
|
|
#include <linux/ptrace.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/user.h>
|
|
|
|
#include <linux/a.out.h>
|
|
|
|
#include <linux/tty.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/major.h>
|
|
|
|
#include <linux/initrd.h>
|
|
|
|
#include <linux/vt_kern.h>
|
|
|
|
#include <linux/console.h>
|
|
|
|
#include <linux/ide.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/adb.h>
|
|
|
|
#include <linux/cuda.h>
|
|
|
|
#include <linux/pmu.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/root_dev.h>
|
|
|
|
#include <linux/serial.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/sections.h>
|
|
|
|
#include <asm/prom.h>
|
|
|
|
#include <asm/system.h>
|
|
|
|
#include <asm/pgtable.h>
|
|
|
|
#include <asm/bitops.h>
|
|
|
|
#include <asm/io.h>
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 15:35:00 +03:00
|
|
|
#include <asm/kexec.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/pci-bridge.h>
|
|
|
|
#include <asm/iommu.h>
|
|
|
|
#include <asm/machdep.h>
|
|
|
|
#include <asm/dma.h>
|
|
|
|
#include <asm/cputable.h>
|
|
|
|
#include <asm/time.h>
|
|
|
|
#include <asm/of_device.h>
|
|
|
|
#include <asm/lmb.h>
|
2005-09-27 07:51:59 +04:00
|
|
|
#include <asm/mpic.h>
|
2005-10-10 16:50:37 +04:00
|
|
|
#include <asm/udbg.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-10-29 16:07:56 +04:00
|
|
|
#include "maple.h"
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
#define DBG(fmt...) udbg_printf(fmt)
|
|
|
|
#else
|
|
|
|
#define DBG(fmt...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern void generic_find_legacy_serial_ports(u64 *physport,
|
|
|
|
unsigned int *default_speed);
|
|
|
|
|
|
|
|
static void maple_restart(char *cmd)
|
|
|
|
{
|
2005-06-23 11:14:39 +04:00
|
|
|
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 (;;) ;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void maple_power_off(void)
|
|
|
|
{
|
2005-06-23 11:14:39 +04:00
|
|
|
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 (;;) ;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void maple_halt(void)
|
|
|
|
{
|
2005-06-23 11:14:39 +04:00
|
|
|
maple_power_off();
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
struct smp_ops_t maple_smp_ops = {
|
|
|
|
.probe = smp_mpic_probe,
|
|
|
|
.message_pass = smp_mpic_message_pass,
|
|
|
|
.kick_cpu = smp_generic_kick_cpu,
|
|
|
|
.setup_cpu = smp_mpic_setup_cpu,
|
|
|
|
.give_timebase = smp_generic_give_timebase,
|
|
|
|
.take_timebase = smp_generic_take_timebase,
|
|
|
|
};
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
|
|
|
|
void __init maple_setup_arch(void)
|
|
|
|
{
|
|
|
|
/* init to some ~sane value until calibrate_delay() runs */
|
|
|
|
loops_per_jiffy = 50000000;
|
|
|
|
|
|
|
|
/* Setup SMP callback */
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
smp_ops = &maple_smp_ops;
|
|
|
|
#endif
|
|
|
|
/* Lookup PCI hosts */
|
|
|
|
maple_pci_init();
|
|
|
|
|
|
|
|
#ifdef CONFIG_DUMMY_CONSOLE
|
|
|
|
conswitchp = &dummy_con;
|
|
|
|
#endif
|
2005-07-08 04:56:30 +04:00
|
|
|
|
|
|
|
printk(KERN_INFO "Using native/NAP idle loop\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Early initialization.
|
|
|
|
*/
|
|
|
|
static void __init maple_init_early(void)
|
|
|
|
{
|
|
|
|
unsigned int default_speed;
|
|
|
|
u64 physport;
|
|
|
|
|
|
|
|
DBG(" -> maple_init_early\n");
|
|
|
|
|
|
|
|
/* Initialize hash table, from now on, we can take hash faults
|
|
|
|
* and call ioremap
|
|
|
|
*/
|
|
|
|
hpte_init_native();
|
|
|
|
|
|
|
|
/* Setup interrupt mapping options */
|
|
|
|
ppc64_interrupt_controller = IC_OPEN_PIC;
|
|
|
|
|
|
|
|
iommu_init_early_u3();
|
|
|
|
|
|
|
|
DBG(" <- maple_init_early\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static __init void maple_init_IRQ(void)
|
|
|
|
{
|
|
|
|
struct device_node *root;
|
|
|
|
unsigned int *opprop;
|
|
|
|
unsigned long opic_addr;
|
|
|
|
struct mpic *mpic;
|
|
|
|
unsigned char senses[128];
|
|
|
|
int n;
|
|
|
|
|
|
|
|
DBG(" -> maple_init_IRQ\n");
|
|
|
|
|
|
|
|
/* XXX: Non standard, replace that with a proper openpic/mpic node
|
|
|
|
* in the device-tree. Find the Open PIC if present */
|
|
|
|
root = of_find_node_by_path("/");
|
|
|
|
opprop = (unsigned int *) get_property(root,
|
|
|
|
"platform-open-pic", NULL);
|
|
|
|
if (opprop == 0)
|
|
|
|
panic("OpenPIC not found !\n");
|
|
|
|
|
|
|
|
n = prom_n_addr_cells(root);
|
|
|
|
for (opic_addr = 0; n > 0; --n)
|
|
|
|
opic_addr = (opic_addr << 32) + *opprop++;
|
|
|
|
of_node_put(root);
|
|
|
|
|
|
|
|
/* Obtain sense values from device-tree */
|
|
|
|
prom_get_irq_senses(senses, 0, 128);
|
|
|
|
|
|
|
|
mpic = mpic_alloc(opic_addr,
|
|
|
|
MPIC_PRIMARY | MPIC_BIG_ENDIAN |
|
|
|
|
MPIC_BROKEN_U3 | MPIC_WANTS_RESET,
|
|
|
|
0, 0, 128, 128, senses, 128, "U3-MPIC");
|
|
|
|
BUG_ON(mpic == NULL);
|
|
|
|
mpic_init(mpic);
|
|
|
|
|
|
|
|
DBG(" <- maple_init_IRQ\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init maple_progress(char *s, unsigned short hex)
|
|
|
|
{
|
|
|
|
printk("*** %04x : %s\n", hex, s ? s : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called very early, MMU is off, device-tree isn't unflattened
|
|
|
|
*/
|
|
|
|
static int __init maple_probe(int platform)
|
|
|
|
{
|
|
|
|
if (platform != PLATFORM_MAPLE)
|
|
|
|
return 0;
|
|
|
|
/*
|
|
|
|
* On U3, the DART (iommu) must be allocated now since it
|
|
|
|
* has an impact on htab_initialize (due to the large page it
|
|
|
|
* occupies having to be broken up so the DART itself is not
|
|
|
|
* part of the cacheable linar mapping
|
|
|
|
*/
|
|
|
|
alloc_u3_dart_table();
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct machdep_calls __initdata maple_md = {
|
|
|
|
.probe = maple_probe,
|
|
|
|
.setup_arch = maple_setup_arch,
|
|
|
|
.init_early = maple_init_early,
|
|
|
|
.init_IRQ = maple_init_IRQ,
|
|
|
|
.get_irq = mpic_get_irq,
|
|
|
|
.pcibios_fixup = maple_pcibios_fixup,
|
|
|
|
.pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
|
|
|
|
.restart = maple_restart,
|
|
|
|
.power_off = maple_power_off,
|
|
|
|
.halt = maple_halt,
|
|
|
|
.get_boot_time = maple_get_boot_time,
|
|
|
|
.set_rtc_time = maple_set_rtc_time,
|
|
|
|
.get_rtc_time = maple_get_rtc_time,
|
2005-06-23 03:43:07 +04:00
|
|
|
.calibrate_decr = generic_calibrate_decr,
|
2005-04-17 02:20:36 +04:00
|
|
|
.progress = maple_progress,
|
2005-07-08 04:56:30 +04:00
|
|
|
.idle_loop = native_idle,
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 15:35:00 +03:00
|
|
|
#ifdef CONFIG_KEXEC
|
|
|
|
.machine_kexec = default_machine_kexec,
|
|
|
|
.machine_kexec_prepare = default_machine_kexec_prepare,
|
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|