1 | /* $Id: PCIInternal.h 13217 2008-10-13 13:40:54Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DevPCI - PCI Internal header - Only for hiding bits of PCIDEVICE.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef __PCIInternal_h__
|
---|
23 | #define __PCIInternal_h__
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * PCI I/O region.
|
---|
27 | */
|
---|
28 | typedef struct PCIIOREGION
|
---|
29 | {
|
---|
30 | /** Current PCI mapping address.
|
---|
31 | * -1 means not mapped. Memory addresses are relative to pci_mem_base. */
|
---|
32 | uint32_t addr;
|
---|
33 | uint32_t size;
|
---|
34 | uint8_t type; /* PCIADDRESSSPACE */
|
---|
35 | uint8_t padding[HC_ARCH_BITS == 32 ? 3 : 7];
|
---|
36 | /** Callback called when the region is mapped. */
|
---|
37 | R3PTRTYPE(PFNPCIIOREGIONMAP) map_func;
|
---|
38 | } PCIIOREGION, PCIIORegion;
|
---|
39 | /** Pointer to PCI I/O region. */
|
---|
40 | typedef PCIIOREGION *PPCIIOREGION;
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Callback function for reading from the PCI configuration space.
|
---|
44 | *
|
---|
45 | * @returns The register value.
|
---|
46 | * @param pDevIns Pointer to the device instance of the PCI bus.
|
---|
47 | * @param iBus The bus number this device is on.
|
---|
48 | * @param iDevice The number of the device on the bus.
|
---|
49 | * @param Address The configuration space register address. [0..255]
|
---|
50 | * @param cb The register size. [1,2,4]
|
---|
51 | */
|
---|
52 | typedef DECLCALLBACK(uint32_t) FNPCIBRIDGECONFIGREAD(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, unsigned cb);
|
---|
53 | /** Pointer to a FNPCICONFIGREAD() function. */
|
---|
54 | typedef FNPCIBRIDGECONFIGREAD *PFNPCIBRIDGECONFIGREAD;
|
---|
55 | /** Pointer to a PFNPCICONFIGREAD. */
|
---|
56 | typedef PFNPCIBRIDGECONFIGREAD *PPFNPCIBRIDGECONFIGREAD;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Callback function for writing to the PCI configuration space.
|
---|
60 | *
|
---|
61 | * @param pDevIns Pointer to the device instance of the PCI bus.
|
---|
62 | * @param iBus The bus number this device is on.
|
---|
63 | * @param iDevice The number of the device on the bus.
|
---|
64 | * @param Address The configuration space register address. [0..255]
|
---|
65 | * @param u32Value The value that's being written. The number of bits actually used from
|
---|
66 | * this value is determined by the cb parameter.
|
---|
67 | * @param cb The register size. [1,2,4]
|
---|
68 | */
|
---|
69 | typedef DECLCALLBACK(void) FNPCIBRIDGECONFIGWRITE(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, uint32_t u32Value, unsigned cb);
|
---|
70 | /** Pointer to a FNPCICONFIGWRITE() function. */
|
---|
71 | typedef FNPCIBRIDGECONFIGWRITE *PFNPCIBRIDGECONFIGWRITE;
|
---|
72 | /** Pointer to a PFNPCICONFIGWRITE. */
|
---|
73 | typedef PFNPCIBRIDGECONFIGWRITE *PPFNPCIBRIDGECONFIGWRITE;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * PCI Device - Internal data.
|
---|
77 | */
|
---|
78 | typedef struct PCIDEVICEINT
|
---|
79 | {
|
---|
80 | /** I/O regions. */
|
---|
81 | PCIIOREGION aIORegions[PCI_NUM_REGIONS];
|
---|
82 | /** Pointer to the PCI bus of the device. - R3 ptr */
|
---|
83 | R3PTRTYPE(struct PCIBus *) pBusR3;
|
---|
84 | /** Pointer to the PCI bus of the device. - R0 ptr */
|
---|
85 | R0PTRTYPE(struct PCIBus *) pBusR0;
|
---|
86 | /** Pointer to the PCI bus of the device. - RC ptr */
|
---|
87 | RCPTRTYPE(struct PCIBus *) pBusRC;
|
---|
88 | #if HC_ARCH_BITS == 64
|
---|
89 | RTRCPTR Alignment0;
|
---|
90 | #endif
|
---|
91 |
|
---|
92 | /** Read config callback. */
|
---|
93 | R3PTRTYPE(PFNPCICONFIGREAD) pfnConfigRead;
|
---|
94 | /** Write config callback. */
|
---|
95 | R3PTRTYPE(PFNPCICONFIGWRITE) pfnConfigWrite;
|
---|
96 |
|
---|
97 | /** Set if the specific device fun was requested by PDM.
|
---|
98 | * If clear the device and it's functions can be relocated to satisfy the slot request of another device. */
|
---|
99 | bool fRequestedDevFn;
|
---|
100 | /** Flag whether the device is a pci-to-pci bridge. */
|
---|
101 | bool fPciToPciBridge;
|
---|
102 | /** Current state of the IRQ pin of the device. */
|
---|
103 | int32_t uIrqPinState;
|
---|
104 |
|
---|
105 | /** Read config callback for PCI bridges to pass requests
|
---|
106 | * to devices on another bus.
|
---|
107 | */
|
---|
108 | R3PTRTYPE(PFNPCIBRIDGECONFIGREAD) pfnBridgeConfigRead;
|
---|
109 | /** Write config callback for PCI bridges to pass requests
|
---|
110 | * to devices on another bus.
|
---|
111 | */
|
---|
112 | R3PTRTYPE(PFNPCIBRIDGECONFIGWRITE) pfnBridgeConfigWrite;
|
---|
113 |
|
---|
114 | } PCIDEVICEINT;
|
---|
115 |
|
---|
116 | /* Indicate that PCIDEVICE::Int.s can be declared. */
|
---|
117 | #define __PCIDEVICEINT_DECLARED__
|
---|
118 |
|
---|
119 | #endif
|
---|