ReactOS 0.4.15-dev-8102-g108db8f
pciidex.h
Go to the documentation of this file.
1/*
2 * PROJECT: PCI IDE bus driver extension
3 * LICENSE: See COPYING in the top level directory
4 * PURPOSE: Common header file
5 * COPYRIGHT: Copyright 2005 Hervé Poussineau <hpoussin@reactos.org>
6 * Copyright 2023 Dmitry Borisov <di.sean@protonmail.com>
7 */
8
9#ifndef _PCIIDEX_PCH_
10#define _PCIIDEX_PCH_
11
12#include <ntddk.h>
13#include <ntstrsafe.h>
14#include <ntintsafe.h>
15#include <initguid.h>
16#include <wdmguid.h>
17#include <ide.h>
18
19#define TAG_PCIIDEX 'XedI'
20
21#define IS_FDO(p) (((PCOMMON_DEVICE_EXTENSION)(p))->IsFDO)
22
23#define IS_PRIMARY_CHANNEL(PdoExtension) (PdoExtension->Channel == 0)
24
25/*
26 * Legacy ranges and interrupts
27 */
28#define PCIIDE_LEGACY_RESOURCE_COUNT 3
29#define PCIIDE_LEGACY_COMMAND_IO_RANGE_LENGTH 8
30#define PCIIDE_LEGACY_CONTROL_IO_RANGE_LENGTH 1
31#define PCIIDE_LEGACY_PRIMARY_COMMAND_BASE 0x1F0
32#define PCIIDE_LEGACY_PRIMARY_CONTROL_BASE 0x3F6
33#define PCIIDE_LEGACY_PRIMARY_IRQ 14
34#define PCIIDE_LEGACY_SECONDARY_COMMAND_BASE 0x170
35#define PCIIDE_LEGACY_SECONDARY_CONTROL_BASE 0x376
36#define PCIIDE_LEGACY_SECONDARY_IRQ 15
37
38/*
39 * Programming Interface Register
40 */
41#define PCIIDE_PROGIF_PRIMARY_CHANNEL_NATIVE_MODE 0x01
42#define PCIIDE_PROGIF_PRIMARY_CHANNEL_NATIVE_MODE_CAPABLE 0x02
43#define PCIIDE_PROGIF_SECONDARY_CHANNEL_NATIVE_MODE 0x04
44#define PCIIDE_PROGIF_SECONDARY_CHANNEL_NATIVE_MODE_CAPABLE 0x08
45#define PCIIDE_PROGIF_DMA_CAPABLE 0x80
46
47#define BM_SECONDARY_CHANNEL_OFFSET 8
48
50
52{
56
57typedef struct _COMMON_DEVICE_EXTENSION
58{
61
62 _Write_guarded_by_(_Global_interlock_)
63 volatile LONG PageFiles;
64
65 _Write_guarded_by_(_Global_interlock_)
66 volatile LONG HibernateFiles;
67
68 _Write_guarded_by_(_Global_interlock_)
69 volatile LONG DumpFiles;
71
72typedef struct _FDO_DEVICE_EXTENSION
73{
76
81
85
90
93
95
96 /* Must be the last entry */
99
100typedef struct _PDO_DEVICE_EXTENSION
101{
108
109CODE_SEG("PAGE")
110DRIVER_INITIALIZE DriverEntry;
111
112CODE_SEG("PAGE")
113DRIVER_UNLOAD PciIdeXUnload;
114
115CODE_SEG("PAGE")
116DRIVER_ADD_DEVICE PciIdeXAddDevice;
117
119CODE_SEG("PAGE")
120DRIVER_DISPATCH_PAGED PciIdeXDispatchPnp;
121
123CODE_SEG("PAGE")
124DRIVER_DISPATCH_PAGED PciIdeXDispatchWmi;
125
128
129CODE_SEG("PAGE")
134
135CODE_SEG("PAGE")
139
140CODE_SEG("PAGE")
144 _In_ ULONG Channel);
145
146#endif /* _PCIIDEX_PCH_ */
#define CODE_SEG(...)
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define _Dispatch_type_(a)
Definition: btrfs_drv.h:204
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS NTAPI PciIdeXDispatchPower(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: power.c:56
@ FdoExtension
Definition: precomp.h:48
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
NTSTATUS(NTAPI * PCONTROLLER_PROPERTIES)(_In_ PVOID DeviceExtension, _In_ PIDE_CONTROLLER_PROPERTIES ControllerProperties)
Definition: ide.h:245
IDE_CHANNEL_STATE
Definition: ide.h:196
#define MAX_IDE_CHANNEL
Definition: ide.h:30
#define _Inout_
Definition: ms_sal.h:378
#define _In_
Definition: ms_sal.h:308
NTSTATUS NTAPI PciIdeXDispatchWmi(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pciidex.c:18
struct _FDO_DEVICE_EXTENSION FDO_DEVICE_EXTENSION
IDE_CHANNEL_STATE PciIdeXChannelState(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ ULONG Channel)
Definition: miniport.c:48
NTSTATUS PciIdeXFdoDispatchPnp(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _Inout_ PIRP Irp)
Definition: fdo.c:422
DRIVER_UNLOAD PciIdeXUnload
Definition: pciidex.h:113
NTSTATUS PciIdeXStartMiniport(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Definition: miniport.c:18
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
DRIVER_INITIALIZE DriverEntry
Definition: pciidex.h:110
DRIVER_ADD_DEVICE PciIdeXAddDevice
Definition: pciidex.h:116
struct _PDO_DEVICE_EXTENSION PDO_DEVICE_EXTENSION
Definition: pciidex.h:49
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
Definition: pciidex.h:49
struct _PCIIDEX_DRIVER_EXTENSION PCIIDEX_DRIVER_EXTENSION
struct _PCIIDEX_DRIVER_EXTENSION * PPCIIDEX_DRIVER_EXTENSION
struct _COMMON_DEVICE_EXTENSION COMMON_DEVICE_EXTENSION
struct _COMMON_DEVICE_EXTENSION * PCOMMON_DEVICE_EXTENSION
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS NTAPI PciIdeXDispatchPnp(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pdo.c:840
_Write_guarded_by_(_Global_interlock_) volatile LONG PageFiles
PDEVICE_OBJECT Self
Definition: pciidex.h:60
_Write_guarded_by_(_Global_interlock_) volatile LONG DumpFiles
_Write_guarded_by_(_Global_interlock_) volatile LONG HibernateFiles
ULONG ControllerNumber
Definition: pciidex.h:77
IDE_CONTROLLER_PROPERTIES Properties
Definition: pciidex.h:94
BOOLEAN InNativeMode
Definition: pciidex.h:78
PUCHAR BusMasterPortBase
Definition: pciidex.h:89
KSPIN_LOCK BusDataLock
Definition: pciidex.h:91
_Guarded_by_(DeviceSyncMutex) PPDO_DEVICE_EXTENSION Channels[MAX_IDE_CHANNEL]
PDEVICE_OBJECT Ldo
Definition: pci.h:98
BOOLEAN IoBaseMapped
Definition: pciidex.h:79
BOOLEAN MiniportStarted
Definition: pciidex.h:80
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:84
PDRIVER_OBJECT DriverObject
Definition: pciidex.h:88
FAST_MUTEX DeviceSyncMutex
Definition: pciidex.h:82
PUCHAR MiniControllerExtension[0]
Definition: pciidex.h:97
BUS_INTERFACE_STANDARD BusInterface
Definition: pciidex.h:92
ULONG MiniControllerExtensionSize
Definition: pciidex.h:54
PCONTROLLER_PROPERTIES HwGetControllerProperties
Definition: pciidex.h:53
PFDO_DEVICE_EXTENSION ParentController
Definition: pciidex.h:104
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:59
BOOLEAN ReportedMissing
Definition: pciidex.h:105
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
FAST_MUTEX
Definition: extypes.h:17
DRIVER_DISPATCH DRIVER_DISPATCH_RAISED
Definition: iotypes.h:2263
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_POWER