mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-07 23:49:35 +00:00
usb/ehci: Move capsbase and opregbase into SysBus EHCI class
This allows specific derived models to use different values. Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
5aa3ca9f53
commit
4a4343671e
@ -35,10 +35,11 @@ static Property ehci_sysbus_properties[] = {
|
|||||||
static int usb_ehci_sysbus_initfn(SysBusDevice *dev)
|
static int usb_ehci_sysbus_initfn(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
EHCISysBusState *i = SYS_BUS_EHCI(dev);
|
EHCISysBusState *i = SYS_BUS_EHCI(dev);
|
||||||
|
SysBusEHCIClass *sec = SYS_BUS_EHCI_GET_CLASS(dev);
|
||||||
EHCIState *s = &i->ehci;
|
EHCIState *s = &i->ehci;
|
||||||
|
|
||||||
s->capsbase = 0x100;
|
s->capsbase = sec->capsbase;
|
||||||
s->opregbase = 0x140;
|
s->opregbase = sec->opregbase;
|
||||||
s->dma = &dma_context_memory;
|
s->dma = &dma_context_memory;
|
||||||
|
|
||||||
usb_ehci_initfn(s, DEVICE(dev));
|
usb_ehci_initfn(s, DEVICE(dev));
|
||||||
@ -63,11 +64,21 @@ static const TypeInfo ehci_type_info = {
|
|||||||
.instance_size = sizeof(EHCISysBusState),
|
.instance_size = sizeof(EHCISysBusState),
|
||||||
.abstract = true,
|
.abstract = true,
|
||||||
.class_init = ehci_sysbus_class_init,
|
.class_init = ehci_sysbus_class_init,
|
||||||
|
.class_size = sizeof(SysBusEHCIClass),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void ehci_xlnx_class_init(ObjectClass *oc, void *data)
|
||||||
|
{
|
||||||
|
SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
|
||||||
|
|
||||||
|
sec->capsbase = 0x100;
|
||||||
|
sec->opregbase = 0x140;
|
||||||
|
}
|
||||||
|
|
||||||
static const TypeInfo ehci_xlnx_type_info = {
|
static const TypeInfo ehci_xlnx_type_info = {
|
||||||
.name = "xlnx,ps7-usb",
|
.name = "xlnx,ps7-usb",
|
||||||
.parent = TYPE_SYS_BUS_EHCI,
|
.parent = TYPE_SYS_BUS_EHCI,
|
||||||
|
.class_init = ehci_xlnx_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ehci_sysbus_register_types(void)
|
static void ehci_sysbus_register_types(void)
|
||||||
|
@ -339,6 +339,10 @@ typedef struct EHCIPCIState {
|
|||||||
#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb"
|
#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb"
|
||||||
#define SYS_BUS_EHCI(obj) \
|
#define SYS_BUS_EHCI(obj) \
|
||||||
OBJECT_CHECK(EHCISysBusState, (obj), TYPE_SYS_BUS_EHCI)
|
OBJECT_CHECK(EHCISysBusState, (obj), TYPE_SYS_BUS_EHCI)
|
||||||
|
#define SYS_BUS_EHCI_CLASS(class) \
|
||||||
|
OBJECT_CLASS_CHECK(SysBusEHCIClass, (class), TYPE_SYS_BUS_EHCI)
|
||||||
|
#define SYS_BUS_EHCI_GET_CLASS(obj) \
|
||||||
|
OBJECT_GET_CLASS(SysBusEHCIClass, (obj), TYPE_SYS_BUS_EHCI)
|
||||||
|
|
||||||
typedef struct EHCISysBusState {
|
typedef struct EHCISysBusState {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
@ -348,4 +352,13 @@ typedef struct EHCISysBusState {
|
|||||||
EHCIState ehci;
|
EHCIState ehci;
|
||||||
} EHCISysBusState;
|
} EHCISysBusState;
|
||||||
|
|
||||||
|
typedef struct SysBusEHCIClass {
|
||||||
|
/*< private >*/
|
||||||
|
SysBusDeviceClass parent_class;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
uint16_t capsbase;
|
||||||
|
uint16_t opregbase;
|
||||||
|
} SysBusEHCIClass;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user