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