aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-09-27 12:18:47 -0400
committerStephen Rothwell <sfr@canb.auug.org.au>2005-09-27 12:18:47 -0400
commit544cbbaed4de962fb0e831e8799ab01c448ff37d (patch)
tree3f03ca171a9f8c2e80bdca050d8714994cd6de9f /arch
parent99a2379cdddcc4e8579e70deb80479450ed65d49 (diff)
powerpc: Merge HvLpEvent.c into lpevents.c
These two files were intimately connected, so just merge them. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c68
-rw-r--r--arch/ppc64/kernel/HvLpEvent.c88
-rw-r--r--arch/ppc64/kernel/Makefile2
3 files changed, 68 insertions, 90 deletions
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index 819298a8a4db..883603027ccf 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -18,6 +18,7 @@
18#include <asm/iSeries/ItLpQueue.h> 18#include <asm/iSeries/ItLpQueue.h>
19#include <asm/iSeries/HvLpEvent.h> 19#include <asm/iSeries/HvLpEvent.h>
20#include <asm/iSeries/HvCallEvent.h> 20#include <asm/iSeries/HvCallEvent.h>
21#include <asm/iSeries/ItLpNaca.h>
21 22
22/* 23/*
23 * 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
@@ -42,7 +43,8 @@ static char *event_types[HvLpEvent_Type_NumTypes] = {
42}; 43};
43 44
44/* Array of LpEvent handler functions */ 45/* Array of LpEvent handler functions */
45extern LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes]; 46static LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes];
47static unsigned lpEventHandlerPaths[HvLpEvent_Type_NumTypes];
46 48
47static struct HvLpEvent * get_next_hvlpevent(void) 49static struct HvLpEvent * get_next_hvlpevent(void)
48{ 50{
@@ -198,6 +200,70 @@ void setup_hvlpevent_queue(void)
198 hvlpevent_queue.xIndex = 0; 200 hvlpevent_queue.xIndex = 0;
199} 201}
200 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
201static int proc_lpevents_show(struct seq_file *m, void *v) 267static int proc_lpevents_show(struct seq_file *m, void *v)
202{ 268{
203 int cpu, i; 269 int cpu, i;
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 f84ae358db0a..a4e5c5b86c74 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -22,7 +22,7 @@ pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o
22 22
23obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y) 23obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y)
24 24
25obj-$(CONFIG_PPC_ISERIES) += HvLpEvent.o iSeries_proc.o iSeries_htab.o \ 25obj-$(CONFIG_PPC_ISERIES) += iSeries_proc.o iSeries_htab.o \
26 iSeries_iommu.o 26 iSeries_iommu.o
27 27
28obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o 28obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o