Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 384

kvm-83-270.el5_11.src.rpm

From e6470c80a710257bcc232c60aafc780acf6ad473 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Tue, 19 Apr 2011 15:10:16 -0300
Subject: [PATCH 04/10] ide/atapi: add support for GET EVENT STATUS
 NOTIFICATION

RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <1303225822-22611-3-git-send-email-armbru@redhat.com>
Patchwork-id: 22559
O-Subject: [PATCH RHEL5 qemu-kvm 2/8] ide/atapi: add support for GET EVENT STATUS NOTIFICATION
Bugzilla: 652135
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>

The GET EVENT STATUS NOTIFICATION is a mandatory command according
to MMC-3, even if event status notification is not supported.

This patch adds support for this command. It returns NEA ("No Event
Available") with an empty "Supported Event Classes" to show that it
doesn't event support status notification. If asychronous operation is
requested, which requires NCQ support, it returns an error according
to the specifications.

This fixes HAL support on FreeBSD and derivatives, which fill up the
logs every second with:

  acd0: FAILURE - unknown CMD (0x03) ILLEGAL REQUEST asc=0x20 ascq=0x00

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Manually cherry-picked from qemu commit 253cb7b9909806b83d73269afb9cf0ab3fa2ce2c
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qemu/hw/ide.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qemu/hw/ide.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c
index bf8f4cb..f7a6604 100644
--- a/qemu/hw/ide.c
+++ b/qemu/hw/ide.c
@@ -2034,6 +2034,21 @@ static void ide_atapi_cmd(IDEState *s)
             ide_atapi_cmd_reply(s, len, max_len);
             break;
         }
+    case GPCMD_GET_EVENT_STATUS_NOTIFICATION:
+        max_len = ube16_to_cpu(packet + 7);
+
+        if (packet[1] & 0x01) { /* polling */
+            /* We don't support any event class (yet). */
+            cpu_to_ube16(buf, 0x00); /* No event descriptor returned */
+            buf[2] = 0x80;           /* No Event Available (NEA) */
+            buf[3] = 0x00;           /* Empty supported event classes */
+            ide_atapi_cmd_reply(s, 4, max_len);
+        } else { /* asynchronous mode */
+            /* Only polling is supported, asynchronous mode is not. */
+            ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
+                                ASC_INV_FIELD_IN_CMD_PACKET);
+        }
+        break;
     default:
         ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
                             ASC_ILLEGAL_OPCODE);
-- 
1.7.5.141.g791a