diff options
Diffstat (limited to 'drivers/staging/hv')
-rw-r--r-- | drivers/staging/hv/Vmbus.c | 415 |
1 files changed, 109 insertions, 306 deletions
diff --git a/drivers/staging/hv/Vmbus.c b/drivers/staging/hv/Vmbus.c index 5c4c96f649a..0377155a0fd 100644 --- a/drivers/staging/hv/Vmbus.c +++ b/drivers/staging/hv/Vmbus.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2009, Microsoft Corporation. | 2 | * Copyright (c) 2009, Microsoft Corporation. |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
@@ -20,7 +19,6 @@ | |||
20 | * Hank Janssen <hjanssen@microsoft.com> | 19 | * Hank Janssen <hjanssen@microsoft.com> |
21 | * | 20 | * |
22 | */ | 21 | */ |
23 | |||
24 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
25 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
26 | #include "osd.h" | 24 | #include "osd.h" |
@@ -28,12 +26,10 @@ | |||
28 | #include "VersionInfo.h" | 26 | #include "VersionInfo.h" |
29 | #include "VmbusPrivate.h" | 27 | #include "VmbusPrivate.h" |
30 | 28 | ||
29 | static const char *gDriverName = "vmbus"; | ||
31 | 30 | ||
32 | /* Globals */ | 31 | /* |
33 | 32 | * Windows vmbus does not defined this. | |
34 | static const char* gDriverName="vmbus"; | ||
35 | |||
36 | /* Windows vmbus does not defined this. | ||
37 | * We defined this to be consistent with other devices | 33 | * We defined this to be consistent with other devices |
38 | */ | 34 | */ |
39 | /* {c5295816-f63a-4d5f-8d1a-4daf999ca185} */ | 35 | /* {c5295816-f63a-4d5f-8d1a-4daf999ca185} */ |
@@ -53,106 +49,61 @@ static const struct hv_guid gVmbusDeviceId = { | |||
53 | }; | 49 | }; |
54 | 50 | ||
55 | static struct hv_driver *gDriver; /* vmbus driver object */ | 51 | static struct hv_driver *gDriver; /* vmbus driver object */ |
56 | static struct hv_device* gDevice; /* vmbus root device */ | 52 | static struct hv_device *gDevice; /* vmbus root device */ |
57 | |||
58 | |||
59 | |||
60 | /* Internal routines */ | ||
61 | |||
62 | 53 | ||
63 | static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface); | 54 | static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface); |
64 | 55 | static void VmbusGetChannelInfo(struct hv_device *DeviceObject, | |
65 | static void | 56 | struct hv_device_info *DeviceInfo); |
66 | VmbusGetChannelInfo( | 57 | static void VmbusGetChannelOffers(void); |
67 | struct hv_device *DeviceObject, | 58 | static int VmbusOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo); |
68 | struct hv_device_info *DeviceInfo | 59 | static int VmbusOnDeviceRemove(struct hv_device *dev); |
69 | ); | 60 | static void VmbusOnCleanup(struct hv_driver *drv); |
70 | 61 | static int VmbusOnISR(struct hv_driver *drv); | |
71 | static void | 62 | static void VmbusOnMsgDPC(struct hv_driver *drv); |
72 | VmbusGetChannelOffers( | 63 | static void VmbusOnEventDPC(struct hv_driver *drv); |
73 | void | 64 | |
74 | ); | 65 | /** |
75 | 66 | * VmbusInitialize - Main entry point | |
76 | static int | 67 | */ |
77 | VmbusOnDeviceAdd( | 68 | int VmbusInitialize(struct hv_driver *drv) |
78 | struct hv_device *Device, | ||
79 | void *AdditionalInfo | ||
80 | ); | ||
81 | |||
82 | static int | ||
83 | VmbusOnDeviceRemove( | ||
84 | struct hv_device *dev | ||
85 | ); | ||
86 | |||
87 | static void | ||
88 | VmbusOnCleanup( | ||
89 | struct hv_driver *drv | ||
90 | ); | ||
91 | |||
92 | static int | ||
93 | VmbusOnISR( | ||
94 | struct hv_driver *drv | ||
95 | ); | ||
96 | |||
97 | static void | ||
98 | VmbusOnMsgDPC( | ||
99 | struct hv_driver *drv | ||
100 | ); | ||
101 | |||
102 | static void | ||
103 | VmbusOnEventDPC( | ||
104 | struct hv_driver *drv | ||
105 | ); | ||
106 | |||
107 | /*++; | ||
108 | |||
109 | Name: | ||
110 | VmbusInitialize() | ||
111 | |||
112 | Description: | ||
113 | Main entry point | ||
114 | |||
115 | --*/ | ||
116 | int | ||
117 | VmbusInitialize( | ||
118 | struct hv_driver *drv | ||
119 | ) | ||
120 | { | 69 | { |
121 | struct vmbus_driver *driver = (struct vmbus_driver *)drv; | 70 | struct vmbus_driver *driver = (struct vmbus_driver *)drv; |
122 | int ret=0; | 71 | int ret; |
123 | 72 | ||
124 | DPRINT_ENTER(VMBUS); | 73 | DPRINT_ENTER(VMBUS); |
125 | 74 | ||
126 | DPRINT_INFO(VMBUS, "+++++++ Build Date=%s %s +++++++", VersionDate, VersionTime); | 75 | DPRINT_INFO(VMBUS, "+++++++ Build Date=%s %s +++++++", |
127 | DPRINT_INFO(VMBUS, "+++++++ Build Description=%s +++++++", VersionDesc); | 76 | VersionDate, VersionTime); |
128 | 77 | DPRINT_INFO(VMBUS, "+++++++ Build Description=%s +++++++", | |
129 | DPRINT_INFO(VMBUS, "+++++++ Vmbus supported version = %d +++++++", VMBUS_REVISION_NUMBER); | 78 | VersionDesc); |
130 | DPRINT_INFO(VMBUS, "+++++++ Vmbus using SINT %d +++++++", VMBUS_MESSAGE_SINT); | 79 | DPRINT_INFO(VMBUS, "+++++++ Vmbus supported version = %d +++++++", |
131 | 80 | VMBUS_REVISION_NUMBER); | |
132 | DPRINT_DBG(VMBUS, "sizeof(VMBUS_CHANNEL_PACKET_PAGE_BUFFER)=%zd, sizeof(VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER)=%zd", | 81 | DPRINT_INFO(VMBUS, "+++++++ Vmbus using SINT %d +++++++", |
133 | sizeof(struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER), sizeof(struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER)); | 82 | VMBUS_MESSAGE_SINT); |
83 | DPRINT_DBG(VMBUS, "sizeof(VMBUS_CHANNEL_PACKET_PAGE_BUFFER)=%zd, " | ||
84 | "sizeof(VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER)=%zd", | ||
85 | sizeof(struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER), | ||
86 | sizeof(struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER)); | ||
134 | 87 | ||
135 | drv->name = gDriverName; | 88 | drv->name = gDriverName; |
136 | memcpy(&drv->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); | 89 | memcpy(&drv->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); |
137 | 90 | ||
138 | /* Setup dispatch table */ | 91 | /* Setup dispatch table */ |
139 | driver->Base.OnDeviceAdd = VmbusOnDeviceAdd; | 92 | driver->Base.OnDeviceAdd = VmbusOnDeviceAdd; |
140 | driver->Base.OnDeviceRemove = VmbusOnDeviceRemove; | 93 | driver->Base.OnDeviceRemove = VmbusOnDeviceRemove; |
141 | driver->Base.OnCleanup = VmbusOnCleanup; | 94 | driver->Base.OnCleanup = VmbusOnCleanup; |
142 | driver->OnIsr = VmbusOnISR; | 95 | driver->OnIsr = VmbusOnISR; |
143 | driver->OnMsgDpc = VmbusOnMsgDPC; | 96 | driver->OnMsgDpc = VmbusOnMsgDPC; |
144 | driver->OnEventDpc = VmbusOnEventDPC; | 97 | driver->OnEventDpc = VmbusOnEventDPC; |
145 | driver->GetChannelOffers = VmbusGetChannelOffers; | 98 | driver->GetChannelOffers = VmbusGetChannelOffers; |
146 | driver->GetChannelInterface = VmbusGetChannelInterface; | 99 | driver->GetChannelInterface = VmbusGetChannelInterface; |
147 | driver->GetChannelInfo = VmbusGetChannelInfo; | 100 | driver->GetChannelInfo = VmbusGetChannelInfo; |
148 | 101 | ||
149 | /* Hypervisor initialization...setup hypercall page..etc */ | 102 | /* Hypervisor initialization...setup hypercall page..etc */ |
150 | ret = HvInit(); | 103 | ret = HvInit(); |
151 | if (ret != 0) | 104 | if (ret != 0) |
152 | { | 105 | DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x", |
153 | DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x", ret); | 106 | ret); |
154 | } | ||
155 | |||
156 | gDriver = drv; | 107 | gDriver = drv; |
157 | 108 | ||
158 | DPRINT_EXIT(VMBUS); | 109 | DPRINT_EXIT(VMBUS); |
@@ -160,93 +111,49 @@ VmbusInitialize( | |||
160 | return ret; | 111 | return ret; |
161 | } | 112 | } |
162 | 113 | ||
163 | 114 | /** | |
164 | /*++; | 115 | * VmbusGetChannelOffers - Retrieve the channel offers from the parent partition |
165 | 116 | */ | |
166 | Name: | 117 | static void VmbusGetChannelOffers(void) |
167 | VmbusGetChannelOffers() | ||
168 | |||
169 | Description: | ||
170 | Retrieve the channel offers from the parent partition | ||
171 | |||
172 | --*/ | ||
173 | |||
174 | static void | ||
175 | VmbusGetChannelOffers(void) | ||
176 | { | 118 | { |
177 | DPRINT_ENTER(VMBUS); | 119 | DPRINT_ENTER(VMBUS); |
178 | VmbusChannelRequestOffers(); | 120 | VmbusChannelRequestOffers(); |
179 | DPRINT_EXIT(VMBUS); | 121 | DPRINT_EXIT(VMBUS); |
180 | } | 122 | } |
181 | 123 | ||
182 | 124 | /** | |
183 | /*++; | 125 | * VmbusGetChannelInterface - Get the channel interface |
184 | 126 | */ | |
185 | Name: | ||
186 | VmbusGetChannelInterface() | ||
187 | |||
188 | Description: | ||
189 | Get the channel interface | ||
190 | |||
191 | --*/ | ||
192 | static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface) | 127 | static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface) |
193 | { | 128 | { |
194 | GetChannelInterface(Interface); | 129 | GetChannelInterface(Interface); |
195 | } | 130 | } |
196 | 131 | ||
197 | 132 | /** | |
198 | /*++; | 133 | * VmbusGetChannelInfo - Get the device info for the specified device object |
199 | 134 | */ | |
200 | Name: | 135 | static void VmbusGetChannelInfo(struct hv_device *DeviceObject, |
201 | VmbusGetChannelInfo() | 136 | struct hv_device_info *DeviceInfo) |
202 | |||
203 | Description: | ||
204 | Get the device info for the specified device object | ||
205 | |||
206 | --*/ | ||
207 | static void | ||
208 | VmbusGetChannelInfo( | ||
209 | struct hv_device *DeviceObject, | ||
210 | struct hv_device_info *DeviceInfo | ||
211 | ) | ||
212 | { | 137 | { |
213 | GetChannelInfo(DeviceObject, DeviceInfo); | 138 | GetChannelInfo(DeviceObject, DeviceInfo); |
214 | } | 139 | } |
215 | 140 | ||
216 | 141 | /** | |
217 | 142 | * VmbusCreateChildDevice - Creates the child device on the bus that represents the channel offer | |
218 | /*++ | 143 | */ |
219 | |||
220 | Name: | ||
221 | VmbusCreateChildDevice() | ||
222 | |||
223 | Description: | ||
224 | Creates the child device on the bus that represents the channel offer | ||
225 | |||
226 | --*/ | ||
227 | |||
228 | struct hv_device *VmbusChildDeviceCreate(struct hv_guid *DeviceType, | 144 | struct hv_device *VmbusChildDeviceCreate(struct hv_guid *DeviceType, |
229 | struct hv_guid *DeviceInstance, | 145 | struct hv_guid *DeviceInstance, |
230 | void *Context) | 146 | void *Context) |
231 | { | 147 | { |
232 | struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver; | 148 | struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver; |
233 | 149 | ||
234 | return vmbusDriver->OnChildDeviceCreate( | 150 | return vmbusDriver->OnChildDeviceCreate(DeviceType, DeviceInstance, |
235 | DeviceType, | 151 | Context); |
236 | DeviceInstance, | ||
237 | Context); | ||
238 | } | 152 | } |
239 | 153 | ||
240 | 154 | /** | |
241 | /*++ | 155 | * VmbusChildDeviceAdd - Registers the child device with the vmbus |
242 | 156 | */ | |
243 | Name: | ||
244 | VmbusChildDeviceAdd() | ||
245 | |||
246 | Description: | ||
247 | Registers the child device with the vmbus | ||
248 | |||
249 | --*/ | ||
250 | int VmbusChildDeviceAdd(struct hv_device *ChildDevice) | 157 | int VmbusChildDeviceAdd(struct hv_device *ChildDevice) |
251 | { | 158 | { |
252 | struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver; | 159 | struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver; |
@@ -254,16 +161,9 @@ int VmbusChildDeviceAdd(struct hv_device *ChildDevice) | |||
254 | return vmbusDriver->OnChildDeviceAdd(gDevice, ChildDevice); | 161 | return vmbusDriver->OnChildDeviceAdd(gDevice, ChildDevice); |
255 | } | 162 | } |
256 | 163 | ||
257 | 164 | /** | |
258 | /*++ | 165 | * VmbusChildDeviceRemove Unregisters the child device from the vmbus |
259 | 166 | */ | |
260 | Name: | ||
261 | VmbusChildDeviceRemove() | ||
262 | |||
263 | Description: | ||
264 | Unregisters the child device from the vmbus | ||
265 | |||
266 | --*/ | ||
267 | void VmbusChildDeviceRemove(struct hv_device *ChildDevice) | 167 | void VmbusChildDeviceRemove(struct hv_device *ChildDevice) |
268 | { | 168 | { |
269 | struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver; | 169 | struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver; |
@@ -271,52 +171,21 @@ void VmbusChildDeviceRemove(struct hv_device *ChildDevice) | |||
271 | vmbusDriver->OnChildDeviceRemove(ChildDevice); | 171 | vmbusDriver->OnChildDeviceRemove(ChildDevice); |
272 | } | 172 | } |
273 | 173 | ||
274 | /*++ | 174 | /** |
275 | 175 | * VmbusOnDeviceAdd - Callback when the root bus device is added | |
276 | Name: | 176 | */ |
277 | VmbusChildDeviceDestroy() | 177 | static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo) |
278 | |||
279 | Description: | ||
280 | Release the child device from the vmbus | ||
281 | |||
282 | --*/ | ||
283 | |||
284 | /* ************** | ||
285 | void | ||
286 | VmbusChildDeviceDestroy( | ||
287 | struct hv_device *ChildDevice | ||
288 | ) | ||
289 | { | ||
290 | struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver; | ||
291 | |||
292 | vmbusDriver->OnChildDeviceDestroy(ChildDevice); | ||
293 | } | ||
294 | ************* */ | ||
295 | |||
296 | /*++ | ||
297 | |||
298 | Name: | ||
299 | VmbusOnDeviceAdd() | ||
300 | |||
301 | Description: | ||
302 | Callback when the root bus device is added | ||
303 | |||
304 | --*/ | ||
305 | static int | ||
306 | VmbusOnDeviceAdd( | ||
307 | struct hv_device *dev, | ||
308 | void *AdditionalInfo | ||
309 | ) | ||
310 | { | 178 | { |
311 | u32 *irqvector = (u32*) AdditionalInfo; | 179 | u32 *irqvector = AdditionalInfo; |
312 | int ret=0; | 180 | int ret; |
313 | 181 | ||
314 | DPRINT_ENTER(VMBUS); | 182 | DPRINT_ENTER(VMBUS); |
315 | 183 | ||
316 | gDevice = dev; | 184 | gDevice = dev; |
317 | 185 | ||
318 | memcpy(&gDevice->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); | 186 | memcpy(&gDevice->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); |
319 | memcpy(&gDevice->deviceInstance, &gVmbusDeviceId, sizeof(struct hv_guid)); | 187 | memcpy(&gDevice->deviceInstance, &gVmbusDeviceId, |
188 | sizeof(struct hv_guid)); | ||
320 | 189 | ||
321 | /* strcpy(dev->name, "vmbus"); */ | 190 | /* strcpy(dev->name, "vmbus"); */ |
322 | /* SynIC setup... */ | 191 | /* SynIC setup... */ |
@@ -331,91 +200,52 @@ VmbusOnDeviceAdd( | |||
331 | return ret; | 200 | return ret; |
332 | } | 201 | } |
333 | 202 | ||
334 | 203 | /** | |
335 | /*++ | 204 | * VmbusOnDeviceRemove - Callback when the root bus device is removed |
336 | 205 | */ | |
337 | Name: | 206 | static int VmbusOnDeviceRemove(struct hv_device *dev) |
338 | VmbusOnDeviceRemove() | ||
339 | |||
340 | Description: | ||
341 | Callback when the root bus device is removed | ||
342 | |||
343 | --*/ | ||
344 | static int VmbusOnDeviceRemove( | ||
345 | struct hv_device *dev | ||
346 | ) | ||
347 | { | 207 | { |
348 | int ret=0; | 208 | int ret = 0; |
349 | 209 | ||
350 | DPRINT_ENTER(VMBUS); | 210 | DPRINT_ENTER(VMBUS); |
351 | |||
352 | VmbusChannelReleaseUnattachedChannels(); | 211 | VmbusChannelReleaseUnattachedChannels(); |
353 | |||
354 | VmbusDisconnect(); | 212 | VmbusDisconnect(); |
355 | |||
356 | HvSynicCleanup(); | 213 | HvSynicCleanup(); |
357 | |||
358 | DPRINT_EXIT(VMBUS); | 214 | DPRINT_EXIT(VMBUS); |
359 | 215 | ||
360 | return ret; | 216 | return ret; |
361 | } | 217 | } |
362 | 218 | ||
363 | 219 | /** | |
364 | /*++ | 220 | * VmbusOnCleanup - Perform any cleanup when the driver is removed |
365 | 221 | */ | |
366 | Name: | 222 | static void VmbusOnCleanup(struct hv_driver *drv) |
367 | VmbusOnCleanup() | ||
368 | |||
369 | Description: | ||
370 | Perform any cleanup when the driver is removed | ||
371 | |||
372 | --*/ | ||
373 | static void | ||
374 | VmbusOnCleanup( | ||
375 | struct hv_driver *drv | ||
376 | ) | ||
377 | { | 223 | { |
378 | /* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */ | 224 | /* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */ |
379 | 225 | ||
380 | DPRINT_ENTER(VMBUS); | 226 | DPRINT_ENTER(VMBUS); |
381 | |||
382 | HvCleanup(); | 227 | HvCleanup(); |
383 | |||
384 | DPRINT_EXIT(VMBUS); | 228 | DPRINT_EXIT(VMBUS); |
385 | } | 229 | } |
386 | 230 | ||
387 | 231 | /** | |
388 | /*++ | 232 | * VmbusOnMsgDPC - DPC routine to handle messages from the hypervisior |
389 | 233 | */ | |
390 | Name: | 234 | static void VmbusOnMsgDPC(struct hv_driver *drv) |
391 | VmbusOnMsgDPC() | ||
392 | |||
393 | Description: | ||
394 | DPC routine to handle messages from the hypervisior | ||
395 | |||
396 | --*/ | ||
397 | static void | ||
398 | VmbusOnMsgDPC( | ||
399 | struct hv_driver *drv | ||
400 | ) | ||
401 | { | 235 | { |
402 | void *page_addr = gHvContext.synICMessagePage[0]; | 236 | void *page_addr = gHvContext.synICMessagePage[0]; |
403 | 237 | struct hv_message *msg = (struct hv_message *)page_addr + | |
404 | struct hv_message *msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; | 238 | VMBUS_MESSAGE_SINT; |
405 | struct hv_message *copied; | 239 | struct hv_message *copied; |
406 | while (1) | 240 | |
407 | { | 241 | while (1) { |
408 | if (msg->Header.MessageType == HvMessageTypeNone) /* no msg */ | 242 | if (msg->Header.MessageType == HvMessageTypeNone) { |
409 | { | 243 | /* no msg */ |
410 | break; | 244 | break; |
411 | } | 245 | } else { |
412 | else | ||
413 | { | ||
414 | copied = kmalloc(sizeof(*copied), GFP_ATOMIC); | 246 | copied = kmalloc(sizeof(*copied), GFP_ATOMIC); |
415 | if (copied == NULL) | 247 | if (copied == NULL) |
416 | { | ||
417 | continue; | 248 | continue; |
418 | } | ||
419 | 249 | ||
420 | memcpy(copied, msg, sizeof(*copied)); | 250 | memcpy(copied, msg, sizeof(*copied)); |
421 | osd_schedule_callback(gVmbusConnection.WorkQueue, | 251 | osd_schedule_callback(gVmbusConnection.WorkQueue, |
@@ -434,8 +264,7 @@ VmbusOnMsgDPC( | |||
434 | */ | 264 | */ |
435 | mb(); | 265 | mb(); |
436 | 266 | ||
437 | if (msg->Header.MessageFlags.MessagePending) | 267 | if (msg->Header.MessageFlags.MessagePending) { |
438 | { | ||
439 | /* | 268 | /* |
440 | * This will cause message queue rescan to | 269 | * This will cause message queue rescan to |
441 | * possibly deliver another msg from the | 270 | * possibly deliver another msg from the |
@@ -446,68 +275,44 @@ VmbusOnMsgDPC( | |||
446 | } | 275 | } |
447 | } | 276 | } |
448 | 277 | ||
449 | /*++ | 278 | /** |
450 | 279 | * VmbusOnEventDPC - DPC routine to handle events from the hypervisior | |
451 | Name: | 280 | */ |
452 | VmbusOnEventDPC() | 281 | static void VmbusOnEventDPC(struct hv_driver *drv) |
453 | |||
454 | Description: | ||
455 | DPC routine to handle events from the hypervisior | ||
456 | |||
457 | --*/ | ||
458 | static void | ||
459 | VmbusOnEventDPC( | ||
460 | struct hv_driver* drv | ||
461 | ) | ||
462 | { | 282 | { |
463 | /* TODO: Process any events */ | 283 | /* TODO: Process any events */ |
464 | VmbusOnEvents(); | 284 | VmbusOnEvents(); |
465 | } | 285 | } |
466 | 286 | ||
467 | 287 | /** | |
468 | /*++ | 288 | * VmbusOnISR - ISR routine |
469 | 289 | */ | |
470 | Name: | 290 | static int VmbusOnISR(struct hv_driver *drv) |
471 | VmbusOnISR() | ||
472 | |||
473 | Description: | ||
474 | ISR routine | ||
475 | |||
476 | --*/ | ||
477 | static int | ||
478 | VmbusOnISR( | ||
479 | struct hv_driver *drv | ||
480 | ) | ||
481 | { | 291 | { |
482 | /* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */ | 292 | int ret = 0; |
483 | |||
484 | int ret=0; | ||
485 | /* struct page* page; */ | ||
486 | void *page_addr; | 293 | void *page_addr; |
487 | struct hv_message *msg; | 294 | struct hv_message *msg; |
488 | union hv_synic_event_flags *event; | 295 | union hv_synic_event_flags *event; |
489 | 296 | ||
490 | /* page = SynICMessagePage[0]; */ | ||
491 | /* page_addr = page_address(page); */ | ||
492 | page_addr = gHvContext.synICMessagePage[0]; | 297 | page_addr = gHvContext.synICMessagePage[0]; |
493 | msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; | 298 | msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; |
494 | 299 | ||
495 | DPRINT_ENTER(VMBUS); | 300 | DPRINT_ENTER(VMBUS); |
496 | 301 | ||
497 | /* Check if there are actual msgs to be process */ | 302 | /* Check if there are actual msgs to be process */ |
498 | if (msg->Header.MessageType != HvMessageTypeNone) | 303 | if (msg->Header.MessageType != HvMessageTypeNone) { |
499 | { | 304 | DPRINT_DBG(VMBUS, "received msg type %d size %d", |
500 | DPRINT_DBG(VMBUS, "received msg type %d size %d", msg->Header.MessageType, msg->Header.PayloadSize); | 305 | msg->Header.MessageType, |
306 | msg->Header.PayloadSize); | ||
501 | ret |= 0x1; | 307 | ret |= 0x1; |
502 | } | 308 | } |
503 | 309 | ||
504 | /* TODO: Check if there are events to be process */ | 310 | /* TODO: Check if there are events to be process */ |
505 | page_addr = gHvContext.synICEventPage[0]; | 311 | page_addr = gHvContext.synICEventPage[0]; |
506 | event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; | 312 | event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; |
507 | 313 | ||
508 | /* Since we are a child, we only need to check bit 0 */ | 314 | /* Since we are a child, we only need to check bit 0 */ |
509 | if (test_and_clear_bit(0, (unsigned long *) &event->Flags32[0])) | 315 | if (test_and_clear_bit(0, (unsigned long *) &event->Flags32[0])) { |
510 | { | ||
511 | DPRINT_DBG(VMBUS, "received event %d", event->Flags32[0]); | 316 | DPRINT_DBG(VMBUS, "received event %d", event->Flags32[0]); |
512 | ret |= 0x2; | 317 | ret |= 0x2; |
513 | } | 318 | } |
@@ -515,5 +320,3 @@ VmbusOnISR( | |||
515 | DPRINT_EXIT(VMBUS); | 320 | DPRINT_EXIT(VMBUS); |
516 | return ret; | 321 | return ret; |
517 | } | 322 | } |
518 | |||
519 | /* eof */ | ||