1===================================
2Writing s390 channel device drivers
3===================================
4
5:Author: Cornelia Huck
6
7Introduction
8============
9
10This document describes the interfaces available for device drivers that
11drive s390 based channel attached I/O devices. This includes interfaces
12for interaction with the hardware and interfaces for interacting with
13the common driver core. Those interfaces are provided by the s390 common
14I/O layer.
15
16The document assumes a familarity with the technical terms associated
17with the s390 channel I/O architecture. For a description of this
18architecture, please refer to the "z/Architecture: Principles of
19Operation", IBM publication no. SA22-7832.
20
21While most I/O devices on a s390 system are typically driven through the
22channel I/O mechanism described here, there are various other methods
23(like the diag interface). These are out of the scope of this document.
24
25Some additional information can also be found in the kernel source under
26Documentation/s390/driver-model.txt.
27
28The ccw bus
29===========
30
31The ccw bus typically contains the majority of devices available to a
32s390 system. Named after the channel command word (ccw), the basic
33command structure used to address its devices, the ccw bus contains
34so-called channel attached devices. They are addressed via I/O
35subchannels, visible on the css bus. A device driver for
36channel-attached devices, however, will never interact with the
37subchannel directly, but only via the I/O device on the ccw bus, the ccw
38device.
39
40I/O functions for channel-attached devices
41------------------------------------------
42
43Some hardware structures have been translated into C structures for use
44by the common I/O layer and device drivers. For more information on the
45hardware structures represented here, please consult the Principles of
46Operation.
47
48.. kernel-doc:: arch/s390/include/asm/cio.h
49   :internal:
50
51ccw devices
52-----------
53
54Devices that want to initiate channel I/O need to attach to the ccw bus.
55Interaction with the driver core is done via the common I/O layer, which
56provides the abstractions of ccw devices and ccw device drivers.
57
58The functions that initiate or terminate channel I/O all act upon a ccw
59device structure. Device drivers must not bypass those functions or
60strange side effects may happen.
61
62.. kernel-doc:: arch/s390/include/asm/ccwdev.h
63   :internal:
64
65.. kernel-doc:: drivers/s390/cio/device.c
66   :export:
67
68.. kernel-doc:: drivers/s390/cio/device_ops.c
69   :export:
70
71The channel-measurement facility
72--------------------------------
73
74The channel-measurement facility provides a means to collect measurement
75data which is made available by the channel subsystem for each channel
76attached device.
77
78.. kernel-doc:: arch/s390/include/uapi/asm/cmb.h
79   :internal:
80
81.. kernel-doc:: drivers/s390/cio/cmf.c
82   :export:
83
84The ccwgroup bus
85================
86
87The ccwgroup bus only contains artificial devices, created by the user.
88Many networking devices (e.g. qeth) are in fact composed of several ccw
89devices (like read, write and data channel for qeth). The ccwgroup bus
90provides a mechanism to create a meta-device which contains those ccw
91devices as slave devices and can be associated with the netdevice.
92
93ccw group devices
94-----------------
95
96.. kernel-doc:: arch/s390/include/asm/ccwgroup.h
97   :internal:
98
99.. kernel-doc:: drivers/s390/cio/ccwgroup.c
100   :export:
101
102Generic interfaces
103==================
104
105Some interfaces are available to other drivers that do not necessarily
106have anything to do with the busses described above, but still are
107indirectly using basic infrastructure in the common I/O layer. One
108example is the support for adapter interrupts.
109
110.. kernel-doc:: drivers/s390/cio/airq.c
111   :export:
112