ReactOS 0.4.15-dev-8135-g1bc6c90
pdo.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for pdo.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS PortCreatePdo (_In_ PFDO_DEVICE_EXTENSION FdoDeviceExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun, _Out_ PPDO_DEVICE_EXTENSION *PdoDeviceExtension)
 
NTSTATUS PortDeletePdo (_In_ PPDO_DEVICE_EXTENSION PdoExtension)
 
NTSTATUS NTAPI PortPdoScsi (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 
NTSTATUS NTAPI PortPdoPnp (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file pdo.c.

Function Documentation

◆ PortCreatePdo()

NTSTATUS PortCreatePdo ( _In_ PFDO_DEVICE_EXTENSION  FdoDeviceExtension,
_In_ ULONG  Bus,
_In_ ULONG  Target,
_In_ ULONG  Lun,
_Out_ PPDO_DEVICE_EXTENSION PdoDeviceExtension 
)

Definition at line 19 of file pdo.c.

25{
26 PPDO_DEVICE_EXTENSION DeviceExtension = NULL;
30
31 DPRINT("PortCreatePdo(%p %p)\n",
32 FdoDeviceExtension, PdoDeviceExtension);
33
34 /* Create the port device */
35 Status = IoCreateDevice(FdoDeviceExtension->Device->DriverObject,
37 NULL,
40 FALSE,
41 &Pdo);
42 if (!NT_SUCCESS(Status))
43 {
44 DPRINT1("IoCreateDevice() failed (Status 0x%lX)\n", Status);
45 return Status;
46 }
47
48 /* Initialize the device */
49 Pdo->Flags |= DO_DIRECT_IO;
50 Pdo->Flags |= DO_POWER_PAGABLE;
51
52 DeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
53 RtlZeroMemory(DeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
54
55 DeviceExtension->ExtensionType = PdoExtension;
56
57 DeviceExtension->Device = Pdo;
58 DeviceExtension->FdoExtension = FdoDeviceExtension;
59 DeviceExtension->PnpState = dsStopped;
60
61 /* Add the PDO to the PDO list*/
62 KeAcquireInStackQueuedSpinLock(&FdoDeviceExtension->PdoListLock,
63 &LockHandle);
64 InsertHeadList(&FdoDeviceExtension->PdoListHead,
65 &DeviceExtension->PdoListEntry);
66 FdoDeviceExtension->PdoCount++;
68
69 DeviceExtension->Bus = Bus;
70 DeviceExtension->Target = Target;
71 DeviceExtension->Lun = Lun;
72
73
74 // FIXME: More initialization
75
76
77 /* The device has been initialized */
78 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
79
80 *PdoDeviceExtension = DeviceExtension;
81
82 return STATUS_SUCCESS;
83}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1315
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
@ PdoExtension
Definition: precomp.h:49
#define InsertHeadList(ListHead, Entry)
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
Status
Definition: gdiplustypes.h:25
VOID FASTCALL KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:130
VOID FASTCALL KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:166
@ dsStopped
Definition: isapnp.h:34
#define FILE_DEVICE_MASS_STORAGE
Definition: imports.h:62
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
PFDO_DEVICE_EXTENSION FdoExtension
Definition: precomp.h:126
LIST_ENTRY PdoListEntry
Definition: precomp.h:128
PDEVICE_OBJECT Device
Definition: precomp.h:125
DEVICE_STATE PnpState
Definition: precomp.h:127
EXTENSION_TYPE ExtensionType
Definition: precomp.h:123
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
Definition: wdfminiport.h:72
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
#define DO_POWER_PAGABLE
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:717

Referenced by PortFdoScanBus().

◆ PortDeletePdo()

NTSTATUS PortDeletePdo ( _In_ PPDO_DEVICE_EXTENSION  PdoExtension)

Definition at line 87 of file pdo.c.

89{
91
92 DPRINT("PortDeletePdo(%p)\n", PdoExtension);
93
94 /* Remove the PDO from the PDO list*/
95 KeAcquireInStackQueuedSpinLock(&PdoExtension->FdoExtension->PdoListLock,
96 &LockHandle);
97 RemoveEntryList(&PdoExtension->PdoListEntry);
98 PdoExtension->FdoExtension->PdoCount--;
100
101 if (PdoExtension->InquiryBuffer)
102 {
104 PdoExtension->InquiryBuffer = NULL;
105 }
106
107
108 // FIXME: More uninitialization
109
110
111 /* Delete the PDO */
113
114 return STATUS_SUCCESS;
115}
#define TAG_INQUIRY_DATA
Definition: precomp.h:32
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251

Referenced by PortFdoScanBus().

◆ PortPdoPnp()

NTSTATUS NTAPI PortPdoPnp ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp 
)

Definition at line 135 of file pdo.c.

138{
139 DPRINT1("PortPdoPnp(%p %p)\n", DeviceObject, Irp);
140
141 Irp->IoStatus.Information = 0;
142 Irp->IoStatus.Status = STATUS_SUCCESS;
144 return STATUS_SUCCESS;
145}
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by PortDispatchPnp().

◆ PortPdoScsi()

NTSTATUS NTAPI PortPdoScsi ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp 
)

Definition at line 120 of file pdo.c.

123{
124 DPRINT1("PortPdoScsi(%p %p)\n", DeviceObject, Irp);
125
126 Irp->IoStatus.Information = 0;
127 Irp->IoStatus.Status = STATUS_SUCCESS;
129 return STATUS_SUCCESS;
130}

Referenced by PortDispatchScsi().