Skip to content

Commit

Permalink
hw/ide/piix: Introduce TYPE_ macros for PIIX IDE controllers
Browse files Browse the repository at this point in the history
Suggested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221022150508.26830-9-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
  • Loading branch information
shentok authored and philmd committed Oct 31, 2022
1 parent 0b6fdb9 commit bb2e9b1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion hw/i386/pc_piix.c
Expand Up @@ -40,6 +40,7 @@
#include "hw/usb.h"
#include "net/net.h"
#include "hw/ide/pci.h"
#include "hw/ide/piix.h"
#include "hw/irq.h"
#include "sysemu/kvm.h"
#include "hw/kvm/clock.h"
Expand Down Expand Up @@ -259,7 +260,7 @@ static void pc_init1(MachineState *machine,
if (pcmc->pci_enabled) {
PCIDevice *dev;

dev = pci_create_simple(pci_bus, piix3_devfn + 1, "piix3-ide");
dev = pci_create_simple(pci_bus, piix3_devfn + 1, TYPE_PIIX3_IDE);
pci_ide_create_devs(dev);
idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
Expand Down
5 changes: 3 additions & 2 deletions hw/ide/piix.c
Expand Up @@ -36,6 +36,7 @@
#include "sysemu/blockdev.h"
#include "sysemu/dma.h"

#include "hw/ide/piix.h"
#include "hw/ide/pci.h"
#include "trace.h"

Expand Down Expand Up @@ -202,7 +203,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
}

static const TypeInfo piix3_ide_info = {
.name = "piix3-ide",
.name = TYPE_PIIX3_IDE,
.parent = TYPE_PCI_IDE,
.class_init = piix3_ide_class_init,
};
Expand All @@ -224,7 +225,7 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
}

static const TypeInfo piix4_ide_info = {
.name = "piix4-ide",
.name = TYPE_PIIX4_IDE,
.parent = TYPE_PCI_IDE,
.class_init = piix4_ide_class_init,
};
Expand Down
3 changes: 2 additions & 1 deletion hw/isa/piix4.c
Expand Up @@ -28,6 +28,7 @@
#include "hw/irq.h"
#include "hw/southbridge/piix.h"
#include "hw/pci/pci.h"
#include "hw/ide/piix.h"
#include "hw/isa/isa.h"
#include "hw/intc/i8259.h"
#include "hw/dma/i8257.h"
Expand Down Expand Up @@ -277,7 +278,7 @@ static void piix4_init(Object *obj)
PIIX4State *s = PIIX4_PCI_DEVICE(obj);

object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC);
object_initialize_child(obj, "ide", &s->ide, "piix4-ide");
object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE);
object_initialize_child(obj, "uhci", &s->uhci, "piix4-usb-uhci");

object_initialize_child(obj, "pm", &s->pm, TYPE_PIIX4_PM);
Expand Down
7 changes: 7 additions & 0 deletions include/hw/ide/piix.h
@@ -0,0 +1,7 @@
#ifndef HW_IDE_PIIX_H
#define HW_IDE_PIIX_H

#define TYPE_PIIX3_IDE "piix3-ide"
#define TYPE_PIIX4_IDE "piix4-ide"

#endif /* HW_IDE_PIIX_H */

0 comments on commit bb2e9b1

Please sign in to comment.