]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
MFC 298260
[FreeBSD/stable/10.git] / sys / dev / hyperv / vmbus / hv_vmbus_drv_freebsd.c
1 /*-
2  * Copyright (c) 2009-2012 Microsoft Corp.
3  * Copyright (c) 2012 NetApp Inc.
4  * Copyright (c) 2012 Citrix Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice unmodified, this list of conditions, and the following
12  *    disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 /*
30  * VM Bus Driver Implementation
31  */
32 #include <sys/cdefs.h>
33 __FBSDID("$FreeBSD$");
34
35 #include <sys/param.h>
36 #include <sys/bus.h>
37 #include <sys/kernel.h>
38 #include <sys/lock.h>
39 #include <sys/malloc.h>
40 #include <sys/module.h>
41 #include <sys/proc.h>
42 #include <sys/sysctl.h>
43 #include <sys/syslog.h>
44 #include <sys/systm.h>
45 #include <sys/rtprio.h>
46 #include <sys/interrupt.h>
47 #include <sys/sx.h>
48 #include <sys/taskqueue.h>
49 #include <sys/mutex.h>
50 #include <sys/smp.h>
51
52 #include <machine/resource.h>
53 #include <sys/rman.h>
54
55 #include <machine/stdarg.h>
56 #include <machine/intr_machdep.h>
57 #include <machine/md_var.h>
58 #include <machine/segments.h>
59 #include <sys/pcpu.h>
60 #include <machine/apicvar.h>
61
62 #include <dev/hyperv/include/hyperv.h>
63 #include "hv_vmbus_priv.h"
64
65 #include <contrib/dev/acpica/include/acpi.h>
66 #include "acpi_if.h"
67
68 static device_t vmbus_devp;
69 static int vmbus_inited;
70 static hv_setup_args setup_args; /* only CPU 0 supported at this time */
71
72 static char *vmbus_ids[] = { "VMBUS", NULL };
73
74 /**
75  * @brief Software interrupt thread routine to handle channel messages from
76  * the hypervisor.
77  */
78 static void
79 vmbus_msg_swintr(void *arg, int pending __unused)
80 {
81         int                     cpu;
82         void*                   page_addr;
83         hv_vmbus_channel_msg_header      *hdr;
84         hv_vmbus_channel_msg_table_entry *entry;
85         hv_vmbus_channel_msg_type msg_type;
86         hv_vmbus_message*       msg;
87
88         cpu = (int)(long)arg;
89         KASSERT(cpu <= mp_maxid, ("VMBUS: vmbus_msg_swintr: "
90             "cpu out of range!"));
91
92         page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu];
93         msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT;
94
95         for (;;) {
96                 if (msg->header.message_type == HV_MESSAGE_TYPE_NONE)
97                         break; /* no message */
98
99                 hdr = (hv_vmbus_channel_msg_header *)msg->u.payload;
100                 msg_type = hdr->message_type;
101
102                 if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) {
103                         printf("VMBUS: unknown message type = %d\n", msg_type);
104                         goto handled;
105                 }
106
107                 entry = &g_channel_message_table[msg_type];
108
109                 if (entry->messageHandler)
110                         entry->messageHandler(hdr);
111 handled:
112             msg->header.message_type = HV_MESSAGE_TYPE_NONE;
113
114             /*
115              * Make sure the write to message_type (ie set to
116              * HV_MESSAGE_TYPE_NONE) happens before we read the
117              * message_pending and EOMing. Otherwise, the EOMing will
118              * not deliver any more messages
119              * since there is no empty slot
120              *
121              * NOTE:
122              * mb() is used here, since atomic_thread_fence_seq_cst()
123              * will become compiler fence on UP kernel.
124              */
125             mb();
126
127             if (msg->header.message_flags.u.message_pending) {
128                         /*
129                          * This will cause message queue rescan to possibly
130                          * deliver another msg from the hypervisor
131                          */
132                         wrmsr(HV_X64_MSR_EOM, 0);
133             }
134         }
135 }
136
137 /**
138  * @brief Interrupt filter routine for VMBUS.
139  *
140  * The purpose of this routine is to determine the type of VMBUS protocol
141  * message to process - an event or a channel message.
142  */
143 static inline int
144 hv_vmbus_isr(struct trapframe *frame)
145 {
146         int                             cpu;
147         hv_vmbus_message*               msg;
148         void*                           page_addr;
149
150         cpu = PCPU_GET(cpuid);
151
152         /*
153          * The Windows team has advised that we check for events
154          * before checking for messages. This is the way they do it
155          * in Windows when running as a guest in Hyper-V
156          */
157
158         hv_vmbus_on_events(cpu);
159
160         /* Check if there are actual msgs to be process */
161         page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu];
162         msg = (hv_vmbus_message*) page_addr + HV_VMBUS_TIMER_SINT;
163
164         /* we call eventtimer process the message */
165         if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) {
166                 msg->header.message_type = HV_MESSAGE_TYPE_NONE;
167
168                 /* call intrrupt handler of event timer */
169                 hv_et_intr(frame);
170
171                 /*
172                  * Make sure the write to message_type (ie set to
173                  * HV_MESSAGE_TYPE_NONE) happens before we read the
174                  * message_pending and EOMing. Otherwise, the EOMing will
175                  * not deliver any more messages
176                  * since there is no empty slot
177                  *
178                  * NOTE:
179                  * mb() is used here, since atomic_thread_fence_seq_cst()
180                  * will become compiler fence on UP kernel.
181                  */
182                 mb();
183
184                 if (msg->header.message_flags.u.message_pending) {
185                         /*
186                          * This will cause message queue rescan to possibly
187                          * deliver another msg from the hypervisor
188                          */
189                         wrmsr(HV_X64_MSR_EOM, 0);
190                 }
191         }
192
193         msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT;
194         if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) {
195                 taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu],
196                     &hv_vmbus_g_context.hv_msg_task[cpu]);
197         }
198
199         return (FILTER_HANDLED);
200 }
201
202 u_long *hv_vmbus_intr_cpu[MAXCPU];
203
204 void
205 hv_vector_handler(struct trapframe *trap_frame)
206 {
207         int cpu;
208
209         /*
210          * Disable preemption.
211          */
212         critical_enter();
213
214         /*
215          * Do a little interrupt counting.
216          */
217         cpu = PCPU_GET(cpuid);
218         (*hv_vmbus_intr_cpu[cpu])++;
219
220         hv_vmbus_isr(trap_frame);
221
222         /*
223          * Enable preemption.
224          */
225         critical_exit();
226 }
227
228 static int
229 vmbus_read_ivar(
230         device_t        dev,
231         device_t        child,
232         int             index,
233         uintptr_t*      result)
234 {
235         struct hv_device *child_dev_ctx = device_get_ivars(child);
236
237         switch (index) {
238
239         case HV_VMBUS_IVAR_TYPE:
240                 *result = (uintptr_t) &child_dev_ctx->class_id;
241                 return (0);
242         case HV_VMBUS_IVAR_INSTANCE:
243                 *result = (uintptr_t) &child_dev_ctx->device_id;
244                 return (0);
245         case HV_VMBUS_IVAR_DEVCTX:
246                 *result = (uintptr_t) child_dev_ctx;
247                 return (0);
248         case HV_VMBUS_IVAR_NODE:
249                 *result = (uintptr_t) child_dev_ctx->device;
250                 return (0);
251         }
252         return (ENOENT);
253 }
254
255 static int
256 vmbus_write_ivar(
257         device_t        dev,
258         device_t        child,
259         int             index,
260         uintptr_t       value)
261 {
262         switch (index) {
263
264         case HV_VMBUS_IVAR_TYPE:
265         case HV_VMBUS_IVAR_INSTANCE:
266         case HV_VMBUS_IVAR_DEVCTX:
267         case HV_VMBUS_IVAR_NODE:
268                 /* read-only */
269                 return (EINVAL);
270         }
271         return (ENOENT);
272 }
273
274 static int
275 vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen)
276 {
277         char guidbuf[40];
278         struct hv_device *dev_ctx = device_get_ivars(child);
279
280         strlcat(buf, "classid=", buflen);
281         snprintf_hv_guid(guidbuf, sizeof(guidbuf), &dev_ctx->class_id);
282         strlcat(buf, guidbuf, buflen);
283
284         strlcat(buf, " deviceid=", buflen);
285         snprintf_hv_guid(guidbuf, sizeof(guidbuf), &dev_ctx->device_id);
286         strlcat(buf, guidbuf, buflen);
287
288         return (0);
289 }
290
291 struct hv_device*
292 hv_vmbus_child_device_create(
293         hv_guid         type,
294         hv_guid         instance,
295         hv_vmbus_channel*       channel)
296 {
297         hv_device* child_dev;
298
299         /*
300          * Allocate the new child device
301          */
302         child_dev = malloc(sizeof(hv_device), M_DEVBUF,
303                         M_WAITOK |  M_ZERO);
304
305         child_dev->channel = channel;
306         memcpy(&child_dev->class_id, &type, sizeof(hv_guid));
307         memcpy(&child_dev->device_id, &instance, sizeof(hv_guid));
308
309         return (child_dev);
310 }
311
312 int
313 snprintf_hv_guid(char *buf, size_t sz, const hv_guid *guid)
314 {
315         int cnt;
316         const unsigned char *d = guid->data;
317
318         cnt = snprintf(buf, sz,
319                 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
320                 d[3], d[2], d[1], d[0], d[5], d[4], d[7], d[6],
321                 d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
322         return (cnt);
323 }
324
325 int
326 hv_vmbus_child_device_register(struct hv_device *child_dev)
327 {
328         device_t child;
329
330         if (bootverbose) {
331                 char name[40];
332                 snprintf_hv_guid(name, sizeof(name), &child_dev->class_id);
333                 printf("VMBUS: Class ID: %s\n", name);
334         }
335
336         child = device_add_child(vmbus_devp, NULL, -1);
337         child_dev->device = child;
338         device_set_ivars(child, child_dev);
339
340         return (0);
341 }
342
343 int
344 hv_vmbus_child_device_unregister(struct hv_device *child_dev)
345 {
346         int ret = 0;
347         /*
348          * XXXKYS: Ensure that this is the opposite of
349          * device_add_child()
350          */
351         mtx_lock(&Giant);
352         ret = device_delete_child(vmbus_devp, child_dev->device);
353         mtx_unlock(&Giant);
354         return(ret);
355 }
356
357 static int
358 vmbus_probe(device_t dev) {
359         if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL ||
360             device_get_unit(dev) != 0)
361                 return (ENXIO);
362
363         device_set_desc(dev, "Vmbus Devices");
364
365         return (BUS_PROBE_DEFAULT);
366 }
367
368 extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback);
369
370 /**
371  * @brief Find a free IDT slot and setup the interrupt handler.
372  */
373 static int
374 vmbus_vector_alloc(void)
375 {
376         int vector;
377         uintptr_t func;
378         struct gate_descriptor *ip;
379
380         /*
381          * Search backwards form the highest IDT vector available for use
382          * as vmbus channel callback vector. We install 'hv_vmbus_callback'
383          * handler at that vector and use it to interrupt vcpus.
384          */
385         vector = APIC_SPURIOUS_INT;
386         while (--vector >= APIC_IPI_INTS) {
387                 ip = &idt[vector];
388                 func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset);
389                 if (func == (uintptr_t)&IDTVEC(rsvd)) {
390 #ifdef __i386__
391                         setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYS386IGT,
392                             SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
393 #else
394                         setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYSIGT,
395                             SEL_KPL, 0);
396 #endif
397
398                         return (vector);
399                 }
400         }
401         return (0);
402 }
403
404 /**
405  * @brief Restore the IDT slot to rsvd.
406  */
407 static void
408 vmbus_vector_free(int vector)
409 {
410         uintptr_t func;
411         struct gate_descriptor *ip;
412
413         if (vector == 0)
414                 return;
415
416         KASSERT(vector >= APIC_IPI_INTS && vector < APIC_SPURIOUS_INT,
417             ("invalid vector %d", vector));
418
419         ip = &idt[vector];
420         func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset);
421         KASSERT(func == (uintptr_t)&IDTVEC(hv_vmbus_callback),
422             ("invalid vector %d", vector));
423
424         setidt(vector, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
425 }
426
427 static void
428 vmbus_cpuset_setthread_task(void *xmask, int pending __unused)
429 {
430         cpuset_t *mask = xmask;
431         int error;
432
433         error = cpuset_setthread(curthread->td_tid, mask);
434         if (error) {
435                 panic("curthread=%ju: can't pin; error=%d",
436                     (uintmax_t)curthread->td_tid, error);
437         }
438 }
439
440 /**
441  * @brief Main vmbus driver initialization routine.
442  *
443  * Here, we
444  * - initialize the vmbus driver context
445  * - setup various driver entry points
446  * - invoke the vmbus hv main init routine
447  * - get the irq resource
448  * - invoke the vmbus to add the vmbus root device
449  * - setup the vmbus root device
450  * - retrieve the channel offers
451  */
452 static int
453 vmbus_bus_init(void)
454 {
455         int i, j, n, ret;
456         char buf[MAXCOMLEN + 1];
457         cpuset_t cpu_mask;
458
459         if (vmbus_inited)
460                 return (0);
461
462         vmbus_inited = 1;
463
464         ret = hv_vmbus_init();
465
466         if (ret) {
467                 if(bootverbose)
468                         printf("Error VMBUS: Hypervisor Initialization Failed!\n");
469                 return (ret);
470         }
471
472         /*
473          * Find a free IDT slot for vmbus callback.
474          */
475         hv_vmbus_g_context.hv_cb_vector = vmbus_vector_alloc();
476
477         if (hv_vmbus_g_context.hv_cb_vector == 0) {
478                 if(bootverbose)
479                         printf("Error VMBUS: Cannot find free IDT slot for "
480                             "vmbus callback!\n");
481                 goto cleanup;
482         }
483
484         if(bootverbose)
485                 printf("VMBUS: vmbus callback vector %d\n",
486                     hv_vmbus_g_context.hv_cb_vector);
487
488         /*
489          * Notify the hypervisor of our vector.
490          */
491         setup_args.vector = hv_vmbus_g_context.hv_cb_vector;
492
493         CPU_FOREACH(j) {
494                 snprintf(buf, sizeof(buf), "cpu%d:hyperv", j);
495                 intrcnt_add(buf, &hv_vmbus_intr_cpu[j]);
496
497                 for (i = 0; i < 2; i++)
498                         setup_args.page_buffers[2 * j + i] = NULL;
499         }
500
501         /*
502          * Per cpu setup.
503          */
504         CPU_FOREACH(j) {
505                 struct task cpuset_task;
506
507                 /*
508                  * Setup taskqueue to handle events
509                  */
510                 hv_vmbus_g_context.hv_event_queue[j] = taskqueue_create_fast("hyperv event", M_WAITOK,
511                         taskqueue_thread_enqueue, &hv_vmbus_g_context.hv_event_queue[j]);
512                 taskqueue_start_threads(&hv_vmbus_g_context.hv_event_queue[j], 1, PI_NET,
513                         "hvevent%d", j);
514
515                 CPU_SETOF(j, &cpu_mask);
516                 TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask);
517                 taskqueue_enqueue(hv_vmbus_g_context.hv_event_queue[j], &cpuset_task);
518                 taskqueue_drain(hv_vmbus_g_context.hv_event_queue[j], &cpuset_task);
519
520                 /*
521                  * Setup per-cpu tasks and taskqueues to handle msg.
522                  */
523                 hv_vmbus_g_context.hv_msg_tq[j] = taskqueue_create_fast(
524                     "hyperv msg", M_WAITOK, taskqueue_thread_enqueue,
525                     &hv_vmbus_g_context.hv_msg_tq[j]);
526                 taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[j], 1, PI_NET,
527                     "hvmsg%d", j);
528                 TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0,
529                     vmbus_msg_swintr, (void *)(long)j);
530
531                 CPU_SETOF(j, &cpu_mask);
532                 TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask);
533                 taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[j], &cpuset_task);
534                 taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[j], &cpuset_task);
535
536                 /*
537                  * Prepare the per cpu msg and event pages to be called on each cpu.
538                  */
539                 for(i = 0; i < 2; i++) {
540                         setup_args.page_buffers[2 * j + i] =
541                                 malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO);
542                 }
543         }
544
545         if (bootverbose)
546                 printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n",
547                     smp_started);
548
549         smp_rendezvous(NULL, hv_vmbus_synic_init, NULL, &setup_args);
550
551         /*
552          * Connect to VMBus in the root partition
553          */
554         ret = hv_vmbus_connect();
555
556         if (ret != 0)
557                 goto cleanup1;
558
559         hv_vmbus_request_channel_offers();
560
561         vmbus_scan();
562         bus_generic_attach(vmbus_devp);
563         device_printf(vmbus_devp, "device scan, probe and attach done\n");
564
565         return (ret);
566
567         cleanup1:
568         /*
569          * Free pages alloc'ed
570          */
571         for (n = 0; n < 2 * MAXCPU; n++)
572                 if (setup_args.page_buffers[n] != NULL)
573                         free(setup_args.page_buffers[n], M_DEVBUF);
574
575         /*
576          * remove swi and vmbus callback vector;
577          */
578         CPU_FOREACH(j) {
579                 if (hv_vmbus_g_context.hv_event_queue[j] != NULL) {
580                         taskqueue_free(hv_vmbus_g_context.hv_event_queue[j]);
581                         hv_vmbus_g_context.hv_event_queue[j] = NULL;
582                 }
583         }
584
585         vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);
586
587         cleanup:
588         hv_vmbus_cleanup();
589
590         return (ret);
591 }
592
593 static int
594 vmbus_attach(device_t dev)
595 {
596         if(bootverbose)
597                 device_printf(dev, "VMBUS: attach dev: %p\n", dev);
598         vmbus_devp = dev;
599
600         /* 
601          * If the system has already booted and thread
602          * scheduling is possible indicated by the global
603          * cold set to zero, we just call the driver
604          * initialization directly.
605          */
606         if (!cold)
607                 vmbus_bus_init();
608
609         return (0);
610 }
611
612 static void
613 vmbus_init(void)
614 {
615         if (vm_guest != VM_GUEST_HV)
616                 return;
617
618         /* 
619          * If the system has already booted and thread
620          * scheduling is possible, as indicated by the
621          * global cold set to zero, we just call the driver
622          * initialization directly.
623          */
624         if (!cold) 
625                 vmbus_bus_init();
626 }
627
628 static void
629 vmbus_bus_exit(void)
630 {
631         int i;
632
633         hv_vmbus_release_unattached_channels();
634         hv_vmbus_disconnect();
635
636         smp_rendezvous(NULL, hv_vmbus_synic_cleanup, NULL, NULL);
637
638         for(i = 0; i < 2 * MAXCPU; i++) {
639                 if (setup_args.page_buffers[i] != NULL)
640                         free(setup_args.page_buffers[i], M_DEVBUF);
641         }
642
643         hv_vmbus_cleanup();
644
645         /* remove swi */
646         CPU_FOREACH(i) {
647                 if (hv_vmbus_g_context.hv_event_queue[i] != NULL) {
648                         taskqueue_free(hv_vmbus_g_context.hv_event_queue[i]);
649                         hv_vmbus_g_context.hv_event_queue[i] = NULL;
650                 }
651         }
652
653         vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);
654
655         return;
656 }
657
658 static void
659 vmbus_exit(void)
660 {
661         vmbus_bus_exit();
662 }
663
664 static int
665 vmbus_detach(device_t dev)
666 {
667         vmbus_exit();
668         return (0);
669 }
670
671 static void
672 vmbus_mod_load(void)
673 {
674         if(bootverbose)
675                 printf("VMBUS: load\n");
676 }
677
678 static void
679 vmbus_mod_unload(void)
680 {
681         if(bootverbose)
682                 printf("VMBUS: unload\n");
683 }
684
685 static int
686 vmbus_modevent(module_t mod, int what, void *arg)
687 {
688         switch (what) {
689
690         case MOD_LOAD:
691                 vmbus_mod_load();
692                 break;
693         case MOD_UNLOAD:
694                 vmbus_mod_unload();
695                 break;
696         }
697
698         return (0);
699 }
700
701 static device_method_t vmbus_methods[] = {
702         /** Device interface */
703         DEVMETHOD(device_probe, vmbus_probe),
704         DEVMETHOD(device_attach, vmbus_attach),
705         DEVMETHOD(device_detach, vmbus_detach),
706         DEVMETHOD(device_shutdown, bus_generic_shutdown),
707         DEVMETHOD(device_suspend, bus_generic_suspend),
708         DEVMETHOD(device_resume, bus_generic_resume),
709
710         /** Bus interface */
711         DEVMETHOD(bus_add_child, bus_generic_add_child),
712         DEVMETHOD(bus_print_child, bus_generic_print_child),
713         DEVMETHOD(bus_read_ivar, vmbus_read_ivar),
714         DEVMETHOD(bus_write_ivar, vmbus_write_ivar),
715         DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str),
716
717         { 0, 0 } };
718
719 static char driver_name[] = "vmbus";
720 static driver_t vmbus_driver = { driver_name, vmbus_methods,0, };
721
722
723 devclass_t vmbus_devclass;
724
725 DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, vmbus_modevent, 0);
726 MODULE_DEPEND(vmbus, acpi, 1, 1, 1);
727 MODULE_VERSION(vmbus, 1);
728
729 /* We want to be started after SMP is initialized */
730 SYSINIT(vmb_init, SI_SUB_SMP + 1, SI_ORDER_FIRST, vmbus_init, NULL);
731