^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright IBM Corp. 2007
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef _ASM_S390_SCLP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define _ASM_S390_SCLP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/chpid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/cpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define SCLP_CHP_INFO_MASK_SIZE 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define SCLP_MAX_CORES 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct sclp_chp_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) u8 standby[SCLP_CHP_INFO_MASK_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) u8 configured[SCLP_CHP_INFO_MASK_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define LOADPARM_LEN 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct sclp_ipl_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int is_valid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int has_dump;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) char loadparm[LOADPARM_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct sclp_core_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) u8 core_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) u8 reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) u8 : 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u8 sief2 : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u8 skey : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u8 : 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u8 : 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) u8 gpere : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) u8 siif : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) u8 sigpif : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u8 : 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) u8 reserved2[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) u8 : 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) u8 ib : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) u8 cei : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) u8 : 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) u8 reserved3[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) u8 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) u8 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct sclp_core_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) unsigned int configured;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) unsigned int standby;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) unsigned int combined;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct sclp_core_entry core[SCLP_MAX_CORES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct sclp_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) unsigned char has_linemode : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) unsigned char has_vt220 : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) unsigned char has_siif : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) unsigned char has_sigpif : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) unsigned char has_core_type : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) unsigned char has_sprp : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) unsigned char has_hvs : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) unsigned char has_esca : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) unsigned char has_sief2 : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) unsigned char has_64bscao : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) unsigned char has_gpere : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) unsigned char has_cmma : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) unsigned char has_gsls : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) unsigned char has_ib : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) unsigned char has_cei : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) unsigned char has_pfmfi : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) unsigned char has_ibs : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) unsigned char has_skey : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) unsigned char has_kss : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) unsigned char has_gisaf : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) unsigned char has_diag318 : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) unsigned char has_sipl : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) unsigned char has_dirq : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) unsigned int ibc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) unsigned int mtid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) unsigned int mtid_cp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) unsigned int mtid_prev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) unsigned long rzm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) unsigned long rnmax;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) unsigned long hamax;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) unsigned int max_cores;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) unsigned long hsa_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) unsigned long facilities;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) unsigned int hmfai;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) extern struct sclp_info sclp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct zpci_report_error_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) u8 version; /* Interface version byte */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) u8 action; /* Action qualifier byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * 0: Adapter Reset Request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * 1: Deconfigure and repair action requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * (OpenCrypto Problem Call Home)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * 2: Informational Report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * (OpenCrypto Successful Diagnostics Execution)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) u16 length; /* Length of Subsequent Data (up to 4K – SCLP header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) u8 data[0]; /* Subsequent Data passed verbatim to SCLP ET 24 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) int sclp_early_read_info(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) int sclp_early_read_storage_info(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int sclp_early_get_core_info(struct sclp_core_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) void sclp_early_detect(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) void sclp_early_printk(const char *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) void __sclp_early_printk(const char *s, unsigned int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) int sclp_early_get_memsize(unsigned long *mem);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) int sclp_early_get_hsa_size(unsigned long *hsa_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) int _sclp_get_core_info(struct sclp_core_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) int sclp_core_configure(u8 core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int sclp_core_deconfigure(u8 core);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) int sclp_sdias_blk_count(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int sclp_chp_configure(struct chp_id chpid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int sclp_chp_deconfigure(struct chp_id chpid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int sclp_chp_read_info(struct sclp_chp_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) int sclp_pci_configure(u32 fid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) int sclp_pci_deconfigure(u32 fid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) int sclp_ap_configure(u32 apid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) int sclp_ap_deconfigure(u32 apid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) int sclp_pci_report(struct zpci_report_error_header *report, u32 fh, u32 fid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) void sclp_ocf_cpc_name_copy(char *dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static inline int sclp_get_core_info(struct sclp_core_info *info, int early)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) if (early)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) return sclp_early_get_core_info(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) return _sclp_get_core_info(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #endif /* _ASM_S390_SCLP_H */