aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ppc64')
-rw-r--r--include/asm-ppc64/bug.h7
-rw-r--r--include/asm-ppc64/byteorder.h10
-rw-r--r--include/asm-ppc64/compat.h1
-rw-r--r--include/asm-ppc64/cputable.h3
-rw-r--r--include/asm-ppc64/emergency-restart.h6
-rw-r--r--include/asm-ppc64/hvconsole.h17
-rw-r--r--include/asm-ppc64/iSeries/HvCallHpt.h11
-rw-r--r--include/asm-ppc64/iSeries/HvReleaseData.h11
-rw-r--r--include/asm-ppc64/iSeries/ItLpQueue.h15
-rw-r--r--include/asm-ppc64/iSeries/LparMap.h32
-rw-r--r--include/asm-ppc64/kdebug.h2
-rw-r--r--include/asm-ppc64/kexec.h41
-rw-r--r--include/asm-ppc64/kprobes.h5
-rw-r--r--include/asm-ppc64/machdep.h13
-rw-r--r--include/asm-ppc64/mmu.h107
-rw-r--r--include/asm-ppc64/mmzone.h44
-rw-r--r--include/asm-ppc64/nvram.h1
-rw-r--r--include/asm-ppc64/paca.h3
-rw-r--r--include/asm-ppc64/page.h3
-rw-r--r--include/asm-ppc64/pci.h32
-rw-r--r--include/asm-ppc64/ppc32.h2
-rw-r--r--include/asm-ppc64/processor.h41
-rw-r--r--include/asm-ppc64/rtas.h6
-rw-r--r--include/asm-ppc64/smp.h8
-rw-r--r--include/asm-ppc64/sparsemem.h16
-rw-r--r--include/asm-ppc64/thread_info.h2
-rw-r--r--include/asm-ppc64/time.h9
-rw-r--r--include/asm-ppc64/topology.h3
-rw-r--r--include/asm-ppc64/unistd.h9
-rw-r--r--include/asm-ppc64/xics.h1
30 files changed, 323 insertions, 138 deletions
diff --git a/include/asm-ppc64/bug.h b/include/asm-ppc64/bug.h
index 169868fa307d..160178278861 100644
--- a/include/asm-ppc64/bug.h
+++ b/include/asm-ppc64/bug.h
@@ -43,8 +43,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
43 ".section __bug_table,\"a\"\n\t" \ 43 ".section __bug_table,\"a\"\n\t" \
44 " .llong 1b,%1,%2,%3\n" \ 44 " .llong 1b,%1,%2,%3\n" \
45 ".previous" \ 45 ".previous" \
46 : : "r" (x), "i" (__LINE__), "i" (__FILE__), \ 46 : : "r" ((long long)(x)), "i" (__LINE__), \
47 "i" (__FUNCTION__)); \ 47 "i" (__FILE__), "i" (__FUNCTION__)); \
48} while (0) 48} while (0)
49 49
50#define WARN_ON(x) do { \ 50#define WARN_ON(x) do { \
@@ -53,7 +53,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
53 ".section __bug_table,\"a\"\n\t" \ 53 ".section __bug_table,\"a\"\n\t" \
54 " .llong 1b,%1,%2,%3\n" \ 54 " .llong 1b,%1,%2,%3\n" \
55 ".previous" \ 55 ".previous" \
56 : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ 56 : : "r" ((long long)(x)), \
57 "i" (__LINE__ + BUG_WARNING_TRAP), \
57 "i" (__FILE__), "i" (__FUNCTION__)); \ 58 "i" (__FILE__), "i" (__FUNCTION__)); \
58} while (0) 59} while (0)
59 60
diff --git a/include/asm-ppc64/byteorder.h b/include/asm-ppc64/byteorder.h
index 80327532de64..8b57da62b674 100644
--- a/include/asm-ppc64/byteorder.h
+++ b/include/asm-ppc64/byteorder.h
@@ -40,7 +40,6 @@ static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
40 __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); 40 __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
41} 41}
42 42
43#if 0
44static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value) 43static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value)
45{ 44{
46 __u16 result; 45 __u16 result;
@@ -63,17 +62,8 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value)
63 return result; 62 return result;
64} 63}
65 64
66static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 value)
67{
68 __u64 result;
69#error implement me
70}
71
72#define __arch__swab16(x) ___arch__swab16(x) 65#define __arch__swab16(x) ___arch__swab16(x)
73#define __arch__swab32(x) ___arch__swab32(x) 66#define __arch__swab32(x) ___arch__swab32(x)
74#define __arch__swab64(x) ___arch__swab64(x)
75
76#endif
77 67
78/* The same, but returns converted value from the location pointer by addr. */ 68/* The same, but returns converted value from the location pointer by addr. */
79#define __arch__swab16p(addr) ld_le16(addr) 69#define __arch__swab16p(addr) ld_le16(addr)
diff --git a/include/asm-ppc64/compat.h b/include/asm-ppc64/compat.h
index 09c28d28ce6c..12414f5fc666 100644
--- a/include/asm-ppc64/compat.h
+++ b/include/asm-ppc64/compat.h
@@ -26,6 +26,7 @@ typedef s32 compat_daddr_t;
26typedef u32 compat_caddr_t; 26typedef u32 compat_caddr_t;
27typedef __kernel_fsid_t compat_fsid_t; 27typedef __kernel_fsid_t compat_fsid_t;
28typedef s32 compat_key_t; 28typedef s32 compat_key_t;
29typedef s32 compat_timer_t;
29 30
30typedef s32 compat_int_t; 31typedef s32 compat_int_t;
31typedef s32 compat_long_t; 32typedef s32 compat_long_t;
diff --git a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h
index cbbfbec78b6b..d67fa9e26079 100644
--- a/include/asm-ppc64/cputable.h
+++ b/include/asm-ppc64/cputable.h
@@ -138,6 +138,7 @@ extern firmware_feature_t firmware_features_table[];
138#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) 138#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000)
139#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 139#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
140#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) 140#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
141#define CPU_FTR_CTRL ASM_CONST(0x0000100000000000)
141 142
142/* Platform firmware features */ 143/* Platform firmware features */
143#define FW_FTR_ ASM_CONST(0x0000000000000001) 144#define FW_FTR_ ASM_CONST(0x0000000000000001)
@@ -148,7 +149,7 @@ extern firmware_feature_t firmware_features_table[];
148 149
149#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ 150#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \
150 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ 151 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \
151 CPU_FTR_NODSISRALIGN) 152 CPU_FTR_NODSISRALIGN | CPU_FTR_CTRL)
152 153
153/* iSeries doesn't support large pages */ 154/* iSeries doesn't support large pages */
154#ifdef CONFIG_PPC_ISERIES 155#ifdef CONFIG_PPC_ISERIES
diff --git a/include/asm-ppc64/emergency-restart.h b/include/asm-ppc64/emergency-restart.h
new file mode 100644
index 000000000000..108d8c48e42e
--- /dev/null
+++ b/include/asm-ppc64/emergency-restart.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-ppc64/hvconsole.h b/include/asm-ppc64/hvconsole.h
index d89d94c91815..6da93ce74dc0 100644
--- a/include/asm-ppc64/hvconsole.h
+++ b/include/asm-ppc64/hvconsole.h
@@ -29,12 +29,21 @@
29 */ 29 */
30#define MAX_NR_HVC_CONSOLES 16 30#define MAX_NR_HVC_CONSOLES 16
31 31
32/* implemented by a low level driver */
33struct hv_ops {
34 int (*get_chars)(uint32_t vtermno, char *buf, int count);
35 int (*put_chars)(uint32_t vtermno, const char *buf, int count);
36};
32extern int hvc_get_chars(uint32_t vtermno, char *buf, int count); 37extern int hvc_get_chars(uint32_t vtermno, char *buf, int count);
33extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count); 38extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count);
34 39
35/* Early discovery of console adapters. */ 40struct hvc_struct;
36extern int hvc_find_vtys(void);
37 41
38/* Implemented by a console driver */ 42/* Register a vterm and a slot index for use as a console (console_init) */
39extern int hvc_instantiate(uint32_t vtermno, int index); 43extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops);
44/* register a vterm for hvc tty operation (module_init or hotplug add) */
45extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq,
46 struct hv_ops *ops);
47/* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */
48extern int __devexit hvc_remove(struct hvc_struct *hp);
40#endif /* _PPC64_HVCONSOLE_H */ 49#endif /* _PPC64_HVCONSOLE_H */
diff --git a/include/asm-ppc64/iSeries/HvCallHpt.h b/include/asm-ppc64/iSeries/HvCallHpt.h
index 66f38222ff75..43a1969230b8 100644
--- a/include/asm-ppc64/iSeries/HvCallHpt.h
+++ b/include/asm-ppc64/iSeries/HvCallHpt.h
@@ -77,27 +77,26 @@ static inline u64 HvCallHpt_invalidateSetSwBitsGet(u32 hpteIndex, u8 bitson,
77 return compressedStatus; 77 return compressedStatus;
78} 78}
79 79
80static inline u64 HvCallHpt_findValid(HPTE *hpte, u64 vpn) 80static inline u64 HvCallHpt_findValid(hpte_t *hpte, u64 vpn)
81{ 81{
82 return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0); 82 return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0);
83} 83}
84 84
85static inline u64 HvCallHpt_findNextValid(HPTE *hpte, u32 hpteIndex, 85static inline u64 HvCallHpt_findNextValid(hpte_t *hpte, u32 hpteIndex,
86 u8 bitson, u8 bitsoff) 86 u8 bitson, u8 bitsoff)
87{ 87{
88 return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex, 88 return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex,
89 bitson, bitsoff); 89 bitson, bitsoff);
90} 90}
91 91
92static inline void HvCallHpt_get(HPTE *hpte, u32 hpteIndex) 92static inline void HvCallHpt_get(hpte_t *hpte, u32 hpteIndex)
93{ 93{
94 HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0); 94 HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0);
95} 95}
96 96
97static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit, HPTE *hpte) 97static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit, hpte_t *hpte)
98{ 98{
99 HvCall4(HvCallHptAddValidate, hpteIndex, hBit, (*((u64 *)hpte)), 99 HvCall4(HvCallHptAddValidate, hpteIndex, hBit, hpte->v, hpte->r);
100 (*(((u64 *)hpte)+1)));
101} 100}
102 101
103#endif /* _HVCALLHPT_H */ 102#endif /* _HVCALLHPT_H */
diff --git a/include/asm-ppc64/iSeries/HvReleaseData.h b/include/asm-ppc64/iSeries/HvReleaseData.h
index 01a1f13ea4a0..c8162e5ccb21 100644
--- a/include/asm-ppc64/iSeries/HvReleaseData.h
+++ b/include/asm-ppc64/iSeries/HvReleaseData.h
@@ -39,6 +39,11 @@
39 * know that this PLIC does not support running an OS "that old". 39 * know that this PLIC does not support running an OS "that old".
40 */ 40 */
41 41
42#define HVREL_TAGSINACTIVE 0x8000
43#define HVREL_32BIT 0x4000
44#define HVREL_NOSHAREDPROCS 0x2000
45#define HVREL_NOHMT 0x1000
46
42struct HvReleaseData { 47struct HvReleaseData {
43 u32 xDesc; /* Descriptor "HvRD" ebcdic x00-x03 */ 48 u32 xDesc; /* Descriptor "HvRD" ebcdic x00-x03 */
44 u16 xSize; /* Size of this control block x04-x05 */ 49 u16 xSize; /* Size of this control block x04-x05 */
@@ -46,11 +51,7 @@ struct HvReleaseData {
46 struct naca_struct *xSlicNacaAddr; /* Virt addr of SLIC NACA x08-x0F */ 51 struct naca_struct *xSlicNacaAddr; /* Virt addr of SLIC NACA x08-x0F */
47 u32 xMsNucDataOffset; /* Offset of Linux Mapping Data x10-x13 */ 52 u32 xMsNucDataOffset; /* Offset of Linux Mapping Data x10-x13 */
48 u32 xRsvd1; /* Reserved x14-x17 */ 53 u32 xRsvd1; /* Reserved x14-x17 */
49 u16 xTagsMode:1; /* 0 == tags active, 1 == tags inactive */ 54 u16 xFlags;
50 u16 xAddressSize:1; /* 0 == 64-bit, 1 == 32-bit */
51 u16 xNoSharedProcs:1; /* 0 == shared procs, 1 == no shared */
52 u16 xNoHMT:1; /* 0 == allow HMT, 1 == no HMT */
53 u16 xRsvd2:12; /* Reserved x18-x19 */
54 u16 xVrmIndex; /* VRM Index of OS image x1A-x1B */ 55 u16 xVrmIndex; /* VRM Index of OS image x1A-x1B */
55 u16 xMinSupportedPlicVrmIndex; /* Min PLIC level (soft) x1C-x1D */ 56 u16 xMinSupportedPlicVrmIndex; /* Min PLIC level (soft) x1C-x1D */
56 u16 xMinCompatablePlicVrmIndex; /* Min PLIC levelP (hard) x1E-x1F */ 57 u16 xMinCompatablePlicVrmIndex; /* Min PLIC levelP (hard) x1E-x1F */
diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h
index 393299e04d7f..69b26ad74135 100644
--- a/include/asm-ppc64/iSeries/ItLpQueue.h
+++ b/include/asm-ppc64/iSeries/ItLpQueue.h
@@ -41,7 +41,7 @@ struct HvLpEvent;
41#define LpEventMaxSize 256 41#define LpEventMaxSize 256
42#define LpEventAlign 64 42#define LpEventAlign 64
43 43
44struct ItLpQueue { 44struct hvlpevent_queue {
45/* 45/*
46 * The xSlicCurEventPtr is the pointer to the next event stack entry 46 * The xSlicCurEventPtr is the pointer to the next event stack entry
47 * that will become valid. The OS must peek at this entry to determine 47 * that will become valid. The OS must peek at this entry to determine
@@ -69,16 +69,13 @@ struct ItLpQueue {
69 char *xSlicEventStackPtr; // 0x20 69 char *xSlicEventStackPtr; // 0x20
70 u8 xIndex; // 0x28 unique sequential index. 70 u8 xIndex; // 0x28 unique sequential index.
71 u8 xSlicRsvd[3]; // 0x29-2b 71 u8 xSlicRsvd[3]; // 0x29-2b
72 u32 xInUseWord; // 0x2C 72 spinlock_t lock;
73 u64 xLpIntCount; // 0x30 Total Lp Int msgs processed
74 u64 xLpIntCountByType[9]; // 0x38-0x7F Event counts by type
75}; 73};
76 74
77extern struct ItLpQueue xItLpQueue; 75extern struct hvlpevent_queue hvlpevent_queue;
78 76
79extern struct HvLpEvent *ItLpQueue_getNextLpEvent(struct ItLpQueue *); 77extern int hvlpevent_is_pending(void);
80extern int ItLpQueue_isLpIntPending(struct ItLpQueue *); 78extern void process_hvlpevents(struct pt_regs *);
81extern unsigned ItLpQueue_process(struct ItLpQueue *, struct pt_regs *); 79extern void setup_hvlpevent_queue(void);
82extern void ItLpQueue_clearValid(struct HvLpEvent *);
83 80
84#endif /* _ITLPQUEUE_H */ 81#endif /* _ITLPQUEUE_H */
diff --git a/include/asm-ppc64/iSeries/LparMap.h b/include/asm-ppc64/iSeries/LparMap.h
index 038e5df7e9f8..a6840b186d03 100644
--- a/include/asm-ppc64/iSeries/LparMap.h
+++ b/include/asm-ppc64/iSeries/LparMap.h
@@ -19,6 +19,8 @@
19#ifndef _LPARMAP_H 19#ifndef _LPARMAP_H
20#define _LPARMAP_H 20#define _LPARMAP_H
21 21
22#ifndef __ASSEMBLY__
23
22#include <asm/types.h> 24#include <asm/types.h>
23 25
24/* 26/*
@@ -49,21 +51,33 @@
49 * entry to map the Esid to the Vsid. 51 * entry to map the Esid to the Vsid.
50*/ 52*/
51 53
54#define HvEsidsToMap 2
55#define HvRangesToMap 1
56
52/* Hypervisor initially maps 32MB of the load area */ 57/* Hypervisor initially maps 32MB of the load area */
53#define HvPagesToMap 8192 58#define HvPagesToMap 8192
54 59
55struct LparMap { 60struct LparMap {
56 u64 xNumberEsids; // Number of ESID/VSID pairs (1) 61 u64 xNumberEsids; // Number of ESID/VSID pairs
57 u64 xNumberRanges; // Number of VA ranges to map (1) 62 u64 xNumberRanges; // Number of VA ranges to map
58 u64 xSegmentTableOffs; // Page number within load area of seg table (0) 63 u64 xSegmentTableOffs; // Page number within load area of seg table
59 u64 xRsvd[5]; 64 u64 xRsvd[5];
60 u64 xKernelEsid; // Esid used to map kernel load (0x0C00000000) 65 struct {
61 u64 xKernelVsid; // Vsid used to map kernel load (0x0C00000000) 66 u64 xKernelEsid; // Esid used to map kernel load
62 u64 xPages; // Number of pages to be mapped (8192) 67 u64 xKernelVsid; // Vsid used to map kernel load
63 u64 xOffset; // Offset from start of load area (0) 68 } xEsids[HvEsidsToMap];
64 u64 xVPN; // Virtual Page Number (0x000C000000000000) 69 struct {
70 u64 xPages; // Number of pages to be mapped
71 u64 xOffset; // Offset from start of load area
72 u64 xVPN; // Virtual Page Number
73 } xRanges[HvRangesToMap];
65}; 74};
66 75
67extern struct LparMap xLparMap; 76extern const struct LparMap xLparMap;
77
78#endif /* __ASSEMBLY__ */
79
80/* the fixed address where the LparMap exists */
81#define LPARMAP_PHYS 0x7000
68 82
69#endif /* _LPARMAP_H */ 83#endif /* _LPARMAP_H */
diff --git a/include/asm-ppc64/kdebug.h b/include/asm-ppc64/kdebug.h
index 488634258a72..d383d161cf8d 100644
--- a/include/asm-ppc64/kdebug.h
+++ b/include/asm-ppc64/kdebug.h
@@ -17,7 +17,7 @@ struct die_args {
17 17
18/* 18/*
19 Note - you should never unregister because that can race with NMIs. 19 Note - you should never unregister because that can race with NMIs.
20 If you really want to do it first unregister - then synchronize_kernel - 20 If you really want to do it first unregister - then synchronize_sched -
21 then free. 21 then free.
22 */ 22 */
23int register_die_notifier(struct notifier_block *nb); 23int register_die_notifier(struct notifier_block *nb);
diff --git a/include/asm-ppc64/kexec.h b/include/asm-ppc64/kexec.h
new file mode 100644
index 000000000000..511908afaeeb
--- /dev/null
+++ b/include/asm-ppc64/kexec.h
@@ -0,0 +1,41 @@
1#ifndef _PPC64_KEXEC_H
2#define _PPC64_KEXEC_H
3
4/*
5 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
6 * I.e. Maximum page that is mapped directly into kernel memory,
7 * and kmap is not required.
8 */
9
10/* Maximum physical address we can use pages from */
11/* XXX: since we copy virt we can use any page we allocate */
12#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
13
14/* Maximum address we can reach in physical address mode */
15/* XXX: I want to allow initrd in highmem. otherwise set to rmo on lpar */
16#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
17
18/* Maximum address we can use for the control code buffer */
19/* XXX: unused today, ppc32 uses TASK_SIZE, probably left over from use_mm */
20#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
21
22/* XXX: today we don't use this at all, althogh we have a static stack */
23#define KEXEC_CONTROL_CODE_SIZE 4096
24
25/* The native architecture */
26#define KEXEC_ARCH KEXEC_ARCH_PPC64
27
28#define MAX_NOTE_BYTES 1024
29
30#ifndef __ASSEMBLY__
31
32typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
33
34extern note_buf_t crash_notes[];
35
36extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
37 master to copy new code to 0 */
38
39#endif /* __ASSEMBLY__ */
40#endif /* _PPC_KEXEC_H */
41
diff --git a/include/asm-ppc64/kprobes.h b/include/asm-ppc64/kprobes.h
index 19b468bed059..0802919c3235 100644
--- a/include/asm-ppc64/kprobes.h
+++ b/include/asm-ppc64/kprobes.h
@@ -42,10 +42,13 @@ typedef unsigned int kprobe_opcode_t;
42 42
43#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry) 43#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry)
44 44
45#define ARCH_SUPPORTS_KRETPROBES
46void kretprobe_trampoline(void);
47
45/* Architecture specific copy of original instruction */ 48/* Architecture specific copy of original instruction */
46struct arch_specific_insn { 49struct arch_specific_insn {
47 /* copy of original instruction */ 50 /* copy of original instruction */
48 kprobe_opcode_t insn[MAX_INSN_SIZE]; 51 kprobe_opcode_t *insn;
49}; 52};
50 53
51#ifdef CONFIG_KPROBES 54#ifdef CONFIG_KPROBES
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index 5d3cd9d042e2..f0ef06375947 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -53,10 +53,8 @@ struct machdep_calls {
53 long (*hpte_insert)(unsigned long hpte_group, 53 long (*hpte_insert)(unsigned long hpte_group,
54 unsigned long va, 54 unsigned long va,
55 unsigned long prpn, 55 unsigned long prpn,
56 int secondary, 56 unsigned long vflags,
57 unsigned long hpteflags, 57 unsigned long rflags);
58 int bolted,
59 int large);
60 long (*hpte_remove)(unsigned long hpte_group); 58 long (*hpte_remove)(unsigned long hpte_group);
61 void (*flush_hash_range)(unsigned long context, 59 void (*flush_hash_range)(unsigned long context,
62 unsigned long number, 60 unsigned long number,
@@ -76,6 +74,7 @@ struct machdep_calls {
76 void (*tce_flush)(struct iommu_table *tbl); 74 void (*tce_flush)(struct iommu_table *tbl);
77 void (*iommu_dev_setup)(struct pci_dev *dev); 75 void (*iommu_dev_setup)(struct pci_dev *dev);
78 void (*iommu_bus_setup)(struct pci_bus *bus); 76 void (*iommu_bus_setup)(struct pci_bus *bus);
77 void (*irq_bus_setup)(struct pci_bus *bus);
79 78
80 int (*probe)(int platform); 79 int (*probe)(int platform);
81 void (*setup_arch)(void); 80 void (*setup_arch)(void);
@@ -85,6 +84,7 @@ struct machdep_calls {
85 84
86 void (*init_IRQ)(void); 85 void (*init_IRQ)(void);
87 int (*get_irq)(struct pt_regs *); 86 int (*get_irq)(struct pt_regs *);
87 void (*cpu_irq_down)(int secondary);
88 88
89 /* PCI stuff */ 89 /* PCI stuff */
90 void (*pcibios_fixup)(void); 90 void (*pcibios_fixup)(void);
@@ -138,8 +138,13 @@ struct machdep_calls {
138 unsigned long size, 138 unsigned long size,
139 pgprot_t vma_prot); 139 pgprot_t vma_prot);
140 140
141 /* Idle loop for this platform, leave empty for default idle loop */
142 int (*idle_loop)(void);
141}; 143};
142 144
145extern int default_idle(void);
146extern int native_idle(void);
147
143extern struct machdep_calls ppc_md; 148extern struct machdep_calls ppc_md;
144extern char cmd_line[COMMAND_LINE_SIZE]; 149extern char cmd_line[COMMAND_LINE_SIZE];
145 150
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h
index c78282a67d8e..70348a851313 100644
--- a/include/asm-ppc64/mmu.h
+++ b/include/asm-ppc64/mmu.h
@@ -47,9 +47,10 @@
47#define SLB_VSID_KS ASM_CONST(0x0000000000000800) 47#define SLB_VSID_KS ASM_CONST(0x0000000000000800)
48#define SLB_VSID_KP ASM_CONST(0x0000000000000400) 48#define SLB_VSID_KP ASM_CONST(0x0000000000000400)
49#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */ 49#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */
50#define SLB_VSID_L ASM_CONST(0x0000000000000100) /* largepage 16M */ 50#define SLB_VSID_L ASM_CONST(0x0000000000000100) /* largepage */
51#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ 51#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
52 52#define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */
53
53#define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) 54#define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C)
54#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) 55#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS)
55 56
@@ -59,6 +60,22 @@
59 60
60#define HPTES_PER_GROUP 8 61#define HPTES_PER_GROUP 8
61 62
63#define HPTE_V_AVPN_SHIFT 7
64#define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80)
65#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
66#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
67#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
68#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
69#define HPTE_V_SECONDARY ASM_CONST(0x0000000000000002)
70#define HPTE_V_VALID ASM_CONST(0x0000000000000001)
71
72#define HPTE_R_PP0 ASM_CONST(0x8000000000000000)
73#define HPTE_R_TS ASM_CONST(0x4000000000000000)
74#define HPTE_R_RPN_SHIFT 12
75#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000)
76#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
77#define HPTE_R_PP ASM_CONST(0x0000000000000003)
78
62/* Values for PP (assumes Ks=0, Kp=1) */ 79/* Values for PP (assumes Ks=0, Kp=1) */
63/* pp0 will always be 0 for linux */ 80/* pp0 will always be 0 for linux */
64#define PP_RWXX 0 /* Supervisor read/write, User none */ 81#define PP_RWXX 0 /* Supervisor read/write, User none */
@@ -68,54 +85,13 @@
68 85
69#ifndef __ASSEMBLY__ 86#ifndef __ASSEMBLY__
70 87
71/* Hardware Page Table Entry */
72typedef struct {
73 unsigned long avpn:57; /* vsid | api == avpn */
74 unsigned long : 2; /* Software use */
75 unsigned long bolted: 1; /* HPTE is "bolted" */
76 unsigned long lock: 1; /* lock on pSeries SMP */
77 unsigned long l: 1; /* Virtual page is large (L=1) or 4 KB (L=0) */
78 unsigned long h: 1; /* Hash function identifier */
79 unsigned long v: 1; /* Valid (v=1) or invalid (v=0) */
80} Hpte_dword0;
81
82typedef struct { 88typedef struct {
83 unsigned long pp0: 1; /* Page protection bit 0 */ 89 unsigned long v;
84 unsigned long ts: 1; /* Tag set bit */ 90 unsigned long r;
85 unsigned long rpn: 50; /* Real page number */ 91} hpte_t;
86 unsigned long : 2; /* Reserved */
87 unsigned long ac: 1; /* Address compare */
88 unsigned long r: 1; /* Referenced */
89 unsigned long c: 1; /* Changed */
90 unsigned long w: 1; /* Write-thru cache mode */
91 unsigned long i: 1; /* Cache inhibited */
92 unsigned long m: 1; /* Memory coherence required */
93 unsigned long g: 1; /* Guarded */
94 unsigned long n: 1; /* No-execute */
95 unsigned long pp: 2; /* Page protection bits 1:2 */
96} Hpte_dword1;
97 92
98typedef struct { 93extern hpte_t *htab_address;
99 char padding[6]; /* padding */ 94extern unsigned long htab_hash_mask;
100 unsigned long : 6; /* padding */
101 unsigned long flags: 10; /* HPTE flags */
102} Hpte_dword1_flags;
103
104typedef struct {
105 union {
106 unsigned long dword0;
107 Hpte_dword0 dw0;
108 } dw0;
109
110 union {
111 unsigned long dword1;
112 Hpte_dword1 dw1;
113 Hpte_dword1_flags flags;
114 } dw1;
115} HPTE;
116
117extern HPTE * htab_address;
118extern unsigned long htab_hash_mask;
119 95
120static inline unsigned long hpt_hash(unsigned long vpn, int large) 96static inline unsigned long hpt_hash(unsigned long vpn, int large)
121{ 97{
@@ -180,6 +156,28 @@ static inline void tlbiel(unsigned long va)
180 asm volatile("ptesync": : :"memory"); 156 asm volatile("ptesync": : :"memory");
181} 157}
182 158
159static inline unsigned long slot2va(unsigned long hpte_v, unsigned long slot)
160{
161 unsigned long avpn = HPTE_V_AVPN_VAL(hpte_v);
162 unsigned long va;
163
164 va = avpn << 23;
165
166 if (! (hpte_v & HPTE_V_LARGE)) {
167 unsigned long vpi, pteg;
168
169 pteg = slot / HPTES_PER_GROUP;
170 if (hpte_v & HPTE_V_SECONDARY)
171 pteg = ~pteg;
172
173 vpi = ((va >> 28) ^ pteg) & htab_hash_mask;
174
175 va |= vpi << PAGE_SHIFT;
176 }
177
178 return va;
179}
180
183/* 181/*
184 * Handle a fault by adding an HPTE. If the address can't be determined 182 * Handle a fault by adding an HPTE. If the address can't be determined
185 * to be valid via Linux page tables, return 1. If handled return 0 183 * to be valid via Linux page tables, return 1. If handled return 0
@@ -196,11 +194,13 @@ extern void hpte_init_iSeries(void);
196 194
197extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, 195extern long pSeries_lpar_hpte_insert(unsigned long hpte_group,
198 unsigned long va, unsigned long prpn, 196 unsigned long va, unsigned long prpn,
199 int secondary, unsigned long hpteflags, 197 unsigned long vflags,
200 int bolted, int large); 198 unsigned long rflags);
201extern long native_hpte_insert(unsigned long hpte_group, unsigned long va, 199extern long native_hpte_insert(unsigned long hpte_group, unsigned long va,
202 unsigned long prpn, int secondary, 200 unsigned long prpn,
203 unsigned long hpteflags, int bolted, int large); 201 unsigned long vflags, unsigned long rflags);
202
203extern void stabs_alloc(void);
204 204
205#endif /* __ASSEMBLY__ */ 205#endif /* __ASSEMBLY__ */
206 206
@@ -338,6 +338,9 @@ static inline unsigned long get_vsid(unsigned long context, unsigned long ea)
338 | (ea >> SID_SHIFT)); 338 | (ea >> SID_SHIFT));
339} 339}
340 340
341#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS)
342#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
343
341#endif /* __ASSEMBLY */ 344#endif /* __ASSEMBLY */
342 345
343#endif /* _PPC64_MMU_H_ */ 346#endif /* _PPC64_MMU_H_ */
diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h
index 0619a41a3c9d..ed473f4b0152 100644
--- a/include/asm-ppc64/mmzone.h
+++ b/include/asm-ppc64/mmzone.h
@@ -10,9 +10,20 @@
10#include <linux/config.h> 10#include <linux/config.h>
11#include <asm/smp.h> 11#include <asm/smp.h>
12 12
13#ifdef CONFIG_DISCONTIGMEM 13/* generic non-linear memory support:
14 *
15 * 1) we will not split memory into more chunks than will fit into the
16 * flags field of the struct page
17 */
18
19
20#ifdef CONFIG_NEED_MULTIPLE_NODES
14 21
15extern struct pglist_data *node_data[]; 22extern struct pglist_data *node_data[];
23/*
24 * Return a pointer to the node data for node n.
25 */
26#define NODE_DATA(nid) (node_data[nid])
16 27
17/* 28/*
18 * Following are specific to this numa platform. 29 * Following are specific to this numa platform.
@@ -47,36 +58,32 @@ static inline int pa_to_nid(unsigned long pa)
47 return nid; 58 return nid;
48} 59}
49 60
50#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
51
52/*
53 * Return a pointer to the node data for node n.
54 */
55#define NODE_DATA(nid) (node_data[nid])
56
57#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) 61#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
58 62
59/* 63/*
60 * Following are macros that each numa implmentation must define. 64 * Following are macros that each numa implmentation must define.
61 */ 65 */
62 66
63/*
64 * Given a kernel address, find the home node of the underlying memory.
65 */
66#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
67
68#define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map)
69#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 67#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
70#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) 68#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn)
71 69
72#define local_mapnr(kvaddr) \ 70#define local_mapnr(kvaddr) \
73 ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) 71 ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr))
74 72
73#ifdef CONFIG_DISCONTIGMEM
74
75/*
76 * Given a kernel address, find the home node of the underlying memory.
77 */
78#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
79
80#define pfn_to_nid(pfn) pa_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
81
75/* Written this way to avoid evaluating arguments twice */ 82/* Written this way to avoid evaluating arguments twice */
76#define discontigmem_pfn_to_page(pfn) \ 83#define discontigmem_pfn_to_page(pfn) \
77({ \ 84({ \
78 unsigned long __tmp = pfn; \ 85 unsigned long __tmp = pfn; \
79 (node_mem_map(pfn_to_nid(__tmp)) + \ 86 (NODE_DATA(pfn_to_nid(__tmp))->node_mem_map + \
80 node_localnr(__tmp, pfn_to_nid(__tmp))); \ 87 node_localnr(__tmp, pfn_to_nid(__tmp))); \
81}) 88})
82 89
@@ -91,4 +98,11 @@ static inline int pa_to_nid(unsigned long pa)
91#define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages) 98#define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages)
92 99
93#endif /* CONFIG_DISCONTIGMEM */ 100#endif /* CONFIG_DISCONTIGMEM */
101
102#endif /* CONFIG_NEED_MULTIPLE_NODES */
103
104#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
105#define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT)
106#endif
107
94#endif /* _ASM_MMZONE_H_ */ 108#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-ppc64/nvram.h b/include/asm-ppc64/nvram.h
index 4e6dd370d936..dfaa21566c9a 100644
--- a/include/asm-ppc64/nvram.h
+++ b/include/asm-ppc64/nvram.h
@@ -70,6 +70,7 @@ extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
70 70
71extern int pSeries_nvram_init(void); 71extern int pSeries_nvram_init(void);
72extern int pmac_nvram_init(void); 72extern int pmac_nvram_init(void);
73extern int bpa_nvram_init(void);
73 74
74/* PowerMac specific nvram stuffs */ 75/* PowerMac specific nvram stuffs */
75 76
diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h
index ae76cae1483f..2f0f36f73d38 100644
--- a/include/asm-ppc64/paca.h
+++ b/include/asm-ppc64/paca.h
@@ -20,7 +20,6 @@
20#include <asm/types.h> 20#include <asm/types.h>
21#include <asm/lppaca.h> 21#include <asm/lppaca.h>
22#include <asm/iSeries/ItLpRegSave.h> 22#include <asm/iSeries/ItLpRegSave.h>
23#include <asm/iSeries/ItLpQueue.h>
24#include <asm/mmu.h> 23#include <asm/mmu.h>
25 24
26register struct paca_struct *local_paca asm("r13"); 25register struct paca_struct *local_paca asm("r13");
@@ -62,7 +61,6 @@ struct paca_struct {
62 u16 paca_index; /* Logical processor number */ 61 u16 paca_index; /* Logical processor number */
63 62
64 u32 default_decr; /* Default decrementer value */ 63 u32 default_decr; /* Default decrementer value */
65 struct ItLpQueue *lpqueue_ptr; /* LpQueue handled by this CPU */
66 u64 kernel_toc; /* Kernel TOC address */ 64 u64 kernel_toc; /* Kernel TOC address */
67 u64 stab_real; /* Absolute address of segment table */ 65 u64 stab_real; /* Absolute address of segment table */
68 u64 stab_addr; /* Virtual address of segment table */ 66 u64 stab_addr; /* Virtual address of segment table */
@@ -91,7 +89,6 @@ struct paca_struct {
91 u64 next_jiffy_update_tb; /* TB value for next jiffy update */ 89 u64 next_jiffy_update_tb; /* TB value for next jiffy update */
92 u64 saved_r1; /* r1 save for RTAS calls */ 90 u64 saved_r1; /* r1 save for RTAS calls */
93 u64 saved_msr; /* MSR saved here by enter_rtas */ 91 u64 saved_msr; /* MSR saved here by enter_rtas */
94 u32 lpevent_count; /* lpevents processed */
95 u8 proc_enabled; /* irq soft-enable flag */ 92 u8 proc_enabled; /* irq soft-enable flag */
96 93
97 /* not yet used */ 94 /* not yet used */
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
index 257d87eb7c34..a5893a305a09 100644
--- a/include/asm-ppc64/page.h
+++ b/include/asm-ppc64/page.h
@@ -217,7 +217,8 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */
217#define page_to_pfn(page) discontigmem_page_to_pfn(page) 217#define page_to_pfn(page) discontigmem_page_to_pfn(page)
218#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) 218#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn)
219#define pfn_valid(pfn) discontigmem_pfn_valid(pfn) 219#define pfn_valid(pfn) discontigmem_pfn_valid(pfn)
220#else 220#endif
221#ifdef CONFIG_FLATMEM
221#define pfn_to_page(pfn) (mem_map + (pfn)) 222#define pfn_to_page(pfn) (mem_map + (pfn))
222#define page_to_pfn(page) ((unsigned long)((page) - mem_map)) 223#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
223#define pfn_valid(pfn) ((pfn) < max_mapnr) 224#define pfn_valid(pfn) ((pfn) < max_mapnr)
diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h
index 6cd593f660a0..4d057452f59b 100644
--- a/include/asm-ppc64/pci.h
+++ b/include/asm-ppc64/pci.h
@@ -37,7 +37,7 @@ static inline void pcibios_set_master(struct pci_dev *dev)
37 /* No special bus mastering setup handling */ 37 /* No special bus mastering setup handling */
38} 38}
39 39
40static inline void pcibios_penalize_isa_irq(int irq) 40static inline void pcibios_penalize_isa_irq(int irq, int active)
41{ 41{
42 /* We don't do dynamic PCI IRQ allocation */ 42 /* We don't do dynamic PCI IRQ allocation */
43} 43}
@@ -78,6 +78,25 @@ static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
78 return 0; 78 return 0;
79} 79}
80 80
81#ifdef CONFIG_PCI
82static inline void pci_dma_burst_advice(struct pci_dev *pdev,
83 enum pci_dma_burst_strategy *strat,
84 unsigned long *strategy_parameter)
85{
86 unsigned long cacheline_size;
87 u8 byte;
88
89 pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
90 if (byte == 0)
91 cacheline_size = 1024;
92 else
93 cacheline_size = (int) byte * 4;
94
95 *strat = PCI_DMA_BURST_MULTIPLE;
96 *strategy_parameter = cacheline_size;
97}
98#endif
99
81extern int pci_domain_nr(struct pci_bus *bus); 100extern int pci_domain_nr(struct pci_bus *bus);
82 101
83/* Decide whether to display the domain number in /proc */ 102/* Decide whether to display the domain number in /proc */
@@ -115,6 +134,10 @@ extern void
115pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 134pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
116 struct resource *res); 135 struct resource *res);
117 136
137extern void
138pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
139 struct pci_bus_region *region);
140
118extern int 141extern int
119unmap_bus_range(struct pci_bus *bus); 142unmap_bus_range(struct pci_bus *bus);
120 143
@@ -136,6 +159,13 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file,
136 unsigned long size, 159 unsigned long size,
137 pgprot_t prot); 160 pgprot_t prot);
138 161
162#ifdef CONFIG_PPC_MULTIPLATFORM
163#define HAVE_ARCH_PCI_RESOURCE_TO_USER
164extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
165 const struct resource *rsrc,
166 u64 *start, u64 *end);
167#endif /* CONFIG_PPC_MULTIPLATFORM */
168
139 169
140#endif /* __KERNEL__ */ 170#endif /* __KERNEL__ */
141 171
diff --git a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h
index 1d0404897550..6b44a8caf395 100644
--- a/include/asm-ppc64/ppc32.h
+++ b/include/asm-ppc64/ppc32.h
@@ -32,7 +32,7 @@ typedef struct compat_siginfo {
32 32
33 /* POSIX.1b timers */ 33 /* POSIX.1b timers */
34 struct { 34 struct {
35 timer_t _tid; /* timer id */ 35 compat_timer_t _tid; /* timer id */
36 int _overrun; /* overrun count */ 36 int _overrun; /* overrun count */
37 compat_sigval_t _sigval; /* same as below */ 37 compat_sigval_t _sigval; /* same as below */
38 int _sys_private; /* not to be passed to user */ 38 int _sys_private; /* not to be passed to user */
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
index 3084099086a8..352306cfb579 100644
--- a/include/asm-ppc64/processor.h
+++ b/include/asm-ppc64/processor.h
@@ -20,6 +20,7 @@
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/types.h> 21#include <asm/types.h>
22#include <asm/systemcfg.h> 22#include <asm/systemcfg.h>
23#include <asm/cputable.h>
23 24
24/* Machine State Register (MSR) Fields */ 25/* Machine State Register (MSR) Fields */
25#define MSR_SF_LG 63 /* Enable 64 bit mode */ 26#define MSR_SF_LG 63 /* Enable 64 bit mode */
@@ -138,8 +139,16 @@
138#define SPRN_NIADORM 0x3F3 /* Hardware Implementation Register 2 */ 139#define SPRN_NIADORM 0x3F3 /* Hardware Implementation Register 2 */
139#define SPRN_HID4 0x3F4 /* 970 HID4 */ 140#define SPRN_HID4 0x3F4 /* 970 HID4 */
140#define SPRN_HID5 0x3F6 /* 970 HID5 */ 141#define SPRN_HID5 0x3F6 /* 970 HID5 */
141#define SPRN_TSC 0x3FD /* Thread switch control */ 142#define SPRN_HID6 0x3F9 /* BE HID 6 */
142#define SPRN_TST 0x3FC /* Thread switch timeout */ 143#define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */
144#define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */
145#define SPRN_TSCR 0x399 /* Thread switch control on BE */
146#define SPRN_TTR 0x39A /* Thread switch timeout on BE */
147#define TSCR_DEC_ENABLE 0x200000 /* Decrementer Interrupt */
148#define TSCR_EE_ENABLE 0x100000 /* External Interrupt */
149#define TSCR_EE_BOOST 0x080000 /* External Interrupt Boost */
150#define SPRN_TSC 0x3FD /* Thread switch control on others */
151#define SPRN_TST 0x3FC /* Thread switch timeout on others */
143#define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */ 152#define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */
144#define SPRN_LR 0x008 /* Link Register */ 153#define SPRN_LR 0x008 /* Link Register */
145#define SPRN_PIR 0x3FF /* Processor Identification Register */ 154#define SPRN_PIR 0x3FF /* Processor Identification Register */
@@ -259,6 +268,7 @@
259#define PV_970FX 0x003C 268#define PV_970FX 0x003C
260#define PV_630 0x0040 269#define PV_630 0x0040
261#define PV_630p 0x0041 270#define PV_630p 0x0041
271#define PV_BE 0x0070
262 272
263/* Platforms supported by PPC64 */ 273/* Platforms supported by PPC64 */
264#define PLATFORM_PSERIES 0x0100 274#define PLATFORM_PSERIES 0x0100
@@ -267,6 +277,7 @@
267#define PLATFORM_LPAR 0x0001 277#define PLATFORM_LPAR 0x0001
268#define PLATFORM_POWERMAC 0x0400 278#define PLATFORM_POWERMAC 0x0400
269#define PLATFORM_MAPLE 0x0500 279#define PLATFORM_MAPLE 0x0500
280#define PLATFORM_BPA 0x1000
270 281
271/* Compatibility with drivers coming from PPC32 world */ 282/* Compatibility with drivers coming from PPC32 world */
272#define _machine (systemcfg->platform) 283#define _machine (systemcfg->platform)
@@ -278,6 +289,7 @@
278#define IC_INVALID 0 289#define IC_INVALID 0
279#define IC_OPEN_PIC 1 290#define IC_OPEN_PIC 1
280#define IC_PPC_XIC 2 291#define IC_PPC_XIC 2
292#define IC_BPA_IIC 3
281 293
282#define XGLUE(a,b) a##b 294#define XGLUE(a,b) a##b
283#define GLUE(a,b) XGLUE(a,b) 295#define GLUE(a,b) XGLUE(a,b)
@@ -490,24 +502,37 @@ static inline void ppc64_runlatch_on(void)
490{ 502{
491 unsigned long ctrl; 503 unsigned long ctrl;
492 504
493 ctrl = mfspr(SPRN_CTRLF); 505 if (cpu_has_feature(CPU_FTR_CTRL)) {
494 ctrl |= CTRL_RUNLATCH; 506 ctrl = mfspr(SPRN_CTRLF);
495 mtspr(SPRN_CTRLT, ctrl); 507 ctrl |= CTRL_RUNLATCH;
508 mtspr(SPRN_CTRLT, ctrl);
509 }
496} 510}
497 511
498static inline void ppc64_runlatch_off(void) 512static inline void ppc64_runlatch_off(void)
499{ 513{
500 unsigned long ctrl; 514 unsigned long ctrl;
501 515
502 ctrl = mfspr(SPRN_CTRLF); 516 if (cpu_has_feature(CPU_FTR_CTRL)) {
503 ctrl &= ~CTRL_RUNLATCH; 517 ctrl = mfspr(SPRN_CTRLF);
504 mtspr(SPRN_CTRLT, ctrl); 518 ctrl &= ~CTRL_RUNLATCH;
519 mtspr(SPRN_CTRLT, ctrl);
520 }
505} 521}
506 522
507#endif /* __KERNEL__ */ 523#endif /* __KERNEL__ */
508 524
509#endif /* __ASSEMBLY__ */ 525#endif /* __ASSEMBLY__ */
510 526
527#ifdef __KERNEL__
528#define RUNLATCH_ON(REG) \
529BEGIN_FTR_SECTION \
530 mfspr (REG),SPRN_CTRLF; \
531 ori (REG),(REG),CTRL_RUNLATCH; \
532 mtspr SPRN_CTRLT,(REG); \
533END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
534#endif
535
511/* 536/*
512 * Number of entries in the SLB. If this ever changes we should handle 537 * Number of entries in the SLB. If this ever changes we should handle
513 * it with a use a cpu feature fixup. 538 * it with a use a cpu feature fixup.
diff --git a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h
index a8ab0e9db84a..e7d1b5222802 100644
--- a/include/asm-ppc64/rtas.h
+++ b/include/asm-ppc64/rtas.h
@@ -186,8 +186,14 @@ extern int rtas_get_sensor(int sensor, int index, int *state);
186extern int rtas_get_power_level(int powerdomain, int *level); 186extern int rtas_get_power_level(int powerdomain, int *level);
187extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); 187extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
188extern int rtas_set_indicator(int indicator, int index, int new_value); 188extern int rtas_set_indicator(int indicator, int index, int new_value);
189extern void rtas_progress(char *s, unsigned short hex);
189extern void rtas_initialize(void); 190extern void rtas_initialize(void);
190 191
192struct rtc_time;
193extern void rtas_get_boot_time(struct rtc_time *rtc_time);
194extern void rtas_get_rtc_time(struct rtc_time *rtc_time);
195extern int rtas_set_rtc_time(struct rtc_time *rtc_time);
196
191/* Given an RTAS status code of 9900..9905 compute the hinted delay */ 197/* Given an RTAS status code of 9900..9905 compute the hinted delay */
192unsigned int rtas_extended_busy_delay_time(int status); 198unsigned int rtas_extended_busy_delay_time(int status);
193static inline int rtas_is_extended_busy(int status) 199static inline int rtas_is_extended_busy(int status)
diff --git a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h
index 8115ecb8feee..d86f742e9a21 100644
--- a/include/asm-ppc64/smp.h
+++ b/include/asm-ppc64/smp.h
@@ -85,6 +85,14 @@ extern void smp_generic_take_timebase(void);
85 85
86extern struct smp_ops_t *smp_ops; 86extern struct smp_ops_t *smp_ops;
87 87
88#ifdef CONFIG_PPC_PSERIES
89void vpa_init(int cpu);
90#else
91static inline void vpa_init(int cpu)
92{
93}
94#endif /* CONFIG_PPC_PSERIES */
95
88#endif /* __ASSEMBLY__ */ 96#endif /* __ASSEMBLY__ */
89 97
90#endif /* !(_PPC64_SMP_H) */ 98#endif /* !(_PPC64_SMP_H) */
diff --git a/include/asm-ppc64/sparsemem.h b/include/asm-ppc64/sparsemem.h
new file mode 100644
index 000000000000..c5bd47e57f17
--- /dev/null
+++ b/include/asm-ppc64/sparsemem.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_PPC64_SPARSEMEM_H
2#define _ASM_PPC64_SPARSEMEM_H 1
3
4#ifdef CONFIG_SPARSEMEM
5/*
6 * SECTION_SIZE_BITS 2^N: how big each section will be
7 * MAX_PHYSADDR_BITS 2^N: how much physical address space we have
8 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
9 */
10#define SECTION_SIZE_BITS 24
11#define MAX_PHYSADDR_BITS 38
12#define MAX_PHYSMEM_BITS 36
13
14#endif /* CONFIG_SPARSEMEM */
15
16#endif /* _ASM_PPC64_SPARSEMEM_H */
diff --git a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h
index 48b7900e90ec..0494df6fca74 100644
--- a/include/asm-ppc64/thread_info.h
+++ b/include/asm-ppc64/thread_info.h
@@ -24,7 +24,7 @@ struct thread_info {
24 struct task_struct *task; /* main task structure */ 24 struct task_struct *task; /* main task structure */
25 struct exec_domain *exec_domain; /* execution domain */ 25 struct exec_domain *exec_domain; /* execution domain */
26 int cpu; /* cpu we're on */ 26 int cpu; /* cpu we're on */
27 int preempt_count; 27 int preempt_count; /* 0 => preemptable, <0 => BUG */
28 struct restart_block restart_block; 28 struct restart_block restart_block;
29 /* set by force_successful_syscall_return */ 29 /* set by force_successful_syscall_return */
30 unsigned char syscall_noerror; 30 unsigned char syscall_noerror;
diff --git a/include/asm-ppc64/time.h b/include/asm-ppc64/time.h
index 8d6e3760ee10..c6c762cad8b0 100644
--- a/include/asm-ppc64/time.h
+++ b/include/asm-ppc64/time.h
@@ -34,6 +34,15 @@ struct rtc_time;
34extern void to_tm(int tim, struct rtc_time * tm); 34extern void to_tm(int tim, struct rtc_time * tm);
35extern time_t last_rtc_update; 35extern time_t last_rtc_update;
36 36
37void generic_calibrate_decr(void);
38void setup_default_decr(void);
39
40/* Some sane defaults: 125 MHz timebase, 1GHz processor */
41extern unsigned long ppc_proc_freq;
42#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
43extern unsigned long ppc_tb_freq;
44#define DEFAULT_TB_FREQ 125000000UL
45
37/* 46/*
38 * By putting all of this stuff into a single struct we 47 * By putting all of this stuff into a single struct we
39 * reduce the number of cache lines touched by do_gettimeofday. 48 * reduce the number of cache lines touched by do_gettimeofday.
diff --git a/include/asm-ppc64/topology.h b/include/asm-ppc64/topology.h
index d58d9dd79998..1e9b19073230 100644
--- a/include/asm-ppc64/topology.h
+++ b/include/asm-ppc64/topology.h
@@ -33,6 +33,7 @@ static inline int node_to_first_cpu(int node)
33 return first_cpu(tmp); 33 return first_cpu(tmp);
34} 34}
35 35
36#define pcibus_to_node(node) (-1)
36#define pcibus_to_cpumask(bus) (cpu_online_map) 37#define pcibus_to_cpumask(bus) (cpu_online_map)
37 38
38#define nr_cpus_node(node) (nr_cpus_in_node[node]) 39#define nr_cpus_node(node) (nr_cpus_in_node[node])
@@ -59,7 +60,7 @@ static inline int node_to_first_cpu(int node)
59 .nr_balance_failed = 0, \ 60 .nr_balance_failed = 0, \
60} 61}
61 62
62#else /* !CONFIG_NUMA */ 63#else
63 64
64#include <asm-generic/topology.h> 65#include <asm-generic/topology.h>
65 66
diff --git a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h
index 605d91e011ec..977bc980c1af 100644
--- a/include/asm-ppc64/unistd.h
+++ b/include/asm-ppc64/unistd.h
@@ -268,7 +268,7 @@
268#define __NR_rtas 255 268#define __NR_rtas 255
269/* Number 256 is reserved for sys_debug_setcontext */ 269/* Number 256 is reserved for sys_debug_setcontext */
270/* Number 257 is reserved for vserver */ 270/* Number 257 is reserved for vserver */
271/* Number 258 is reserved for new sys_remap_file_pages */ 271/* 258 currently unused */
272#define __NR_mbind 259 272#define __NR_mbind 259
273#define __NR_get_mempolicy 260 273#define __NR_get_mempolicy 260
274#define __NR_set_mempolicy 261 274#define __NR_set_mempolicy 261
@@ -283,8 +283,13 @@
283#define __NR_request_key 270 283#define __NR_request_key 270
284#define __NR_keyctl 271 284#define __NR_keyctl 271
285#define __NR_waitid 272 285#define __NR_waitid 272
286#define __NR_ioprio_set 273
287#define __NR_ioprio_get 274
288#define __NR_inotify_init 275
289#define __NR_inotify_add_watch 276
290#define __NR_inotify_rm_watch 277
286 291
287#define __NR_syscalls 273 292#define __NR_syscalls 278
288#ifdef __KERNEL__ 293#ifdef __KERNEL__
289#define NR_syscalls __NR_syscalls 294#define NR_syscalls __NR_syscalls
290#endif 295#endif
diff --git a/include/asm-ppc64/xics.h b/include/asm-ppc64/xics.h
index fdec5e7a7af6..1092af55d707 100644
--- a/include/asm-ppc64/xics.h
+++ b/include/asm-ppc64/xics.h
@@ -17,6 +17,7 @@
17void xics_init_IRQ(void); 17void xics_init_IRQ(void);
18int xics_get_irq(struct pt_regs *); 18int xics_get_irq(struct pt_regs *);
19void xics_setup_cpu(void); 19void xics_setup_cpu(void);
20void xics_teardown_cpu(int secondary);
20void xics_cause_IPI(int cpu); 21void xics_cause_IPI(int cpu);
21void xics_request_IPIs(void); 22void xics_request_IPIs(void);
22void xics_migrate_irqs_away(void); 23void xics_migrate_irqs_away(void);