Commit 96665822 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
  [POWERPC] Fix SLB initialization at boot time
  [POWERPC] Fix undefined reference to device_power_up/resume
  [POWERPC] cell: Update cell_defconfig for 2.6.23
  [POWERPC] axonram: Do not delete gendisks queue in error path
  [POWERPC] axonram: Module modification for latest firmware API changes
  [POWERPC] cell: Support pinhole-reset on IBM cell blades
  [POWERPC] spu_manage: Use newer physical-id attribute
  [POWERPC] pasemi: Another IOMMU bugfix for 64K PAGE_SIZE
parents d96a2a5c 175587cc
This diff is collapsed.
......@@ -74,6 +74,22 @@ static inline void slb_shadow_clear(unsigned long entry)
get_slb_shadow()->save_area[entry].esid = 0;
}
static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags,
unsigned long entry)
{
/*
* Updating the shadow buffer before writing the SLB ensures
* we don't get a stale entry here if we get preempted by PHYP
* between these two statements.
*/
slb_shadow_update(ea, flags, entry);
asm volatile("slbmte %0,%1" :
: "r" (mk_vsid_data(ea, flags)),
"r" (mk_esid_data(ea, entry))
: "memory" );
}
void slb_flush_and_rebolt(void)
{
/* If you change this make sure you change SLB_NUM_BOLTED
......@@ -226,12 +242,16 @@ void slb_initialize(void)
vflags = SLB_VSID_KERNEL | vmalloc_llp;
/* Invalidate the entire SLB (even slot 0) & all the ERATS */
slb_shadow_update(PAGE_OFFSET, lflags, 0);
asm volatile("isync; slbia; sync; slbmte %0,%1; isync" ::
"r" (get_slb_shadow()->save_area[0].vsid),
"r" (get_slb_shadow()->save_area[0].esid) : "memory");
slb_shadow_update(VMALLOC_START, vflags, 1);
slb_flush_and_rebolt();
asm volatile("isync":::"memory");
asm volatile("slbmte %0,%0"::"r" (0) : "memory");
asm volatile("isync; slbia; isync":::"memory");
create_shadowed_slbe(PAGE_OFFSET, lflags, 0);
create_shadowed_slbe(VMALLOC_START, vflags, 1);
/* We don't bolt the stack for the time being - we're in boot,
* so the stack is in the bolted segment. By the time it goes
* elsewhere, we'll call _switch() which will bolt in the new
* one. */
asm volatile("isync":::"memory");
}
......@@ -113,10 +113,14 @@ struct cbe_pmd_regs {
u64 checkstop_fir; /* 0x0c00 */
u64 recoverable_fir; /* 0x0c08 */
u64 spec_att_mchk_fir; /* 0x0c10 */
u64 fir_mode_reg; /* 0x0c18 */
u32 fir_mode_reg; /* 0x0c18 */
u8 pad_0x0c1c_0x0c20 [4]; /* 0x0c1c */
#define CBE_PMD_FIR_MODE_M8 0x00800
u64 fir_enable_mask; /* 0x0c20 */
u8 pad_0x0c28_0x1000 [0x1000 - 0x0c28]; /* 0x0c28 */
u8 pad_0x0c28_0x0ca8 [0x0ca8 - 0x0c28]; /* 0x0c28 */
u64 ras_esc_0; /* 0x0ca8 */
u8 pad_0x0cb0_0x1000 [0x1000 - 0x0cb0]; /* 0x0cb0 */
};
extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np);
......
......@@ -88,17 +88,13 @@ static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev)
/* returns the value for a given spu in a given register */
static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg)
{
const unsigned int *id;
union spe_reg value;
struct spu *spu;
/* getting the id from the reg attribute will not work on future device-tree layouts
* in future we should store the id to the spu struct and use it here */
spu = container_of(sysdev, struct spu, sysdev);
id = of_get_property(spu_devnode(spu), "reg", NULL);
value.val = in_be64(&reg->val);
return value.spe[*id];
return value.spe[spu->spe_id];
}
static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf)
......
......@@ -38,6 +38,8 @@
#include "pervasive.h"
#include "cbe_regs.h"
static int sysreset_hack;
static void cbe_power_save(void)
{
unsigned long ctrl, thread_switch_control;
......@@ -85,6 +87,9 @@ static void cbe_power_save(void)
static int cbe_system_reset_exception(struct pt_regs *regs)
{
int cpu;
struct cbe_pmd_regs __iomem *pmd;
switch (regs->msr & SRR1_WAKEMASK) {
case SRR1_WAKEEE:
do_IRQ(regs);
......@@ -93,6 +98,18 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
timer_interrupt(regs);
break;
case SRR1_WAKEMT:
/*
* The BMC can inject user triggered system reset exceptions,
* but cannot set the system reset reason in srr1,
* so check an extra register here.
*/
if (sysreset_hack && (cpu = smp_processor_id()) == 0) {
pmd = cbe_get_cpu_pmd_regs(cpu);
if (in_be64(&pmd->ras_esc_0) & 0xffff) {
out_be64(&pmd->ras_esc_0, 0);
return 0;
}
}
break;
#ifdef CONFIG_CBE_RAS
case SRR1_WAKESYSERR:
......@@ -113,9 +130,12 @@ static int cbe_system_reset_exception(struct pt_regs *regs)
void __init cbe_pervasive_init(void)
{
int cpu;
if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO))
return;
sysreset_hack = machine_is_compatible("IBM,CBPLUS-1.0");
for_each_possible_cpu(cpu) {
struct cbe_pmd_regs __iomem *regs = cbe_get_cpu_pmd_regs(cpu);
if (!regs)
......@@ -124,6 +144,12 @@ void __init cbe_pervasive_init(void)
/* Enable Pause(0) control bit */
out_be64(&regs->pmcr, in_be64(&regs->pmcr) |
CBE_PMD_PAUSE_ZERO_CONTROL);
/* Enable JTAG system-reset hack */
if (sysreset_hack)
out_be32(&regs->fir_mode_reg,
in_be32(&regs->fir_mode_reg) |
CBE_PMD_FIR_MODE_M8);
}
ppc_md.power_save = cbe_power_save;
......
......@@ -48,7 +48,7 @@ static u64 __init find_spu_unit_number(struct device_node *spe)
{
const unsigned int *prop;
int proplen;
prop = of_get_property(spe, "unit-id", &proplen);
prop = of_get_property(spe, "physical-id", &proplen);
if (proplen == 4)
return (u64)*prop;
......
......@@ -93,7 +93,7 @@ static void iobmap_build(struct iommu_table *tbl, long index,
pr_debug("iobmap: build at: %lx, %lx, addr: %lx\n", index, npages, uaddr);
bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
bus_addr = (tbl->it_offset + index) << IOBMAP_PAGE_SHIFT;
ip = ((u32 *)tbl->it_base) + index;
......@@ -118,7 +118,7 @@ static void iobmap_free(struct iommu_table *tbl, long index,
pr_debug("iobmap: free at: %lx, %lx\n", index, npages);
bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
bus_addr = (tbl->it_offset + index) << IOBMAP_PAGE_SHIFT;
ip = ((u32 *)tbl->it_base) + index;
......@@ -137,7 +137,7 @@ static void iommu_table_iobmap_setup(void)
iommu_table_iobmap.it_busno = 0;
iommu_table_iobmap.it_offset = 0;
/* it_size is in number of entries */
iommu_table_iobmap.it_size = 0x80000000 >> PAGE_SHIFT;
iommu_table_iobmap.it_size = 0x80000000 >> IOBMAP_PAGE_SHIFT;
/* Initialize the common IOMMU code */
iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
......
......@@ -59,8 +59,7 @@
struct axon_ram_bank {
struct of_device *device;
struct gendisk *disk;
unsigned int irq_correctable;
unsigned int irq_uncorrectable;
unsigned int irq_id;
unsigned long ph_addr;
unsigned long io_addr;
unsigned long size;
......@@ -93,16 +92,9 @@ axon_ram_irq_handler(int irq, void *dev)
BUG_ON(!bank);
if (irq == bank->irq_correctable) {
dev_err(&device->dev, "Correctable memory error occured\n");
bank->ecc_counter++;
return IRQ_HANDLED;
} else if (irq == bank->irq_uncorrectable) {
dev_err(&device->dev, "Uncorrectable memory error occured\n");
panic("Critical ECC error on %s", device->node->full_name);
}
return IRQ_NONE;
dev_err(&device->dev, "Correctable memory error occured\n");
bank->ecc_counter++;
return IRQ_HANDLED;
}
/**
......@@ -259,28 +251,18 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id)
blk_queue_hardsect_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
add_disk(bank->disk);
bank->irq_correctable = irq_of_parse_and_map(device->node, 0);
bank->irq_uncorrectable = irq_of_parse_and_map(device->node, 1);
if ((bank->irq_correctable <= 0) || (bank->irq_uncorrectable <= 0)) {
bank->irq_id = irq_of_parse_and_map(device->node, 0);
if (bank->irq_id == NO_IRQ) {
dev_err(&device->dev, "Cannot access ECC interrupt ID\n");
rc = -EFAULT;
goto failed;
}
rc = request_irq(bank->irq_correctable, axon_ram_irq_handler,
AXON_RAM_IRQ_FLAGS, bank->disk->disk_name, device);
if (rc != 0) {
dev_err(&device->dev, "Cannot register ECC interrupt handler\n");
bank->irq_correctable = bank->irq_uncorrectable = 0;
rc = -EFAULT;
goto failed;
}
rc = request_irq(bank->irq_uncorrectable, axon_ram_irq_handler,
rc = request_irq(bank->irq_id, axon_ram_irq_handler,
AXON_RAM_IRQ_FLAGS, bank->disk->disk_name, device);
if (rc != 0) {
dev_err(&device->dev, "Cannot register ECC interrupt handler\n");
bank->irq_uncorrectable = 0;
bank->irq_id = NO_IRQ;
rc = -EFAULT;
goto failed;
}
......@@ -296,13 +278,9 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id)
failed:
if (bank != NULL) {
if (bank->irq_uncorrectable > 0)
free_irq(bank->irq_uncorrectable, device);
if (bank->irq_correctable > 0)
free_irq(bank->irq_correctable, device);
if (bank->irq_id != NO_IRQ)
free_irq(bank->irq_id, device);
if (bank->disk != NULL) {
if (bank->disk->queue != NULL)
blk_cleanup_queue(bank->disk->queue);
if (bank->disk->major > 0)
unregister_blkdev(bank->disk->major,
bank->disk->disk_name);
......@@ -329,9 +307,7 @@ axon_ram_remove(struct of_device *device)
BUG_ON(!bank || !bank->disk);
device_remove_file(&device->dev, &dev_attr_ecc);
free_irq(bank->irq_uncorrectable, device);
free_irq(bank->irq_correctable, device);
blk_cleanup_queue(bank->disk->queue);
free_irq(bank->irq_id, device);
unregister_blkdev(bank->disk->major, bank->disk->disk_name);
del_gendisk(bank->disk);
iounmap((void __iomem *) bank->io_addr);
......
......@@ -89,7 +89,7 @@ static int sleepy_trackpad;
static int autopoll_devs;
int __adb_probe_sync;
#ifdef CONFIG_PM
#ifdef CONFIG_PM_SLEEP
static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
static struct pmu_sleep_notifier adb_sleep_notifier = {
adb_notify_sleep,
......@@ -313,7 +313,7 @@ int __init adb_init(void)
printk(KERN_WARNING "Warning: no ADB interface detected\n");
adb_controller = NULL;
} else {
#ifdef CONFIG_PM
#ifdef CONFIG_PM_SLEEP
pmu_register_sleep_notifier(&adb_sleep_notifier);
#endif /* CONFIG_PM */
#ifdef CONFIG_PPC
......
......@@ -152,10 +152,10 @@ static spinlock_t pmu_lock;
static u8 pmu_intr_mask;
static int pmu_version;
static int drop_interrupts;
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
static int option_lid_wakeup = 1;
#endif /* CONFIG_PM && CONFIG_PPC32 */
#if (defined(CONFIG_PM)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY)
#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
#if (defined(CONFIG_PM_SLEEP)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY)
static int sleep_in_progress;
#endif
static unsigned long async_req_locks;
......@@ -875,7 +875,7 @@ proc_read_options(char *page, char **start, off_t off,
{
char *p = page;
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
if (pmu_kind == PMU_KEYLARGO_BASED &&
pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup);
......@@ -916,7 +916,7 @@ proc_write_options(struct file *file, const char __user *buffer,
*(val++) = 0;
while(*val == ' ')
val++;
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
if (pmu_kind == PMU_KEYLARGO_BASED &&
pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
if (!strcmp(label, "lid_wakeup"))
......@@ -1738,7 +1738,7 @@ pmu_present(void)
return via != 0;
}
#ifdef CONFIG_PM
#ifdef CONFIG_PM_SLEEP
static LIST_HEAD(sleep_notifiers);
......@@ -1769,9 +1769,9 @@ pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n)
return 0;
}
EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
#endif /* CONFIG_PM */
#endif /* CONFIG_PM_SLEEP */
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
/* Sleep is broadcast last-to-first */
static void broadcast_sleep(int when)
......@@ -2390,7 +2390,7 @@ powerbook_sleep_3400(void)
return 0;
}
#endif /* CONFIG_PM && CONFIG_PPC32 */
#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
/*
* Support for /dev/pmu device
......@@ -2573,7 +2573,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
int error = -EINVAL;
switch (cmd) {
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
case PMU_IOC_SLEEP:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
......@@ -2601,7 +2601,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
return put_user(0, argp);
else
return put_user(1, argp);
#endif /* CONFIG_PM && CONFIG_PPC32 */
#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
#ifdef CONFIG_PMAC_BACKLIGHT_LEGACY
/* Compatibility ioctl's for backlight */
......@@ -2757,7 +2757,7 @@ pmu_polled_request(struct adb_request *req)
* to do suspend-to-disk.
*/
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
int pmu_sys_suspended;
......@@ -2792,7 +2792,7 @@ static int pmu_sys_resume(struct sys_device *sysdev)
return 0;
}
#endif /* CONFIG_PM && CONFIG_PPC32 */
#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
static struct sysdev_class pmu_sysclass = {
set_kset_name("pmu"),
......@@ -2803,10 +2803,10 @@ static struct sys_device device_pmu = {
};
static struct sysdev_driver driver_pmu = {
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
.suspend = &pmu_sys_suspend,
.resume = &pmu_sys_resume,
#endif /* CONFIG_PM && CONFIG_PPC32 */
#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
};
static int __init init_pmu_sysfs(void)
......@@ -2841,10 +2841,10 @@ EXPORT_SYMBOL(pmu_wait_complete);
EXPORT_SYMBOL(pmu_suspend);
EXPORT_SYMBOL(pmu_resume);
EXPORT_SYMBOL(pmu_unlock);
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
EXPORT_SYMBOL(pmu_enable_irled);
EXPORT_SYMBOL(pmu_battery_count);
EXPORT_SYMBOL(pmu_batteries);
EXPORT_SYMBOL(pmu_power_flags);
#endif /* CONFIG_PM && CONFIG_PPC32 */
#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
......@@ -226,7 +226,7 @@ extern unsigned int pmu_power_flags;
extern void pmu_backlight_init(void);
/* some code needs to know if the PMU was suspended for hibernation */
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
extern int pmu_sys_suspended;
#else
/* if power management is not configured it can't be suspended */
......
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