2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
5 Desc: VMWare SVGA Hidd initialisation code
10 #include <aros/debug.h>
12 #define __OOP_NOATTRBASES__
14 #include <proto/exec.h>
15 #include <proto/oop.h>
16 #include <exec/types.h>
17 #include <exec/lists.h>
18 #include <hidd/graphics.h>
21 #include <utility/utility.h>
22 #include <aros/symbolsets.h>
24 #include "vmwaresvgahardware.h"
25 #include "vmwaresvgaclass.h"
28 #include LC_LIBDEFS_FILE
30 static OOP_AttrBase HiddPixFmtAttrBase
; // = 0;
31 static OOP_AttrBase HiddPCIDeviceAttrBase
;
33 static struct OOP_ABDescr abd
[] =
35 { IID_Hidd_PixFmt
, &HiddPixFmtAttrBase
},
39 AROS_UFH3(void, VMWSVGAEnumerator
,
40 AROS_UFHA(struct Hook
*, hook
, A0
),
41 AROS_UFHA(OOP_Object
*, pciDevice
, A2
),
42 AROS_UFHA(APTR
, message
, A1
))
46 struct VMWareSVGA_staticdata
*xsd
= (struct VMWareSVGA_staticdata
*)hook
->h_Data
;
48 IPTR ProductID
, VendorID
, SubClass
;
50 OOP_GetAttr(pciDevice
, aHidd_PCIDevice_ProductID
, &ProductID
);
51 OOP_GetAttr(pciDevice
, aHidd_PCIDevice_VendorID
, &VendorID
);
52 OOP_GetAttr(pciDevice
, aHidd_PCIDevice_SubClass
, &SubClass
);
54 bug("[VMWareSVGA] VMWSVGAEnumerator: VMWare SVGA device %04x\n", ProductID
);
56 if (ProductID
== DEVICE_VMWARE0710
)
58 xsd
->data
.indexReg
= SVGA_LEGACY_BASE_PORT
+ SVGA_INDEX_PORT
* sizeof(ULONG
);
59 xsd
->data
.valueReg
= SVGA_LEGACY_BASE_PORT
+ SVGA_VALUE_PORT
* sizeof(ULONG
);
61 bug("[VMWareSVGA] VMWSVGAEnumerator: Found VMWare SVGA 0710 device\n");
62 xsd
->card
= pciDevice
;
64 else if (ProductID
== DEVICE_VMWARE0405
)
68 OOP_GetAttr(pciDevice
, aHidd_PCIDevice_Base0
, &mmio
);
70 xsd
->data
.indexReg
= mmio
+ SVGA_INDEX_PORT
;
71 xsd
->data
.valueReg
= mmio
+ SVGA_VALUE_PORT
;
73 bug("[VMWareSVGA] VMWSVGAEnumerator: Found VMWare SVGA 0405 device\n");
74 xsd
->card
= pciDevice
;
80 STATIC BOOL
findCard(struct VMWareSVGA_staticdata
*xsd
)
82 struct Hook findHook
= {
83 h_Entry
: (IPTR (*)())VMWSVGAEnumerator
,
87 struct TagItem Requirements
[] =
89 {tHidd_PCI_VendorID
, VENDOR_VMWARE
},
90 {tHidd_PCI_Class
, 3 }, /* Display */
91 {tHidd_PCI_Interface
, 0 },
95 HIDD_PCI_EnumDevices(xsd
->pcihidd
, &findHook
, (struct TagItem
*)&Requirements
);
99 if (!initVMWareSVGAHW(&xsd
->data
, xsd
->card
))
101 bug("[VMWareSVGA] findCard: Unsupported VMWare SVGA device found - skipping\n");
105 return (xsd
->card
) ? TRUE
: FALSE
;
108 static int VMWareSVGA_Init(LIBBASETYPEPTR LIBBASE
)
110 struct VMWareSVGA_staticdata
*xsd
= &LIBBASE
->vsd
;
112 if (!OOP_ObtainAttrBases(abd
))
115 xsd
->basebm
= OOP_FindClass(CLID_Hidd_BitMap
);
117 xsd
->pcihidd
= OOP_NewObject(NULL
, CLID_Hidd_PCI
, NULL
);
118 if (xsd
->pcihidd
== NULL
)
121 HiddPCIDeviceAttrBase
= OOP_ObtainAttrBase(IID_Hidd_PCIDevice
);
122 if (HiddPCIDeviceAttrBase
== 0)
128 D(bug("[VMWareSVGA] Init: VMWare SVGA Adaptor Found\n"));
132 D(bug("[VMWareSVGA] Init: No VMWare SVGA Adaptor Found\n"));
133 if (HiddPCIDeviceAttrBase
!= 0)
135 OOP_ReleaseAttrBase(IID_Hidd_PCIDevice
);
136 HiddPCIDeviceAttrBase
= 0;
139 if (xsd
->pcihidd
!= NULL
)
141 OOP_DisposeObject(xsd
->pcihidd
);
145 OOP_ReleaseAttrBases(abd
);
150 ADD2INITLIB(VMWareSVGA_Init
, 0)