ReactOS 0.4.16-dev-340-g0540c21
ide.h File Reference
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for ide.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _IDENTIFY_DATA
 
struct  _EXTENDED_IDENTIFY_DATA
 
struct  _PCIIDE_TRANSFER_MODE_SELECT
 
struct  _IDE_CONTROLLER_PROPERTIES
 

Macros

#define MAX_IDE_CHANNEL   2
 
#define MAX_IDE_LINE   2
 
#define MAX_IDE_DEVICE   2
 
#define PIO_MODE0   (1 << 0)
 
#define PIO_MODE1   (1 << 1)
 
#define PIO_MODE2   (1 << 2)
 
#define PIO_MODE3   (1 << 3)
 
#define PIO_MODE4   (1 << 4)
 
#define SWDMA_MODE0   (1 << 5)
 
#define SWDMA_MODE1   (1 << 6)
 
#define SWDMA_MODE2   (1 << 7)
 
#define MWDMA_MODE0   (1 << 8)
 
#define MWDMA_MODE1   (1 << 9)
 
#define MWDMA_MODE2   (1 << 10)
 
#define UDMA_MODE0   (1 << 11)
 
#define UDMA_MODE1   (1 << 12)
 
#define UDMA_MODE2   (1 << 13)
 
#define UDMA_MODE3   (1 << 14)
 
#define UDMA_MODE4   (1 << 15)
 
#define UDMA_MODE5   (1 << 16)
 

Typedefs

typedef struct _IDENTIFY_DATA IDENTIFY_DATA
 
typedef struct _IDENTIFY_DATAPIDENTIFY_DATA
 
typedef struct _EXTENDED_IDENTIFY_DATA EXTENDED_IDENTIFY_DATA
 
typedef struct _EXTENDED_IDENTIFY_DATAPEXTENDED_IDENTIFY_DATA
 
typedef struct _PCIIDE_TRANSFER_MODE_SELECT PCIIDE_TRANSFER_MODE_SELECT
 
typedef struct _PCIIDE_TRANSFER_MODE_SELECTPPCIIDE_TRANSFER_MODE_SELECT
 
typedef IDE_CHANNEL_STATE(NTAPIPCIIDE_CHANNEL_ENABLED) (_In_ PVOID DeviceExtension, _In_ ULONG Channel)
 
typedef BOOLEAN(NTAPIPCIIDE_SYNC_ACCESS_REQUIRED) (_In_ PVOID DeviceExtension)
 
typedef NTSTATUS(NTAPIPCIIDE_TRANSFER_MODE_SELECT_FUNC) (_In_ PVOID DeviceExtension, _Inout_ PPCIIDE_TRANSFER_MODE_SELECT XferMode)
 
typedef ULONG(NTAPIPCIIDE_USEDMA_FUNC) (_In_ PVOID DeviceExtension, _In_ PUCHAR CdbCommand, _In_ PUCHAR Slave)
 
typedef NTSTATUS(NTAPIPCIIDE_UDMA_MODES_SUPPORTED) (_In_ IDENTIFY_DATA IdentifyData, _Out_ PULONG BestXferMode, _Out_ PULONG CurrentXferMode)
 
typedef struct _IDE_CONTROLLER_PROPERTIES IDE_CONTROLLER_PROPERTIES
 
typedef struct _IDE_CONTROLLER_PROPERTIESPIDE_CONTROLLER_PROPERTIES
 
typedef NTSTATUS(NTAPIPCONTROLLER_PROPERTIES) (_In_ PVOID DeviceExtension, _In_ PIDE_CONTROLLER_PROPERTIES ControllerProperties)
 

Enumerations

enum  IDE_CHANNEL_STATE { ChannelDisabled = 0 , ChannelEnabled , ChannelStateUnknown }
 

Functions

NTSTATUS NTAPI PciIdeXInitialize (_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath, _In_ PCONTROLLER_PROPERTIES HwGetControllerProperties, _In_ ULONG ExtensionSize)
 
NTSTATUS NTAPI PciIdeXGetBusData (_In_ PVOID DeviceExtension, _Out_writes_bytes_all_(BufferLength) PVOID Buffer, _In_ ULONG ConfigDataOffset, _In_ ULONG BufferLength)
 
NTSTATUS NTAPI PciIdeXSetBusData (_In_ PVOID DeviceExtension, _In_reads_bytes_(BufferLength) PVOID Buffer, _In_reads_bytes_(BufferLength) PVOID DataMask, _In_ ULONG ConfigDataOffset, _In_ ULONG BufferLength)
 

Macro Definition Documentation

◆ MAX_IDE_CHANNEL

#define MAX_IDE_CHANNEL   2

Definition at line 30 of file ide.h.

◆ MAX_IDE_DEVICE

#define MAX_IDE_DEVICE   2

Definition at line 32 of file ide.h.

◆ MAX_IDE_LINE

#define MAX_IDE_LINE   2

Definition at line 31 of file ide.h.

◆ MWDMA_MODE0

#define MWDMA_MODE0   (1 << 8)

Definition at line 287 of file ide.h.

◆ MWDMA_MODE1

#define MWDMA_MODE1   (1 << 9)

Definition at line 288 of file ide.h.

◆ MWDMA_MODE2

#define MWDMA_MODE2   (1 << 10)

Definition at line 289 of file ide.h.

◆ PIO_MODE0

#define PIO_MODE0   (1 << 0)

Definition at line 277 of file ide.h.

◆ PIO_MODE1

#define PIO_MODE1   (1 << 1)

Definition at line 278 of file ide.h.

◆ PIO_MODE2

#define PIO_MODE2   (1 << 2)

Definition at line 279 of file ide.h.

◆ PIO_MODE3

#define PIO_MODE3   (1 << 3)

Definition at line 280 of file ide.h.

◆ PIO_MODE4

#define PIO_MODE4   (1 << 4)

Definition at line 281 of file ide.h.

◆ SWDMA_MODE0

#define SWDMA_MODE0   (1 << 5)

Definition at line 283 of file ide.h.

◆ SWDMA_MODE1

#define SWDMA_MODE1   (1 << 6)

Definition at line 284 of file ide.h.

◆ SWDMA_MODE2

#define SWDMA_MODE2   (1 << 7)

Definition at line 285 of file ide.h.

◆ UDMA_MODE0

#define UDMA_MODE0   (1 << 11)

Definition at line 291 of file ide.h.

◆ UDMA_MODE1

#define UDMA_MODE1   (1 << 12)

Definition at line 292 of file ide.h.

◆ UDMA_MODE2

#define UDMA_MODE2   (1 << 13)

Definition at line 293 of file ide.h.

◆ UDMA_MODE3

#define UDMA_MODE3   (1 << 14)

Definition at line 294 of file ide.h.

◆ UDMA_MODE4

#define UDMA_MODE4   (1 << 15)

Definition at line 295 of file ide.h.

◆ UDMA_MODE5

#define UDMA_MODE5   (1 << 16)

Definition at line 296 of file ide.h.

Typedef Documentation

◆ EXTENDED_IDENTIFY_DATA

◆ IDE_CONTROLLER_PROPERTIES

◆ IDENTIFY_DATA

◆ PCIIDE_CHANNEL_ENABLED

typedef IDE_CHANNEL_STATE(NTAPI * PCIIDE_CHANNEL_ENABLED) (_In_ PVOID DeviceExtension, _In_ ULONG Channel)

Definition at line 202 of file ide.h.

◆ PCIIDE_SYNC_ACCESS_REQUIRED

typedef BOOLEAN(NTAPI * PCIIDE_SYNC_ACCESS_REQUIRED) (_In_ PVOID DeviceExtension)

Definition at line 207 of file ide.h.

◆ PCIIDE_TRANSFER_MODE_SELECT

◆ PCIIDE_TRANSFER_MODE_SELECT_FUNC

typedef NTSTATUS(NTAPI * PCIIDE_TRANSFER_MODE_SELECT_FUNC) (_In_ PVOID DeviceExtension, _Inout_ PPCIIDE_TRANSFER_MODE_SELECT XferMode)

Definition at line 211 of file ide.h.

◆ PCIIDE_UDMA_MODES_SUPPORTED

typedef NTSTATUS(NTAPI * PCIIDE_UDMA_MODES_SUPPORTED) (_In_ IDENTIFY_DATA IdentifyData, _Out_ PULONG BestXferMode, _Out_ PULONG CurrentXferMode)

Definition at line 222 of file ide.h.

◆ PCIIDE_USEDMA_FUNC

typedef ULONG(NTAPI * PCIIDE_USEDMA_FUNC) (_In_ PVOID DeviceExtension, _In_ PUCHAR CdbCommand, _In_ PUCHAR Slave)

Definition at line 216 of file ide.h.

◆ PCONTROLLER_PROPERTIES

typedef NTSTATUS(NTAPI * PCONTROLLER_PROPERTIES) (_In_ PVOID DeviceExtension, _In_ PIDE_CONTROLLER_PROPERTIES ControllerProperties)

Definition at line 244 of file ide.h.

◆ PEXTENDED_IDENTIFY_DATA

◆ PIDE_CONTROLLER_PROPERTIES

◆ PIDENTIFY_DATA

◆ PPCIIDE_TRANSFER_MODE_SELECT

Enumeration Type Documentation

◆ IDE_CHANNEL_STATE

Enumerator
ChannelDisabled 
ChannelEnabled 
ChannelStateUnknown 

Definition at line 195 of file ide.h.

196{
197 ChannelDisabled = 0,
IDE_CHANNEL_STATE
Definition: ide.h:196
@ ChannelDisabled
Definition: ide.h:197
@ ChannelStateUnknown
Definition: ide.h:199
@ ChannelEnabled
Definition: ide.h:198

Function Documentation

◆ PciIdeXGetBusData()

NTSTATUS NTAPI PciIdeXGetBusData ( _In_ PVOID  DeviceExtension,
_Out_writes_bytes_all_(BufferLength) PVOID  Buffer,
_In_ ULONG  ConfigDataOffset,
_In_ ULONG  BufferLength 
)

Definition at line 92 of file miniport.c.

97{
100
101 DPRINT("PciIdeXGetBusData(%p %p 0x%lx 0x%lx)\n",
102 DeviceExtension, Buffer, ConfigDataOffset, BufferLength);
103
104 FdoExtension = CONTAINING_RECORD(DeviceExtension,
106 MiniControllerExtension);
107
108 BytesRead = (*FdoExtension->BusInterface.GetBusData)(FdoExtension->BusInterface.Context,
110 Buffer,
111 ConfigDataOffset,
113 if (BytesRead != BufferLength)
114 return STATUS_UNSUCCESSFUL;
115
116 return STATUS_SUCCESS;
117}
Definition: bufpool.h:45
@ FdoExtension
Definition: precomp.h:48
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870
#define PCI_WHICHSPACE_CONFIG
Definition: iotypes.h:3644

Referenced by PciIdeChannelEnabled(), and PciIdeXSetBusData().

◆ PciIdeXInitialize()

NTSTATUS NTAPI PciIdeXInitialize ( _In_ PDRIVER_OBJECT  DriverObject,
_In_ PUNICODE_STRING  RegistryPath,
_In_ PCONTROLLER_PROPERTIES  HwGetControllerProperties,
_In_ ULONG  ExtensionSize 
)

Definition at line 289 of file pciidex.c.

294{
297
298 PAGED_CODE();
299
300 DPRINT("PciIdeXInitialize(%p '%wZ' %p 0x%lx)\n",
301 DriverObject, RegistryPath, HwGetControllerProperties, ExtensionSize);
302
307 if (!NT_SUCCESS(Status))
308 return Status;
309
311 DriverExtension->MiniControllerExtensionSize = ExtensionSize;
312 DriverExtension->HwGetControllerProperties = HwGetControllerProperties;
313
317 DriverObject->DriverExtension->AddDevice = PciIdeXAddDevice;
318 DriverObject->DriverUnload = PciIdeXUnload;
319
320 /* Create a directory to hold the driver's device objects */
322
323 return STATUS_SUCCESS;
324}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
NTSTATUS NTAPI PciIdeXDispatchPower(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: power.c:56
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1826
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
static VOID PciIdeXCreateIdeDirectory(VOID)
Definition: pciidex.c:258
NTSTATUS NTAPI PciIdeXDispatchWmi(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pciidex.c:18
DRIVER_UNLOAD PciIdeXUnload
Definition: pciidex.h:113
DRIVER_ADD_DEVICE PciIdeXAddDevice
Definition: pciidex.h:116
WORD ExtensionSize
Definition: apisets.c:17
NTSTATUS NTAPI PciIdeXDispatchPnp(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: pdo.c:840
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_POWER

Referenced by DriverEntry().

◆ PciIdeXSetBusData()

NTSTATUS NTAPI PciIdeXSetBusData ( _In_ PVOID  DeviceExtension,
_In_reads_bytes_(BufferLength) PVOID  Buffer,
_In_reads_bytes_(BufferLength) PVOID  DataMask,
_In_ ULONG  ConfigDataOffset,
_In_ ULONG  BufferLength 
)

Definition at line 122 of file miniport.c.

128{
134
135 DPRINT("PciIdeXSetBusData(%p %p %p 0x%lx 0x%lx)\n",
136 DeviceExtension, Buffer, DataMask, ConfigDataOffset, BufferLength);
137
139 if (!CurrentBuffer)
141
142 FdoExtension = CONTAINING_RECORD(DeviceExtension,
144 MiniControllerExtension);
145
146 KeAcquireSpinLock(&FdoExtension->BusDataLock, &OldIrql);
147
148 Status = PciIdeXGetBusData(DeviceExtension, Buffer, ConfigDataOffset, BufferLength);
149 if (!NT_SUCCESS(Status))
150 goto Cleanup;
151
152 for (i = 0; i < BufferLength; i++)
153 {
154 CurrentBuffer[i] = (CurrentBuffer[i] & ~((PUCHAR)DataMask)[i]) |
155 (((PUCHAR)DataMask)[i] & ((PUCHAR)Buffer)[i]);
156 }
157
158 BytesWritten = (*FdoExtension->BusInterface.SetBusData)(FdoExtension->BusInterface.Context,
161 ConfigDataOffset,
165 else
167
168Cleanup:
169 KeReleaseSpinLock(&FdoExtension->BusDataLock, OldIrql);
170
172 return Status;
173}
static ACPI_BUFFER CurrentBuffer
static const WCHAR Cleanup[]
Definition: register.c:80
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define NonPagedPool
Definition: env_spec_w32.h:307
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define TAG_PCIIDEX
Definition: pciidex.h:19
NTSTATUS NTAPI PciIdeXGetBusData(_In_ PVOID DeviceExtension, _Out_writes_bytes_all_(BufferLength) PVOID Buffer, _In_ ULONG ConfigDataOffset, _In_ ULONG BufferLength)
Definition: miniport.c:92
unsigned char * PUCHAR
Definition: typedefs.h:53
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778