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(NV44AMockHardware
, 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_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 */
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 */
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 */
52 VOID
METHOD(NV44AMockHardware
, Hidd_PCIMockHardware
, MemoryReadAtAddress
)
56 /* Detect in which address space the address is located and get relative offset */
57 struct RegionAndOffset rao
= HIDDPCIMockHardwareDetectRegionAndOffset(hwdata
, msg
->memoryaddress
);
62 if (rao
.Region
== PCI_CONFIG_SPACE
)
86 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
89 VOID
METHOD(NV44AMockHardware
, Hidd_PCIMockHardware
, MemoryChangedAtAddress
)
93 /* Detect in which address space the address is located and get relative offset */
94 struct RegionAndOffset rao
= HIDDPCIMockHardwareDetectRegionAndOffset(hwdata
, msg
->memoryaddress
);
99 if (rao
.Region
== PCI_CONFIG_SPACE
)
104 case(0x00000088): /* AGP_COMMAND_REG */
109 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);