Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / hidds / nouveau / pci-device-mock / NVGF100.c
blobc9c11dcb90b9614892ed1c89797f6898dd703ba7
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 /* chip GF100, model GTX 470 */
15 OOP_Object * METHOD(NVGF100MockHardware, Root, New)
17 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
19 GET_PCIMOCKHWDATA
20 DEF_NEXTCAPADDR
22 /* Allocate address space regions */
23 ALLOC_ASR(hwdata, PCI_CONFIG_SPACE, 256);
24 ALLOC_ASR(hwdata, PCI_BAR0, 0x1000000);
25 ALLOC_ASR(hwdata, PCI_BAR1, 0x10000000);
26 ALLOC_ASR(hwdata, PCI_BAR3, 0x2000000);
27 ALLOC_ASR(hwdata, PCI_ROM, 0x20000);
29 /* Fill in pci config space */
30 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x00, 0x06cd10de); /* PCICS_PRODUCT, PCICS_VENDOR */
31 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x04, 0x00300006); /* PCICS_STATUS, PCICS_COMMAND */
32 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x08, 0x030000a2); /* PCICS_CLASS, PCICS_SUBCLASS, PCICS_PROGIF, PCICS_REVISION */
33 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x0c, 0x00000000); /* PCICS_BIST, PCICS_HEADERTYPE, PCICS_LATENCY, PCICS_CACHELS */
34 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x10, hwdata->Regions[PCI_BAR0].Address); /* PCICS_BAR0 */
35 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x14, hwdata->Regions[PCI_BAR1].Address); /* PCICS_BAR1 */
36 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x1c, hwdata->Regions[PCI_BAR3].Address); /* PCICS_BAR3 */
37 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x2c, 0x510319da); /* PCICS_SUBSYSTEM, PCICS_SUBVENDOR */
38 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x30, hwdata->Regions[PCI_ROM].Address); /* PCICS_EXPROM_BASE */
39 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x34, 0x00000080); /* PCICS_CAP_PTR */
40 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x3c, 0x0000010b); /* PCICS_INT_PIN, PCICS_INT_LINE */
42 /* Capabilities */
43 ADD_PCI_CAP(hwdata, 0x10); /* CAPABILITY: PCICAP_PCIE */
44 ADD_PCI_CAP(hwdata, 0xff); /* CAPABILITY: END */
46 /* Fill in BAR 0 */
47 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x00000000, 0x0c0000a2); /* NV03_PMC_BOOT_0 */
48 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x0010020c, 0x10000000); /* NV04_PFB_FIFO_DATA */
49 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x0010f20c, 0x00000100); /* bsize */
50 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x00121c74, 0x00000001); /* parts */
51 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x0011020c, 0x00000100); /* psize */
52 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x00001540, 0x01010001); /* NV40_PMC_GRAPH_UNITS */
53 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x00409604, 0x00050004); /* rop_nr, gpc_nr */
54 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x00502608, 0x00000003); /* GPC 0 */
55 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x0050a608, 0x00000003); /* GPC 1 */
56 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x00512608, 0x00000004); /* GPC 2 */
57 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x0051a608, 0x00000004); /* GPC 3 */
58 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x00409804, 0x000037f0); /* GRCTX size */
60 return o;
63 VOID METHOD(NVGF100MockHardware, Hidd_PCIMockHardware, MemoryReadAtAddress)
65 GET_PCIMOCKHWDATA
67 /* Detect in which address space the address is located and get relative offset */
68 struct RegionAndOffset rao = HIDDPCIMockHardwareDetectRegionAndOffset(hwdata, msg->memoryaddress);
70 if (rao.Region == -1)
71 return;
73 if (rao.Region == PCI_CONFIG_SPACE)
75 switch(rao.Offset)
77 case(0x00000000):
78 case(0x00000004):
79 case(0x00000008):
80 case(0x0000000c):
81 case(0x00000010):
82 case(0x00000014):
83 case(0x00000018):
84 case(0x0000001c):
85 case(0x00000020):
86 case(0x00000024):
87 case(0x0000002c):
88 case(0x00000030):
89 case(0x00000034):
90 case(0x0000003c):
91 case(0x00000080):
92 case(0x00000084):
93 return;
97 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
100 VOID METHOD(NVGF100MockHardware, Hidd_PCIMockHardware, MemoryChangedAtAddress)
102 GET_PCIMOCKHWDATA
104 /* Detect in which address space the address is located and get relative offset */
105 struct RegionAndOffset rao = HIDDPCIMockHardwareDetectRegionAndOffset(hwdata, msg->memoryaddress);
107 if (rao.Region == -1)
108 return;
110 if (rao.Region == PCI_CONFIG_SPACE)
112 switch(rao.Offset)
114 case(0x00000004):
115 return;
119 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);