ahci: Move QOM macros to header

The TYPE_* constants and the typedefs are defined in ahci.h, so
we can move the type checking macros there too.

This will make future conversion to OBJECT_DECLARE* easier.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Tested-By: Roman Bolshakov <r.bolshakov@yadro.com>
Message-Id: <20200825192110.3528606-31-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2020-08-25 15:20:26 -04:00
parent 2504f868f3
commit 5e748ffbbf
2 changed files with 3 additions and 5 deletions

View File

@ -332,9 +332,6 @@ struct AHCIPCIState {
AHCIState ahci; AHCIState ahci;
}; };
#define ICH_AHCI(obj) \
OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
extern const VMStateDescription vmstate_ahci; extern const VMStateDescription vmstate_ahci;
#define VMSTATE_AHCI(_field, _state) { \ #define VMSTATE_AHCI(_field, _state) { \
@ -394,6 +391,4 @@ void ahci_uninit(AHCIState *s);
void ahci_reset(AHCIState *s); void ahci_reset(AHCIState *s);
#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
#endif /* HW_IDE_AHCI_INTERNAL_H */ #endif /* HW_IDE_AHCI_INTERNAL_H */

View File

@ -53,11 +53,14 @@ typedef struct AHCIState {
typedef struct AHCIPCIState AHCIPCIState; typedef struct AHCIPCIState AHCIPCIState;
#define TYPE_ICH9_AHCI "ich9-ahci" #define TYPE_ICH9_AHCI "ich9-ahci"
#define ICH_AHCI(obj) \
OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
int32_t ahci_get_num_ports(PCIDevice *dev); int32_t ahci_get_num_ports(PCIDevice *dev);
void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd); void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
#define TYPE_SYSBUS_AHCI "sysbus-ahci" #define TYPE_SYSBUS_AHCI "sysbus-ahci"
#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
typedef struct SysbusAHCIState { typedef struct SysbusAHCIState {
/*< private >*/ /*< private >*/