<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>

<book id="s390drivers">
 <bookinfo>
  <title>Writing s390 channel device drivers</title>

  <authorgroup>
   <author>
    <firstname>Cornelia</firstname>
    <surname>Huck</surname>
    <affiliation>
     <address>
       <email>cornelia.huck@de.ibm.com</email>
     </address>
    </affiliation>
   </author>
  </authorgroup>

  <copyright>
   <year>2007</year>
   <holder>IBM Corp.</holder>
  </copyright>

  <legalnotice>
   <para>
     This documentation is free software; you can redistribute
     it and/or modify it under the terms of the GNU General Public
     License as published by the Free Software Foundation; either
     version 2 of the License, or (at your option) any later
     version.
   </para>

   <para>
     This program is distributed in the hope that it will be
     useful, but WITHOUT ANY WARRANTY; without even the implied
     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     See the GNU General Public License for more details.
   </para>

   <para>
     You should have received a copy of the GNU General Public
     License along with this program; if not, write to the Free
     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
     MA 02111-1307 USA
   </para>

   <para>
     For more details see the file COPYING in the source
     distribution of Linux.
   </para>
  </legalnotice>
 </bookinfo>

<toc></toc>

  <chapter id="intro">
   <title>Introduction</title>
  <para>
    This document describes the interfaces available for device drivers that
    drive s390 based channel attached I/O devices. This includes interfaces for
    interaction with the hardware and interfaces for interacting with the
    common driver core. Those interfaces are provided by the s390 common I/O
    layer.
  </para>
  <para>
    The document assumes a familarity with the technical terms associated
    with the s390 channel I/O architecture. For a description of this
    architecture, please refer to the "z/Architecture: Principles of
    Operation", IBM publication no. SA22-7832.
  </para>
  <para>
    While most I/O devices on a s390 system are typically driven through the
    channel I/O mechanism described here, there are various other methods
    (like the diag interface). These are out of the scope of this document.
  </para>
  <para>
    Some additional information can also be found in the kernel source
    under Documentation/s390/driver-model.txt.
  </para>
  </chapter>
  <chapter id="ccw">
   <title>The ccw bus</title>
  <para>
	The ccw bus typically contains the majority of devices available to
	a s390 system. Named after the channel command word (ccw), the basic
	command structure used to address its devices, the ccw bus contains
	so-called channel attached devices. They are addressed via I/O
	subchannels, visible on the css bus. A device driver for
	channel-attached devices, however, will never interact	with the
	subchannel directly, but only via the I/O device on the ccw bus,
	the ccw device.
  </para>
    <sect1 id="channelIO">
     <title>I/O functions for channel-attached devices</title>
    <para>
      Some hardware structures have been translated into C structures for use
      by the common I/O layer and device drivers. For more information on
      the hardware structures represented here, please consult the Principles
      of Operation.
    </para>
<!-- include/asm-s390/cio.h -->
<refentry id="API-struct-scsw">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct scsw</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct scsw</refname>
 <refpurpose>
  subchannel status word
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct scsw {
  __u32 key:4;
  __u32 sctl:1;
  __u32 eswf:1;
  __u32 cc:2;
  __u32 fmt:1;
  __u32 pfch:1;
  __u32 isic:1;
  __u32 alcc:1;
  __u32 ssi:1;
  __u32 zcc:1;
  __u32 ectl:1;
  __u32 pno:1;
  __u32 res:1;
  __u32 fctl:3;
  __u32 actl:7;
  __u32 stctl:5;
  __u32 cpa;
  __u32 dstat:8;
  __u32 cstat:8;
  __u32 count:16;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>key</term>
      <listitem><para>
subchannel key
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>sctl</term>
      <listitem><para>
suspend control
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>eswf</term>
      <listitem><para>
esw format
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>cc</term>
      <listitem><para>
deferred condition code
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>fmt</term>
      <listitem><para>
format
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>pfch</term>
      <listitem><para>
prefetch
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>isic</term>
      <listitem><para>
initial-status interruption control
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>alcc</term>
      <listitem><para>
address-limit checking control
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>ssi</term>
      <listitem><para>
suppress-suspended interruption
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>zcc</term>
      <listitem><para>
zero condition code
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>ectl</term>
      <listitem><para>
extended control
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>pno</term>
      <listitem><para>
path not operational
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>res</term>
      <listitem><para>
reserved
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>fctl</term>
      <listitem><para>
function control
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>actl</term>
      <listitem><para>
activity control
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>stctl</term>
      <listitem><para>
status control
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>cpa</term>
      <listitem><para>
channel program address
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>dstat</term>
      <listitem><para>
device status
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>cstat</term>
      <listitem><para>
subchannel status
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>count</term>
      <listitem><para>
residual count
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-ccw1">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct ccw1</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct ccw1</refname>
 <refpurpose>
     channel command word
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct ccw1 {
  __u8 cmd_code;
  __u8 flags;
  __u16 count;
  __u32 cda;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>cmd_code</term>
      <listitem><para>
   command code
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>flags</term>
      <listitem><para>
   flags, like IDA adressing, etc.
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>count</term>
      <listitem><para>
   byte count
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>cda</term>
      <listitem><para>
   data address
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
<refsect1>
<title>Description</title>
<para>
   The ccw is the basic structure to build channel programs that perform
   operations with the device or the control unit. Only Format-1 channel
   command words are supported.
</para>
</refsect1>
</refentry>

<refentry id="API-struct-erw">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct erw</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct erw</refname>
 <refpurpose>
     extended report word
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct erw {
  __u32 res0:3;
  __u32 auth:1;
  __u32 pvrf:1;
  __u32 cpt:1;
  __u32 fsavf:1;
  __u32 cons:1;
  __u32 scavf:1;
  __u32 fsaf:1;
  __u32 scnt:6;
  __u32 res16:16;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>res0</term>
      <listitem><para>
   reserved
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>auth</term>
      <listitem><para>
   authorization check
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>pvrf</term>
      <listitem><para>
   path-verification-required flag
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>cpt</term>
      <listitem><para>
   channel-path timeout
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>fsavf</term>
      <listitem><para>
   failing storage address validity flag
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>cons</term>
      <listitem><para>
   concurrent sense
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>scavf</term>
      <listitem><para>
   secondary ccw address validity flag
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>fsaf</term>
      <listitem><para>
   failing storage address format
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>scnt</term>
      <listitem><para>
   sense count, if <parameter>cons</parameter> == <constant>1</constant>
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>res16</term>
      <listitem><para>
   reserved
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-sublog">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct sublog</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct sublog</refname>
 <refpurpose>
     subchannel logout area
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct sublog {
  __u32 res0:1;
  __u32 esf:7;
  __u32 lpum:8;
  __u32 arep:1;
  __u32 fvf:5;
  __u32 sacc:2;
  __u32 termc:2;
  __u32 devsc:1;
  __u32 serr:1;
  __u32 ioerr:1;
  __u32 seqc:3;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>res0</term>
      <listitem><para>
   reserved
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>esf</term>
      <listitem><para>
   extended status flags
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>lpum</term>
      <listitem><para>
   last path used mask
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>arep</term>
      <listitem><para>
   ancillary report
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>fvf</term>
      <listitem><para>
   field-validity flags
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>sacc</term>
      <listitem><para>
   storage access code
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>termc</term>
      <listitem><para>
   termination code
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>devsc</term>
      <listitem><para>
   device-status check
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>serr</term>
      <listitem><para>
   secondary error
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>ioerr</term>
      <listitem><para>
   i/o-error alert
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>seqc</term>
      <listitem><para>
   sequence code
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-esw0">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct esw0</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct esw0</refname>
 <refpurpose>
     Format 0 Extended Status Word (ESW)
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct esw0 {
  struct sublog sublog;
  struct erw erw;
  __u32 faddr[2];
  __u32 saddr;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>sublog</term>
      <listitem><para>
   subchannel logout
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>erw</term>
      <listitem><para>
   extended report word
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>faddr[2]</term>
      <listitem><para>
   failing storage address
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>saddr</term>
      <listitem><para>
   secondary ccw address
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-esw1">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct esw1</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct esw1</refname>
 <refpurpose>
     Format 1 Extended Status Word (ESW)
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct esw1 {
  __u8 zero0;
  __u8 lpum;
  __u16 zero16;
  struct erw erw;
  __u32 zeros[3];
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>zero0</term>
      <listitem><para>
   reserved zeros
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>lpum</term>
      <listitem><para>
   last path used mask
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>zero16</term>
      <listitem><para>
   reserved zeros
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>erw</term>
      <listitem><para>
   extended report word
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>zeros[3]</term>
      <listitem><para>
   three fullwords of zeros
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-esw2">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct esw2</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct esw2</refname>
 <refpurpose>
     Format 2 Extended Status Word (ESW)
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct esw2 {
  __u8 zero0;
  __u8 lpum;
  __u16 dcti;
  struct erw erw;
  __u32 zeros[3];
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>zero0</term>
      <listitem><para>
   reserved zeros
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>lpum</term>
      <listitem><para>
   last path used mask
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>dcti</term>
      <listitem><para>
   device-connect-time interval
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>erw</term>
      <listitem><para>
   extended report word
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>zeros[3]</term>
      <listitem><para>
   three fullwords of zeros
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-esw3">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct esw3</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct esw3</refname>
 <refpurpose>
     Format 3 Extended Status Word (ESW)
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct esw3 {
  __u8 zero0;
  __u8 lpum;
  __u16 res;
  struct erw erw;
  __u32 zeros[3];
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>zero0</term>
      <listitem><para>
   reserved zeros
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>lpum</term>
      <listitem><para>
   last path used mask
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>res</term>
      <listitem><para>
   reserved
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>erw</term>
      <listitem><para>
   extended report word
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>zeros[3]</term>
      <listitem><para>
   three fullwords of zeros
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-irb">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct irb</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct irb</refname>
 <refpurpose>
     interruption response block
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct irb {
  struct scsw scsw;
  union esw;
  __u8 ecw[32];
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>scsw</term>
      <listitem><para>
   subchannel status word
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>esw</term>
      <listitem><para>
   extened status word, 4 formats
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>ecw[32]</term>
      <listitem><para>
   extended control word
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
<refsect1>
<title>Description</title>
<para>
   The irb that is handed to the device driver when an interrupt occurs. For
   solicited interrupts, the common I/O layer already performs checks whether
   a field is valid; a field not being valid is always passed as <constant>0</constant>.
   If a unit check occured, <parameter>ecw</parameter> may contain sense data; this is retrieved
   by the common I/O layer itself if the device doesn't support concurrent
   sense (so that the device driver never needs to perform basic sene itself).
   For unsolicited interrupts, the irb is passed as-is (expect for sense data,
   if applicable).
</para>
</refsect1>
</refentry>

<refentry id="API-struct-ciw">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct ciw</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct ciw</refname>
 <refpurpose>
     command information word  (CIW) layout
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct ciw {
  __u32 et:2;
  __u32 reserved:2;
  __u32 ct:4;
  __u32 cmd:8;
  __u32 count:16;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>et</term>
      <listitem><para>
   entry type
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>reserved</term>
      <listitem><para>
   reserved bits
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>ct</term>
      <listitem><para>
   command type
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>cmd</term>
      <listitem><para>
   command code
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>count</term>
      <listitem><para>
   command count
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-ccw-dev-id">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct ccw_dev_id</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct ccw_dev_id</refname>
 <refpurpose>
     unique identifier for ccw devices
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct ccw_dev_id {
  u8 ssid;
  u16 devno;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>ssid</term>
      <listitem><para>
   subchannel set id
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>devno</term>
      <listitem><para>
   device number
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
<refsect1>
<title>Description</title>
<para>
   This structure is not directly based on any hardware structure. The
   hardware identifies a device by its device number and its subchannel,
   which is in turn identified by its id. In order to get a unique identifier
   for ccw devices across subchannel sets, <parameter>struct</parameter> ccw_dev_id has been
   introduced.
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-dev-id-is-equal">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_dev_id_is_equal</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_dev_id_is_equal</refname>
 <refpurpose>
     compare two ccw_dev_ids
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_dev_id_is_equal </function></funcdef>
   <paramdef>struct ccw_dev_id * <parameter>dev_id1</parameter></paramdef>
   <paramdef>struct ccw_dev_id * <parameter>dev_id2</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>dev_id1</parameter></term>
   <listitem>
    <para>
     a ccw_dev_id
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>dev_id2</parameter></term>
   <listitem>
    <para>
     another ccw_dev_id
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>1</constant> if the two structures are equal field-by-field,
   <constant>0</constant> if not.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   any
</para>
</refsect1>
</refentry>

    </sect1>
    <sect1 id="ccwdev">
     <title>ccw devices</title>
    <para>
      Devices that want to initiate channel I/O need to attach to the ccw bus.
      Interaction with the driver core is done via the common I/O layer, which
      provides the abstractions of ccw devices and ccw device drivers.
    </para>
    <para>
      The functions that initiate or terminate channel I/O all act upon a
      ccw device structure. Device drivers must not bypass those functions
      or strange side effects may happen.
    </para>
<!-- include/asm-s390/ccwdev.h -->
<refentry id="API-struct-ccw-device">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct ccw_device</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct ccw_device</refname>
 <refpurpose>
  channel attached device
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct ccw_device {
  spinlock_t * ccwlock;
  struct ccw_device_id id;
  struct ccw_driver * drv;
  struct device dev;
  int online;
  void (* handler) (struct ccw_device *, unsigned long, struct irb *);
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>ccwlock</term>
      <listitem><para>
pointer to device lock
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>id</term>
      <listitem><para>
id of this device
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>drv</term>
      <listitem><para>
ccw driver for this device
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>dev</term>
      <listitem><para>
embedded device structure
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>online</term>
      <listitem><para>
online status of device
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>handler</term>
      <listitem><para>
interrupt handler
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
<refsect1>
<title>Description</title>
<para>
   <parameter>handler</parameter> is a member of the device rather than the driver since a driver
   can have different interrupt handlers for different ccw devices
   (multi-subchannel drivers).
</para>
</refsect1>
</refentry>

<refentry id="API-struct-ccw-driver">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct ccw_driver</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct ccw_driver</refname>
 <refpurpose>
     device driver for channel attached devices
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct ccw_driver {
  struct module * owner;
  struct ccw_device_id * ids;
  int (* probe) (struct ccw_device *);
  void (* remove) (struct ccw_device *);
  int (* set_online) (struct ccw_device *);
  int (* set_offline) (struct ccw_device *);
  int (* notify) (struct ccw_device *, int);
  void (* shutdown) (struct ccw_device *);
  struct device_driver driver;
  char * name;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>owner</term>
      <listitem><para>
   owning module
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>ids</term>
      <listitem><para>
   ids supported by this driver
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>probe</term>
      <listitem><para>
   function called on probe
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>remove</term>
      <listitem><para>
   function called on remove
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>set_online</term>
      <listitem><para>
   called when setting device online
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>set_offline</term>
      <listitem><para>
   called when setting device offline
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>notify</term>
      <listitem><para>
   notify driver of device state changes
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>shutdown</term>
      <listitem><para>
   called at device shutdown
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>driver</term>
      <listitem><para>
   embedded device driver structure
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>name</term>
      <listitem><para>
   device driver name
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<!-- drivers/s390/cio/device.c -->
<refentry id="API-ccw-device-set-offline">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_set_offline</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_set_offline</refname>
 <refpurpose>
  disable a ccw device for I/O
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_set_offline </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This function calls the driver's <function>set_offline</function> function for <parameter>cdev</parameter>, if
   given, and then disables <parameter>cdev</parameter>.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success and a negative error value on failure.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   enabled, ccw device lock not held
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-set-online">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_set_online</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_set_online</refname>
 <refpurpose>
     enable a ccw device for I/O
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_set_online </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This function first enables <parameter>cdev</parameter> and then calls the driver's <function>set_online</function>
   function for <parameter>cdev</parameter>, if given. If <function>set_online</function> returns an error, <parameter>cdev</parameter> is
   disabled again.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success and a negative error value on failure.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   enabled, ccw device lock not held
</para>
</refsect1>
</refentry>

<refentry id="API-get-ccwdev-by-busid">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>get_ccwdev_by_busid</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>get_ccwdev_by_busid</refname>
 <refpurpose>
     obtain device from a bus id
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>struct ccw_device * <function>get_ccwdev_by_busid </function></funcdef>
   <paramdef>struct ccw_driver * <parameter>cdrv</parameter></paramdef>
   <paramdef>const char * <parameter>bus_id</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdrv</parameter></term>
   <listitem>
    <para>
     driver the device is owned by
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>bus_id</parameter></term>
   <listitem>
    <para>
     bus id of the device to be searched
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This function searches all devices owned by <parameter>cdrv</parameter> for a device with a bus
   id matching <parameter>bus_id</parameter>.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   If a match is found, its reference count of the found device is increased
   and it is returned; else <constant>NULL</constant> is returned.
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-driver-register">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_driver_register</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_driver_register</refname>
 <refpurpose>
     register a ccw driver
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_driver_register </function></funcdef>
   <paramdef>struct ccw_driver * <parameter>cdriver</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdriver</parameter></term>
   <listitem>
    <para>
     driver to be registered
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This function is mainly a wrapper around <function>driver_register</function>.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success and a negative error value on failure.
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-driver-unregister">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_driver_unregister</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_driver_unregister</refname>
 <refpurpose>
     deregister a ccw driver
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>void <function>ccw_driver_unregister </function></funcdef>
   <paramdef>struct ccw_driver * <parameter>cdriver</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdriver</parameter></term>
   <listitem>
    <para>
     driver to be deregistered
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This function is mainly a wrapper around <function>driver_unregister</function>.
</para>
</refsect1>
</refentry>

<!-- drivers/s390/cio/device_ops.c -->
<refentry id="API-ccw-device-set-options-mask">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_set_options_mask</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_set_options_mask</refname>
 <refpurpose>
  set some options and unset the rest
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_set_options_mask </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     device for which the options are to be set
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>flags</parameter></term>
   <listitem>
    <para>
     options to be set
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   All flags specified in <parameter>flags</parameter> are set, all flags not specified in <parameter>flags</parameter>
   are cleared.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success, -<constant>EINVAL</constant> on an invalid flag combination.
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-set-options">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_set_options</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_set_options</refname>
 <refpurpose>
     set some options
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_set_options </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     device for which the options are to be set
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>flags</parameter></term>
   <listitem>
    <para>
     options to be set
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   All flags specified in <parameter>flags</parameter> are set, the remainder is left untouched.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success, -<constant>EINVAL</constant> if an invalid flag combination would ensue.
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-clear-options">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_clear_options</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_clear_options</refname>
 <refpurpose>
     clear some options
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>void <function>ccw_device_clear_options </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     device for which the options are to be cleared
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>flags</parameter></term>
   <listitem>
    <para>
     options to be cleared
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   All flags specified in <parameter>flags</parameter> are cleared, the remainder is left untouched.
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-clear">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_clear</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_clear</refname>
 <refpurpose>
     terminate I/O request processing
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_clear </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>unsigned long <parameter>intparm</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>intparm</parameter></term>
   <listitem>
    <para>
     interruption parameter; value is only used if no I/O is
     outstanding, otherwise the intparm associated with the I/O request
     is returned
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   <function>ccw_device_clear</function> calls csch on <parameter>cdev</parameter>'s subchannel.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success,
   -<constant>ENODEV</constant> on device not operational,
   -<constant>EINVAL</constant> on invalid device state.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   Interrupts disabled, ccw device lock held
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-start-key">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_start_key</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_start_key</refname>
 <refpurpose>
     start a s390 channel program with key
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_start_key </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>struct ccw1 * <parameter>cpa</parameter></paramdef>
   <paramdef>unsigned long <parameter>intparm</parameter></paramdef>
   <paramdef>__u8 <parameter>lpm</parameter></paramdef>
   <paramdef>__u8 <parameter>key</parameter></paramdef>
   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>cpa</parameter></term>
   <listitem>
    <para>
     logical start address of channel program
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>intparm</parameter></term>
   <listitem>
    <para>
     user specific interruption parameter; will be presented back to
     <parameter>cdev</parameter>'s interrupt handler. Allows a device driver to associate
     the interrupt with a particular I/O request.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>lpm</parameter></term>
   <listitem>
    <para>
     defines the channel path to be used for a specific I/O request. A
     value of 0 will make cio use the opm.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>key</parameter></term>
   <listitem>
    <para>
     storage key to be used for the I/O
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>flags</parameter></term>
   <listitem>
    <para>
     additional flags; defines the action to be performed for I/O
     processing.
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Start a S/390 channel program. When the interrupt arrives, the
   IRQ handler is called, either immediately, delayed (dev-end missing,
   or sense required) or never (no IRQ handler registered).
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant>, if the operation was successful;
   -<constant>EBUSY</constant>, if the device is busy, or status pending;
   -<constant>EACCES</constant>, if no path specified in <parameter>lpm</parameter> is operational;
   -<constant>ENODEV</constant>, if the device is not operational.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   Interrupts disabled, ccw device lock held
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-start-timeout-key">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_start_timeout_key</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_start_timeout_key</refname>
 <refpurpose>
     start a s390 channel program with timeout and key
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_start_timeout_key </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>struct ccw1 * <parameter>cpa</parameter></paramdef>
   <paramdef>unsigned long <parameter>intparm</parameter></paramdef>
   <paramdef>__u8 <parameter>lpm</parameter></paramdef>
   <paramdef>__u8 <parameter>key</parameter></paramdef>
   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
   <paramdef>int <parameter>expires</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>cpa</parameter></term>
   <listitem>
    <para>
     logical start address of channel program
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>intparm</parameter></term>
   <listitem>
    <para>
     user specific interruption parameter; will be presented back to
     <parameter>cdev</parameter>'s interrupt handler. Allows a device driver to associate
     the interrupt with a particular I/O request.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>lpm</parameter></term>
   <listitem>
    <para>
     defines the channel path to be used for a specific I/O request. A
     value of 0 will make cio use the opm.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>key</parameter></term>
   <listitem>
    <para>
     storage key to be used for the I/O
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>flags</parameter></term>
   <listitem>
    <para>
     additional flags; defines the action to be performed for I/O
     processing.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>expires</parameter></term>
   <listitem>
    <para>
     timeout value in jiffies
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Start a S/390 channel program. When the interrupt arrives, the
   IRQ handler is called, either immediately, delayed (dev-end missing,
   or sense required) or never (no IRQ handler registered).
   This function notifies the device driver if the channel program has not
   completed during the time specified by <parameter>expires</parameter>. If a timeout occurs, the
   channel program is terminated via xsch, hsch or csch, and the device's
   interrupt handler will be called with an irb containing ERR_PTR(-<constant>ETIMEDOUT</constant>).
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant>, if the operation was successful;
   -<constant>EBUSY</constant>, if the device is busy, or status pending;
   -<constant>EACCES</constant>, if no path specified in <parameter>lpm</parameter> is operational;
   -<constant>ENODEV</constant>, if the device is not operational.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   Interrupts disabled, ccw device lock held
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-start">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_start</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_start</refname>
 <refpurpose>
     start a s390 channel program
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_start </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>struct ccw1 * <parameter>cpa</parameter></paramdef>
   <paramdef>unsigned long <parameter>intparm</parameter></paramdef>
   <paramdef>__u8 <parameter>lpm</parameter></paramdef>
   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>cpa</parameter></term>
   <listitem>
    <para>
     logical start address of channel program
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>intparm</parameter></term>
   <listitem>
    <para>
     user specific interruption parameter; will be presented back to
     <parameter>cdev</parameter>'s interrupt handler. Allows a device driver to associate
     the interrupt with a particular I/O request.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>lpm</parameter></term>
   <listitem>
    <para>
     defines the channel path to be used for a specific I/O request. A
     value of 0 will make cio use the opm.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>flags</parameter></term>
   <listitem>
    <para>
     additional flags; defines the action to be performed for I/O
     processing.
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Start a S/390 channel program. When the interrupt arrives, the
   IRQ handler is called, either immediately, delayed (dev-end missing,
   or sense required) or never (no IRQ handler registered).
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant>, if the operation was successful;
   -<constant>EBUSY</constant>, if the device is busy, or status pending;
   -<constant>EACCES</constant>, if no path specified in <parameter>lpm</parameter> is operational;
   -<constant>ENODEV</constant>, if the device is not operational.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   Interrupts disabled, ccw device lock held
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-start-timeout">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_start_timeout</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_start_timeout</refname>
 <refpurpose>
     start a s390 channel program with timeout
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_start_timeout </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>struct ccw1 * <parameter>cpa</parameter></paramdef>
   <paramdef>unsigned long <parameter>intparm</parameter></paramdef>
   <paramdef>__u8 <parameter>lpm</parameter></paramdef>
   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
   <paramdef>int <parameter>expires</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>cpa</parameter></term>
   <listitem>
    <para>
     logical start address of channel program
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>intparm</parameter></term>
   <listitem>
    <para>
     user specific interruption parameter; will be presented back to
     <parameter>cdev</parameter>'s interrupt handler. Allows a device driver to associate
     the interrupt with a particular I/O request.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>lpm</parameter></term>
   <listitem>
    <para>
     defines the channel path to be used for a specific I/O request. A
     value of 0 will make cio use the opm.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>flags</parameter></term>
   <listitem>
    <para>
     additional flags; defines the action to be performed for I/O
     processing.
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>expires</parameter></term>
   <listitem>
    <para>
     timeout value in jiffies
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Start a S/390 channel program. When the interrupt arrives, the
   IRQ handler is called, either immediately, delayed (dev-end missing,
   or sense required) or never (no IRQ handler registered).
   This function notifies the device driver if the channel program has not
   completed during the time specified by <parameter>expires</parameter>. If a timeout occurs, the
   channel program is terminated via xsch, hsch or csch, and the device's
   interrupt handler will be called with an irb containing ERR_PTR(-<constant>ETIMEDOUT</constant>).
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant>, if the operation was successful;
   -<constant>EBUSY</constant>, if the device is busy, or status pending;
   -<constant>EACCES</constant>, if no path specified in <parameter>lpm</parameter> is operational;
   -<constant>ENODEV</constant>, if the device is not operational.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   Interrupts disabled, ccw device lock held
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-halt">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_halt</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_halt</refname>
 <refpurpose>
     halt I/O request processing
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_halt </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>unsigned long <parameter>intparm</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>intparm</parameter></term>
   <listitem>
    <para>
     interruption parameter; value is only used if no I/O is
     outstanding, otherwise the intparm associated with the I/O request
     is returned
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   <function>ccw_device_halt</function> calls hsch on <parameter>cdev</parameter>'s subchannel.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success,
   -<constant>ENODEV</constant> on device not operational,
   -<constant>EINVAL</constant> on invalid device state,
   -<constant>EBUSY</constant> on device busy or interrupt pending.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   Interrupts disabled, ccw device lock held
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-resume">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_resume</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_resume</refname>
 <refpurpose>
     resume channel program execution
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccw_device_resume </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     target ccw device
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   <function>ccw_device_resume</function> calls rsch on <parameter>cdev</parameter>'s subchannel.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success,
   -<constant>ENODEV</constant> on device not operational,
   -<constant>EINVAL</constant> on invalid device state,
   -<constant>EBUSY</constant> on device busy or interrupt pending.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   Interrupts disabled, ccw device lock held
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-get-ciw">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_get_ciw</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_get_ciw</refname>
 <refpurpose>
     Search for CIW command in extended sense data.
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>struct ciw * <function>ccw_device_get_ciw </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>__u32 <parameter>ct</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     ccw device to inspect
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>ct</parameter></term>
   <listitem>
    <para>
     command type to look for
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   During SenseID, command information words (CIWs) describing special
   commands available to the device may have been stored in the extended
   sense data. This function searches for CIWs of a specified command
   type in the extended sense data.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>NULL</constant> if no extended sense data has been stored or if no CIW of the
   specified command type could be found,
   else a pointer to the CIW of the specified command type.
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-get-path-mask">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_get_path_mask</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_get_path_mask</refname>
 <refpurpose>
     get currently available paths
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>__u8 <function>ccw_device_get_path_mask </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     ccw device to be queried
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> if no subchannel for the device is available,
   else the mask of currently available paths for the ccw device's subchannel.
</para>
</refsect1>
</refentry>

<refentry id="API-ccw-device-get-id">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccw_device_get_id</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccw_device_get_id</refname>
 <refpurpose>
     obtain a ccw device id
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>void <function>ccw_device_get_id </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>struct ccw_dev_id * <parameter>dev_id</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     device to obtain the id for
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>dev_id</parameter></term>
   <listitem>
    <para>
     where to fill in the values
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
</refentry>

    </sect1>
    <sect1 id="cmf">
     <title>The channel-measurement facility</title>
  <para>
	The channel-measurement facility provides a means to collect
	measurement data which is made available by the channel subsystem
	for each channel attached device.
  </para>
<!-- include/asm-s390/cmb.h -->
<refentry id="API-struct-cmbdata">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct cmbdata</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct cmbdata</refname>
 <refpurpose>
  channel measurement block data for user space
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct cmbdata {
  __u64 size;
  __u64 elapsed_time;
  __u64 ssch_rsch_count;
  __u64 sample_count;
  __u64 device_connect_time;
  __u64 function_pending_time;
  __u64 device_disconnect_time;
  __u64 control_unit_queuing_time;
  __u64 device_active_only_time;
  __u64 device_busy_time;
  __u64 initial_command_response_time;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>size</term>
      <listitem><para>
size of the stored data
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>elapsed_time</term>
      <listitem><para>
time since last sampling
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>ssch_rsch_count</term>
      <listitem><para>
number of ssch and rsch
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>sample_count</term>
      <listitem><para>
number of samples
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>device_connect_time</term>
      <listitem><para>
time of device connect
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>function_pending_time</term>
      <listitem><para>
time of function pending
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>device_disconnect_time</term>
      <listitem><para>
time of device disconnect
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>control_unit_queuing_time</term>
      <listitem><para>
time of control unit queuing
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>device_active_only_time</term>
      <listitem><para>
time of device active only
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>device_busy_time</term>
      <listitem><para>
time of device busy (ext. format)
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>initial_command_response_time</term>
      <listitem><para>
initial command response time (ext. format)
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
<refsect1>
<title>Description</title>
<para>
   All values are stored as 64 bit for simplicity, especially
   in 32 bit emulation mode. All time values are normalized to
   nanoseconds.
   Currently, two formats are known, which differ by the size of
   this structure, i.e. the last two members are only set when
   the extended channel measurement facility (first shipped in
   z990 machines) is activated.
   Potentially, more fields could be added, which would result in a
   new ioctl number.
</para>
</refsect1>
</refentry>

<!-- drivers/s390/cio/cmf.c -->
<refentry id="API-enable-cmf">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>enable_cmf</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>enable_cmf</refname>
 <refpurpose>
  switch on the channel measurement for a specific device
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>enable_cmf </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     The ccw device to be enabled
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Returns <constant>0</constant> for success or a negative error value.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   non-atomic
</para>
</refsect1>
</refentry>

<refentry id="API-disable-cmf">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>disable_cmf</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>disable_cmf</refname>
 <refpurpose>
     switch off the channel measurement for a specific device
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>disable_cmf </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     The ccw device to be disabled
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Returns <constant>0</constant> for success or a negative error value.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   non-atomic
</para>
</refsect1>
</refentry>

<refentry id="API-cmf-read">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>cmf_read</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>cmf_read</refname>
 <refpurpose>
     read one value from the current channel measurement block
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>u64 <function>cmf_read </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>int <parameter>index</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     the channel to be read
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>index</parameter></term>
   <listitem>
    <para>
     the index of the value to be read
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Returns the value read or <constant>0</constant> if the value cannot be read.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   any
</para>
</refsect1>
</refentry>

<refentry id="API-cmf-readall">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>cmf_readall</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>cmf_readall</refname>
 <refpurpose>
     read the current channel measurement block
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>cmf_readall </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
   <paramdef>struct cmbdata * <parameter>data</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     the channel to be read
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>data</parameter></term>
   <listitem>
    <para>
     a pointer to a data block that will be filled
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Returns <constant>0</constant> on success, a negative error value otherwise.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   any
</para>
</refsect1>
</refentry>

    </sect1>
  </chapter>

  <chapter id="ccwgroup">
   <title>The ccwgroup bus</title>
  <para>
	The ccwgroup bus only contains artificial devices, created by the user.
	Many networking devices (e.g. qeth) are in fact composed of several
	ccw devices (like read, write and data channel for qeth). The
	ccwgroup bus provides a mechanism to create a meta-device which
	contains those ccw devices as slave devices and can be associated
	with the netdevice.
  </para>
   <sect1 id="ccwgroupdevices">
    <title>ccw group devices</title>
<!-- include/asm-s390/ccwgroup.h -->
<refentry id="API-struct-ccwgroup-device">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct ccwgroup_device</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct ccwgroup_device</refname>
 <refpurpose>
  ccw group device
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct ccwgroup_device {
  unsigned long creator_id;
  enum state;
  unsigned int count;
  struct device dev;
  struct ccw_device * cdev[0];
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>creator_id</term>
      <listitem><para>
unique number of the driver
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>state</term>
      <listitem><para>
online/offline state
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>count</term>
      <listitem><para>
number of attached slave devices
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>dev</term>
      <listitem><para>
embedded device structure
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>cdev[0]</term>
      <listitem><para>
variable number of slave devices, allocated as needed
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<refentry id="API-struct-ccwgroup-driver">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>struct ccwgroup_driver</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>struct ccwgroup_driver</refname>
 <refpurpose>
     driver for ccw group devices
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <programlisting>
struct ccwgroup_driver {
  struct module * owner;
  char * name;
  int max_slaves;
  unsigned long driver_id;
  int (* probe) (struct ccwgroup_device *);
  void (* remove) (struct ccwgroup_device *);
  int (* set_online) (struct ccwgroup_device *);
  int (* set_offline) (struct ccwgroup_device *);
  void (* shutdown) (struct ccwgroup_device *);
  struct device_driver driver;
};  </programlisting>
</refsynopsisdiv>
 <refsect1>
  <title>Members</title>
  <variablelist>
    <varlistentry>      <term>owner</term>
      <listitem><para>
   driver owner
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>name</term>
      <listitem><para>
   driver name
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>max_slaves</term>
      <listitem><para>
   maximum number of slave devices
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>driver_id</term>
      <listitem><para>
   unique id
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>probe</term>
      <listitem><para>
   function called on probe
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>remove</term>
      <listitem><para>
   function called on remove
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>set_online</term>
      <listitem><para>
   function called when device is set online
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>set_offline</term>
      <listitem><para>
   function called when device is set offline
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>shutdown</term>
      <listitem><para>
   function called when device is shut down
      </para></listitem>
    </varlistentry>
    <varlistentry>      <term>driver</term>
      <listitem><para>
   embedded driver structure
      </para></listitem>
    </varlistentry>
  </variablelist>
 </refsect1>
</refentry>

<!-- drivers/s390/cio/ccwgroup.c -->
<refentry id="API-ccwgroup-create">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccwgroup_create</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccwgroup_create</refname>
 <refpurpose>
  create and register a ccw group device
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccwgroup_create </function></funcdef>
   <paramdef>struct device * <parameter>root</parameter></paramdef>
   <paramdef>unsigned int <parameter>creator_id</parameter></paramdef>
   <paramdef>struct ccw_driver * <parameter>cdrv</parameter></paramdef>
   <paramdef>int <parameter>argc</parameter></paramdef>
   <paramdef>char * <parameter>argv[]</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>root</parameter></term>
   <listitem>
    <para>
     parent device for the new device
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>creator_id</parameter></term>
   <listitem>
    <para>
     identifier of creating driver
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>cdrv</parameter></term>
   <listitem>
    <para>
     ccw driver of slave devices
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>argc</parameter></term>
   <listitem>
    <para>
     number of slave devices
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>argv[]</parameter></term>
   <listitem>
    <para>
     bus ids of slave devices
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   Create and register a new ccw group device as a child of <parameter>root</parameter>. Slave
   devices are obtained from the list of bus ids given in <parameter>argv</parameter>[] and must all
   belong to <parameter>cdrv</parameter>.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   <constant>0</constant> on success and an error code on failure.
</para>
</refsect1>
<refsect1>
<title>Context</title>
<para>
   non-atomic
</para>
</refsect1>
</refentry>

<refentry id="API-ccwgroup-driver-register">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccwgroup_driver_register</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccwgroup_driver_register</refname>
 <refpurpose>
     register a ccw group driver
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccwgroup_driver_register </function></funcdef>
   <paramdef>struct ccwgroup_driver * <parameter>cdriver</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdriver</parameter></term>
   <listitem>
    <para>
     driver to be registered
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This function is mainly a wrapper around <function>driver_register</function>.
</para>
</refsect1>
</refentry>

<refentry id="API-ccwgroup-driver-unregister">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccwgroup_driver_unregister</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccwgroup_driver_unregister</refname>
 <refpurpose>
     deregister a ccw group driver
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>void <function>ccwgroup_driver_unregister </function></funcdef>
   <paramdef>struct ccwgroup_driver * <parameter>cdriver</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdriver</parameter></term>
   <listitem>
    <para>
     driver to be deregistered
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This function is mainly a wrapper around <function>driver_unregister</function>.
</para>
</refsect1>
</refentry>

<refentry id="API-ccwgroup-probe-ccwdev">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccwgroup_probe_ccwdev</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccwgroup_probe_ccwdev</refname>
 <refpurpose>
     probe function for slave devices
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>int <function>ccwgroup_probe_ccwdev </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     ccw device to be probed
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This is a dummy probe function for ccw devices that are slave devices in
   a ccw group device.
</para>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   always <constant>0</constant>
</para>
</refsect1>
</refentry>

<refentry id="API-ccwgroup-remove-ccwdev">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>ccwgroup_remove_ccwdev</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>ccwgroup_remove_ccwdev</refname>
 <refpurpose>
     remove function for slave devices
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>void <function>ccwgroup_remove_ccwdev </function></funcdef>
   <paramdef>struct ccw_device * <parameter>cdev</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>cdev</parameter></term>
   <listitem>
    <para>
     ccw device to be removed
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
   This is a remove function for ccw devices that are slave devices in a ccw
   group device. It sets the ccw device offline and also deregisters the
   embedding ccw group device.
</para>
</refsect1>
</refentry>

   </sect1>
  </chapter>

  <chapter id="genericinterfaces">
   <title>Generic interfaces</title>
  <para>
	Some interfaces are available to other drivers that do not necessarily
	have anything to do with the busses described above, but still are
	indirectly using basic infrastructure in the common I/O layer.
	One example is the support for adapter interrupts.
  </para>
<!-- drivers/s390/cio/airq.c -->
<refentry id="API-s390-register-adapter-interrupt">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>s390_register_adapter_interrupt</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>s390_register_adapter_interrupt</refname>
 <refpurpose>
  register adapter interrupt handler
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>void * <function>s390_register_adapter_interrupt </function></funcdef>
   <paramdef>adapter_int_handler_t <parameter>handler</parameter></paramdef>
   <paramdef>void * <parameter>drv_data</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>handler</parameter></term>
   <listitem>
    <para>
     adapter handler to be registered
    </para>
   </listitem>
  </varlistentry>
  <varlistentry>
   <term><parameter>drv_data</parameter></term>
   <listitem>
    <para>
     driver data passed with each call to the handler
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
<refsect1>
<title>Returns</title>
<para>
   Pointer to the indicator to be used on success
   <function>ERR_PTR</function> if registration failed
</para>
</refsect1>
</refentry>

<refentry id="API-s390-unregister-adapter-interrupt">
<refentryinfo>
 <title>LINUX</title>
 <productname>Kernel Hackers Manual</productname>
 <date>February 2008</date>
</refentryinfo>
<refmeta>
 <refentrytitle><phrase>s390_unregister_adapter_interrupt</phrase></refentrytitle>
 <manvolnum>9</manvolnum>
 <refmiscinfo class="version">2.6.25-rc3</refmiscinfo>
</refmeta>
<refnamediv>
 <refname>s390_unregister_adapter_interrupt</refname>
 <refpurpose>
     unregister adapter interrupt handler
 </refpurpose>
</refnamediv>
<refsynopsisdiv>
 <title>Synopsis</title>
  <funcsynopsis><funcprototype>
   <funcdef>void <function>s390_unregister_adapter_interrupt </function></funcdef>
   <paramdef>void * <parameter>ind</parameter></paramdef>
  </funcprototype></funcsynopsis>
</refsynopsisdiv>
<refsect1>
 <title>Arguments</title>
 <variablelist>
  <varlistentry>
   <term><parameter>ind</parameter></term>
   <listitem>
    <para>
     indicator for which the handler is to be unregistered
    </para>
   </listitem>
  </varlistentry>
 </variablelist>
</refsect1>
</refentry>

  </chapter>

</book>
