Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/vmbus/vmbus.c
Show First 20 Lines • Show All 1,120 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static struct resource * | static struct resource * | ||||
vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid, | vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid, | ||||
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
device_t parent = device_get_parent(dev); | device_t parent = device_get_parent(dev); | ||||
struct resource *res; | struct resource *res; | ||||
#ifdef NEW_PCIB | |||||
if (type == SYS_RES_MEMORY) { | if (type == SYS_RES_MEMORY) { | ||||
struct vmbus_softc *sc = device_get_softc(dev); | struct vmbus_softc *sc = device_get_softc(dev); | ||||
res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type, | res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type, | ||||
rid, start, end, count, flags); | rid, start, end, count, flags); | ||||
} else | } else { | ||||
#endif | |||||
{ | |||||
res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start, | res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start, | ||||
end, count, flags); | end, count, flags); | ||||
} | } | ||||
return (res); | return (res); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
vmbus_get_eventtq_method(device_t bus, device_t dev __unused, int cpu) | vmbus_get_eventtq_method(device_t bus, device_t dev __unused, int cpu) | ||||
{ | { | ||||
const struct vmbus_softc *sc = device_get_softc(bus); | const struct vmbus_softc *sc = device_get_softc(bus); | ||||
KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu%d", cpu)); | KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu%d", cpu)); | ||||
return (VMBUS_PCPU_GET(sc, event_tq, cpu)); | return (VMBUS_PCPU_GET(sc, event_tq, cpu)); | ||||
} | } | ||||
#ifdef NEW_PCIB | |||||
#define VTPM_BASE_ADDR 0xfed40000 | #define VTPM_BASE_ADDR 0xfed40000 | ||||
#define FOUR_GB (1ULL << 32) | #define FOUR_GB (1ULL << 32) | ||||
enum parse_pass { parse_64, parse_32 }; | enum parse_pass { parse_64, parse_32 }; | ||||
struct parse_context { | struct parse_context { | ||||
device_t vmbus_dev; | device_t vmbus_dev; | ||||
enum parse_pass pass; | enum parse_pass pass; | ||||
▲ Show 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct vmbus_softc *sc = device_get_softc(dev); | struct vmbus_softc *sc = device_get_softc(dev); | ||||
pcib_host_res_free(dev, &sc->vmbus_mmio_res); | pcib_host_res_free(dev, &sc->vmbus_mmio_res); | ||||
if (hv_fb_res) | if (hv_fb_res) | ||||
hv_fb_res = NULL; | hv_fb_res = NULL; | ||||
} | } | ||||
#endif /* NEW_PCIB */ | |||||
static void | static void | ||||
vmbus_identify(driver_t *driver, device_t parent) | vmbus_identify(driver_t *driver, device_t parent) | ||||
{ | { | ||||
if (device_get_unit(parent) != 0 || vm_guest != VM_GUEST_HV || | if (device_get_unit(parent) != 0 || vm_guest != VM_GUEST_HV || | ||||
(hyperv_features & CPUID_HV_MSR_SYNIC) == 0) | (hyperv_features & CPUID_HV_MSR_SYNIC) == 0) | ||||
return; | return; | ||||
Show All 29 Lines | |||||
{ | { | ||||
struct sysctl_oid_list *child; | struct sysctl_oid_list *child; | ||||
struct sysctl_ctx_list *ctx; | struct sysctl_ctx_list *ctx; | ||||
int ret; | int ret; | ||||
if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) | if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) | ||||
return (0); | return (0); | ||||
#ifdef NEW_PCIB | |||||
vmbus_get_mmio_res(sc->vmbus_dev); | vmbus_get_mmio_res(sc->vmbus_dev); | ||||
vmbus_fb_mmio_res(sc->vmbus_dev); | vmbus_fb_mmio_res(sc->vmbus_dev); | ||||
#endif | |||||
sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; | sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; | ||||
sc->vmbus_gpadl = VMBUS_GPADL_START; | sc->vmbus_gpadl = VMBUS_GPADL_START; | ||||
mtx_init(&sc->vmbus_prichan_lock, "vmbus prichan", NULL, MTX_DEF); | mtx_init(&sc->vmbus_prichan_lock, "vmbus prichan", NULL, MTX_DEF); | ||||
TAILQ_INIT(&sc->vmbus_prichans); | TAILQ_INIT(&sc->vmbus_prichans); | ||||
mtx_init(&sc->vmbus_chan_lock, "vmbus channel", NULL, MTX_DEF); | mtx_init(&sc->vmbus_chan_lock, "vmbus channel", NULL, MTX_DEF); | ||||
TAILQ_INIT(&sc->vmbus_chans); | TAILQ_INIT(&sc->vmbus_chans); | ||||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | if (sc->vmbus_xc != NULL) { | ||||
vmbus_xact_ctx_destroy(sc->vmbus_xc); | vmbus_xact_ctx_destroy(sc->vmbus_xc); | ||||
sc->vmbus_xc = NULL; | sc->vmbus_xc = NULL; | ||||
} | } | ||||
free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF); | free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF); | ||||
mtx_destroy(&sc->vmbus_prichan_lock); | mtx_destroy(&sc->vmbus_prichan_lock); | ||||
mtx_destroy(&sc->vmbus_chan_lock); | mtx_destroy(&sc->vmbus_chan_lock); | ||||
#ifdef NEW_PCIB | |||||
vmbus_free_mmio_res(dev); | vmbus_free_mmio_res(dev); | ||||
#endif | |||||
return (0); | return (0); | ||||
} | } | ||||
#ifndef EARLY_AP_STARTUP | #ifndef EARLY_AP_STARTUP | ||||
static void | static void | ||||
vmbus_sysinit(void *arg __unused) | vmbus_sysinit(void *arg __unused) | ||||
Show All 23 Lines |