diff options
author | Sebastian Herbszt <herbszt@gmx.de> | 2011-02-01 15:51:26 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-02-07 11:14:01 +0100 |
commit | 03c7a6a8e7122b9c12a532577046094a69593116 (patch) | |
tree | 119eea8a08d290ef9739f22d4214dc62a6c4a9a8 /hw/ide/ich.c | |
parent | 4f3669ea5bd73ade0dce5f1155cb9ad9788fd54c (diff) |
ahci: split ICH9 from core
There are multiple ahci devices out there. The currently implemented ich-9
is only one of the many. So let's split that one out into a separate file
to stress the difference.
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/ich.c')
-rw-r--r-- | hw/ide/ich.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/hw/ide/ich.c b/hw/ide/ich.c new file mode 100644 index 0000000000..9868b73592 --- /dev/null +++ b/hw/ide/ich.c @@ -0,0 +1,61 @@ +#include <hw/hw.h> +#include <hw/msi.h> +#include <hw/pc.h> +#include <hw/pci.h> +#include <hw/isa.h> +#include "block.h" +#include "block_int.h" +#include "sysemu.h" +#include "dma.h" + +#include <hw/ide/pci.h> +#include <hw/ide/ahci.h> + +static int pci_ich9_ahci_initfn(PCIDevice *dev) +{ + struct AHCIPCIState *d; + d = DO_UPCAST(struct AHCIPCIState, card, dev); + + pci_config_set_vendor_id(d->card.config, PCI_VENDOR_ID_INTEL); + pci_config_set_device_id(d->card.config, PCI_DEVICE_ID_INTEL_82801IR); + + pci_config_set_class(d->card.config, PCI_CLASS_STORAGE_SATA); + pci_config_set_revision(d->card.config, 0x02); + pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1); + + d->card.config[PCI_CACHE_LINE_SIZE] = 0x08; /* Cache line size */ + d->card.config[PCI_LATENCY_TIMER] = 0x00; /* Latency timer */ + pci_config_set_interrupt_pin(d->card.config, 1); + + /* XXX Software should program this register */ + d->card.config[0x90] = 1 << 6; /* Address Map Register - AHCI mode */ + + qemu_register_reset(ahci_reset, d); + + /* XXX BAR size should be 1k, but that breaks, so bump it to 4k for now */ + pci_register_bar(&d->card, 5, 0x1000, PCI_BASE_ADDRESS_SPACE_MEMORY, + ahci_pci_map); + + msi_init(dev, 0x50, 1, true, false); + + ahci_init(&d->ahci, &dev->qdev); + d->ahci.irq = d->card.irq[0]; + + return 0; +} + +static PCIDeviceInfo ich_ahci_info[] = { + { + .qdev.name = "ich9-ahci", + .qdev.size = sizeof(AHCIPCIState), + .init = pci_ich9_ahci_initfn, + },{ + /* end of list */ + } +}; + +static void ich_ahci_register(void) +{ + pci_qdev_register_many(ich_ahci_info); +} +device_init(ich_ahci_register); |