socsvn commit: r257503 - soc2013/zcore/head/usr.sbin/bhyve

zcore at FreeBSD.org zcore at FreeBSD.org
Thu Sep 19 16:28:37 UTC 2013


Author: zcore
Date: Thu Sep 19 16:28:37 2013
New Revision: 257503
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257503

Log:
  support GET_EVENT_STATUS_NOTIFICATION

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	Thu Sep 19 16:28:02 2013	(r257502)
+++ soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c	Thu Sep 19 16:28:37 2013	(r257503)
@@ -83,6 +83,7 @@
 #define READ_10			0x28
 #define POSITION_TO_ELEMENT	0x2B
 #define READ_TOC		0x43
+#define GET_EVENT_STATUS_NOTIFICATION 0x4A
 #define MODE_SENSE_10		0x5A
 #define READ_12			0xA8
 #define READ_CD			0xBE
@@ -1009,6 +1010,38 @@
 }
 
 static void
+atapi_get_event_status_notification(struct ahci_port *p, int slot,
+					uint8_t *cfis)
+{
+	uint32_t tfd;
+	uint8_t *acmd = cfis + 0x40;
+
+	/* we don't support asynchronous operation */
+	if (!(acmd[1] & 1)) {
+		p->sense_key = ATA_SENSE_ILLEGAL_REQUEST;
+		p->asc = 0x24;
+		tfd = (p->sense_key << 12) | ATA_S_READY | ATA_S_ERROR;
+	} else {
+		int len;
+		uint8_t buf[8];
+
+		len = be16dec(acmd + 7);
+		if (len > sizeof(buf))
+			len = sizeof(buf);
+
+		memset(buf, 0, sizeof(buf));
+		be16enc(buf, 8 - 2);
+		buf[2] = 0x04;
+		buf[3] = 0x10;
+		buf[5] = 0x02;
+		write_prdt(p, slot, cfis, buf, len);
+		tfd = ATA_S_READY | ATA_S_DSC;
+	}
+	cfis[4] = (cfis[4] & ~7) | ATA_I_CMD | ATA_I_IN;
+	ahci_write_fis_d2h(p, slot, cfis, tfd);
+}
+
+static void
 handle_packet_cmd(struct ahci_port *p, int slot, uint8_t *cfis)
 {
 	uint8_t *acmd = cfis + 0x40;
@@ -1053,6 +1086,9 @@
 	case MODE_SENSE_10:
 		atapi_mode_sense(p, slot, cfis);
 		break;
+	case GET_EVENT_STATUS_NOTIFICATION:
+		atapi_get_event_status_notification(p, slot, cfis);
+		break;
 	default:
 		break;
 	}


More information about the svn-soc-all mailing list