Deleted Added
full compact
hyperv.h (307291) hyperv.h (307301)
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

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

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

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

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 * $FreeBSD: stable/11/sys/dev/hyperv/include/hyperv.h 307291 2016-10-14 07:40:04Z sephe $
28 * $FreeBSD: stable/11/sys/dev/hyperv/include/hyperv.h 307301 2016-10-14 07:47:35Z sephe $
29 */
30
31/**
32 * HyperV definitions for messages that are sent between instances of the
33 * Channel Management Library in separate partitions, or in some cases,
34 * back to itself.
35 */
36

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

174 /*
175 * Sub_channel_index, newly added in Win8.
176 */
177 uint16_t sub_channel_index;
178 uint16_t padding;
179
180} __packed hv_vmbus_channel_offer;
181
29 */
30
31/**
32 * HyperV definitions for messages that are sent between instances of the
33 * Channel Management Library in separate partitions, or in some cases,
34 * back to itself.
35 */
36

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

174 /*
175 * Sub_channel_index, newly added in Win8.
176 */
177 uint16_t sub_channel_index;
178 uint16_t padding;
179
180} __packed hv_vmbus_channel_offer;
181
182typedef uint32_t hv_gpadl_handle;
183
184typedef struct {
185 uint16_t type;
186 uint16_t data_offset8;
187 uint16_t length8;
188 uint16_t flags;
189 uint64_t transaction_id;
190} __packed hv_vm_packet_descriptor;
191

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

347 * Query VMBus Version parameters
348 */
349typedef struct {
350 hv_vmbus_channel_msg_header header;
351 uint32_t version;
352} __packed hv_vmbus_channel_query_vmbus_version;
353
354/*
182typedef struct {
183 uint16_t type;
184 uint16_t data_offset8;
185 uint16_t length8;
186 uint16_t flags;
187 uint64_t transaction_id;
188} __packed hv_vm_packet_descriptor;
189

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

345 * Query VMBus Version parameters
346 */
347typedef struct {
348 hv_vmbus_channel_msg_header header;
349 uint32_t version;
350} __packed hv_vmbus_channel_query_vmbus_version;
351
352/*
355 * VMBus Version Supported parameters
356 */
357typedef struct {
358 hv_vmbus_channel_msg_header header;
359 hv_bool_uint8_t version_supported;
360} __packed hv_vmbus_channel_version_supported;
361
362/*
363 * Channel Offer parameters
364 */
365typedef struct {
366 hv_vmbus_channel_msg_header header;
367 hv_vmbus_channel_offer offer;
368 uint32_t child_rel_id;
369 uint8_t monitor_id;
370 /*

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

392 * Rescind Offer parameters
393 */
394typedef struct
395{
396 hv_vmbus_channel_msg_header header;
397 uint32_t child_rel_id;
398} __packed hv_vmbus_channel_rescind_offer;
399
353 * Channel Offer parameters
354 */
355typedef struct {
356 hv_vmbus_channel_msg_header header;
357 hv_vmbus_channel_offer offer;
358 uint32_t child_rel_id;
359 uint8_t monitor_id;
360 /*

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

382 * Rescind Offer parameters
383 */
384typedef struct
385{
386 hv_vmbus_channel_msg_header header;
387 uint32_t child_rel_id;
388} __packed hv_vmbus_channel_rescind_offer;
389
400
401/*
402 * Request Offer -- no parameters, SynIC message contains the partition ID
403 *
404 * Set Snoop -- no parameters, SynIC message contains the partition ID
405 *
406 * Clear Snoop -- no parameters, SynIC message contains the partition ID
407 *
408 * All Offers Delivered -- no parameters, SynIC message contains the
409 * partition ID
410 *
411 * Flush Client -- no parameters, SynIC message contains the partition ID
412 */
413
414
415/*
416 * Open Channel parameters
417 */
418typedef struct
419{
420 hv_vmbus_channel_msg_header header;
421
422 /*
423 * Identifies the specific VMBus channel that is being opened.
424 */
425 uint32_t child_rel_id;
426
427 /*
428 * ID making a particular open request at a channel offer unique.
429 */
430 uint32_t open_id;
431
432 /*
433 * GPADL for the channel's ring buffer.
434 */
435 hv_gpadl_handle ring_buffer_gpadl_handle;
436
437 /*
438 * Before win8, all incoming channel interrupts are only
439 * delivered on cpu 0. Setting this value to 0 would
440 * preserve the earlier behavior.
441 */
442 uint32_t target_vcpu;
443
444 /*
445 * The upstream ring buffer begins at offset zero in the memory described
446 * by ring_buffer_gpadl_handle. The downstream ring buffer follows it at
447 * this offset (in pages).
448 */
449 uint32_t downstream_ring_buffer_page_offset;
450
451 /*
452 * User-specific data to be passed along to the server endpoint.
453 */
454 uint8_t user_data[HV_MAX_USER_DEFINED_BYTES];
455
456} __packed hv_vmbus_channel_open_channel;
457
458typedef uint32_t hv_nt_status;
459
460/*
461 * Open Channel Result parameters
462 */
463typedef struct
464{
465 hv_vmbus_channel_msg_header header;
466 uint32_t child_rel_id;
467 uint32_t open_id;
468 hv_nt_status status;
469} __packed hv_vmbus_channel_open_result;
470
471/*
472 * Close channel parameters
473 */
474typedef struct
475{
476 hv_vmbus_channel_msg_header header;
477 uint32_t child_rel_id;
478} __packed hv_vmbus_channel_close_channel;
479
480/*
481 * Channel Message GPADL
482 */
483#define HV_GPADL_TYPE_RING_BUFFER 1
484#define HV_GPADL_TYPE_SERVER_SAVE_AREA 2
485#define HV_GPADL_TYPE_TRANSACTION 8
486
487/*
488 * The number of PFNs in a GPADL message is defined by the number of pages
489 * that would be spanned by byte_count and byte_offset. If the implied number
490 * of PFNs won't fit in this packet, there will be a follow-up packet that
491 * contains more
492 */
493
494typedef struct {
495 hv_vmbus_channel_msg_header header;
496 uint32_t child_rel_id;
390typedef struct {
391 hv_vmbus_channel_msg_header header;
392 uint32_t child_rel_id;
497 uint32_t gpadl;
498 uint16_t range_buf_len;
499 uint16_t range_count;
500 hv_gpa_range range[0];
501} __packed hv_vmbus_channel_gpadl_header;
502
503/*
504 * This is the follow-up packet that contains more PFNs
505 */
506typedef struct {
507 hv_vmbus_channel_msg_header header;
508 uint32_t message_number;
509 uint32_t gpadl;
510 uint64_t pfn[0];
511} __packed hv_vmbus_channel_gpadl_body;
512
513typedef struct {
514 hv_vmbus_channel_msg_header header;
515 uint32_t child_rel_id;
516 uint32_t gpadl;
517 uint32_t creation_status;
518} __packed hv_vmbus_channel_gpadl_created;
519
520typedef struct {
521 hv_vmbus_channel_msg_header header;
522 uint32_t child_rel_id;
523 uint32_t gpadl;
524} __packed hv_vmbus_channel_gpadl_teardown;
525
526typedef struct {
527 hv_vmbus_channel_msg_header header;
528 uint32_t gpadl;
529} __packed hv_vmbus_channel_gpadl_torndown;
530
531typedef struct {
532 hv_vmbus_channel_msg_header header;
533 uint32_t child_rel_id;
534} __packed hv_vmbus_channel_relid_released;
535
393} __packed hv_vmbus_channel_relid_released;
394
536typedef hv_vmbus_channel_msg_header hv_vmbus_channel_unload;
537
538#define HW_MACADDR_LEN 6
539
395#define HW_MACADDR_LEN 6
396
540/*
541 * Fixme: Added to quiet "typeof" errors involving hv_vmbus.h when
542 * the including C file was compiled with "-std=c99".
543 */
544#ifndef typeof
545#define typeof __typeof
546#endif
547
548#ifndef NULL
549#define NULL (void *)0
550#endif
551
552typedef void *hv_vmbus_handle;
553
554#ifndef CONTAINING_RECORD
555#define CONTAINING_RECORD(address, type, field) ((type *)( \
556 (uint8_t *)(address) - \
557 (uint8_t *)(&((type *)0)->field)))
558#endif /* CONTAINING_RECORD */
559
560
561#define container_of(ptr, type, member) ({ \
562 __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
563 (type *)( (char *)__mptr - offsetof(type,member) );})
564
565enum {
566 HV_VMBUS_IVAR_TYPE,
567 HV_VMBUS_IVAR_INSTANCE,
568 HV_VMBUS_IVAR_NODE,
569 HV_VMBUS_IVAR_DEVCTX
570};
571
572#define HV_VMBUS_ACCESSOR(var, ivar, type) \

--- 341 unchanged lines hidden ---
397enum {
398 HV_VMBUS_IVAR_TYPE,
399 HV_VMBUS_IVAR_INSTANCE,
400 HV_VMBUS_IVAR_NODE,
401 HV_VMBUS_IVAR_DEVCTX
402};
403
404#define HV_VMBUS_ACCESSOR(var, ivar, type) \

--- 341 unchanged lines hidden ---