18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: MIT */ 28c2ecf20Sopenharmony_ci/* Copyright (C) 2006-2017 Oracle Corporation */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef __HGSMI_DEFS_H__ 58c2ecf20Sopenharmony_ci#define __HGSMI_DEFS_H__ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/* Buffer sequence type mask. */ 88c2ecf20Sopenharmony_ci#define HGSMI_BUFFER_HEADER_F_SEQ_MASK 0x03 98c2ecf20Sopenharmony_ci/* Single buffer, not a part of a sequence. */ 108c2ecf20Sopenharmony_ci#define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE 0x00 118c2ecf20Sopenharmony_ci/* The first buffer in a sequence. */ 128c2ecf20Sopenharmony_ci#define HGSMI_BUFFER_HEADER_F_SEQ_START 0x01 138c2ecf20Sopenharmony_ci/* A middle buffer in a sequence. */ 148c2ecf20Sopenharmony_ci#define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02 158c2ecf20Sopenharmony_ci/* The last buffer in a sequence. */ 168c2ecf20Sopenharmony_ci#define HGSMI_BUFFER_HEADER_F_SEQ_END 0x03 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* 16 bytes buffer header. */ 198c2ecf20Sopenharmony_cistruct hgsmi_buffer_header { 208c2ecf20Sopenharmony_ci u32 data_size; /* Size of data that follows the header. */ 218c2ecf20Sopenharmony_ci u8 flags; /* HGSMI_BUFFER_HEADER_F_* */ 228c2ecf20Sopenharmony_ci u8 channel; /* The channel the data must be routed to. */ 238c2ecf20Sopenharmony_ci u16 channel_info; /* Opaque to the HGSMI, used by the channel. */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci union { 268c2ecf20Sopenharmony_ci /* Opaque placeholder to make the union 8 bytes. */ 278c2ecf20Sopenharmony_ci u8 header_data[8]; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */ 308c2ecf20Sopenharmony_ci struct { 318c2ecf20Sopenharmony_ci u32 reserved1; /* A reserved field, initialize to 0. */ 328c2ecf20Sopenharmony_ci u32 reserved2; /* A reserved field, initialize to 0. */ 338c2ecf20Sopenharmony_ci } buffer; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci /* HGSMI_BUFFER_HEADER_F_SEQ_START */ 368c2ecf20Sopenharmony_ci struct { 378c2ecf20Sopenharmony_ci /* Must be the same for all buffers in the sequence. */ 388c2ecf20Sopenharmony_ci u32 sequence_number; 398c2ecf20Sopenharmony_ci /* The total size of the sequence. */ 408c2ecf20Sopenharmony_ci u32 sequence_size; 418c2ecf20Sopenharmony_ci } sequence_start; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci /* 448c2ecf20Sopenharmony_ci * HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and 458c2ecf20Sopenharmony_ci * HGSMI_BUFFER_HEADER_F_SEQ_END 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_ci struct { 488c2ecf20Sopenharmony_ci /* Must be the same for all buffers in the sequence. */ 498c2ecf20Sopenharmony_ci u32 sequence_number; 508c2ecf20Sopenharmony_ci /* Data offset in the entire sequence. */ 518c2ecf20Sopenharmony_ci u32 sequence_offset; 528c2ecf20Sopenharmony_ci } sequence_continue; 538c2ecf20Sopenharmony_ci } u; 548c2ecf20Sopenharmony_ci} __packed; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* 8 bytes buffer tail. */ 578c2ecf20Sopenharmony_cistruct hgsmi_buffer_tail { 588c2ecf20Sopenharmony_ci /* Reserved, must be initialized to 0. */ 598c2ecf20Sopenharmony_ci u32 reserved; 608c2ecf20Sopenharmony_ci /* 618c2ecf20Sopenharmony_ci * One-at-a-Time Hash: https://www.burtleburtle.net/bob/hash/doobs.html 628c2ecf20Sopenharmony_ci * Over the header, offset and for first 4 bytes of the tail. 638c2ecf20Sopenharmony_ci */ 648c2ecf20Sopenharmony_ci u32 checksum; 658c2ecf20Sopenharmony_ci} __packed; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* 688c2ecf20Sopenharmony_ci * The size of the array of channels. Array indexes are u8. 698c2ecf20Sopenharmony_ci * Note: the value must not be changed. 708c2ecf20Sopenharmony_ci */ 718c2ecf20Sopenharmony_ci#define HGSMI_NUMBER_OF_CHANNELS 0x100 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#endif 74