revert between 56095 -> 55830 in arch
[AROS.git] / workbench / hidds / agp / sisagp3bridgedeviceclass.c
blobd9c879c31eab879e103e1bcb5fac07261d0464ce
1 /*
2 Copyright 2010, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <hidd/agp.h>
7 #include <proto/oop.h>
8 #include <proto/exec.h>
9 #define DEBUG 0
10 #include <aros/debug.h>
12 #include "agp_private.h"
14 #undef HiddAGPBridgeDeviceAttrBase
15 #define HiddAGPBridgeDeviceAttrBase (SD(cl)->hiddAGPBridgeDeviceAB)
17 OOP_Object * METHOD(SiSAgp3BridgeDevice, Root, New)
19 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg);
21 return o;
24 BOOL METHOD(SiSAgp3BridgeDevice, Hidd_AGPBridgeDevice, Initialize)
26 struct HIDDGenericBridgeDeviceData * gbddata =
27 OOP_INST_DATA(SD(cl)->genericBridgeDeviceClass, o);
29 struct pHidd_AGPBridgeDevice_ScanAndDetectDevices saddmsg = {
30 mID: OOP_GetMethodID(IID_Hidd_AGPBridgeDevice, moHidd_AGPBridgeDevice_ScanAndDetectDevices)
33 ULONG major, minor = 0;
34 OOP_Object * bridgedev = NULL;
35 UBYTE bridgeagpcap = 0;
37 /* Scan for bridge and agp devices */
38 if (!OOP_DoMethod(o, (OOP_Msg)&saddmsg))
39 return FALSE;
41 /* Check if bridge is a supported SiS bridge */
42 if (gbddata->bridge->VendorID != 0x1039)
43 return FALSE;
45 /* Check if version is at least 3.5 */
46 bridgedev = gbddata->bridge->PciDevice;
47 bridgeagpcap = gbddata->bridge->AgpCapability;
49 /* Getting version info */
50 major = (readconfigbyte(bridgedev, bridgeagpcap + AGP_VERSION_REG) >> 4) & 0xf;
51 minor = readconfigbyte(bridgedev, bridgeagpcap + AGP_VERSION_REG) & 0xf;
52 D(bug("[AGP] [SiS] Read config: AGP version %d.%d\n", major, minor));
54 /* In case of SiS only 3.5 bridges are guaranteed to be AGP3 compliant */
55 if (!((major == 3) && (minor >= 5)))
56 return FALSE;
58 /* Getting mode */
59 gbddata->bridgemode = readconfiglong(bridgedev, bridgeagpcap + AGP_STATUS_REG);
60 D(bug("[AGP] [SiS] Reading mode: 0x%x\n", gbddata->bridgemode));
62 /* Execute standard AGP3 initialize */
63 if (OOP_DoSuperMethod(cl, o, (OOP_Msg) msg))
65 gbddata->state = STATE_INITIALIZED;
66 return TRUE;
68 else
69 return FALSE;