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