ide: PCIIDEState type field is not needed anymore
We have split the functions that needed it for cmd646 Patchworks-ID: 35302 Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
4c3df0ecc2
commit
58c0e7326e
@ -80,24 +80,17 @@ static uint32_t bmdma_readb(void *opaque, uint32_t addr)
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
pci_dev = bm->pci_dev;
|
pci_dev = bm->pci_dev;
|
||||||
if (pci_dev->type == IDE_TYPE_CMD646) {
|
val = pci_dev->dev.config[MRDMODE];
|
||||||
val = pci_dev->dev.config[MRDMODE];
|
|
||||||
} else {
|
|
||||||
val = 0xff;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
val = bm->status;
|
val = bm->status;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
pci_dev = bm->pci_dev;
|
pci_dev = bm->pci_dev;
|
||||||
if (pci_dev->type == IDE_TYPE_CMD646) {
|
if (bm == &pci_dev->bmdma[0]) {
|
||||||
if (bm == &pci_dev->bmdma[0])
|
val = pci_dev->dev.config[UDIDETCR0];
|
||||||
val = pci_dev->dev.config[UDIDETCR0];
|
|
||||||
else
|
|
||||||
val = pci_dev->dev.config[UDIDETCR1];
|
|
||||||
} else {
|
} else {
|
||||||
val = 0xff;
|
val = pci_dev->dev.config[UDIDETCR1];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -120,23 +113,19 @@ static void bmdma_writeb(void *opaque, uint32_t addr, uint32_t val)
|
|||||||
switch(addr & 3) {
|
switch(addr & 3) {
|
||||||
case 1:
|
case 1:
|
||||||
pci_dev = bm->pci_dev;
|
pci_dev = bm->pci_dev;
|
||||||
if (pci_dev->type == IDE_TYPE_CMD646) {
|
pci_dev->dev.config[MRDMODE] =
|
||||||
pci_dev->dev.config[MRDMODE] =
|
(pci_dev->dev.config[MRDMODE] & ~0x30) | (val & 0x30);
|
||||||
(pci_dev->dev.config[MRDMODE] & ~0x30) | (val & 0x30);
|
cmd646_update_irq(pci_dev);
|
||||||
cmd646_update_irq(pci_dev);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);
|
bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
pci_dev = bm->pci_dev;
|
pci_dev = bm->pci_dev;
|
||||||
if (pci_dev->type == IDE_TYPE_CMD646) {
|
if (bm == &pci_dev->bmdma[0])
|
||||||
if (bm == &pci_dev->bmdma[0])
|
pci_dev->dev.config[UDIDETCR0] = val;
|
||||||
pci_dev->dev.config[UDIDETCR0] = val;
|
else
|
||||||
else
|
pci_dev->dev.config[UDIDETCR1] = val;
|
||||||
pci_dev->dev.config[UDIDETCR1] = val;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,7 +200,6 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev)
|
|||||||
uint8_t *pci_conf = d->dev.config;
|
uint8_t *pci_conf = d->dev.config;
|
||||||
qemu_irq *irq;
|
qemu_irq *irq;
|
||||||
|
|
||||||
d->type = IDE_TYPE_CMD646;
|
|
||||||
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD);
|
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD);
|
||||||
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646);
|
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646);
|
||||||
|
|
||||||
|
@ -3,15 +3,10 @@
|
|||||||
|
|
||||||
#include <hw/ide/internal.h>
|
#include <hw/ide/internal.h>
|
||||||
|
|
||||||
#define IDE_TYPE_PIIX3 0
|
|
||||||
#define IDE_TYPE_CMD646 1
|
|
||||||
#define IDE_TYPE_PIIX4 2
|
|
||||||
|
|
||||||
typedef struct PCIIDEState {
|
typedef struct PCIIDEState {
|
||||||
PCIDevice dev;
|
PCIDevice dev;
|
||||||
IDEBus bus[2];
|
IDEBus bus[2];
|
||||||
BMDMAState bmdma[2];
|
BMDMAState bmdma[2];
|
||||||
int type; /* see IDE_TYPE_xxx */
|
|
||||||
uint32_t secondary;
|
uint32_t secondary;
|
||||||
} PCIIDEState;
|
} PCIIDEState;
|
||||||
|
|
||||||
|
@ -141,7 +141,6 @@ static int pci_piix3_ide_initfn(PCIDevice *dev)
|
|||||||
{
|
{
|
||||||
PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);
|
PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);
|
||||||
|
|
||||||
d->type = IDE_TYPE_PIIX3;
|
|
||||||
pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
|
pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
|
||||||
pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371SB_1);
|
pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371SB_1);
|
||||||
return pci_piix_ide_initfn(d);
|
return pci_piix_ide_initfn(d);
|
||||||
@ -151,7 +150,6 @@ static int pci_piix4_ide_initfn(PCIDevice *dev)
|
|||||||
{
|
{
|
||||||
PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);
|
PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);
|
||||||
|
|
||||||
d->type = IDE_TYPE_PIIX4;
|
|
||||||
pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
|
pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
|
||||||
pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371AB);
|
pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371AB);
|
||||||
return pci_piix_ide_initfn(d);
|
return pci_piix_ide_initfn(d);
|
||||||
|
Loading…
Reference in New Issue
Block a user