cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

sclp_rw.h (2303B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 * interface to the SCLP-read/write driver
      4 *
      5 * Copyright IBM Corporation 1999, 2009
      6 *
      7 * Author(s): Martin Peschke <mpeschke@de.ibm.com>
      8 *	      Martin Schwidefsky <schwidefsky@de.ibm.com>
      9 */
     10
     11#ifndef __SCLP_RW_H__
     12#define __SCLP_RW_H__
     13
     14#include <linux/list.h>
     15
     16struct mto {
     17	u16 length;
     18	u16 type;
     19	u16 line_type_flags;
     20	u8  alarm_control;
     21	u8  _reserved[3];
     22} __attribute__((packed));
     23
     24struct go {
     25	u16 length;
     26	u16 type;
     27	u32 domid;
     28	u8  hhmmss_time[8];
     29	u8  th_time[3];
     30	u8  reserved_0;
     31	u8  dddyyyy_date[7];
     32	u8  _reserved_1;
     33	u16 general_msg_flags;
     34	u8  _reserved_2[10];
     35	u8  originating_system_name[8];
     36	u8  job_guest_name[8];
     37} __attribute__((packed));
     38
     39struct mdb_header {
     40	u16 length;
     41	u16 type;
     42	u32 tag;
     43	u32 revision_code;
     44} __attribute__((packed));
     45
     46struct mdb {
     47	struct mdb_header header;
     48	struct go go;
     49	struct mto mto;
     50} __attribute__((packed));
     51
     52struct msg_buf {
     53	struct evbuf_header header;
     54	struct mdb mdb;
     55} __attribute__((packed));
     56
     57/* The number of empty mto buffers that can be contained in a single sccb. */
     58#define NR_EMPTY_MSG_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \
     59			sizeof(struct sccb_header)) / sizeof(struct msg_buf))
     60
     61/*
     62 * data structure for information about list of SCCBs (only for writing),
     63 * will be located at the end of a SCCBs page
     64 */
     65struct sclp_buffer {
     66	struct list_head list;		/* list_head for sccb_info chain */
     67	struct sclp_req request;
     68	void *sccb;
     69	struct msg_buf *current_msg;
     70	char *current_line;
     71	int current_length;
     72	int retry_count;
     73	/* output format settings */
     74	unsigned short columns;
     75	unsigned short htab;
     76	/* statistics about this buffer */
     77	unsigned int char_sum;		/* # chars in sccb */
     78	unsigned int messages;		/* # messages in sccb */
     79	/* Callback that is called after reaching final status. */
     80	void (*callback)(struct sclp_buffer *, int);
     81};
     82
     83int sclp_rw_init(void);
     84struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short);
     85void *sclp_unmake_buffer(struct sclp_buffer *);
     86int sclp_buffer_space(struct sclp_buffer *);
     87int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
     88int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
     89unsigned int sclp_chars_in_buffer(struct sclp_buffer *);
     90
     91#endif	/* __SCLP_RW_H__ */