Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Sep 2013 09:48:50 GMT
From:      zcore@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r257359 - soc2013/zcore/head/usr.sbin/bhyve
Message-ID:  <201309150948.r8F9moDd011432@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zcore
Date: Sun Sep 15 09:48:50 2013
New Revision: 257359
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257359

Log:
  support ATAPI_REQUEST_SENSE

Modified:
  soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c

Modified: soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c
==============================================================================
--- soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c	Sun Sep 15 09:48:15 2013	(r257358)
+++ soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c	Sun Sep 15 09:48:50 2013	(r257359)
@@ -857,6 +857,26 @@
 }
 
 static void
+atapi_request_sense(struct ahci_port *p, int slot, uint8_t *cfis)
+{
+	int len;
+	uint8_t buf[64];
+	uint8_t *acmd = cfis + 0x40;
+
+	len = acmd[4];
+	if (len > sizeof(buf))
+		len = sizeof(buf);
+	memset(buf, 0, len);
+	buf[0] = 0x70 | (1 << 7);
+	buf[2] = p->sense_key;
+	buf[7] = 10;
+	buf[12] = p->asc;
+	write_prdt(p, slot, cfis, buf, len);
+	cfis[4] = (cfis[4] & ~7) | ATA_I_CMD | ATA_I_IN;
+	ahci_write_fis_d2h(p, slot, cfis, ATA_S_READY | ATA_S_DSC);
+}
+
+static void
 handle_packet_cmd(struct ahci_port *p, int slot, uint8_t *cfis)
 {
 	uint8_t *acmd = cfis + 0x40;
@@ -890,6 +910,9 @@
 	case ATAPI_READ_BIG:
 		atapi_read(p, slot, cfis);
 		break;
+	case ATAPI_REQUEST_SENSE:
+		atapi_request_sense(p, slot, cfis);
+		break;
 	default:
 		break;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309150948.r8F9moDd011432>