Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / hidds / nouveau / pci-device-mock / NV44A.c
blob7fba79e696f10d0eb62194bcae9e4b535c62ac91
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(NV44AMockHardware, Root, New)
15 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
17 GET_PCIMOCKHWDATA
18 DEF_NEXTCAPADDR
20 /* Allocate address space regions */
21 ALLOC_ASR(hwdata, PCI_CONFIG_SPACE, 256);
22 ALLOC_ASR(hwdata, PCI_BAR0, 0x1000000);
23 ALLOC_ASR(hwdata, PCI_BAR1, 0x10000000);
24 ALLOC_ASR(hwdata, PCI_BAR2, 0x1000000);
25 ALLOC_ASR(hwdata, PCI_ROM, 0x20000);
27 /* Fill in pci config space */
28 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x00, 0x022110de); /* PCICS_PRODUCT, PCICS_VENDOR */
29 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x04, 0x00300006); /* PCICS_STATUS, PCICS_COMMAND */
30 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x08, 0x030000a1); /* PCICS_CLASS, PCICS_SUBCLASS, PCICS_PROGIF, PCICS_REVISION */
31 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x0c, 0x00000000); /* PCICS_BIST, PCICS_HEADERTYPE, PCICS_LATENCY, PCICS_CACHELS */
32 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x10, hwdata->Regions[PCI_BAR0].Address); /* PCICS_BAR0 */
33 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x14, hwdata->Regions[PCI_BAR1].Address); /* PCICS_BAR1 */
34 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x18, hwdata->Regions[PCI_BAR2].Address); /* PCICS_BAR2 */
35 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x2c, 0x81c71043); /* PCICS_SUBSYSTEM, PCICS_SUBVENDOR */
36 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x30, hwdata->Regions[PCI_ROM].Address); /* PCICS_EXPROM_BASE */
37 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x34, 0x00000080); /* PCICS_CAP_PTR */
38 SET_ASR_DWORD(hwdata, PCI_CONFIG_SPACE, 0x3c, 0x0000010b); /* PCICS_INT_PIN, PCICS_INT_LINE */
40 /* Capabilities */
41 ADD_PCI_CAP(hwdata, 0x02); /* CAPABILITY: PCICAP_AGP */
42 // ADD_PCI_CAP(hwdata, 0x10); /* CAPABILITY: PCICAP_PCIE */
43 ADD_PCI_CAP(hwdata, 0xff); /* CAPABILITY: END */
45 /* Fill in BAR 0 */
46 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x00000000, 0x04a100a1); /* NV03_PMC_BOOT_0 */
47 SET_ASR_DWORD(hwdata, PCI_BAR0, 0x0010020c, 0x10000000); /* NV04_PFB_FIFO_DATA */
49 return o;
52 VOID METHOD(NV44AMockHardware, Hidd_PCIMockHardware, MemoryReadAtAddress)
54 GET_PCIMOCKHWDATA
56 /* Detect in which address space the address is located and get relative offset */
57 struct RegionAndOffset rao = HIDDPCIMockHardwareDetectRegionAndOffset(hwdata, msg->memoryaddress);
59 if (rao.Region == -1)
60 return;
62 if (rao.Region == PCI_CONFIG_SPACE)
64 switch(rao.Offset)
66 case(0x00000000):
67 case(0x00000004):
68 case(0x00000008):
69 case(0x0000000c):
70 case(0x00000010):
71 case(0x00000014):
72 case(0x00000018):
73 case(0x0000001c):
74 case(0x00000020):
75 case(0x00000024):
76 case(0x0000002c):
77 case(0x00000030):
78 case(0x00000034):
79 case(0x0000003c):
80 case(0x00000080):
81 case(0x00000084):
82 return;
86 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
89 VOID METHOD(NV44AMockHardware, Hidd_PCIMockHardware, MemoryChangedAtAddress)
91 GET_PCIMOCKHWDATA
93 /* Detect in which address space the address is located and get relative offset */
94 struct RegionAndOffset rao = HIDDPCIMockHardwareDetectRegionAndOffset(hwdata, msg->memoryaddress);
96 if (rao.Region == -1)
97 return;
99 if (rao.Region == PCI_CONFIG_SPACE)
101 switch(rao.Offset)
103 case(0x00000004):
104 case(0x00000088): /* AGP_COMMAND_REG */
105 return;
109 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);