#include "version_info.h"
#include "vmbus_private.h"
-static const char *gDriverName = "vmbus";
+static const char *gDriverName = "hyperv";
/*
* Windows vmbus does not defined this.
static struct hv_driver *gDriver; /* vmbus driver object */
static struct hv_device *gDevice; /* vmbus root device */
-/*
- * VmbusGetChannelOffers - Retrieve the channel offers from the parent partition
- */
-static void VmbusGetChannelOffers(void)
-{
- VmbusChannelRequestOffers();
-}
-
-/*
- * VmbusGetChannelInterface - Get the channel interface
- */
-static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface)
-{
- GetChannelInterface(Interface);
-}
-
-/*
- * VmbusGetChannelInfo - Get the device info for the specified device object
- */
-static void VmbusGetChannelInfo(struct hv_device *DeviceObject,
- struct hv_device_info *DeviceInfo)
-{
- GetChannelInfo(DeviceObject, DeviceInfo);
-}
-
-/*
- * VmbusCreateChildDevice - Creates the child device on the bus that represents the channel offer
- */
-struct hv_device *VmbusChildDeviceCreate(struct hv_guid *DeviceType,
- struct hv_guid *DeviceInstance,
- void *Context)
-{
- struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
-
- return vmbusDriver->OnChildDeviceCreate(DeviceType, DeviceInstance,
- Context);
-}
-
/*
* VmbusChildDeviceAdd - Registers the child device with the vmbus
*/
int VmbusChildDeviceAdd(struct hv_device *ChildDevice)
{
- struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
-
- return vmbusDriver->OnChildDeviceAdd(gDevice, ChildDevice);
-}
-
-/*
- * VmbusChildDeviceRemove Unregisters the child device from the vmbus
- */
-void VmbusChildDeviceRemove(struct hv_device *ChildDevice)
-{
- struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
-
- vmbusDriver->OnChildDeviceRemove(ChildDevice);
+ return vmbus_child_device_register(gDevice, ChildDevice);
}
/*
/* strcpy(dev->name, "vmbus"); */
/* SynIC setup... */
- on_each_cpu(HvSynicInit, (void *)irqvector, 1);
+ on_each_cpu(hv_synic_init, (void *)irqvector, 1);
/* Connect to VMBus in the root partition */
ret = VmbusConnect();
{
int ret = 0;
- VmbusChannelReleaseUnattachedChannels();
+ vmbus_release_unattached_channels();
VmbusDisconnect();
- on_each_cpu(HvSynicCleanup, NULL, 1);
+ on_each_cpu(hv_synic_cleanup, NULL, 1);
return ret;
}
{
/* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */
- HvCleanup();
+ hv_cleanup();
}
/*
- * VmbusOnMsgDPC - DPC routine to handle messages from the hypervisior
+ * vmbus_on_msg_dpc - DPC routine to handle messages from the hypervisior
*/
-static void VmbusOnMsgDPC(struct hv_driver *drv)
+void vmbus_on_msg_dpc(struct hv_driver *drv)
{
int cpu = smp_processor_id();
- void *page_addr = gHvContext.synICMessagePage[cpu];
+ void *page_addr = hv_context.synic_message_page[cpu];
struct hv_message *msg = (struct hv_message *)page_addr +
VMBUS_MESSAGE_SINT;
struct hv_message *copied;
while (1) {
- if (msg->Header.MessageType == HvMessageTypeNone) {
+ if (msg->header.message_type == HVMSG_NONE) {
/* no msg */
break;
} else {
continue;
osd_schedule_callback(gVmbusConnection.WorkQueue,
- VmbusOnChannelMessage,
+ vmbus_onmessage,
(void *)copied);
}
- msg->Header.MessageType = HvMessageTypeNone;
+ msg->header.message_type = HVMSG_NONE;
/*
* Make sure the write to MessageType (ie set to
- * HvMessageTypeNone) happens before we read the
+ * HVMSG_NONE) happens before we read the
* MessagePending and EOMing. Otherwise, the EOMing
* will not deliver any more messages since there is
* no empty slot
*/
mb();
- if (msg->Header.MessageFlags.MessagePending) {
+ if (msg->header.message_flags.msg_pending) {
/*
* This will cause message queue rescan to
* possibly deliver another msg from the
}
/*
- * VmbusOnEventDPC - DPC routine to handle events from the hypervisior
+ * vmbus_on_event_dpc - DPC routine to handle events from the hypervisior
*/
-static void VmbusOnEventDPC(struct hv_driver *drv)
+void vmbus_on_event_dpc(struct hv_driver *drv)
{
/* TODO: Process any events */
VmbusOnEvents();
}
/*
- * VmbusOnISR - ISR routine
+ * vmbus_on_isr - ISR routine
*/
-static int VmbusOnISR(struct hv_driver *drv)
+int vmbus_on_isr(struct hv_driver *drv)
{
int ret = 0;
int cpu = smp_processor_id();
struct hv_message *msg;
union hv_synic_event_flags *event;
- page_addr = gHvContext.synICMessagePage[cpu];
+ page_addr = hv_context.synic_message_page[cpu];
msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
/* Check if there are actual msgs to be process */
- if (msg->Header.MessageType != HvMessageTypeNone) {
+ if (msg->header.message_type != HVMSG_NONE) {
DPRINT_DBG(VMBUS, "received msg type %d size %d",
- msg->Header.MessageType,
- msg->Header.PayloadSize);
+ msg->header.message_type,
+ msg->header.payload_size);
ret |= 0x1;
}
/* TODO: Check if there are events to be process */
- page_addr = gHvContext.synICEventPage[cpu];
+ page_addr = hv_context.synic_event_page[cpu];
event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
/* Since we are a child, we only need to check bit 0 */
- if (test_and_clear_bit(0, (unsigned long *) &event->Flags32[0])) {
- DPRINT_DBG(VMBUS, "received event %d", event->Flags32[0]);
+ if (test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) {
+ DPRINT_DBG(VMBUS, "received event %d", event->flags32[0]);
ret |= 0x2;
}
/*
* VmbusInitialize - Main entry point
*/
-int VmbusInitialize(struct hv_driver *drv)
+int VmbusInitialize(struct hv_driver *driver)
{
- struct vmbus_driver *driver = (struct vmbus_driver *)drv;
int ret;
DPRINT_INFO(VMBUS, "+++++++ HV Driver version = %s +++++++",
VMBUS_REVISION_NUMBER);
DPRINT_INFO(VMBUS, "+++++++ Vmbus using SINT %d +++++++",
VMBUS_MESSAGE_SINT);
- DPRINT_DBG(VMBUS, "sizeof(VMBUS_CHANNEL_PACKET_PAGE_BUFFER)=%zd, "
+ DPRINT_DBG(VMBUS, "sizeof(vmbus_channel_packet_page_buffer)=%zd, "
"sizeof(VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER)=%zd",
- sizeof(struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER),
- sizeof(struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER));
+ sizeof(struct vmbus_channel_packet_page_buffer),
+ sizeof(struct vmbus_channel_packet_multipage_buffer));
- drv->name = gDriverName;
- memcpy(&drv->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid));
+ driver->name = gDriverName;
+ memcpy(&driver->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid));
/* Setup dispatch table */
- driver->Base.OnDeviceAdd = VmbusOnDeviceAdd;
- driver->Base.OnDeviceRemove = VmbusOnDeviceRemove;
- driver->Base.OnCleanup = VmbusOnCleanup;
- driver->OnIsr = VmbusOnISR;
- driver->OnMsgDpc = VmbusOnMsgDPC;
- driver->OnEventDpc = VmbusOnEventDPC;
- driver->GetChannelOffers = VmbusGetChannelOffers;
- driver->GetChannelInterface = VmbusGetChannelInterface;
- driver->GetChannelInfo = VmbusGetChannelInfo;
+ driver->OnDeviceAdd = VmbusOnDeviceAdd;
+ driver->OnDeviceRemove = VmbusOnDeviceRemove;
+ driver->OnCleanup = VmbusOnCleanup;
/* Hypervisor initialization...setup hypercall page..etc */
- ret = HvInit();
+ ret = hv_init();
if (ret != 0)
DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x",
ret);
- gDriver = drv;
+ gDriver = driver;
return ret;
}