Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/vmbus/vmbus.c
Show All 34 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/linker.h> | #include <sys/linker.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/sbuf.h> | |||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/taskqueue.h> | #include <sys/taskqueue.h> | ||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <machine/intr_machdep.h> | #include <machine/intr_machdep.h> | ||||
#include <machine/metadata.h> | #include <machine/metadata.h> | ||||
Show All 24 Lines | |||||
}; | }; | ||||
static void vmbus_identify(driver_t *, device_t); | static void vmbus_identify(driver_t *, device_t); | ||||
static int vmbus_probe(device_t); | static int vmbus_probe(device_t); | ||||
static int vmbus_attach(device_t); | static int vmbus_attach(device_t); | ||||
static int vmbus_detach(device_t); | static int vmbus_detach(device_t); | ||||
static int vmbus_read_ivar(device_t, device_t, int, | static int vmbus_read_ivar(device_t, device_t, int, | ||||
uintptr_t *); | uintptr_t *); | ||||
static int vmbus_child_pnpinfo_str(device_t, device_t, | static int vmbus_child_pnpinfo(device_t, device_t, struct sbuf *); | ||||
char *, size_t); | |||||
static struct resource *vmbus_alloc_resource(device_t dev, | static struct resource *vmbus_alloc_resource(device_t dev, | ||||
device_t child, int type, int *rid, | device_t child, int type, int *rid, | ||||
rman_res_t start, rman_res_t end, | rman_res_t start, rman_res_t end, | ||||
rman_res_t count, u_int flags); | rman_res_t count, u_int flags); | ||||
static int vmbus_alloc_msi(device_t bus, device_t dev, | static int vmbus_alloc_msi(device_t bus, device_t dev, | ||||
int count, int maxcount, int *irqs); | int count, int maxcount, int *irqs); | ||||
static int vmbus_release_msi(device_t bus, device_t dev, | static int vmbus_release_msi(device_t bus, device_t dev, | ||||
int count, int *irqs); | int count, int *irqs); | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | static device_method_t vmbus_methods[] = { | ||||
DEVMETHOD(device_shutdown, bus_generic_shutdown), | DEVMETHOD(device_shutdown, bus_generic_shutdown), | ||||
DEVMETHOD(device_suspend, bus_generic_suspend), | DEVMETHOD(device_suspend, bus_generic_suspend), | ||||
DEVMETHOD(device_resume, bus_generic_resume), | DEVMETHOD(device_resume, bus_generic_resume), | ||||
/* Bus interface */ | /* Bus interface */ | ||||
DEVMETHOD(bus_add_child, bus_generic_add_child), | DEVMETHOD(bus_add_child, bus_generic_add_child), | ||||
DEVMETHOD(bus_print_child, bus_generic_print_child), | DEVMETHOD(bus_print_child, bus_generic_print_child), | ||||
DEVMETHOD(bus_read_ivar, vmbus_read_ivar), | DEVMETHOD(bus_read_ivar, vmbus_read_ivar), | ||||
DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), | DEVMETHOD(bus_child_pnpinfo, vmbus_child_pnpinfo), | ||||
DEVMETHOD(bus_alloc_resource, vmbus_alloc_resource), | DEVMETHOD(bus_alloc_resource, vmbus_alloc_resource), | ||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource), | DEVMETHOD(bus_release_resource, bus_generic_release_resource), | ||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), | DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), | ||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), | DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), | ||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), | DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), | ||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), | DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), | ||||
#if __FreeBSD_version >= 1100000 | #if __FreeBSD_version >= 1100000 | ||||
DEVMETHOD(bus_get_cpus, bus_generic_get_cpus), | DEVMETHOD(bus_get_cpus, bus_generic_get_cpus), | ||||
▲ Show 20 Lines • Show All 841 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
vmbus_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) | vmbus_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) | ||||
{ | { | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
static int | static int | ||||
vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen) | vmbus_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb) | ||||
{ | { | ||||
const struct vmbus_channel *chan; | const struct vmbus_channel *chan; | ||||
char guidbuf[HYPERV_GUID_STRLEN]; | char guidbuf[HYPERV_GUID_STRLEN]; | ||||
chan = vmbus_get_channel(child); | chan = vmbus_get_channel(child); | ||||
if (chan == NULL) { | if (chan == NULL) { | ||||
/* Event timer device, which does not belong to a channel */ | /* Event timer device, which does not belong to a channel */ | ||||
return (0); | return (0); | ||||
} | } | ||||
strlcat(buf, "classid=", buflen); | |||||
hyperv_guid2str(&chan->ch_guid_type, guidbuf, sizeof(guidbuf)); | hyperv_guid2str(&chan->ch_guid_type, guidbuf, sizeof(guidbuf)); | ||||
strlcat(buf, guidbuf, buflen); | sbuf_printf(sb, "classid=%s", guidbuf); | ||||
strlcat(buf, " deviceid=", buflen); | |||||
hyperv_guid2str(&chan->ch_guid_inst, guidbuf, sizeof(guidbuf)); | hyperv_guid2str(&chan->ch_guid_inst, guidbuf, sizeof(guidbuf)); | ||||
strlcat(buf, guidbuf, buflen); | sbuf_printf(sb, " deviceid=%s", guidbuf); | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
vmbus_add_child(struct vmbus_channel *chan) | vmbus_add_child(struct vmbus_channel *chan) | ||||
{ | { | ||||
struct vmbus_softc *sc = chan->ch_vmbus; | struct vmbus_softc *sc = chan->ch_vmbus; | ||||
▲ Show 20 Lines • Show All 609 Lines • Show Last 20 Lines |