revert between 56095 -> 55830 in arch
[AROS.git] / workbench / hidds / nouveau / pci-device-mock / SIS661FX.c
blob8473a85bf04d05998de9642d4bf3ff07c75caf65
1 /*
2 Copyright 2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <proto/oop.h>
9 #include "pcimockhardware.h"
10 #include "pcimockhardware_intern.h"
11 #include "pcimock_intern.h"
13 OOP_Object * METHOD(SIS661FXMockHardware, Root, New)
15 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
17 GET_PCIMOCKHWDATA
19 /* Allocate address space regions */
20 ALLOC_ASR(hwdata, PCI_CONFIG_SPACE, 256);
21 ALLOC_ASR(hwdata, PCI_BAR0, 0x4000000);
23 /* Fill in pci config space */
24 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x00, 0x06611039); /* PCICS_PRODUCT, PCICS_VENDOR */
25 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x04, 0x00100007); /* PCICS_STATUS, PCICS_COMMAND */
26 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x08, 0x06000011); /* PCICS_CLASS, PCICS_SUBCLASS, PCICS_PROGIF, PCICS_REVISION */
27 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x0c, 0x00000000); /* PCICS_BIST, PCICS_HEADERTYPE, PCICS_LATENCY, PCICS_CACHELS */
28 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x10, hwdata->Regions[PCI_BAR0].Address); /* PCICS_BAR0 */
29 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x2c, 0x00000000); /* PCICS_SUBSYSTEM, PCICS_SUBVENDOR */
30 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x34, 0x00000080); /* PCICS_CAP_PTR */
31 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x3c, 0x00000000); /* PCICS_INT_PIN, PCICS_INT_LINE */
33 /* Capabilities */
34 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x80, 0x0030ff02); /* AGP VERSION 3.0, CAPABILITY: END, CAPABILITY: PCICAP_AGP */
36 /* AGP Registers */
37 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x84, 0x1f004e1b); /* bridgemode */
38 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x94, 0x00000040); /* AGP_SIS_APER_SIZE */
40 return o;
43 VOID METHOD(SIS661FXMockHardware, Hidd_PCIMockHardware, MemoryReadAtAddress)
45 GET_PCIMOCKHWDATA
47 /* Detect in which address space the address is located and get relative offset */
48 struct RegionAndOffset rao = HIDDPCIMockHardwareDetectRegionAndOffset(hwdata, msg->memoryaddress);
50 if (rao.Region == -1)
51 return;
53 if (rao.Region == PCI_CONFIG_SPACE)
55 switch(rao.Offset)
57 case(0x00000000):
58 case(0x00000004):
59 case(0x00000008):
60 case(0x0000000c):
61 case(0x00000010):
62 case(0x00000014):
63 case(0x00000018):
64 case(0x0000001c):
65 case(0x00000020):
66 case(0x00000024):
67 case(0x0000002c):
68 case(0x00000030):
69 case(0x00000034):
70 case(0x0000003c):
71 case(0x00000080):
72 case(0x00000084):
73 case(0x00000094):
74 case(0x00000098):
75 return;
79 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
82 VOID METHOD(SIS661FXMockHardware, Hidd_PCIMockHardware, MemoryChangedAtAddress)
84 GET_PCIMOCKHWDATA
86 /* Detect in which address space the address is located and get relative offset */
87 struct RegionAndOffset rao = HIDDPCIMockHardwareDetectRegionAndOffset(hwdata, msg->memoryaddress);
89 if (rao.Region == -1)
90 return;
92 if (rao.Region == PCI_CONFIG_SPACE)
94 switch(rao.Offset)
96 case(0x00000088):
97 case(0x00000090):
98 case(0x00000094):
99 case(0x00000098):
100 return;
104 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);