ReactOS 0.4.17-dev-1190-g4c812f4
agpintrf.c File Reference
#include <pci.h>
#include <ntagp.h>
#include <debug.h>
Include dependency graph for agpintrf.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static VOID NTAPI agpintrf_Reference (_In_ PVOID Context)
 
static VOID NTAPI agpintrf_Dereference (_In_ PVOID Context)
 
static NTSTATUS NTAPI agpintrf_FindHostBridge (_In_ PPCI_FDO_EXTENSION FdoExtension, _Out_ PPCI_PDO_EXTENSION *HostBridge)
 Finds the one host bridge on a root bus that has an AGP capability.
 
NTSTATUS NTAPI agpintrf_Initializer (IN PVOID Instance)
 
NTSTATUS NTAPI agpintrf_Constructor (IN PVOID DeviceExtension, IN PVOID Instance, IN PVOID InterfaceData, IN USHORT Version, IN USHORT Size, IN PINTERFACE Interface)
 

Variables

PCI_INTERFACE AgpTargetInterface
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 15 of file agpintrf.c.

Function Documentation

◆ agpintrf_Constructor()

NTSTATUS NTAPI agpintrf_Constructor ( IN PVOID  DeviceExtension,
IN PVOID  Instance,
IN PVOID  InterfaceData,
IN USHORT  Version,
IN USHORT  Size,
IN PINTERFACE  Interface 
)

Definition at line 117 of file agpintrf.c.

123{
128
130 UNREFERENCED_PARAMETER(InterfaceData);
132 PAGED_CODE();
133
134 /* Only AGP bridges are supported (which are PCI-to-PCI Bridge Devices) */
135 if ((PdoExtension->BaseClass != PCI_CLASS_BRIDGE_DEV) ||
137 {
138 /* Fail any other PDO */
140 }
141
142 /* Without its own target capability the bridge relies on a host bridge beside it */
144 if (!PdoExtension->TargetAgpCapabilityId)
145 {
146 if (!PCI_IS_ROOT_FDO(PdoExtension->ParentFdoExtension))
148
149 Status = agpintrf_FindHostBridge(PdoExtension->ParentFdoExtension, &Target);
150 if (!NT_SUCCESS(Status))
151 return Status;
152 }
153
155 AgpInterface->Size = sizeof(*AgpInterface);
156 AgpInterface->Version = Version;
157 AgpInterface->Context = Target;
162 AgpInterface->CapabilityID = Target->TargetAgpCapabilityId;
163
164 return STATUS_SUCCESS;
165}
#define PAGED_CODE()
static VOID NTAPI agpintrf_Dereference(_In_ PVOID Context)
Definition: agpintrf.c:50
static NTSTATUS NTAPI agpintrf_FindHostBridge(_In_ PPCI_FDO_EXTENSION FdoExtension, _Out_ PPCI_PDO_EXTENSION *HostBridge)
Finds the one host bridge on a root bus that has an AGP capability.
Definition: agpintrf.c:65
static VOID NTAPI agpintrf_Reference(_In_ PVOID Context)
Definition: agpintrf.c:38
LONG NTSTATUS
Definition: precomp.h:26
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
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
struct _PCI_PDO_EXTENSION * PPCI_PDO_EXTENSION
#define PCI_IS_ROOT_FDO(x)
Definition: pci.h:42
@ PdoExtension
Definition: precomp.h:61
Status
Definition: gdiplustypes.h:24
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define STATUS_SUCCESS
Definition: shellext.h:65
PINTERFACE_REFERENCE InterfaceReference
Definition: iotypes.h:4536
PGET_SET_DEVICE_DATA GetBusData
Definition: iotypes.h:4539
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:4537
PGET_SET_DEVICE_DATA SetBusData
Definition: iotypes.h:4538
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
_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 _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
Definition: wdfwmi.h:481
#define PCI_SUBCLASS_BR_PCI_TO_PCI
Definition: iotypes.h:4181
struct _AGP_TARGET_BUS_INTERFACE_STANDARD * PAGP_TARGET_BUS_INTERFACE_STANDARD
#define PCI_CLASS_BRIDGE_DEV
Definition: iotypes.h:4124

◆ agpintrf_Dereference()

static VOID NTAPI agpintrf_Dereference ( _In_ PVOID  Context)
static

Definition at line 50 of file agpintrf.c.

52{
54
55 ObDereferenceObject(PdoExtension->PhysicalDeviceObject);
56 InterlockedDecrement(&PdoExtension->AgpInterfaceReferenceCount);
57}
#define InterlockedDecrement
Definition: armddk.h:52
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by agpintrf_Constructor().

◆ agpintrf_FindHostBridge()

static NTSTATUS NTAPI agpintrf_FindHostBridge ( _In_ PPCI_FDO_EXTENSION  FdoExtension,
_Out_ PPCI_PDO_EXTENSION *  HostBridge 
)
static

Finds the one host bridge on a root bus that has an AGP capability.

Definition at line 65 of file agpintrf.c.

68{
72 PAGED_CODE();
73
76
77 for (Child = FdoExtension->ChildPdoList; Child; Child = Child->Next)
78 {
79 if ((Child->BaseClass != PCI_CLASS_BRIDGE_DEV) ||
80 (Child->SubClass != PCI_SUBCLASS_BR_HOST) ||
81 !Child->TargetAgpCapabilityId)
82 {
83 continue;
84 }
85
86 /* More than one candidate leaves no way to pick the right one */
87 if (Found)
88 {
89 Found = NULL;
91 break;
92 }
93
94 Found = Child;
96 }
97
100
101 *HostBridge = Found;
102 return Status;
103}
return Found
Definition: dirsup.c:1270
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
@ FdoExtension
Definition: precomp.h:60
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define KernelMode
Definition: asm.h:38
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define PCI_SUBCLASS_BR_HOST
Definition: iotypes.h:4177
@ Executive
Definition: ketypes.h:467

Referenced by agpintrf_Constructor().

◆ agpintrf_Initializer()

NTSTATUS NTAPI agpintrf_Initializer ( IN PVOID  Instance)

Definition at line 107 of file agpintrf.c.

108{
110 /* PnP Interfaces don't get Initialized */
111 ASSERTMSG("PCI agpintrf_Initializer, unexpected call.\n", FALSE);
112 return STATUS_UNSUCCESSFUL;
113}
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

◆ agpintrf_Reference()

static VOID NTAPI agpintrf_Reference ( _In_ PVOID  Context)
static

Definition at line 38 of file agpintrf.c.

40{
42
43 InterlockedIncrement(&PdoExtension->AgpInterfaceReferenceCount);
44 ObReferenceObject(PdoExtension->PhysicalDeviceObject);
45}
#define InterlockedIncrement
Definition: armddk.h:53
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by agpintrf_Constructor().

Variable Documentation

◆ AgpTargetInterface

PCI_INTERFACE AgpTargetInterface
Initial value:
=
{
&GUID_AGP_TARGET_BUS_INTERFACE_STANDARD,
0,
}
NTSTATUS NTAPI agpintrf_Constructor(IN PVOID DeviceExtension, IN PVOID Instance, IN PVOID InterfaceData, IN USHORT Version, IN USHORT Size, IN PINTERFACE Interface)
Definition: agpintrf.c:117
NTSTATUS NTAPI agpintrf_Initializer(IN PVOID Instance)
Definition: agpintrf.c:107
#define PCI_INTERFACE_PDO
Definition: pci.h:67
@ PciInterface_AgpTarget
Definition: pci.h:147
#define AGP_BUS_INTERFACE_V1
Definition: ntagp.h:31
struct _AGP_TARGET_BUS_INTERFACE_STANDARD AGP_TARGET_BUS_INTERFACE_STANDARD

Definition at line 20 of file agpintrf.c.