mirror of https://github.com/proxmox/mirror_qemu
ide: move retry constants out of BM_STATUS_* namespace
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>master
parent
7e2648df86
commit
fd648f10af
|
@ -523,8 +523,8 @@ static void ide_sector_read_cb(void *opaque, int ret)
|
||||||
|
|
||||||
bdrv_acct_done(s->bs, &s->acct);
|
bdrv_acct_done(s->bs, &s->acct);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if (ide_handle_rw_error(s, -ret, BM_STATUS_PIO_RETRY |
|
if (ide_handle_rw_error(s, -ret, IDE_RETRY_PIO |
|
||||||
BM_STATUS_RETRY_READ)) {
|
IDE_RETRY_READ)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -614,14 +614,14 @@ void ide_dma_error(IDEState *s)
|
||||||
|
|
||||||
static int ide_handle_rw_error(IDEState *s, int error, int op)
|
static int ide_handle_rw_error(IDEState *s, int error, int op)
|
||||||
{
|
{
|
||||||
bool is_read = (op & BM_STATUS_RETRY_READ) != 0;
|
bool is_read = (op & IDE_RETRY_READ) != 0;
|
||||||
BlockErrorAction action = bdrv_get_error_action(s->bs, is_read, error);
|
BlockErrorAction action = bdrv_get_error_action(s->bs, is_read, error);
|
||||||
|
|
||||||
if (action == BLOCK_ERROR_ACTION_STOP) {
|
if (action == BLOCK_ERROR_ACTION_STOP) {
|
||||||
s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
|
s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
|
||||||
s->bus->error_status = op;
|
s->bus->error_status = op;
|
||||||
} else if (action == BLOCK_ERROR_ACTION_REPORT) {
|
} else if (action == BLOCK_ERROR_ACTION_REPORT) {
|
||||||
if (op & BM_STATUS_DMA_RETRY) {
|
if (op & IDE_RETRY_DMA) {
|
||||||
dma_buf_commit(s);
|
dma_buf_commit(s);
|
||||||
ide_dma_error(s);
|
ide_dma_error(s);
|
||||||
} else {
|
} else {
|
||||||
|
@ -640,12 +640,12 @@ void ide_dma_cb(void *opaque, int ret)
|
||||||
bool stay_active = false;
|
bool stay_active = false;
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
int op = BM_STATUS_DMA_RETRY;
|
int op = IDE_RETRY_DMA;
|
||||||
|
|
||||||
if (s->dma_cmd == IDE_DMA_READ)
|
if (s->dma_cmd == IDE_DMA_READ)
|
||||||
op |= BM_STATUS_RETRY_READ;
|
op |= IDE_RETRY_READ;
|
||||||
else if (s->dma_cmd == IDE_DMA_TRIM)
|
else if (s->dma_cmd == IDE_DMA_TRIM)
|
||||||
op |= BM_STATUS_RETRY_TRIM;
|
op |= IDE_RETRY_TRIM;
|
||||||
|
|
||||||
if (ide_handle_rw_error(s, -ret, op)) {
|
if (ide_handle_rw_error(s, -ret, op)) {
|
||||||
return;
|
return;
|
||||||
|
@ -769,7 +769,7 @@ static void ide_sector_write_cb(void *opaque, int ret)
|
||||||
s->status &= ~BUSY_STAT;
|
s->status &= ~BUSY_STAT;
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if (ide_handle_rw_error(s, -ret, BM_STATUS_PIO_RETRY)) {
|
if (ide_handle_rw_error(s, -ret, IDE_RETRY_PIO)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -843,7 +843,7 @@ static void ide_flush_cb(void *opaque, int ret)
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* XXX: What sector number to set here? */
|
/* XXX: What sector number to set here? */
|
||||||
if (ide_handle_rw_error(s, -ret, BM_STATUS_RETRY_FLUSH)) {
|
if (ide_handle_rw_error(s, -ret, IDE_RETRY_FLUSH)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2338,7 +2338,7 @@ static bool ide_drive_pio_state_needed(void *opaque)
|
||||||
IDEState *s = opaque;
|
IDEState *s = opaque;
|
||||||
|
|
||||||
return ((s->status & DRQ_STAT) != 0)
|
return ((s->status & DRQ_STAT) != 0)
|
||||||
|| (s->bus->error_status & BM_STATUS_PIO_RETRY);
|
|| (s->bus->error_status & IDE_RETRY_PIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ide_tray_state_needed(void *opaque)
|
static bool ide_tray_state_needed(void *opaque)
|
||||||
|
|
|
@ -484,12 +484,12 @@ struct IDEDevice {
|
||||||
uint64_t wwn;
|
uint64_t wwn;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FIXME These are not status register bits */
|
/* These are used for the error_status field of IDEBus */
|
||||||
#define BM_STATUS_DMA_RETRY 0x08
|
#define IDE_RETRY_DMA 0x08
|
||||||
#define BM_STATUS_PIO_RETRY 0x10
|
#define IDE_RETRY_PIO 0x10
|
||||||
#define BM_STATUS_RETRY_READ 0x20
|
#define IDE_RETRY_READ 0x20
|
||||||
#define BM_STATUS_RETRY_FLUSH 0x40
|
#define IDE_RETRY_FLUSH 0x40
|
||||||
#define BM_STATUS_RETRY_TRIM 0x80
|
#define IDE_RETRY_TRIM 0x80
|
||||||
|
|
||||||
static inline IDEState *idebus_active_if(IDEBus *bus)
|
static inline IDEState *idebus_active_if(IDEBus *bus)
|
||||||
{
|
{
|
||||||
|
|
14
hw/ide/pci.c
14
hw/ide/pci.c
|
@ -34,8 +34,8 @@
|
||||||
#define BMDMA_PAGE_SIZE 4096
|
#define BMDMA_PAGE_SIZE 4096
|
||||||
|
|
||||||
#define BM_MIGRATION_COMPAT_STATUS_BITS \
|
#define BM_MIGRATION_COMPAT_STATUS_BITS \
|
||||||
(BM_STATUS_DMA_RETRY | BM_STATUS_PIO_RETRY | \
|
(IDE_RETRY_DMA | IDE_RETRY_PIO | \
|
||||||
BM_STATUS_RETRY_READ | BM_STATUS_RETRY_FLUSH)
|
IDE_RETRY_READ | IDE_RETRY_FLUSH)
|
||||||
|
|
||||||
static void bmdma_start_dma(IDEDMA *dma, IDEState *s,
|
static void bmdma_start_dma(IDEDMA *dma, IDEState *s,
|
||||||
BlockDriverCompletionFunc *dma_cb)
|
BlockDriverCompletionFunc *dma_cb)
|
||||||
|
@ -198,7 +198,7 @@ static void bmdma_restart_bh(void *opaque)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_read = (bus->error_status & BM_STATUS_RETRY_READ) != 0;
|
is_read = (bus->error_status & IDE_RETRY_READ) != 0;
|
||||||
|
|
||||||
/* The error status must be cleared before resubmitting the request: The
|
/* The error status must be cleared before resubmitting the request: The
|
||||||
* request may fail again, and this case can only be distinguished if the
|
* request may fail again, and this case can only be distinguished if the
|
||||||
|
@ -206,19 +206,19 @@ static void bmdma_restart_bh(void *opaque)
|
||||||
error_status = bus->error_status;
|
error_status = bus->error_status;
|
||||||
bus->error_status = 0;
|
bus->error_status = 0;
|
||||||
|
|
||||||
if (error_status & BM_STATUS_DMA_RETRY) {
|
if (error_status & IDE_RETRY_DMA) {
|
||||||
if (error_status & BM_STATUS_RETRY_TRIM) {
|
if (error_status & IDE_RETRY_TRIM) {
|
||||||
bmdma_restart_dma(bm, IDE_DMA_TRIM);
|
bmdma_restart_dma(bm, IDE_DMA_TRIM);
|
||||||
} else {
|
} else {
|
||||||
bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
|
bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
|
||||||
}
|
}
|
||||||
} else if (error_status & BM_STATUS_PIO_RETRY) {
|
} else if (error_status & IDE_RETRY_PIO) {
|
||||||
if (is_read) {
|
if (is_read) {
|
||||||
ide_sector_read(bmdma_active_if(bm));
|
ide_sector_read(bmdma_active_if(bm));
|
||||||
} else {
|
} else {
|
||||||
ide_sector_write(bmdma_active_if(bm));
|
ide_sector_write(bmdma_active_if(bm));
|
||||||
}
|
}
|
||||||
} else if (error_status & BM_STATUS_RETRY_FLUSH) {
|
} else if (error_status & IDE_RETRY_FLUSH) {
|
||||||
ide_flush_cache(bmdma_active_if(bm));
|
ide_flush_cache(bmdma_active_if(bm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue