ReactOS  0.4.15-dev-3175-g222acf5
pciide.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: PCI IDE bus driver
4  * FILE: drivers/storage/pciide/pciide.c
5  * PURPOSE: Main file
6  * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
7  */
8 
9 #include "pciide.h"
10 
11 #define NDEBUG
12 #include <debug.h>
13 
16  IN PVOID DeviceExtension,
17  IN ULONG Channel)
18 {
19  PCI_COMMON_CONFIG PciConfig;
21 
22  DPRINT("PciIdeChannelEnabled(%p, %lu)\n", DeviceExtension, Channel);
23 
25  DeviceExtension,
26  &PciConfig,
27  0,
29  if (!NT_SUCCESS(Status))
30  {
31  DPRINT("PciIdeXGetBusData() failed with status 0x%08lx\n", Status);
32  return ChannelStateUnknown;
33  }
34 
35  if (PCI_CONFIGURATION_TYPE(&PciConfig) != PCI_DEVICE_TYPE)
36  {
37  DPRINT("Wrong PCI card type. Disabling IDE channel #%lu\n", Channel);
38  return ChannelDisabled;
39  }
40 
41  if (PciConfig.BaseClass != PCI_CLASS_MASS_STORAGE_CTLR || PciConfig.SubClass != PCI_SUBCLASS_MSC_IDE_CTLR)
42  {
43  DPRINT("Wrong PCI card base class/sub class. Disabling IDE channel #%lu\n", Channel);
44  return ChannelDisabled;
45  }
46 
47  return ChannelStateUnknown;
48 }
49 
52  IN PVOID DeviceExtension)
53 {
54  DPRINT1("PciIdeSyncAccessRequired %p\n", DeviceExtension);
55 
56  return FALSE; /* FIXME */
57 }
58 
61  IN PVOID DeviceExtension,
63 {
64  ULONG i;
65 
66  DPRINT1("PciIdeTransferModeSelect(%p %p)\n", DeviceExtension, XferMode);
67 
68  for (i = 0; i < MAX_IDE_DEVICE; i++)
69  XferMode->DevicePresent[i] = FALSE; /* FIXME */
70 
71  return STATUS_SUCCESS;
72 }
73 
76  IN PVOID DeviceExtension,
77  IN PUCHAR CdbCommand,
78  IN PUCHAR Slave)
79 {
80  DPRINT("PciIdeUseDma(%p %p %p)\n", DeviceExtension, CdbCommand, Slave);
81 
82  /* Nothing should prevent us to use DMA */
83  return 1;
84 }
85 
88  IN PVOID DeviceExtension,
89  OUT PIDE_CONTROLLER_PROPERTIES ControllerProperties)
90 {
91  if (ControllerProperties->Size != sizeof(IDE_CONTROLLER_PROPERTIES))
93 
94  ControllerProperties->PciIdeChannelEnabled = PciIdeChannelEnabled;
95  ControllerProperties->PciIdeSyncAccessRequired = PciIdeSyncAccessRequired;
96  ControllerProperties->PciIdeTransferModeSelect = PciIdeTransferModeSelect;
97  ControllerProperties->IgnoreActiveBitForAtaDevice = FALSE;
98  ControllerProperties->AlwaysClearBusMasterInterrupt = TRUE;
99  ControllerProperties->PciIdeUseDma = PciIdeUseDma;
100  ControllerProperties->AlignmentRequirement = 1;
101  ControllerProperties->DefaultPIO = 0; /* FIXME */
102  ControllerProperties->PciIdeUdmaModesSupported = NULL; /* optional */
103 
104  ControllerProperties->SupportedTransferMode[0][0] =
105  ControllerProperties->SupportedTransferMode[0][1] =
106  ControllerProperties->SupportedTransferMode[1][0] =
107  ControllerProperties->SupportedTransferMode[1][1] =
112 
113  return STATUS_SUCCESS;
114 }
115 
120 {
122 
124  DriverObject,
125  RegistryPath,
127  0);
128 
129  return Status;
130 }
NTSTATUS NTAPI PciIdeTransferModeSelect(IN PVOID DeviceExtension, IN PPCIIDE_TRANSFER_MODE_SELECT XferMode)
Definition: pciide.c:60
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:325
#define IN
Definition: typedefs.h:39
#define PIO_MODE2
Definition: ide.h:278
NTSTATUS NTAPI PciIdeGetControllerProperties(IN PVOID DeviceExtension, OUT PIDE_CONTROLLER_PROPERTIES ControllerProperties)
Definition: pciide.c:87
#define TRUE
Definition: types.h:120
#define SWDMA_MODE1
Definition: ide.h:283
#define PIO_MODE0
Definition: ide.h:276
unsigned char * PUCHAR
Definition: retypes.h:3
#define SWDMA_MODE2
Definition: ide.h:284
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
#define PIO_MODE1
Definition: ide.h:277
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
#define UDMA_MODE0
Definition: ide.h:290
#define PIO_MODE4
Definition: ide.h:280
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define PIO_MODE3
Definition: ide.h:279
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
IDE_CHANNEL_STATE NTAPI PciIdeChannelEnabled(IN PVOID DeviceExtension, IN ULONG Channel)
Definition: pciide.c:15
#define PCI_DEVICE_TYPE
Definition: iotypes.h:3605
#define MAX_IDE_DEVICE
Definition: ide.h:32
#define MWDMA_MODE2
Definition: ide.h:288
IDE_CHANNEL_STATE
Definition: ide.h:195
#define UDMA_MODE2
Definition: ide.h:292
#define MWDMA_MODE0
Definition: ide.h:286
#define UDMA_MODE3
Definition: ide.h:293
#define PCI_SUBCLASS_MSC_IDE_CTLR
Definition: iotypes.h:4129
#define SWDMA_MODE0
Definition: ide.h:282
NTSTATUS NTAPI PciIdeXInitialize(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath, IN PCONTROLLER_PROPERTIES HwGetControllerProperties, IN ULONG ExtensionSize)
Definition: miniport.c:123
BOOLEAN NTAPI PciIdeSyncAccessRequired(IN PVOID DeviceExtension)
Definition: pciide.c:51
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 UDMA_MODE1
Definition: ide.h:291
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: pciide.c:117
#define OUT
Definition: typedefs.h:40
#define PCI_CONFIGURATION_TYPE(PciData)
Definition: iotypes.h:3609
unsigned int ULONG
Definition: retypes.h:1
ULONG NTAPI PciIdeUseDma(IN PVOID DeviceExtension, IN PUCHAR CdbCommand, IN PUCHAR Slave)
Definition: pciide.c:75
#define UDMA_MODE4
Definition: ide.h:294
#define MWDMA_MODE1
Definition: ide.h:287
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
NTSTATUS NTAPI PciIdeXGetBusData(IN PVOID DeviceExtension, IN PVOID Buffer, IN ULONG ConfigDataOffset, IN ULONG BufferLength)
Definition: miniport.c:159
#define PCI_CLASS_MASS_STORAGE_CTLR
Definition: iotypes.h:4104
#define PCI_COMMON_HDR_LENGTH
Definition: iotypes.h:3594