blob: 3cae9168f63c4f5070fd659ee93ab0c82b6a26a4 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Heiko Carstensab14de62007-02-05 21:18:37 +01002/*
Heiko Carstensab14de62007-02-05 21:18:37 +01003 * Copyright IBM Corp. 2007
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
5 */
6
7#ifndef _ASM_S390_SCLP_H
8#define _ASM_S390_SCLP_H
9
10#include <linux/types.h>
Peter Oberparleitere5854a52007-04-27 16:01:31 +020011#include <asm/chpid.h>
Heiko Carstens9c095232013-11-30 12:00:28 +010012#include <asm/cpu.h>
Heiko Carstensab14de62007-02-05 21:18:37 +010013
Peter Oberparleitere5854a52007-04-27 16:01:31 +020014#define SCLP_CHP_INFO_MASK_SIZE 32
Martin Schwidefskyd08d9432015-06-18 14:23:00 +020015#define SCLP_MAX_CORES 256
Peter Oberparleitere5854a52007-04-27 16:01:31 +020016
17struct sclp_chp_info {
18 u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
19 u8 standby[SCLP_CHP_INFO_MASK_SIZE];
20 u8 configured[SCLP_CHP_INFO_MASK_SIZE];
21};
22
Heiko Carstens05dd2532007-07-10 11:24:09 +020023#define LOADPARM_LEN 8
24
25struct sclp_ipl_info {
26 int is_valid;
27 int has_dump;
28 char loadparm[LOADPARM_LEN];
29};
30
Martin Schwidefskyd08d9432015-06-18 14:23:00 +020031struct sclp_core_entry {
Martin Schwidefsky10ad34b2015-01-14 17:52:10 +010032 u8 core_id;
David Hildenbrand8dfd5232015-02-24 15:51:55 +010033 u8 reserved0;
34 u8 : 4;
35 u8 sief2 : 1;
David Hildenbrand23861452015-11-24 12:56:43 +010036 u8 skey : 1;
37 u8 : 2;
David Hildenbrandb9e28892015-11-24 12:51:52 +010038 u8 : 2;
39 u8 gpere : 1;
Heiko Carstens217a4402013-12-30 12:54:14 +010040 u8 siif : 1;
David Hildenbrandd614be02014-10-14 12:11:02 +020041 u8 sigpif : 1;
42 u8 : 3;
David Hildenbrand72cd82b2015-11-24 12:59:03 +010043 u8 reserved2[3];
44 u8 : 2;
45 u8 ib : 1;
David Hildenbrand4a5c3e02015-11-24 13:00:23 +010046 u8 cei : 1;
47 u8 : 4;
David Hildenbrand72cd82b2015-11-24 12:59:03 +010048 u8 reserved3[6];
Heiko Carstens08d07962008-01-26 14:10:56 +010049 u8 type;
50 u8 reserved1;
51} __attribute__((packed));
52
Martin Schwidefskyd08d9432015-06-18 14:23:00 +020053struct sclp_core_info {
Heiko Carstens08d07962008-01-26 14:10:56 +010054 unsigned int configured;
55 unsigned int standby;
56 unsigned int combined;
Martin Schwidefskyd08d9432015-06-18 14:23:00 +020057 struct sclp_core_entry core[SCLP_MAX_CORES];
Heiko Carstens08d07962008-01-26 14:10:56 +010058};
59
David Hildenbrand37c5f6c2015-05-06 13:18:59 +020060struct sclp_info {
61 unsigned char has_linemode : 1;
62 unsigned char has_vt220 : 1;
63 unsigned char has_siif : 1;
64 unsigned char has_sigpif : 1;
Martin Schwidefskyd08d9432015-06-18 14:23:00 +020065 unsigned char has_core_type : 1;
David Hildenbrand37c5f6c2015-05-06 13:18:59 +020066 unsigned char has_sprp : 1;
Eugene (jno) Dvurechenskif7ba1d32014-10-09 16:04:48 +020067 unsigned char has_hvs : 1;
68 unsigned char has_esca : 1;
David Hildenbrand8dfd5232015-02-24 15:51:55 +010069 unsigned char has_sief2 : 1;
David Hildenbrand4013ade2015-11-24 12:49:43 +010070 unsigned char has_64bscao : 1;
David Hildenbrandb9e28892015-11-24 12:51:52 +010071 unsigned char has_gpere : 1;
David Hildenbrand09be9cb2015-11-24 12:55:35 +010072 unsigned char has_cmma : 1;
David Hildenbrand5236c752015-11-24 12:53:46 +010073 unsigned char has_gsls : 1;
David Hildenbrand72cd82b2015-11-24 12:59:03 +010074 unsigned char has_ib : 1;
David Hildenbrand4a5c3e02015-11-24 13:00:23 +010075 unsigned char has_cei : 1;
David Hildenbranda0eb55e2015-11-24 13:02:25 +010076 unsigned char has_pfmfi : 1;
David Hildenbrand9c375492015-11-24 13:02:52 +010077 unsigned char has_ibs : 1;
David Hildenbrand23861452015-11-24 12:56:43 +010078 unsigned char has_skey : 1;
Farhan Ali71cb1bf2017-02-23 13:39:17 -050079 unsigned char has_kss : 1;
Michael Mueller9e73ea72017-06-12 13:49:28 +020080 unsigned char has_gisaf : 1;
David Hildenbrand37c5f6c2015-05-06 13:18:59 +020081 unsigned int ibc;
82 unsigned int mtid;
83 unsigned int mtid_cp;
84 unsigned int mtid_prev;
Heiko Carstens423d5b32015-12-31 10:07:21 +010085 unsigned long rzm;
86 unsigned long rnmax;
87 unsigned long hamax;
Martin Schwidefskyd08d9432015-06-18 14:23:00 +020088 unsigned int max_cores;
David Hildenbrand37c5f6c2015-05-06 13:18:59 +020089 unsigned long hsa_size;
Heiko Carstens423d5b32015-12-31 10:07:21 +010090 unsigned long facilities;
Alexander Yarygin154fa272016-04-01 15:36:51 +030091 unsigned int hmfai;
David Hildenbrand37c5f6c2015-05-06 13:18:59 +020092};
93extern struct sclp_info sclp;
94
Sebastian Ott12283a42015-11-27 11:18:02 +010095struct zpci_report_error_header {
96 u8 version; /* Interface version byte */
97 u8 action; /* Action qualifier byte
98 * 1: Deconfigure and repair action requested
99 * (OpenCrypto Problem Call Home)
100 * 2: Informational Report
101 * (OpenCrypto Successful Diagnostics Execution)
102 */
103 u16 length; /* Length of Subsequent Data (up to 4K – SCLP header */
104 u8 data[0]; /* Subsequent Data passed verbatim to SCLP ET 24 */
105} __packed;
106
Heiko Carstensd5ab7a32017-01-24 15:58:52 +0100107int sclp_early_get_core_info(struct sclp_core_info *info);
108void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
109void sclp_early_detect(void);
110void sclp_early_printk(const char *s);
111void __sclp_early_printk(const char *s, unsigned int len);
112
Heiko Carstensaf511602016-12-03 09:48:01 +0100113int _sclp_get_core_info(struct sclp_core_info *info);
Martin Schwidefskyd08d9432015-06-18 14:23:00 +0200114int sclp_core_configure(u8 core);
115int sclp_core_deconfigure(u8 core);
Heiko Carstens05dd2532007-07-10 11:24:09 +0200116int sclp_sdias_blk_count(void);
117int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
118int sclp_chp_configure(struct chp_id chpid);
119int sclp_chp_deconfigure(struct chp_id chpid);
120int sclp_chp_read_info(struct sclp_chp_info *info);
Jan Glauber7441b062012-11-29 14:35:47 +0100121int sclp_pci_configure(u32 fid);
122int sclp_pci_deconfigure(u32 fid);
Sebastian Ott12283a42015-11-27 11:18:02 +0100123int sclp_pci_report(struct zpci_report_error_header *report, u32 fh, u32 fid);
Martin Schwidefskydf9694c2015-10-12 10:43:37 +0200124int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count);
125int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count);
Janosch Franke435dc32016-02-08 13:36:22 +0100126void sclp_ocf_cpc_name_copy(char *dst);
Chen Gangfbf87df2015-01-03 17:29:07 +0800127
Heiko Carstensaf511602016-12-03 09:48:01 +0100128static inline int sclp_get_core_info(struct sclp_core_info *info, int early)
129{
130 if (early)
Heiko Carstensd5ab7a32017-01-24 15:58:52 +0100131 return sclp_early_get_core_info(info);
Heiko Carstensaf511602016-12-03 09:48:01 +0100132 return _sclp_get_core_info(info);
133}
134
Heiko Carstensab14de62007-02-05 21:18:37 +0100135#endif /* _ASM_S390_SCLP_H */