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 OOP_Object
* METHOD(NVG86MockHardware
, Root
, New
)
15 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
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_BAR3
, 0x2000000);
25 ALLOC_ASR(hwdata
, PCI_ROM
, 0x20000);
27 /* Fill in pci config space */
28 SET_ASR_DWORD(hwdata
, PCI_CONFIG_SPACE
, 0x00, 0x042410de); /* 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
, 0x1c, hwdata
->Regions
[PCI_BAR3
].Address
); /* PCICS_BAR3 */
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 */
41 ADD_PCI_CAP(hwdata
, 0x10); /* CAPABILITY: PCICAP_PCIE */
42 ADD_PCI_CAP(hwdata
, 0xff); /* CAPABILITY: END */
45 SET_ASR_DWORD(hwdata
, PCI_BAR0
, 0x00000000, 0x086000a1); /* NV03_PMC_BOOT_0 */
46 SET_ASR_DWORD(hwdata
, PCI_BAR0
, 0x0010020c, 0x10000000); /* NV04_PFB_FIFO_DATA */
47 SET_ASR_DWORD(hwdata
, PCI_BAR0
, 0x00100200, 0x00000000); /* r0 */
48 SET_ASR_DWORD(hwdata
, PCI_BAR0
, 0x00100204, 0x01086000); /* r4 */
49 SET_ASR_DWORD(hwdata
, PCI_BAR0
, 0x00100250, 0x00000000); /* rt */
50 SET_ASR_DWORD(hwdata
, PCI_BAR0
, 0x00001540, 0x01010001); /* ru, NV40_PMC_GRAPH_UNITS */
55 VOID
METHOD(NVG86MockHardware
, Hidd_PCIMockHardware
, MemoryReadAtAddress
)
59 /* Detect in which address space the address is located and get relative offset */
60 struct RegionAndOffset rao
= HIDDPCIMockHardwareDetectRegionAndOffset(hwdata
, msg
->memoryaddress
);
65 if (rao
.Region
== PCI_CONFIG_SPACE
)
89 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
92 VOID
METHOD(NVG86MockHardware
, Hidd_PCIMockHardware
, MemoryChangedAtAddress
)
96 /* Detect in which address space the address is located and get relative offset */
97 struct RegionAndOffset rao
= HIDDPCIMockHardwareDetectRegionAndOffset(hwdata
, msg
->memoryaddress
);
102 if (rao
.Region
== PCI_CONFIG_SPACE
)
111 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);