[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/23] ide: Convert WIN_DSM to ide_cmd_table handler
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 02/23] ide: Convert WIN_DSM to ide_cmd_table handler |
Date: |
Mon, 24 Jun 2013 11:10:14 +0200 |
From: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/ide/core.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index cd9de14..567515e 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1004,6 +1004,21 @@ void ide_ioport_write(void *opaque, uint32_t addr,
uint32_t val)
}
}
+static bool cmd_data_set_management(IDEState *s, uint8_t cmd)
+{
+ switch (s->feature) {
+ case DSM_TRIM:
+ if (s->bs) {
+ ide_sector_start_dma(s, IDE_DMA_TRIM);
+ return false;
+ }
+ break;
+ }
+
+ ide_abort_command(s);
+ return true;
+}
+
#define HD_OK (1u << IDE_HD)
#define CD_OK (1u << IDE_CD)
#define CFA_OK (1u << IDE_CFATA)
@@ -1021,7 +1036,7 @@ static const struct {
} ide_cmd_table[0x100] = {
/* NOP not implemented, mandatory for CD */
[CFA_REQ_EXT_ERROR_CODE] = { NULL, CFA_OK },
- [WIN_DSM] = { NULL, ALL_OK },
+ [WIN_DSM] = { cmd_data_set_management, ALL_OK },
[WIN_DEVICE_RESET] = { NULL, CD_OK },
[WIN_RECAL] = { NULL, HD_CFA_OK },
[WIN_READ] = { NULL, ALL_OK },
@@ -1129,18 +1144,6 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
}
switch(val) {
- case WIN_DSM:
- switch (s->feature) {
- case DSM_TRIM:
- if (!s->bs) {
- goto abort_cmd;
- }
- ide_sector_start_dma(s, IDE_DMA_TRIM);
- break;
- default:
- goto abort_cmd;
- }
- break;
case WIN_IDENTIFY:
if (s->bs && s->drive_kind != IDE_CD) {
if (s->drive_kind != IDE_CFATA)
--
1.8.1.4
- [Qemu-devel] [PULL 00/23] Block patches, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 02/23] ide: Convert WIN_DSM to ide_cmd_table handler,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 01/23] ide: Add handler to ide_cmd_table, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 03/23] ide: Convert WIN_IDENTIFY to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 04/23] ide: Convert cmd_nop commands to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 05/23] ide: Convert verify commands to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 06/23] ide: Convert read/write multiple commands to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 09/23] ide: Convert READ NATIVE MAX ADDRESS to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 10/23] ide: Convert CHECK POWER MDOE to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 08/23] ide: Convert DMA read/write commands to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 07/23] ide: Convert PIO read/write commands to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24
- [Qemu-devel] [PATCH 11/23] ide: Convert SET FEATURES to ide_cmd_table handler, Stefan Hajnoczi, 2013/06/24