Home | History | Annotate | Line # | Download | only in vboxvideo
      1 /*	$NetBSD: hgsmi_defs.h,v 1.2 2021/12/18 23:45:44 riastradh Exp $	*/
      2 
      3 /* SPDX-License-Identifier: MIT */
      4 /* Copyright (C) 2006-2017 Oracle Corporation */
      5 
      6 #ifndef __HGSMI_DEFS_H__
      7 #define __HGSMI_DEFS_H__
      8 
      9 /* Buffer sequence type mask. */
     10 #define HGSMI_BUFFER_HEADER_F_SEQ_MASK     0x03
     11 /* Single buffer, not a part of a sequence. */
     12 #define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE   0x00
     13 /* The first buffer in a sequence. */
     14 #define HGSMI_BUFFER_HEADER_F_SEQ_START    0x01
     15 /* A middle buffer in a sequence. */
     16 #define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02
     17 /* The last buffer in a sequence. */
     18 #define HGSMI_BUFFER_HEADER_F_SEQ_END      0x03
     19 
     20 /* 16 bytes buffer header. */
     21 struct hgsmi_buffer_header {
     22 	u32 data_size;		/* Size of data that follows the header. */
     23 	u8 flags;		/* HGSMI_BUFFER_HEADER_F_* */
     24 	u8 channel;		/* The channel the data must be routed to. */
     25 	u16 channel_info;	/* Opaque to the HGSMI, used by the channel. */
     26 
     27 	union {
     28 		/* Opaque placeholder to make the union 8 bytes. */
     29 		u8 header_data[8];
     30 
     31 		/* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
     32 		struct {
     33 			u32 reserved1;	/* A reserved field, initialize to 0. */
     34 			u32 reserved2;	/* A reserved field, initialize to 0. */
     35 		} buffer;
     36 
     37 		/* HGSMI_BUFFER_HEADER_F_SEQ_START */
     38 		struct {
     39 			/* Must be the same for all buffers in the sequence. */
     40 			u32 sequence_number;
     41 			/* The total size of the sequence. */
     42 			u32 sequence_size;
     43 		} sequence_start;
     44 
     45 		/*
     46 		 * HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and
     47 		 * HGSMI_BUFFER_HEADER_F_SEQ_END
     48 		 */
     49 		struct {
     50 			/* Must be the same for all buffers in the sequence. */
     51 			u32 sequence_number;
     52 			/* Data offset in the entire sequence. */
     53 			u32 sequence_offset;
     54 		} sequence_continue;
     55 	} u;
     56 } __packed;
     57 
     58 /* 8 bytes buffer tail. */
     59 struct hgsmi_buffer_tail {
     60 	/* Reserved, must be initialized to 0. */
     61 	u32 reserved;
     62 	/*
     63 	 * One-at-a-Time Hash: http://www.burtleburtle.net/bob/hash/doobs.html
     64 	 * Over the header, offset and for first 4 bytes of the tail.
     65 	 */
     66 	u32 checksum;
     67 } __packed;
     68 
     69 /*
     70  * The size of the array of channels. Array indexes are u8.
     71  * Note: the value must not be changed.
     72  */
     73 #define HGSMI_NUMBER_OF_CHANNELS 0x100
     74 
     75 #endif
     76