2 Copyright 2011, The AROS Development Team. All rights reserved.
6 #include <aros/debug.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
);
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 */
43 ADD_PCI_CAP(hwdata
, 0x10); /* CAPABILITY: PCICAP_PCIE */
44 ADD_PCI_CAP(hwdata
, 0xff); /* CAPABILITY: END */
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 */
63 VOID
METHOD(NVGF100MockHardware
, Hidd_PCIMockHardware
, MemoryReadAtAddress
)
67 /* Detect in which address space the address is located and get relative offset */
68 struct RegionAndOffset rao
= HIDDPCIMockHardwareDetectRegionAndOffset(hwdata
, msg
->memoryaddress
);
73 if (rao
.Region
== PCI_CONFIG_SPACE
)
97 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
100 VOID
METHOD(NVGF100MockHardware
, Hidd_PCIMockHardware
, MemoryChangedAtAddress
)
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)
110 if (rao
.Region
== PCI_CONFIG_SPACE
)
119 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);