aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/boot/.gitignore1
-rw-r--r--arch/powerpc/include/asm/iommu.h1
-rw-r--r--arch/powerpc/include/asm/irq.h6
-rw-r--r--arch/powerpc/include/asm/machdep.h4
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h12
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h16
-rw-r--r--arch/powerpc/include/asm/perf_event_server.h2
-rw-r--r--arch/powerpc/include/asm/rtas.h34
-rw-r--r--arch/powerpc/include/asm/smp.h1
-rw-r--r--arch/powerpc/include/asm/udbg.h1
-rw-r--r--arch/powerpc/include/asm/vio.h10
-rw-r--r--arch/powerpc/kernel/irq.c8
-rw-r--r--arch/powerpc/kernel/prom_init.c2
-rw-r--r--arch/powerpc/kernel/rtas.c34
-rw-r--r--arch/powerpc/kernel/udbg.c3
-rw-r--r--arch/powerpc/kernel/vdso.c4
-rw-r--r--arch/powerpc/kernel/vio.c12
-rw-r--r--arch/powerpc/perf/core-book3s.c46
-rw-r--r--arch/powerpc/perf/power4-pmu.c1
-rw-r--r--arch/powerpc/perf/ppc970-pmu.c1
-rw-r--r--arch/powerpc/platforms/cell/beat_htab.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c19
-rw-r--r--arch/powerpc/platforms/pseries/eeh_dev.c2
-rw-r--r--arch/powerpc/platforms/pseries/io_event_irq.c68
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c29
-rw-r--r--arch/powerpc/platforms/pseries/ras.c195
-rw-r--r--arch/sparc/include/asm/vio.h9
-rw-r--r--arch/sparc/kernel/ds.c5
-rw-r--r--arch/sparc/kernel/vio.c8
-rw-r--r--drivers/block/sunvdc.c5
-rw-r--r--drivers/net/ethernet/ibm/ibmveth.c7
-rw-r--r--drivers/net/ethernet/sun/sunvnet.c5
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c7
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c7
-rw-r--r--drivers/scsi/ibmvscsi/ibmvstgt.c5
-rw-r--r--drivers/tty/hvc/hvc_vio.c7
-rw-r--r--drivers/tty/hvc/hvcs.c5
-rw-r--r--include/linux/of.h10
38 files changed, 321 insertions, 273 deletions
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index 12da77ec0228..1c1aadc8c48f 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -27,7 +27,6 @@ zImage.bin.*
27zImage.chrp 27zImage.chrp
28zImage.coff 28zImage.coff
29zImage.holly 29zImage.holly
30zImage.iseries
31zImage.*lds 30zImage.*lds
32zImage.miboot 31zImage.miboot
33zImage.pmac 32zImage.pmac
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index edfc9803ec91..957a83f43646 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -112,7 +112,6 @@ extern void iommu_unmap_page(struct iommu_table *tbl, dma_addr_t dma_handle,
112 struct dma_attrs *attrs); 112 struct dma_attrs *attrs);
113 113
114extern void iommu_init_early_pSeries(void); 114extern void iommu_init_early_pSeries(void);
115extern void iommu_init_early_iSeries(void);
116extern void iommu_init_early_dart(void); 115extern void iommu_init_early_dart(void);
117extern void iommu_init_early_pasemi(void); 116extern void iommu_init_early_pasemi(void);
118 117
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index fe0b09dceb7d..cf417e510736 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -27,12 +27,6 @@ extern atomic_t ppc_n_lost_interrupts;
27/* This number is used when no interrupt has been assigned */ 27/* This number is used when no interrupt has been assigned */
28#define NO_IRQ (0) 28#define NO_IRQ (0)
29 29
30/* This is a special irq number to return from get_irq() to tell that
31 * no interrupt happened _and_ ignore it (don't count it as bad). Some
32 * platforms like iSeries rely on that.
33 */
34#define NO_IRQ_IGNORE ((unsigned int)-1)
35
36/* Total number of virq in the platform */ 30/* Total number of virq in the platform */
37#define NR_IRQS CONFIG_NR_IRQS 31#define NR_IRQS CONFIG_NR_IRQS
38 32
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index bf37931d1ad6..42ce570812c1 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -99,9 +99,7 @@ struct machdep_calls {
99 99
100 void (*init_IRQ)(void); 100 void (*init_IRQ)(void);
101 101
102 /* Return an irq, or NO_IRQ to indicate there are none pending. 102 /* Return an irq, or NO_IRQ to indicate there are none pending. */
103 * If for some reason there is no irq, but the interrupt
104 * shouldn't be counted as spurious, return NO_IRQ_IGNORE. */
105 unsigned int (*get_irq)(void); 103 unsigned int (*get_irq)(void);
106 104
107 /* PCI stuff */ 105 /* PCI stuff */
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index 0759dd8bf5aa..1c65a59881ea 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -267,7 +267,6 @@ extern void demote_segment_4k(struct mm_struct *mm, unsigned long addr);
267 267
268extern void hpte_init_native(void); 268extern void hpte_init_native(void);
269extern void hpte_init_lpar(void); 269extern void hpte_init_lpar(void);
270extern void hpte_init_iSeries(void);
271extern void hpte_init_beat(void); 270extern void hpte_init_beat(void);
272extern void hpte_init_beat_v3(void); 271extern void hpte_init_beat_v3(void);
273 272
@@ -325,9 +324,6 @@ extern void slb_set_size(u16 size);
325 * WARNING - If you change these you must make sure the asm 324 * WARNING - If you change these you must make sure the asm
326 * implementations in slb_allocate (slb_low.S), do_stab_bolted 325 * implementations in slb_allocate (slb_low.S), do_stab_bolted
327 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly. 326 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
328 *
329 * You'll also need to change the precomputed VSID values in head.S
330 * which are used by the iSeries firmware.
331 */ 327 */
332 328
333#define VSID_MULTIPLIER_256M ASM_CONST(200730139) /* 28-bit prime */ 329#define VSID_MULTIPLIER_256M ASM_CONST(200730139) /* 28-bit prime */
@@ -484,14 +480,6 @@ static inline unsigned long get_vsid(unsigned long context, unsigned long ea,
484 | (ea >> SID_SHIFT_1T), 1T); 480 | (ea >> SID_SHIFT_1T), 1T);
485} 481}
486 482
487/*
488 * This is only used on legacy iSeries in lparmap.c,
489 * hence the 256MB segment assumption.
490 */
491#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER_256M) % \
492 VSID_MODULUS_256M)
493#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
494
495#endif /* __ASSEMBLY__ */ 483#endif /* __ASSEMBLY__ */
496 484
497#endif /* _ASM_POWERPC_MMU_HASH64_H_ */ 485#endif /* _ASM_POWERPC_MMU_HASH64_H_ */
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 5d487657322e..ac39e6a3b25a 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -155,14 +155,7 @@ struct pci_dn {
155 155
156 struct pci_dev *pcidev; /* back-pointer to the pci device */ 156 struct pci_dev *pcidev; /* back-pointer to the pci device */
157#ifdef CONFIG_EEH 157#ifdef CONFIG_EEH
158 int class_code; /* pci device class */ 158 struct eeh_dev *edev; /* eeh device */
159 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
160 int eeh_config_addr;
161 int eeh_pe_config_addr; /* new-style partition endpoint address */
162 int eeh_check_count; /* # times driver ignored error */
163 int eeh_freeze_count; /* # times this device froze up. */
164 int eeh_false_positives; /* # times this device reported #ff's */
165 u32 config_space[16]; /* saved PCI config space */
166#endif 159#endif
167#define IODA_INVALID_PE (-1) 160#define IODA_INVALID_PE (-1)
168#ifdef CONFIG_PPC_POWERNV 161#ifdef CONFIG_PPC_POWERNV
@@ -185,6 +178,13 @@ static inline int pci_device_from_OF_node(struct device_node *np,
185 return 0; 178 return 0;
186} 179}
187 180
181#if defined(CONFIG_EEH)
182static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
183{
184 return PCI_DN(dn)->edev;
185}
186#endif
187
188/** Find the bus corresponding to the indicated device node */ 188/** Find the bus corresponding to the indicated device node */
189extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn); 189extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn);
190 190
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index 1a8093fa8f71..078019b5b353 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -47,6 +47,8 @@ struct power_pmu {
47 */ 47 */
48#define PPMU_LIMITED_PMC5_6 1 /* PMC5/6 have limited function */ 48#define PPMU_LIMITED_PMC5_6 1 /* PMC5/6 have limited function */
49#define PPMU_ALT_SIPR 2 /* uses alternate posn for SIPR/HV */ 49#define PPMU_ALT_SIPR 2 /* uses alternate posn for SIPR/HV */
50#define PPMU_NO_SIPR 4 /* no SIPR/HV in MMCRA at all */
51#define PPMU_NO_CONT_SAMPLING 8 /* no continuous sampling */
50 52
51/* 53/*
52 * Values for flags to get_alternatives() 54 * Values for flags to get_alternatives()
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 01c143bb77ae..f0a4db31ecb6 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -74,7 +74,6 @@ struct rtas_suspend_me_data {
74/* RTAS event classes */ 74/* RTAS event classes */
75#define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */ 75#define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */
76#define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */ 76#define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */
77#define RTAS_POWERMGM_EVENTS 0x20000000 /* set bit 2 */
78#define RTAS_HOTPLUG_EVENTS 0x10000000 /* set bit 3 */ 77#define RTAS_HOTPLUG_EVENTS 0x10000000 /* set bit 3 */
79#define RTAS_IO_EVENTS 0x08000000 /* set bit 4 */ 78#define RTAS_IO_EVENTS 0x08000000 /* set bit 4 */
80#define RTAS_EVENT_SCAN_ALL_EVENTS 0xffffffff 79#define RTAS_EVENT_SCAN_ALL_EVENTS 0xffffffff
@@ -204,6 +203,39 @@ struct rtas_ext_event_log_v6 {
204 /* Variable length. */ 203 /* Variable length. */
205}; 204};
206 205
206/* pSeries event log format */
207
208/* Two bytes ASCII section IDs */
209#define PSERIES_ELOG_SECT_ID_PRIV_HDR (('P' << 8) | 'H')
210#define PSERIES_ELOG_SECT_ID_USER_HDR (('U' << 8) | 'H')
211#define PSERIES_ELOG_SECT_ID_PRIMARY_SRC (('P' << 8) | 'S')
212#define PSERIES_ELOG_SECT_ID_EXTENDED_UH (('E' << 8) | 'H')
213#define PSERIES_ELOG_SECT_ID_FAILING_MTMS (('M' << 8) | 'T')
214#define PSERIES_ELOG_SECT_ID_SECONDARY_SRC (('S' << 8) | 'S')
215#define PSERIES_ELOG_SECT_ID_DUMP_LOCATOR (('D' << 8) | 'H')
216#define PSERIES_ELOG_SECT_ID_FW_ERROR (('S' << 8) | 'W')
217#define PSERIES_ELOG_SECT_ID_IMPACT_PART_ID (('L' << 8) | 'P')
218#define PSERIES_ELOG_SECT_ID_LOGIC_RESOURCE_ID (('L' << 8) | 'R')
219#define PSERIES_ELOG_SECT_ID_HMC_ID (('H' << 8) | 'M')
220#define PSERIES_ELOG_SECT_ID_EPOW (('E' << 8) | 'P')
221#define PSERIES_ELOG_SECT_ID_IO_EVENT (('I' << 8) | 'E')
222#define PSERIES_ELOG_SECT_ID_MANUFACT_INFO (('M' << 8) | 'I')
223#define PSERIES_ELOG_SECT_ID_CALL_HOME (('C' << 8) | 'H')
224#define PSERIES_ELOG_SECT_ID_USER_DEF (('U' << 8) | 'D')
225
226/* Vendor specific Platform Event Log Format, Version 6, section header */
227struct pseries_errorlog {
228 uint16_t id; /* 0x00 2-byte ASCII section ID */
229 uint16_t length; /* 0x02 Section length in bytes */
230 uint8_t version; /* 0x04 Section version */
231 uint8_t subtype; /* 0x05 Section subtype */
232 uint16_t creator_component; /* 0x06 Creator component ID */
233 uint8_t data[]; /* 0x08 Start of section data */
234};
235
236struct pseries_errorlog *get_pseries_errorlog(struct rtas_error_log *log,
237 uint16_t section_id);
238
207/* 239/*
208 * This can be set by the rtas_flash module so that it can get called 240 * This can be set by the rtas_flash module so that it can get called
209 * as the absolutely last thing before the kernel terminates. 241 * as the absolutely last thing before the kernel terminates.
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index adba970ce918..ebc24dc5b1a1 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -122,7 +122,6 @@ extern void smp_muxed_ipi_set_data(int cpu, unsigned long data);
122extern void smp_muxed_ipi_message_pass(int cpu, int msg); 122extern void smp_muxed_ipi_message_pass(int cpu, int msg);
123extern irqreturn_t smp_ipi_demux(void); 123extern irqreturn_t smp_ipi_demux(void);
124 124
125void smp_init_iSeries(void);
126void smp_init_pSeries(void); 125void smp_init_pSeries(void);
127void smp_init_cell(void); 126void smp_init_cell(void);
128void smp_init_celleb(void); 127void smp_init_celleb(void);
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index 8338aef5a4d3..b3038817b8dc 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -44,7 +44,6 @@ extern void __init udbg_init_debug_lpar_hvsi(void);
44extern void __init udbg_init_pmac_realmode(void); 44extern void __init udbg_init_pmac_realmode(void);
45extern void __init udbg_init_maple_realmode(void); 45extern void __init udbg_init_maple_realmode(void);
46extern void __init udbg_init_pas_realmode(void); 46extern void __init udbg_init_pas_realmode(void);
47extern void __init udbg_init_iseries(void);
48extern void __init udbg_init_rtas_panel(void); 47extern void __init udbg_init_rtas_panel(void);
49extern void __init udbg_init_rtas_console(void); 48extern void __init udbg_init_rtas_console(void);
50extern void __init udbg_init_debug_beat(void); 49extern void __init udbg_init_debug_beat(void);
diff --git a/arch/powerpc/include/asm/vio.h b/arch/powerpc/include/asm/vio.h
index 0a290a195946..6bfd5ffe1d4f 100644
--- a/arch/powerpc/include/asm/vio.h
+++ b/arch/powerpc/include/asm/vio.h
@@ -69,6 +69,7 @@ struct vio_dev {
69}; 69};
70 70
71struct vio_driver { 71struct vio_driver {
72 const char *name;
72 const struct vio_device_id *id_table; 73 const struct vio_device_id *id_table;
73 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); 74 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
74 int (*remove)(struct vio_dev *dev); 75 int (*remove)(struct vio_dev *dev);
@@ -76,10 +77,17 @@ struct vio_driver {
76 * be loaded in a CMO environment if it uses DMA. 77 * be loaded in a CMO environment if it uses DMA.
77 */ 78 */
78 unsigned long (*get_desired_dma)(struct vio_dev *dev); 79 unsigned long (*get_desired_dma)(struct vio_dev *dev);
80 const struct dev_pm_ops *pm;
79 struct device_driver driver; 81 struct device_driver driver;
80}; 82};
81 83
82extern int vio_register_driver(struct vio_driver *drv); 84extern int __vio_register_driver(struct vio_driver *drv, struct module *owner,
85 const char *mod_name);
86/*
87 * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded
88 */
89#define vio_register_driver(driver) \
90 __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
83extern void vio_unregister_driver(struct vio_driver *drv); 91extern void vio_unregister_driver(struct vio_driver *drv);
84 92
85extern int vio_cmo_entitlement_update(size_t); 93extern int vio_cmo_entitlement_update(size_t);
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index a3d128e94cff..cea2d9f3ae4e 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -208,8 +208,8 @@ notrace void arch_local_irq_restore(unsigned long en)
208 * we are checking the "new" CPU instead of the old one. This 208 * we are checking the "new" CPU instead of the old one. This
209 * is only a problem if an event happened on the "old" CPU. 209 * is only a problem if an event happened on the "old" CPU.
210 * 210 *
211 * External interrupt events on non-iseries will have caused 211 * External interrupt events will have caused interrupts to
212 * interrupts to be hard-disabled, so there is no problem, we 212 * be hard-disabled, so there is no problem, we
213 * cannot have preempted. 213 * cannot have preempted.
214 */ 214 */
215 irq_happened = get_irq_happened(); 215 irq_happened = get_irq_happened();
@@ -445,9 +445,9 @@ void do_IRQ(struct pt_regs *regs)
445 may_hard_irq_enable(); 445 may_hard_irq_enable();
446 446
447 /* And finally process it */ 447 /* And finally process it */
448 if (irq != NO_IRQ && irq != NO_IRQ_IGNORE) 448 if (irq != NO_IRQ)
449 handle_one_irq(irq); 449 handle_one_irq(irq);
450 else if (irq != NO_IRQ_IGNORE) 450 else
451 __get_cpu_var(irq_stat).spurious_irqs++; 451 __get_cpu_var(irq_stat).spurious_irqs++;
452 452
453 irq_exit(); 453 irq_exit();
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index e2d599048142..ea4e311e09d2 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -447,7 +447,7 @@ static void __init __attribute__((noreturn)) prom_panic(const char *reason)
447 if (RELOC(of_platform) == PLATFORM_POWERMAC) 447 if (RELOC(of_platform) == PLATFORM_POWERMAC)
448 asm("trap\n"); 448 asm("trap\n");
449 449
450 /* ToDo: should put up an SRC here on p/iSeries */ 450 /* ToDo: should put up an SRC here on pSeries */
451 call_prom("exit", 0, 0); 451 call_prom("exit", 0, 0);
452 452
453 for (;;) /* should never get here */ 453 for (;;) /* should never get here */
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 9f843cdfee9e..4d1a7babe342 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -868,6 +868,40 @@ int rtas_ibm_suspend_me(struct rtas_args *args)
868} 868}
869#endif 869#endif
870 870
871/**
872 * Find a specific pseries error log in an RTAS extended event log.
873 * @log: RTAS error/event log
874 * @section_id: two character section identifier
875 *
876 * Returns a pointer to the specified errorlog or NULL if not found.
877 */
878struct pseries_errorlog *get_pseries_errorlog(struct rtas_error_log *log,
879 uint16_t section_id)
880{
881 struct rtas_ext_event_log_v6 *ext_log =
882 (struct rtas_ext_event_log_v6 *)log->buffer;
883 struct pseries_errorlog *sect;
884 unsigned char *p, *log_end;
885
886 /* Check that we understand the format */
887 if (log->extended_log_length < sizeof(struct rtas_ext_event_log_v6) ||
888 ext_log->log_format != RTAS_V6EXT_LOG_FORMAT_EVENT_LOG ||
889 ext_log->company_id != RTAS_V6EXT_COMPANY_ID_IBM)
890 return NULL;
891
892 log_end = log->buffer + log->extended_log_length;
893 p = ext_log->vendor_log;
894
895 while (p < log_end) {
896 sect = (struct pseries_errorlog *)p;
897 if (sect->id == section_id)
898 return sect;
899 p += sect->length;
900 }
901
902 return NULL;
903}
904
871asmlinkage int ppc_rtas(struct rtas_args __user *uargs) 905asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
872{ 906{
873 struct rtas_args args; 907 struct rtas_args args;
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 57fa2c0a531c..c39c1ca77f46 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -46,9 +46,6 @@ void __init udbg_early_init(void)
46#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE) 46#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE)
47 /* Maple real mode debug */ 47 /* Maple real mode debug */
48 udbg_init_maple_realmode(); 48 udbg_init_maple_realmode();
49#elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES)
50 /* For iSeries - hit Ctrl-x Ctrl-x to see the output */
51 udbg_init_iseries();
52#elif defined(CONFIG_PPC_EARLY_DEBUG_BEAT) 49#elif defined(CONFIG_PPC_EARLY_DEBUG_BEAT)
53 udbg_init_debug_beat(); 50 udbg_init_debug_beat();
54#elif defined(CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE) 51#elif defined(CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index d36ee1055f88..972cca278f98 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -721,10 +721,10 @@ static int __init vdso_init(void)
721 vdso_data->version.minor = SYSTEMCFG_MINOR; 721 vdso_data->version.minor = SYSTEMCFG_MINOR;
722 vdso_data->processor = mfspr(SPRN_PVR); 722 vdso_data->processor = mfspr(SPRN_PVR);
723 /* 723 /*
724 * Fake the old platform number for pSeries and iSeries and add 724 * Fake the old platform number for pSeries and add
725 * in LPAR bit if necessary 725 * in LPAR bit if necessary
726 */ 726 */
727 vdso_data->platform = machine_is(iseries) ? 0x200 : 0x100; 727 vdso_data->platform = 0x100;
728 if (firmware_has_feature(FW_FEATURE_LPAR)) 728 if (firmware_has_feature(FW_FEATURE_LPAR))
729 vdso_data->platform |= 1; 729 vdso_data->platform |= 1;
730 vdso_data->physicalMemorySize = memblock_phys_mem_size(); 730 vdso_data->physicalMemorySize = memblock_phys_mem_size();
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index bca3fc427b45..b2f7c8480bf6 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1159,17 +1159,21 @@ static int vio_bus_remove(struct device *dev)
1159 * vio_register_driver: - Register a new vio driver 1159 * vio_register_driver: - Register a new vio driver
1160 * @drv: The vio_driver structure to be registered. 1160 * @drv: The vio_driver structure to be registered.
1161 */ 1161 */
1162int vio_register_driver(struct vio_driver *viodrv) 1162int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
1163 const char *mod_name)
1163{ 1164{
1164 printk(KERN_DEBUG "%s: driver %s registering\n", __func__, 1165 pr_debug("%s: driver %s registering\n", __func__, viodrv->name);
1165 viodrv->driver.name);
1166 1166
1167 /* fill in 'struct driver' fields */ 1167 /* fill in 'struct driver' fields */
1168 viodrv->driver.name = viodrv->name;
1169 viodrv->driver.pm = viodrv->pm;
1168 viodrv->driver.bus = &vio_bus_type; 1170 viodrv->driver.bus = &vio_bus_type;
1171 viodrv->driver.owner = owner;
1172 viodrv->driver.mod_name = mod_name;
1169 1173
1170 return driver_register(&viodrv->driver); 1174 return driver_register(&viodrv->driver);
1171} 1175}
1172EXPORT_SYMBOL(vio_register_driver); 1176EXPORT_SYMBOL(__vio_register_driver);
1173 1177
1174/** 1178/**
1175 * vio_unregister_driver - Remove registration of vio driver. 1179 * vio_unregister_driver - Remove registration of vio driver.
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index c2e27ede07ec..02aee03e713c 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -116,14 +116,45 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
116 *addrp = mfspr(SPRN_SDAR); 116 *addrp = mfspr(SPRN_SDAR);
117} 117}
118 118
119static inline u32 perf_flags_from_msr(struct pt_regs *regs)
120{
121 if (regs->msr & MSR_PR)
122 return PERF_RECORD_MISC_USER;
123 if ((regs->msr & MSR_HV) && freeze_events_kernel != MMCR0_FCHV)
124 return PERF_RECORD_MISC_HYPERVISOR;
125 return PERF_RECORD_MISC_KERNEL;
126}
127
119static inline u32 perf_get_misc_flags(struct pt_regs *regs) 128static inline u32 perf_get_misc_flags(struct pt_regs *regs)
120{ 129{
121 unsigned long mmcra = regs->dsisr; 130 unsigned long mmcra = regs->dsisr;
122 unsigned long sihv = MMCRA_SIHV; 131 unsigned long sihv = MMCRA_SIHV;
123 unsigned long sipr = MMCRA_SIPR; 132 unsigned long sipr = MMCRA_SIPR;
124 133
134 /* Not a PMU interrupt: Make up flags from regs->msr */
125 if (TRAP(regs) != 0xf00) 135 if (TRAP(regs) != 0xf00)
126 return 0; /* not a PMU interrupt */ 136 return perf_flags_from_msr(regs);
137
138 /*
139 * If we don't support continuous sampling and this
140 * is not a marked event, same deal
141 */
142 if ((ppmu->flags & PPMU_NO_CONT_SAMPLING) &&
143 !(mmcra & MMCRA_SAMPLE_ENABLE))
144 return perf_flags_from_msr(regs);
145
146 /*
147 * If we don't have flags in MMCRA, rather than using
148 * the MSR, we intuit the flags from the address in
149 * SIAR which should give slightly more reliable
150 * results
151 */
152 if (ppmu->flags & PPMU_NO_SIPR) {
153 unsigned long siar = mfspr(SPRN_SIAR);
154 if (siar >= PAGE_OFFSET)
155 return PERF_RECORD_MISC_KERNEL;
156 return PERF_RECORD_MISC_USER;
157 }
127 158
128 if (ppmu->flags & PPMU_ALT_SIPR) { 159 if (ppmu->flags & PPMU_ALT_SIPR) {
129 sihv = POWER6_MMCRA_SIHV; 160 sihv = POWER6_MMCRA_SIHV;
@@ -1299,13 +1330,18 @@ unsigned long perf_misc_flags(struct pt_regs *regs)
1299 */ 1330 */
1300unsigned long perf_instruction_pointer(struct pt_regs *regs) 1331unsigned long perf_instruction_pointer(struct pt_regs *regs)
1301{ 1332{
1302 unsigned long ip; 1333 unsigned long mmcra = regs->dsisr;
1303 1334
1335 /* Not a PMU interrupt */
1304 if (TRAP(regs) != 0xf00) 1336 if (TRAP(regs) != 0xf00)
1305 return regs->nip; /* not a PMU interrupt */ 1337 return regs->nip;
1338
1339 /* Processor doesn't support sampling non marked events */
1340 if ((ppmu->flags & PPMU_NO_CONT_SAMPLING) &&
1341 !(mmcra & MMCRA_SAMPLE_ENABLE))
1342 return regs->nip;
1306 1343
1307 ip = mfspr(SPRN_SIAR) + perf_ip_adjust(regs); 1344 return mfspr(SPRN_SIAR) + perf_ip_adjust(regs);
1308 return ip;
1309} 1345}
1310 1346
1311static bool pmc_overflow(unsigned long val) 1347static bool pmc_overflow(unsigned long val)
diff --git a/arch/powerpc/perf/power4-pmu.c b/arch/powerpc/perf/power4-pmu.c
index b4f1dda4d089..9103a1de864d 100644
--- a/arch/powerpc/perf/power4-pmu.c
+++ b/arch/powerpc/perf/power4-pmu.c
@@ -607,6 +607,7 @@ static struct power_pmu power4_pmu = {
607 .n_generic = ARRAY_SIZE(p4_generic_events), 607 .n_generic = ARRAY_SIZE(p4_generic_events),
608 .generic_events = p4_generic_events, 608 .generic_events = p4_generic_events,
609 .cache_events = &power4_cache_events, 609 .cache_events = &power4_cache_events,
610 .flags = PPMU_NO_SIPR | PPMU_NO_CONT_SAMPLING,
610}; 611};
611 612
612static int __init init_power4_pmu(void) 613static int __init init_power4_pmu(void)
diff --git a/arch/powerpc/perf/ppc970-pmu.c b/arch/powerpc/perf/ppc970-pmu.c
index 111eb25bb0b6..20139ceeacf6 100644
--- a/arch/powerpc/perf/ppc970-pmu.c
+++ b/arch/powerpc/perf/ppc970-pmu.c
@@ -487,6 +487,7 @@ static struct power_pmu ppc970_pmu = {
487 .n_generic = ARRAY_SIZE(ppc970_generic_events), 487 .n_generic = ARRAY_SIZE(ppc970_generic_events),
488 .generic_events = ppc970_generic_events, 488 .generic_events = ppc970_generic_events,
489 .cache_events = &ppc970_cache_events, 489 .cache_events = &ppc970_cache_events,
490 .flags = PPMU_NO_SIPR | PPMU_NO_CONT_SAMPLING,
490}; 491};
491 492
492static int __init init_ppc970_pmu(void) 493static int __init init_ppc970_pmu(void)
diff --git a/arch/powerpc/platforms/cell/beat_htab.c b/arch/powerpc/platforms/cell/beat_htab.c
index 2516c1cf8467..943c9d39aa16 100644
--- a/arch/powerpc/platforms/cell/beat_htab.c
+++ b/arch/powerpc/platforms/cell/beat_htab.c
@@ -95,7 +95,6 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
95 unsigned long lpar_rc; 95 unsigned long lpar_rc;
96 u64 hpte_v, hpte_r, slot; 96 u64 hpte_v, hpte_r, slot;
97 97
98 /* same as iseries */
99 if (vflags & HPTE_V_SECONDARY) 98 if (vflags & HPTE_V_SECONDARY)
100 return -1; 99 return -1;
101 100
@@ -319,7 +318,6 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
319 unsigned long lpar_rc; 318 unsigned long lpar_rc;
320 u64 hpte_v, hpte_r, slot; 319 u64 hpte_v, hpte_r, slot;
321 320
322 /* same as iseries */
323 if (vflags & HPTE_V_SECONDARY) 321 if (vflags & HPTE_V_SECONDARY)
324 return -1; 322 return -1;
325 323
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 8011088392d3..309d38ef7322 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -984,7 +984,8 @@ int __exit eeh_ops_unregister(const char *name)
984 */ 984 */
985void __init eeh_init(void) 985void __init eeh_init(void)
986{ 986{
987 struct device_node *phb, *np; 987 struct pci_controller *hose, *tmp;
988 struct device_node *phb;
988 int ret; 989 int ret;
989 990
990 /* call platform initialization function */ 991 /* call platform initialization function */
@@ -1000,19 +1001,9 @@ void __init eeh_init(void)
1000 1001
1001 raw_spin_lock_init(&confirm_error_lock); 1002 raw_spin_lock_init(&confirm_error_lock);
1002 1003
1003 np = of_find_node_by_path("/rtas"); 1004 /* Enable EEH for all adapters */
1004 if (np == NULL) 1005 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
1005 return; 1006 phb = hose->dn;
1006
1007 /* Enable EEH for all adapters. Note that eeh requires buid's */
1008 for (phb = of_find_node_by_name(NULL, "pci"); phb;
1009 phb = of_find_node_by_name(phb, "pci")) {
1010 unsigned long buid;
1011
1012 buid = get_phb_buid(phb);
1013 if (buid == 0 || !of_node_to_eeh_dev(phb))
1014 continue;
1015
1016 traverse_pci_devices(phb, eeh_early_enable, NULL); 1007 traverse_pci_devices(phb, eeh_early_enable, NULL);
1017 } 1008 }
1018 1009
diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/platforms/pseries/eeh_dev.c
index f3aed7dcae95..c4507d095900 100644
--- a/arch/powerpc/platforms/pseries/eeh_dev.c
+++ b/arch/powerpc/platforms/pseries/eeh_dev.c
@@ -62,7 +62,7 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
62 } 62 }
63 63
64 /* Associate EEH device with OF node */ 64 /* Associate EEH device with OF node */
65 dn->edev = edev; 65 PCI_DN(dn)->edev = edev;
66 edev->dn = dn; 66 edev->dn = dn;
67 edev->phb = phb; 67 edev->phb = phb;
68 68
diff --git a/arch/powerpc/platforms/pseries/io_event_irq.c b/arch/powerpc/platforms/pseries/io_event_irq.c
index 1a709bc48ce1..ef9d9d84c7d5 100644
--- a/arch/powerpc/platforms/pseries/io_event_irq.c
+++ b/arch/powerpc/platforms/pseries/io_event_irq.c
@@ -63,73 +63,9 @@ EXPORT_SYMBOL_GPL(pseries_ioei_notifier_list);
63 63
64static int ioei_check_exception_token; 64static int ioei_check_exception_token;
65 65
66/* pSeries event log format */
67
68/* Two bytes ASCII section IDs */
69#define PSERIES_ELOG_SECT_ID_PRIV_HDR (('P' << 8) | 'H')
70#define PSERIES_ELOG_SECT_ID_USER_HDR (('U' << 8) | 'H')
71#define PSERIES_ELOG_SECT_ID_PRIMARY_SRC (('P' << 8) | 'S')
72#define PSERIES_ELOG_SECT_ID_EXTENDED_UH (('E' << 8) | 'H')
73#define PSERIES_ELOG_SECT_ID_FAILING_MTMS (('M' << 8) | 'T')
74#define PSERIES_ELOG_SECT_ID_SECONDARY_SRC (('S' << 8) | 'S')
75#define PSERIES_ELOG_SECT_ID_DUMP_LOCATOR (('D' << 8) | 'H')
76#define PSERIES_ELOG_SECT_ID_FW_ERROR (('S' << 8) | 'W')
77#define PSERIES_ELOG_SECT_ID_IMPACT_PART_ID (('L' << 8) | 'P')
78#define PSERIES_ELOG_SECT_ID_LOGIC_RESOURCE_ID (('L' << 8) | 'R')
79#define PSERIES_ELOG_SECT_ID_HMC_ID (('H' << 8) | 'M')
80#define PSERIES_ELOG_SECT_ID_EPOW (('E' << 8) | 'P')
81#define PSERIES_ELOG_SECT_ID_IO_EVENT (('I' << 8) | 'E')
82#define PSERIES_ELOG_SECT_ID_MANUFACT_INFO (('M' << 8) | 'I')
83#define PSERIES_ELOG_SECT_ID_CALL_HOME (('C' << 8) | 'H')
84#define PSERIES_ELOG_SECT_ID_USER_DEF (('U' << 8) | 'D')
85
86/* Vendor specific Platform Event Log Format, Version 6, section header */
87struct pseries_elog_section {
88 uint16_t id; /* 0x00 2-byte ASCII section ID */
89 uint16_t length; /* 0x02 Section length in bytes */
90 uint8_t version; /* 0x04 Section version */
91 uint8_t subtype; /* 0x05 Section subtype */
92 uint16_t creator_component; /* 0x06 Creator component ID */
93 uint8_t data[]; /* 0x08 Start of section data */
94};
95
96static char ioei_rtas_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned; 66static char ioei_rtas_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned;
97 67
98/** 68/**
99 * Find data portion of a specific section in RTAS extended event log.
100 * @elog: RTAS error/event log.
101 * @sect_id: secsion ID.
102 *
103 * Return:
104 * pointer to the section data of the specified section
105 * NULL if not found
106 */
107static struct pseries_elog_section *find_xelog_section(struct rtas_error_log *elog,
108 uint16_t sect_id)
109{
110 struct rtas_ext_event_log_v6 *xelog =
111 (struct rtas_ext_event_log_v6 *) elog->buffer;
112 struct pseries_elog_section *sect;
113 unsigned char *p, *log_end;
114
115 /* Check that we understand the format */
116 if (elog->extended_log_length < sizeof(struct rtas_ext_event_log_v6) ||
117 xelog->log_format != RTAS_V6EXT_LOG_FORMAT_EVENT_LOG ||
118 xelog->company_id != RTAS_V6EXT_COMPANY_ID_IBM)
119 return NULL;
120
121 log_end = elog->buffer + elog->extended_log_length;
122 p = xelog->vendor_log;
123 while (p < log_end) {
124 sect = (struct pseries_elog_section *)p;
125 if (sect->id == sect_id)
126 return sect;
127 p += sect->length;
128 }
129 return NULL;
130}
131
132/**
133 * Find the data portion of an IO Event section from event log. 69 * Find the data portion of an IO Event section from event log.
134 * @elog: RTAS error/event log. 70 * @elog: RTAS error/event log.
135 * 71 *
@@ -138,7 +74,7 @@ static struct pseries_elog_section *find_xelog_section(struct rtas_error_log *el
138 */ 74 */
139static struct pseries_io_event * ioei_find_event(struct rtas_error_log *elog) 75static struct pseries_io_event * ioei_find_event(struct rtas_error_log *elog)
140{ 76{
141 struct pseries_elog_section *sect; 77 struct pseries_errorlog *sect;
142 78
143 /* We should only ever get called for io-event interrupts, but if 79 /* We should only ever get called for io-event interrupts, but if
144 * we do get called for another type then something went wrong so 80 * we do get called for another type then something went wrong so
@@ -152,7 +88,7 @@ static struct pseries_io_event * ioei_find_event(struct rtas_error_log *elog)
152 return NULL; 88 return NULL;
153 } 89 }
154 90
155 sect = find_xelog_section(elog, PSERIES_ELOG_SECT_ID_IO_EVENT); 91 sect = get_pseries_errorlog(elog, PSERIES_ELOG_SECT_ID_IO_EVENT);
156 if (unlikely(!sect)) { 92 if (unlikely(!sect)) {
157 printk_once(KERN_WARNING "io_event_irq: RTAS extended event " 93 printk_once(KERN_WARNING "io_event_irq: RTAS extended event "
158 "log does not contain an IO Event section. " 94 "log does not contain an IO Event section. "
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index c442f2b1980f..0915b1ad66ce 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -809,8 +809,7 @@ machine_arch_initcall(pseries, find_existing_ddw_windows);
809static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, 809static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail,
810 struct ddw_query_response *query) 810 struct ddw_query_response *query)
811{ 811{
812 struct device_node *dn; 812 struct eeh_dev *edev;
813 struct pci_dn *pcidn;
814 u32 cfg_addr; 813 u32 cfg_addr;
815 u64 buid; 814 u64 buid;
816 int ret; 815 int ret;
@@ -821,12 +820,12 @@ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail,
821 * Retrieve them from the pci device, not the node with the 820 * Retrieve them from the pci device, not the node with the
822 * dma-window property 821 * dma-window property
823 */ 822 */
824 dn = pci_device_to_OF_node(dev); 823 edev = pci_dev_to_eeh_dev(dev);
825 pcidn = PCI_DN(dn); 824 cfg_addr = edev->config_addr;
826 cfg_addr = pcidn->eeh_config_addr; 825 if (edev->pe_config_addr)
827 if (pcidn->eeh_pe_config_addr) 826 cfg_addr = edev->pe_config_addr;
828 cfg_addr = pcidn->eeh_pe_config_addr; 827 buid = edev->phb->buid;
829 buid = pcidn->phb->buid; 828
830 ret = rtas_call(ddw_avail[0], 3, 5, (u32 *)query, 829 ret = rtas_call(ddw_avail[0], 3, 5, (u32 *)query,
831 cfg_addr, BUID_HI(buid), BUID_LO(buid)); 830 cfg_addr, BUID_HI(buid), BUID_LO(buid));
832 dev_info(&dev->dev, "ibm,query-pe-dma-windows(%x) %x %x %x" 831 dev_info(&dev->dev, "ibm,query-pe-dma-windows(%x) %x %x %x"
@@ -839,8 +838,7 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail,
839 struct ddw_create_response *create, int page_shift, 838 struct ddw_create_response *create, int page_shift,
840 int window_shift) 839 int window_shift)
841{ 840{
842 struct device_node *dn; 841 struct eeh_dev *edev;
843 struct pci_dn *pcidn;
844 u32 cfg_addr; 842 u32 cfg_addr;
845 u64 buid; 843 u64 buid;
846 int ret; 844 int ret;
@@ -851,12 +849,11 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail,
851 * Retrieve them from the pci device, not the node with the 849 * Retrieve them from the pci device, not the node with the
852 * dma-window property 850 * dma-window property
853 */ 851 */
854 dn = pci_device_to_OF_node(dev); 852 edev = pci_dev_to_eeh_dev(dev);
855 pcidn = PCI_DN(dn); 853 cfg_addr = edev->config_addr;
856 cfg_addr = pcidn->eeh_config_addr; 854 if (edev->pe_config_addr)
857 if (pcidn->eeh_pe_config_addr) 855 cfg_addr = edev->pe_config_addr;
858 cfg_addr = pcidn->eeh_pe_config_addr; 856 buid = edev->phb->buid;
859 buid = pcidn->phb->buid;
860 857
861 do { 858 do {
862 /* extra outputs are LIOBN and dma-addr (hi, lo) */ 859 /* extra outputs are LIOBN and dma-addr (hi, lo) */
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 086d2ae4e06a..c4dfccd3a3d9 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -16,37 +16,15 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19/* Change Activity:
20 * 2001/09/21 : engebret : Created with minimal EPOW and HW exception support.
21 * End Change Activity
22 */
23
24#include <linux/errno.h>
25#include <linux/threads.h>
26#include <linux/kernel_stat.h>
27#include <linux/signal.h>
28#include <linux/sched.h> 19#include <linux/sched.h>
29#include <linux/ioport.h>
30#include <linux/interrupt.h> 20#include <linux/interrupt.h>
31#include <linux/timex.h>
32#include <linux/init.h>
33#include <linux/delay.h>
34#include <linux/irq.h> 21#include <linux/irq.h>
35#include <linux/random.h> 22#include <linux/of.h>
36#include <linux/sysrq.h> 23#include <linux/fs.h>
37#include <linux/bitops.h> 24#include <linux/reboot.h>
38 25
39#include <asm/uaccess.h>
40#include <asm/system.h>
41#include <asm/io.h>
42#include <asm/pgtable.h>
43#include <asm/irq.h>
44#include <asm/cache.h>
45#include <asm/prom.h>
46#include <asm/ptrace.h>
47#include <asm/machdep.h> 26#include <asm/machdep.h>
48#include <asm/rtas.h> 27#include <asm/rtas.h>
49#include <asm/udbg.h>
50#include <asm/firmware.h> 28#include <asm/firmware.h>
51 29
52#include "pseries.h" 30#include "pseries.h"
@@ -57,7 +35,6 @@ static DEFINE_SPINLOCK(ras_log_buf_lock);
57static char global_mce_data_buf[RTAS_ERROR_LOG_MAX]; 35static char global_mce_data_buf[RTAS_ERROR_LOG_MAX];
58static DEFINE_PER_CPU(__u64, mce_data_buf); 36static DEFINE_PER_CPU(__u64, mce_data_buf);
59 37
60static int ras_get_sensor_state_token;
61static int ras_check_exception_token; 38static int ras_check_exception_token;
62 39
63#define EPOW_SENSOR_TOKEN 9 40#define EPOW_SENSOR_TOKEN 9
@@ -75,7 +52,6 @@ static int __init init_ras_IRQ(void)
75{ 52{
76 struct device_node *np; 53 struct device_node *np;
77 54
78 ras_get_sensor_state_token = rtas_token("get-sensor-state");
79 ras_check_exception_token = rtas_token("check-exception"); 55 ras_check_exception_token = rtas_token("check-exception");
80 56
81 /* Internal Errors */ 57 /* Internal Errors */
@@ -95,26 +71,126 @@ static int __init init_ras_IRQ(void)
95 71
96 return 0; 72 return 0;
97} 73}
98__initcall(init_ras_IRQ); 74subsys_initcall(init_ras_IRQ);
99 75
100/* 76#define EPOW_SHUTDOWN_NORMAL 1
101 * Handle power subsystem events (EPOW). 77#define EPOW_SHUTDOWN_ON_UPS 2
102 * 78#define EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS 3
103 * Presently we just log the event has occurred. This should be fixed 79#define EPOW_SHUTDOWN_AMBIENT_TEMPERATURE_TOO_HIGH 4
104 * to examine the type of power failure and take appropriate action where 80
105 * the time horizon permits something useful to be done. 81static void handle_system_shutdown(char event_modifier)
106 */ 82{
83 switch (event_modifier) {
84 case EPOW_SHUTDOWN_NORMAL:
85 pr_emerg("Firmware initiated power off");
86 orderly_poweroff(1);
87 break;
88
89 case EPOW_SHUTDOWN_ON_UPS:
90 pr_emerg("Loss of power reported by firmware, system is "
91 "running on UPS/battery");
92 break;
93
94 case EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS:
95 pr_emerg("Loss of system critical functions reported by "
96 "firmware");
97 pr_emerg("Check RTAS error log for details");
98 orderly_poweroff(1);
99 break;
100
101 case EPOW_SHUTDOWN_AMBIENT_TEMPERATURE_TOO_HIGH:
102 pr_emerg("Ambient temperature too high reported by firmware");
103 pr_emerg("Check RTAS error log for details");
104 orderly_poweroff(1);
105 break;
106
107 default:
108 pr_err("Unknown power/cooling shutdown event (modifier %d)",
109 event_modifier);
110 }
111}
112
113struct epow_errorlog {
114 unsigned char sensor_value;
115 unsigned char event_modifier;
116 unsigned char extended_modifier;
117 unsigned char reserved;
118 unsigned char platform_reason;
119};
120
121#define EPOW_RESET 0
122#define EPOW_WARN_COOLING 1
123#define EPOW_WARN_POWER 2
124#define EPOW_SYSTEM_SHUTDOWN 3
125#define EPOW_SYSTEM_HALT 4
126#define EPOW_MAIN_ENCLOSURE 5
127#define EPOW_POWER_OFF 7
128
129void rtas_parse_epow_errlog(struct rtas_error_log *log)
130{
131 struct pseries_errorlog *pseries_log;
132 struct epow_errorlog *epow_log;
133 char action_code;
134 char modifier;
135
136 pseries_log = get_pseries_errorlog(log, PSERIES_ELOG_SECT_ID_EPOW);
137 if (pseries_log == NULL)
138 return;
139
140 epow_log = (struct epow_errorlog *)pseries_log->data;
141 action_code = epow_log->sensor_value & 0xF; /* bottom 4 bits */
142 modifier = epow_log->event_modifier & 0xF; /* bottom 4 bits */
143
144 switch (action_code) {
145 case EPOW_RESET:
146 pr_err("Non critical power or cooling issue cleared");
147 break;
148
149 case EPOW_WARN_COOLING:
150 pr_err("Non critical cooling issue reported by firmware");
151 pr_err("Check RTAS error log for details");
152 break;
153
154 case EPOW_WARN_POWER:
155 pr_err("Non critical power issue reported by firmware");
156 pr_err("Check RTAS error log for details");
157 break;
158
159 case EPOW_SYSTEM_SHUTDOWN:
160 handle_system_shutdown(epow_log->event_modifier);
161 break;
162
163 case EPOW_SYSTEM_HALT:
164 pr_emerg("Firmware initiated power off");
165 orderly_poweroff(1);
166 break;
167
168 case EPOW_MAIN_ENCLOSURE:
169 case EPOW_POWER_OFF:
170 pr_emerg("Critical power/cooling issue reported by firmware");
171 pr_emerg("Check RTAS error log for details");
172 pr_emerg("Immediate power off");
173 emergency_sync();
174 kernel_power_off();
175 break;
176
177 default:
178 pr_err("Unknown power/cooling event (action code %d)",
179 action_code);
180 }
181}
182
183/* Handle environmental and power warning (EPOW) interrupts. */
107static irqreturn_t ras_epow_interrupt(int irq, void *dev_id) 184static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)
108{ 185{
109 int status = 0xdeadbeef; 186 int status;
110 int state = 0; 187 int state;
111 int critical; 188 int critical;
112 189
113 status = rtas_call(ras_get_sensor_state_token, 2, 2, &state, 190 status = rtas_get_sensor(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, &state);
114 EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX);
115 191
116 if (state > 3) 192 if (state > 3)
117 critical = 1; /* Time Critical */ 193 critical = 1; /* Time Critical */
118 else 194 else
119 critical = 0; 195 critical = 0;
120 196
@@ -123,18 +199,14 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)
123 status = rtas_call(ras_check_exception_token, 6, 1, NULL, 199 status = rtas_call(ras_check_exception_token, 6, 1, NULL,
124 RTAS_VECTOR_EXTERNAL_INTERRUPT, 200 RTAS_VECTOR_EXTERNAL_INTERRUPT,
125 virq_to_hw(irq), 201 virq_to_hw(irq),
126 RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS, 202 RTAS_EPOW_WARNING,
127 critical, __pa(&ras_log_buf), 203 critical, __pa(&ras_log_buf),
128 rtas_get_error_log_max()); 204 rtas_get_error_log_max());
129 205
130 udbg_printf("EPOW <0x%lx 0x%x 0x%x>\n",
131 *((unsigned long *)&ras_log_buf), status, state);
132 printk(KERN_WARNING "EPOW <0x%lx 0x%x 0x%x>\n",
133 *((unsigned long *)&ras_log_buf), status, state);
134
135 /* format and print the extended information */
136 log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, 0); 206 log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, 0);
137 207
208 rtas_parse_epow_errlog((struct rtas_error_log *)ras_log_buf);
209
138 spin_unlock(&ras_log_buf_lock); 210 spin_unlock(&ras_log_buf_lock);
139 return IRQ_HANDLED; 211 return IRQ_HANDLED;
140} 212}
@@ -150,7 +222,7 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)
150static irqreturn_t ras_error_interrupt(int irq, void *dev_id) 222static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
151{ 223{
152 struct rtas_error_log *rtas_elog; 224 struct rtas_error_log *rtas_elog;
153 int status = 0xdeadbeef; 225 int status;
154 int fatal; 226 int fatal;
155 227
156 spin_lock(&ras_log_buf_lock); 228 spin_lock(&ras_log_buf_lock);
@@ -158,7 +230,7 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
158 status = rtas_call(ras_check_exception_token, 6, 1, NULL, 230 status = rtas_call(ras_check_exception_token, 6, 1, NULL,
159 RTAS_VECTOR_EXTERNAL_INTERRUPT, 231 RTAS_VECTOR_EXTERNAL_INTERRUPT,
160 virq_to_hw(irq), 232 virq_to_hw(irq),
161 RTAS_INTERNAL_ERROR, 1 /*Time Critical */, 233 RTAS_INTERNAL_ERROR, 1 /* Time Critical */,
162 __pa(&ras_log_buf), 234 __pa(&ras_log_buf),
163 rtas_get_error_log_max()); 235 rtas_get_error_log_max());
164 236
@@ -173,24 +245,13 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
173 log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, fatal); 245 log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, fatal);
174 246
175 if (fatal) { 247 if (fatal) {
176 udbg_printf("Fatal HW Error <0x%lx 0x%x>\n", 248 pr_emerg("Fatal hardware error reported by firmware");
177 *((unsigned long *)&ras_log_buf), status); 249 pr_emerg("Check RTAS error log for details");
178 printk(KERN_EMERG "Error: Fatal hardware error <0x%lx 0x%x>\n", 250 pr_emerg("Immediate power off");
179 *((unsigned long *)&ras_log_buf), status); 251 emergency_sync();
180 252 kernel_power_off();
181#ifndef DEBUG_RTAS_POWER_OFF
182 /* Don't actually power off when debugging so we can test
183 * without actually failing while injecting errors.
184 * Error data will not be logged to syslog.
185 */
186 ppc_md.power_off();
187#endif
188 } else { 253 } else {
189 udbg_printf("Recoverable HW Error <0x%lx 0x%x>\n", 254 pr_err("Recoverable hardware error reported by firmware");
190 *((unsigned long *)&ras_log_buf), status);
191 printk(KERN_WARNING
192 "Warning: Recoverable hardware error <0x%lx 0x%x>\n",
193 *((unsigned long *)&ras_log_buf), status);
194 } 255 }
195 256
196 spin_unlock(&ras_log_buf_lock); 257 spin_unlock(&ras_log_buf_lock);
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h
index 9d83d3bcb494..432afa838861 100644
--- a/arch/sparc/include/asm/vio.h
+++ b/arch/sparc/include/asm/vio.h
@@ -284,6 +284,7 @@ struct vio_dev {
284}; 284};
285 285
286struct vio_driver { 286struct vio_driver {
287 const char *name;
287 struct list_head node; 288 struct list_head node;
288 const struct vio_device_id *id_table; 289 const struct vio_device_id *id_table;
289 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); 290 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
@@ -371,7 +372,13 @@ do { if (vio->debug & VIO_DEBUG_##TYPE) \
371 vio->vdev->channel_id, ## a); \ 372 vio->vdev->channel_id, ## a); \
372} while (0) 373} while (0)
373 374
374extern int vio_register_driver(struct vio_driver *drv); 375extern int __vio_register_driver(struct vio_driver *drv, struct module *owner,
376 const char *mod_name);
377/*
378 * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded
379 */
380#define vio_register_driver(driver) \
381 __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
375extern void vio_unregister_driver(struct vio_driver *drv); 382extern void vio_unregister_driver(struct vio_driver *drv);
376 383
377static inline struct vio_driver *to_vio_driver(struct device_driver *drv) 384static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 381edcd5bc29..fea13c7b1aee 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -1244,10 +1244,7 @@ static struct vio_driver ds_driver = {
1244 .id_table = ds_match, 1244 .id_table = ds_match,
1245 .probe = ds_probe, 1245 .probe = ds_probe,
1246 .remove = ds_remove, 1246 .remove = ds_remove,
1247 .driver = { 1247 .name = "ds",
1248 .name = "ds",
1249 .owner = THIS_MODULE,
1250 }
1251}; 1248};
1252 1249
1253static int __init ds_init(void) 1250static int __init ds_init(void)
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index f67e28ef598c..5cffdc55f075 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -119,13 +119,17 @@ static struct bus_type vio_bus_type = {
119 .remove = vio_device_remove, 119 .remove = vio_device_remove,
120}; 120};
121 121
122int vio_register_driver(struct vio_driver *viodrv) 122int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
123 const char *mod_name)
123{ 124{
124 viodrv->driver.bus = &vio_bus_type; 125 viodrv->driver.bus = &vio_bus_type;
126 viodrv->driver.name = viodrv->name;
127 viodrv->driver.owner = owner;
128 viodrv->driver.mod_name = mod_name;
125 129
126 return driver_register(&viodrv->driver); 130 return driver_register(&viodrv->driver);
127} 131}
128EXPORT_SYMBOL(vio_register_driver); 132EXPORT_SYMBOL(__vio_register_driver);
129 133
130void vio_unregister_driver(struct vio_driver *viodrv) 134void vio_unregister_driver(struct vio_driver *viodrv)
131{ 135{
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 48e8fee9f2d4..9dcf76a10bb6 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -839,10 +839,7 @@ static struct vio_driver vdc_port_driver = {
839 .id_table = vdc_port_match, 839 .id_table = vdc_port_match,
840 .probe = vdc_port_probe, 840 .probe = vdc_port_probe,
841 .remove = vdc_port_remove, 841 .remove = vdc_port_remove,
842 .driver = { 842 .name = "vdc_port",
843 .name = "vdc_port",
844 .owner = THIS_MODULE,
845 }
846}; 843};
847 844
848static int __init vdc_init(void) 845static int __init vdc_init(void)
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index e877371680a9..9010cea68bc3 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1616,11 +1616,8 @@ static struct vio_driver ibmveth_driver = {
1616 .probe = ibmveth_probe, 1616 .probe = ibmveth_probe,
1617 .remove = ibmveth_remove, 1617 .remove = ibmveth_remove,
1618 .get_desired_dma = ibmveth_get_desired_dma, 1618 .get_desired_dma = ibmveth_get_desired_dma,
1619 .driver = { 1619 .name = ibmveth_driver_name,
1620 .name = ibmveth_driver_name, 1620 .pm = &ibmveth_pm_ops,
1621 .owner = THIS_MODULE,
1622 .pm = &ibmveth_pm_ops,
1623 }
1624}; 1621};
1625 1622
1626static int __init ibmveth_module_init(void) 1623static int __init ibmveth_module_init(void)
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index 92a037a8228a..38e3ae9155b7 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -1259,10 +1259,7 @@ static struct vio_driver vnet_port_driver = {
1259 .id_table = vnet_port_match, 1259 .id_table = vnet_port_match,
1260 .probe = vnet_port_probe, 1260 .probe = vnet_port_probe,
1261 .remove = vnet_port_remove, 1261 .remove = vnet_port_remove,
1262 .driver = { 1262 .name = "vnet_port",
1263 .name = "vnet_port",
1264 .owner = THIS_MODULE,
1265 }
1266}; 1263};
1267 1264
1268static int __init vnet_init(void) 1265static int __init vnet_init(void)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index bdfa223a7dbb..134a0ae85bb7 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -4890,11 +4890,8 @@ static struct vio_driver ibmvfc_driver = {
4890 .probe = ibmvfc_probe, 4890 .probe = ibmvfc_probe,
4891 .remove = ibmvfc_remove, 4891 .remove = ibmvfc_remove,
4892 .get_desired_dma = ibmvfc_get_desired_dma, 4892 .get_desired_dma = ibmvfc_get_desired_dma,
4893 .driver = { 4893 .name = IBMVFC_NAME,
4894 .name = IBMVFC_NAME, 4894 .pm = &ibmvfc_pm_ops,
4895 .owner = THIS_MODULE,
4896 .pm = &ibmvfc_pm_ops,
4897 }
4898}; 4895};
4899 4896
4900static struct fc_function_template ibmvfc_transport_functions = { 4897static struct fc_function_template ibmvfc_transport_functions = {
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index e984951baeb6..3a6c4742951e 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -2061,11 +2061,8 @@ static struct vio_driver ibmvscsi_driver = {
2061 .probe = ibmvscsi_probe, 2061 .probe = ibmvscsi_probe,
2062 .remove = ibmvscsi_remove, 2062 .remove = ibmvscsi_remove,
2063 .get_desired_dma = ibmvscsi_get_desired_dma, 2063 .get_desired_dma = ibmvscsi_get_desired_dma,
2064 .driver = { 2064 .name = "ibmvscsi",
2065 .name = "ibmvscsi", 2065 .pm = &ibmvscsi_pm_ops,
2066 .owner = THIS_MODULE,
2067 .pm = &ibmvscsi_pm_ops,
2068 }
2069}; 2066};
2070 2067
2071static struct srp_function_template ibmvscsi_transport_functions = { 2068static struct srp_function_template ibmvscsi_transport_functions = {
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index 2256babe0474..aa7ed81e9237 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -918,10 +918,7 @@ static struct vio_driver ibmvstgt_driver = {
918 .id_table = ibmvstgt_device_table, 918 .id_table = ibmvstgt_device_table,
919 .probe = ibmvstgt_probe, 919 .probe = ibmvstgt_probe,
920 .remove = ibmvstgt_remove, 920 .remove = ibmvstgt_remove,
921 .driver = { 921 .name = "ibmvscsis",
922 .name = "ibmvscsis",
923 .owner = THIS_MODULE,
924 }
925}; 922};
926 923
927static int get_system_info(void) 924static int get_system_info(void)
diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
index 3a0d53d6368f..ee307799271a 100644
--- a/drivers/tty/hvc/hvc_vio.c
+++ b/drivers/tty/hvc/hvc_vio.c
@@ -310,11 +310,8 @@ static int __devexit hvc_vio_remove(struct vio_dev *vdev)
310static struct vio_driver hvc_vio_driver = { 310static struct vio_driver hvc_vio_driver = {
311 .id_table = hvc_driver_table, 311 .id_table = hvc_driver_table,
312 .probe = hvc_vio_probe, 312 .probe = hvc_vio_probe,
313 .remove = __devexit_p(hvc_vio_remove), 313 .remove = hvc_vio_remove,
314 .driver = { 314 .name = hvc_driver_name,
315 .name = hvc_driver_name,
316 .owner = THIS_MODULE,
317 }
318}; 315};
319 316
320static int __init hvc_vio_init(void) 317static int __init hvc_vio_init(void)
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index d23759183b47..3436436fe2d7 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -879,10 +879,7 @@ static struct vio_driver hvcs_vio_driver = {
879 .id_table = hvcs_driver_table, 879 .id_table = hvcs_driver_table,
880 .probe = hvcs_probe, 880 .probe = hvcs_probe,
881 .remove = __devexit_p(hvcs_remove), 881 .remove = __devexit_p(hvcs_remove),
882 .driver = { 882 .name = hvcs_driver_name,
883 .name = hvcs_driver_name,
884 .owner = THIS_MODULE,
885 }
886}; 883};
887 884
888/* Only called from hvcs_get_pi please */ 885/* Only called from hvcs_get_pi please */
diff --git a/include/linux/of.h b/include/linux/of.h
index ba5d8494f2e1..fa7fb1d97458 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -58,9 +58,6 @@ struct device_node {
58 struct kref kref; 58 struct kref kref;
59 unsigned long _flags; 59 unsigned long _flags;
60 void *data; 60 void *data;
61#if defined(CONFIG_EEH)
62 struct eeh_dev *edev;
63#endif
64#if defined(CONFIG_SPARC) 61#if defined(CONFIG_SPARC)
65 char *path_component_name; 62 char *path_component_name;
66 unsigned int unique_id; 63 unsigned int unique_id;
@@ -75,13 +72,6 @@ struct of_phandle_args {
75 uint32_t args[MAX_PHANDLE_ARGS]; 72 uint32_t args[MAX_PHANDLE_ARGS];
76}; 73};
77 74
78#if defined(CONFIG_EEH)
79static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
80{
81 return dn->edev;
82}
83#endif
84
85#ifdef CONFIG_OF_DYNAMIC 75#ifdef CONFIG_OF_DYNAMIC
86extern struct device_node *of_node_get(struct device_node *node); 76extern struct device_node *of_node_get(struct device_node *node);
87extern void of_node_put(struct device_node *node); 77extern void of_node_put(struct device_node *node);