0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _ASM_S390_DIAG_H
0010 #define _ASM_S390_DIAG_H
0011
0012 #include <linux/if_ether.h>
0013 #include <linux/percpu.h>
0014 #include <asm/asm-extable.h>
0015
0016 enum diag_stat_enum {
0017 DIAG_STAT_X008,
0018 DIAG_STAT_X00C,
0019 DIAG_STAT_X010,
0020 DIAG_STAT_X014,
0021 DIAG_STAT_X044,
0022 DIAG_STAT_X064,
0023 DIAG_STAT_X09C,
0024 DIAG_STAT_X0DC,
0025 DIAG_STAT_X204,
0026 DIAG_STAT_X210,
0027 DIAG_STAT_X224,
0028 DIAG_STAT_X250,
0029 DIAG_STAT_X258,
0030 DIAG_STAT_X26C,
0031 DIAG_STAT_X288,
0032 DIAG_STAT_X2C4,
0033 DIAG_STAT_X2FC,
0034 DIAG_STAT_X304,
0035 DIAG_STAT_X308,
0036 DIAG_STAT_X318,
0037 DIAG_STAT_X500,
0038 NR_DIAG_STAT
0039 };
0040
0041 void diag_stat_inc(enum diag_stat_enum nr);
0042 void diag_stat_inc_norecursion(enum diag_stat_enum nr);
0043
0044
0045
0046
0047 static inline void diag10_range(unsigned long start_pfn, unsigned long num_pfn)
0048 {
0049 unsigned long start_addr, end_addr;
0050
0051 start_addr = pfn_to_phys(start_pfn);
0052 end_addr = pfn_to_phys(start_pfn + num_pfn - 1);
0053
0054 diag_stat_inc(DIAG_STAT_X010);
0055 asm volatile(
0056 "0: diag %0,%1,0x10\n"
0057 "1: nopr %%r7\n"
0058 EX_TABLE(0b, 1b)
0059 EX_TABLE(1b, 1b)
0060 : : "a" (start_addr), "a" (end_addr));
0061 }
0062
0063
0064
0065
0066 extern int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode);
0067
0068
0069
0070
0071 struct diag210 {
0072 u16 vrdcdvno;
0073 u16 vrdclen;
0074 u8 vrdcvcla;
0075 u8 vrdcvtyp;
0076 u8 vrdcvsta;
0077 u8 vrdcvfla;
0078 u8 vrdcrccl;
0079 u8 vrdccrty;
0080 u8 vrdccrmd;
0081 u8 vrdccrft;
0082 } __attribute__((packed, aligned(4)));
0083
0084 extern int diag210(struct diag210 *addr);
0085
0086
0087 #define DIAG204_LPAR_PHYS_FLG 0x80
0088 #define DIAG204_LPAR_NAME_LEN 8
0089 #define DIAG204_CPU_NAME_LEN 16
0090
0091
0092 enum diag204_sc {
0093 DIAG204_SUBC_STIB4 = 4,
0094 DIAG204_SUBC_RSI = 5,
0095 DIAG204_SUBC_STIB6 = 6,
0096 DIAG204_SUBC_STIB7 = 7
0097 };
0098
0099
0100 enum diag204_format {
0101 DIAG204_INFO_SIMPLE = 0,
0102 DIAG204_INFO_EXT = 0x00010000
0103 };
0104
0105 enum diag204_cpu_flags {
0106 DIAG204_CPU_ONLINE = 0x20,
0107 DIAG204_CPU_CAPPED = 0x40,
0108 };
0109
0110 struct diag204_info_blk_hdr {
0111 __u8 npar;
0112 __u8 flags;
0113 __u16 tslice;
0114 __u16 phys_cpus;
0115 __u16 this_part;
0116 __u64 curtod;
0117 } __packed;
0118
0119 struct diag204_x_info_blk_hdr {
0120 __u8 npar;
0121 __u8 flags;
0122 __u16 tslice;
0123 __u16 phys_cpus;
0124 __u16 this_part;
0125 __u64 curtod1;
0126 __u64 curtod2;
0127 char reserved[40];
0128 } __packed;
0129
0130 struct diag204_part_hdr {
0131 __u8 pn;
0132 __u8 cpus;
0133 char reserved[6];
0134 char part_name[DIAG204_LPAR_NAME_LEN];
0135 } __packed;
0136
0137 struct diag204_x_part_hdr {
0138 __u8 pn;
0139 __u8 cpus;
0140 __u8 rcpus;
0141 __u8 pflag;
0142 __u32 mlu;
0143 char part_name[DIAG204_LPAR_NAME_LEN];
0144 char lpc_name[8];
0145 char os_name[8];
0146 __u64 online_cs;
0147 __u64 online_es;
0148 __u8 upid;
0149 __u8 reserved:3;
0150 __u8 mtid:5;
0151 char reserved1[2];
0152 __u32 group_mlu;
0153 char group_name[8];
0154 char hardware_group_name[8];
0155 char reserved2[24];
0156 } __packed;
0157
0158 struct diag204_cpu_info {
0159 __u16 cpu_addr;
0160 char reserved1[2];
0161 __u8 ctidx;
0162 __u8 cflag;
0163 __u16 weight;
0164 __u64 acc_time;
0165 __u64 lp_time;
0166 } __packed;
0167
0168 struct diag204_x_cpu_info {
0169 __u16 cpu_addr;
0170 char reserved1[2];
0171 __u8 ctidx;
0172 __u8 cflag;
0173 __u16 weight;
0174 __u64 acc_time;
0175 __u64 lp_time;
0176 __u16 min_weight;
0177 __u16 cur_weight;
0178 __u16 max_weight;
0179 char reseved2[2];
0180 __u64 online_time;
0181 __u64 wait_time;
0182 __u32 pma_weight;
0183 __u32 polar_weight;
0184 __u32 cpu_type_cap;
0185 __u32 group_cpu_type_cap;
0186 char reserved3[32];
0187 } __packed;
0188
0189 struct diag204_phys_hdr {
0190 char reserved1[1];
0191 __u8 cpus;
0192 char reserved2[6];
0193 char mgm_name[8];
0194 } __packed;
0195
0196 struct diag204_x_phys_hdr {
0197 char reserved1[1];
0198 __u8 cpus;
0199 char reserved2[6];
0200 char mgm_name[8];
0201 char reserved3[80];
0202 } __packed;
0203
0204 struct diag204_phys_cpu {
0205 __u16 cpu_addr;
0206 char reserved1[2];
0207 __u8 ctidx;
0208 char reserved2[3];
0209 __u64 mgm_time;
0210 char reserved3[8];
0211 } __packed;
0212
0213 struct diag204_x_phys_cpu {
0214 __u16 cpu_addr;
0215 char reserved1[2];
0216 __u8 ctidx;
0217 char reserved2[1];
0218 __u16 weight;
0219 __u64 mgm_time;
0220 char reserved3[80];
0221 } __packed;
0222
0223 struct diag204_x_part_block {
0224 struct diag204_x_part_hdr hdr;
0225 struct diag204_x_cpu_info cpus[];
0226 } __packed;
0227
0228 struct diag204_x_phys_block {
0229 struct diag204_x_phys_hdr hdr;
0230 struct diag204_x_phys_cpu cpus[];
0231 } __packed;
0232
0233 enum diag26c_sc {
0234 DIAG26C_PORT_VNIC = 0x00000024,
0235 DIAG26C_MAC_SERVICES = 0x00000030
0236 };
0237
0238 enum diag26c_version {
0239 DIAG26C_VERSION2 = 0x00000002,
0240 DIAG26C_VERSION6_VM65918 = 0x00020006
0241 };
0242
0243 #define DIAG26C_VNIC_INFO 0x0002
0244 struct diag26c_vnic_req {
0245 u32 resp_buf_len;
0246 u32 resp_version;
0247 u16 req_format;
0248 u16 vlan_id;
0249 u64 sys_name;
0250 u8 res[2];
0251 u16 devno;
0252 } __packed __aligned(8);
0253
0254 #define VNIC_INFO_PROT_L3 1
0255 #define VNIC_INFO_PROT_L2 2
0256
0257 struct diag26c_vnic_resp {
0258 u32 version;
0259 u32 entry_cnt;
0260
0261 u32 next_entry;
0262 u64 owner;
0263 u16 devno;
0264 u8 status;
0265 u8 type;
0266 u64 lan_owner;
0267 u64 lan_name;
0268 u64 port_name;
0269 u8 port_type;
0270 u8 ext_status:6;
0271 u8 protocol:2;
0272 u16 base_devno;
0273 u32 port_num;
0274 u32 ifindex;
0275 u32 maxinfo;
0276 u32 dev_count;
0277
0278 u8 dev_info1[28];
0279 u8 dev_info2[28];
0280 u8 dev_info3[28];
0281 } __packed __aligned(8);
0282
0283 #define DIAG26C_GET_MAC 0x0000
0284 struct diag26c_mac_req {
0285 u32 resp_buf_len;
0286 u32 resp_version;
0287 u16 op_code;
0288 u16 devno;
0289 u8 res[4];
0290 };
0291
0292 struct diag26c_mac_resp {
0293 u32 version;
0294 u8 mac[ETH_ALEN];
0295 u8 res[2];
0296 } __aligned(8);
0297
0298 #define CPNC_LINUX 0x4
0299 union diag318_info {
0300 unsigned long val;
0301 struct {
0302 unsigned long cpnc : 8;
0303 unsigned long cpvc : 56;
0304 };
0305 };
0306
0307 int diag204(unsigned long subcode, unsigned long size, void *addr);
0308 int diag224(void *ptr);
0309 int diag26c(void *req, void *resp, enum diag26c_sc subcode);
0310
0311 struct hypfs_diag0c_entry;
0312
0313
0314
0315
0316
0317 struct diag_ops {
0318 int (*diag210)(struct diag210 *addr);
0319 int (*diag26c)(void *req, void *resp, enum diag26c_sc subcode);
0320 int (*diag14)(unsigned long rx, unsigned long ry1, unsigned long subcode);
0321 void (*diag0c)(struct hypfs_diag0c_entry *entry);
0322 void (*diag308_reset)(void);
0323 };
0324
0325 extern struct diag_ops diag_amode31_ops;
0326 extern struct diag210 *__diag210_tmp_amode31;
0327
0328 int _diag210_amode31(struct diag210 *addr);
0329 int _diag26c_amode31(void *req, void *resp, enum diag26c_sc subcode);
0330 int _diag14_amode31(unsigned long rx, unsigned long ry1, unsigned long subcode);
0331 void _diag0c_amode31(struct hypfs_diag0c_entry *entry);
0332 void _diag308_reset_amode31(void);
0333
0334 #endif