From 91b94ddeccdbabd0de03cd39d7dc1bc657face24 Mon Sep 17 00:00:00 2001
From: mstsirkin <mstsirkin@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>
Date: Mon, 10 Oct 2016 19:37:25 +0000
Subject: ccw: add CCW_CMD_READ_STATUS

ccw currently allows the driver to update the status via the
CCW_CMD_WRITE_STATUS command; however, it does not allow the driver to
retrieve the current status at the device, which is needed to properly
support DEVICE_NEEDS_RESET.

Therefore, provide a new command CCW_CMD_READ_STATUS allowing the driver
to retrieve the device status. Provide this command when revision 2 has
been negotiated.

VIRTIO-117

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-Id: <1445243513-2263-2-git-send-email-cornelia.huck@de.ibm.com>

git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio/trunk@579 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652
---
 content.tex | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

(limited to 'content.tex')

diff --git a/content.tex b/content.tex
index 4b45678..c362a5c 100644
--- a/content.tex
+++ b/content.tex
@@ -2513,6 +2513,7 @@ virtio:
 #define CCW_CMD_WRITE_STATUS 0x31
 #define CCW_CMD_READ_VQ_CONF 0x32
 #define CCW_CMD_SET_VIRTIO_REV 0x83
+#define CCW_CMD_READ_STATUS 0x72
 \end{lstlisting}
 
 \devicenormative{\subsubsection}{Basic Concepts}{Virtio Transport Options / Virtio over channel I/O / Basic Concepts}
@@ -2573,7 +2574,9 @@ The following values are supported:
 \hline
 1        & 0      & <empty>   & Virtio 1.0 \\
 \hline
-2-n      &        &           & reserved for later revisions \\
+2        & 0      & <empty>   & CCW_CMD_READ_STATUS support \\
+\hline
+3-n      &        &           & reserved for later revisions \\
 \hline
 \end{tabular}
 
@@ -2691,18 +2694,31 @@ As described in
 a device sometimes fails to set the \field{status} field: For example, it
 might fail to accept the FEATURES_OK status bit during device initialization.
 
+With revision 2, CCW_CMD_READ_STATUS is defined: It reads an 8 bit status
+value from the device and acts as a reverse operation to CCW_CMD_WRITE_STATUS.
+
 \drivernormative{\paragraph}{Communicating Status Information}{Virtio Transport Options / Virtio over channel I/O / Device Initialization / Communicating Status Information}
 
 If the device posts a unit check with command reject in response to the
 CCW_CMD_WRITE_STATUS command, the driver MUST assume that the device failed
 to set the status and the \field{status} field retained its previous value.
 
+If at least revision 2 has been negotiated, the driver SHOULD use the
+CCW_CMD_READ_STATUS command to retrieve the \field{status} field after
+a configuration change has been detected.
+
+If not at least revision 2 has been negotiated, the driver MUST NOT attempt
+to issue the CCW_CMD_READ_STATUS command.
+
 \devicenormative{\paragraph}{Communicating Status Information}{Virtio Transport Options / Virtio over channel I/O / Device Initialization / Communicating Status Information}
 
 If the device fails to set the \field{status} field to the value written by
 the driver, the device MUST assure that the \field{status} field is left
 unchanged and MUST post a unit check with command reject.
 
+If at least revision 2 has been negotiated, the device MUST return the
+current \field{status} field if the CCW_CMD_READ_STATUS command is issued.
+
 \subsubsection{Handling Device Features}\label{sec:Virtio Transport Options / Virtio over channel I/O / Device Initialization / Handling Device Features}
 
 Feature bits are arranged in an array of 32 bit values, making
-- 
cgit v1.2.3

