#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)
-{
- vmbus_request_offers();
-}
-
-/*
- * 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,
- struct vmbus_channel *channel)
-{
- struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
-
- return vmbusDriver->OnChildDeviceCreate(DeviceType, DeviceInstance,
- channel);
-}
-
/*
* 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();
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;
}
/*
- * 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 */
}
/* 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 */
/*
* 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 +++++++",
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->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;
}