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>
14 #include <asm/asm-extable.h>
44 void diag_stat_inc(enum diag_stat_enum nr);
45 void diag_stat_inc_norecursion(enum diag_stat_enum nr);
47 struct hypfs_diag0c_entry;
50 * Diagnose 0c: Pseudo Timer
52 void diag0c(struct hypfs_diag0c_entry *data);
55 * Diagnose 10: Release page range
57 static inline void diag10_range(unsigned long start_pfn, unsigned long num_pfn)
59 unsigned long start_addr, end_addr;
61 start_addr = pfn_to_phys(start_pfn);
62 end_addr = pfn_to_phys(start_pfn + num_pfn - 1);
64 diag_stat_inc(DIAG_STAT_X010);
66 "0: diag %0,%1,0x10\n"
70 : : "a" (start_addr), "a" (end_addr));
74 * Diagnose 14: Input spool file manipulation
76 extern int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode);
79 * Diagnose 210: Get information about a virtual device
82 u16 vrdcdvno; /* device number (input) */
83 u16 vrdclen; /* data block length (input) */
84 u8 vrdcvcla; /* virtual device class (output) */
85 u8 vrdcvtyp; /* virtual device type (output) */
86 u8 vrdcvsta; /* virtual device status (output) */
87 u8 vrdcvfla; /* virtual device flags (output) */
88 u8 vrdcrccl; /* real device class (output) */
89 u8 vrdccrty; /* real device type (output) */
90 u8 vrdccrmd; /* real device model (output) */
91 u8 vrdccrft; /* real device feature (output) */
92 } __packed __aligned(4);
94 extern int diag210(struct diag210 *addr);
102 } __packed __aligned(4);
104 extern int diag8c(struct diag8c *out, struct ccw_dev_id *devno);
106 /* bit is set in flags, when physical cpu info is included in diag 204 data */
107 #define DIAG204_LPAR_PHYS_FLG 0x80
108 #define DIAG204_LPAR_NAME_LEN 8 /* lpar name len in diag 204 data */
109 #define DIAG204_CPU_NAME_LEN 16 /* type name len of cpus in diag224 name table */
111 /* diag 204 subcodes */
113 DIAG204_SUBC_STIB4 = 4,
114 DIAG204_SUBC_RSI = 5,
115 DIAG204_SUBC_STIB6 = 6,
116 DIAG204_SUBC_STIB7 = 7
119 #define DIAG204_SUBCODE_MASK 0xffff
121 /* The two available diag 204 data formats */
122 enum diag204_format {
123 DIAG204_INFO_SIMPLE = 0,
124 DIAG204_INFO_EXT = 0x00010000
127 enum diag204_cpu_flags {
128 DIAG204_CPU_ONLINE = 0x20,
129 DIAG204_CPU_CAPPED = 0x40,
132 struct diag204_info_blk_hdr {
141 struct diag204_x_info_blk_hdr {
152 struct diag204_part_hdr {
156 char part_name[DIAG204_LPAR_NAME_LEN];
159 struct diag204_x_part_hdr {
165 char part_name[DIAG204_LPAR_NAME_LEN];
176 char hardware_group_name[8];
180 struct diag204_cpu_info {
190 struct diag204_x_cpu_info {
207 __u32 group_cpu_type_cap;
211 struct diag204_phys_hdr {
218 struct diag204_x_phys_hdr {
226 struct diag204_phys_cpu {
235 struct diag204_x_phys_cpu {
245 struct diag204_x_part_block {
246 struct diag204_x_part_hdr hdr;
247 struct diag204_x_cpu_info cpus[];
250 struct diag204_x_phys_block {
251 struct diag204_x_phys_hdr hdr;
252 struct diag204_x_phys_cpu cpus[];
256 DIAG26C_PORT_VNIC = 0x00000024,
257 DIAG26C_MAC_SERVICES = 0x00000030
260 enum diag26c_version {
261 DIAG26C_VERSION2 = 0x00000002, /* z/VM 5.4.0 */
262 DIAG26C_VERSION6_VM65918 = 0x00020006 /* z/VM 6.4.0 + VM65918 */
265 #define DIAG26C_VNIC_INFO 0x0002
266 struct diag26c_vnic_req {
274 } __packed __aligned(8);
276 #define VNIC_INFO_PROT_L3 1
277 #define VNIC_INFO_PROT_L2 2
278 /* Note: this is the bare minimum, use it for uninitialized VNICs only. */
279 struct diag26c_vnic_resp {
299 /* 3x device info: */
303 } __packed __aligned(8);
305 #define DIAG26C_GET_MAC 0x0000
306 struct diag26c_mac_req {
314 struct diag26c_mac_resp {
320 #define CPNC_LINUX 0x4
324 unsigned long cpnc : 8;
325 unsigned long cpvc : 56;
329 int diag204(unsigned long subcode, unsigned long size, void *addr);
330 int diag224(void *ptr);
331 int diag26c(void *req, void *resp, enum diag26c_sc subcode);
333 struct hypfs_diag0c_entry;
336 * This structure must contain only pointers/references into
337 * the AMODE31 text section.
340 int (*diag210)(struct diag210 *addr);
341 int (*diag26c)(unsigned long rx, unsigned long rx1, enum diag26c_sc subcode);
342 int (*diag14)(unsigned long rx, unsigned long ry1, unsigned long subcode);
343 int (*diag8c)(struct diag8c *addr, struct ccw_dev_id *devno, size_t len);
344 void (*diag0c)(unsigned long rx);
345 void (*diag308_reset)(void);
348 extern struct diag_ops diag_amode31_ops;
349 extern struct diag210 *__diag210_tmp_amode31;
351 int _diag210_amode31(struct diag210 *addr);
352 int _diag26c_amode31(unsigned long rx, unsigned long rx1, enum diag26c_sc subcode);
353 int _diag14_amode31(unsigned long rx, unsigned long ry1, unsigned long subcode);
354 void _diag0c_amode31(unsigned long rx);
355 void _diag308_reset_amode31(void);
356 int _diag8c_amode31(struct diag8c *addr, struct ccw_dev_id *devno, size_t len);
358 #endif /* _ASM_S390_DIAG_H */