drm/rockchip: Don't change hdmi reference clock rate
[drm/drm-misc.git] / drivers / s390 / block / dasd_eckd.h
blobf9299bd184ba80098375b06981921844670522bf
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Horst Hummel <Horst.Hummel@de.ibm.com>
5 * Bugreports.to..: <Linux390@de.ibm.com>
6 * Copyright IBM Corp. 1999, 2000
8 */
10 #ifndef DASD_ECKD_H
11 #define DASD_ECKD_H
13 /*****************************************************************************
14 * SECTION: CCW Definitions
15 ****************************************************************************/
16 #define DASD_ECKD_CCW_NOP 0x03
17 #define DASD_ECKD_CCW_WRITE 0x05
18 #define DASD_ECKD_CCW_READ 0x06
19 #define DASD_ECKD_CCW_WRITE_HOME_ADDRESS 0x09
20 #define DASD_ECKD_CCW_READ_HOME_ADDRESS 0x0a
21 #define DASD_ECKD_CCW_WRITE_KD 0x0d
22 #define DASD_ECKD_CCW_READ_KD 0x0e
23 #define DASD_ECKD_CCW_ERASE 0x11
24 #define DASD_ECKD_CCW_READ_COUNT 0x12
25 #define DASD_ECKD_CCW_SLCK 0x14
26 #define DASD_ECKD_CCW_WRITE_RECORD_ZERO 0x15
27 #define DASD_ECKD_CCW_READ_RECORD_ZERO 0x16
28 #define DASD_ECKD_CCW_WRITE_CKD 0x1d
29 #define DASD_ECKD_CCW_READ_CKD 0x1e
30 #define DASD_ECKD_CCW_PSF 0x27
31 #define DASD_ECKD_CCW_SNID 0x34
32 #define DASD_ECKD_CCW_RSSD 0x3e
33 #define DASD_ECKD_CCW_LOCATE_RECORD 0x47
34 #define DASD_ECKD_CCW_LOCATE_RECORD_EXT 0x4b
35 #define DASD_ECKD_CCW_SNSS 0x54
36 #define DASD_ECKD_CCW_DEFINE_EXTENT 0x63
37 #define DASD_ECKD_CCW_WRITE_MT 0x85
38 #define DASD_ECKD_CCW_READ_MT 0x86
39 #define DASD_ECKD_CCW_WRITE_KD_MT 0x8d
40 #define DASD_ECKD_CCW_READ_KD_MT 0x8e
41 #define DASD_ECKD_CCW_READ_COUNT_MT 0x92
42 #define DASD_ECKD_CCW_RELEASE 0x94
43 #define DASD_ECKD_CCW_WRITE_FULL_TRACK 0x95
44 #define DASD_ECKD_CCW_READ_CKD_MT 0x9e
45 #define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d
46 #define DASD_ECKD_CCW_WRITE_TRACK_DATA 0xA5
47 #define DASD_ECKD_CCW_READ_TRACK_DATA 0xA6
48 #define DASD_ECKD_CCW_RESERVE 0xB4
49 #define DASD_ECKD_CCW_READ_TRACK 0xDE
50 #define DASD_ECKD_CCW_PFX 0xE7
51 #define DASD_ECKD_CCW_PFX_READ 0xEA
52 #define DASD_ECKD_CCW_RSCK 0xF9
53 #define DASD_ECKD_CCW_RCD 0xFA
54 #define DASD_ECKD_CCW_DSO 0xF7
56 /* Define Subsystem Function / Orders */
57 #define DSO_ORDER_RAS 0x81
60 * Perform Subsystem Function / Orders
62 #define PSF_ORDER_PRSSD 0x18
63 #define PSF_ORDER_CUIR_RESPONSE 0x1A
64 #define PSF_ORDER_SSC 0x1D
67 * Perform Subsystem Function / Sub-Orders
69 #define PSF_SUBORDER_QHA 0x1C /* Query Host Access */
70 #define PSF_SUBORDER_PPRCEQ 0x50 /* PPRC Extended Query */
71 #define PSF_SUBORDER_VSQ 0x52 /* Volume Storage Query */
72 #define PSF_SUBORDER_LCQ 0x53 /* Logical Configuration Query */
75 * PPRC Extended Query Scopes
77 #define PPRCEQ_SCOPE_4 0x04 /* Scope 4 for PPRC Extended Query */
80 * CUIR response condition codes
82 #define PSF_CUIR_INVALID 0x00
83 #define PSF_CUIR_COMPLETED 0x01
84 #define PSF_CUIR_NOT_SUPPORTED 0x02
85 #define PSF_CUIR_ERROR_IN_REQ 0x03
86 #define PSF_CUIR_DENIED 0x04
87 #define PSF_CUIR_LAST_PATH 0x05
88 #define PSF_CUIR_DEVICE_ONLINE 0x06
89 #define PSF_CUIR_VARY_FAILURE 0x07
90 #define PSF_CUIR_SOFTWARE_FAILURE 0x08
91 #define PSF_CUIR_NOT_RECOGNIZED 0x09
94 * CUIR codes
96 #define CUIR_QUIESCE 0x01
97 #define CUIR_RESUME 0x02
100 * Out-of-space (OOS) Codes
102 #define REPO_WARN 0x01
103 #define REPO_EXHAUST 0x02
104 #define POOL_WARN 0x03
105 #define POOL_EXHAUST 0x04
106 #define REPO_RELIEVE 0x05
107 #define POOL_RELIEVE 0x06
110 * attention message definitions
112 #define ATTENTION_LENGTH_CUIR 0x0e
113 #define ATTENTION_FORMAT_CUIR 0x01
114 #define ATTENTION_LENGTH_OOS 0x10
115 #define ATTENTION_FORMAT_OOS 0x06
117 #define DASD_ECKD_PG_GROUPED 0x10
120 * Size that is reported for large volumes in the old 16-bit no_cyl field
122 #define LV_COMPAT_CYL 0xFFFE
125 #define FCX_MAX_DATA_FACTOR 65536
126 #define DASD_ECKD_RCD_DATA_SIZE 256
128 #define DASD_ECKD_PATH_THRHLD 256
129 #define DASD_ECKD_PATH_INTERVAL 300
132 * Maximum number of blocks to be chained
134 #define DASD_ECKD_MAX_BLOCKS 190
135 #define DASD_ECKD_MAX_BLOCKS_RAW 256
137 /*****************************************************************************
138 * SECTION: Type Definitions
139 ****************************************************************************/
141 struct eckd_count {
142 __u16 cyl;
143 __u16 head;
144 __u8 record;
145 __u8 kl;
146 __u16 dl;
147 } __attribute__ ((packed));
149 struct ch_t {
150 __u16 cyl;
151 __u16 head;
152 } __attribute__ ((packed));
154 struct chr_t {
155 __u16 cyl;
156 __u16 head;
157 __u8 record;
158 } __attribute__ ((packed));
160 struct DE_eckd_data {
161 struct {
162 unsigned char perm:2; /* Permissions on this extent */
163 unsigned char reserved:1;
164 unsigned char seek:2; /* Seek control */
165 unsigned char auth:2; /* Access authorization */
166 unsigned char pci:1; /* PCI Fetch mode */
167 } __attribute__ ((packed)) mask;
168 struct {
169 unsigned char mode:2; /* Architecture mode */
170 unsigned char ckd:1; /* CKD Conversion */
171 unsigned char operation:3; /* Operation mode */
172 unsigned char cfw:1; /* Cache fast write */
173 unsigned char dfw:1; /* DASD fast write */
174 } __attribute__ ((packed)) attributes;
175 __u16 blk_size; /* Blocksize */
176 __u16 fast_write_id;
177 __u8 ga_additional; /* Global Attributes Additional */
178 __u8 ga_extended; /* Global Attributes Extended */
179 struct ch_t beg_ext;
180 struct ch_t end_ext;
181 unsigned long ep_sys_time; /* Ext Parameter - System Time Stamp */
182 __u8 ep_format; /* Extended Parameter format byte */
183 __u8 ep_prio; /* Extended Parameter priority I/O byte */
184 __u8 ep_reserved1; /* Extended Parameter Reserved */
185 __u8 ep_rec_per_track; /* Number of records on a track */
186 __u8 ep_reserved[4]; /* Extended Parameter Reserved */
187 } __attribute__ ((packed));
189 struct LO_eckd_data {
190 struct {
191 unsigned char orientation:2;
192 unsigned char operation:6;
193 } __attribute__ ((packed)) operation;
194 struct {
195 unsigned char last_bytes_used:1;
196 unsigned char reserved:6;
197 unsigned char read_count_suffix:1;
198 } __attribute__ ((packed)) auxiliary;
199 __u8 unused;
200 __u8 count;
201 struct ch_t seek_addr;
202 struct chr_t search_arg;
203 __u8 sector;
204 __u16 length;
205 } __attribute__ ((packed));
207 struct LRE_eckd_data {
208 struct {
209 unsigned char orientation:2;
210 unsigned char operation:6;
211 } __attribute__ ((packed)) operation;
212 struct {
213 unsigned char length_valid:1;
214 unsigned char length_scope:1;
215 unsigned char imbedded_ccw_valid:1;
216 unsigned char check_bytes:2;
217 unsigned char imbedded_count_valid:1;
218 unsigned char reserved:1;
219 unsigned char read_count_suffix:1;
220 } __attribute__ ((packed)) auxiliary;
221 __u8 imbedded_ccw;
222 __u8 count;
223 struct ch_t seek_addr;
224 struct chr_t search_arg;
225 __u8 sector;
226 __u16 length;
227 __u8 imbedded_count;
228 __u8 extended_operation;
229 __u16 extended_parameter_length;
230 __u8 extended_parameter[];
231 } __attribute__ ((packed));
233 /* Prefix data for format 0x00 and 0x01 */
234 struct PFX_eckd_data {
235 unsigned char format;
236 struct {
237 unsigned char define_extent:1;
238 unsigned char time_stamp:1;
239 unsigned char verify_base:1;
240 unsigned char hyper_pav:1;
241 unsigned char reserved:4;
242 } __attribute__ ((packed)) validity;
243 __u8 base_address;
244 __u8 aux;
245 __u8 base_lss;
246 __u8 reserved[7];
247 struct DE_eckd_data define_extent;
248 struct LRE_eckd_data locate_record;
249 } __attribute__ ((packed));
251 struct dasd_eckd_characteristics {
252 __u16 cu_type;
253 struct {
254 unsigned char support:2;
255 unsigned char async:1;
256 unsigned char reserved:1;
257 unsigned char cache_info:1;
258 unsigned char model:3;
259 } __attribute__ ((packed)) cu_model;
260 __u16 dev_type;
261 __u8 dev_model;
262 struct {
263 unsigned char mult_burst:1;
264 unsigned char RT_in_LR:1;
265 unsigned char reserved1:1;
266 unsigned char RD_IN_LR:1;
267 unsigned char reserved2:4;
268 unsigned char reserved3:8;
269 unsigned char defect_wr:1;
270 unsigned char XRC_supported:1;
271 unsigned char PPRC_enabled:1;
272 unsigned char striping:1;
273 unsigned char reserved5:4;
274 unsigned char cfw:1;
275 unsigned char reserved6:2;
276 unsigned char cache:1;
277 unsigned char dual_copy:1;
278 unsigned char dfw:1;
279 unsigned char reset_alleg:1;
280 unsigned char sense_down:1;
281 } __attribute__ ((packed)) facilities;
282 __u8 dev_class;
283 __u8 unit_type;
284 __u16 no_cyl;
285 __u16 trk_per_cyl;
286 __u8 sec_per_trk;
287 __u8 byte_per_track[3];
288 __u16 home_bytes;
289 __u8 formula;
290 union {
291 struct {
292 __u8 f1;
293 __u16 f2;
294 __u16 f3;
295 } __attribute__ ((packed)) f_0x01;
296 struct {
297 __u8 f1;
298 __u8 f2;
299 __u8 f3;
300 __u8 f4;
301 __u8 f5;
302 } __attribute__ ((packed)) f_0x02;
303 } __attribute__ ((packed)) factors;
304 __u16 first_alt_trk;
305 __u16 no_alt_trk;
306 __u16 first_dia_trk;
307 __u16 no_dia_trk;
308 __u16 first_sup_trk;
309 __u16 no_sup_trk;
310 __u8 MDR_ID;
311 __u8 OBR_ID;
312 __u8 director;
313 __u8 rd_trk_set;
314 __u16 max_rec_zero;
315 __u8 reserved1;
316 __u8 RWANY_in_LR;
317 __u8 factor6;
318 __u8 factor7;
319 __u8 factor8;
320 __u8 reserved2[3];
321 __u8 reserved3[6];
322 __u32 long_no_cyl;
323 } __attribute__ ((packed));
325 /* elements of the configuration data */
326 struct dasd_ned {
327 struct {
328 __u8 identifier:2;
329 __u8 token_id:1;
330 __u8 sno_valid:1;
331 __u8 subst_sno:1;
332 __u8 recNED:1;
333 __u8 emuNED:1;
334 __u8 reserved:1;
335 } __attribute__ ((packed)) flags;
336 __u8 descriptor;
337 __u8 dev_class;
338 __u8 reserved;
339 __u8 dev_type[6];
340 __u8 dev_model[3];
341 __u8 HDA_manufacturer[3];
342 struct {
343 __u8 HDA_location[2];
344 __u8 HDA_seqno[12];
345 } serial;
346 __u8 ID;
347 __u8 unit_addr;
348 } __attribute__ ((packed));
350 struct dasd_sneq {
351 struct {
352 __u8 identifier:2;
353 __u8 reserved:6;
354 } __attribute__ ((packed)) flags;
355 __u8 res1;
356 __u16 format;
357 __u8 res2[4]; /* byte 4- 7 */
358 __u8 sua_flags; /* byte 8 */
359 __u8 base_unit_addr; /* byte 9 */
360 __u8 res3[22]; /* byte 10-31 */
361 } __attribute__ ((packed));
363 struct vd_sneq {
364 struct {
365 __u8 identifier:2;
366 __u8 reserved:6;
367 } __attribute__ ((packed)) flags;
368 __u8 res1;
369 __u16 format;
370 __u8 res2[4]; /* byte 4- 7 */
371 __u8 uit[16]; /* byte 8-23 */
372 __u8 res3[8]; /* byte 24-31 */
373 } __attribute__ ((packed));
375 struct dasd_gneq {
376 struct {
377 __u8 identifier:2;
378 __u8 reserved:6;
379 } __attribute__ ((packed)) flags;
380 __u8 record_selector;
381 __u8 reserved[4];
382 struct {
383 __u8 value:2;
384 __u8 number:6;
385 } __attribute__ ((packed)) timeout;
386 __u8 reserved3;
387 __u16 subsystemID;
388 __u8 reserved2[22];
389 } __attribute__ ((packed));
391 struct dasd_rssd_features {
392 char feature[256];
393 } __attribute__((packed));
395 struct dasd_rssd_messages {
396 __u16 length;
397 __u8 format;
398 __u8 code;
399 __u32 message_id;
400 __u8 flags;
401 char messages[4087];
402 } __packed;
405 * Read Subsystem Data - Volume Storage Query
407 struct dasd_rssd_vsq {
408 struct {
409 __u8 tse:1;
410 __u8 space_not_available:1;
411 __u8 ese:1;
412 __u8 unused:5;
413 } __packed vol_info;
414 __u8 unused1;
415 __u16 extent_pool_id;
416 __u8 warn_cap_limit;
417 __u8 warn_cap_guaranteed;
418 __u16 unused2;
419 __u32 limit_capacity;
420 __u32 guaranteed_capacity;
421 __u32 space_allocated;
422 __u32 space_configured;
423 __u32 logical_capacity;
424 } __packed;
427 * Extent Pool Summary
429 struct dasd_ext_pool_sum {
430 __u16 pool_id;
431 __u8 repo_warn_thrshld;
432 __u8 warn_thrshld;
433 struct {
434 __u8 type:1; /* 0 - CKD / 1 - FB */
435 __u8 track_space_efficient:1;
436 __u8 extent_space_efficient:1;
437 __u8 standard_volume:1;
438 __u8 extent_size_valid:1;
439 __u8 capacity_at_warnlevel:1;
440 __u8 pool_oos:1;
441 __u8 unused0:1;
442 __u8 unused1;
443 } __packed flags;
444 struct {
445 __u8 reserved0:1;
446 __u8 size_1G:1;
447 __u8 reserved1:5;
448 __u8 size_16M:1;
449 } __packed extent_size;
450 __u8 unused;
451 } __packed;
454 * Read Subsystem Data-Response - Logical Configuration Query - Header
456 struct dasd_rssd_lcq {
457 __u16 data_length; /* Length of data returned */
458 __u16 pool_count; /* Count of extent pools returned - Max: 448 */
459 struct {
460 __u8 pool_info_valid:1; /* Detailed Information valid */
461 __u8 pool_id_volume:1;
462 __u8 pool_id_cec:1;
463 __u8 unused0:5;
464 __u8 unused1;
465 } __packed header_flags;
466 char sfi_type[6]; /* Storage Facility Image Type (EBCDIC) */
467 char sfi_model[3]; /* Storage Facility Image Model (EBCDIC) */
468 __u8 sfi_seq_num[10]; /* Storage Facility Image Sequence Number */
469 __u8 reserved[7];
470 struct dasd_ext_pool_sum ext_pool_sum[448];
471 } __packed;
473 struct dasd_oos_message {
474 __u16 length;
475 __u8 format;
476 __u8 code;
477 __u8 percentage_empty;
478 __u8 reserved;
479 __u16 ext_pool_id;
480 __u16 token;
481 __u8 unused[6];
482 } __packed;
484 struct dasd_cuir_message {
485 __u16 length;
486 __u8 format;
487 __u8 code;
488 __u32 message_id;
489 __u8 flags;
490 __u8 neq_map[3];
491 __u8 ned_map;
492 __u8 record_selector;
493 } __packed;
495 struct dasd_psf_cuir_response {
496 __u8 order;
497 __u8 flags;
498 __u8 cc;
499 __u8 chpid;
500 __u16 device_nr;
501 __u16 reserved;
502 __u32 message_id;
503 __u64 system_id;
504 __u8 cssid;
505 __u8 ssid;
506 } __packed;
508 struct dasd_ckd_path_group_entry {
509 __u8 status_flags;
510 __u8 pgid[11];
511 __u8 sysplex_name[8];
512 __u32 timestamp;
513 __u32 cylinder;
514 __u8 reserved[4];
515 } __packed;
517 struct dasd_ckd_host_information {
518 __u8 access_flags;
519 __u8 entry_size;
520 __u16 entry_count;
521 __u8 entry[16390];
522 } __packed;
524 struct dasd_psf_query_host_access {
525 __u8 access_flag;
526 __u8 version;
527 __u16 CKD_length;
528 __u16 SCSI_length;
529 __u8 unused[10];
530 __u8 host_access_information[16394];
531 } __packed;
534 * Perform Subsystem Function - Prepare for Read Subsystem Data
536 struct dasd_psf_prssd_data {
537 unsigned char order;
538 unsigned char flags;
539 unsigned char reserved1;
540 unsigned char reserved2;
541 unsigned char lss;
542 unsigned char volume;
543 unsigned char suborder;
544 unsigned char varies[5];
545 } __attribute__ ((packed));
548 * Perform Subsystem Function - Set Subsystem Characteristics
550 struct dasd_psf_ssc_data {
551 unsigned char order;
552 unsigned char flags;
553 unsigned char cu_type[4];
554 unsigned char suborder;
555 unsigned char reserved[59];
556 } __attribute__((packed));
558 /* Maximum number of extents for a single Release Allocated Space command */
559 #define DASD_ECKD_RAS_EXTS_MAX 110U
561 struct dasd_dso_ras_ext_range {
562 struct ch_t beg_ext;
563 struct ch_t end_ext;
564 } __packed;
567 * Define Subsystem Operation - Release Allocated Space
569 struct dasd_dso_ras_data {
570 __u8 order;
571 struct {
572 __u8 message:1; /* Must be zero */
573 __u8 reserved1:2;
574 __u8 vol_type:1; /* 0 - CKD/FBA, 1 - FB */
575 __u8 reserved2:4;
576 } __packed flags;
577 /* Operation Flags to specify scope */
578 struct {
579 __u8 reserved1:2;
580 /* Release Space by Extent */
581 __u8 by_extent:1; /* 0 - entire volume, 1 - specified extents */
582 __u8 guarantee_init:1;
583 __u8 force_release:1; /* Internal - will be ignored */
584 __u16 reserved2:11;
585 } __packed op_flags;
586 __u8 lss;
587 __u8 dev_addr;
588 __u32 reserved1;
589 __u8 reserved2[10];
590 __u16 nr_exts; /* Defines number of ext_scope - max 110 */
591 __u16 reserved3;
592 } __packed;
596 * some structures and definitions for alias handling
598 struct dasd_unit_address_configuration {
599 struct {
600 char ua_type;
601 char base_ua;
602 } unit[256];
603 } __attribute__((packed));
606 #define MAX_DEVICES_PER_LCU 256
608 /* flags on the LCU */
609 #define NEED_UAC_UPDATE 0x01
610 #define UPDATE_PENDING 0x02
612 enum pavtype {NO_PAV, BASE_PAV, HYPER_PAV};
615 struct alias_root {
616 struct list_head serverlist;
617 spinlock_t lock;
620 struct alias_server {
621 struct list_head server;
622 struct dasd_uid uid;
623 struct list_head lculist;
626 struct summary_unit_check_work_data {
627 char reason;
628 struct dasd_device *device;
629 struct work_struct worker;
632 struct read_uac_work_data {
633 struct dasd_device *device;
634 struct delayed_work dwork;
637 struct alias_lcu {
638 struct list_head lcu;
639 struct dasd_uid uid;
640 enum pavtype pav;
641 char flags;
642 spinlock_t lock;
643 struct list_head grouplist;
644 struct list_head active_devices;
645 struct list_head inactive_devices;
646 struct dasd_unit_address_configuration *uac;
647 struct summary_unit_check_work_data suc_data;
648 struct read_uac_work_data ruac_data;
649 struct dasd_ccw_req *rsu_cqr;
650 struct completion lcu_setup;
653 struct alias_pav_group {
654 struct list_head group;
655 struct dasd_uid uid;
656 struct alias_lcu *lcu;
657 struct list_head baselist;
658 struct list_head aliaslist;
659 struct dasd_device *next;
662 struct dasd_conf_data {
663 struct dasd_ned neds[5];
664 u8 reserved[64];
665 struct dasd_gneq gneq;
666 } __packed;
668 struct dasd_conf {
669 u8 *data;
670 int len;
671 /* pointers to specific parts in the conf_data */
672 struct dasd_ned *ned;
673 struct dasd_sneq *sneq;
674 struct vd_sneq *vdsneq;
675 struct dasd_gneq *gneq;
678 struct dasd_eckd_private {
679 struct dasd_eckd_characteristics rdc_data;
680 struct dasd_conf conf;
682 struct eckd_count count_area[5];
683 int init_cqr_status;
684 int uses_cdl;
685 struct attrib_data_t attrib; /* e.g. cache operations */
686 struct dasd_rssd_features features;
687 struct dasd_rssd_vsq vsq;
688 struct dasd_ext_pool_sum eps;
689 u32 real_cyl;
691 /* alias management */
692 struct dasd_uid uid;
693 struct alias_pav_group *pavgroup;
694 struct alias_lcu *lcu;
695 int count;
697 u32 fcx_max_data;
698 char suc_reason;
703 int dasd_alias_make_device_known_to_lcu(struct dasd_device *);
704 void dasd_alias_disconnect_device_from_lcu(struct dasd_device *);
705 int dasd_alias_add_device(struct dasd_device *);
706 int dasd_alias_remove_device(struct dasd_device *);
707 struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *);
708 void dasd_alias_handle_summary_unit_check(struct work_struct *);
709 void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *);
710 int dasd_alias_update_add_device(struct dasd_device *);
711 #endif /* DASD_ECKD_H */