1 /* SPDX-License-Identifier: GPL-2.0 */
3 * s390 diagnose functions
5 * Copyright IBM Corp. 2007
6 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
9 #ifndef _ASM_S390_DIAG_H
10 #define _ASM_S390_DIAG_H
12 #include <linux/if_ether.h>
13 #include <linux/percpu.h>
40 void diag_stat_inc(enum diag_stat_enum nr
);
41 void diag_stat_inc_norecursion(enum diag_stat_enum nr
);
44 * Diagnose 10: Release page range
46 static inline void diag10_range(unsigned long start_pfn
, unsigned long num_pfn
)
48 unsigned long start_addr
, end_addr
;
50 start_addr
= start_pfn
<< PAGE_SHIFT
;
51 end_addr
= (start_pfn
+ num_pfn
- 1) << PAGE_SHIFT
;
53 diag_stat_inc(DIAG_STAT_X010
);
55 "0: diag %0,%1,0x10\n"
59 : : "a" (start_addr
), "a" (end_addr
));
63 * Diagnose 14: Input spool file manipulation
65 extern int diag14(unsigned long rx
, unsigned long ry1
, unsigned long subcode
);
68 * Diagnose 210: Get information about a virtual device
71 u16 vrdcdvno
; /* device number (input) */
72 u16 vrdclen
; /* data block length (input) */
73 u8 vrdcvcla
; /* virtual device class (output) */
74 u8 vrdcvtyp
; /* virtual device type (output) */
75 u8 vrdcvsta
; /* virtual device status (output) */
76 u8 vrdcvfla
; /* virtual device flags (output) */
77 u8 vrdcrccl
; /* real device class (output) */
78 u8 vrdccrty
; /* real device type (output) */
79 u8 vrdccrmd
; /* real device model (output) */
80 u8 vrdccrft
; /* real device feature (output) */
81 } __attribute__((packed
, aligned(4)));
83 extern int diag210(struct diag210
*addr
);
85 /* bit is set in flags, when physical cpu info is included in diag 204 data */
86 #define DIAG204_LPAR_PHYS_FLG 0x80
87 #define DIAG204_LPAR_NAME_LEN 8 /* lpar name len in diag 204 data */
88 #define DIAG204_CPU_NAME_LEN 16 /* type name len of cpus in diag224 name table */
90 /* diag 204 subcodes */
92 DIAG204_SUBC_STIB4
= 4,
94 DIAG204_SUBC_STIB6
= 6,
95 DIAG204_SUBC_STIB7
= 7
98 /* The two available diag 204 data formats */
100 DIAG204_INFO_SIMPLE
= 0,
101 DIAG204_INFO_EXT
= 0x00010000
104 enum diag204_cpu_flags
{
105 DIAG204_CPU_ONLINE
= 0x20,
106 DIAG204_CPU_CAPPED
= 0x40,
109 struct diag204_info_blk_hdr
{
118 struct diag204_x_info_blk_hdr
{
129 struct diag204_part_hdr
{
133 char part_name
[DIAG204_LPAR_NAME_LEN
];
136 struct diag204_x_part_hdr
{
142 char part_name
[DIAG204_LPAR_NAME_LEN
];
153 char hardware_group_name
[8];
157 struct diag204_cpu_info
{
167 struct diag204_x_cpu_info
{
184 __u32 group_cpu_type_cap
;
188 struct diag204_phys_hdr
{
195 struct diag204_x_phys_hdr
{
203 struct diag204_phys_cpu
{
212 struct diag204_x_phys_cpu
{
222 struct diag204_x_part_block
{
223 struct diag204_x_part_hdr hdr
;
224 struct diag204_x_cpu_info cpus
[];
227 struct diag204_x_phys_block
{
228 struct diag204_x_phys_hdr hdr
;
229 struct diag204_x_phys_cpu cpus
[];
233 DIAG26C_PORT_VNIC
= 0x00000024,
234 DIAG26C_MAC_SERVICES
= 0x00000030
237 enum diag26c_version
{
238 DIAG26C_VERSION2
= 0x00000002, /* z/VM 5.4.0 */
239 DIAG26C_VERSION6_VM65918
= 0x00020006 /* z/VM 6.4.0 + VM65918 */
242 #define DIAG26C_VNIC_INFO 0x0002
243 struct diag26c_vnic_req
{
251 } __packed
__aligned(8);
253 #define VNIC_INFO_PROT_L3 1
254 #define VNIC_INFO_PROT_L2 2
255 /* Note: this is the bare minimum, use it for uninitialized VNICs only. */
256 struct diag26c_vnic_resp
{
276 /* 3x device info: */
280 } __packed
__aligned(8);
282 #define DIAG26C_GET_MAC 0x0000
283 struct diag26c_mac_req
{
291 struct diag26c_mac_resp
{
297 #define CPNC_LINUX 0x4
301 unsigned int cpnc
: 8;
302 unsigned int cpvc_linux
: 24;
303 unsigned char cpvc_distro
[3];
308 int diag204(unsigned long subcode
, unsigned long size
, void *addr
);
309 int diag224(void *ptr
);
310 int diag26c(void *req
, void *resp
, enum diag26c_sc subcode
);
312 struct hypfs_diag0c_entry
;
315 int (*diag210
)(struct diag210
*addr
);
316 int (*diag26c
)(void *req
, void *resp
, enum diag26c_sc subcode
);
317 int (*diag14
)(unsigned long rx
, unsigned long ry1
, unsigned long subcode
);
318 void (*diag0c
)(struct hypfs_diag0c_entry
*entry
);
319 void (*diag308_reset
)(void);
322 extern struct diag_ops diag_dma_ops
;
323 extern struct diag210
*__diag210_tmp_dma
;
324 #endif /* _ASM_S390_DIAG_H */