qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

sclp.h (3223B)


      1 /*
      2  * SCLP ASCII access driver
      3  *
      4  * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
      5  *
      6  * This work is licensed under the terms of the GNU GPL, version 2 or (at
      7  * your option) any later version. See the COPYING file in the top-level
      8  * directory.
      9  */
     10 
     11 #ifndef SCLP_H
     12 #define SCLP_H
     13 
     14 /* SCLP command codes */
     15 #define SCLP_CMDW_READ_SCP_INFO                 0x00020001
     16 #define SCLP_CMDW_READ_SCP_INFO_FORCED          0x00120001
     17 #define SCLP_CMD_READ_EVENT_DATA                0x00770005
     18 #define SCLP_CMD_WRITE_EVENT_DATA               0x00760005
     19 #define SCLP_CMD_READ_EVENT_DATA                0x00770005
     20 #define SCLP_CMD_WRITE_EVENT_DATA               0x00760005
     21 #define SCLP_CMD_WRITE_EVENT_MASK               0x00780005
     22 
     23 /* SCLP response codes */
     24 #define SCLP_RC_NORMAL_READ_COMPLETION          0x0010
     25 #define SCLP_RC_NORMAL_COMPLETION               0x0020
     26 #define SCLP_RC_INVALID_SCLP_COMMAND            0x01f0
     27 #define SCLP_RC_CONTAINED_EQUIPMENT_CHECK       0x0340
     28 #define SCLP_RC_INSUFFICIENT_SCCB_LENGTH        0x0300
     29 #define SCLP_RC_INVALID_FUNCTION                0x40f0
     30 #define SCLP_RC_NO_EVENT_BUFFERS_STORED         0x60f0
     31 #define SCLP_RC_INVALID_SELECTION_MASK          0x70f0
     32 #define SCLP_RC_INCONSISTENT_LENGTHS            0x72f0
     33 #define SCLP_RC_EVENT_BUFFER_SYNTAX_ERROR       0x73f0
     34 #define SCLP_RC_INVALID_MASK_LENGTH             0x74f0
     35 
     36 /* Service Call Control Block (SCCB) and its elements */
     37 
     38 #define SCCB_SIZE 4096
     39 
     40 #define SCLP_VARIABLE_LENGTH_RESPONSE           0x80
     41 #define SCLP_EVENT_BUFFER_ACCEPTED              0x80
     42 
     43 #define SCLP_FC_NORMAL_WRITE                    0
     44 
     45 typedef struct SCCBHeader {
     46     uint16_t length;
     47     uint8_t function_code;
     48     uint8_t control_mask[3];
     49     uint16_t response_code;
     50 } __attribute__((packed)) SCCBHeader;
     51 
     52 #define SCCB_DATA_LEN (SCCB_SIZE - sizeof(SCCBHeader))
     53 
     54 typedef struct ReadInfo {
     55     SCCBHeader h;
     56     uint16_t rnmax;
     57     uint8_t rnsize;
     58     uint8_t reserved[13];
     59     uint8_t loadparm[LOADPARM_LEN];
     60 } __attribute__((packed)) ReadInfo;
     61 
     62 typedef struct SCCB {
     63     SCCBHeader h;
     64     char data[SCCB_DATA_LEN];
     65  } __attribute__((packed)) SCCB;
     66 
     67 /* SCLP event types */
     68 #define SCLP_EVENT_ASCII_CONSOLE_DATA           0x1a
     69 #define SCLP_EVENT_SIGNAL_QUIESCE               0x1d
     70 
     71 /* SCLP event masks */
     72 #define SCLP_EVENT_MASK_SIGNAL_QUIESCE          0x00000008
     73 #define SCLP_EVENT_MASK_MSG_ASCII               0x00000040
     74 
     75 #define SCLP_UNCONDITIONAL_READ                 0x00
     76 #define SCLP_SELECTIVE_READ                     0x01
     77 
     78 typedef struct WriteEventMask {
     79     SCCBHeader h;
     80     uint16_t _reserved;
     81     uint16_t mask_length;
     82     uint32_t cp_receive_mask;
     83     uint32_t cp_send_mask;
     84     uint32_t send_mask;
     85     uint32_t receive_mask;
     86 } __attribute__((packed)) WriteEventMask;
     87 
     88 typedef struct EventBufferHeader {
     89     uint16_t length;
     90     uint8_t  type;
     91     uint8_t  flags;
     92     uint16_t _reserved;
     93 } __attribute__((packed)) EventBufferHeader;
     94 
     95 typedef struct WriteEventData {
     96     SCCBHeader h;
     97     EventBufferHeader ebh;
     98     char data[];
     99 } __attribute__((packed)) WriteEventData;
    100 
    101 typedef struct ReadEventData {
    102     SCCBHeader h;
    103     EventBufferHeader ebh;
    104     uint32_t mask;
    105 } __attribute__((packed)) ReadEventData;
    106 
    107 #define __pa(x) (x)
    108 
    109 #endif /* SCLP_H */