Pull request
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE+ber27ys35W+dsvQfe+BBqr8OQ4FAl5+XpIACgkQfe+BBqr8 OQ6Itg/8CUXVle2zxfYLO7SYdVFt5nyRqmx355nDz8M05A+ul8IsnP112FqtIAbM u7G26onW1b9tZII2QuHRyWA3lPIHHn2ybzZ0YVJSkA1EV0UpF2HjcFaq8d3aPb2x dUR3vdre+383nE1PniyPCBwMNfmch+LiF+kacBgy0wOCo8x2DYlmIKTVaTe6MAWo WWLcJ7eF6ioFRivCivHVNFoZ8yp1FOU7njh4rQyY2B/Qy3K5kjE9InPWM7fkqfKQ DaHVf1sXgJpJj/s2/O9wxMb6oazDjkGRcUUqQ6nohD3MelM2qLxxyVL0b5IJbhfF uMQlfl4/jChCIr4CH2JrcqF4GVP4YTkUrdy3w5AvjYlxfPiVyt4koEAqprZ6keTP ztuA7/TIZxy+7HCt0tdGJo8r/pis4GRzJVZCWVEJ1FDr8RO5UaI4d5iARlLWEVkS 2fOeohu/MwUrj0bTyB9Rv3NyYHI3eX2ubXOCM/UvP+rJTl3j19Ql3oiBxWwY3yOj TPYu5grDyf0hdOCu5G32U0gokvkWmJ7tw3LzgYsUA456hXSc571+hLO5eZBUh0oW WVRzqDug/Pdv3cTfepLZYJKcL3aWTwD3fh+JlKHvJqM9E4n35Z8b+WwP6++qIdTV o5OuiHmb1N6Hffv+qcJvoGdH+Ccaniq01S9K+Ble7oRP+N7n4nk= =aDvc -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging Pull request # gpg: Signature made Fri 27 Mar 2020 20:14:10 GMT # gpg: using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E # gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full] # Primary key fingerprint: FAEB 9711 A12C F475 812F 18F2 88A9 064D 1835 61EB # Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76 CBD0 7DEF 8106 AAFC 390E * remotes/jnsnow/tags/ide-pull-request: cmd646-ide: use qdev gpio rather than qemu_allocate_irqs() via-ide: use qdev gpio rather than qemu_allocate_irqs() via-ide: don't use PCI level for legacy IRQs hw/ide/sii3112: Use qdev gpio rather than qemu_allocate_irqs() fdc/i8257: implement verify transfer mode Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
5acad5bf48
@ -1714,53 +1714,28 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
|
||||
}
|
||||
fdctrl->eot = fdctrl->fifo[6];
|
||||
if (fdctrl->dor & FD_DOR_DMAEN) {
|
||||
IsaDmaTransferMode dma_mode;
|
||||
/* DMA transfer is enabled. */
|
||||
IsaDmaClass *k = ISADMA_GET_CLASS(fdctrl->dma);
|
||||
bool dma_mode_ok;
|
||||
/* DMA transfer are enabled. Check if DMA channel is well programmed */
|
||||
dma_mode = k->get_transfer_mode(fdctrl->dma, fdctrl->dma_chann);
|
||||
FLOPPY_DPRINTF("dma_mode=%d direction=%d (%d - %d)\n",
|
||||
dma_mode, direction,
|
||||
(128 << fdctrl->fifo[5]) *
|
||||
|
||||
FLOPPY_DPRINTF("direction=%d (%d - %d)\n",
|
||||
direction, (128 << fdctrl->fifo[5]) *
|
||||
(cur_drv->last_sect - ks + 1), fdctrl->data_len);
|
||||
switch (direction) {
|
||||
case FD_DIR_SCANE:
|
||||
case FD_DIR_SCANL:
|
||||
case FD_DIR_SCANH:
|
||||
dma_mode_ok = (dma_mode == ISADMA_TRANSFER_VERIFY);
|
||||
break;
|
||||
case FD_DIR_WRITE:
|
||||
dma_mode_ok = (dma_mode == ISADMA_TRANSFER_WRITE);
|
||||
break;
|
||||
case FD_DIR_READ:
|
||||
dma_mode_ok = (dma_mode == ISADMA_TRANSFER_READ);
|
||||
break;
|
||||
case FD_DIR_VERIFY:
|
||||
dma_mode_ok = true;
|
||||
break;
|
||||
default:
|
||||
dma_mode_ok = false;
|
||||
break;
|
||||
}
|
||||
if (dma_mode_ok) {
|
||||
/* No access is allowed until DMA transfer has completed */
|
||||
fdctrl->msr &= ~FD_MSR_RQM;
|
||||
if (direction != FD_DIR_VERIFY) {
|
||||
/* Now, we just have to wait for the DMA controller to
|
||||
* recall us...
|
||||
*/
|
||||
k->hold_DREQ(fdctrl->dma, fdctrl->dma_chann);
|
||||
k->schedule(fdctrl->dma);
|
||||
} else {
|
||||
/* Start transfer */
|
||||
fdctrl_transfer_handler(fdctrl, fdctrl->dma_chann, 0,
|
||||
fdctrl->data_len);
|
||||
}
|
||||
return;
|
||||
|
||||
/* No access is allowed until DMA transfer has completed */
|
||||
fdctrl->msr &= ~FD_MSR_RQM;
|
||||
if (direction != FD_DIR_VERIFY) {
|
||||
/*
|
||||
* Now, we just have to wait for the DMA controller to
|
||||
* recall us...
|
||||
*/
|
||||
k->hold_DREQ(fdctrl->dma, fdctrl->dma_chann);
|
||||
k->schedule(fdctrl->dma);
|
||||
} else {
|
||||
FLOPPY_DPRINTF("bad dma_mode=%d direction=%d\n", dma_mode,
|
||||
direction);
|
||||
/* Start transfer */
|
||||
fdctrl_transfer_handler(fdctrl, fdctrl->dma_chann, 0,
|
||||
fdctrl->data_len);
|
||||
}
|
||||
return;
|
||||
}
|
||||
FLOPPY_DPRINTF("start non-DMA transfer\n");
|
||||
fdctrl->msr |= FD_MSR_NONDMA | FD_MSR_RQM;
|
||||
|
@ -292,12 +292,6 @@ static uint64_t i8257_read_cont(void *opaque, hwaddr nport, unsigned size)
|
||||
return val;
|
||||
}
|
||||
|
||||
static IsaDmaTransferMode i8257_dma_get_transfer_mode(IsaDma *obj, int nchan)
|
||||
{
|
||||
I8257State *d = I8257(obj);
|
||||
return (d->regs[nchan & 3].mode >> 2) & 3;
|
||||
}
|
||||
|
||||
static bool i8257_dma_has_autoinitialization(IsaDma *obj, int nchan)
|
||||
{
|
||||
I8257State *d = I8257(obj);
|
||||
@ -400,6 +394,11 @@ static void i8257_dma_register_channel(IsaDma *obj, int nchan,
|
||||
r->opaque = opaque;
|
||||
}
|
||||
|
||||
static bool i8257_is_verify_transfer(I8257Regs *r)
|
||||
{
|
||||
return (r->mode & 0x0c) == 0;
|
||||
}
|
||||
|
||||
static int i8257_dma_read_memory(IsaDma *obj, int nchan, void *buf, int pos,
|
||||
int len)
|
||||
{
|
||||
@ -407,6 +406,10 @@ static int i8257_dma_read_memory(IsaDma *obj, int nchan, void *buf, int pos,
|
||||
I8257Regs *r = &d->regs[nchan & 3];
|
||||
hwaddr addr = ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[ADDR];
|
||||
|
||||
if (i8257_is_verify_transfer(r)) {
|
||||
return len;
|
||||
}
|
||||
|
||||
if (r->mode & 0x20) {
|
||||
int i;
|
||||
uint8_t *p = buf;
|
||||
@ -431,6 +434,10 @@ static int i8257_dma_write_memory(IsaDma *obj, int nchan, void *buf, int pos,
|
||||
I8257Regs *r = &s->regs[nchan & 3];
|
||||
hwaddr addr = ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[ADDR];
|
||||
|
||||
if (i8257_is_verify_transfer(r)) {
|
||||
return len;
|
||||
}
|
||||
|
||||
if (r->mode & 0x20) {
|
||||
int i;
|
||||
uint8_t *p = buf;
|
||||
@ -597,7 +604,6 @@ static void i8257_class_init(ObjectClass *klass, void *data)
|
||||
dc->vmsd = &vmstate_i8257;
|
||||
device_class_set_props(dc, i8257_properties);
|
||||
|
||||
idc->get_transfer_mode = i8257_dma_get_transfer_mode;
|
||||
idc->has_autoinitialization = i8257_dma_has_autoinitialization;
|
||||
idc->read_memory = i8257_dma_read_memory;
|
||||
idc->write_memory = i8257_dma_write_memory;
|
||||
|
@ -249,8 +249,8 @@ static void cmd646_pci_config_write(PCIDevice *d, uint32_t addr, uint32_t val,
|
||||
static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
PCIIDEState *d = PCI_IDE(dev);
|
||||
DeviceState *ds = DEVICE(dev);
|
||||
uint8_t *pci_conf = dev->config;
|
||||
qemu_irq *irq;
|
||||
int i;
|
||||
|
||||
pci_conf[PCI_CLASS_PROG] = 0x8f;
|
||||
@ -291,16 +291,15 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp)
|
||||
/* TODO: RST# value should be 0 */
|
||||
pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1
|
||||
|
||||
irq = qemu_allocate_irqs(cmd646_set_irq, d, 2);
|
||||
qdev_init_gpio_in(ds, cmd646_set_irq, 2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(dev), i, 2);
|
||||
ide_init2(&d->bus[i], irq[i]);
|
||||
ide_bus_new(&d->bus[i], sizeof(d->bus[i]), ds, i, 2);
|
||||
ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i));
|
||||
|
||||
bmdma_init(&d->bus[i], &d->bmdma[i], d);
|
||||
d->bmdma[i].bus = &d->bus[i];
|
||||
ide_register_restart_cb(&d->bus[i]);
|
||||
}
|
||||
g_free(irq);
|
||||
}
|
||||
|
||||
static void pci_cmd646_ide_exitfn(PCIDevice *dev)
|
||||
|
@ -251,8 +251,8 @@ static void sii3112_pci_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
SiI3112PCIState *d = SII3112_PCI(dev);
|
||||
PCIIDEState *s = PCI_IDE(dev);
|
||||
DeviceState *ds = DEVICE(dev);
|
||||
MemoryRegion *mr;
|
||||
qemu_irq *irq;
|
||||
int i;
|
||||
|
||||
pci_config_set_interrupt_pin(dev->config, 1);
|
||||
@ -280,10 +280,10 @@ static void sii3112_pci_realize(PCIDevice *dev, Error **errp)
|
||||
memory_region_init_alias(mr, OBJECT(d), "sii3112.bar4", &d->mmio, 0, 16);
|
||||
pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, mr);
|
||||
|
||||
irq = qemu_allocate_irqs(sii3112_set_irq, d, 2);
|
||||
qdev_init_gpio_in(ds, sii3112_set_irq, 2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
ide_bus_new(&s->bus[i], sizeof(s->bus[i]), DEVICE(dev), i, 1);
|
||||
ide_init2(&s->bus[i], irq[i]);
|
||||
ide_bus_new(&s->bus[i], sizeof(s->bus[i]), ds, i, 1);
|
||||
ide_init2(&s->bus[i], qdev_get_gpio_in(ds, i));
|
||||
|
||||
bmdma_init(&s->bus[i], &s->bmdma[i], s);
|
||||
s->bmdma[i].bus = &s->bus[i];
|
||||
|
@ -112,7 +112,6 @@ static void via_ide_set_irq(void *opaque, int n, int level)
|
||||
d->config[0x70 + n * 8] &= ~0x80;
|
||||
}
|
||||
|
||||
level = (d->config[0x70] & 0x80) || (d->config[0x78] & 0x80);
|
||||
qemu_set_irq(isa_get_irq(NULL, 14 + n), level);
|
||||
}
|
||||
|
||||
@ -161,6 +160,7 @@ static void via_ide_reset(DeviceState *dev)
|
||||
static void via_ide_realize(PCIDevice *dev, Error **errp)
|
||||
{
|
||||
PCIIDEState *d = PCI_IDE(dev);
|
||||
DeviceState *ds = DEVICE(dev);
|
||||
uint8_t *pci_conf = dev->config;
|
||||
int i;
|
||||
|
||||
@ -188,9 +188,10 @@ static void via_ide_realize(PCIDevice *dev, Error **errp)
|
||||
bmdma_setup_bar(d);
|
||||
pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
|
||||
|
||||
qdev_init_gpio_in(ds, via_ide_set_irq, 2);
|
||||
for (i = 0; i < 2; i++) {
|
||||
ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
|
||||
ide_init2(&d->bus[i], qemu_allocate_irq(via_ide_set_irq, d, i));
|
||||
ide_bus_new(&d->bus[i], sizeof(d->bus[i]), ds, i, 2);
|
||||
ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i));
|
||||
|
||||
bmdma_init(&d->bus[i], &d->bmdma[i], d);
|
||||
d->bmdma[i].bus = &d->bus[i];
|
||||
|
@ -56,7 +56,6 @@ typedef int (*IsaDmaTransferHandler)(void *opaque, int nchan, int pos,
|
||||
typedef struct IsaDmaClass {
|
||||
InterfaceClass parent;
|
||||
|
||||
IsaDmaTransferMode (*get_transfer_mode)(IsaDma *obj, int nchan);
|
||||
bool (*has_autoinitialization)(IsaDma *obj, int nchan);
|
||||
int (*read_memory)(IsaDma *obj, int nchan, void *buf, int pos, int len);
|
||||
int (*write_memory)(IsaDma *obj, int nchan, void *buf, int pos, int len);
|
||||
|
Loading…
Reference in New Issue
Block a user