qemu-patch-raspberry4/hw/ide/pci.h
Kevin Wolf def93791f2 ide: Split error status from status register
When adding the werror=stop mode, some flags were added to s->status
which are used to determine what kind of operation should be restarted
when the VM is continued.

Unfortunately, it turns out that s->status is in fact a device register
and as such is visible to the guest (some of the abused bits are even
writable for the guest).

For migration we keep on using the old VMState field (renamed to
migration_compat_status) if the status register doesn't use any of the
previously abused bits. If it does, we use a subsection with a clean copy of
the status register.

The error status is always sent in a subsection if there is any error. It can't
use the old field because errors happen even without PCI.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-15 14:36:15 +02:00

53 lines
1.2 KiB
C

#ifndef HW_IDE_PCI_H
#define HW_IDE_PCI_H
#include <hw/ide/internal.h>
typedef struct BMDMAState {
IDEDMA dma;
uint8_t cmd;
uint8_t status;
uint32_t addr;
IDEBus *bus;
/* current transfer state */
uint32_t cur_addr;
uint32_t cur_prd_last;
uint32_t cur_prd_addr;
uint32_t cur_prd_len;
uint8_t unit;
BlockDriverCompletionFunc *dma_cb;
int64_t sector_num;
uint32_t nsector;
IORange addr_ioport;
QEMUBH *bh;
qemu_irq irq;
/* Bit 0-2 and 7: BM status register
* Bit 3-6: bus->error_status */
uint8_t migration_compat_status;
} BMDMAState;
typedef struct PCIIDEState {
PCIDevice dev;
IDEBus bus[2];
BMDMAState bmdma[2];
uint32_t secondary; /* used only for cmd646 */
} PCIIDEState;
static inline IDEState *bmdma_active_if(BMDMAState *bmdma)
{
assert(bmdma->unit != (uint8_t)-1);
return bmdma->bus->ifs + bmdma->unit;
}
void bmdma_init(IDEBus *bus, BMDMAState *bm);
void bmdma_cmd_writeb(void *opaque, uint32_t addr, uint32_t val);
extern const IORangeOps bmdma_addr_ioport_ops;
void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table);
extern const VMStateDescription vmstate_ide_pci;
#endif