Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 /* Copyright (C) 2006-2017 Oracle Corporation */
0003 
0004 #ifndef __HGSMI_DEFS_H__
0005 #define __HGSMI_DEFS_H__
0006 
0007 /* Buffer sequence type mask. */
0008 #define HGSMI_BUFFER_HEADER_F_SEQ_MASK     0x03
0009 /* Single buffer, not a part of a sequence. */
0010 #define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE   0x00
0011 /* The first buffer in a sequence. */
0012 #define HGSMI_BUFFER_HEADER_F_SEQ_START    0x01
0013 /* A middle buffer in a sequence. */
0014 #define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02
0015 /* The last buffer in a sequence. */
0016 #define HGSMI_BUFFER_HEADER_F_SEQ_END      0x03
0017 
0018 /* 16 bytes buffer header. */
0019 struct hgsmi_buffer_header {
0020     u32 data_size;      /* Size of data that follows the header. */
0021     u8 flags;       /* HGSMI_BUFFER_HEADER_F_* */
0022     u8 channel;     /* The channel the data must be routed to. */
0023     u16 channel_info;   /* Opaque to the HGSMI, used by the channel. */
0024 
0025     union {
0026         /* Opaque placeholder to make the union 8 bytes. */
0027         u8 header_data[8];
0028 
0029         /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
0030         struct {
0031             u32 reserved1;  /* A reserved field, initialize to 0. */
0032             u32 reserved2;  /* A reserved field, initialize to 0. */
0033         } buffer;
0034 
0035         /* HGSMI_BUFFER_HEADER_F_SEQ_START */
0036         struct {
0037             /* Must be the same for all buffers in the sequence. */
0038             u32 sequence_number;
0039             /* The total size of the sequence. */
0040             u32 sequence_size;
0041         } sequence_start;
0042 
0043         /*
0044          * HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and
0045          * HGSMI_BUFFER_HEADER_F_SEQ_END
0046          */
0047         struct {
0048             /* Must be the same for all buffers in the sequence. */
0049             u32 sequence_number;
0050             /* Data offset in the entire sequence. */
0051             u32 sequence_offset;
0052         } sequence_continue;
0053     } u;
0054 } __packed;
0055 
0056 /* 8 bytes buffer tail. */
0057 struct hgsmi_buffer_tail {
0058     /* Reserved, must be initialized to 0. */
0059     u32 reserved;
0060     /*
0061      * One-at-a-Time Hash: https://www.burtleburtle.net/bob/hash/doobs.html
0062      * Over the header, offset and for first 4 bytes of the tail.
0063      */
0064     u32 checksum;
0065 } __packed;
0066 
0067 /*
0068  * The size of the array of channels. Array indexes are u8.
0069  * Note: the value must not be changed.
0070  */
0071 #define HGSMI_NUMBER_OF_CHANNELS 0x100
0072 
0073 #endif