|
@@ -30,28 +30,20 @@
|
|
|
#include "Channel.h"
|
|
|
#include "ChannelMgmt.h"
|
|
|
#include "ChannelInterface.h"
|
|
|
-/* #include "ChannelMessages.h" */
|
|
|
#include "RingBuffer.h"
|
|
|
-/* #include "Packet.h" */
|
|
|
#include "include/List.h"
|
|
|
|
|
|
|
|
|
-/* Defines */
|
|
|
-
|
|
|
-
|
|
|
/*
|
|
|
* Maximum channels is determined by the size of the interrupt page
|
|
|
* which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt
|
|
|
* and the other is receive endpoint interrupt
|
|
|
*/
|
|
|
-#define MAX_NUM_CHANNELS (PAGE_SIZE >> 1) << 3 /* 16348 channels */
|
|
|
+#define MAX_NUM_CHANNELS ((PAGE_SIZE >> 1) << 3) /* 16348 channels */
|
|
|
|
|
|
/* The value here must be in multiple of 32 */
|
|
|
/* TODO: Need to make this configurable */
|
|
|
-#define MAX_NUM_CHANNELS_SUPPORTED 256
|
|
|
-
|
|
|
-
|
|
|
-/* Data types */
|
|
|
+#define MAX_NUM_CHANNELS_SUPPORTED 256
|
|
|
|
|
|
|
|
|
enum VMBUS_CONNECT_STATE {
|
|
@@ -61,36 +53,34 @@ enum VMBUS_CONNECT_STATE {
|
|
|
Disconnecting
|
|
|
};
|
|
|
|
|
|
-#define MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT
|
|
|
+#define MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT
|
|
|
|
|
|
struct VMBUS_CONNECTION {
|
|
|
-
|
|
|
- enum VMBUS_CONNECT_STATE ConnectState;
|
|
|
+ enum VMBUS_CONNECT_STATE ConnectState;
|
|
|
|
|
|
atomic_t NextGpadlHandle;
|
|
|
|
|
|
/*
|
|
|
- * Represents channel interrupts. Each bit position represents
|
|
|
- * a channel. When a channel sends an interrupt via VMBUS, it
|
|
|
- * finds its bit in the sendInterruptPage, set it and calls Hv
|
|
|
- * to generate a port event. The other end receives the port
|
|
|
- * event and parse the recvInterruptPage to see which bit is
|
|
|
- * set
|
|
|
+ * Represents channel interrupts. Each bit position represents a
|
|
|
+ * channel. When a channel sends an interrupt via VMBUS, it finds its
|
|
|
+ * bit in the sendInterruptPage, set it and calls Hv to generate a port
|
|
|
+ * event. The other end receives the port event and parse the
|
|
|
+ * recvInterruptPage to see which bit is set
|
|
|
*/
|
|
|
- void * InterruptPage;
|
|
|
- void * SendInterruptPage;
|
|
|
- void * RecvInterruptPage;
|
|
|
+ void *InterruptPage;
|
|
|
+ void *SendInterruptPage;
|
|
|
+ void *RecvInterruptPage;
|
|
|
|
|
|
/*
|
|
|
* 2 pages - 1st page for parent->child notification and 2nd
|
|
|
* is child->parent notification
|
|
|
*/
|
|
|
- void * MonitorPages;
|
|
|
- LIST_ENTRY ChannelMsgList;
|
|
|
+ void *MonitorPages;
|
|
|
+ LIST_ENTRY ChannelMsgList;
|
|
|
spinlock_t channelmsg_lock;
|
|
|
|
|
|
/* List of channels */
|
|
|
- LIST_ENTRY ChannelList;
|
|
|
+ LIST_ENTRY ChannelList;
|
|
|
spinlock_t channel_lock;
|
|
|
|
|
|
struct workqueue_struct *WorkQueue;
|
|
@@ -99,75 +89,46 @@ struct VMBUS_CONNECTION {
|
|
|
|
|
|
struct VMBUS_MSGINFO {
|
|
|
/* Bookkeeping stuff */
|
|
|
- LIST_ENTRY MsgListEntry;
|
|
|
+ LIST_ENTRY MsgListEntry;
|
|
|
|
|
|
/* Synchronize the request/response if needed */
|
|
|
struct osd_waitevent *WaitEvent;
|
|
|
|
|
|
/* The message itself */
|
|
|
- unsigned char Msg[0];
|
|
|
+ unsigned char Msg[0];
|
|
|
};
|
|
|
|
|
|
|
|
|
-
|
|
|
-/* Externs */
|
|
|
-
|
|
|
extern struct VMBUS_CONNECTION gVmbusConnection;
|
|
|
|
|
|
-
|
|
|
/* General vmbus interface */
|
|
|
|
|
|
-static struct hv_device*
|
|
|
-VmbusChildDeviceCreate(
|
|
|
- GUID deviceType,
|
|
|
- GUID deviceInstance,
|
|
|
- void *context);
|
|
|
+struct hv_device *VmbusChildDeviceCreate(GUID deviceType,
|
|
|
+ GUID deviceInstance,
|
|
|
+ void *context);
|
|
|
|
|
|
-static int
|
|
|
-VmbusChildDeviceAdd(
|
|
|
- struct hv_device *Device);
|
|
|
+int VmbusChildDeviceAdd(struct hv_device *Device);
|
|
|
|
|
|
-static void
|
|
|
-VmbusChildDeviceRemove(
|
|
|
- struct hv_device *Device);
|
|
|
+void VmbusChildDeviceRemove(struct hv_device *Device);
|
|
|
|
|
|
/* static void */
|
|
|
/* VmbusChildDeviceDestroy( */
|
|
|
/* struct hv_device *); */
|
|
|
|
|
|
-static VMBUS_CHANNEL*
|
|
|
-GetChannelFromRelId(
|
|
|
- u32 relId
|
|
|
- );
|
|
|
+VMBUS_CHANNEL *GetChannelFromRelId(u32 relId);
|
|
|
|
|
|
|
|
|
/* Connection interface */
|
|
|
|
|
|
-static int
|
|
|
-VmbusConnect(
|
|
|
- void
|
|
|
- );
|
|
|
-
|
|
|
-static int
|
|
|
-VmbusDisconnect(
|
|
|
- void
|
|
|
- );
|
|
|
-
|
|
|
-static int
|
|
|
-VmbusPostMessage(
|
|
|
- void * buffer,
|
|
|
- size_t bufSize
|
|
|
- );
|
|
|
-
|
|
|
-static int
|
|
|
-VmbusSetEvent(
|
|
|
- u32 childRelId
|
|
|
- );
|
|
|
-
|
|
|
-static void
|
|
|
-VmbusOnEvents(
|
|
|
- void
|
|
|
- );
|
|
|
+int VmbusConnect(void);
|
|
|
+
|
|
|
+int VmbusDisconnect(void);
|
|
|
+
|
|
|
+int VmbusPostMessage(void *buffer, size_t bufSize);
|
|
|
+
|
|
|
+int VmbusSetEvent(u32 childRelId);
|
|
|
+
|
|
|
+void VmbusOnEvents(void);
|
|
|
|
|
|
|
|
|
#endif /* _VMBUS_PRIVATE_H_ */
|