xref: /reactos/drivers/bus/isapnp/isapnpres.h (revision 76ec8411)
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:     Resource management header file
5  * COPYRIGHT:   Copyright 2010 Cameron Gutman <cameron.gutman@reactos.org>
6  *              Copyright 2020 Hervé Poussineau <hpoussin@reactos.org>
7  */
8 
9 #pragma once
10 
11 /** @brief Maximum size of resource data structure supported by the driver. */
12 #define ISAPNP_MAX_RESOURCEDATA   0x1000
13 
14 typedef struct _ISAPNP_IO
15 {
16     USHORT CurrentBase;
17     ISAPNP_IO_DESCRIPTION Description;
18     UCHAR Index;
19 } ISAPNP_IO, *PISAPNP_IO;
20 
21 typedef struct _ISAPNP_IRQ
22 {
23     UCHAR CurrentNo;
24     UCHAR CurrentType;
25     ISAPNP_IRQ_DESCRIPTION Description;
26     UCHAR Index;
27 } ISAPNP_IRQ, *PISAPNP_IRQ;
28 
29 typedef struct _ISAPNP_DMA
30 {
31     UCHAR CurrentChannel;
32     ISAPNP_DMA_DESCRIPTION Description;
33     UCHAR Index;
34 } ISAPNP_DMA, *PISAPNP_DMA;
35 
36 typedef struct _ISAPNP_MEMRANGE
37 {
38     ULONG CurrentBase;
39     ULONG CurrentLength;
40     ISAPNP_MEMRANGE_DESCRIPTION Description;
41     UCHAR Index;
42 } ISAPNP_MEMRANGE, *PISAPNP_MEMRANGE;
43 
44 typedef struct _ISAPNP_MEMRANGE32
45 {
46     ULONG CurrentBase;
47     ULONG CurrentLength;
48     ISAPNP_MEMRANGE32_DESCRIPTION Description;
49     UCHAR Index;
50 } ISAPNP_MEMRANGE32, *PISAPNP_MEMRANGE32;
51 
52 typedef struct _ISAPNP_COMPATIBLE_ID_ENTRY
53 {
54     UCHAR VendorId[3];
55     USHORT ProdId;
56     LIST_ENTRY IdLink;
57 } ISAPNP_COMPATIBLE_ID_ENTRY, *PISAPNP_COMPATIBLE_ID_ENTRY;
58 
59 typedef enum
60 {
61     dfNotStarted,
62     dfStarted,
63     dfDone
64 } ISAPNP_DEPENDENT_FUNCTION_STATE;
65 
66 typedef struct _ISAPNP_RESOURCE
67 {
68     UCHAR Type;
69 #define ISAPNP_RESOURCE_TYPE_END               0
70 #define ISAPNP_RESOURCE_TYPE_IO                1
71 #define ISAPNP_RESOURCE_TYPE_IRQ               2
72 #define ISAPNP_RESOURCE_TYPE_DMA               3
73 #define ISAPNP_RESOURCE_TYPE_MEMRANGE          4
74 #define ISAPNP_RESOURCE_TYPE_MEMRANGE32        5
75 #define ISAPNP_RESOURCE_TYPE_START_DEPENDENT   6
76 #define ISAPNP_RESOURCE_TYPE_END_DEPENDENT     7
77 
78     union
79     {
80         ISAPNP_IO_DESCRIPTION IoDescription;
81         ISAPNP_IRQ_DESCRIPTION IrqDescription;
82         ISAPNP_DMA_DESCRIPTION DmaDescription;
83         ISAPNP_MEMRANGE_DESCRIPTION MemRangeDescription;
84         ISAPNP_MEMRANGE32_DESCRIPTION MemRange32Description;
85         UCHAR Priority;
86     };
87 } ISAPNP_RESOURCE, *PISAPNP_RESOURCE;
88 
89 typedef struct _ISAPNP_LOGICAL_DEVICE
90 {
91     LIST_ENTRY DeviceLink;
92     PDEVICE_OBJECT Pdo;
93 
94     ULONG Flags;
95 /** Cleared when the device is physically removed */
96 #define ISAPNP_PRESENT              0x00000001
97 
98 /** Indicates if the parent card has multiple logical devices */
99 #define ISAPNP_HAS_MULTIPLE_LOGDEVS 0x00000002
100 
101 /** Cleared when the device has no boot resources */
102 #define ISAPNP_HAS_RESOURCES        0x00000004
103 
104 /** The card implements 24-bit memory decoder */
105 #define ISAPNP_HAS_MEM24_DECODER    0x00000008
106 
107 /** The card implements 32-bit memory decoder */
108 #define ISAPNP_HAS_MEM32_DECODER    0x00000010
109 
110     /**
111      * @name The card data.
112      * @{
113      */
114     UCHAR CSN;
115     UCHAR VendorId[3];
116     USHORT ProdId;
117     ULONG SerialNumber;
118     /**@}*/
119 
120     /**
121      * @name The logical device data.
122      * @{
123      */
124     UCHAR LDN;
125     UCHAR LogVendorId[3];
126     USHORT LogProdId;
127     PISAPNP_RESOURCE Resources;
128     PSTR FriendlyName;
129     LIST_ENTRY CompatibleIdList;
130 
131     ISAPNP_IO Io[8];
132     ISAPNP_IRQ Irq[2];
133     ISAPNP_DMA Dma[2];
134     ISAPNP_MEMRANGE MemRange[4];
135     ISAPNP_MEMRANGE32 MemRange32[4];
136     /**@}*/
137 } ISAPNP_LOGICAL_DEVICE, *PISAPNP_LOGICAL_DEVICE;
138