diff options
Diffstat (limited to 'drivers/staging/hv/Channel.h')
-rw-r--r-- | drivers/staging/hv/Channel.h | 195 |
1 files changed, 77 insertions, 118 deletions
diff --git a/drivers/staging/hv/Channel.h b/drivers/staging/hv/Channel.h index 16d6e7d886f..4fc5baf297d 100644 --- a/drivers/staging/hv/Channel.h +++ b/drivers/staging/hv/Channel.h @@ -28,127 +28,86 @@ #include "include/osd.h" #include "ChannelMgmt.h" -#pragma pack(push,1) - - /* The format must be the same as VMDATA_GPA_DIRECT */ struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER { - u16 Type; - u16 DataOffset8; - u16 Length8; - u16 Flags; - u64 TransactionId; - u32 Reserved; - u32 RangeCount; - PAGE_BUFFER Range[MAX_PAGE_BUFFER_COUNT]; -}; - + u16 Type; + u16 DataOffset8; + u16 Length8; + u16 Flags; + u64 TransactionId; + u32 Reserved; + u32 RangeCount; + PAGE_BUFFER Range[MAX_PAGE_BUFFER_COUNT]; +} __attribute__((packed)); /* The format must be the same as VMDATA_GPA_DIRECT */ struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER { - u16 Type; - u16 DataOffset8; - u16 Length8; - u16 Flags; - u64 TransactionId; - u32 Reserved; - u32 RangeCount; /* Always 1 in this case */ - MULTIPAGE_BUFFER Range; -}; - -#pragma pack(pop) - - -/* Routines */ - - -static int -VmbusChannelOpen( - VMBUS_CHANNEL *Channel, - u32 SendRingBufferSize, - u32 RecvRingBufferSize, - void * UserData, - u32 UserDataLen, - PFN_CHANNEL_CALLBACK pfnOnChannelCallback, - void * Context - ); - -static void -VmbusChannelClose( - VMBUS_CHANNEL *Channel - ); - -static int -VmbusChannelSendPacket( - VMBUS_CHANNEL *Channel, - const void * Buffer, - u32 BufferLen, - u64 RequestId, - VMBUS_PACKET_TYPE Type, - u32 Flags -); - -static int -VmbusChannelSendPacketPageBuffer( - VMBUS_CHANNEL *Channel, - PAGE_BUFFER PageBuffers[], - u32 PageCount, - void * Buffer, - u32 BufferLen, - u64 RequestId - ); - -static int -VmbusChannelSendPacketMultiPageBuffer( - VMBUS_CHANNEL *Channel, - MULTIPAGE_BUFFER *MultiPageBuffer, - void * Buffer, - u32 BufferLen, - u64 RequestId -); - -static int -VmbusChannelEstablishGpadl( - VMBUS_CHANNEL *Channel, - void * Kbuffer, /* from kmalloc() */ - u32 Size, /* page-size multiple */ - u32 *GpadlHandle - ); - -static int -VmbusChannelTeardownGpadl( - VMBUS_CHANNEL *Channel, - u32 GpadlHandle - ); - -static int -VmbusChannelRecvPacket( - VMBUS_CHANNEL *Channel, - void * Buffer, - u32 BufferLen, - u32* BufferActualLen, - u64* RequestId - ); - -static int -VmbusChannelRecvPacketRaw( - VMBUS_CHANNEL *Channel, - void * Buffer, - u32 BufferLen, - u32* BufferActualLen, - u64* RequestId - ); - -static void -VmbusChannelOnChannelEvent( - VMBUS_CHANNEL *Channel - ); - -static void -VmbusChannelGetDebugInfo( - VMBUS_CHANNEL *Channel, - VMBUS_CHANNEL_DEBUG_INFO *DebugInfo - ); - -static void VmbusChannelOnTimer(unsigned long data); + u16 Type; + u16 DataOffset8; + u16 Length8; + u16 Flags; + u64 TransactionId; + u32 Reserved; + u32 RangeCount; /* Always 1 in this case */ + MULTIPAGE_BUFFER Range; +} __attribute__((packed)); + + +extern int VmbusChannelOpen(VMBUS_CHANNEL *Channel, + u32 SendRingBufferSize, + u32 RecvRingBufferSize, + void *UserData, + u32 UserDataLen, + PFN_CHANNEL_CALLBACK pfnOnChannelCallback, + void *Context); + +extern void VmbusChannelClose(VMBUS_CHANNEL *Channel); + +extern int VmbusChannelSendPacket(VMBUS_CHANNEL *Channel, + const void *Buffer, + u32 BufferLen, + u64 RequestId, + VMBUS_PACKET_TYPE Type, + u32 Flags); + +extern int VmbusChannelSendPacketPageBuffer(VMBUS_CHANNEL *Channel, + PAGE_BUFFER PageBuffers[], + u32 PageCount, + void *Buffer, + u32 BufferLen, + u64 RequestId); + +extern int VmbusChannelSendPacketMultiPageBuffer(VMBUS_CHANNEL *Channel, + MULTIPAGE_BUFFER *MultiPageBuffer, + void *Buffer, + u32 BufferLen, + u64 RequestId); + +extern int VmbusChannelEstablishGpadl(VMBUS_CHANNEL *Channel, + void *Kbuffer, + u32 Size, + u32 *GpadlHandle); + +extern int VmbusChannelTeardownGpadl(VMBUS_CHANNEL *Channel, + u32 GpadlHandle); + +extern int VmbusChannelRecvPacket(VMBUS_CHANNEL *Channel, + void *Buffer, + u32 BufferLen, + u32 *BufferActualLen, + u64 *RequestId); + +extern int VmbusChannelRecvPacketRaw(VMBUS_CHANNEL *Channel, + void *Buffer, + u32 BufferLen, + u32 *BufferActualLen, + u64 *RequestId); + +extern void VmbusChannelOnChannelEvent(VMBUS_CHANNEL *Channel); + +extern void VmbusChannelGetDebugInfo(VMBUS_CHANNEL *Channel, + VMBUS_CHANNEL_DEBUG_INFO *DebugInfo); + +extern void VmbusChannelOnTimer(unsigned long data); + #endif /* _CHANNEL_H_ */ |