Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 2 | /* |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 3 | * 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 Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 11 | #include <asm/chpid.h> |
Heiko Carstens | 9c09523 | 2013-11-30 12:00:28 +0100 | [diff] [blame] | 12 | #include <asm/cpu.h> |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 13 | |
Peter Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 14 | #define SCLP_CHP_INFO_MASK_SIZE 32 |
Martin Schwidefsky | d08d943 | 2015-06-18 14:23:00 +0200 | [diff] [blame] | 15 | #define SCLP_MAX_CORES 256 |
Peter Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 16 | |
| 17 | struct 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 Carstens | 05dd253 | 2007-07-10 11:24:09 +0200 | [diff] [blame] | 23 | #define LOADPARM_LEN 8 |
| 24 | |
| 25 | struct sclp_ipl_info { |
| 26 | int is_valid; |
| 27 | int has_dump; |
| 28 | char loadparm[LOADPARM_LEN]; |
| 29 | }; |
| 30 | |
Martin Schwidefsky | d08d943 | 2015-06-18 14:23:00 +0200 | [diff] [blame] | 31 | struct sclp_core_entry { |
Martin Schwidefsky | 10ad34b | 2015-01-14 17:52:10 +0100 | [diff] [blame] | 32 | u8 core_id; |
David Hildenbrand | 8dfd523 | 2015-02-24 15:51:55 +0100 | [diff] [blame] | 33 | u8 reserved0; |
| 34 | u8 : 4; |
| 35 | u8 sief2 : 1; |
David Hildenbrand | 2386145 | 2015-11-24 12:56:43 +0100 | [diff] [blame] | 36 | u8 skey : 1; |
| 37 | u8 : 2; |
David Hildenbrand | b9e2889 | 2015-11-24 12:51:52 +0100 | [diff] [blame] | 38 | u8 : 2; |
| 39 | u8 gpere : 1; |
Heiko Carstens | 217a440 | 2013-12-30 12:54:14 +0100 | [diff] [blame] | 40 | u8 siif : 1; |
David Hildenbrand | d614be0 | 2014-10-14 12:11:02 +0200 | [diff] [blame] | 41 | u8 sigpif : 1; |
| 42 | u8 : 3; |
David Hildenbrand | 72cd82b | 2015-11-24 12:59:03 +0100 | [diff] [blame] | 43 | u8 reserved2[3]; |
| 44 | u8 : 2; |
| 45 | u8 ib : 1; |
David Hildenbrand | 4a5c3e0 | 2015-11-24 13:00:23 +0100 | [diff] [blame] | 46 | u8 cei : 1; |
| 47 | u8 : 4; |
David Hildenbrand | 72cd82b | 2015-11-24 12:59:03 +0100 | [diff] [blame] | 48 | u8 reserved3[6]; |
Heiko Carstens | 08d0796 | 2008-01-26 14:10:56 +0100 | [diff] [blame] | 49 | u8 type; |
| 50 | u8 reserved1; |
| 51 | } __attribute__((packed)); |
| 52 | |
Martin Schwidefsky | d08d943 | 2015-06-18 14:23:00 +0200 | [diff] [blame] | 53 | struct sclp_core_info { |
Heiko Carstens | 08d0796 | 2008-01-26 14:10:56 +0100 | [diff] [blame] | 54 | unsigned int configured; |
| 55 | unsigned int standby; |
| 56 | unsigned int combined; |
Martin Schwidefsky | d08d943 | 2015-06-18 14:23:00 +0200 | [diff] [blame] | 57 | struct sclp_core_entry core[SCLP_MAX_CORES]; |
Heiko Carstens | 08d0796 | 2008-01-26 14:10:56 +0100 | [diff] [blame] | 58 | }; |
| 59 | |
David Hildenbrand | 37c5f6c | 2015-05-06 13:18:59 +0200 | [diff] [blame] | 60 | struct 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 Schwidefsky | d08d943 | 2015-06-18 14:23:00 +0200 | [diff] [blame] | 65 | unsigned char has_core_type : 1; |
David Hildenbrand | 37c5f6c | 2015-05-06 13:18:59 +0200 | [diff] [blame] | 66 | unsigned char has_sprp : 1; |
Eugene (jno) Dvurechenski | f7ba1d3 | 2014-10-09 16:04:48 +0200 | [diff] [blame] | 67 | unsigned char has_hvs : 1; |
| 68 | unsigned char has_esca : 1; |
David Hildenbrand | 8dfd523 | 2015-02-24 15:51:55 +0100 | [diff] [blame] | 69 | unsigned char has_sief2 : 1; |
David Hildenbrand | 4013ade | 2015-11-24 12:49:43 +0100 | [diff] [blame] | 70 | unsigned char has_64bscao : 1; |
David Hildenbrand | b9e2889 | 2015-11-24 12:51:52 +0100 | [diff] [blame] | 71 | unsigned char has_gpere : 1; |
David Hildenbrand | 09be9cb | 2015-11-24 12:55:35 +0100 | [diff] [blame] | 72 | unsigned char has_cmma : 1; |
David Hildenbrand | 5236c75 | 2015-11-24 12:53:46 +0100 | [diff] [blame] | 73 | unsigned char has_gsls : 1; |
David Hildenbrand | 72cd82b | 2015-11-24 12:59:03 +0100 | [diff] [blame] | 74 | unsigned char has_ib : 1; |
David Hildenbrand | 4a5c3e0 | 2015-11-24 13:00:23 +0100 | [diff] [blame] | 75 | unsigned char has_cei : 1; |
David Hildenbrand | a0eb55e | 2015-11-24 13:02:25 +0100 | [diff] [blame] | 76 | unsigned char has_pfmfi : 1; |
David Hildenbrand | 9c37549 | 2015-11-24 13:02:52 +0100 | [diff] [blame] | 77 | unsigned char has_ibs : 1; |
David Hildenbrand | 2386145 | 2015-11-24 12:56:43 +0100 | [diff] [blame] | 78 | unsigned char has_skey : 1; |
Farhan Ali | 71cb1bf | 2017-02-23 13:39:17 -0500 | [diff] [blame] | 79 | unsigned char has_kss : 1; |
Michael Mueller | 9e73ea7 | 2017-06-12 13:49:28 +0200 | [diff] [blame] | 80 | unsigned char has_gisaf : 1; |
David Hildenbrand | 37c5f6c | 2015-05-06 13:18:59 +0200 | [diff] [blame] | 81 | unsigned int ibc; |
| 82 | unsigned int mtid; |
| 83 | unsigned int mtid_cp; |
| 84 | unsigned int mtid_prev; |
Heiko Carstens | 423d5b3 | 2015-12-31 10:07:21 +0100 | [diff] [blame] | 85 | unsigned long rzm; |
| 86 | unsigned long rnmax; |
| 87 | unsigned long hamax; |
Martin Schwidefsky | d08d943 | 2015-06-18 14:23:00 +0200 | [diff] [blame] | 88 | unsigned int max_cores; |
David Hildenbrand | 37c5f6c | 2015-05-06 13:18:59 +0200 | [diff] [blame] | 89 | unsigned long hsa_size; |
Heiko Carstens | 423d5b3 | 2015-12-31 10:07:21 +0100 | [diff] [blame] | 90 | unsigned long facilities; |
Alexander Yarygin | 154fa27 | 2016-04-01 15:36:51 +0300 | [diff] [blame] | 91 | unsigned int hmfai; |
David Hildenbrand | 37c5f6c | 2015-05-06 13:18:59 +0200 | [diff] [blame] | 92 | }; |
| 93 | extern struct sclp_info sclp; |
| 94 | |
Sebastian Ott | 12283a4 | 2015-11-27 11:18:02 +0100 | [diff] [blame] | 95 | struct 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 Carstens | d5ab7a3 | 2017-01-24 15:58:52 +0100 | [diff] [blame] | 107 | int sclp_early_get_core_info(struct sclp_core_info *info); |
| 108 | void sclp_early_get_ipl_info(struct sclp_ipl_info *info); |
| 109 | void sclp_early_detect(void); |
| 110 | void sclp_early_printk(const char *s); |
| 111 | void __sclp_early_printk(const char *s, unsigned int len); |
| 112 | |
Heiko Carstens | af51160 | 2016-12-03 09:48:01 +0100 | [diff] [blame] | 113 | int _sclp_get_core_info(struct sclp_core_info *info); |
Martin Schwidefsky | d08d943 | 2015-06-18 14:23:00 +0200 | [diff] [blame] | 114 | int sclp_core_configure(u8 core); |
| 115 | int sclp_core_deconfigure(u8 core); |
Heiko Carstens | 05dd253 | 2007-07-10 11:24:09 +0200 | [diff] [blame] | 116 | int sclp_sdias_blk_count(void); |
| 117 | int sclp_sdias_copy(void *dest, int blk_num, int nr_blks); |
| 118 | int sclp_chp_configure(struct chp_id chpid); |
| 119 | int sclp_chp_deconfigure(struct chp_id chpid); |
| 120 | int sclp_chp_read_info(struct sclp_chp_info *info); |
Jan Glauber | 7441b06 | 2012-11-29 14:35:47 +0100 | [diff] [blame] | 121 | int sclp_pci_configure(u32 fid); |
| 122 | int sclp_pci_deconfigure(u32 fid); |
Sebastian Ott | 12283a4 | 2015-11-27 11:18:02 +0100 | [diff] [blame] | 123 | int sclp_pci_report(struct zpci_report_error_header *report, u32 fh, u32 fid); |
Martin Schwidefsky | df9694c | 2015-10-12 10:43:37 +0200 | [diff] [blame] | 124 | int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count); |
| 125 | int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count); |
Janosch Frank | e435dc3 | 2016-02-08 13:36:22 +0100 | [diff] [blame] | 126 | void sclp_ocf_cpc_name_copy(char *dst); |
Chen Gang | fbf87df | 2015-01-03 17:29:07 +0800 | [diff] [blame] | 127 | |
Heiko Carstens | af51160 | 2016-12-03 09:48:01 +0100 | [diff] [blame] | 128 | static inline int sclp_get_core_info(struct sclp_core_info *info, int early) |
| 129 | { |
| 130 | if (early) |
Heiko Carstens | d5ab7a3 | 2017-01-24 15:58:52 +0100 | [diff] [blame] | 131 | return sclp_early_get_core_info(info); |
Heiko Carstens | af51160 | 2016-12-03 09:48:01 +0100 | [diff] [blame] | 132 | return _sclp_get_core_info(info); |
| 133 | } |
| 134 | |
Heiko Carstens | ab14de6 | 2007-02-05 21:18:37 +0100 | [diff] [blame] | 135 | #endif /* _ASM_S390_SCLP_H */ |