1/*
2 * File...........: linux/drivers/s390/block/dasd.c
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Bugreports.to..: <Linux390@de.ibm.com>
5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
6 *
7 * This file is the interface of the DASD device driver, which is exported to user space
8 * any future changes wrt the API will result in a change of the APIVERSION reported
9 * to userspace by the DASDAPIVER-ioctl
10 *
11 * History of changes (starts July 2000)
12 * 05/04/01 created by moving the kernel interface to drivers/s390/block/dasd_int.h
13 */
14
15#ifndef DASD_H
16#define DASD_H
17#include <linux/ioctl.h>
18
19#define DASD_IOCTL_LETTER 'D'
20
21#if DASD_API_VERSION == 0
22
23#define DASD_PARTN_BITS 2
24
25/*
26 * struct profile_info_t
27 * holds the profinling information
28 */
29typedef struct dasd_profile_info_t {
30        unsigned int dasd_io_reqs;	 /* number of requests processed at all */
31        unsigned int dasd_io_sects;	 /* number of sectors processed at all */
32        unsigned int dasd_io_secs[32];	 /* histogram of request's sizes */
33        unsigned int dasd_io_times[32];	 /* histogram of requests's times */
34        unsigned int dasd_io_timps[32];	 /* histogram of requests's times per sector */
35        unsigned int dasd_io_time1[32];	 /* histogram of time from build to start */
36        unsigned int dasd_io_time2[32];	 /* histogram of time from start to irq */
37        unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
38        unsigned int dasd_io_time3[32];	 /* histogram of time from irq to end */
39        unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
40} dasd_profile_info_t;
41
42/*
43 * struct format_data_t
44 * represents all data necessary to format a dasd
45 */
46typedef struct format_data_t {
47	int start_unit; /* from track */
48	int stop_unit;  /* to track */
49	int blksize;    /* sectorsize */
50        int intensity;
51} format_data_t;
52
53/*
54 * values to be used for format_data_t.intensity
55 * 0/8: normal format
56 * 1/9: also write record zero
57 * 3/11: also write home address
58 * 4/12: invalidate track
59 */
60#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
61#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
62#define DASD_FMT_INT_INVAL  4 /* invalidate tracks */
63#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
64
65/*
66 * struct dasd_information_t
67 * represents any data about the data, which is visible to userspace
68 */
69typedef struct dasd_information_t {
70        unsigned int devno; /* S/390 devno */
71        unsigned int real_devno; /* for aliases */
72        unsigned int schid; /* S/390 subchannel identifier */
73        unsigned int cu_type  : 16; /* from SenseID */
74        unsigned int cu_model :  8; /* from SenseID */
75        unsigned int dev_type : 16; /* from SenseID */
76        unsigned int dev_model : 8; /* from SenseID */
77        unsigned int open_count;
78        unsigned int req_queue_len;
79        unsigned int chanq_len;
80        char type[4]; /* from discipline.name, 'none' for unknown */
81        unsigned int status; /* current device level */
82        unsigned int label_block; /* where to find the VOLSER */
83        unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
84        unsigned int characteristics_size;
85        unsigned int confdata_size;
86        char characteristics[64]; /* from read_device_characteristics */
87        char configuration_data[256]; /* from read_configuration_data */
88} dasd_information_t;
89
90/* Disable the volume (for Linux) */
91#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
92/* Enable the volume (for Linux) */
93#define BIODASDENABLE  _IO(DASD_IOCTL_LETTER,1)
94/* Issue a reserve/release command, rsp. */
95#define BIODASDRSRV    _IO(DASD_IOCTL_LETTER,2) /* reserve */
96#define BIODASDRLSE    _IO(DASD_IOCTL_LETTER,3) /* release */
97#define BIODASDSLCK    _IO(DASD_IOCTL_LETTER,4) /* steal lock */
98/* reset profiling information of a device */
99#define BIODASDPRRST   _IO(DASD_IOCTL_LETTER,5)
100/* retrieve API version number */
101#define DASDAPIVER     _IOR(DASD_IOCTL_LETTER,0,int)
102/* Get information on a dasd device */
103#define BIODASDINFO    _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
104/* retrieve profiling information of a device */
105#define BIODASDPRRD    _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
106/* #define BIODASDFORMAT  _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
107#define BIODASDFMT     _IOW(DASD_IOCTL_LETTER,1,format_data_t)
108#endif /* DASD_API_VERSION */
109#endif				/* DASD_H */
110
111/*
112 * Overrides for Emacs so that we follow Linus's tabbing style.
113 * Emacs will notice this stuff at the end of the file and automatically
114 * adjust the settings for this buffer only.  This must remain at the end
115 * of the file.
116 * ---------------------------------------------------------------------------
117 * Local variables:
118 * c-indent-level: 4
119 * c-brace-imaginary-offset: 0
120 * c-brace-offset: -4
121 * c-argdecl-indent: 4
122 * c-label-offset: -4
123 * c-continued-statement-offset: 4
124 * c-continued-brace-offset: 0
125 * indent-tabs-mode: nil
126 * tab-width: 8
127 * End:
128 */
129