aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-09-28 07:11:41 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-28 07:11:41 -0400
commit952ecef7a0479049c8abb7c34a688ec2981ceadd (patch)
tree74377080bb1fe12e874d18cb77461341a904f854 /arch
parentbeeca08738c4c4024c81a591812bfe38f8c436c0 (diff)
parent252e75a51d40757928d692b3d339e66838294b4b (diff)
Merge Stephen Rothwell's patches
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/Makefile11
-rw-r--r--arch/powerpc/platforms/iseries/Makefile7
-rw-r--r--arch/powerpc/platforms/iseries/htab.c (renamed from arch/ppc64/kernel/iSeries_htab.c)25
-rw-r--r--arch/powerpc/platforms/iseries/hvcall.S (renamed from arch/ppc64/kernel/hvCall.S)21
-rw-r--r--arch/powerpc/platforms/iseries/hvlog.c (renamed from arch/ppc64/kernel/HvCall.c)1
-rw-r--r--arch/powerpc/platforms/iseries/hvlpconfig.c (renamed from arch/ppc64/kernel/HvLpConfig.c)1
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c (renamed from arch/ppc64/kernel/iSeries_iommu.c)31
-rw-r--r--arch/powerpc/platforms/iseries/irq.c (renamed from arch/ppc64/kernel/iSeries_irq.c)1
-rw-r--r--arch/powerpc/platforms/iseries/ksyms.c27
-rw-r--r--arch/powerpc/platforms/iseries/lpardata.c (renamed from arch/ppc64/kernel/LparData.c)18
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c (renamed from arch/ppc64/kernel/ItLpQueue.c)69
-rw-r--r--arch/powerpc/platforms/iseries/mf.c (renamed from arch/ppc64/kernel/mf.c)85
-rw-r--r--arch/powerpc/platforms/iseries/misc.S55
-rw-r--r--arch/powerpc/platforms/iseries/pci.c (renamed from arch/ppc64/kernel/iSeries_pci.c)157
-rw-r--r--arch/powerpc/platforms/iseries/proc.c (renamed from arch/ppc64/kernel/iSeries_proc.c)10
-rw-r--r--arch/powerpc/platforms/iseries/setup.c (renamed from arch/ppc64/kernel/iSeries_setup.c)5
-rw-r--r--arch/powerpc/platforms/iseries/setup.h (renamed from arch/ppc64/kernel/iSeries_setup.h)2
-rw-r--r--arch/powerpc/platforms/iseries/smp.c (renamed from arch/ppc64/kernel/iSeries_smp.c)16
-rw-r--r--arch/powerpc/platforms/iseries/vio.c (renamed from arch/ppc64/kernel/iSeries_vio.c)0
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c (renamed from arch/ppc64/kernel/viopath.c)3
-rw-r--r--arch/powerpc/platforms/iseries/vpdinfo.c (renamed from arch/ppc64/kernel/iSeries_VpdInfo.c)4
-rw-r--r--arch/ppc64/Makefile1
-rw-r--r--arch/ppc64/kernel/HvLpEvent.c88
-rw-r--r--arch/ppc64/kernel/Makefile10
-rw-r--r--arch/ppc64/kernel/bpa_iommu.c2
-rw-r--r--arch/ppc64/kernel/bpa_setup.c2
-rw-r--r--arch/ppc64/kernel/eeh.c2
-rw-r--r--arch/ppc64/kernel/head.S2
-rw-r--r--arch/ppc64/kernel/maple_pci.c3
-rw-r--r--arch/ppc64/kernel/misc.S38
-rw-r--r--arch/ppc64/kernel/pSeries_iommu.c2
-rw-r--r--arch/ppc64/kernel/pSeries_pci.c3
-rw-r--r--arch/ppc64/kernel/pSeries_setup.c2
-rw-r--r--arch/ppc64/kernel/pci.c3
-rw-r--r--arch/ppc64/kernel/pci.h54
-rw-r--r--arch/ppc64/kernel/pci_direct_iommu.c3
-rw-r--r--arch/ppc64/kernel/pci_dn.c3
-rw-r--r--arch/ppc64/kernel/pci_iommu.c8
-rw-r--r--arch/ppc64/kernel/pmac_pci.c2
-rw-r--r--arch/ppc64/kernel/ppc_ksyms.c20
-rw-r--r--arch/ppc64/kernel/rtas_pci.c3
-rw-r--r--arch/ppc64/kernel/rtc.c37
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c3
-rw-r--r--arch/ppc64/kernel/u3_iommu.c3
44 files changed, 386 insertions, 457 deletions
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index dbc093759a89..7637ff3642c3 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -1,4 +1,7 @@
1obj-$(CONFIG_PPC_PMAC) += powermac/ 1ifeq ($(CONFIG_PPC32),y)
2obj-$(CONFIG_4xx) += 4xx/ 2obj-$(CONFIG_PPC_PMAC) += powermac/
3obj-$(CONFIG_83xx) += 83xx/ 3endif
4obj-$(CONFIG_85xx) += 85xx/ 4obj-$(CONFIG_4xx) += 4xx/
5obj-$(CONFIG_83xx) += 83xx/
6obj-$(CONFIG_85xx) += 85xx/
7obj-$(CONFIG_PPC_ISERIES) += iseries/
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
new file mode 100644
index 000000000000..18bf40077561
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -0,0 +1,7 @@
1obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \
2 hvcall.o proc.o htab.o iommu.o misc.o
3obj-$(CONFIG_PCI) += pci.o irq.o vpdinfo.o
4obj-$(CONFIG_IBMVIO) += vio.o
5obj-$(CONFIG_SMP) += smp.o
6obj-$(CONFIG_VIOPATH) += viopath.o
7obj-$(CONFIG_MODULES) += ksyms.o
diff --git a/arch/ppc64/kernel/iSeries_htab.c b/arch/powerpc/platforms/iseries/htab.c
index 9a2be3abf349..431b22767d06 100644
--- a/arch/ppc64/kernel/iSeries_htab.c
+++ b/arch/powerpc/platforms/iseries/htab.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * iSeries hashtable management. 2 * iSeries hashtable management.
3 * Derived from pSeries_htab.c 3 * Derived from pSeries_htab.c
4 * 4 *
5 * SMP scalability work: 5 * SMP scalability work:
6 * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM 6 * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM
7 * 7 *
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
@@ -18,7 +18,8 @@
18#include <asm/abs_addr.h> 18#include <asm/abs_addr.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20 20
21static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp = { [0 ... 63] = SPIN_LOCK_UNLOCKED}; 21static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp =
22 { [0 ... 63] = SPIN_LOCK_UNLOCKED};
22 23
23/* 24/*
24 * Very primitive algorithm for picking up a lock 25 * Very primitive algorithm for picking up a lock
@@ -126,7 +127,7 @@ static long iSeries_hpte_remove(unsigned long hpte_group)
126 hpte_v = iSeries_hpte_getword0(hpte_group + slot_offset); 127 hpte_v = iSeries_hpte_getword0(hpte_group + slot_offset);
127 128
128 if (! (hpte_v & HPTE_V_BOLTED)) { 129 if (! (hpte_v & HPTE_V_BOLTED)) {
129 HvCallHpt_invalidateSetSwBitsGet(hpte_group + 130 HvCallHpt_invalidateSetSwBitsGet(hpte_group +
130 slot_offset, 0, 0); 131 slot_offset, 0, 0);
131 iSeries_hunlock(hpte_group); 132 iSeries_hunlock(hpte_group);
132 return i; 133 return i;
@@ -143,9 +144,9 @@ static long iSeries_hpte_remove(unsigned long hpte_group)
143 144
144/* 145/*
145 * The HyperVisor expects the "flags" argument in this form: 146 * The HyperVisor expects the "flags" argument in this form:
146 * bits 0..59 : reserved 147 * bits 0..59 : reserved
147 * bit 60 : N 148 * bit 60 : N
148 * bits 61..63 : PP2,PP1,PP0 149 * bits 61..63 : PP2,PP1,PP0
149 */ 150 */
150static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp, 151static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
151 unsigned long va, int large, int local) 152 unsigned long va, int large, int local)
@@ -171,7 +172,7 @@ static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
171} 172}
172 173
173/* 174/*
174 * Functions used to find the PTE for a particular virtual address. 175 * Functions used to find the PTE for a particular virtual address.
175 * Only used during boot when bolting pages. 176 * Only used during boot when bolting pages.
176 * 177 *
177 * Input : vpn : virtual page number 178 * Input : vpn : virtual page number
@@ -189,7 +190,7 @@ static long iSeries_hpte_find(unsigned long vpn)
189 * 0x00000000xxxxxxxx : Entry found in primary group, slot x 190 * 0x00000000xxxxxxxx : Entry found in primary group, slot x
190 * 0x80000000xxxxxxxx : Entry found in secondary group, slot x 191 * 0x80000000xxxxxxxx : Entry found in secondary group, slot x
191 */ 192 */
192 slot = HvCallHpt_findValid(&hpte, vpn); 193 slot = HvCallHpt_findValid(&hpte, vpn);
193 if (hpte.v & HPTE_V_VALID) { 194 if (hpte.v & HPTE_V_VALID) {
194 if (slot < 0) { 195 if (slot < 0) {
195 slot &= 0x7fffffffffffffff; 196 slot &= 0x7fffffffffffffff;
@@ -216,7 +217,7 @@ static void iSeries_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
216 vsid = get_kernel_vsid(ea); 217 vsid = get_kernel_vsid(ea);
217 va = (vsid << 28) | (ea & 0x0fffffff); 218 va = (vsid << 28) | (ea & 0x0fffffff);
218 vpn = va >> PAGE_SHIFT; 219 vpn = va >> PAGE_SHIFT;
219 slot = iSeries_hpte_find(vpn); 220 slot = iSeries_hpte_find(vpn);
220 if (slot == -1) 221 if (slot == -1)
221 panic("updateboltedpp: Could not find page to bolt\n"); 222 panic("updateboltedpp: Could not find page to bolt\n");
222 HvCallHpt_setPp(slot, newpp); 223 HvCallHpt_setPp(slot, newpp);
@@ -234,7 +235,7 @@ static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
234 iSeries_hlock(slot); 235 iSeries_hlock(slot);
235 236
236 hpte_v = iSeries_hpte_getword0(slot); 237 hpte_v = iSeries_hpte_getword0(slot);
237 238
238 if ((HPTE_V_AVPN_VAL(hpte_v) == avpn) && (hpte_v & HPTE_V_VALID)) 239 if ((HPTE_V_AVPN_VAL(hpte_v) == avpn) && (hpte_v & HPTE_V_VALID))
239 HvCallHpt_invalidateSetSwBitsGet(slot, 0, 0); 240 HvCallHpt_invalidateSetSwBitsGet(slot, 0, 0);
240 241
@@ -249,7 +250,7 @@ void hpte_init_iSeries(void)
249 ppc_md.hpte_updatepp = iSeries_hpte_updatepp; 250 ppc_md.hpte_updatepp = iSeries_hpte_updatepp;
250 ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp; 251 ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp;
251 ppc_md.hpte_insert = iSeries_hpte_insert; 252 ppc_md.hpte_insert = iSeries_hpte_insert;
252 ppc_md.hpte_remove = iSeries_hpte_remove; 253 ppc_md.hpte_remove = iSeries_hpte_remove;
253 254
254 htab_finish_init(); 255 htab_finish_init();
255} 256}
diff --git a/arch/ppc64/kernel/hvCall.S b/arch/powerpc/platforms/iseries/hvcall.S
index 4c699eab1b95..9901c0ec1415 100644
--- a/arch/ppc64/kernel/hvCall.S
+++ b/arch/powerpc/platforms/iseries/hvcall.S
@@ -1,7 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/hvCall.S
3 *
4 *
5 * This file contains the code to perform calls to the 2 * This file contains the code to perform calls to the
6 * iSeries LPAR hypervisor 3 * iSeries LPAR hypervisor
7 * 4 *
@@ -16,12 +13,12 @@
16 13
17 .text 14 .text
18 15
19/* 16/*
20 * Hypervisor call 17 * Hypervisor call
21 * 18 *
22 * Invoke the iSeries hypervisor via the System Call instruction 19 * Invoke the iSeries hypervisor via the System Call instruction
23 * Parameters are passed to this routine in registers r3 - r10 20 * Parameters are passed to this routine in registers r3 - r10
24 * 21 *
25 * r3 contains the HV function to be called 22 * r3 contains the HV function to be called
26 * r4-r10 contain the operands to the hypervisor function 23 * r4-r10 contain the operands to the hypervisor function
27 * 24 *
@@ -41,11 +38,11 @@ _GLOBAL(HvCall7)
41 mfcr r0 38 mfcr r0
42 std r0,-8(r1) 39 std r0,-8(r1)
43 stdu r1,-(STACK_FRAME_OVERHEAD+16)(r1) 40 stdu r1,-(STACK_FRAME_OVERHEAD+16)(r1)
44 41
45 /* r0 = 0xffffffffffffffff indicates a hypervisor call */ 42 /* r0 = 0xffffffffffffffff indicates a hypervisor call */
46 43
47 li r0,-1 44 li r0,-1
48 45
49 /* Invoke the hypervisor */ 46 /* Invoke the hypervisor */
50 47
51 sc 48 sc
@@ -55,7 +52,7 @@ _GLOBAL(HvCall7)
55 mtcrf 0xff,r0 52 mtcrf 0xff,r0
56 53
57 /* return to caller, return value in r3 */ 54 /* return to caller, return value in r3 */
58 55
59 blr 56 blr
60 57
61_GLOBAL(HvCall0Ret16) 58_GLOBAL(HvCall0Ret16)
@@ -92,7 +89,5 @@ _GLOBAL(HvCall7Ret16)
92 ld r0,-8(r1) 89 ld r0,-8(r1)
93 mtcrf 0xff,r0 90 mtcrf 0xff,r0
94 ld r31,-16(r1) 91 ld r31,-16(r1)
95
96 blr
97
98 92
93 blr
diff --git a/arch/ppc64/kernel/HvCall.c b/arch/powerpc/platforms/iseries/hvlog.c
index b772e65b57a2..f61e2e9ac9ec 100644
--- a/arch/ppc64/kernel/HvCall.c
+++ b/arch/powerpc/platforms/iseries/hvlog.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvCall.c
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/ppc64/kernel/HvLpConfig.c b/arch/powerpc/platforms/iseries/hvlpconfig.c
index cb1d6473203c..dc28621aea0d 100644
--- a/arch/ppc64/kernel/HvLpConfig.c
+++ b/arch/powerpc/platforms/iseries/hvlpconfig.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvLpConfig.c
3 * Copyright (C) 2001 Kyle A. Lucke, IBM Corporation 2 * Copyright (C) 2001 Kyle A. Lucke, IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/ppc64/kernel/iSeries_iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index 287db32d9867..9ac735d5b817 100644
--- a/arch/ppc64/kernel/iSeries_iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/iSeries_iommu.c
3 *
4 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
5 * 3 *
6 * Rewrite, cleanup: 4 * Rewrite, cleanup:
@@ -91,15 +89,17 @@ static void tce_free_iSeries(struct iommu_table *tbl, long index, long npages)
91 */ 89 */
92static struct iommu_table *iommu_table_find(struct iommu_table * tbl) 90static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
93{ 91{
94 struct iSeries_Device_Node *dp; 92 struct device_node *dp;
95 93
96 list_for_each_entry(dp, &iSeries_Global_Device_List, Device_List) { 94 list_for_each_entry(dp, &iSeries_Global_Device_List, Device_List) {
97 if ((dp->iommu_table != NULL) && 95 struct iommu_table *it = PCI_DN(dp)->iommu_table;
98 (dp->iommu_table->it_type == TCE_PCI) && 96
99 (dp->iommu_table->it_offset == tbl->it_offset) && 97 if ((it != NULL) &&
100 (dp->iommu_table->it_index == tbl->it_index) && 98 (it->it_type == TCE_PCI) &&
101 (dp->iommu_table->it_size == tbl->it_size)) 99 (it->it_offset == tbl->it_offset) &&
102 return dp->iommu_table; 100 (it->it_index == tbl->it_index) &&
101 (it->it_size == tbl->it_size))
102 return it;
103 } 103 }
104 return NULL; 104 return NULL;
105} 105}
@@ -113,7 +113,7 @@ static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
113 * 2. TCE table per Bus. 113 * 2. TCE table per Bus.
114 * 3. TCE Table per IOA. 114 * 3. TCE Table per IOA.
115 */ 115 */
116static void iommu_table_getparms(struct iSeries_Device_Node* dn, 116static void iommu_table_getparms(struct device_node *dn,
117 struct iommu_table* tbl) 117 struct iommu_table* tbl)
118{ 118{
119 struct iommu_table_cb *parms; 119 struct iommu_table_cb *parms;
@@ -125,7 +125,7 @@ static void iommu_table_getparms(struct iSeries_Device_Node* dn,
125 memset(parms, 0, sizeof(*parms)); 125 memset(parms, 0, sizeof(*parms));
126 126
127 parms->itc_busno = ISERIES_BUS(dn); 127 parms->itc_busno = ISERIES_BUS(dn);
128 parms->itc_slotno = dn->LogicalSlot; 128 parms->itc_slotno = PCI_DN(dn)->LogicalSlot;
129 parms->itc_virtbus = 0; 129 parms->itc_virtbus = 0;
130 130
131 HvCallXm_getTceTableParms(ISERIES_HV_ADDR(parms)); 131 HvCallXm_getTceTableParms(ISERIES_HV_ADDR(parms));
@@ -145,18 +145,19 @@ static void iommu_table_getparms(struct iSeries_Device_Node* dn,
145} 145}
146 146
147 147
148void iommu_devnode_init_iSeries(struct iSeries_Device_Node *dn) 148void iommu_devnode_init_iSeries(struct device_node *dn)
149{ 149{
150 struct iommu_table *tbl; 150 struct iommu_table *tbl;
151 struct pci_dn *pdn = PCI_DN(dn);
151 152
152 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 153 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
153 154
154 iommu_table_getparms(dn, tbl); 155 iommu_table_getparms(dn, tbl);
155 156
156 /* Look for existing tce table */ 157 /* Look for existing tce table */
157 dn->iommu_table = iommu_table_find(tbl); 158 pdn->iommu_table = iommu_table_find(tbl);
158 if (dn->iommu_table == NULL) 159 if (pdn->iommu_table == NULL)
159 dn->iommu_table = iommu_init_table(tbl); 160 pdn->iommu_table = iommu_init_table(tbl);
160 else 161 else
161 kfree(tbl); 162 kfree(tbl);
162} 163}
diff --git a/arch/ppc64/kernel/iSeries_irq.c b/arch/powerpc/platforms/iseries/irq.c
index 0170682a8ca5..5a8a0056b31f 100644
--- a/arch/ppc64/kernel/iSeries_irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -363,4 +363,3 @@ void virt_irq_init(void)
363{ 363{
364 return; 364 return;
365} 365}
366
diff --git a/arch/powerpc/platforms/iseries/ksyms.c b/arch/powerpc/platforms/iseries/ksyms.c
new file mode 100644
index 000000000000..f271b3539721
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/ksyms.c
@@ -0,0 +1,27 @@
1/*
2 * (C) 2001-2005 PPC 64 Team, IBM Corp
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/module.h>
10
11#include <asm/hw_irq.h>
12#include <asm/iSeries/HvCallSc.h>
13
14EXPORT_SYMBOL(HvCall0);
15EXPORT_SYMBOL(HvCall1);
16EXPORT_SYMBOL(HvCall2);
17EXPORT_SYMBOL(HvCall3);
18EXPORT_SYMBOL(HvCall4);
19EXPORT_SYMBOL(HvCall5);
20EXPORT_SYMBOL(HvCall6);
21EXPORT_SYMBOL(HvCall7);
22
23#ifdef CONFIG_SMP
24EXPORT_SYMBOL(local_get_flags);
25EXPORT_SYMBOL(local_irq_disable);
26EXPORT_SYMBOL(local_irq_restore);
27#endif
diff --git a/arch/ppc64/kernel/LparData.c b/arch/powerpc/platforms/iseries/lpardata.c
index 0a9c23ca2f0c..87b7ad8ca465 100644
--- a/arch/ppc64/kernel/LparData.c
+++ b/arch/powerpc/platforms/iseries/lpardata.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright 2001 Mike Corrigan, IBM Corp 2 * Copyright 2001 Mike Corrigan, IBM Corp
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
@@ -29,8 +29,8 @@
29#include <asm/iSeries/ItSpCommArea.h> 29#include <asm/iSeries/ItSpCommArea.h>
30 30
31 31
32/* The HvReleaseData is the root of the information shared between 32/* The HvReleaseData is the root of the information shared between
33 * the hypervisor and Linux. 33 * the hypervisor and Linux.
34 */ 34 */
35struct HvReleaseData hvReleaseData = { 35struct HvReleaseData hvReleaseData = {
36 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */ 36 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */
@@ -79,7 +79,7 @@ extern void trap_0e_iSeries(void);
79extern void performance_monitor_iSeries(void); 79extern void performance_monitor_iSeries(void);
80extern void data_access_slb_iSeries(void); 80extern void data_access_slb_iSeries(void);
81extern void instruction_access_slb_iSeries(void); 81extern void instruction_access_slb_iSeries(void);
82 82
83struct ItLpNaca itLpNaca = { 83struct ItLpNaca itLpNaca = {
84 .xDesc = 0xd397d581, /* "LpNa" ebcdic */ 84 .xDesc = 0xd397d581, /* "LpNa" ebcdic */
85 .xSize = 0x0400, /* size of ItLpNaca */ 85 .xSize = 0x0400, /* size of ItLpNaca */
@@ -106,7 +106,7 @@ struct ItLpNaca itLpNaca = {
106 .xLoadAreaChunks = 0, /* chunks for load area */ 106 .xLoadAreaChunks = 0, /* chunks for load area */
107 .xPaseSysCallCRMask = 0, /* PASE mask */ 107 .xPaseSysCallCRMask = 0, /* PASE mask */
108 .xSlicSegmentTablePtr = 0, /* seg table */ 108 .xSlicSegmentTablePtr = 0, /* seg table */
109 .xOldLpQueue = { 0 }, /* Old LP Queue */ 109 .xOldLpQueue = { 0 }, /* Old LP Queue */
110 .xInterruptHdlr = { 110 .xInterruptHdlr = {
111 (u64)system_reset_iSeries, /* 0x100 System Reset */ 111 (u64)system_reset_iSeries, /* 0x100 System Reset */
112 (u64)machine_check_iSeries, /* 0x200 Machine Check */ 112 (u64)machine_check_iSeries, /* 0x200 Machine Check */
@@ -134,7 +134,7 @@ struct ItLpNaca itLpNaca = {
134EXPORT_SYMBOL(itLpNaca); 134EXPORT_SYMBOL(itLpNaca);
135 135
136/* May be filled in by the hypervisor so cannot end up in the BSS */ 136/* May be filled in by the hypervisor so cannot end up in the BSS */
137struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data"))); 137struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data")));
138 138
139/* May be filled in by the hypervisor so cannot end up in the BSS */ 139/* May be filled in by the hypervisor so cannot end up in the BSS */
140struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data"))); 140struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data")));
@@ -151,7 +151,7 @@ struct IoHriProcessorVpd xIoHriProcessorVpd[maxPhysicalProcessors] = {
151 .xPVR = 0x3600 151 .xPVR = 0x3600
152 } 152 }
153}; 153};
154 154
155/* Space for Main Store Vpd 27,200 bytes */ 155/* Space for Main Store Vpd 27,200 bytes */
156/* May be filled in by the hypervisor so cannot end up in the BSS */ 156/* May be filled in by the hypervisor so cannot end up in the BSS */
157u64 xMsVpd[3400] __attribute__((__section__(".data"))); 157u64 xMsVpd[3400] __attribute__((__section__(".data")));
@@ -197,7 +197,7 @@ struct ItVpdAreas itVpdAreas = {
197 26992, /* 7 length of MS VPD */ 197 26992, /* 7 length of MS VPD */
198 0, /* 8 */ 198 0, /* 8 */
199 sizeof(struct ItLpNaca),/* 9 length of LP Naca */ 199 sizeof(struct ItLpNaca),/* 9 length of LP Naca */
200 0, /* 10 */ 200 0, /* 10 */
201 256, /* 11 length of Recovery Log Buf */ 201 256, /* 11 length of Recovery Log Buf */
202 sizeof(struct SpCommArea), /* 12 length of SP Comm Area */ 202 sizeof(struct SpCommArea), /* 12 length of SP Comm Area */
203 0,0,0, /* 13 - 15 */ 203 0,0,0, /* 13 - 15 */
@@ -207,7 +207,7 @@ struct ItVpdAreas itVpdAreas = {
207 0,0 /* 24 - 25 */ 207 0,0 /* 24 - 25 */
208 }, 208 },
209 .xSlicVpdAdrs = { /* VPD addresses */ 209 .xSlicVpdAdrs = { /* VPD addresses */
210 0,0,0, /* 0 - 2 */ 210 0,0,0, /* 0 - 2 */
211 &xItExtVpdPanel, /* 3 Extended VPD */ 211 &xItExtVpdPanel, /* 3 Extended VPD */
212 &paca[0], /* 4 first Paca */ 212 &paca[0], /* 4 first Paca */
213 0, /* 5 */ 213 0, /* 5 */
diff --git a/arch/ppc64/kernel/ItLpQueue.c b/arch/powerpc/platforms/iseries/lpevents.c
index 4231861288a3..883603027ccf 100644
--- a/arch/ppc64/kernel/ItLpQueue.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItLpQueue.c
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -19,6 +18,7 @@
19#include <asm/iSeries/ItLpQueue.h> 18#include <asm/iSeries/ItLpQueue.h>
20#include <asm/iSeries/HvLpEvent.h> 19#include <asm/iSeries/HvLpEvent.h>
21#include <asm/iSeries/HvCallEvent.h> 20#include <asm/iSeries/HvCallEvent.h>
21#include <asm/iSeries/ItLpNaca.h>
22 22
23/* 23/*
24 * The LpQueue is used to pass event data from the hypervisor to 24 * The LpQueue is used to pass event data from the hypervisor to
@@ -43,7 +43,8 @@ static char *event_types[HvLpEvent_Type_NumTypes] = {
43}; 43};
44 44
45/* Array of LpEvent handler functions */ 45/* Array of LpEvent handler functions */
46extern LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes]; 46static LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes];
47static unsigned lpEventHandlerPaths[HvLpEvent_Type_NumTypes];
47 48
48static struct HvLpEvent * get_next_hvlpevent(void) 49static struct HvLpEvent * get_next_hvlpevent(void)
49{ 50{
@@ -199,6 +200,70 @@ void setup_hvlpevent_queue(void)
199 hvlpevent_queue.xIndex = 0; 200 hvlpevent_queue.xIndex = 0;
200} 201}
201 202
203/* Register a handler for an LpEvent type */
204int HvLpEvent_registerHandler(HvLpEvent_Type eventType, LpEventHandler handler)
205{
206 if (eventType < HvLpEvent_Type_NumTypes) {
207 lpEventHandler[eventType] = handler;
208 return 0;
209 }
210 return 1;
211}
212EXPORT_SYMBOL(HvLpEvent_registerHandler);
213
214int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType)
215{
216 might_sleep();
217
218 if (eventType < HvLpEvent_Type_NumTypes) {
219 if (!lpEventHandlerPaths[eventType]) {
220 lpEventHandler[eventType] = NULL;
221 /*
222 * We now sleep until all other CPUs have scheduled.
223 * This ensures that the deletion is seen by all
224 * other CPUs, and that the deleted handler isn't
225 * still running on another CPU when we return.
226 */
227 synchronize_rcu();
228 return 0;
229 }
230 }
231 return 1;
232}
233EXPORT_SYMBOL(HvLpEvent_unregisterHandler);
234
235/*
236 * lpIndex is the partition index of the target partition.
237 * needed only for VirtualIo, VirtualLan and SessionMgr. Zero
238 * indicates to use our partition index - for the other types.
239 */
240int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex)
241{
242 if ((eventType < HvLpEvent_Type_NumTypes) &&
243 lpEventHandler[eventType]) {
244 if (lpIndex == 0)
245 lpIndex = itLpNaca.xLpIndex;
246 HvCallEvent_openLpEventPath(lpIndex, eventType);
247 ++lpEventHandlerPaths[eventType];
248 return 0;
249 }
250 return 1;
251}
252
253int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex)
254{
255 if ((eventType < HvLpEvent_Type_NumTypes) &&
256 lpEventHandler[eventType] &&
257 lpEventHandlerPaths[eventType]) {
258 if (lpIndex == 0)
259 lpIndex = itLpNaca.xLpIndex;
260 HvCallEvent_closeLpEventPath(lpIndex, eventType);
261 --lpEventHandlerPaths[eventType];
262 return 0;
263 }
264 return 1;
265}
266
202static int proc_lpevents_show(struct seq_file *m, void *v) 267static int proc_lpevents_show(struct seq_file *m, void *v)
203{ 268{
204 int cpu, i; 269 int cpu, i;
diff --git a/arch/ppc64/kernel/mf.c b/arch/powerpc/platforms/iseries/mf.c
index ef4a338ebd01..82f5abab9afa 100644
--- a/arch/ppc64/kernel/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -1,29 +1,28 @@
1/* 1/*
2 * mf.c 2 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation
3 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation 3 * Copyright (C) 2004-2005 Stephen Rothwell IBM Corporation
4 * Copyright (C) 2004-2005 Stephen Rothwell IBM Corporation 4 *
5 * 5 * This modules exists as an interface between a Linux secondary partition
6 * This modules exists as an interface between a Linux secondary partition 6 * running on an iSeries and the primary partition's Virtual Service
7 * running on an iSeries and the primary partition's Virtual Service 7 * Processor (VSP) object. The VSP has final authority over powering on/off
8 * Processor (VSP) object. The VSP has final authority over powering on/off 8 * all partitions in the iSeries. It also provides miscellaneous low-level
9 * all partitions in the iSeries. It also provides miscellaneous low-level 9 * machine facility type operations.
10 * machine facility type operations. 10 *
11 * 11 *
12 * 12 * This program is free software; you can redistribute it and/or modify
13 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by
14 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation; either version 2 of the License, or
15 * the Free Software Foundation; either version 2 of the License, or 15 * (at your option) any later version.
16 * (at your option) any later version. 16 *
17 * 17 * This program is distributed in the hope that it will be useful,
18 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details.
21 * GNU General Public License for more details. 21 *
22 * 22 * You should have received a copy of the GNU General Public License
23 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software
24 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 */
26 */
27 26
28#include <linux/types.h> 27#include <linux/types.h>
29#include <linux/errno.h> 28#include <linux/errno.h>
@@ -42,6 +41,10 @@
42#include <asm/iSeries/HvLpConfig.h> 41#include <asm/iSeries/HvLpConfig.h>
43#include <asm/iSeries/ItLpQueue.h> 42#include <asm/iSeries/ItLpQueue.h>
44 43
44#include "setup.h"
45
46extern int piranha_simulator;
47
45/* 48/*
46 * This is the structure layout for the Machine Facilites LPAR event 49 * This is the structure layout for the Machine Facilites LPAR event
47 * flows. 50 * flows.
@@ -1279,3 +1282,35 @@ static int __init mf_proc_init(void)
1279__initcall(mf_proc_init); 1282__initcall(mf_proc_init);
1280 1283
1281#endif /* CONFIG_PROC_FS */ 1284#endif /* CONFIG_PROC_FS */
1285
1286/*
1287 * Get the RTC from the virtual service processor
1288 * This requires flowing LpEvents to the primary partition
1289 */
1290void iSeries_get_rtc_time(struct rtc_time *rtc_tm)
1291{
1292 if (piranha_simulator)
1293 return;
1294
1295 mf_get_rtc(rtc_tm);
1296 rtc_tm->tm_mon--;
1297}
1298
1299/*
1300 * Set the RTC in the virtual service processor
1301 * This requires flowing LpEvents to the primary partition
1302 */
1303int iSeries_set_rtc_time(struct rtc_time *tm)
1304{
1305 mf_set_rtc(tm);
1306 return 0;
1307}
1308
1309void iSeries_get_boot_time(struct rtc_time *tm)
1310{
1311 if (piranha_simulator)
1312 return;
1313
1314 mf_get_boot_rtc(tm);
1315 tm->tm_mon -= 1;
1316}
diff --git a/arch/powerpc/platforms/iseries/misc.S b/arch/powerpc/platforms/iseries/misc.S
new file mode 100644
index 000000000000..09f14522e176
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/misc.S
@@ -0,0 +1,55 @@
1/*
2 * This file contains miscellaneous low-level functions.
3 * Copyright (C) 1995-2005 IBM Corp
4 *
5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6 * and Paul Mackerras.
7 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
8 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <asm/processor.h>
17#include <asm/asm-offsets.h>
18
19 .text
20
21/* unsigned long local_save_flags(void) */
22_GLOBAL(local_get_flags)
23 lbz r3,PACAPROCENABLED(r13)
24 blr
25
26/* unsigned long local_irq_disable(void) */
27_GLOBAL(local_irq_disable)
28 lbz r3,PACAPROCENABLED(r13)
29 li r4,0
30 stb r4,PACAPROCENABLED(r13)
31 blr /* Done */
32
33/* void local_irq_restore(unsigned long flags) */
34_GLOBAL(local_irq_restore)
35 lbz r5,PACAPROCENABLED(r13)
36 /* Check if things are setup the way we want _already_. */
37 cmpw 0,r3,r5
38 beqlr
39 /* are we enabling interrupts? */
40 cmpdi 0,r3,0
41 stb r3,PACAPROCENABLED(r13)
42 beqlr
43 /* Check pending interrupts */
44 /* A decrementer, IPI or PMC interrupt may have occurred
45 * while we were in the hypervisor (which enables) */
46 ld r4,PACALPPACA+LPPACAANYINT(r13)
47 cmpdi r4,0
48 beqlr
49
50 /*
51 * Handle pending interrupts in interrupt context
52 */
53 li r0,0x5555
54 sc
55 blr
diff --git a/arch/ppc64/kernel/iSeries_pci.c b/arch/powerpc/platforms/iseries/pci.c
index fbc273c32bcc..501b1dcbfac5 100644
--- a/arch/ppc64/kernel/iSeries_pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -1,28 +1,26 @@
1/* 1/*
2 * iSeries_pci.c
3 *
4 * Copyright (C) 2001 Allan Trautman, IBM Corporation 2 * Copyright (C) 2001 Allan Trautman, IBM Corporation
5 * 3 *
6 * iSeries specific routines for PCI. 4 * iSeries specific routines for PCI.
7 * 5 *
8 * Based on code from pci.c and iSeries_pci.c 32bit 6 * Based on code from pci.c and iSeries_pci.c 32bit
9 * 7 *
10 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. 11 * (at your option) any later version.
14 * 12 *
15 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details. 16 * GNU General Public License for more details.
19 * 17 *
20 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 21 */
24#include <linux/kernel.h> 22#include <linux/kernel.h>
25#include <linux/list.h> 23#include <linux/list.h>
26#include <linux/string.h> 24#include <linux/string.h>
27#include <linux/init.h> 25#include <linux/init.h>
28#include <linux/module.h> 26#include <linux/module.h>
@@ -43,14 +41,14 @@
43#include <asm/iSeries/iSeries_pci.h> 41#include <asm/iSeries/iSeries_pci.h>
44#include <asm/iSeries/mf.h> 42#include <asm/iSeries/mf.h>
45 43
46#include "pci.h" 44#include <asm/ppc-pci.h>
47 45
48extern unsigned long io_page_mask; 46extern unsigned long io_page_mask;
49 47
50/* 48/*
51 * Forward declares of prototypes. 49 * Forward declares of prototypes.
52 */ 50 */
53static struct iSeries_Device_Node *find_Device_Node(int bus, int devfn); 51static struct device_node *find_Device_Node(int bus, int devfn);
54static void scan_PHB_slots(struct pci_controller *Phb); 52static void scan_PHB_slots(struct pci_controller *Phb);
55static void scan_EADS_bridge(HvBusNumber Bus, HvSubBusNumber SubBus, int IdSel); 53static void scan_EADS_bridge(HvBusNumber Bus, HvSubBusNumber SubBus, int IdSel);
56static int scan_bridge_slot(HvBusNumber Bus, struct HvCallPci_BridgeInfo *Info); 54static int scan_bridge_slot(HvBusNumber Bus, struct HvCallPci_BridgeInfo *Info);
@@ -68,7 +66,7 @@ static long Pci_Cfg_Write_Count;
68#endif 66#endif
69static long Pci_Error_Count; 67static long Pci_Error_Count;
70 68
71static int Pci_Retry_Max = 3; /* Only retry 3 times */ 69static int Pci_Retry_Max = 3; /* Only retry 3 times */
72static int Pci_Error_Flag = 1; /* Set Retry Error on. */ 70static int Pci_Error_Flag = 1; /* Set Retry Error on. */
73 71
74static struct pci_ops iSeries_pci_ops; 72static struct pci_ops iSeries_pci_ops;
@@ -87,7 +85,7 @@ static long current_iomm_table_entry;
87/* 85/*
88 * Lookup Tables. 86 * Lookup Tables.
89 */ 87 */
90static struct iSeries_Device_Node **iomm_table; 88static struct device_node **iomm_table;
91static u8 *iobar_table; 89static u8 *iobar_table;
92 90
93/* 91/*
@@ -179,7 +177,7 @@ static void allocate_device_bars(struct pci_dev *dev)
179 for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num) { 177 for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num) {
180 bar_res = &dev->resource[bar_num]; 178 bar_res = &dev->resource[bar_num];
181 iomm_table_allocate_entry(dev, bar_num); 179 iomm_table_allocate_entry(dev, bar_num);
182 } 180 }
183} 181}
184 182
185/* 183/*
@@ -201,29 +199,35 @@ static void pci_Log_Error(char *Error_Text, int Bus, int SubBus,
201/* 199/*
202 * build_device_node(u16 Bus, int SubBus, u8 DevFn) 200 * build_device_node(u16 Bus, int SubBus, u8 DevFn)
203 */ 201 */
204static struct iSeries_Device_Node *build_device_node(HvBusNumber Bus, 202static struct device_node *build_device_node(HvBusNumber Bus,
205 HvSubBusNumber SubBus, int AgentId, int Function) 203 HvSubBusNumber SubBus, int AgentId, int Function)
206{ 204{
207 struct iSeries_Device_Node *node; 205 struct device_node *node;
206 struct pci_dn *pdn;
208 207
209 PPCDBG(PPCDBG_BUSWALK, 208 PPCDBG(PPCDBG_BUSWALK,
210 "-build_device_node 0x%02X.%02X.%02X Function: %02X\n", 209 "-build_device_node 0x%02X.%02X.%02X Function: %02X\n",
211 Bus, SubBus, AgentId, Function); 210 Bus, SubBus, AgentId, Function);
212 211
213 node = kmalloc(sizeof(struct iSeries_Device_Node), GFP_KERNEL); 212 node = kmalloc(sizeof(struct device_node), GFP_KERNEL);
214 if (node == NULL) 213 if (node == NULL)
215 return NULL; 214 return NULL;
216 215 memset(node, 0, sizeof(struct device_node));
217 memset(node, 0, sizeof(struct iSeries_Device_Node)); 216 pdn = kzalloc(sizeof(*pdn), GFP_KERNEL);
217 if (pdn == NULL) {
218 kfree(node);
219 return NULL;
220 }
221 node->data = pdn;
218 list_add_tail(&node->Device_List, &iSeries_Global_Device_List); 222 list_add_tail(&node->Device_List, &iSeries_Global_Device_List);
219#if 0 223#if 0
220 node->DsaAddr = ((u64)Bus << 48) + ((u64)SubBus << 40) + ((u64)0x10 << 32); 224 pdn->DsaAddr = ((u64)Bus << 48) + ((u64)SubBus << 40) + ((u64)0x10 << 32);
221#endif 225#endif
222 node->DsaAddr.DsaAddr = 0; 226 pdn->DsaAddr.DsaAddr = 0;
223 node->DsaAddr.Dsa.busNumber = Bus; 227 pdn->DsaAddr.Dsa.busNumber = Bus;
224 node->DsaAddr.Dsa.subBusNumber = SubBus; 228 pdn->DsaAddr.Dsa.subBusNumber = SubBus;
225 node->DsaAddr.Dsa.deviceId = 0x10; 229 pdn->DsaAddr.Dsa.deviceId = 0x10;
226 node->DevFn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function); 230 pdn->devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function);
227 return node; 231 return node;
228} 232}
229 233
@@ -278,28 +282,28 @@ unsigned long __init find_and_init_phbs(void)
278 282
279/* 283/*
280 * iSeries_pcibios_init 284 * iSeries_pcibios_init
281 * 285 *
282 * Chance to initialize and structures or variable before PCI Bus walk. 286 * Chance to initialize and structures or variable before PCI Bus walk.
283 */ 287 */
284void iSeries_pcibios_init(void) 288void iSeries_pcibios_init(void)
285{ 289{
286 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_init Entry.\n"); 290 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_init Entry.\n");
287 iomm_table_initialize(); 291 iomm_table_initialize();
288 find_and_init_phbs(); 292 find_and_init_phbs();
289 io_page_mask = -1; 293 io_page_mask = -1;
290 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_init Exit.\n"); 294 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_init Exit.\n");
291} 295}
292 296
293/* 297/*
294 * iSeries_pci_final_fixup(void) 298 * iSeries_pci_final_fixup(void)
295 */ 299 */
296void __init iSeries_pci_final_fixup(void) 300void __init iSeries_pci_final_fixup(void)
297{ 301{
298 struct pci_dev *pdev = NULL; 302 struct pci_dev *pdev = NULL;
299 struct iSeries_Device_Node *node; 303 struct device_node *node;
300 int DeviceCount = 0; 304 int DeviceCount = 0;
301 305
302 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_fixup Entry.\n"); 306 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_fixup Entry.\n");
303 307
304 /* Fix up at the device node and pci_dev relationship */ 308 /* Fix up at the device node and pci_dev relationship */
305 mf_display_src(0xC9000100); 309 mf_display_src(0xC9000100);
@@ -313,7 +317,7 @@ void __init iSeries_pci_final_fixup(void)
313 if (node != NULL) { 317 if (node != NULL) {
314 ++DeviceCount; 318 ++DeviceCount;
315 pdev->sysdata = (void *)node; 319 pdev->sysdata = (void *)node;
316 node->PciDev = pdev; 320 PCI_DN(node)->pcidev = pdev;
317 PPCDBG(PPCDBG_BUSWALK, 321 PPCDBG(PPCDBG_BUSWALK,
318 "pdev 0x%p <==> DevNode 0x%p\n", 322 "pdev 0x%p <==> DevNode 0x%p\n",
319 pdev, node); 323 pdev, node);
@@ -323,7 +327,7 @@ void __init iSeries_pci_final_fixup(void)
323 } else 327 } else
324 printk("PCI: Device Tree not found for 0x%016lX\n", 328 printk("PCI: Device Tree not found for 0x%016lX\n",
325 (unsigned long)pdev); 329 (unsigned long)pdev);
326 pdev->irq = node->Irq; 330 pdev->irq = PCI_DN(node)->Irq;
327 } 331 }
328 iSeries_activate_IRQs(); 332 iSeries_activate_IRQs();
329 mf_display_src(0xC9000200); 333 mf_display_src(0xC9000200);
@@ -332,24 +336,24 @@ void __init iSeries_pci_final_fixup(void)
332void pcibios_fixup_bus(struct pci_bus *PciBus) 336void pcibios_fixup_bus(struct pci_bus *PciBus)
333{ 337{
334 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_fixup_bus(0x%04X) Entry.\n", 338 PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_fixup_bus(0x%04X) Entry.\n",
335 PciBus->number); 339 PciBus->number);
336} 340}
337 341
338void pcibios_fixup_resources(struct pci_dev *pdev) 342void pcibios_fixup_resources(struct pci_dev *pdev)
339{ 343{
340 PPCDBG(PPCDBG_BUSWALK, "fixup_resources pdev %p\n", pdev); 344 PPCDBG(PPCDBG_BUSWALK, "fixup_resources pdev %p\n", pdev);
341} 345}
342 346
343/* 347/*
344 * Loop through each node function to find usable EADs bridges. 348 * Loop through each node function to find usable EADs bridges.
345 */ 349 */
346static void scan_PHB_slots(struct pci_controller *Phb) 350static void scan_PHB_slots(struct pci_controller *Phb)
347{ 351{
348 struct HvCallPci_DeviceInfo *DevInfo; 352 struct HvCallPci_DeviceInfo *DevInfo;
349 HvBusNumber bus = Phb->local_number; /* System Bus */ 353 HvBusNumber bus = Phb->local_number; /* System Bus */
350 const HvSubBusNumber SubBus = 0; /* EADs is always 0. */ 354 const HvSubBusNumber SubBus = 0; /* EADs is always 0. */
351 int HvRc = 0; 355 int HvRc = 0;
352 int IdSel; 356 int IdSel;
353 const int MaxAgents = 8; 357 const int MaxAgents = 8;
354 358
355 DevInfo = (struct HvCallPci_DeviceInfo*) 359 DevInfo = (struct HvCallPci_DeviceInfo*)
@@ -358,10 +362,10 @@ static void scan_PHB_slots(struct pci_controller *Phb)
358 return; 362 return;
359 363
360 /* 364 /*
361 * Probe for EADs Bridges 365 * Probe for EADs Bridges
362 */ 366 */
363 for (IdSel = 1; IdSel < MaxAgents; ++IdSel) { 367 for (IdSel = 1; IdSel < MaxAgents; ++IdSel) {
364 HvRc = HvCallPci_getDeviceInfo(bus, SubBus, IdSel, 368 HvRc = HvCallPci_getDeviceInfo(bus, SubBus, IdSel,
365 ISERIES_HV_ADDR(DevInfo), 369 ISERIES_HV_ADDR(DevInfo),
366 sizeof(struct HvCallPci_DeviceInfo)); 370 sizeof(struct HvCallPci_DeviceInfo));
367 if (HvRc == 0) { 371 if (HvRc == 0) {
@@ -393,19 +397,19 @@ static void scan_EADS_bridge(HvBusNumber bus, HvSubBusNumber SubBus,
393 397
394 /* Note: hvSubBus and irq is always be 0 at this level! */ 398 /* Note: hvSubBus and irq is always be 0 at this level! */
395 for (Function = 0; Function < 8; ++Function) { 399 for (Function = 0; Function < 8; ++Function) {
396 AgentId = ISERIES_PCI_AGENTID(IdSel, Function); 400 AgentId = ISERIES_PCI_AGENTID(IdSel, Function);
397 HvRc = HvCallXm_connectBusUnit(bus, SubBus, AgentId, 0); 401 HvRc = HvCallXm_connectBusUnit(bus, SubBus, AgentId, 0);
398 if (HvRc == 0) { 402 if (HvRc == 0) {
399 printk("found device at bus %d idsel %d func %d (AgentId %x)\n", 403 printk("found device at bus %d idsel %d func %d (AgentId %x)\n",
400 bus, IdSel, Function, AgentId); 404 bus, IdSel, Function, AgentId);
401 /* Connect EADs: 0x18.00.12 = 0x00 */ 405 /* Connect EADs: 0x18.00.12 = 0x00 */
402 PPCDBG(PPCDBG_BUSWALK, 406 PPCDBG(PPCDBG_BUSWALK,
403 "PCI:Connect EADs: 0x%02X.%02X.%02X\n", 407 "PCI:Connect EADs: 0x%02X.%02X.%02X\n",
404 bus, SubBus, AgentId); 408 bus, SubBus, AgentId);
405 HvRc = HvCallPci_getBusUnitInfo(bus, SubBus, AgentId, 409 HvRc = HvCallPci_getBusUnitInfo(bus, SubBus, AgentId,
406 ISERIES_HV_ADDR(BridgeInfo), 410 ISERIES_HV_ADDR(BridgeInfo),
407 sizeof(struct HvCallPci_BridgeInfo)); 411 sizeof(struct HvCallPci_BridgeInfo));
408 if (HvRc == 0) { 412 if (HvRc == 0) {
409 printk("bridge info: type %x subbus %x maxAgents %x maxsubbus %x logslot %x\n", 413 printk("bridge info: type %x subbus %x maxAgents %x maxsubbus %x logslot %x\n",
410 BridgeInfo->busUnitInfo.deviceType, 414 BridgeInfo->busUnitInfo.deviceType,
411 BridgeInfo->subBusNumber, 415 BridgeInfo->subBusNumber,
@@ -428,7 +432,7 @@ static void scan_EADS_bridge(HvBusNumber bus, HvSubBusNumber SubBus,
428 printk("PCI: Invalid Bridge Configuration(0x%02X)", 432 printk("PCI: Invalid Bridge Configuration(0x%02X)",
429 BridgeInfo->busUnitInfo.deviceType); 433 BridgeInfo->busUnitInfo.deviceType);
430 } 434 }
431 } else if (HvRc != 0x000B) 435 } else if (HvRc != 0x000B)
432 pci_Log_Error("EADs Connect", 436 pci_Log_Error("EADs Connect",
433 bus, SubBus, AgentId, HvRc); 437 bus, SubBus, AgentId, HvRc);
434 } 438 }
@@ -441,7 +445,7 @@ static void scan_EADS_bridge(HvBusNumber bus, HvSubBusNumber SubBus,
441static int scan_bridge_slot(HvBusNumber Bus, 445static int scan_bridge_slot(HvBusNumber Bus,
442 struct HvCallPci_BridgeInfo *BridgeInfo) 446 struct HvCallPci_BridgeInfo *BridgeInfo)
443{ 447{
444 struct iSeries_Device_Node *node; 448 struct device_node *node;
445 HvSubBusNumber SubBus = BridgeInfo->subBusNumber; 449 HvSubBusNumber SubBus = BridgeInfo->subBusNumber;
446 u16 VendorId = 0; 450 u16 VendorId = 0;
447 int HvRc = 0; 451 int HvRc = 0;
@@ -451,16 +455,16 @@ static int scan_bridge_slot(HvBusNumber Bus,
451 HvAgentId EADsIdSel = ISERIES_PCI_AGENTID(IdSel, Function); 455 HvAgentId EADsIdSel = ISERIES_PCI_AGENTID(IdSel, Function);
452 456
453 /* iSeries_allocate_IRQ.: 0x18.00.12(0xA3) */ 457 /* iSeries_allocate_IRQ.: 0x18.00.12(0xA3) */
454 Irq = iSeries_allocate_IRQ(Bus, 0, EADsIdSel); 458 Irq = iSeries_allocate_IRQ(Bus, 0, EADsIdSel);
455 PPCDBG(PPCDBG_BUSWALK, 459 PPCDBG(PPCDBG_BUSWALK,
456 "PCI:- allocate and assign IRQ 0x%02X.%02X.%02X = 0x%02X\n", 460 "PCI:- allocate and assign IRQ 0x%02X.%02X.%02X = 0x%02X\n",
457 Bus, 0, EADsIdSel, Irq); 461 Bus, 0, EADsIdSel, Irq);
458 462
459 /* 463 /*
460 * Connect all functions of any device found. 464 * Connect all functions of any device found.
461 */ 465 */
462 for (IdSel = 1; IdSel <= BridgeInfo->maxAgents; ++IdSel) { 466 for (IdSel = 1; IdSel <= BridgeInfo->maxAgents; ++IdSel) {
463 for (Function = 0; Function < 8; ++Function) { 467 for (Function = 0; Function < 8; ++Function) {
464 HvAgentId AgentId = ISERIES_PCI_AGENTID(IdSel, Function); 468 HvAgentId AgentId = ISERIES_PCI_AGENTID(IdSel, Function);
465 HvRc = HvCallXm_connectBusUnit(Bus, SubBus, 469 HvRc = HvCallXm_connectBusUnit(Bus, SubBus,
466 AgentId, Irq); 470 AgentId, Irq);
@@ -484,15 +488,15 @@ static int scan_bridge_slot(HvBusNumber Bus,
484 "PCI:- FoundDevice: 0x%02X.%02X.%02X = 0x%04X, irq %d\n", 488 "PCI:- FoundDevice: 0x%02X.%02X.%02X = 0x%04X, irq %d\n",
485 Bus, SubBus, AgentId, VendorId, Irq); 489 Bus, SubBus, AgentId, VendorId, Irq);
486 HvRc = HvCallPci_configStore8(Bus, SubBus, AgentId, 490 HvRc = HvCallPci_configStore8(Bus, SubBus, AgentId,
487 PCI_INTERRUPT_LINE, Irq); 491 PCI_INTERRUPT_LINE, Irq);
488 if (HvRc != 0) 492 if (HvRc != 0)
489 pci_Log_Error("PciCfgStore Irq Failed!", 493 pci_Log_Error("PciCfgStore Irq Failed!",
490 Bus, SubBus, AgentId, HvRc); 494 Bus, SubBus, AgentId, HvRc);
491 495
492 ++DeviceCount; 496 ++DeviceCount;
493 node = build_device_node(Bus, SubBus, EADsIdSel, Function); 497 node = build_device_node(Bus, SubBus, EADsIdSel, Function);
494 node->Irq = Irq; 498 PCI_DN(node)->Irq = Irq;
495 node->LogicalSlot = BridgeInfo->logicalSlotNumber; 499 PCI_DN(node)->LogicalSlot = BridgeInfo->logicalSlotNumber;
496 500
497 } /* for (Function = 0; Function < 8; ++Function) */ 501 } /* for (Function = 0; Function < 8; ++Function) */
498 } /* for (IdSel = 1; IdSel <= MaxAgents; ++IdSel) */ 502 } /* for (IdSel = 1; IdSel <= MaxAgents; ++IdSel) */
@@ -542,15 +546,16 @@ EXPORT_SYMBOL(iSeries_memcpy_fromio);
542/* 546/*
543 * Look down the chain to find the matching Device Device 547 * Look down the chain to find the matching Device Device
544 */ 548 */
545static struct iSeries_Device_Node *find_Device_Node(int bus, int devfn) 549static struct device_node *find_Device_Node(int bus, int devfn)
546{ 550{
547 struct list_head *pos; 551 struct list_head *pos;
548 552
549 list_for_each(pos, &iSeries_Global_Device_List) { 553 list_for_each(pos, &iSeries_Global_Device_List) {
550 struct iSeries_Device_Node *node = 554 struct device_node *node =
551 list_entry(pos, struct iSeries_Device_Node, Device_List); 555 list_entry(pos, struct device_node, Device_List);
552 556
553 if ((bus == ISERIES_BUS(node)) && (devfn == node->DevFn)) 557 if ((bus == ISERIES_BUS(node)) &&
558 (devfn == PCI_DN(node)->devfn))
554 return node; 559 return node;
555 } 560 }
556 return NULL; 561 return NULL;
@@ -562,12 +567,12 @@ static struct iSeries_Device_Node *find_Device_Node(int bus, int devfn)
562 * Sanity Check Node PciDev to passed pci_dev 567 * Sanity Check Node PciDev to passed pci_dev
563 * If none is found, returns a NULL which the client must handle. 568 * If none is found, returns a NULL which the client must handle.
564 */ 569 */
565static struct iSeries_Device_Node *get_Device_Node(struct pci_dev *pdev) 570static struct device_node *get_Device_Node(struct pci_dev *pdev)
566{ 571{
567 struct iSeries_Device_Node *node; 572 struct device_node *node;
568 573
569 node = pdev->sysdata; 574 node = pdev->sysdata;
570 if (node == NULL || node->PciDev != pdev) 575 if (node == NULL || PCI_DN(node)->pcidev != pdev)
571 node = find_Device_Node(pdev->bus->number, pdev->devfn); 576 node = find_Device_Node(pdev->bus->number, pdev->devfn);
572 return node; 577 return node;
573} 578}
@@ -595,7 +600,7 @@ static u64 hv_cfg_write_func[4] = {
595static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn, 600static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
596 int offset, int size, u32 *val) 601 int offset, int size, u32 *val)
597{ 602{
598 struct iSeries_Device_Node *node = find_Device_Node(bus->number, devfn); 603 struct device_node *node = find_Device_Node(bus->number, devfn);
599 u64 fn; 604 u64 fn;
600 struct HvCallPci_LoadReturn ret; 605 struct HvCallPci_LoadReturn ret;
601 606
@@ -607,7 +612,7 @@ static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
607 } 612 }
608 613
609 fn = hv_cfg_read_func[(size - 1) & 3]; 614 fn = hv_cfg_read_func[(size - 1) & 3];
610 HvCall3Ret16(fn, &ret, node->DsaAddr.DsaAddr, offset, 0); 615 HvCall3Ret16(fn, &ret, PCI_DN(node)->DsaAddr.DsaAddr, offset, 0);
611 616
612 if (ret.rc != 0) { 617 if (ret.rc != 0) {
613 *val = ~0; 618 *val = ~0;
@@ -625,7 +630,7 @@ static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
625static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn, 630static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
626 int offset, int size, u32 val) 631 int offset, int size, u32 val)
627{ 632{
628 struct iSeries_Device_Node *node = find_Device_Node(bus->number, devfn); 633 struct device_node *node = find_Device_Node(bus->number, devfn);
629 u64 fn; 634 u64 fn;
630 u64 ret; 635 u64 ret;
631 636
@@ -635,7 +640,7 @@ static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
635 return PCIBIOS_BAD_REGISTER_NUMBER; 640 return PCIBIOS_BAD_REGISTER_NUMBER;
636 641
637 fn = hv_cfg_write_func[(size - 1) & 3]; 642 fn = hv_cfg_write_func[(size - 1) & 3];
638 ret = HvCall4(fn, node->DsaAddr.DsaAddr, offset, val, 0); 643 ret = HvCall4(fn, PCI_DN(node)->DsaAddr.DsaAddr, offset, val, 0);
639 644
640 if (ret != 0) 645 if (ret != 0)
641 return PCIBIOS_DEVICE_NOT_FOUND; 646 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -657,14 +662,16 @@ static struct pci_ops iSeries_pci_ops = {
657 * PCI: Device 23.90 ReadL Retry( 1) 662 * PCI: Device 23.90 ReadL Retry( 1)
658 * PCI: Device 23.90 ReadL Retry Successful(1) 663 * PCI: Device 23.90 ReadL Retry Successful(1)
659 */ 664 */
660static int CheckReturnCode(char *TextHdr, struct iSeries_Device_Node *DevNode, 665static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
661 int *retry, u64 ret) 666 int *retry, u64 ret)
662{ 667{
663 if (ret != 0) { 668 if (ret != 0) {
669 struct pci_dn *pdn = PCI_DN(DevNode);
670
664 ++Pci_Error_Count; 671 ++Pci_Error_Count;
665 (*retry)++; 672 (*retry)++;
666 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n", 673 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n",
667 TextHdr, DevNode->DsaAddr.Dsa.busNumber, DevNode->DevFn, 674 TextHdr, pdn->DsaAddr.Dsa.busNumber, pdn->devfn,
668 *retry, (int)ret); 675 *retry, (int)ret);
669 /* 676 /*
670 * Bump the retry and check for retry count exceeded. 677 * Bump the retry and check for retry count exceeded.
@@ -687,14 +694,14 @@ static int CheckReturnCode(char *TextHdr, struct iSeries_Device_Node *DevNode,
687 * Note: Make sure the passed variable end up on the stack to avoid 694 * Note: Make sure the passed variable end up on the stack to avoid
688 * the exposure of being device global. 695 * the exposure of being device global.
689 */ 696 */
690static inline struct iSeries_Device_Node *xlate_iomm_address( 697static inline struct device_node *xlate_iomm_address(
691 const volatile void __iomem *IoAddress, 698 const volatile void __iomem *IoAddress,
692 u64 *dsaptr, u64 *BarOffsetPtr) 699 u64 *dsaptr, u64 *BarOffsetPtr)
693{ 700{
694 unsigned long OrigIoAddr; 701 unsigned long OrigIoAddr;
695 unsigned long BaseIoAddr; 702 unsigned long BaseIoAddr;
696 unsigned long TableIndex; 703 unsigned long TableIndex;
697 struct iSeries_Device_Node *DevNode; 704 struct device_node *DevNode;
698 705
699 OrigIoAddr = (unsigned long __force)IoAddress; 706 OrigIoAddr = (unsigned long __force)IoAddress;
700 if ((OrigIoAddr < BASE_IO_MEMORY) || (OrigIoAddr >= max_io_memory)) 707 if ((OrigIoAddr < BASE_IO_MEMORY) || (OrigIoAddr >= max_io_memory))
@@ -705,7 +712,7 @@ static inline struct iSeries_Device_Node *xlate_iomm_address(
705 712
706 if (DevNode != NULL) { 713 if (DevNode != NULL) {
707 int barnum = iobar_table[TableIndex]; 714 int barnum = iobar_table[TableIndex];
708 *dsaptr = DevNode->DsaAddr.DsaAddr | (barnum << 24); 715 *dsaptr = PCI_DN(DevNode)->DsaAddr.DsaAddr | (barnum << 24);
709 *BarOffsetPtr = BaseIoAddr % IOMM_TABLE_ENTRY_SIZE; 716 *BarOffsetPtr = BaseIoAddr % IOMM_TABLE_ENTRY_SIZE;
710 } else 717 } else
711 panic("PCI: Invalid PCI IoAddress detected!\n"); 718 panic("PCI: Invalid PCI IoAddress detected!\n");
@@ -727,7 +734,7 @@ u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
727 u64 dsa; 734 u64 dsa;
728 int retry = 0; 735 int retry = 0;
729 struct HvCallPci_LoadReturn ret; 736 struct HvCallPci_LoadReturn ret;
730 struct iSeries_Device_Node *DevNode = 737 struct device_node *DevNode =
731 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 738 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
732 739
733 if (DevNode == NULL) { 740 if (DevNode == NULL) {
@@ -757,7 +764,7 @@ u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
757 u64 dsa; 764 u64 dsa;
758 int retry = 0; 765 int retry = 0;
759 struct HvCallPci_LoadReturn ret; 766 struct HvCallPci_LoadReturn ret;
760 struct iSeries_Device_Node *DevNode = 767 struct device_node *DevNode =
761 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 768 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
762 769
763 if (DevNode == NULL) { 770 if (DevNode == NULL) {
@@ -788,7 +795,7 @@ u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
788 u64 dsa; 795 u64 dsa;
789 int retry = 0; 796 int retry = 0;
790 struct HvCallPci_LoadReturn ret; 797 struct HvCallPci_LoadReturn ret;
791 struct iSeries_Device_Node *DevNode = 798 struct device_node *DevNode =
792 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 799 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
793 800
794 if (DevNode == NULL) { 801 if (DevNode == NULL) {
@@ -826,7 +833,7 @@ void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
826 u64 dsa; 833 u64 dsa;
827 int retry = 0; 834 int retry = 0;
828 u64 rc; 835 u64 rc;
829 struct iSeries_Device_Node *DevNode = 836 struct device_node *DevNode =
830 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 837 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
831 838
832 if (DevNode == NULL) { 839 if (DevNode == NULL) {
@@ -854,7 +861,7 @@ void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
854 u64 dsa; 861 u64 dsa;
855 int retry = 0; 862 int retry = 0;
856 u64 rc; 863 u64 rc;
857 struct iSeries_Device_Node *DevNode = 864 struct device_node *DevNode =
858 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 865 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
859 866
860 if (DevNode == NULL) { 867 if (DevNode == NULL) {
@@ -882,7 +889,7 @@ void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
882 u64 dsa; 889 u64 dsa;
883 int retry = 0; 890 int retry = 0;
884 u64 rc; 891 u64 rc;
885 struct iSeries_Device_Node *DevNode = 892 struct device_node *DevNode =
886 xlate_iomm_address(IoAddress, &dsa, &BarOffset); 893 xlate_iomm_address(IoAddress, &dsa, &BarOffset);
887 894
888 if (DevNode == NULL) { 895 if (DevNode == NULL) {
diff --git a/arch/ppc64/kernel/iSeries_proc.c b/arch/powerpc/platforms/iseries/proc.c
index 0fe3116eba29..d46b473ce4dd 100644
--- a/arch/ppc64/kernel/iSeries_proc.c
+++ b/arch/powerpc/platforms/iseries/proc.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * iSeries_proc.c
3 * Copyright (C) 2001 Kyle A. Lucke IBM Corporation 2 * Copyright (C) 2001 Kyle A. Lucke IBM Corporation
4 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen IBM Corporation 3 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen IBM Corporation
5 * 4 *
@@ -68,12 +67,15 @@ static int proc_titantod_show(struct seq_file *m, void *v)
68 unsigned long tb_ticks = (tb0 - startTb); 67 unsigned long tb_ticks = (tb0 - startTb);
69 unsigned long titan_jiffies = titan_usec / (1000000/HZ); 68 unsigned long titan_jiffies = titan_usec / (1000000/HZ);
70 unsigned long titan_jiff_usec = titan_jiffies * (1000000/HZ); 69 unsigned long titan_jiff_usec = titan_jiffies * (1000000/HZ);
71 unsigned long titan_jiff_rem_usec = titan_usec - titan_jiff_usec; 70 unsigned long titan_jiff_rem_usec =
71 titan_usec - titan_jiff_usec;
72 unsigned long tb_jiffies = tb_ticks / tb_ticks_per_jiffy; 72 unsigned long tb_jiffies = tb_ticks / tb_ticks_per_jiffy;
73 unsigned long tb_jiff_ticks = tb_jiffies * tb_ticks_per_jiffy; 73 unsigned long tb_jiff_ticks = tb_jiffies * tb_ticks_per_jiffy;
74 unsigned long tb_jiff_rem_ticks = tb_ticks - tb_jiff_ticks; 74 unsigned long tb_jiff_rem_ticks = tb_ticks - tb_jiff_ticks;
75 unsigned long tb_jiff_rem_usec = tb_jiff_rem_ticks / tb_ticks_per_usec; 75 unsigned long tb_jiff_rem_usec =
76 unsigned long new_tb_ticks_per_jiffy = (tb_ticks * (1000000/HZ))/titan_usec; 76 tb_jiff_rem_ticks / tb_ticks_per_usec;
77 unsigned long new_tb_ticks_per_jiffy =
78 (tb_ticks * (1000000/HZ))/titan_usec;
77 79
78 seq_printf(m, " titan elapsed = %lu uSec\n", titan_usec); 80 seq_printf(m, " titan elapsed = %lu uSec\n", titan_usec);
79 seq_printf(m, " tb elapsed = %lu ticks\n", tb_ticks); 81 seq_printf(m, " tb elapsed = %lu ticks\n", tb_ticks);
diff --git a/arch/ppc64/kernel/iSeries_setup.c b/arch/powerpc/platforms/iseries/setup.c
index 9daf734adbd5..ad78c8581a5a 100644
--- a/arch/ppc64/kernel/iSeries_setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -2,8 +2,6 @@
2 * Copyright (c) 2000 Mike Corrigan <mikejc@us.ibm.com> 2 * Copyright (c) 2000 Mike Corrigan <mikejc@us.ibm.com>
3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu> 3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
4 * 4 *
5 * Module name: iSeries_setup.c
6 *
7 * Description: 5 * Description:
8 * Architecture- / platform-specific boot-time initialization code for 6 * Architecture- / platform-specific boot-time initialization code for
9 * the IBM iSeries LPAR. Adapted from original code by Grant Erickson and 7 * the IBM iSeries LPAR. Adapted from original code by Grant Erickson and
@@ -42,7 +40,6 @@
42#include <asm/firmware.h> 40#include <asm/firmware.h>
43 41
44#include <asm/time.h> 42#include <asm/time.h>
45#include "iSeries_setup.h"
46#include <asm/naca.h> 43#include <asm/naca.h>
47#include <asm/paca.h> 44#include <asm/paca.h>
48#include <asm/cache.h> 45#include <asm/cache.h>
@@ -62,6 +59,8 @@
62#include <asm/iSeries/ItVpdAreas.h> 59#include <asm/iSeries/ItVpdAreas.h>
63#include <asm/iSeries/LparMap.h> 60#include <asm/iSeries/LparMap.h>
64 61
62#include "setup.h"
63
65extern void hvlog(char *fmt, ...); 64extern void hvlog(char *fmt, ...);
66 65
67#ifdef DEBUG 66#ifdef DEBUG
diff --git a/arch/ppc64/kernel/iSeries_setup.h b/arch/powerpc/platforms/iseries/setup.h
index c6eb29a245ac..6da89ae991ce 100644
--- a/arch/ppc64/kernel/iSeries_setup.h
+++ b/arch/powerpc/platforms/iseries/setup.h
@@ -2,8 +2,6 @@
2 * Copyright (c) 2000 Mike Corrigan <mikejc@us.ibm.com> 2 * Copyright (c) 2000 Mike Corrigan <mikejc@us.ibm.com>
3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu> 3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
4 * 4 *
5 * Module name: as400_setup.h
6 *
7 * Description: 5 * Description:
8 * Architecture- / platform-specific boot-time initialization code for 6 * Architecture- / platform-specific boot-time initialization code for
9 * the IBM AS/400 LPAR. Adapted from original code by Grant Erickson and 7 * the IBM AS/400 LPAR. Adapted from original code by Grant Erickson and
diff --git a/arch/ppc64/kernel/iSeries_smp.c b/arch/powerpc/platforms/iseries/smp.c
index f982e5b805f4..f720916682f6 100644
--- a/arch/ppc64/kernel/iSeries_smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -47,17 +47,17 @@
47 47
48static unsigned long iSeries_smp_message[NR_CPUS]; 48static unsigned long iSeries_smp_message[NR_CPUS];
49 49
50void iSeries_smp_message_recv( struct pt_regs * regs ) 50void iSeries_smp_message_recv(struct pt_regs *regs)
51{ 51{
52 int cpu = smp_processor_id(); 52 int cpu = smp_processor_id();
53 int msg; 53 int msg;
54 54
55 if ( num_online_cpus() < 2 ) 55 if (num_online_cpus() < 2)
56 return; 56 return;
57 57
58 for ( msg = 0; msg < 4; ++msg ) 58 for (msg = 0; msg < 4; msg++)
59 if ( test_and_clear_bit( msg, &iSeries_smp_message[cpu] ) ) 59 if (test_and_clear_bit(msg, &iSeries_smp_message[cpu]))
60 smp_message_recv( msg, regs ); 60 smp_message_recv(msg, regs);
61} 61}
62 62
63static inline void smp_iSeries_do_message(int cpu, int msg) 63static inline void smp_iSeries_do_message(int cpu, int msg)
@@ -74,8 +74,8 @@ static void smp_iSeries_message_pass(int target, int msg)
74 smp_iSeries_do_message(target, msg); 74 smp_iSeries_do_message(target, msg);
75 else { 75 else {
76 for_each_online_cpu(i) { 76 for_each_online_cpu(i) {
77 if (target == MSG_ALL_BUT_SELF 77 if ((target == MSG_ALL_BUT_SELF) &&
78 && i == smp_processor_id()) 78 (i == smp_processor_id()))
79 continue; 79 continue;
80 smp_iSeries_do_message(i, msg); 80 smp_iSeries_do_message(i, msg);
81 } 81 }
@@ -89,7 +89,7 @@ static int smp_iSeries_probe(void)
89 89
90static void smp_iSeries_kick_cpu(int nr) 90static void smp_iSeries_kick_cpu(int nr)
91{ 91{
92 BUG_ON(nr < 0 || nr >= NR_CPUS); 92 BUG_ON((nr < 0) || (nr >= NR_CPUS));
93 93
94 /* Verify that our partition has a processor nr */ 94 /* Verify that our partition has a processor nr */
95 if (paca[nr].lppaca.dyn_proc_status >= 2) 95 if (paca[nr].lppaca.dyn_proc_status >= 2)
diff --git a/arch/ppc64/kernel/iSeries_vio.c b/arch/powerpc/platforms/iseries/vio.c
index c0f7d2e9153f..c0f7d2e9153f 100644
--- a/arch/ppc64/kernel/iSeries_vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
diff --git a/arch/ppc64/kernel/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
index 2a6c4f01c45e..c0c767bd37f1 100644
--- a/arch/ppc64/kernel/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -1,5 +1,4 @@
1/* -*- linux-c -*- 1/* -*- linux-c -*-
2 * arch/ppc64/kernel/viopath.c
3 * 2 *
4 * iSeries Virtual I/O Message Path code 3 * iSeries Virtual I/O Message Path code
5 * 4 *
@@ -7,7 +6,7 @@
7 * Ryan Arnold <ryanarn@us.ibm.com> 6 * Ryan Arnold <ryanarn@us.ibm.com>
8 * Colin Devilbiss <devilbis@us.ibm.com> 7 * Colin Devilbiss <devilbis@us.ibm.com>
9 * 8 *
10 * (C) Copyright 2000-2003 IBM Corporation 9 * (C) Copyright 2000-2005 IBM Corporation
11 * 10 *
12 * This code is used by the iSeries virtual disk, cd, 11 * This code is used by the iSeries virtual disk, cd,
13 * tape, and console to communicate with OS/400 in another 12 * tape, and console to communicate with OS/400 in another
diff --git a/arch/ppc64/kernel/iSeries_VpdInfo.c b/arch/powerpc/platforms/iseries/vpdinfo.c
index 5d921792571f..d8a6796924e2 100644
--- a/arch/ppc64/kernel/iSeries_VpdInfo.c
+++ b/arch/powerpc/platforms/iseries/vpdinfo.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * File iSeries_vpdInfo.c created by Allan Trautman on Fri Feb 2 2001.
3 *
4 * This code gets the card location of the hardware 2 * This code gets the card location of the hardware
5 * Copyright (C) 2001 <Allan H Trautman> <IBM Corp> 3 * Copyright (C) 2001 <Allan H Trautman> <IBM Corp>
6 * Copyright (C) 2005 Stephen Rothwel, IBM Corp 4 * Copyright (C) 2005 Stephen Rothwel, IBM Corp
@@ -242,7 +240,7 @@ out_free:
242 */ 240 */
243void __init iSeries_Device_Information(struct pci_dev *PciDev, int count) 241void __init iSeries_Device_Information(struct pci_dev *PciDev, int count)
244{ 242{
245 struct iSeries_Device_Node *DevNode = PciDev->sysdata; 243 struct device_node *DevNode = PciDev->sysdata;
246 u16 bus; 244 u16 bus;
247 u8 frame; 245 u8 frame;
248 char card[4]; 246 char card[4];
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 40675b3f924d..d4eb55f82f03 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -84,6 +84,7 @@ head-y := arch/ppc64/kernel/head.o
84libs-y += arch/ppc64/lib/ 84libs-y += arch/ppc64/lib/
85core-y += arch/ppc64/kernel/ 85core-y += arch/ppc64/kernel/
86core-y += arch/ppc64/mm/ 86core-y += arch/ppc64/mm/
87core-y += arch/powerpc/platforms/
87core-$(CONFIG_XMON) += arch/ppc64/xmon/ 88core-$(CONFIG_XMON) += arch/ppc64/xmon/
88drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 89drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
89 90
diff --git a/arch/ppc64/kernel/HvLpEvent.c b/arch/ppc64/kernel/HvLpEvent.c
deleted file mode 100644
index 90032b138902..000000000000
--- a/arch/ppc64/kernel/HvLpEvent.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Copyright 2001 Mike Corrigan IBM Corp
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/stddef.h>
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <asm/system.h>
13#include <asm/iSeries/HvLpEvent.h>
14#include <asm/iSeries/HvCallEvent.h>
15#include <asm/iSeries/ItLpNaca.h>
16
17/* Array of LpEvent handler functions */
18LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes];
19unsigned lpEventHandlerPaths[HvLpEvent_Type_NumTypes];
20
21/* Register a handler for an LpEvent type */
22
23int HvLpEvent_registerHandler( HvLpEvent_Type eventType, LpEventHandler handler )
24{
25 int rc = 1;
26 if ( eventType < HvLpEvent_Type_NumTypes ) {
27 lpEventHandler[eventType] = handler;
28 rc = 0;
29 }
30 return rc;
31
32}
33
34int HvLpEvent_unregisterHandler( HvLpEvent_Type eventType )
35{
36 int rc = 1;
37
38 might_sleep();
39
40 if ( eventType < HvLpEvent_Type_NumTypes ) {
41 if ( !lpEventHandlerPaths[eventType] ) {
42 lpEventHandler[eventType] = NULL;
43 rc = 0;
44
45 /* We now sleep until all other CPUs have scheduled. This ensures that
46 * the deletion is seen by all other CPUs, and that the deleted handler
47 * isn't still running on another CPU when we return. */
48 synchronize_rcu();
49 }
50 }
51 return rc;
52}
53EXPORT_SYMBOL(HvLpEvent_registerHandler);
54EXPORT_SYMBOL(HvLpEvent_unregisterHandler);
55
56/* (lpIndex is the partition index of the target partition.
57 * needed only for VirtualIo, VirtualLan and SessionMgr. Zero
58 * indicates to use our partition index - for the other types)
59 */
60int HvLpEvent_openPath( HvLpEvent_Type eventType, HvLpIndex lpIndex )
61{
62 int rc = 1;
63 if ( eventType < HvLpEvent_Type_NumTypes &&
64 lpEventHandler[eventType] ) {
65 if ( lpIndex == 0 )
66 lpIndex = itLpNaca.xLpIndex;
67 HvCallEvent_openLpEventPath( lpIndex, eventType );
68 ++lpEventHandlerPaths[eventType];
69 rc = 0;
70 }
71 return rc;
72}
73
74int HvLpEvent_closePath( HvLpEvent_Type eventType, HvLpIndex lpIndex )
75{
76 int rc = 1;
77 if ( eventType < HvLpEvent_Type_NumTypes &&
78 lpEventHandler[eventType] &&
79 lpEventHandlerPaths[eventType] ) {
80 if ( lpIndex == 0 )
81 lpIndex = itLpNaca.xLpIndex;
82 HvCallEvent_closeLpEventPath( lpIndex, eventType );
83 --lpEventHandlerPaths[eventType];
84 rc = 0;
85 }
86 return rc;
87}
88
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
index afadb6e4a6dc..bb5946b88b8b 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -16,17 +16,10 @@ obj-y += vdso32/ vdso64/
16 16
17obj-$(CONFIG_PPC_OF) += of_device.o 17obj-$(CONFIG_PPC_OF) += of_device.o
18 18
19pci-obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o iSeries_irq.o \
20 iSeries_VpdInfo.o
21pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o 19pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o
22 20
23obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y) 21obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y)
24 22
25obj-$(CONFIG_PPC_ISERIES) += HvCall.o HvLpConfig.o LparData.o \
26 iSeries_setup.o ItLpQueue.o hvCall.o \
27 mf.o HvLpEvent.o iSeries_proc.o iSeries_htab.o \
28 iSeries_iommu.o
29
30obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o 23obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o
31 24
32obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \ 25obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \
@@ -45,14 +38,12 @@ obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o
45obj-$(CONFIG_PPC_RTAS) += rtas.o rtas_pci.o 38obj-$(CONFIG_PPC_RTAS) += rtas.o rtas_pci.o
46obj-$(CONFIG_RTAS_PROC) += rtas-proc.o 39obj-$(CONFIG_RTAS_PROC) += rtas-proc.o
47obj-$(CONFIG_SCANLOG) += scanlog.o 40obj-$(CONFIG_SCANLOG) += scanlog.o
48obj-$(CONFIG_VIOPATH) += viopath.o
49obj-$(CONFIG_LPARCFG) += lparcfg.o 41obj-$(CONFIG_LPARCFG) += lparcfg.o
50obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o 42obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
51obj-$(CONFIG_BOOTX_TEXT) += btext.o 43obj-$(CONFIG_BOOTX_TEXT) += btext.o
52obj-$(CONFIG_HVCS) += hvcserver.o 44obj-$(CONFIG_HVCS) += hvcserver.o
53 45
54vio-obj-$(CONFIG_PPC_PSERIES) += pSeries_vio.o 46vio-obj-$(CONFIG_PPC_PSERIES) += pSeries_vio.o
55vio-obj-$(CONFIG_PPC_ISERIES) += iSeries_vio.o
56obj-$(CONFIG_IBMVIO) += vio.o $(vio-obj-y) 47obj-$(CONFIG_IBMVIO) += vio.o $(vio-obj-y)
57obj-$(CONFIG_XICS) += xics.o 48obj-$(CONFIG_XICS) += xics.o
58obj-$(CONFIG_MPIC) += mpic.o 49obj-$(CONFIG_MPIC) += mpic.o
@@ -68,7 +59,6 @@ obj-$(CONFIG_U3_DART) += u3_iommu.o
68 59
69ifdef CONFIG_SMP 60ifdef CONFIG_SMP
70obj-$(CONFIG_PPC_PMAC) += pmac_smp.o smp-tbsync.o 61obj-$(CONFIG_PPC_PMAC) += pmac_smp.o smp-tbsync.o
71obj-$(CONFIG_PPC_ISERIES) += iSeries_smp.o
72obj-$(CONFIG_PPC_PSERIES) += pSeries_smp.o 62obj-$(CONFIG_PPC_PSERIES) += pSeries_smp.o
73obj-$(CONFIG_PPC_BPA) += pSeries_smp.o 63obj-$(CONFIG_PPC_BPA) += pSeries_smp.o
74obj-$(CONFIG_PPC_MAPLE) += smp-tbsync.o 64obj-$(CONFIG_PPC_MAPLE) += smp-tbsync.o
diff --git a/arch/ppc64/kernel/bpa_iommu.c b/arch/ppc64/kernel/bpa_iommu.c
index f33a7bccb0d7..0cc463f24539 100644
--- a/arch/ppc64/kernel/bpa_iommu.c
+++ b/arch/ppc64/kernel/bpa_iommu.c
@@ -39,8 +39,8 @@
39#include <asm/pmac_feature.h> 39#include <asm/pmac_feature.h>
40#include <asm/abs_addr.h> 40#include <asm/abs_addr.h>
41#include <asm/system.h> 41#include <asm/system.h>
42#include <asm/ppc-pci.h>
42 43
43#include "pci.h"
44#include "bpa_iommu.h" 44#include "bpa_iommu.h"
45 45
46static inline unsigned long 46static inline unsigned long
diff --git a/arch/ppc64/kernel/bpa_setup.c b/arch/ppc64/kernel/bpa_setup.c
index 57b3db66f458..9f915f4222b1 100644
--- a/arch/ppc64/kernel/bpa_setup.c
+++ b/arch/ppc64/kernel/bpa_setup.c
@@ -43,8 +43,8 @@
43#include <asm/time.h> 43#include <asm/time.h>
44#include <asm/nvram.h> 44#include <asm/nvram.h>
45#include <asm/cputable.h> 45#include <asm/cputable.h>
46#include <asm/ppc-pci.h>
46 47
47#include "pci.h"
48#include "bpa_iic.h" 48#include "bpa_iic.h"
49#include "bpa_iommu.h" 49#include "bpa_iommu.h"
50 50
diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
index ba93fd731222..035d1b14a207 100644
--- a/arch/ppc64/kernel/eeh.c
+++ b/arch/ppc64/kernel/eeh.c
@@ -33,7 +33,7 @@
33#include <asm/rtas.h> 33#include <asm/rtas.h>
34#include <asm/atomic.h> 34#include <asm/atomic.h>
35#include <asm/systemcfg.h> 35#include <asm/systemcfg.h>
36#include "pci.h" 36#include <asm/ppc-pci.h>
37 37
38#undef DEBUG 38#undef DEBUG
39 39
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index eb526c480b6c..db0cd3587627 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -1253,7 +1253,7 @@ unrecov_slb:
1253 * 1253 *
1254 * On iSeries, the hypervisor must fill in at least one entry before 1254 * On iSeries, the hypervisor must fill in at least one entry before
1255 * we get control (with relocate on). The address is give to the hv 1255 * we get control (with relocate on). The address is give to the hv
1256 * as a page number (see xLparMap in LparData.c), so this must be at a 1256 * as a page number (see xLparMap in lpardata.c), so this must be at a
1257 * fixed address (the linker can't compute (u64)&initial_stab >> 1257 * fixed address (the linker can't compute (u64)&initial_stab >>
1258 * PAGE_SHIFT). 1258 * PAGE_SHIFT).
1259 */ 1259 */
diff --git a/arch/ppc64/kernel/maple_pci.c b/arch/ppc64/kernel/maple_pci.c
index 1d297e0edfc0..0937649f4961 100644
--- a/arch/ppc64/kernel/maple_pci.c
+++ b/arch/ppc64/kernel/maple_pci.c
@@ -23,8 +23,7 @@
23#include <asm/pci-bridge.h> 23#include <asm/pci-bridge.h>
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25#include <asm/iommu.h> 25#include <asm/iommu.h>
26 26#include <asm/ppc-pci.h>
27#include "pci.h"
28 27
29#ifdef DEBUG 28#ifdef DEBUG
30#define DBG(x...) printk(x) 29#define DBG(x...) printk(x)
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index a25b59759ddb..d069bbd7f81f 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -64,44 +64,6 @@ _GLOBAL(get_srr1)
64_GLOBAL(get_sp) 64_GLOBAL(get_sp)
65 mr r3,r1 65 mr r3,r1
66 blr 66 blr
67
68#ifdef CONFIG_PPC_ISERIES
69/* unsigned long local_save_flags(void) */
70_GLOBAL(local_get_flags)
71 lbz r3,PACAPROCENABLED(r13)
72 blr
73
74/* unsigned long local_irq_disable(void) */
75_GLOBAL(local_irq_disable)
76 lbz r3,PACAPROCENABLED(r13)
77 li r4,0
78 stb r4,PACAPROCENABLED(r13)
79 blr /* Done */
80
81/* void local_irq_restore(unsigned long flags) */
82_GLOBAL(local_irq_restore)
83 lbz r5,PACAPROCENABLED(r13)
84 /* Check if things are setup the way we want _already_. */
85 cmpw 0,r3,r5
86 beqlr
87 /* are we enabling interrupts? */
88 cmpdi 0,r3,0
89 stb r3,PACAPROCENABLED(r13)
90 beqlr
91 /* Check pending interrupts */
92 /* A decrementer, IPI or PMC interrupt may have occurred
93 * while we were in the hypervisor (which enables) */
94 ld r4,PACALPPACA+LPPACAANYINT(r13)
95 cmpdi r4,0
96 beqlr
97
98 /*
99 * Handle pending interrupts in interrupt context
100 */
101 li r0,0x5555
102 sc
103 blr
104#endif /* CONFIG_PPC_ISERIES */
105 67
106#ifdef CONFIG_IRQSTACKS 68#ifdef CONFIG_IRQSTACKS
107_GLOBAL(call_do_softirq) 69_GLOBAL(call_do_softirq)
diff --git a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c
index 5914f61a152e..9e90d41131d8 100644
--- a/arch/ppc64/kernel/pSeries_iommu.c
+++ b/arch/ppc64/kernel/pSeries_iommu.c
@@ -47,7 +47,7 @@
47#include <asm/systemcfg.h> 47#include <asm/systemcfg.h>
48#include <asm/firmware.h> 48#include <asm/firmware.h>
49#include <asm/tce.h> 49#include <asm/tce.h>
50#include "pci.h" 50#include <asm/ppc-pci.h>
51 51
52#define DBG(fmt...) 52#define DBG(fmt...)
53 53
diff --git a/arch/ppc64/kernel/pSeries_pci.c b/arch/ppc64/kernel/pSeries_pci.c
index 1f5f141fb7a1..2dd477eb1c53 100644
--- a/arch/ppc64/kernel/pSeries_pci.c
+++ b/arch/ppc64/kernel/pSeries_pci.c
@@ -29,8 +29,7 @@
29 29
30#include <asm/pci-bridge.h> 30#include <asm/pci-bridge.h>
31#include <asm/prom.h> 31#include <asm/prom.h>
32 32#include <asm/ppc-pci.h>
33#include "pci.h"
34 33
35static int __initdata s7a_workaround = -1; 34static int __initdata s7a_workaround = -1;
36 35
diff --git a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c
index b9bcff21b463..5a9fe96f9f67 100644
--- a/arch/ppc64/kernel/pSeries_setup.c
+++ b/arch/ppc64/kernel/pSeries_setup.c
@@ -63,9 +63,9 @@
63#include <asm/firmware.h> 63#include <asm/firmware.h>
64#include <asm/pmc.h> 64#include <asm/pmc.h>
65#include <asm/mpic.h> 65#include <asm/mpic.h>
66#include <asm/ppc-pci.h>
66 67
67#include "i8259.h" 68#include "i8259.h"
68#include "pci.h"
69 69
70#ifdef DEBUG 70#ifdef DEBUG
71#define DBG(fmt...) udbg_printf(fmt) 71#define DBG(fmt...) udbg_printf(fmt)
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index ff4be1da69d5..feec06bbafc3 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -31,8 +31,7 @@
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/machdep.h> 32#include <asm/machdep.h>
33#include <asm/udbg.h> 33#include <asm/udbg.h>
34 34#include <asm/ppc-pci.h>
35#include "pci.h"
36 35
37#ifdef DEBUG 36#ifdef DEBUG
38#define DBG(fmt...) udbg_printf(fmt) 37#define DBG(fmt...) udbg_printf(fmt)
diff --git a/arch/ppc64/kernel/pci.h b/arch/ppc64/kernel/pci.h
deleted file mode 100644
index 5eb2cc320566..000000000000
--- a/arch/ppc64/kernel/pci.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * c 2001 PPC 64 Team, IBM Corp
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef __PPC_KERNEL_PCI_H__
10#define __PPC_KERNEL_PCI_H__
11
12#include <linux/pci.h>
13#include <asm/pci-bridge.h>
14
15extern unsigned long isa_io_base;
16
17extern void pci_setup_pci_controller(struct pci_controller *hose);
18extern void pci_setup_phb_io(struct pci_controller *hose, int primary);
19extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary);
20
21
22extern struct list_head hose_list;
23extern int global_phb_number;
24
25extern unsigned long find_and_init_phbs(void);
26
27extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */
28
29/* PCI device_node operations */
30struct device_node;
31typedef void *(*traverse_func)(struct device_node *me, void *data);
32void *traverse_pci_devices(struct device_node *start, traverse_func pre,
33 void *data);
34
35void pci_devs_phb_init(void);
36void pci_devs_phb_init_dynamic(struct pci_controller *phb);
37
38/* PCI address cache management routines */
39void pci_addr_cache_insert_device(struct pci_dev *dev);
40void pci_addr_cache_remove_device(struct pci_dev *dev);
41
42/* From rtas_pci.h */
43void init_pci_config_tokens (void);
44unsigned long get_phb_buid (struct device_node *);
45
46/* From pSeries_pci.h */
47extern void pSeries_final_fixup(void);
48extern void pSeries_irq_bus_setup(struct pci_bus *bus);
49
50extern unsigned long pci_probe_only;
51extern unsigned long pci_assign_all_buses;
52extern int pci_read_irq_line(struct pci_dev *pci_dev);
53
54#endif /* __PPC_KERNEL_PCI_H__ */
diff --git a/arch/ppc64/kernel/pci_direct_iommu.c b/arch/ppc64/kernel/pci_direct_iommu.c
index b8f7f58824f4..57980a5674d7 100644
--- a/arch/ppc64/kernel/pci_direct_iommu.c
+++ b/arch/ppc64/kernel/pci_direct_iommu.c
@@ -27,8 +27,7 @@
27#include <asm/machdep.h> 27#include <asm/machdep.h>
28#include <asm/pmac_feature.h> 28#include <asm/pmac_feature.h>
29#include <asm/abs_addr.h> 29#include <asm/abs_addr.h>
30 30#include <asm/ppc-pci.h>
31#include "pci.h"
32 31
33static void *pci_direct_alloc_coherent(struct device *hwdev, size_t size, 32static void *pci_direct_alloc_coherent(struct device *hwdev, size_t size,
34 dma_addr_t *dma_handle, unsigned int __nocast flag) 33 dma_addr_t *dma_handle, unsigned int __nocast flag)
diff --git a/arch/ppc64/kernel/pci_dn.c b/arch/ppc64/kernel/pci_dn.c
index a86389d07d57..493bbe43f5b4 100644
--- a/arch/ppc64/kernel/pci_dn.c
+++ b/arch/ppc64/kernel/pci_dn.c
@@ -30,8 +30,7 @@
30#include <asm/prom.h> 30#include <asm/prom.h>
31#include <asm/pci-bridge.h> 31#include <asm/pci-bridge.h>
32#include <asm/pSeries_reconfig.h> 32#include <asm/pSeries_reconfig.h>
33 33#include <asm/ppc-pci.h>
34#include "pci.h"
35 34
36/* 35/*
37 * Traverse_func that inits the PCI fields of the device node. 36 * Traverse_func that inits the PCI fields of the device node.
diff --git a/arch/ppc64/kernel/pci_iommu.c b/arch/ppc64/kernel/pci_iommu.c
index 14647e09c9cd..6c9dc67f59d8 100644
--- a/arch/ppc64/kernel/pci_iommu.c
+++ b/arch/ppc64/kernel/pci_iommu.c
@@ -37,7 +37,7 @@
37#include <asm/iommu.h> 37#include <asm/iommu.h>
38#include <asm/pci-bridge.h> 38#include <asm/pci-bridge.h>
39#include <asm/machdep.h> 39#include <asm/machdep.h>
40#include "pci.h" 40#include <asm/ppc-pci.h>
41 41
42#ifdef CONFIG_PPC_ISERIES 42#ifdef CONFIG_PPC_ISERIES
43#include <asm/iSeries/iSeries_pci.h> 43#include <asm/iSeries/iSeries_pci.h>
@@ -61,13 +61,7 @@ static inline struct iommu_table *devnode_table(struct device *dev)
61 } else 61 } else
62 pdev = to_pci_dev(dev); 62 pdev = to_pci_dev(dev);
63 63
64#ifdef CONFIG_PPC_ISERIES
65 return ISERIES_DEVNODE(pdev)->iommu_table;
66#endif /* CONFIG_PPC_ISERIES */
67
68#ifdef CONFIG_PPC_MULTIPLATFORM
69 return PCI_DN(PCI_GET_DN(pdev))->iommu_table; 64 return PCI_DN(PCI_GET_DN(pdev))->iommu_table;
70#endif /* CONFIG_PPC_MULTIPLATFORM */
71} 65}
72 66
73 67
diff --git a/arch/ppc64/kernel/pmac_pci.c b/arch/ppc64/kernel/pmac_pci.c
index 1f61aa4746ec..f139fc034199 100644
--- a/arch/ppc64/kernel/pmac_pci.c
+++ b/arch/ppc64/kernel/pmac_pci.c
@@ -27,8 +27,8 @@
27#include <asm/machdep.h> 27#include <asm/machdep.h>
28#include <asm/pmac_feature.h> 28#include <asm/pmac_feature.h>
29#include <asm/iommu.h> 29#include <asm/iommu.h>
30#include <asm/ppc-pci.h>
30 31
31#include "pci.h"
32#include "pmac.h" 32#include "pmac.h"
33 33
34#define DEBUG 34#define DEBUG
diff --git a/arch/ppc64/kernel/ppc_ksyms.c b/arch/ppc64/kernel/ppc_ksyms.c
index 705742f4eec6..84006e26342c 100644
--- a/arch/ppc64/kernel/ppc_ksyms.c
+++ b/arch/ppc64/kernel/ppc_ksyms.c
@@ -19,7 +19,6 @@
19#include <asm/hw_irq.h> 19#include <asm/hw_irq.h>
20#include <asm/abs_addr.h> 20#include <asm/abs_addr.h>
21#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
22#include <asm/iSeries/HvCallSc.h>
23 22
24EXPORT_SYMBOL(strcpy); 23EXPORT_SYMBOL(strcpy);
25EXPORT_SYMBOL(strncpy); 24EXPORT_SYMBOL(strncpy);
@@ -46,17 +45,6 @@ EXPORT_SYMBOL(__strnlen_user);
46 45
47EXPORT_SYMBOL(reloc_offset); 46EXPORT_SYMBOL(reloc_offset);
48 47
49#ifdef CONFIG_PPC_ISERIES
50EXPORT_SYMBOL(HvCall0);
51EXPORT_SYMBOL(HvCall1);
52EXPORT_SYMBOL(HvCall2);
53EXPORT_SYMBOL(HvCall3);
54EXPORT_SYMBOL(HvCall4);
55EXPORT_SYMBOL(HvCall5);
56EXPORT_SYMBOL(HvCall6);
57EXPORT_SYMBOL(HvCall7);
58#endif
59
60EXPORT_SYMBOL(_insb); 48EXPORT_SYMBOL(_insb);
61EXPORT_SYMBOL(_outsb); 49EXPORT_SYMBOL(_outsb);
62EXPORT_SYMBOL(_insw); 50EXPORT_SYMBOL(_insw);
@@ -77,14 +65,6 @@ EXPORT_SYMBOL(giveup_altivec);
77EXPORT_SYMBOL(__flush_icache_range); 65EXPORT_SYMBOL(__flush_icache_range);
78EXPORT_SYMBOL(flush_dcache_range); 66EXPORT_SYMBOL(flush_dcache_range);
79 67
80#ifdef CONFIG_SMP
81#ifdef CONFIG_PPC_ISERIES
82EXPORT_SYMBOL(local_get_flags);
83EXPORT_SYMBOL(local_irq_disable);
84EXPORT_SYMBOL(local_irq_restore);
85#endif
86#endif
87
88EXPORT_SYMBOL(memcpy); 68EXPORT_SYMBOL(memcpy);
89EXPORT_SYMBOL(memset); 69EXPORT_SYMBOL(memset);
90EXPORT_SYMBOL(memmove); 70EXPORT_SYMBOL(memmove);
diff --git a/arch/ppc64/kernel/rtas_pci.c b/arch/ppc64/kernel/rtas_pci.c
index 4d920dd41dc6..20361bcd8cfb 100644
--- a/arch/ppc64/kernel/rtas_pci.c
+++ b/arch/ppc64/kernel/rtas_pci.c
@@ -39,8 +39,7 @@
39#include <asm/iommu.h> 39#include <asm/iommu.h>
40#include <asm/rtas.h> 40#include <asm/rtas.h>
41#include <asm/mpic.h> 41#include <asm/mpic.h>
42 42#include <asm/ppc-pci.h>
43#include "pci.h"
44 43
45/* RTAS tokens */ 44/* RTAS tokens */
46static int read_pci_config; 45static int read_pci_config;
diff --git a/arch/ppc64/kernel/rtc.c b/arch/ppc64/kernel/rtc.c
index 6ff52bc61325..88ae13f81c46 100644
--- a/arch/ppc64/kernel/rtc.c
+++ b/arch/ppc64/kernel/rtc.c
@@ -43,11 +43,8 @@
43#include <asm/time.h> 43#include <asm/time.h>
44#include <asm/rtas.h> 44#include <asm/rtas.h>
45 45
46#include <asm/iSeries/mf.h>
47#include <asm/machdep.h> 46#include <asm/machdep.h>
48 47
49extern int piranha_simulator;
50
51/* 48/*
52 * We sponge a minor off of the misc major. No need slurping 49 * We sponge a minor off of the misc major. No need slurping
53 * up another valuable major dev number for this. If you add 50 * up another valuable major dev number for this. If you add
@@ -265,40 +262,6 @@ static int rtc_read_proc(char *page, char **start, off_t off,
265 return len; 262 return len;
266} 263}
267 264
268#ifdef CONFIG_PPC_ISERIES
269/*
270 * Get the RTC from the virtual service processor
271 * This requires flowing LpEvents to the primary partition
272 */
273void iSeries_get_rtc_time(struct rtc_time *rtc_tm)
274{
275 if (piranha_simulator)
276 return;
277
278 mf_get_rtc(rtc_tm);
279 rtc_tm->tm_mon--;
280}
281
282/*
283 * Set the RTC in the virtual service processor
284 * This requires flowing LpEvents to the primary partition
285 */
286int iSeries_set_rtc_time(struct rtc_time *tm)
287{
288 mf_set_rtc(tm);
289 return 0;
290}
291
292void iSeries_get_boot_time(struct rtc_time *tm)
293{
294 if ( piranha_simulator )
295 return;
296
297 mf_get_boot_rtc(tm);
298 tm->tm_mon -= 1;
299}
300#endif
301
302#ifdef CONFIG_PPC_RTAS 265#ifdef CONFIG_PPC_RTAS
303#define MAX_RTC_WAIT 5000 /* 5 sec */ 266#define MAX_RTC_WAIT 5000 /* 5 sec */
304#define RTAS_CLOCK_BUSY (-2) 267#define RTAS_CLOCK_BUSY (-2)
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index e93c13458910..1cacf61f9c91 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -53,8 +53,7 @@
53#include <asm/time.h> 53#include <asm/time.h>
54#include <asm/mmu_context.h> 54#include <asm/mmu_context.h>
55#include <asm/systemcfg.h> 55#include <asm/systemcfg.h>
56 56#include <asm/ppc-pci.h>
57#include "pci.h"
58 57
59/* readdir & getdents */ 58/* readdir & getdents */
60#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) 59#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
diff --git a/arch/ppc64/kernel/u3_iommu.c b/arch/ppc64/kernel/u3_iommu.c
index df9c775f4955..fba871a1bda5 100644
--- a/arch/ppc64/kernel/u3_iommu.c
+++ b/arch/ppc64/kernel/u3_iommu.c
@@ -45,8 +45,7 @@
45#include <asm/cacheflush.h> 45#include <asm/cacheflush.h>
46#include <asm/lmb.h> 46#include <asm/lmb.h>
47#include <asm/dart.h> 47#include <asm/dart.h>
48 48#include <asm/ppc-pci.h>
49#include "pci.h"
50 49
51extern int iommu_force_on; 50extern int iommu_force_on;
52 51