ReactOS 0.4.16-dev-319-g6cf4263
pciidex.h File Reference
#include <ntddk.h>
#include <ntstrsafe.h>
#include <ntintsafe.h>
#include <initguid.h>
#include <wdmguid.h>
#include <ide.h>
Include dependency graph for pciidex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PCIIDEX_DRIVER_EXTENSION
 
struct  _COMMON_DEVICE_EXTENSION
 
struct  _FDO_DEVICE_EXTENSION
 
struct  _PDO_DEVICE_EXTENSION
 

Macros

#define TAG_PCIIDEX   'XedI'
 
#define IS_FDO(p)   (((PCOMMON_DEVICE_EXTENSION)(p))->IsFDO)
 
#define IS_PRIMARY_CHANNEL(PdoExtension)   (PdoExtension->Channel == 0)
 
#define PCIIDE_LEGACY_RESOURCE_COUNT   3
 
#define PCIIDE_LEGACY_COMMAND_IO_RANGE_LENGTH   8
 
#define PCIIDE_LEGACY_CONTROL_IO_RANGE_LENGTH   1
 
#define PCIIDE_LEGACY_PRIMARY_COMMAND_BASE   0x1F0
 
#define PCIIDE_LEGACY_PRIMARY_CONTROL_BASE   0x3F6
 
#define PCIIDE_LEGACY_PRIMARY_IRQ   14
 
#define PCIIDE_LEGACY_SECONDARY_COMMAND_BASE   0x170
 
#define PCIIDE_LEGACY_SECONDARY_CONTROL_BASE   0x376
 
#define PCIIDE_LEGACY_SECONDARY_IRQ   15
 
#define PCIIDE_PROGIF_PRIMARY_CHANNEL_NATIVE_MODE   0x01
 
#define PCIIDE_PROGIF_PRIMARY_CHANNEL_NATIVE_MODE_CAPABLE   0x02
 
#define PCIIDE_PROGIF_SECONDARY_CHANNEL_NATIVE_MODE   0x04
 
#define PCIIDE_PROGIF_SECONDARY_CHANNEL_NATIVE_MODE_CAPABLE   0x08
 
#define PCIIDE_PROGIF_DMA_CAPABLE   0x80
 
#define BM_SECONDARY_CHANNEL_OFFSET   8
 

Typedefs

typedef struct _PDO_DEVICE_EXTENSION PDO_DEVICE_EXTENSION
 
typedef struct _PDO_DEVICE_EXTENSIONPPDO_DEVICE_EXTENSION
 
typedef struct _PCIIDEX_DRIVER_EXTENSION PCIIDEX_DRIVER_EXTENSION
 
typedef struct _PCIIDEX_DRIVER_EXTENSIONPPCIIDEX_DRIVER_EXTENSION
 
typedef struct _COMMON_DEVICE_EXTENSION COMMON_DEVICE_EXTENSION
 
typedef struct _COMMON_DEVICE_EXTENSIONPCOMMON_DEVICE_EXTENSION
 
typedef struct _FDO_DEVICE_EXTENSION FDO_DEVICE_EXTENSION
 
typedef struct _FDO_DEVICE_EXTENSIONPFDO_DEVICE_EXTENSION
 

Functions

 _Dispatch_type_ (IRP_MJ_PNP) DRIVER_DISPATCH_PAGED PciIdeXDispatchPnp
 
 _Dispatch_type_ (IRP_MJ_SYSTEM_CONTROL) DRIVER_DISPATCH_PAGED PciIdeXDispatchWmi
 
 _Dispatch_type_ (IRP_MJ_POWER) DRIVER_DISPATCH_RAISED PciIdeXDispatchPower
 
NTSTATUS PciIdeXFdoDispatchPnp (_In_ PFDO_DEVICE_EXTENSION FdoExtension, _Inout_ PIRP Irp)
 
NTSTATUS PciIdeXStartMiniport (_In_ PFDO_DEVICE_EXTENSION FdoExtension)
 
IDE_CHANNEL_STATE PciIdeXChannelState (_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ ULONG Channel)
 

Variables

DRIVER_INITIALIZE DriverEntry
 
DRIVER_UNLOAD PciIdeXUnload
 
DRIVER_ADD_DEVICE PciIdeXAddDevice
 

Macro Definition Documentation

◆ BM_SECONDARY_CHANNEL_OFFSET

#define BM_SECONDARY_CHANNEL_OFFSET   8

Definition at line 47 of file pciidex.h.

◆ IS_FDO

#define IS_FDO (   p)    (((PCOMMON_DEVICE_EXTENSION)(p))->IsFDO)

Definition at line 21 of file pciidex.h.

◆ IS_PRIMARY_CHANNEL

#define IS_PRIMARY_CHANNEL (   PdoExtension)    (PdoExtension->Channel == 0)

Definition at line 23 of file pciidex.h.

◆ PCIIDE_LEGACY_COMMAND_IO_RANGE_LENGTH

#define PCIIDE_LEGACY_COMMAND_IO_RANGE_LENGTH   8

Definition at line 29 of file pciidex.h.

◆ PCIIDE_LEGACY_CONTROL_IO_RANGE_LENGTH

#define PCIIDE_LEGACY_CONTROL_IO_RANGE_LENGTH   1

Definition at line 30 of file pciidex.h.

◆ PCIIDE_LEGACY_PRIMARY_COMMAND_BASE

#define PCIIDE_LEGACY_PRIMARY_COMMAND_BASE   0x1F0

Definition at line 31 of file pciidex.h.

◆ PCIIDE_LEGACY_PRIMARY_CONTROL_BASE

#define PCIIDE_LEGACY_PRIMARY_CONTROL_BASE   0x3F6

Definition at line 32 of file pciidex.h.

◆ PCIIDE_LEGACY_PRIMARY_IRQ

#define PCIIDE_LEGACY_PRIMARY_IRQ   14

Definition at line 33 of file pciidex.h.

◆ PCIIDE_LEGACY_RESOURCE_COUNT

#define PCIIDE_LEGACY_RESOURCE_COUNT   3

Definition at line 28 of file pciidex.h.

◆ PCIIDE_LEGACY_SECONDARY_COMMAND_BASE

#define PCIIDE_LEGACY_SECONDARY_COMMAND_BASE   0x170

Definition at line 34 of file pciidex.h.

◆ PCIIDE_LEGACY_SECONDARY_CONTROL_BASE

#define PCIIDE_LEGACY_SECONDARY_CONTROL_BASE   0x376

Definition at line 35 of file pciidex.h.

◆ PCIIDE_LEGACY_SECONDARY_IRQ

#define PCIIDE_LEGACY_SECONDARY_IRQ   15

Definition at line 36 of file pciidex.h.

◆ PCIIDE_PROGIF_DMA_CAPABLE

#define PCIIDE_PROGIF_DMA_CAPABLE   0x80

Definition at line 45 of file pciidex.h.

◆ PCIIDE_PROGIF_PRIMARY_CHANNEL_NATIVE_MODE

#define PCIIDE_PROGIF_PRIMARY_CHANNEL_NATIVE_MODE   0x01

Definition at line 41 of file pciidex.h.

◆ PCIIDE_PROGIF_PRIMARY_CHANNEL_NATIVE_MODE_CAPABLE

#define PCIIDE_PROGIF_PRIMARY_CHANNEL_NATIVE_MODE_CAPABLE   0x02

Definition at line 42 of file pciidex.h.

◆ PCIIDE_PROGIF_SECONDARY_CHANNEL_NATIVE_MODE

#define PCIIDE_PROGIF_SECONDARY_CHANNEL_NATIVE_MODE   0x04

Definition at line 43 of file pciidex.h.

◆ PCIIDE_PROGIF_SECONDARY_CHANNEL_NATIVE_MODE_CAPABLE

#define PCIIDE_PROGIF_SECONDARY_CHANNEL_NATIVE_MODE_CAPABLE   0x08

Definition at line 44 of file pciidex.h.

◆ TAG_PCIIDEX

#define TAG_PCIIDEX   'XedI'

Definition at line 19 of file pciidex.h.

Typedef Documentation

◆ COMMON_DEVICE_EXTENSION

◆ FDO_DEVICE_EXTENSION

◆ PCIIDEX_DRIVER_EXTENSION

◆ PCOMMON_DEVICE_EXTENSION

◆ PDO_DEVICE_EXTENSION

Definition at line 49 of file pciidex.h.

◆ PFDO_DEVICE_EXTENSION

◆ PPCIIDEX_DRIVER_EXTENSION

◆ PPDO_DEVICE_EXTENSION

Definition at line 49 of file pciidex.h.

Function Documentation

◆ _Dispatch_type_() [1/3]

_Dispatch_type_ ( IRP_MJ_PNP  )

Definition at line 1331 of file isapnp.c.

1341{
1343 PISAPNP_COMMON_EXTENSION DevExt = DeviceObject->DeviceExtension;
1344
1345 PAGED_CODE();
1346
1347 if (DevExt->Signature == IsaPnpBus)
1348 return IsaFdoPnp((PISAPNP_FDO_EXTENSION)DevExt, Irp, IrpSp);
1349 else
1350 return IsaPdoPnp((PISAPNP_PDO_EXTENSION)DevExt, Irp, IrpSp);
1351}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
NTSTATUS IsaFdoPnp(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:123
_In_ PIRP Irp
Definition: csq.h:116
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
@ IsaPnpBus
Definition: isapnp.h:36
NTSTATUS IsaPdoPnp(_In_ PISAPNP_PDO_EXTENSION PdoDeviceExtension, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:867
ISAPNP_SIGNATURE Signature
Definition: isapnp.h:43
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

◆ _Dispatch_type_() [2/3]

_Dispatch_type_ ( IRP_MJ_POWER  )

Definition at line 1293 of file isapnp.c.

1302{
1303 PISAPNP_COMMON_EXTENSION DevExt = DeviceObject->DeviceExtension;
1305
1306 if (DevExt->Signature != IsaPnpBus)
1307 {
1309 {
1310 case IRP_MN_SET_POWER:
1311 case IRP_MN_QUERY_POWER:
1313 Irp->IoStatus.Status = Status;
1314 break;
1315
1316 default:
1317 Status = Irp->IoStatus.Status;
1318 break;
1319 }
1320
1323 return Status;
1324 }
1325
1328 return PoCallDriver(((PISAPNP_FDO_EXTENSION)DevExt)->Ldo, Irp);
1329}
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:25
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IoCompleteRequest
Definition: irp.c:1240
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1699
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_SET_POWER
#define IRP_MN_QUERY_POWER

◆ _Dispatch_type_() [3/3]

_Dispatch_type_ ( IRP_MJ_SYSTEM_CONTROL  )

Definition at line 5748 of file btrfs.c.

5750 {
5752 device_extension* Vcb = DeviceObject->DeviceExtension;
5753 bool top_level;
5754
5756
5757 top_level = is_top_level(Irp);
5758
5759 Irp->IoStatus.Information = 0;
5760
5761 if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
5762 volume_device_extension* vde = DeviceObject->DeviceExtension;
5763
5765
5767
5768 goto exit;
5769 } else if (Vcb && Vcb->type == VCB_TYPE_FS) {
5771
5772 Status = IoCallDriver(Vcb->Vpb->RealDevice, Irp);
5773
5774 goto exit;
5775 } else if (Vcb && Vcb->type == VCB_TYPE_BUS) {
5776 bus_device_extension* bde = DeviceObject->DeviceExtension;
5777
5779
5781
5782 goto exit;
5783 }
5784
5785 Status = Irp->IoStatus.Status;
5787
5788exit:
5789 if (top_level)
5791
5793
5794 return Status;
5795}
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:689
#define VCB_TYPE_FS
Definition: btrfs_drv.h:687
#define VCB_TYPE_BUS
Definition: btrfs_drv.h:691
#define NULL
Definition: types.h:112
InsertTailList & Vcb
Definition: btrfs.c:3044
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:278
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define IoCallDriver
Definition: irp.c:1225
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define exit(n)
Definition: config.h:202
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:880
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:849

◆ PciIdeXChannelState()

IDE_CHANNEL_STATE PciIdeXChannelState ( _In_ PFDO_DEVICE_EXTENSION  FdoExtension,
_In_ ULONG  Channel 
)

Definition at line 48 of file miniport.c.

51{
52 PCIIDE_CHANNEL_ENABLED MiniportChannelEnabled;
53
54 PAGED_CODE();
55
56 MiniportChannelEnabled = FdoExtension->Properties.PciIdeChannelEnabled;
57 if (MiniportChannelEnabled)
58 return MiniportChannelEnabled(FdoExtension->MiniControllerExtension, Channel);
59
61}
@ FdoExtension
Definition: precomp.h:48
@ ChannelStateUnknown
Definition: ide.h:199
IDE_CHANNEL_STATE(NTAPI * PCIIDE_CHANNEL_ENABLED)(_In_ PVOID DeviceExtension, _In_ ULONG Channel)
Definition: ide.h:203

Referenced by PciIdeXFdoQueryBusRelations(), PciIdeXPdoQueryResourceRequirements(), and PciIdeXPdoQueryResources().

◆ PciIdeXFdoDispatchPnp()

NTSTATUS PciIdeXFdoDispatchPnp ( _In_ PFDO_DEVICE_EXTENSION  FdoExtension,
_Inout_ PIRP  Irp 
)

Definition at line 422 of file fdo.c.

425{
426 PIO_STACK_LOCATION IoStack;
428
429 PAGED_CODE();
430
432 switch (IoStack->MinorFunction)
433 {
435 {
437
438 Irp->IoStatus.Status = Status;
440
441 return Status;
442 }
443
445 {
447 break;
448 }
449
452
454 {
456 break;
457 }
458
460 {
461 if (IoStack->Parameters.QueryDeviceRelations.Type != BusRelations)
462 break;
463
465 if (!NT_SUCCESS(Status))
466 {
467 Irp->IoStatus.Status = Status;
469
470 return Status;
471 }
472
473 Irp->IoStatus.Status = Status;
474 break;
475 }
476
478 {
480 break;
481 }
482
484 {
487 break;
488
489 Irp->IoStatus.Status = Status;
490 break;
491 }
492
498 Irp->IoStatus.Status = STATUS_SUCCESS;
499 break;
500
501 default:
502 break;
503 }
504
506 return IoCallDriver(FdoExtension->Ldo, Irp);
507}
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
static NTSTATUS PciIdeXFdoQueryPnpDeviceState(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp)
Definition: fdo.c:196
static NTSTATUS PciIdeXFdoQueryDeviceUsageNotification(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp)
Definition: fdo.c:338
static NTSTATUS PciIdeXFdoRemoveDevice(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp)
Definition: fdo.c:154
static NTSTATUS PciIdeXFdoQueryInterface(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIO_STACK_LOCATION IoStack)
Definition: fdo.c:385
static NTSTATUS PciIdeXFdoStartDevice(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp)
Definition: fdo.c:84
static NTSTATUS PciIdeXFdoQueryBusRelations(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp)
Definition: fdo.c:275
static NTSTATUS PciIdeXFdoStopDevice(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Definition: fdo.c:141
union _IO_STACK_LOCATION::@1580 Parameters
struct _IO_STACK_LOCATION::@3979::@4004 QueryDeviceRelations
#define IRP_MN_CANCEL_STOP_DEVICE
@ BusRelations
Definition: iotypes.h:2152
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE

Referenced by PciIdeXDispatchPnp().

◆ PciIdeXStartMiniport()

NTSTATUS PciIdeXStartMiniport ( _In_ PFDO_DEVICE_EXTENSION  FdoExtension)

Definition at line 18 of file miniport.c.

20{
23
24 PAGED_CODE();
25
26 if (FdoExtension->MiniportStarted)
27 return STATUS_SUCCESS;
28
29 DPRINT("Starting miniport\n");
30
32 FdoExtension->DriverObject);
34
35 FdoExtension->Properties.Size = sizeof(IDE_CONTROLLER_PROPERTIES);
36 FdoExtension->Properties.ExtensionSize = DriverExtension->MiniControllerExtensionSize;
37 Status = DriverExtension->HwGetControllerProperties(FdoExtension->MiniControllerExtension,
38 &FdoExtension->Properties);
39 if (!NT_SUCCESS(Status))
40 return Status;
41
42 FdoExtension->MiniportStarted = TRUE;
43 return STATUS_SUCCESS;
44}
#define TRUE
Definition: types.h:120
struct _IDE_CONTROLLER_PROPERTIES IDE_CONTROLLER_PROPERTIES
#define ASSERT(a)
Definition: mode.c:44
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1904
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
#define DPRINT
Definition: sndvol32.h:73

Referenced by PciIdeXFdoStartDevice().

Variable Documentation

◆ DriverEntry

DRIVER_INITIALIZE DriverEntry

Definition at line 110 of file pciidex.h.

◆ PciIdeXAddDevice

DRIVER_ADD_DEVICE PciIdeXAddDevice

Definition at line 116 of file pciidex.h.

Referenced by PciIdeXInitialize().

◆ PciIdeXUnload

DRIVER_UNLOAD PciIdeXUnload

Definition at line 113 of file pciidex.h.

Referenced by PciIdeXInitialize().