ReactOS 0.4.17-dev-1190-g4c812f4
locintrf.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/locintrf.c
5 * PURPOSE: Location 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_PNP_LOCATION_INTERFACE,
25 0,
29};
30
31/* FUNCTIONS ******************************************************************/
32
36{
38 /* PnP Interfaces don't get Initialized */
39 ASSERTMSG("PCI locintrf_Initializer, unexpected call.\n", FALSE);
41}
42
43static
44VOID
48{
49 /* Extensions live as long as their device objects, nothing to count */
51}
52
53static
54VOID
58{
60}
61
66static
72{
75 BOOLEAN IsDevice;
79 PAGED_CODE();
80
82
83 IsDevice = (PdoExtension->ExtensionType == PciPdoExtensionType);
84 if (!IsDevice && !PCI_IS_ROOT_FDO(FdoExtension))
86
87 /* Room for the longer form plus the empty character that ends the list */
88 Size = sizeof(L"PCIROOT(FF)") + sizeof(UNICODE_NULL);
90 if (!Buffer)
92
94
95 if (IsDevice)
96 {
98 L"PCI(%02X%02X)",
99 PdoExtension->Slot.u.bits.DeviceNumber,
100 PdoExtension->Slot.u.bits.FunctionNumber);
102 }
103 else
104 {
105 /* The root starts the path, so PnP stops asking further up */
106 _swprintf(Buffer, L"PCIROOT(%X)", FdoExtension->BaseBus);
108 }
109
111 return Status;
112}
113
115NTAPI
118 IN PVOID InterfaceData,
120 IN USHORT Size,
122{
124 PAGED_CODE();
125
127 UNREFERENCED_PARAMETER(InterfaceData);
130
131 LocationInterface->Size = sizeof(*LocationInterface);
132 LocationInterface->Version = PNP_LOCATION_INTERFACE_VERSION;
133 LocationInterface->Context = DeviceExtension;
134 LocationInterface->InterfaceReference = locintrf_Reference;
135 LocationInterface->InterfaceDereference = locintrf_Dereference;
137 return STATUS_SUCCESS;
138}
139
140/* EOF */
#define PAGED_CODE()
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define L(x)
Definition: resources.c:13
#define PCI_INTERFACE_PDO
Definition: pci.h:67
#define PCI_INTERFACE_FDO
Definition: pci.h:68
#define PCI_INTERFACE_ROOT
Definition: pci.h:69
#define PCI_IS_ROOT_FDO(x)
Definition: pci.h:42
#define PCI_POOL_TAG
Definition: pci.h:27
@ PciPdoExtensionType
Definition: pci.h:133
@ PciInterface_Location
Definition: pci.h:148
@ PdoExtension
Definition: precomp.h:61
@ FdoExtension
Definition: precomp.h:60
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:24
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
static VOID NTAPI locintrf_Dereference(_In_ PVOID Context)
Definition: locintrf.c:56
NTSTATUS NTAPI locintrf_Constructor(IN PVOID DeviceExtension, IN PVOID Instance, IN PVOID InterfaceData, IN USHORT Version, IN USHORT Size, IN PINTERFACE Interface)
Definition: locintrf.c:116
PCI_INTERFACE PciLocationInterface
Definition: locintrf.c:18
static NTSTATUS NTAPI locintrf_GetLocationString(_In_ PVOID Context, _Outptr_ PZZWSTR *LocationStrings)
Returns "PCI(DDFF)" for a device or "PCIROOT(B)" for a root bus as a multi-sz. The caller frees the b...
Definition: locintrf.c:69
NTSTATUS NTAPI locintrf_Initializer(IN PVOID Instance)
Definition: locintrf.c:35
static VOID NTAPI locintrf_Reference(_In_ PVOID Context)
Definition: locintrf.c:46
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define _Outptr_
Definition: no_sal2.h:262
#define _In_
Definition: no_sal2.h:158
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define UNICODE_NULL
_NullNull_terminated_ WCHAR * PZZWSTR
Definition: ntbasedef.h:432
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define STATUS_TRANSLATION_COMPLETE
Definition: ntstatus.h:157
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
PGET_LOCATION_STRING GetLocationString
Definition: iotypes.h:4559
PINTERFACE_REFERENCE InterfaceReference
Definition: iotypes.h:4557
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:4558
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_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
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
Definition: wdfwmi.h:481
_Outptr_ _At_ * LocationStrings(return==0, __drv_allocatesMem(Mem))) PZZWSTR *LocationStrings
struct _PNP_LOCATION_INTERFACE PNP_LOCATION_INTERFACE
struct _PNP_LOCATION_INTERFACE * PPNP_LOCATION_INTERFACE
#define PNP_LOCATION_INTERFACE_VERSION
Definition: iotypes.h:5536