ReactOS 0.4.17-dev-675-g51fcee3
busintrf.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS PCI Bus Driver
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/bus/pci/intrface/busintrf.c
5 * PURPOSE: Bus Interface
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include <pci.h>
12
13#define NDEBUG
14#include <debug.h>
15
16/* GLOBALS ********************************************************************/
17
19{
20 &GUID_BUS_INTERFACE_STANDARD,
22 1,
23 1,
25 0,
29};
30
31/* FUNCTIONS ******************************************************************/
32
33VOID
36{
38
39 InterlockedIncrement(&PdoExtension->BusInterfaceReferenceCount);
40}
41
42VOID
45{
47
48 InterlockedDecrement(&PdoExtension->BusInterfaceReferenceCount);
49}
50
58{
60 PPCI_FDO_EXTENSION FdoExtension = PdoExtension->ParentFdoExtension;
61
63
65 FdoExtension->BaseBus,
69}
70
76{
78 PPCI_FDO_EXTENSION FdoExtension = PdoExtension->ParentFdoExtension;
79
80 if (DeviceDescriptor->InterfaceType == PCIBus)
81 {
82 DeviceDescriptor->BusNumber = FdoExtension->BaseBus;
83 }
84
85 return IoGetDmaAdapter(FdoExtension->PhysicalDeviceObject,
88}
89
97{
99
101
103 PdoExtension->ParentFdoExtension->BaseBus,
104 PdoExtension->Slot.u.AsULONG,
105 Buffer,
106 Offset,
107 Length);
108}
109
110ULONG
111NTAPI
117{
119
121
123 PdoExtension->ParentFdoExtension->BaseBus,
124 PdoExtension->Slot.u.AsULONG,
125 Buffer,
126 Offset,
127 Length);
128}
129
131NTAPI
133{
135 /* PnP Interfaces don't get Initialized */
136 ASSERTMSG("PCI busintrf_Initializer, unexpected call.\n", FALSE);
137 return STATUS_UNSUCCESSFUL;
138}
139
141NTAPI
144 IN PVOID InterfaceData,
146 IN USHORT Size,
148{
149 PBUS_INTERFACE_STANDARD BusInterface;
151
153 UNREFERENCED_PARAMETER(InterfaceData);
155 PAGED_CODE();
156
157 if (Size < sizeof(BUS_INTERFACE_STANDARD))
158 {
159 return STATUS_UNSUCCESSFUL;
160 }
161
162 BusInterface = (PBUS_INTERFACE_STANDARD)Interface;
163 PdoExtension = (PPCI_PDO_EXTENSION)DeviceExtension;
164
165 BusInterface->Size = sizeof(*BusInterface);
166 BusInterface->Version = 1;
167 BusInterface->Context = PdoExtension;
170
175
176 return STATUS_SUCCESS;
177}
178
179/* EOF */
#define PAGED_CODE()
unsigned char BOOLEAN
Definition: actypes.h:127
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
PCI_INTERFACE BusHandlerInterface
Definition: busintrf.c:18
NTSTATUS NTAPI busintrf_Constructor(IN PVOID DeviceExtension, IN PVOID Instance, IN PVOID InterfaceData, IN USHORT Version, IN USHORT Size, IN PINTERFACE Interface)
Definition: busintrf.c:142
NTSTATUS NTAPI busintrf_Initializer(IN PVOID Instance)
Definition: busintrf.c:132
VOID NTAPI PciBusInterface_Dereference(IN PVOID Context)
Definition: busintrf.c:44
ULONG NTAPI PciBusInterface_GetBusData(IN PVOID Context, IN ULONG WhichSpace, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: busintrf.c:92
ULONG NTAPI PciBusInterface_SetBusData(IN PVOID Context, IN ULONG WhichSpace, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: busintrf.c:112
VOID NTAPI PciBusInterface_Reference(IN PVOID Context)
Definition: busintrf.c:35
PDMA_ADAPTER NTAPI PciBusInterface_GetDmaAdapter(IN PVOID Context, IN PDEVICE_DESCRIPTION DeviceDescriptor, OUT PULONG NumberOfMapRegisters)
Definition: busintrf.c:73
BOOLEAN NTAPI PciBusInterface_TranslateBusAddress(IN PVOID Context, IN PHYSICAL_ADDRESS BusAddress, IN ULONG Length, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: busintrf.c:53
Definition: bufpool.h:45
#define FALSE
Definition: types.h:117
#define PCI_INTERFACE_PDO
Definition: pci.h:57
struct _PCI_PDO_EXTENSION * PPCI_PDO_EXTENSION
@ PciInterface_BusHandler
Definition: pci.h:101
@ PdoExtension
Definition: precomp.h:49
@ FdoExtension
Definition: precomp.h:48
ULONG NTAPI HalSetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:123
BOOLEAN NTAPI HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bus.c:140
ULONG NTAPI HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:73
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG WhichSpace
Definition: ntddpcm.h:99
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
unsigned short USHORT
Definition: pedump.c:61
PDMA_ADAPTER NTAPI IoGetDmaAdapter(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
Definition: pnpdma.c:23
@ PCIBus
Definition: restypes.h:126
@ PCIConfiguration
Definition: miniport.h:93
#define STATUS_SUCCESS
Definition: shellext.h:65
const KSDEVICE_DESCRIPTOR DeviceDescriptor
Definition: splitter.c:257
_In_ PVOID Context
Definition: storport.h:2269
PGET_SET_DEVICE_DATA SetBusData
Definition: iotypes.h:915
PINTERFACE_REFERENCE InterfaceReference
Definition: iotypes.h:911
PTRANSLATE_BUS_ADDRESS TranslateBusAddress
Definition: iotypes.h:913
PGET_SET_DEVICE_DATA GetBusData
Definition: iotypes.h:916
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:912
PGET_DMA_ADAPTER GetDmaAdapter
Definition: iotypes.h:914
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
Definition: wdfwmi.h:481
_Out_ PULONG NumberOfMapRegisters
Definition: halfuncs.h:209
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2273
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2275
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2274
struct _BUS_INTERFACE_STANDARD BUS_INTERFACE_STANDARD
struct _BUS_INTERFACE_STANDARD * PBUS_INTERFACE_STANDARD