ReactOS 0.4.15-dev-7788-g1ad9096
isapnp.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS ISA PnP Bus driver
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Common header file
5 * COPYRIGHT: Copyright 2010 Cameron Gutman <cameron.gutman@reactos.org>
6 * Copyright 2020 Hervé Poussineau <hpoussin@reactos.org>
7 */
8
9#ifndef _ISAPNP_PCH_
10#define _ISAPNP_PCH_
11
12#include <ntddk.h>
13#include <ntstrsafe.h>
14#include <section_attribs.h>
15#include "isapnphw.h"
16
17#include <initguid.h>
18#include <wdmguid.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#define TAG_ISAPNP 'pasI'
25
27#define ISAPNP_MAX_RESOURCEDATA 0x1000
28
30#define ISAPNP_MAX_ALTERNATIVES 8
31
32typedef enum
33{
37
38typedef struct _ISAPNP_IO
39{
44
45typedef struct _ISAPNP_IRQ
46{
52
53typedef struct _ISAPNP_DMA
54{
59
60typedef struct _ISAPNP_MEMRANGE
61{
67
68typedef struct _ISAPNP_MEMRANGE32
69{
75
77{
82
84{
96
100
102{
104
125
134#define ISAPNP_PRESENT 0x00000001
135#define ISAPNP_HAS_MULTIPLE_LOGDEVS 0x00000002
136#define ISAPNP_HAS_RESOURCES 0x00000004
140
142{
143 IsaPnpBus = 'odFI',
145 IsaPnpReadDataPort = 'pdRI'
147
149{
154
156{
163
166
169
175
177{
182
185
187#define ISAPNP_ENUMERATED 0x00000001
188#define ISAPNP_SCANNED_BY_READ_PORT 0x00000002
189#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN 0x00000004
190#define ISAPNP_READ_PORT_NEED_REBALANCE 0x00000008
192 _Write_guarded_by_(_Global_interlock_)
193 volatile LONG SpecialFiles;
195
196extern KEVENT BusSyncEvent;
197
199extern BOOLEAN ReadPortCreated;
200
202extern LIST_ENTRY BusListHead;
203
207VOID
208IsaPnpAcquireBusDataLock(VOID)
209{
211}
212
215VOID
216IsaPnpReleaseBusDataLock(VOID)
217{
219}
220
221_Requires_lock_not_held_(FdoExt->DeviceSyncEvent)
222_Acquires_lock_(FdoExt->DeviceSyncEvent)
224VOID
225IsaPnpAcquireDeviceDataLock(
227{
228 KeWaitForSingleObject(&FdoExt->DeviceSyncEvent, Executive, KernelMode, FALSE, NULL);
229}
230
231_Releases_lock_(FdoExt->DeviceSyncEvent)
233VOID
234IsaPnpReleaseDeviceDataLock(
236{
237 KeSetEvent(&FdoExt->DeviceSyncEvent, IO_NO_INCREMENT, FALSE);
238}
239
243 _In_ PISAPNP_ALTERNATIVES Alternatives)
244{
245 return (Alternatives->Io[0].Length != 0);
246}
247
251 _In_ PISAPNP_ALTERNATIVES Alternatives)
252{
253 return (Alternatives->Irq[0].Mask != 0);
254}
255
259 _In_ PISAPNP_ALTERNATIVES Alternatives)
260{
261 return (Alternatives->Dma[0].Mask != 0);
262}
263
267 _In_ PISAPNP_ALTERNATIVES Alternatives)
268{
269 return (Alternatives->MemRange[0].Length != 0);
270}
271
275 _In_ PISAPNP_ALTERNATIVES Alternatives)
276{
277 return (Alternatives->MemRange32[0].Length != 0);
278}
279
280/* isapnp.c */
281
282CODE_SEG("PAGE")
287 _In_ ULONG RangeStart,
288 _In_ ULONG RangeEnd,
291 _Out_opt_ PUCHAR WriteOrder);
292
293CODE_SEG("PAGE")
298 _Out_opt_ PUCHAR WriteOrder);
299
300CODE_SEG("PAGE")
304 _In_ ULONG Channel,
305 _Out_opt_ PUCHAR WriteOrder);
306
307CODE_SEG("PAGE")
311 _In_ ULONG RangeStart,
312 _In_ ULONG RangeEnd,
313 _Out_opt_ PBOOLEAN Memory32,
315 _Out_opt_ PUCHAR WriteOrder);
316
317CODE_SEG("PAGE")
321 _In_opt_ ULONG SelectedReadPort);
322
323CODE_SEG("PAGE")
324VOID
327
328CODE_SEG("PAGE")
333 _In_ BOOLEAN IncludeDataPort);
334
335CODE_SEG("INIT")
336DRIVER_INITIALIZE DriverEntry;
337
338/* fdo.c */
339CODE_SEG("PAGE")
345
346/* interface.c */
347CODE_SEG("PAGE")
352
353/* pdo.c */
354CODE_SEG("PAGE")
357 _In_ PISAPNP_PDO_EXTENSION PdoDeviceExtension,
360
361CODE_SEG("PAGE")
362VOID
365
366/* hardware.c */
367CODE_SEG("PAGE")
368UCHAR
370 _In_ PUCHAR ReadDataPort);
371
372_Requires_lock_held_(FdoExt->DeviceSyncEvent)
373CODE_SEG("PAGE")
375IsaHwFillDeviceList(
377
378CODE_SEG("PAGE")
384
386VOID
387IsaHwWakeDevice(
389
391VOID
392IsaHwDeactivateDevice(
394
396VOID
397IsaHwActivateDevice(
400
402VOID
403IsaHwWaitForKey(VOID);
404
405#ifdef __cplusplus
406}
407#endif
408
409#endif /* _ISAPNP_PCH_ */
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
static LIST_ENTRY DeviceListHead
Definition: fs.c:52
#define _Acquires_lock_(lock)
#define _Guarded_by_(lock)
#define _Requires_lock_held_(lock)
#define _Requires_lock_not_held_(lock)
#define _Releases_lock_(lock)
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
struct _ISAPNP_ALTERNATIVES * PISAPNP_ALTERNATIVES
struct _ISAPNP_LOGICAL_DEVICE * PISAPNP_LOGICAL_DEVICE
VOID IsaPnpRemoveLogicalDeviceDO(_In_ PDEVICE_OBJECT Pdo)
Definition: pdo.c:820
struct _ISAPNP_MEMRANGE ISAPNP_MEMRANGE
_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice
Definition: isapnp.h:399
struct _ISAPNP_IO ISAPNP_IO
NTSTATUS IsaFdoQueryInterface(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PIO_STACK_LOCATION IrpSp)
Definition: interface.c:19
struct _ISAPNP_FDO_EXTENSION ISAPNP_FDO_EXTENSION
#define ISAPNP_MAX_ALTERNATIVES
Maximum number of Start DF tags supported by the driver.
Definition: isapnp.h:30
ISAPNP_DEVICE_STATE
Definition: isapnp.h:33
@ dsStopped
Definition: isapnp.h:34
@ dsStarted
Definition: isapnp.h:35
NTSTATUS IsaPnpCreateReadPortDORequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt, _In_opt_ ULONG SelectedReadPort)
Definition: isapnp.c:1042
struct _ISAPNP_FDO_EXTENSION * PISAPNP_FDO_EXTENSION
struct _ISAPNP_PDO_EXTENSION * PISAPNP_PDO_EXTENSION
DRIVER_INITIALIZE DriverEntry
Definition: isapnp.h:336
BOOLEAN FindMemoryDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PBOOLEAN Memory32, _Out_opt_ PUCHAR Information, _Out_opt_ PUCHAR WriteOrder)
Definition: isapnp.c:695
NTSTATUS IsaPnpFillDeviceRelations(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ BOOLEAN IncludeDataPort)
Definition: isapnp.c:1304
struct _ISAPNP_IRQ ISAPNP_IRQ
_ISAPNP_SIGNATURE
Definition: isapnp.h:142
@ IsaPnpLogicalDevice
Definition: isapnp.h:144
@ IsaPnpBus
Definition: isapnp.h:143
@ IsaPnpReadDataPort
Definition: isapnp.h:145
struct _ISAPNP_IO * PISAPNP_IO
struct _ISAPNP_PDO_EXTENSION ISAPNP_PDO_EXTENSION
struct _ISAPNP_COMMON_EXTENSION ISAPNP_COMMON_EXTENSION
struct _ISAPNP_DMA * PISAPNP_DMA
VOID IsaPnpRemoveReadPortDO(_In_ PDEVICE_OBJECT Pdo)
Definition: isapnp.c:1284
UCHAR IsaHwTryReadDataPort(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:1362
FORCEINLINE BOOLEAN HasDmaAlternatives(_In_ PISAPNP_ALTERNATIVES Alternatives)
Definition: isapnp.h:258
KEVENT BusSyncEvent
Definition: isapnp.c:21
NTSTATUS IsaPdoPnp(_In_ PISAPNP_PDO_EXTENSION PdoDeviceExtension, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:864
NTSTATUS IsaFdoPnp(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:123
struct _ISAPNP_COMMON_EXTENSION * PISAPNP_COMMON_EXTENSION
struct _ISAPNP_COMPATIBLE_ID_ENTRY ISAPNP_COMPATIBLE_ID_ENTRY
BOOLEAN FindIrqDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Vector, _Out_opt_ PUCHAR WriteOrder)
Definition: isapnp.c:583
struct _ISAPNP_IRQ * PISAPNP_IRQ
enum _ISAPNP_SIGNATURE ISAPNP_SIGNATURE
FORCEINLINE BOOLEAN HasMemory32Alternatives(_In_ PISAPNP_ALTERNATIVES Alternatives)
Definition: isapnp.h:274
FORCEINLINE BOOLEAN HasMemoryAlternatives(_In_ PISAPNP_ALTERNATIVES Alternatives)
Definition: isapnp.h:266
struct _ISAPNP_MEMRANGE32 * PISAPNP_MEMRANGE32
struct _ISAPNP_DMA ISAPNP_DMA
struct _ISAPNP_MEMRANGE * PISAPNP_MEMRANGE
struct _ISAPNP_LOGICAL_DEVICE ISAPNP_LOGICAL_DEVICE
FORCEINLINE BOOLEAN HasIoAlternatives(_In_ PISAPNP_ALTERNATIVES Alternatives)
Definition: isapnp.h:242
struct _ISAPNP_MEMRANGE32 ISAPNP_MEMRANGE32
BOOLEAN FindIoDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_opt_ ULONG Base, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PUCHAR Information, _Out_opt_ PULONG Length, _Out_opt_ PUCHAR WriteOrder)
Definition: isapnp.c:518
NTSTATUS IsaHwConfigureDevice(_In_ PISAPNP_FDO_EXTENSION FdoExt, _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice, _In_ PCM_RESOURCE_LIST Resources)
Definition: hardware.c:1603
struct _ISAPNP_ALTERNATIVES ISAPNP_ALTERNATIVES
FORCEINLINE BOOLEAN HasIrqAlternatives(_In_ PISAPNP_ALTERNATIVES Alternatives)
Definition: isapnp.h:250
struct _ISAPNP_COMPATIBLE_ID_ENTRY * PISAPNP_COMPATIBLE_ID_ENTRY
BOOLEAN FindDmaDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Channel, _Out_opt_ PUCHAR WriteOrder)
Definition: isapnp.c:639
ULONG DeviceCount
Definition: mpu401.c:26
#define _Out_opt_
Definition: ms_sal.h:346
#define _Inout_
Definition: ms_sal.h:378
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define KernelMode
Definition: asm.h:34
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
_Field_range_(0, ISAPNP_MAX_ALTERNATIVES) UCHAR Count
ISAPNP_IRQ_DESCRIPTION Irq[ISAPNP_MAX_ALTERNATIVES]
Definition: isapnp.h:86
ISAPNP_MEMRANGE32_DESCRIPTION MemRange32[ISAPNP_MAX_ALTERNATIVES]
Definition: isapnp.h:89
UCHAR MemRange32Index
Definition: isapnp.h:95
UCHAR MemRangeIndex
Definition: isapnp.h:94
ISAPNP_MEMRANGE_DESCRIPTION MemRange[ISAPNP_MAX_ALTERNATIVES]
Definition: isapnp.h:88
ISAPNP_IO_DESCRIPTION Io[ISAPNP_MAX_ALTERNATIVES]
Definition: isapnp.h:85
ISAPNP_DMA_DESCRIPTION Dma[ISAPNP_MAX_ALTERNATIVES]
Definition: isapnp.h:87
ISAPNP_SIGNATURE Signature
Definition: isapnp.h:150
PDEVICE_OBJECT Self
Definition: isapnp.h:151
ISAPNP_DEVICE_STATE State
Definition: isapnp.h:152
Definition: isapnp.h:77
UCHAR VendorId[3]
Definition: isapnp.h:78
LIST_ENTRY IdLink
Definition: isapnp.h:80
USHORT ProdId
Definition: isapnp.h:79
ISAPNP_DMA_DESCRIPTION Description
Definition: isapnp.h:56
UCHAR CurrentChannel
Definition: isapnp.h:55
UCHAR Index
Definition: isapnp.h:57
PDRIVER_OBJECT DriverObject
Definition: isapnp.h:170
PDEVICE_OBJECT Pdo
Definition: isapnp.h:159
_Guarded_by_(DeviceSyncEvent) ULONG DeviceCount
LIST_ENTRY BusLink
Definition: isapnp.h:173
KEVENT DeviceSyncEvent
Definition: isapnp.h:162
ISAPNP_COMMON_EXTENSION Common
Definition: isapnp.h:157
PDEVICE_OBJECT Ldo
Definition: isapnp.h:158
_Guarded_by_(DeviceSyncEvent) LIST_ENTRY DeviceListHead
PDEVICE_OBJECT ReadPortPdo
Definition: isapnp.h:160
ISAPNP_IO_DESCRIPTION Description
Definition: isapnp.h:41
UCHAR Index
Definition: isapnp.h:42
USHORT CurrentBase
Definition: isapnp.h:40
ISAPNP_IRQ_DESCRIPTION Description
Definition: isapnp.h:49
UCHAR CurrentType
Definition: isapnp.h:48
UCHAR Index
Definition: isapnp.h:50
UCHAR CurrentNo
Definition: isapnp.h:47
ISAPNP_IO Io[8]
Definition: isapnp.h:126
ISAPNP_DMA Dma[2]
Definition: isapnp.h:128
LIST_ENTRY CompatibleIdList
Definition: isapnp.h:122
PDEVICE_OBJECT Pdo
Definition: isapnp.h:103
UCHAR LogVendorId[3]
Definition: isapnp.h:120
ISAPNP_MEMRANGE32 MemRange32[4]
Definition: isapnp.h:130
ISAPNP_MEMRANGE MemRange[4]
Definition: isapnp.h:129
ISAPNP_IRQ Irq[2]
Definition: isapnp.h:127
LIST_ENTRY DeviceLink
Definition: isapnp.h:138
PISAPNP_ALTERNATIVES Alternatives
Definition: isapnp.h:124
ISAPNP_MEMRANGE32_DESCRIPTION Description
Definition: isapnp.h:72
ULONG CurrentBase
Definition: isapnp.h:70
ULONG CurrentLength
Definition: isapnp.h:71
ULONG CurrentLength
Definition: isapnp.h:63
UCHAR Index
Definition: isapnp.h:65
ISAPNP_MEMRANGE_DESCRIPTION Description
Definition: isapnp.h:64
ULONG CurrentBase
Definition: isapnp.h:62
PCM_RESOURCE_LIST ResourceList
Definition: isapnp.h:183
ISAPNP_COMMON_EXTENSION Common
Definition: isapnp.h:178
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList
Definition: isapnp.h:181
ULONG ResourceListSize
Definition: isapnp.h:184
_Write_guarded_by_(_Global_interlock_) volatile LONG SpecialFiles
PISAPNP_LOGICAL_DEVICE IsaPnpDevice
Definition: isapnp.h:179
PISAPNP_FDO_EXTENSION FdoExt
Definition: isapnp.h:180
Definition: typedefs.h:120
uint32_t * PULONG
Definition: typedefs.h:59
char * PSTR
Definition: typedefs.h:51
unsigned char * PBOOLEAN
Definition: typedefs.h:53
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
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_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
#define FORCEINLINE
Definition: wdftypes.h:67
#define IO_NO_INCREMENT
Definition: iotypes.h:598
@ Executive
Definition: ketypes.h:415
unsigned char UCHAR
Definition: xmlstorage.h:181