xref: /reactos/drivers/bus/isapnp/isapnphw.h (revision 10b08aa2)
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:     Hardware definitions
5  * COPYRIGHT:   Copyright 2010 Cameron Gutman <cameron.gutman@reactos.org>
6  *              Copyright 2020 Hervé Poussineau <hpoussin@reactos.org>
7  *              Copyright 2021 Dmitry Borisov <di.sean@protonmail.com>
8  */
9 
10 #pragma once
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #define ISAPNP_ADDRESS_PCAT    0x279
17 #define ISAPNP_WRITE_DATA_PCAT 0xA79
18 
19 #define ISAPNP_ADDRESS_PC98    0x259
20 #define ISAPNP_WRITE_DATA_PC98 0xA59
21 
22 #define ISAPNP_READPORT 0x00
23 #define ISAPNP_SERIALISOLATION 0x01
24 #define ISAPNP_CONFIGCONTROL 0x02
25 #define ISAPNP_WAKE 0x03
26 #define ISAPNP_RESOURCEDATA 0x04
27 #define ISAPNP_STATUS 0x05
28 #define ISAPNP_CARDSELECTNUMBER 0x06
29 #define ISAPNP_LOGICALDEVICENUMBER 0x07
30 
31 #define ISAPNP_ACTIVATE 0x30
32 #define ISAPNP_IORANGECHECK 0x31
33 
34 #define ISAPNP_MEMBASE(n) (0x40 + ((n) * 8))
35 #define ISAPNP_MEMCONTROL(n) (0x42 + ((n) * 8))
36 #define    MEMORY_UPPER_LIMIT 0x01
37 #define    MEMORY_USE_8_BIT_DECODER 0x00
38 #define    MEMORY_USE_16_BIT_DECODER 0x02
39 #define    MEMORY_USE_32_BIT_DECODER 0x06
40 #define ISAPNP_MEMLIMIT(n) (0x43 + ((n) * 8))
41 #define ISAPNP_IOBASE(n) (0x60 + ((n)*2))
42 #define ISAPNP_IRQNO(n) (0x70 + ((n)*2))
43 #define ISAPNP_IRQTYPE(n) (0x71 + ((n) * 2))
44 #define    IRQTYPE_LOW_LEVEL 0x01
45 #define    IRQTYPE_HIGH_EDGE 0x02
46 #define ISAPNP_DMACHANNEL(n) (0x74 + (n))
47 #define    DMACHANNEL_NONE 4
48 #define ISAPNP_MEMBASE32(n) ((n) == 0 ? 0x76 : (0x70 + (n) * 16))
49 #define ISAPNP_MEMCONTROL32(n) ((n) == 0 ? 0x7A : (0x74 + (n) * 16))
50 #define ISAPNP_MEMLIMIT32(n) ((n) == 0 ? 0x7B : (0x75 + (n) * 16))
51 
52 #define ISAPNP_CONFIG_RESET (1 << 0)
53 #define ISAPNP_CONFIG_WAIT_FOR_KEY (1 << 1)
54 #define ISAPNP_CONFIG_RESET_CSN (1 << 2)
55 
56 #define ISAPNP_LFSR_SEED 0x6A
57 
58 #define ISAPNP_IS_SMALL_TAG(t) (!((t) & 0x80))
59 #define ISAPNP_SMALL_TAG_NAME(t) (((t) >> 3) & 0xF)
60 #define ISAPNP_SMALL_TAG_LEN(t) (((t) & 0x7))
61 #define ISAPNP_TAG_PNPVERNO 0x01
62 #define ISAPNP_TAG_LOGDEVID 0x02
63 #define ISAPNP_TAG_COMPATDEVID 0x03
64 #define ISAPNP_TAG_IRQ 0x04
65 #define ISAPNP_TAG_DMA 0x05
66 #define ISAPNP_TAG_STARTDEP 0x06
67 #define ISAPNP_TAG_ENDDEP 0x07
68 #define ISAPNP_TAG_IOPORT 0x08
69 #define ISAPNP_TAG_FIXEDIO 0x09
70 #define ISAPNP_TAG_END 0x0F
71 
72 #define ISAPNP_IS_LARGE_TAG(t) (((t) & 0x80))
73 #define ISAPNP_LARGE_TAG_NAME(t) (t)
74 #define ISAPNP_TAG_MEMRANGE 0x81
75 #define    MEMRANGE_16_BIT_MEMORY_MASK (0x10 | 0x08)
76 #define       MEMRANGE_32_BIT_MEMORY_ONLY 0x18
77 #define ISAPNP_TAG_ANSISTR 0x82
78 #define ISAPNP_TAG_UNICODESTR 0x83
79 #define ISAPNP_TAG_MEM32RANGE 0x85
80 #define ISAPNP_TAG_FIXEDMEM32RANGE 0x86
81 
82 #define RANGE_LENGTH_TO_LENGTH(RangeLength) ((~(RangeLength) + 1) & 0xFFFFFF)
83 #define LENGTH_TO_RANGE_LENGTH(Length) (~(Length) + 1)
84 
85 #include <pshpack1.h>
86 
87 typedef struct _ISAPNP_IDENTIFIER
88 {
89     USHORT VendorId;
90     USHORT ProdId;
91     ULONG Serial;
92     UCHAR Checksum;
93 } ISAPNP_IDENTIFIER, *PISAPNP_IDENTIFIER;
94 
95 typedef struct _ISAPNP_LOGDEVID
96 {
97     USHORT VendorId;
98     USHORT ProdId;
99     USHORT Flags;
100 } ISAPNP_LOGDEVID, *PISAPNP_LOGDEVID;
101 
102 typedef struct _ISAPNP_COMPATID
103 {
104     USHORT VendorId;
105     USHORT ProdId;
106 } ISAPNP_COMPATID, *PISAPNP_COMPATID;
107 
108 typedef struct _ISAPNP_IO_DESCRIPTION
109 {
110     UCHAR Information;
111     USHORT Minimum;
112     USHORT Maximum;
113     UCHAR Alignment;
114     UCHAR Length;
115 } ISAPNP_IO_DESCRIPTION, *PISAPNP_IO_DESCRIPTION;
116 
117 typedef struct _ISAPNP_FIXED_IO_DESCRIPTION
118 {
119     USHORT IoBase;
120     UCHAR Length;
121 } ISAPNP_FIXED_IO_DESCRIPTION, *PISAPNP_FIXED_IO_DESCRIPTION;
122 
123 typedef struct _ISAPNP_IRQ_DESCRIPTION
124 {
125     USHORT Mask;
126     UCHAR Information;
127 } ISAPNP_IRQ_DESCRIPTION, *PISAPNP_IRQ_DESCRIPTION;
128 
129 typedef struct _ISAPNP_DMA_DESCRIPTION
130 {
131     UCHAR Mask;
132     UCHAR Information;
133 } ISAPNP_DMA_DESCRIPTION, *PISAPNP_DMA_DESCRIPTION;
134 
135 typedef struct _ISAPNP_MEMRANGE_DESCRIPTION
136 {
137     UCHAR Information;
138     USHORT Minimum;
139     USHORT Maximum;
140     USHORT Alignment;
141     USHORT Length;
142 } ISAPNP_MEMRANGE_DESCRIPTION, *PISAPNP_MEMRANGE_DESCRIPTION;
143 
144 typedef struct _ISAPNP_MEMRANGE32_DESCRIPTION
145 {
146     UCHAR Information;
147     ULONG Minimum;
148     ULONG Maximum;
149     ULONG Alignment;
150     ULONG Length;
151 } ISAPNP_MEMRANGE32_DESCRIPTION, *PISAPNP_MEMRANGE32_DESCRIPTION;
152 
153 typedef struct _ISAPNP_FIXEDMEMRANGE_DESCRIPTION
154 {
155     UCHAR Information;
156     ULONG MemoryBase;
157     ULONG Length;
158 } ISAPNP_FIXEDMEMRANGE_DESCRIPTION, *PISAPNP_FIXEDMEMRANGE_DESCRIPTION;
159 
160 #include <poppack.h>
161 
162 #ifdef __cplusplus
163 }
164 #endif
165