vmbus.c (301021) | vmbus.c (301106) |
---|---|
1/*- 2 * Copyright (c) 2009-2012,2016 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,2016 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 301021 2016-05-31 05:43:59Z sephe $"); | 33__FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c 301106 2016-06-01 06:51:44Z 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/proc.h> --- 201 unchanged lines hidden (view full) --- 243 MSR_HV_SIMP_PGSHIFT); 244 wrmsr(MSR_HV_SIMP, val); 245 246 /* 247 * Setup the SynIC event flags. 248 */ 249 orig = rdmsr(MSR_HV_SIEFP); 250 val = MSR_HV_SIEFP_ENABLE | (orig & MSR_HV_SIEFP_RSVD_MASK) | | 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> --- 201 unchanged lines hidden (view full) --- 243 MSR_HV_SIMP_PGSHIFT); 244 wrmsr(MSR_HV_SIMP, val); 245 246 /* 247 * Setup the SynIC event flags. 248 */ 249 orig = rdmsr(MSR_HV_SIEFP); 250 val = MSR_HV_SIEFP_ENABLE | (orig & MSR_HV_SIEFP_RSVD_MASK) | |
251 ((VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT) << 252 MSR_HV_SIEFP_PGSHIFT); | 251 ((VMBUS_PCPU_GET(sc, event_flags_dma.hv_paddr, cpu) 252 >> PAGE_SHIFT) << MSR_HV_SIEFP_PGSHIFT); |
253 wrmsr(MSR_HV_SIEFP, val); 254 255 256 /* 257 * Configure and unmask SINT for message and event flags. 258 */ 259 sint = MSR_HV_SINT0 + VMBUS_SINT_MESSAGE; 260 orig = rdmsr(sint); --- 73 unchanged lines hidden (view full) --- 334 VMBUS_PCPU_PTR(sc, message_dma, cpu), 335 BUS_DMA_WAITOK | BUS_DMA_ZERO); 336 if (ptr == NULL) 337 return ENOMEM; 338 VMBUS_PCPU_GET(sc, message, cpu) = ptr; 339 340 ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), 341 PAGE_SIZE, 0, PAGE_SIZE, | 253 wrmsr(MSR_HV_SIEFP, val); 254 255 256 /* 257 * Configure and unmask SINT for message and event flags. 258 */ 259 sint = MSR_HV_SINT0 + VMBUS_SINT_MESSAGE; 260 orig = rdmsr(sint); --- 73 unchanged lines hidden (view full) --- 334 VMBUS_PCPU_PTR(sc, message_dma, cpu), 335 BUS_DMA_WAITOK | BUS_DMA_ZERO); 336 if (ptr == NULL) 337 return ENOMEM; 338 VMBUS_PCPU_GET(sc, message, cpu) = ptr; 339 340 ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), 341 PAGE_SIZE, 0, PAGE_SIZE, |
342 VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), | 342 VMBUS_PCPU_PTR(sc, event_flags_dma, cpu), |
343 BUS_DMA_WAITOK | BUS_DMA_ZERO); 344 if (ptr == NULL) 345 return ENOMEM; | 343 BUS_DMA_WAITOK | BUS_DMA_ZERO); 344 if (ptr == NULL) 345 return ENOMEM; |
346 VMBUS_PCPU_GET(sc, event_flag, cpu) = ptr; | 346 VMBUS_PCPU_GET(sc, event_flags, cpu) = ptr; |
347 } 348 return 0; 349} 350 351static void 352vmbus_dma_free(struct vmbus_softc *sc) 353{ 354 int cpu; 355 356 CPU_FOREACH(cpu) { 357 if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) { 358 hyperv_dmamem_free( 359 VMBUS_PCPU_PTR(sc, message_dma, cpu), 360 VMBUS_PCPU_GET(sc, message, cpu)); 361 VMBUS_PCPU_GET(sc, message, cpu) = NULL; 362 } | 347 } 348 return 0; 349} 350 351static void 352vmbus_dma_free(struct vmbus_softc *sc) 353{ 354 int cpu; 355 356 CPU_FOREACH(cpu) { 357 if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) { 358 hyperv_dmamem_free( 359 VMBUS_PCPU_PTR(sc, message_dma, cpu), 360 VMBUS_PCPU_GET(sc, message, cpu)); 361 VMBUS_PCPU_GET(sc, message, cpu) = NULL; 362 } |
363 if (VMBUS_PCPU_GET(sc, event_flag, cpu) != NULL) { | 363 if (VMBUS_PCPU_GET(sc, event_flags, cpu) != NULL) { |
364 hyperv_dmamem_free( | 364 hyperv_dmamem_free( |
365 VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), 366 VMBUS_PCPU_GET(sc, event_flag, cpu)); 367 VMBUS_PCPU_GET(sc, event_flag, cpu) = NULL; | 365 VMBUS_PCPU_PTR(sc, event_flags_dma, cpu), 366 VMBUS_PCPU_GET(sc, event_flags, cpu)); 367 VMBUS_PCPU_GET(sc, event_flags, cpu) = NULL; |
368 } 369 } 370} 371 372static int 373vmbus_intr_setup(struct vmbus_softc *sc) 374{ 375 int cpu; --- 384 unchanged lines hidden --- | 368 } 369 } 370} 371 372static int 373vmbus_intr_setup(struct vmbus_softc *sc) 374{ 375 int cpu; --- 384 unchanged lines hidden --- |