Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) S/390 driver model interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 1. CCW devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) All devices which can be addressed by means of ccws are called 'CCW devices' -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) even if they aren't actually driven by ccws.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) All ccw devices are accessed via a subchannel, this is reflected in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) structures under devices/::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)   devices/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)      - system/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)      - css0/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	   - 0.0.0000/0.0.0815/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	   - 0.0.0001/0.0.4711/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	   - 0.0.0002/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	   - 0.1.0000/0.1.1234/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	   ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	   - defunct/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) In this example, device 0815 is accessed via subchannel 0 in subchannel set 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) device 4711 via subchannel 1 in subchannel set 0, and subchannel 2 is a non-I/O
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) subchannel. Device 1234 is accessed via subchannel 0 in subchannel set 1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) The subchannel named 'defunct' does not represent any real subchannel on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) system; it is a pseudo subchannel where disconnected ccw devices are moved to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) if they are displaced by another ccw device becoming operational on their
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) former subchannel. The ccw devices will be moved again to a proper subchannel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) if they become operational again on that subchannel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) You should address a ccw device via its bus id (e.g. 0.0.4711); the device can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) be found under bus/ccw/devices/.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) All ccw devices export some data via sysfs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) cutype:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	The control unit type / model.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) devtype:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	The device type / model, if applicable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) availability:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	      Can be 'good' or 'boxed'; 'no path' or 'no device' for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	      disconnected devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) online:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	    An interface to set the device online and offline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	    In the special case of the device being disconnected (see the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	    notify function under 1.2), piping 0 to online will forcibly delete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	    the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) The device drivers can add entries to export per-device data and interfaces.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) There is also some data exported on a per-subchannel basis (see under
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) bus/css/devices/):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) chpids:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	Via which chpids the device is connected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) pimpampom:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	The path installed, path available and path operational masks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) There also might be additional data, for example for block devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 1.1 Bringing up a ccw device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) ----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) This is done in several steps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) a. Each driver can provide one or more parameter interfaces where parameters can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)    be specified. These interfaces are also in the driver's responsibility.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) b. After a. has been performed, if necessary, the device is finally brought up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)    via the 'online' interface.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 1.2 Writing a driver for ccw devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) The basic struct ccw_device and struct ccw_driver data structures can be found
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) under include/asm/ccwdev.h::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)   struct ccw_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	spinlock_t *ccwlock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	struct ccw_device_private *private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	struct ccw_device_id id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	struct ccw_driver *drv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	struct device dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	int online;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	void (*handler) (struct ccw_device *dev, unsigned long intparm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			 struct irb *irb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)   };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)   struct ccw_driver {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	struct ccw_device_id *ids;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	int (*probe) (struct ccw_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	int (*remove) (struct ccw_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	int (*set_online) (struct ccw_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	int (*set_offline) (struct ccw_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	int (*notify) (struct ccw_device *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	struct device_driver driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)   };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) The 'private' field contains data needed for internal i/o operation only, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) is not available to the device driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) Each driver should declare in a MODULE_DEVICE_TABLE into which CU types/models
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) and/or device types/models it is interested. This information can later be found
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) in the struct ccw_device_id fields::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)   struct ccw_device_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	__u16   match_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	__u16   cu_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	__u16   dev_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	__u8    cu_model;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	__u8    dev_model;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	unsigned long driver_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)   };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) The functions in ccw_driver should be used in the following way:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) probe:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	 This function is called by the device layer for each device the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	 is interested in. The driver should only allocate private structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	 to put in dev->driver_data and create attributes (if needed). Also,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	 the interrupt handler (see below) should be set here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)   int (*probe) (struct ccw_device *cdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) Parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		cdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			- the device to be probed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) remove:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	 This function is called by the device layer upon removal of the driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	 the device or the module. The driver should perform cleanups here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)   int (*remove) (struct ccw_device *cdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) Parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		cdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 			- the device to be removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) set_online:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	    This function is called by the common I/O layer when the device is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	    activated via the 'online' attribute. The driver should finally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	    setup and activate the device here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)   int (*set_online) (struct ccw_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) Parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		cdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			- the device to be activated. The common layer has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			  verified that the device is not already online.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) set_offline: This function is called by the common I/O layer when the device is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	     de-activated via the 'online' attribute. The driver should shut
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	     down the device, but not de-allocate its private data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)   int (*set_offline) (struct ccw_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) Parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		cdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			- the device to be deactivated. The common layer has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 			   verified that the device is online.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) notify:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	This function is called by the common I/O layer for some state changes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	of the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	Signalled to the driver are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	* In online state, device detached (CIO_GONE) or last path gone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	  (CIO_NO_PATH). The driver must return !0 to keep the device; for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	  return code 0, the device will be deleted as usual (also when no
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	  notify function is registered). If the driver wants to keep the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	  device, it is moved into disconnected state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	* In disconnected state, device operational again (CIO_OPER). The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	  common I/O layer performs some sanity checks on device number and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	  Device / CU to be reasonably sure if it is still the same device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	  If not, the old device is removed and a new one registered. By the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	  return code of the notify function the device driver signals if it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	  wants the device back: !0 for keeping, 0 to make the device being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	  removed and re-registered.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)   int (*notify) (struct ccw_device *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) Parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		cdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 			- the device whose state changed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 			- the event that happened. This can be one of CIO_GONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 			  CIO_NO_PATH or CIO_OPER.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) The handler field of the struct ccw_device is meant to be set to the interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) handler for the device. In order to accommodate drivers which use several
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) distinct handlers (e.g. multi subchannel devices), this is a member of ccw_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) instead of ccw_driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) The handler is registered with the common layer during set_online() processing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) before the driver is called, and is deregistered during set_offline() after the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) driver has been called. Also, after registering / before deregistering, path
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) grouping resp. disbanding of the path group (if applicable) are performed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)   void (*handler) (struct ccw_device *dev, unsigned long intparm, struct irb *irb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) Parameters:     dev     - the device the handler is called for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		intparm - the intparm which allows the device driver to identify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			  the i/o the interrupt is associated with, or to recognize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 			  the interrupt as unsolicited.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		irb     - interruption response block which contains the accumulated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			  status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) The device driver is called from the common ccw_device layer and can retrieve
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) information about the interrupt from the irb parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 1.3 ccwgroup devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) --------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) The ccwgroup mechanism is designed to handle devices consisting of multiple ccw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) devices, like lcs or ctc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) The ccw driver provides a 'group' attribute. Piping bus ids of ccw devices to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) this attributes creates a ccwgroup device consisting of these ccw devices (if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) possible). This ccwgroup device can be set online or offline just like a normal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) ccw device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) Each ccwgroup device also provides an 'ungroup' attribute to destroy the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) again (only when offline). This is a generic ccwgroup mechanism (the driver does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) not need to implement anything beyond normal removal routines).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) A ccw device which is a member of a ccwgroup device carries a pointer to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) ccwgroup device in the driver_data of its device struct. This field must not be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) touched by the driver - it should use the ccwgroup device's driver_data for its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) private data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) To implement a ccwgroup driver, please refer to include/asm/ccwgroup.h. Keep in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) mind that most drivers will need to implement both a ccwgroup and a ccw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 2. Channel paths
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) Channel paths show up, like subchannels, under the channel subsystem root (css0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) and are called 'chp0.<chpid>'. They have no driver and do not belong to any bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) Please note, that unlike /proc/chpids in 2.4, the channel path objects reflect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) only the logical state and not the physical state, since we cannot track the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) latter consistently due to lacking machine support (we don't need to be aware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) of it anyway).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)        - Can be 'online' or 'offline'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	 Piping 'on' or 'off' sets the chpid logically online/offline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	 Piping 'on' to an online chpid triggers path reprobing for all devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	 the chpid connects to. This can be used to force the kernel to re-use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	 a channel path the user knows to be online, but the machine hasn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	 created a machine check for.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)        - The physical type of the channel path.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)        - Whether the channel path is shared.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) cmg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)        - The channel measurement group.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 3. System devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 3.1 xpram
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) xpram shows up under devices/system/ as 'xpram'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 3.2 cpus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) For each cpu, a directory is created under devices/system/cpu/. Each cpu has an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) attribute 'online' which can be 0 or 1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 4. Other devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) ----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 4.1 Netiucv
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) The netiucv driver creates an attribute 'connection' under
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) bus/iucv/drivers/netiucv. Piping to this attribute creates a new netiucv
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) connection to the specified host.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) Netiucv connections show up under devices/iucv/ as "netiucv<ifnum>". The interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) number is assigned sequentially to the connections defined via the 'connection'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) attribute.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)     - shows the connection partner.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)     - maximum buffer size. Pipe to it to change buffer size.