aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/ccwdev.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-s390/ccwdev.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-s390/ccwdev.h')
-rw-r--r--include/asm-s390/ccwdev.h192
1 files changed, 192 insertions, 0 deletions
diff --git a/include/asm-s390/ccwdev.h b/include/asm-s390/ccwdev.h
new file mode 100644
index 000000000000..3eb231af5d51
--- /dev/null
+++ b/include/asm-s390/ccwdev.h
@@ -0,0 +1,192 @@
1/*
2 * include/asm-s390/ccwdev.h
3 * include/asm-s390x/ccwdev.h
4 *
5 * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * Interface for CCW device drivers
9 */
10#ifndef _S390_CCWDEV_H_
11#define _S390_CCWDEV_H_
12
13#include <linux/device.h>
14#include <linux/mod_devicetable.h>
15
16/* structs from asm/cio.h */
17struct irb;
18struct ccw1;
19
20/* simplified initializers for struct ccw_device:
21 * CCW_DEVICE and CCW_DEVICE_DEVTYPE initialize one
22 * entry in your MODULE_DEVICE_TABLE and set the match_flag correctly */
23#define CCW_DEVICE(cu, cum) \
24 .cu_type=(cu), .cu_model=(cum), \
25 .match_flags=(CCW_DEVICE_ID_MATCH_CU_TYPE \
26 | (cum ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0))
27
28#define CCW_DEVICE_DEVTYPE(cu, cum, dev, devm) \
29 .cu_type=(cu), .cu_model=(cum), .dev_type=(dev), .dev_model=(devm),\
30 .match_flags=CCW_DEVICE_ID_MATCH_CU_TYPE \
31 | ((cum) ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0) \
32 | CCW_DEVICE_ID_MATCH_DEVICE_TYPE \
33 | ((devm) ? CCW_DEVICE_ID_MATCH_DEVICE_MODEL : 0)
34
35/* scan through an array of device ids and return the first
36 * entry that matches the device.
37 *
38 * the array must end with an entry containing zero match_flags
39 */
40static inline const struct ccw_device_id *
41ccw_device_id_match(const struct ccw_device_id *array,
42 const struct ccw_device_id *match)
43{
44 const struct ccw_device_id *id = array;
45
46 for (id = array; id->match_flags; id++) {
47 if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_TYPE)
48 && (id->cu_type != match->cu_type))
49 continue;
50
51 if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_MODEL)
52 && (id->cu_model != match->cu_model))
53 continue;
54
55 if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_TYPE)
56 && (id->dev_type != match->dev_type))
57 continue;
58
59 if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_MODEL)
60 && (id->dev_model != match->dev_model))
61 continue;
62
63 return id;
64 }
65
66 return 0;
67}
68
69/* The struct ccw device is our replacement for the globally accessible
70 * ioinfo array. ioinfo will mutate into a subchannel device later.
71 *
72 * Reference: Documentation/s390/driver-model.txt */
73struct ccw_device {
74 spinlock_t *ccwlock;
75 struct ccw_device_private *private; /* cio private information */
76 struct ccw_device_id id; /* id of this device, driver_info is
77 set by ccw_find_driver */
78 struct ccw_driver *drv; /* */
79 struct device dev; /* */
80 int online;
81 /* This is sick, but a driver can have different interrupt handlers
82 for different ccw_devices (multi-subchannel drivers)... */
83 void (*handler) (struct ccw_device *, unsigned long, struct irb *);
84};
85
86
87/* Each ccw driver registers with the ccw root bus */
88struct ccw_driver {
89 struct module *owner; /* for automatic MOD_INC_USE_COUNT */
90 struct ccw_device_id *ids; /* probe driver with these devs */
91 int (*probe) (struct ccw_device *); /* ask driver to probe dev */
92 void (*remove) (struct ccw_device *);
93 /* device is no longer available */
94 int (*set_online) (struct ccw_device *);
95 int (*set_offline) (struct ccw_device *);
96 int (*notify) (struct ccw_device *, int);
97 struct device_driver driver; /* higher level structure, don't init
98 this from your driver */
99 char *name;
100};
101
102extern struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv,
103 const char *bus_id);
104
105/* devices drivers call these during module load and unload.
106 * When a driver is registered, its probe method is called
107 * when new devices for its type pop up */
108extern int ccw_driver_register (struct ccw_driver *driver);
109extern void ccw_driver_unregister (struct ccw_driver *driver);
110
111struct ccw1;
112
113extern int ccw_device_set_options(struct ccw_device *, unsigned long);
114
115/* Allow for i/o completion notification after primary interrupt status. */
116#define CCWDEV_EARLY_NOTIFICATION 0x0001
117/* Report all interrupt conditions. */
118#define CCWDEV_REPORT_ALL 0x0002
119/* Try to perform path grouping. */
120#define CCWDEV_DO_PATHGROUP 0x0004
121/* Allow forced onlining of boxed devices. */
122#define CCWDEV_ALLOW_FORCE 0x0008
123
124/*
125 * ccw_device_start()
126 *
127 * Start a S/390 channel program. When the interrupt arrives, the
128 * IRQ handler is called, either immediately, delayed (dev-end missing,
129 * or sense required) or never (no IRQ handler registered).
130 * Depending on the action taken, ccw_device_start() returns:
131 * 0 - Success
132 * -EBUSY - Device busy, or status pending
133 * -ENODEV - Device not operational
134 * -EINVAL - Device invalid for operation
135 */
136extern int ccw_device_start(struct ccw_device *, struct ccw1 *,
137 unsigned long, __u8, unsigned long);
138/*
139 * ccw_device_start_timeout()
140 *
141 * This function notifies the device driver if the channel program has not
142 * completed during the specified time. If a timeout occurs, the channel
143 * program is terminated via xsch(), hsch() or csch().
144 */
145extern int ccw_device_start_timeout(struct ccw_device *, struct ccw1 *,
146 unsigned long, __u8, unsigned long, int);
147/*
148 * ccw_device_start_key()
149 * ccw_device_start_key_timeout()
150 *
151 * Same as ccw_device_start() and ccw_device_start_timeout(), except a
152 * storage key != default key can be provided for the I/O.
153 */
154extern int ccw_device_start_key(struct ccw_device *, struct ccw1 *,
155 unsigned long, __u8, __u8, unsigned long);
156extern int ccw_device_start_timeout_key(struct ccw_device *, struct ccw1 *,
157 unsigned long, __u8, __u8,
158 unsigned long, int);
159
160
161extern int ccw_device_resume(struct ccw_device *);
162extern int ccw_device_halt(struct ccw_device *, unsigned long);
163extern int ccw_device_clear(struct ccw_device *, unsigned long);
164
165extern int read_dev_chars(struct ccw_device *cdev, void **buffer, int length);
166extern int read_conf_data(struct ccw_device *cdev, void **buffer, int *length);
167extern int read_conf_data_lpm(struct ccw_device *cdev, void **buffer,
168 int *length, __u8 lpm);
169
170extern int ccw_device_set_online(struct ccw_device *cdev);
171extern int ccw_device_set_offline(struct ccw_device *cdev);
172
173
174extern struct ciw *ccw_device_get_ciw(struct ccw_device *, __u32 cmd);
175extern __u8 ccw_device_get_path_mask(struct ccw_device *);
176
177#define get_ccwdev_lock(x) (x)->ccwlock
178
179#define to_ccwdev(n) container_of(n, struct ccw_device, dev)
180#define to_ccwdrv(n) container_of(n, struct ccw_driver, driver)
181
182extern struct ccw_device *ccw_device_probe_console(void);
183
184// FIXME: these have to go
185extern int _ccw_device_get_device_number(struct ccw_device *);
186extern int _ccw_device_get_subchannel_number(struct ccw_device *);
187
188extern struct device *s390_root_dev_register(const char *);
189extern void s390_root_dev_unregister(struct device *);
190
191extern void *ccw_device_get_chp_desc(struct ccw_device *, int);
192#endif /* _S390_CCWDEV_H_ */