Deleted Added
full compact
vmbus.c (292861) vmbus.c (293870)
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

--- 16 unchanged lines hidden (view full) ---

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>
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

--- 16 unchanged lines hidden (view full) ---

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: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c 292861 2015-12-29 08:19:43Z delphij $");
33__FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c 293870 2016-01-14 02:50:13Z sephe $");
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/sysctl.h>

--- 13 unchanged lines hidden (view full) ---

55#include <machine/intr_machdep.h>
56#include <machine/md_var.h>
57#include <machine/segments.h>
58#include <sys/pcpu.h>
59#include <x86/apicvar.h>
60
61#include "hv_vmbus_priv.h"
62
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/sysctl.h>

--- 13 unchanged lines hidden (view full) ---

55#include <machine/intr_machdep.h>
56#include <machine/md_var.h>
57#include <machine/segments.h>
58#include <sys/pcpu.h>
59#include <x86/apicvar.h>
60
61#include "hv_vmbus_priv.h"
62
63#include <contrib/dev/acpica/include/acpi.h>
64#include "acpi_if.h"
63
65
64#define VMBUS_IRQ 0x5
65
66static device_t vmbus_devp;
67static int vmbus_inited;
68static hv_setup_args setup_args; /* only CPU 0 supported at this time */
69
66static device_t vmbus_devp;
67static int vmbus_inited;
68static hv_setup_args setup_args; /* only CPU 0 supported at this time */
69
70static char *vmbus_ids[] = { "VMBUS", NULL };
71
70/**
71 * @brief Software interrupt thread routine to handle channel messages from
72 * the hypervisor.
73 */
74static void
75vmbus_msg_swintr(void *arg)
76{
77 int cpu;

--- 267 unchanged lines hidden (view full) ---

345 * device_add_child()
346 */
347 mtx_lock(&Giant);
348 ret = device_delete_child(vmbus_devp, child_dev->device);
349 mtx_unlock(&Giant);
350 return(ret);
351}
352
72/**
73 * @brief Software interrupt thread routine to handle channel messages from
74 * the hypervisor.
75 */
76static void
77vmbus_msg_swintr(void *arg)
78{
79 int cpu;

--- 267 unchanged lines hidden (view full) ---

347 * device_add_child()
348 */
349 mtx_lock(&Giant);
350 ret = device_delete_child(vmbus_devp, child_dev->device);
351 mtx_unlock(&Giant);
352 return(ret);
353}
354
353static void
354vmbus_identify(driver_t *driver, device_t parent)
355{
356 if (!hv_vmbus_query_hypervisor_presence())
357 return;
358
359 vm_guest = VM_GUEST_HV;
360
361 BUS_ADD_CHILD(parent, 0, "vmbus", 0);
362}
363
364static int
365vmbus_probe(device_t dev) {
355static int
356vmbus_probe(device_t dev) {
366 if(bootverbose)
367 device_printf(dev, "VMBUS: probe\n");
357 if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL ||
358 device_get_unit(dev) != 0)
359 return (ENXIO);
368
369 device_set_desc(dev, "Vmbus Devices");
370
360
361 device_set_desc(dev, "Vmbus Devices");
362
371 return (BUS_PROBE_NOWILDCARD);
363 return (BUS_PROBE_DEFAULT);
372}
373
374#ifdef HYPERV
375extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback);
376
377/**
378 * @brief Find a free IDT slot and setup the interrupt handler.
379 */

--- 338 unchanged lines hidden (view full) ---

718 break;
719 }
720
721 return (0);
722}
723
724static device_method_t vmbus_methods[] = {
725 /** Device interface */
364}
365
366#ifdef HYPERV
367extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback);
368
369/**
370 * @brief Find a free IDT slot and setup the interrupt handler.
371 */

--- 338 unchanged lines hidden (view full) ---

710 break;
711 }
712
713 return (0);
714}
715
716static device_method_t vmbus_methods[] = {
717 /** Device interface */
726 DEVMETHOD(device_identify, vmbus_identify),
727 DEVMETHOD(device_probe, vmbus_probe),
728 DEVMETHOD(device_attach, vmbus_attach),
729 DEVMETHOD(device_detach, vmbus_detach),
730 DEVMETHOD(device_shutdown, bus_generic_shutdown),
731 DEVMETHOD(device_suspend, bus_generic_suspend),
732 DEVMETHOD(device_resume, bus_generic_resume),
733
734 /** Bus interface */

--- 5 unchanged lines hidden (view full) ---

740 { 0, 0 } };
741
742static char driver_name[] = "vmbus";
743static driver_t vmbus_driver = { driver_name, vmbus_methods,0, };
744
745
746devclass_t vmbus_devclass;
747
718 DEVMETHOD(device_probe, vmbus_probe),
719 DEVMETHOD(device_attach, vmbus_attach),
720 DEVMETHOD(device_detach, vmbus_detach),
721 DEVMETHOD(device_shutdown, bus_generic_shutdown),
722 DEVMETHOD(device_suspend, bus_generic_suspend),
723 DEVMETHOD(device_resume, bus_generic_resume),
724
725 /** Bus interface */

--- 5 unchanged lines hidden (view full) ---

731 { 0, 0 } };
732
733static char driver_name[] = "vmbus";
734static driver_t vmbus_driver = { driver_name, vmbus_methods,0, };
735
736
737devclass_t vmbus_devclass;
738
748DRIVER_MODULE(vmbus, nexus, vmbus_driver, vmbus_devclass, vmbus_modevent, 0);
749MODULE_VERSION(vmbus,1);
739DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, vmbus_modevent, 0);
740MODULE_DEPEND(vmbus, acpi, 1, 1, 1);
741MODULE_VERSION(vmbus, 1);
750
751/* We want to be started after SMP is initialized */
752SYSINIT(vmb_init, SI_SUB_SMP + 1, SI_ORDER_FIRST, vmbus_init, NULL);
753
742
743/* We want to be started after SMP is initialized */
744SYSINIT(vmb_init, SI_SUB_SMP + 1, SI_ORDER_FIRST, vmbus_init, NULL);
745