xref: /qemu/include/hw/s390x/ap-bridge.h (revision d9ce74873a6a5a7c504379857461e4ae64fcf0cd)
1 /*
2  * ap bridge
3  *
4  * Copyright 2018 IBM Corp.
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 HW_S390X_AP_BRIDGE_H
12 #define HW_S390X_AP_BRIDGE_H
13 
14 #define TYPE_AP_BRIDGE "ap-bridge"
15 #define TYPE_AP_BUS "ap-bus"
16 
17 void s390_init_ap(void);
18 
19 typedef struct ChscSeiNt0Res {
20     uint16_t length;
21     uint16_t code;
22     uint8_t reserved1;
23     uint16_t reserved2;
24     uint8_t nt;
25 #define PENDING_EVENT_INFO_BITMASK 0x80;
26     uint8_t flags;
27     uint8_t reserved3;
28     uint8_t rs;
29     uint8_t cc;
30 } QEMU_PACKED ChscSeiNt0Res;
31 
32 #define NT0_RES_RESPONSE_CODE 1
33 #define NT0_RES_NT_DEFAULT    0
34 #define NT0_RES_RS_AP_CHANGE  5
35 #define NT0_RES_CC_AP_CHANGE  3
36 
37 #define EVENT_INFORMATION_NOT_STORED 1
38 #define EVENT_INFORMATION_STORED     0
39 
40 /**
41  * ap_chsc_sei_nt0_get_event - Retrieve the next pending AP config
42  * change event
43  * @res: Pointer to a ChscSeiNt0Res struct to be filled with event
44  * data
45  *
46  * This function checks for any pending AP config change events and,
47  * if present, populates the provided response structure with the
48  * appropriate SEI NT0 fields.
49  *
50  * Return:
51  *   EVENT_INFORMATION_STORED - An event was available and written to @res
52  *   EVENT_INFORMATION_NOT_STORED - No event was available
53  */
54 int ap_chsc_sei_nt0_get_event(void *res);
55 
56 bool ap_chsc_sei_nt0_have_event(void);
57 
58 #endif
59