aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/XmPciLpEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64/kernel/XmPciLpEvent.c')
-rw-r--r--arch/ppc64/kernel/XmPciLpEvent.c105
1 files changed, 49 insertions, 56 deletions
diff --git a/arch/ppc64/kernel/XmPciLpEvent.c b/arch/ppc64/kernel/XmPciLpEvent.c
index 809c9bc6678b..3db530744831 100644
--- a/arch/ppc64/kernel/XmPciLpEvent.c
+++ b/arch/ppc64/kernel/XmPciLpEvent.c
@@ -1,9 +1,8 @@
1/* 1/*
2 * File XmPciLpEvent.h created by Wayne Holm on Mon Jan 15 2001. 2 * File XmPciLpEvent.c created by Wayne Holm on Mon Jan 15 2001.
3 * 3 *
4 * This module handles PCI interrupt events sent by the iSeries Hypervisor. 4 * This module handles PCI interrupt events sent by the iSeries Hypervisor.
5*/ 5 */
6
7#include <linux/config.h> 6#include <linux/config.h>
8#include <linux/pci.h> 7#include <linux/pci.h>
9#include <linux/init.h> 8#include <linux/init.h>
@@ -17,22 +16,22 @@
17#include <asm/iSeries/HvTypes.h> 16#include <asm/iSeries/HvTypes.h>
18#include <asm/iSeries/HvLpEvent.h> 17#include <asm/iSeries/HvLpEvent.h>
19#include <asm/iSeries/HvCallPci.h> 18#include <asm/iSeries/HvCallPci.h>
20#include <asm/iSeries/XmPciLpEvent.h> 19#include <asm/iSeries/iSeries_irq.h>
21#include <asm/ppcdebug.h> 20#include <asm/ppcdebug.h>
22 21
23static long Pci_Interrupt_Count; 22static long Pci_Interrupt_Count;
24static long Pci_Event_Count; 23static long Pci_Event_Count;
25 24
26enum XmPciLpEvent_Subtype { 25enum XmPciLpEvent_Subtype {
27 XmPciLpEvent_BusCreated = 0, // PHB has been created 26 XmPciLpEvent_BusCreated = 0, // PHB has been created
28 XmPciLpEvent_BusError = 1, // PHB has failed 27 XmPciLpEvent_BusError = 1, // PHB has failed
29 XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus 28 XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus
30 XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed 29 XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed
31 XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered 30 XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered
32 XmPciLpEvent_BusRecovered = 12, // PHB has been recovered 31 XmPciLpEvent_BusRecovered = 12, // PHB has been recovered
33 XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing 32 XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing
34 XmPciLpEvent_BridgeError = 21, // Bridge Error 33 XmPciLpEvent_BridgeError = 21, // Bridge Error
35 XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt 34 XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt
36}; 35};
37 36
38struct XmPciLpEvent_BusInterrupt { 37struct XmPciLpEvent_BusInterrupt {
@@ -71,43 +70,6 @@ struct XmPciLpEvent {
71}; 70};
72 71
73static void intReceived(struct XmPciLpEvent *eventParm, 72static void intReceived(struct XmPciLpEvent *eventParm,
74 struct pt_regs *regsParm);
75
76static void XmPciLpEvent_handler(struct HvLpEvent *eventParm,
77 struct pt_regs *regsParm)
78{
79#ifdef CONFIG_PCI
80#if 0
81 PPCDBG(PPCDBG_BUSWALK, "XmPciLpEvent_handler, type 0x%x\n",
82 eventParm->xType);
83#endif
84 ++Pci_Event_Count;
85
86 if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) {
87 switch (eventParm->xFlags.xFunction) {
88 case HvLpEvent_Function_Int:
89 intReceived((struct XmPciLpEvent *)eventParm, regsParm);
90 break;
91 case HvLpEvent_Function_Ack:
92 printk(KERN_ERR
93 "XmPciLpEvent.c: unexpected ack received\n");
94 break;
95 default:
96 printk(KERN_ERR
97 "XmPciLpEvent.c: unexpected event function %d\n",
98 (int)eventParm->xFlags.xFunction);
99 break;
100 }
101 } else if (eventParm)
102 printk(KERN_ERR
103 "XmPciLpEvent.c: Unrecognized PCI event type 0x%x\n",
104 (int)eventParm->xType);
105 else
106 printk(KERN_ERR "XmPciLpEvent.c: NULL event received\n");
107#endif
108}
109
110static void intReceived(struct XmPciLpEvent *eventParm,
111 struct pt_regs *regsParm) 73 struct pt_regs *regsParm)
112{ 74{
113 int irq; 75 int irq;
@@ -164,6 +126,39 @@ static void intReceived(struct XmPciLpEvent *eventParm,
164 } 126 }
165} 127}
166 128
129static void XmPciLpEvent_handler(struct HvLpEvent *eventParm,
130 struct pt_regs *regsParm)
131{
132#ifdef CONFIG_PCI
133#if 0
134 PPCDBG(PPCDBG_BUSWALK, "XmPciLpEvent_handler, type 0x%x\n",
135 eventParm->xType);
136#endif
137 ++Pci_Event_Count;
138
139 if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) {
140 switch (eventParm->xFlags.xFunction) {
141 case HvLpEvent_Function_Int:
142 intReceived((struct XmPciLpEvent *)eventParm, regsParm);
143 break;
144 case HvLpEvent_Function_Ack:
145 printk(KERN_ERR
146 "XmPciLpEvent.c: unexpected ack received\n");
147 break;
148 default:
149 printk(KERN_ERR
150 "XmPciLpEvent.c: unexpected event function %d\n",
151 (int)eventParm->xFlags.xFunction);
152 break;
153 }
154 } else if (eventParm)
155 printk(KERN_ERR
156 "XmPciLpEvent.c: Unrecognized PCI event type 0x%x\n",
157 (int)eventParm->xType);
158 else
159 printk(KERN_ERR "XmPciLpEvent.c: NULL event received\n");
160#endif
161}
167 162
168/* This should be called sometime prior to buswalk (init_IRQ would be good) */ 163/* This should be called sometime prior to buswalk (init_IRQ would be good) */
169int XmPciLpEvent_init() 164int XmPciLpEvent_init()
@@ -179,12 +174,10 @@ int XmPciLpEvent_init()
179 if (xRc == 0) { 174 if (xRc == 0) {
180 xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0); 175 xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
181 if (xRc != 0) 176 if (xRc != 0)
182 printk(KERN_ERR 177 printk(KERN_ERR "XmPciLpEvent.c: open event path "
183 "XmPciLpEvent.c: open event path failed with rc 0x%x\n", 178 "failed with rc 0x%x\n", xRc);
184 xRc);
185 } else 179 } else
186 printk(KERN_ERR 180 printk(KERN_ERR "XmPciLpEvent.c: register handler "
187 "XmPciLpEvent.c: register handler failed with rc 0x%x\n", 181 "failed with rc 0x%x\n", xRc);
188 xRc);
189 return xRc; 182 return xRc;
190} 183}