[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 08/10] ahci: add ahci emulation
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] Re: [PATCH 08/10] ahci: add ahci emulation |
Date: |
Thu, 18 Nov 2010 09:01:56 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100827 Red Hat/3.1.3-1.el6 Thunderbird/3.1.3 |
Hi,
+static void ahci_trigger_irq(AHCIState *s, AHCIDevice *d,
+ int irq_type)
+static void ahci_check_irq(AHCIState *s)
MSI support would be nice to have.
+#ifndef min
+#define min(a, b) ((a)< (b) ? (a) : (b))
+#endif
osdep.h has MIN/MAX macros.
+static void ahci_init(AHCIState *s, DeviceState *qdev)
+{
+ ide_bus_new(&ad->port, qdev);
+ ide_init2(&ad->port, 0);
Good.
+ if (dinfo) {
+ ide_create_drive(&ad->port, 0, dinfo);
+ }
That doesn't belong into the qdev init function.
Look how ide/isa.c handles it: The qdev init function (isa_ide_initfn)
doesn't create ide-drives at all. And there is a convinience function
(isa_ide_init) which first creates the controller, then attaches the
drives. The later is called from pc_init() with the drives specified
via -drive if=ide (or -hda).
Does AHCI support drive hotplug btw?
+static void ahci_reset(void *opaque)
+{
+ pci_config_set_vendor_id(d->card.config, PCI_VENDOR_ID_INTEL);
+ pci_config_set_device_id(d->card.config, PCI_DEVICE_ID_INTEL_ICH7M_AHCI);
+ pci_config_set_class(d->card.config, PCI_CLASS_STORAGE_SATA);
+ pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1);
+ d->card.config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL;
+ d->card.config[PCI_INTERRUPT_PIN] = 1; /* interrupt pin 0 */
Why is that in the reset function instead of init? It should never ever
change, should it?
+static PCIDeviceInfo ahci_info = {
+ .qdev.name = "ahci",
+ .qdev.size = sizeof(AHCIPciState),
+ .init = pci_ahci_init,
+ .exit = pci_ahci_uninit,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_END_OF_LIST(),
+ }
If there are no properties you can zap the last tree lines altogether ;)
cheers,
Gerd
- [Qemu-devel] [PATCH 07/10] pci: add ich7 pci id, (continued)
- [Qemu-devel] [PATCH 07/10] pci: add ich7 pci id, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 09/10] ahci: add -drive support, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 01/10] ide: split ide command interpretation off, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 03/10] ide: add support for ide bus ops, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 04/10] ide: add DMA hooks to bus ops, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 05/10] ide: add ncq identify data for ahci sata drives, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 06/10] pci: add storage class for sata, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 10/10] ahci: spawn controller on demand, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 02/10] ide: fix whitespace gap in ide_exec_cmd, Alexander Graf, 2010/11/17
- [Qemu-devel] [PATCH 08/10] ahci: add ahci emulation, Alexander Graf, 2010/11/17
- [Qemu-devel] Re: [PATCH 08/10] ahci: add ahci emulation,
Gerd Hoffmann <=
[Qemu-devel] Re: [PATCH 00/10] AHCI emulation support v2, Stefan Hajnoczi, 2010/11/18
Re: [Qemu-devel] [PATCH 00/10] AHCI emulation support v2, Kevin Wolf, 2010/11/18