ReactOS 0.4.16-dev-319-g6cf4263
isapnp.c
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: Driver entry
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/* INCLUDES *******************************************************************/
11
12#ifndef UNIT_TEST
13
14#include "isapnp.h"
15
16#define NDEBUG
17#include <debug.h>
18
19/* GLOBALS ********************************************************************/
20
22
24BOOLEAN ReadPortCreated = FALSE;
25
27LIST_ENTRY BusListHead;
28
29#endif /* UNIT_TEST */
30
31extern ULONG IsaConfigPorts[2];
32
33/* FUNCTIONS ******************************************************************/
34
35static
36CODE_SEG("PAGE")
37VOID
38IsaConvertIoRequirement(
41{
42 PAGED_CODE();
43
47 if (Description->Information & 0x1)
49 else
51 Descriptor->u.Port.Length = Description->Length;
52 Descriptor->u.Port.Alignment = Description->Alignment;
53 Descriptor->u.Port.MinimumAddress.LowPart = Description->Minimum;
54 Descriptor->u.Port.MaximumAddress.LowPart = Description->Maximum +
55 Description->Length - 1;
56}
57
58static
59CODE_SEG("PAGE")
60VOID
65 _In_ BOOLEAN FirstDescriptor)
66{
67 PAGED_CODE();
68
69 if (!FirstDescriptor)
72 if (Description->Information & 0xC)
73 {
75 Descriptor->ShareDisposition = CmResourceShareShared;
76 }
77 else
78 {
81 }
82 Descriptor->u.Interrupt.MinimumVector =
83 Descriptor->u.Interrupt.MaximumVector = Vector;
84}
85
86static
87CODE_SEG("PAGE")
88VOID
92 _In_ ULONG Channel,
93 _In_ BOOLEAN FirstDescriptor)
94{
96
97 PAGED_CODE();
98
99 if (!FirstDescriptor)
102 Descriptor->ShareDisposition = CmResourceShareUndetermined;
103 Descriptor->Flags = CM_RESOURCE_DMA_8; /* Ignore information byte for compatibility */
104 Descriptor->u.Dma.MinimumChannel =
105 Descriptor->u.Dma.MaximumChannel = Channel;
106}
107
108static
109CODE_SEG("PAGE")
110VOID
114{
115 PAGED_CODE();
116
118 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
120 if ((Description->Information & 0x40) || !(Description->Information & 0x01))
122 else
124 Descriptor->u.Memory.Length = Description->Length << 8;
125 if (Description->Alignment == 0)
126 Descriptor->u.Memory.Alignment = 0x10000;
127 else
128 Descriptor->u.Memory.Alignment = Description->Alignment;
129 Descriptor->u.Memory.MinimumAddress.LowPart = Description->Minimum << 8;
130 Descriptor->u.Memory.MaximumAddress.LowPart = (Description->Maximum << 8) +
131 (Description->Length << 8) - 1;
132}
133
134static
135CODE_SEG("PAGE")
136VOID
140{
141 PAGED_CODE();
142
144 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
146 if ((Description->Information & 0x40) || !(Description->Information & 0x01))
148 else
150 Descriptor->u.Memory.Length = Description->Length;
151 Descriptor->u.Memory.Alignment = Description->Alignment;
152 Descriptor->u.Memory.MinimumAddress.LowPart = Description->Minimum;
153 Descriptor->u.Memory.MaximumAddress.LowPart = Description->Maximum +
154 Description->Length - 1;
155}
156
157/*
158 * For example, the PnP ROM
159 * 0x15, 0x04, ... // Logical device ID
160 * 0x47, 0x01, 0x30, 0x03, 0x30, 0x03, 0x04, 0x04, // IO 330, len 4, align 4
161 * 0x30, // **** Start DF ****
162 * 0x22, 0x04, 0x00, // IRQ 2
163 * 0x31, 0x02, // **** Start DF ****
164 * 0x22, 0xC0, 0x00, // IRQ 6 or 7
165 * 0x38, // **** End DF ******
166 * 0x2A, 0x20, 0x3A, // DMA 5
167 * 0x22, 0x00, 0x08, // IRQ 12
168 * 0x79, 0x00, // END
169 *
170 * becomes the following resource requirements list:
171 * Interface 1 Bus 0 Slot 0 AlternativeLists 2
172 *
173 * AltList #0, AltList->Count 4
174 * [Option 0, ShareDisposition 1, Flags 11] IO: Min 0:330, Max 0:333, Align 4 Len 4
175 * [Option 0, ShareDisposition 1, Flags 1] INT: Min 2 Max 2
176 * [Option 0, ShareDisposition 0, Flags 0] DMA: Min 5 Max 5
177 * [Option 0, ShareDisposition 1, Flags 1] INT: Min B Max B
178 *
179 * AltList #1, AltList->Count 5
180 * [Option 0, ShareDisposition 1, Flags 11] IO: Min 0:330, Max 0:333, Align 4 Len 4
181 * [Option 0, ShareDisposition 1, Flags 1] INT: Min 6 Max 6
182 * [Option 8, ShareDisposition 1, Flags 1] INT: Min 7 Max 7
183 * [Option 0, ShareDisposition 0, Flags 0] DMA: Min 5 Max 5
184 * [Option 0, ShareDisposition 1, Flags 1] INT: Min B Max B
185 */
186static
187CODE_SEG("PAGE")
191{
195 ULONG FirstFixedDescriptors, LastFixedDescriptors;
196 ULONG ResourceCount, AltListCount, ListSize, i;
197 BOOLEAN IsFirstAltList, IsFirstDescriptor;
198 PIO_RESOURCE_LIST AltList;
200
201 PAGED_CODE();
202
203 /* Count the number of requirements */
204 DfState = dfNotStarted;
205 FirstFixedDescriptors = 0;
206 LastFixedDescriptors = 0;
207 ResourceCount = 0;
208 AltListCount = 1;
209 Resource = PdoExt->IsaPnpDevice->Resources;
210 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
211 {
212 switch (Resource->Type)
213 {
215 {
216 if (DfState == dfStarted)
217 ++AltListCount;
218
219 DfState = dfStarted;
220 break;
221 }
222
224 {
225 DfState = dfDone;
226 break;
227 }
228
231 {
232 RTL_BITMAP ResourceBitmap;
233 ULONG BitmapSize, BitmapBuffer, BitCount;
234
236 {
237 BitmapSize = RTL_BITS_OF(Resource->IrqDescription.Mask);
238 BitmapBuffer = Resource->IrqDescription.Mask;
239 }
240 else
241 {
242 BitmapSize = RTL_BITS_OF(Resource->DmaDescription.Mask);
243 BitmapBuffer = Resource->DmaDescription.Mask;
244 }
245 RtlInitializeBitMap(&ResourceBitmap, &BitmapBuffer, BitmapSize);
246
247 BitCount = RtlNumberOfSetBits(&ResourceBitmap);
248 switch (DfState)
249 {
250 case dfNotStarted:
251 FirstFixedDescriptors += BitCount;
252 break;
253
254 case dfStarted:
255 ResourceCount += BitCount;
256 break;
257
258 case dfDone:
259 LastFixedDescriptors += BitCount;
260 break;
261
263 }
264
265 break;
266 }
267
271 {
272 switch (DfState)
273 {
274 case dfNotStarted:
275 ++FirstFixedDescriptors;
276 break;
277
278 case dfStarted:
280 break;
281
282 case dfDone:
283 ++LastFixedDescriptors;
284 break;
285
287 }
288 break;
289 }
290
291 default:
292 ASSERT(FALSE);
294 break;
295 }
296
298 }
299
300 /* This logical device has no resource requirements */
301 if ((ResourceCount == 0) && (FirstFixedDescriptors == 0) && (LastFixedDescriptors == 0))
302 return STATUS_SUCCESS;
303
304 /* Allocate memory to store requirements */
306 FIELD_OFFSET(IO_RESOURCE_LIST, Descriptors) * AltListCount +
308 sizeof(IO_RESOURCE_DESCRIPTOR) * AltListCount *
309 (FirstFixedDescriptors + LastFixedDescriptors);
311 if (!RequirementsList)
312 return STATUS_NO_MEMORY;
313
314 RequirementsList->ListSize = ListSize;
315 RequirementsList->InterfaceType = Isa;
316 RequirementsList->AlternativeLists = AltListCount;
317
318 RequirementsList->List[0].Version = 1;
319 RequirementsList->List[0].Revision = 1;
320
321 /* Store requirements */
322 IsFirstAltList = TRUE;
323 AltList = &RequirementsList->List[0];
325 Resource = PdoExt->IsaPnpDevice->Resources;
326 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
327 {
328 switch (Resource->Type)
329 {
331 {
332 if (!IsFirstAltList)
333 {
334 /* Add room for the fixed descriptors */
335 AltList->Count += LastFixedDescriptors;
336
337 /* Move on to the next list */
338 AltList = (PIO_RESOURCE_LIST)(AltList->Descriptors + AltList->Count);
339 AltList->Version = 1;
340 AltList->Revision = 1;
341
342 /* Propagate the fixed resources to our new list */
343 RtlCopyMemory(&AltList->Descriptors,
344 RequirementsList->List[0].Descriptors,
345 sizeof(IO_RESOURCE_DESCRIPTOR) * FirstFixedDescriptors);
346 AltList->Count += FirstFixedDescriptors;
347
348 Descriptor = &AltList->Descriptors[FirstFixedDescriptors];
349 }
350
351 IsFirstAltList = FALSE;
352 break;
353 }
354
356 break;
357
359 {
360 IsaConvertIoRequirement(Descriptor++, &Resource->IoDescription);
361
362 ++AltList->Count;
363 break;
364 }
365
367 {
368 IsFirstDescriptor = TRUE;
369
370 for (i = 0; i < RTL_BITS_OF(Resource->IrqDescription.Mask); i++)
371 {
372 if (!(Resource->IrqDescription.Mask & (1 << i)))
373 continue;
374
376 &Resource->IrqDescription,
378 IsFirstDescriptor);
379 ++AltList->Count;
380
381 IsFirstDescriptor = FALSE;
382 }
383
384 break;
385 }
386
388 {
389 IsFirstDescriptor = TRUE;
390
391 for (i = 0; i < RTL_BITS_OF(Resource->DmaDescription.Mask); i++)
392 {
393 if (!(Resource->DmaDescription.Mask & (1 << i)))
394 continue;
395
397 &Resource->DmaDescription,
398 i,
399 IsFirstDescriptor);
400 ++AltList->Count;
401
402 IsFirstDescriptor = FALSE;
403 }
404
405 break;
406 }
407
409 {
410 IsaConvertMemRangeRequirement(Descriptor++, &Resource->MemRangeDescription);
411
412 ++AltList->Count;
413 break;
414 }
415
417 {
418 IsaConvertMemRange32Requirement(Descriptor++, &Resource->MemRange32Description);
419
420 ++AltList->Count;
421 break;
422 }
423
424 default:
425 ASSERT(FALSE);
427 break;
428 }
429
430 ++Resource;
431 }
432
433 /* Append the fixed resources */
434 if (LastFixedDescriptors)
435 {
436 PIO_RESOURCE_LIST NextList = &RequirementsList->List[0];
437
438 /* Make the descriptor point to the fixed resources */
439 Descriptor -= LastFixedDescriptors;
440
441 /* Propagate the fixed resources onto previous lists */
442 AltListCount = RequirementsList->AlternativeLists - 1;
443 for (i = 0; i < AltListCount; i++)
444 {
445 RtlCopyMemory(&NextList->Descriptors[NextList->Count - LastFixedDescriptors],
447 sizeof(IO_RESOURCE_DESCRIPTOR) * LastFixedDescriptors);
448
449 NextList = (PIO_RESOURCE_LIST)(NextList->Descriptors + NextList->Count);
450 }
451 }
452
453 PdoExt->RequirementsList = RequirementsList;
454 return STATUS_SUCCESS;
455}
456
457CODE_SEG("PAGE")
462 _In_ ULONG RangeStart,
463 _In_ ULONG RangeEnd,
466{
468
469 PAGED_CODE();
470
471 Resource = LogDevice->Resources;
472 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
473 {
475 {
477 BOOLEAN Match;
478
479 if (Base)
480 {
481 Match = (Base >= Description->Minimum) && (Base <= Description->Maximum);
482 }
483 else
484 {
485 Match = (RangeStart >= Description->Minimum) &&
486 (RangeEnd <= (ULONG)(Description->Maximum + Description->Length - 1));
487 }
488
489 if (Match)
490 {
491 if (Information)
492 *Information = Description->Information;
493 if (Length)
494 *Length = Description->Length;
495
496 return TRUE;
497 }
498 }
499
500 ++Resource;
501 }
502
503 return FALSE;
504}
505
506CODE_SEG("PAGE")
511{
513
514 PAGED_CODE();
515
516 Resource = LogDevice->Resources;
517 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
518 {
520 {
522
523 if (Description->Mask & (1 << Vector))
524 return TRUE;
525 }
526
527 ++Resource;
528 }
529
530 return FALSE;
531}
532
533CODE_SEG("PAGE")
537 _In_ ULONG Channel)
538{
540
541 PAGED_CODE();
542
543 Resource = LogDevice->Resources;
544 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
545 {
547 {
549
550 if (Description->Mask & (1 << Channel))
551 return TRUE;
552 }
553
554 ++Resource;
555 }
556
557 return FALSE;
558}
559
560CODE_SEG("PAGE")
564 _In_ ULONG RangeStart,
565 _In_ ULONG RangeEnd,
567{
569
570 PAGED_CODE();
571
572 Resource = LogDevice->Resources;
573 while (Resource->Type != ISAPNP_RESOURCE_TYPE_END)
574 {
575 switch (Resource->Type)
576 {
578 {
580
581 Description = &Resource->MemRangeDescription;
582
583 if ((RangeStart >= (ULONG)(Description->Minimum << 8)) &&
584 (RangeEnd <= (ULONG)((Description->Maximum << 8) +
585 (Description->Length << 8) - 1)))
586 {
587 if (Information)
588 *Information = Description->Information;
589
590 return TRUE;
591 }
592 break;
593 }
594
596 {
597 PISAPNP_MEMRANGE32_DESCRIPTION Description32;
598
599 Description32 = &Resource->MemRange32Description;
600
601 if ((RangeStart >= Description32->Minimum) &&
602 (RangeEnd <= (Description32->Maximum + Description32->Length - 1)))
603 {
604 if (Information)
605 *Information = Description32->Information;
606
607 return TRUE;
608 }
609 break;
610 }
611
612 default:
613 break;
614 }
615
616 ++Resource;
617 }
618
619 return FALSE;
620}
621
622static
623CODE_SEG("PAGE")
627{
628 PISAPNP_LOGICAL_DEVICE LogDev = PdoExt->IsaPnpDevice;
631 ULONG ListSize, i;
634
635 PAGED_CODE();
636
637 if (!(LogDev->Flags & ISAPNP_HAS_RESOURCES))
638 return STATUS_SUCCESS;
639
640 /* Count number of required resources */
641 for (i = 0; i < RTL_NUMBER_OF(LogDev->Io); i++)
642 {
643 if (LogDev->Io[i].CurrentBase)
645 else
646 break;
647 }
648 for (i = 0; i < RTL_NUMBER_OF(LogDev->Irq); i++)
649 {
650 if (LogDev->Irq[i].CurrentNo)
652 else
653 break;
654 }
655 for (i = 0; i < RTL_NUMBER_OF(LogDev->Dma); i++)
656 {
657 if (LogDev->Dma[i].CurrentChannel != DMACHANNEL_NONE)
659 else
660 break;
661 }
662 for (i = 0; i < RTL_NUMBER_OF(LogDev->MemRange); i++)
663 {
664 if (LogDev->MemRange[i].CurrentBase)
666 else
667 break;
668 }
669 for (i = 0; i < RTL_NUMBER_OF(LogDev->MemRange32); i++)
670 {
671 if (LogDev->MemRange32[i].CurrentBase)
673 else
674 break;
675 }
676 if (ResourceCount == 0)
677 return STATUS_SUCCESS;
678
679 /* Allocate memory to store resources */
680 ListSize = sizeof(CM_RESOURCE_LIST)
683 if (!ResourceList)
684 return STATUS_NO_MEMORY;
685
686 ResourceList->Count = 1;
687 ResourceList->List[0].InterfaceType = Isa;
688 ResourceList->List[0].PartialResourceList.Version = 1;
689 ResourceList->List[0].PartialResourceList.Revision = 1;
690 ResourceList->List[0].PartialResourceList.Count = ResourceCount;
691
692 /* Store resources */
693 ResourceCount = 0;
694 for (i = 0; i < RTL_NUMBER_OF(LogDev->Io); i++)
695 {
696 ULONG CurrentLength;
697
698 if (!LogDev->Io[i].CurrentBase)
699 break;
700
701 if (!FindIoDescriptor(LogDev,
702 LogDev->Io[i].CurrentBase,
703 0,
704 0,
706 &CurrentLength))
707 {
708 DPRINT1("I/O entry #%lu %x not found\n", i, LogDev->Io[i].CurrentBase);
709 goto InvalidBiosResources;
710 }
711
712 Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[ResourceCount++];
714 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
716 if (Information & 0x1)
718 else
720 Descriptor->u.Port.Length = CurrentLength;
721 Descriptor->u.Port.Start.LowPart = LogDev->Io[i].CurrentBase;
722 }
723 for (i = 0; i < RTL_NUMBER_OF(LogDev->Irq); i++)
724 {
725 if (!LogDev->Irq[i].CurrentNo)
726 break;
727
728 Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[ResourceCount++];
730 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
731 if (LogDev->Irq[i].CurrentType & 0x01)
733 else
735 Descriptor->u.Interrupt.Level = LogDev->Irq[i].CurrentNo;
736 Descriptor->u.Interrupt.Vector = LogDev->Irq[i].CurrentNo;
737 Descriptor->u.Interrupt.Affinity = (KAFFINITY)-1;
738 }
739 for (i = 0; i < RTL_NUMBER_OF(LogDev->Dma); i++)
740 {
741 if (LogDev->Dma[i].CurrentChannel == DMACHANNEL_NONE)
742 break;
743
744 Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[ResourceCount++];
746 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
747 Descriptor->Flags = CM_RESOURCE_DMA_8; /* Ignore information byte for compatibility */
748 Descriptor->u.Dma.Channel = LogDev->Dma[i].CurrentChannel;
749 }
750 for (i = 0; i < RTL_NUMBER_OF(LogDev->MemRange); i++)
751 {
752 if (!LogDev->MemRange[i].CurrentBase)
753 break;
754
755 if (!FindMemoryDescriptor(LogDev,
756 LogDev->MemRange[i].CurrentBase,
757 LogDev->MemRange[i].CurrentLength,
758 &Information))
759 {
760 DPRINT1("MEM entry #%lu %lx %lx not found\n",
761 i,
762 LogDev->MemRange[i].CurrentBase,
763 LogDev->MemRange[i].CurrentLength);
764 goto InvalidBiosResources;
765 }
766
767 Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[ResourceCount++];
769 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
771 if ((Information & 0x40) || !(Information & 0x01))
773 else
775 Descriptor->u.Memory.Length = LogDev->MemRange[i].CurrentLength;
776 Descriptor->u.Memory.Start.QuadPart = LogDev->MemRange[i].CurrentBase;
777 }
778 for (i = 0; i < RTL_NUMBER_OF(LogDev->MemRange32); i++)
779 {
780 if (!LogDev->MemRange32[i].CurrentBase)
781 break;
782
783 if (!FindMemoryDescriptor(LogDev,
784 LogDev->MemRange32[i].CurrentBase,
785 LogDev->MemRange32[i].CurrentLength,
786 &Information))
787 {
788 DPRINT1("MEM32 entry #%lu %lx %lx not found\n",
789 i,
790 LogDev->MemRange32[i].CurrentBase,
791 LogDev->MemRange32[i].CurrentLength);
792 goto InvalidBiosResources;
793 }
794
795 Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[ResourceCount++];
797 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
799 if ((Information & 0x40) || !(Information & 0x01))
801 else
803 Descriptor->u.Memory.Length = LogDev->MemRange32[i].CurrentLength;
804 Descriptor->u.Memory.Start.QuadPart = LogDev->MemRange32[i].CurrentBase;
805 }
806
807 PdoExt->ResourceList = ResourceList;
808 PdoExt->ResourceListSize = ListSize;
809 return STATUS_SUCCESS;
810
811InvalidBiosResources:
812 DPRINT1("Invalid boot resources! (CSN %u, LDN %u)\n", LogDev->CSN, LogDev->LDN);
813
814 LogDev->Flags &= ~ISAPNP_HAS_RESOURCES;
816 return STATUS_SUCCESS;
817}
818
819CODE_SEG("PAGE")
822 _In_opt_ ULONG SelectedReadPort)
823{
824 ULONG ResourceCount, ListSize, i;
827 const ULONG ReadPorts[] = { 0x274, 0x3E4, 0x204, 0x2E4, 0x354, 0x2F4 };
828
829 PAGED_CODE();
830
831 if (SelectedReadPort)
832 {
833 /*
834 * [IO descriptor: ISAPNP_WRITE_DATA, required]
835 * [IO descriptor: ISAPNP_WRITE_DATA, optional]
836 * [IO descriptor: ISAPNP_ADDRESS, required]
837 * [IO descriptor: ISAPNP_ADDRESS, optional]
838 * [IO descriptor: Selected Read Port, required]
839 * [IO descriptor: Read Port 1, optional]
840 * [IO descriptor: Read Port 2, optional]
841 * [...]
842 * [IO descriptor: Read Port X - 1, optional]
843 */
845 }
846 else
847 {
848 /*
849 * [IO descriptor: ISAPNP_WRITE_DATA, required]
850 * [IO descriptor: ISAPNP_WRITE_DATA, optional]
851 * [IO descriptor: ISAPNP_ADDRESS, required]
852 * [IO descriptor: ISAPNP_ADDRESS, optional]
853 * [IO descriptor: Read Port 1, required]
854 * [IO descriptor: Read Port 1, optional]
855 * [IO descriptor: Read Port 2, required]
856 * [IO descriptor: Read Port 2, optional]
857 * [...]
858 * [IO descriptor: Read Port X, required]
859 * [IO descriptor: Read Port X, optional]
860 */
862 }
863 ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
866 if (!RequirementsList)
867 return NULL;
868
869 RequirementsList->ListSize = ListSize;
870 RequirementsList->AlternativeLists = 1;
871
872 RequirementsList->List[0].Version = 1;
873 RequirementsList->List[0].Revision = 1;
874 RequirementsList->List[0].Count = ResourceCount;
875
876 Descriptor = &RequirementsList->List[0].Descriptors[0];
877
878 /* Store the Data port and the Address port */
879 for (i = 0; i < RTL_NUMBER_OF(IsaConfigPorts) * 2; i++)
880 {
881 if ((i % 2) == 0)
882 {
883 /* Expected port */
885 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
887 Descriptor->u.Port.Length = 0x01;
888 Descriptor->u.Port.Alignment = 0x01;
889 Descriptor->u.Port.MinimumAddress.LowPart =
890 Descriptor->u.Port.MaximumAddress.LowPart = IsaConfigPorts[i / 2];
891 }
892 else
893 {
894 /* ... but mark it as optional */
897 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
899 Descriptor->u.Port.Alignment = 0x01;
900 }
901
902 Descriptor++;
903 }
904
905 /* Store the Read Ports */
906 if (SelectedReadPort)
907 {
908 BOOLEAN Selected = FALSE;
909
911
912 for (i = 0; i < RTL_NUMBER_OF(ReadPorts); i++)
913 {
914 if (ReadPorts[i] != SelectedReadPort)
916 else
917 Selected = TRUE;
919 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
921 Descriptor->u.Port.Length = 0x04;
922 Descriptor->u.Port.Alignment = 0x01;
923 Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[i];
924 Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[i] +
925 Descriptor->u.Port.Length - 1;
926
927 Descriptor++;
928 }
929
930 ASSERT(Selected == TRUE);
931 }
932 else
933 {
934 for (i = 0; i < RTL_NUMBER_OF(ReadPorts) * 2; i++)
935 {
936 if ((i % 2) == 0)
937 {
938 /* Expected port */
940 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
942 Descriptor->u.Port.Length = 0x04;
943 Descriptor->u.Port.Alignment = 0x01;
944 Descriptor->u.Port.MinimumAddress.LowPart = ReadPorts[i / 2];
945 Descriptor->u.Port.MaximumAddress.LowPart = ReadPorts[i / 2] +
946 Descriptor->u.Port.Length - 1;
947 }
948 else
949 {
950 /* ... but mark it as optional */
953 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
955 Descriptor->u.Port.Alignment = 0x01;
956 }
957
958 Descriptor++;
959 }
960 }
961
962 return RequirementsList;
963}
964
965CODE_SEG("PAGE")
968{
969 ULONG ListSize, i;
972
973 PAGED_CODE();
974
975 ListSize = sizeof(CM_RESOURCE_LIST) +
978 if (!ResourceList)
979 return NULL;
980
981 ResourceList->Count = 1;
982 ResourceList->List[0].InterfaceType = Internal;
983 ResourceList->List[0].PartialResourceList.Version = 1;
984 ResourceList->List[0].PartialResourceList.Revision = 1;
985 ResourceList->List[0].PartialResourceList.Count = RTL_NUMBER_OF(IsaConfigPorts);
986
987 Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
988 for (i = 0; i < RTL_NUMBER_OF(IsaConfigPorts); i++)
989 {
991 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
993 Descriptor->u.Port.Length = 0x01;
994 Descriptor->u.Port.Start.LowPart = IsaConfigPorts[i];
995
996 Descriptor++;
997 }
998
999 return ResourceList;
1000}
1001
1002#ifndef UNIT_TEST
1003
1004static
1005CODE_SEG("PAGE")
1009{
1012
1013 PAGED_CODE();
1014 ASSERT(ReadPortCreated == FALSE);
1015
1016 DPRINT("Creating Read Port\n");
1017
1018 Status = IoCreateDevice(FdoExt->DriverObject,
1019 sizeof(ISAPNP_PDO_EXTENSION),
1020 NULL,
1023 FALSE,
1024 &FdoExt->ReadPortPdo);
1025 if (!NT_SUCCESS(Status))
1026 return Status;
1027
1028 PdoExt = FdoExt->ReadPortPdo->DeviceExtension;
1030 PdoExt->Common.Signature = IsaPnpReadDataPort;
1031 PdoExt->Common.Self = FdoExt->ReadPortPdo;
1032 PdoExt->Common.State = dsStopped;
1033 PdoExt->FdoExt = FdoExt;
1034
1035 FdoExt->ReadPortPdo->Flags &= ~DO_DEVICE_INITIALIZING;
1036
1037 return Status;
1038}
1039
1040CODE_SEG("PAGE")
1041VOID
1044{
1045 PAGED_CODE();
1046
1047 DPRINT("Removing Read Port\n");
1048
1050}
1051
1052CODE_SEG("PAGE")
1057 _In_ BOOLEAN IncludeDataPort)
1058{
1060 PLIST_ENTRY CurrentEntry;
1061 PISAPNP_LOGICAL_DEVICE IsaDevice;
1062 PDEVICE_RELATIONS DeviceRelations;
1063 ULONG PdoCount, i = 0;
1064
1065 PAGED_CODE();
1066
1067 IsaPnpAcquireBusDataLock();
1068
1069 /* Try to claim the Read Port for our FDO */
1070 if (!ReadPortCreated)
1071 {
1073 if (!NT_SUCCESS(Status))
1074 return Status;
1075
1076 ReadPortCreated = TRUE;
1077 }
1078
1079 IsaPnpReleaseBusDataLock();
1080
1081 /* Inactive ISA bus */
1082 if (!FdoExt->ReadPortPdo)
1083 IncludeDataPort = FALSE;
1084
1085 IsaPnpAcquireDeviceDataLock(FdoExt);
1086
1087 /* If called from the FDO dispatch routine && Active bus */
1088 if (IncludeDataPort && FdoExt->ReadPortPdo)
1089 {
1090 PISAPNP_PDO_EXTENSION ReadPortExt = FdoExt->ReadPortPdo->DeviceExtension;
1091
1092 if ((ReadPortExt->Flags & ISAPNP_READ_PORT_ALLOW_FDO_SCAN) &&
1093 !(ReadPortExt->Flags & ISAPNP_SCANNED_BY_READ_PORT))
1094 {
1095 DPRINT("Rescan ISA PnP bus\n");
1096
1097 /* Run the isolation protocol */
1098 FdoExt->Cards = IsaHwTryReadDataPort(FdoExt->ReadDataPort);
1099
1100 /* Card identification */
1101 if (FdoExt->Cards > 0)
1102 (VOID)IsaHwFillDeviceList(FdoExt);
1103
1105 }
1106
1107 ReadPortExt->Flags &= ~ISAPNP_SCANNED_BY_READ_PORT;
1108 }
1109
1110 PdoCount = FdoExt->DeviceCount;
1111 if (IncludeDataPort)
1112 ++PdoCount;
1113
1114 CurrentEntry = FdoExt->DeviceListHead.Flink;
1115 while (CurrentEntry != &FdoExt->DeviceListHead)
1116 {
1117 IsaDevice = CONTAINING_RECORD(CurrentEntry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1118
1119 if (!(IsaDevice->Flags & ISAPNP_PRESENT))
1120 --PdoCount;
1121
1122 CurrentEntry = CurrentEntry->Flink;
1123 }
1124
1125 DeviceRelations = ExAllocatePoolWithTag(PagedPool,
1126 FIELD_OFFSET(DEVICE_RELATIONS, Objects[PdoCount]),
1127 TAG_ISAPNP);
1128 if (!DeviceRelations)
1129 {
1130 IsaPnpReleaseDeviceDataLock(FdoExt);
1131 return STATUS_NO_MEMORY;
1132 }
1133
1134 if (IncludeDataPort)
1135 {
1136 PISAPNP_PDO_EXTENSION ReadPortExt = FdoExt->ReadPortPdo->DeviceExtension;
1137
1138 DeviceRelations->Objects[i++] = FdoExt->ReadPortPdo;
1139 ObReferenceObject(FdoExt->ReadPortPdo);
1140
1141 /* The Read Port PDO can only be removed by FDO */
1142 ReadPortExt->Flags |= ISAPNP_ENUMERATED;
1143 }
1144
1145 CurrentEntry = FdoExt->DeviceListHead.Flink;
1146 while (CurrentEntry != &FdoExt->DeviceListHead)
1147 {
1149
1150 IsaDevice = CONTAINING_RECORD(CurrentEntry, ISAPNP_LOGICAL_DEVICE, DeviceLink);
1151
1152 if (!(IsaDevice->Flags & ISAPNP_PRESENT))
1153 goto SkipPdo;
1154
1155 if (!IsaDevice->Pdo)
1156 {
1157 Status = IoCreateDevice(FdoExt->DriverObject,
1158 sizeof(ISAPNP_PDO_EXTENSION),
1159 NULL,
1162 FALSE,
1163 &IsaDevice->Pdo);
1164 if (!NT_SUCCESS(Status))
1165 goto SkipPdo;
1166
1167 IsaDevice->Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
1168 /* The power pagable flag is always unset */
1169
1170 PdoExt = IsaDevice->Pdo->DeviceExtension;
1171
1173 PdoExt->Common.Signature = IsaPnpLogicalDevice;
1174 PdoExt->Common.Self = IsaDevice->Pdo;
1175 PdoExt->Common.State = dsStopped;
1176 PdoExt->IsaPnpDevice = IsaDevice;
1177 PdoExt->FdoExt = FdoExt;
1178
1181 {
1182 if (PdoExt->RequirementsList)
1183 {
1184 ExFreePoolWithTag(PdoExt->RequirementsList, TAG_ISAPNP);
1185 PdoExt->RequirementsList = NULL;
1186 }
1187
1188 if (PdoExt->ResourceList)
1189 {
1190 ExFreePoolWithTag(PdoExt->ResourceList, TAG_ISAPNP);
1191 PdoExt->ResourceList = NULL;
1192 }
1193
1194 IoDeleteDevice(IsaDevice->Pdo);
1195 IsaDevice->Pdo = NULL;
1196 goto SkipPdo;
1197 }
1198 }
1199 else
1200 {
1201 PdoExt = IsaDevice->Pdo->DeviceExtension;
1202 }
1203 DeviceRelations->Objects[i++] = IsaDevice->Pdo;
1204 ObReferenceObject(IsaDevice->Pdo);
1205
1206 PdoExt->Flags |= ISAPNP_ENUMERATED;
1207
1208 CurrentEntry = CurrentEntry->Flink;
1209 continue;
1210
1211SkipPdo:
1212 if (IsaDevice->Pdo)
1213 {
1214 PdoExt = IsaDevice->Pdo->DeviceExtension;
1215
1216 if (PdoExt)
1217 PdoExt->Flags &= ~ISAPNP_ENUMERATED;
1218 }
1219
1220 CurrentEntry = CurrentEntry->Flink;
1221 }
1222
1223 IsaPnpReleaseDeviceDataLock(FdoExt);
1224
1225 DeviceRelations->Count = i;
1226
1227 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
1228
1229 return Status;
1230}
1231
1232static CODE_SEG("PAGE") DRIVER_ADD_DEVICE IsaAddDevice;
1233
1234static
1235CODE_SEG("PAGE")
1237NTAPI
1238IsaAddDevice(
1241{
1243 PISAPNP_FDO_EXTENSION FdoExt;
1245 static ULONG BusNumber = 0;
1246
1247 PAGED_CODE();
1248
1250
1252 sizeof(*FdoExt),
1253 NULL,
1256 FALSE,
1257 &Fdo);
1258 if (!NT_SUCCESS(Status))
1259 {
1260 DPRINT1("Failed to create FDO (0x%08lx)\n", Status);
1261 return Status;
1262 }
1263
1264 FdoExt = Fdo->DeviceExtension;
1265 RtlZeroMemory(FdoExt, sizeof(*FdoExt));
1266
1267 FdoExt->Common.Self = Fdo;
1268 FdoExt->Common.Signature = IsaPnpBus;
1269 FdoExt->Common.State = dsStopped;
1270 FdoExt->DriverObject = DriverObject;
1271 FdoExt->BusNumber = BusNumber++;
1272 FdoExt->Pdo = PhysicalDeviceObject;
1275 if (!FdoExt->Ldo)
1276 {
1278 return STATUS_DEVICE_REMOVED;
1279 }
1280
1283
1284 IsaPnpAcquireBusDataLock();
1285 InsertTailList(&BusListHead, &FdoExt->BusLink);
1286 IsaPnpReleaseBusDataLock();
1287
1288 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
1289
1290 return STATUS_SUCCESS;
1291}
1292
1294static DRIVER_DISPATCH_RAISED IsaPower;
1295
1296static
1298NTAPI
1299IsaPower(
1302{
1303 PISAPNP_COMMON_EXTENSION DevExt = DeviceObject->DeviceExtension;
1305
1306 if (DevExt->Signature != IsaPnpBus)
1307 {
1309 {
1310 case IRP_MN_SET_POWER:
1311 case IRP_MN_QUERY_POWER:
1313 Irp->IoStatus.Status = Status;
1314 break;
1315
1316 default:
1317 Status = Irp->IoStatus.Status;
1318 break;
1319 }
1320
1323 return Status;
1324 }
1325
1328 return PoCallDriver(((PISAPNP_FDO_EXTENSION)DevExt)->Ldo, Irp);
1329}
1330
1332static CODE_SEG("PAGE") DRIVER_DISPATCH_PAGED IsaPnp;
1333
1334static
1335CODE_SEG("PAGE")
1337NTAPI
1338IsaPnp(
1341{
1343 PISAPNP_COMMON_EXTENSION DevExt = DeviceObject->DeviceExtension;
1344
1345 PAGED_CODE();
1346
1347 if (DevExt->Signature == IsaPnpBus)
1348 return IsaFdoPnp((PISAPNP_FDO_EXTENSION)DevExt, Irp, IrpSp);
1349 else
1350 return IsaPdoPnp((PISAPNP_PDO_EXTENSION)DevExt, Irp, IrpSp);
1351}
1352
1355static CODE_SEG("PAGE") DRIVER_DISPATCH_PAGED IsaCreateClose;
1356
1357static
1358CODE_SEG("PAGE")
1360NTAPI
1361IsaCreateClose(
1364{
1365 PAGED_CODE();
1366
1367 Irp->IoStatus.Status = STATUS_SUCCESS;
1368
1369 DPRINT("%s(%p, %p)\n", __FUNCTION__, DeviceObject, Irp);
1370
1372
1373 return STATUS_SUCCESS;
1374}
1375
1378static CODE_SEG("PAGE") DRIVER_DISPATCH_PAGED IsaForwardOrIgnore;
1379
1380static
1381CODE_SEG("PAGE")
1383NTAPI
1384IsaForwardOrIgnore(
1387{
1388 PISAPNP_COMMON_EXTENSION CommonExt = DeviceObject->DeviceExtension;
1389
1390 PAGED_CODE();
1391
1392 DPRINT("%s(%p, %p) Minor - %X\n", __FUNCTION__, DeviceObject, Irp,
1394
1395 if (CommonExt->Signature == IsaPnpBus)
1396 {
1398 return IoCallDriver(((PISAPNP_FDO_EXTENSION)CommonExt)->Ldo, Irp);
1399 }
1400 else
1401 {
1402 NTSTATUS Status = Irp->IoStatus.Status;
1403
1405 return Status;
1406 }
1407}
1408
1409CODE_SEG("INIT")
1411NTAPI
1415{
1416 DPRINT("%s(%p, %wZ)\n", __FUNCTION__, DriverObject, RegistryPath);
1417
1418 if (IsNEC_98)
1419 {
1422 }
1423
1424 DriverObject->MajorFunction[IRP_MJ_CREATE] = IsaCreateClose;
1425 DriverObject->MajorFunction[IRP_MJ_CLOSE] = IsaCreateClose;
1426 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IsaForwardOrIgnore;
1427 DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IsaForwardOrIgnore;
1428 DriverObject->MajorFunction[IRP_MJ_PNP] = IsaPnp;
1429 DriverObject->MajorFunction[IRP_MJ_POWER] = IsaPower;
1430 DriverObject->DriverExtension->AddDevice = IsaAddDevice;
1431
1432 /* FIXME: Fix SDK headers */
1433#if 0
1435#endif
1436
1438 InitializeListHead(&BusListHead);
1439
1440 /* FIXME: Fix SDK headers */
1441#if 0
1443#endif
1444
1445 return STATUS_SUCCESS;
1446}
1447
1448#endif /* UNIT_TEST */
1449
1450/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
#define CODE_SEG(...)
unsigned char BOOLEAN
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define VOID
Definition: acefi.h:82
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define _Dispatch_type_(a)
Definition: btrfs_drv.h:204
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
NTSTATUS IsaFdoPnp(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:123
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define _Guarded_by_(lock)
#define _No_competing_thread_begin_
#define _No_competing_thread_end_
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define STATUS_DEVICE_REMOVED
Definition: d3dkmdt.h:39
#define RtlInitializeBitMap
Definition: dbgbitmap.h:326
#define RtlNumberOfSetBits
Definition: dbgbitmap.h:343
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static const WCHAR Description[]
Definition: oid.c:1266
ULONG_PTR KAFFINITY
Definition: compat.h:85
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
VOID IsaHwWaitForKey(VOID)
Definition: hardware.c:1684
UCHAR IsaHwTryReadDataPort(_In_ PUCHAR ReadDataPort)
Definition: hardware.c:1259
ULONG IsaConfigPorts[2]
Definition: hardware.c:23
#define __FUNCTION__
Definition: types.h:116
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define ULONG_PTR
Definition: config.h:101
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:25
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
static ULONG BitmapBuffer[(XMS_BLOCKS+31)/32]
Definition: himem.c:86
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
#define CmResourceTypeDma
Definition: hwresource.cpp:126
@ Internal
Definition: hwresource.cpp:137
@ Isa
Definition: hwresource.cpp:138
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
static ULONG ResourceCount
Definition: inbv.c:50
BOOLEAN FindDmaDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Channel)
Definition: isapnp.c:535
static VOID IsaConvertIrqRequirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PISAPNP_IRQ_DESCRIPTION Description, _In_ ULONG Vector, _In_ BOOLEAN FirstDescriptor)
Definition: isapnp.c:61
BOOLEAN FindIrqDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG Vector)
Definition: isapnp.c:508
NTSTATUS IsaPnpFillDeviceRelations(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ BOOLEAN IncludeDataPort)
Definition: isapnp.c:1054
static NTSTATUS IsaPnpCreateLogicalDeviceRequirements(_In_ PISAPNP_PDO_EXTENSION PdoExt)
Definition: isapnp.c:189
VOID IsaPnpRemoveReadPortDO(_In_ PDEVICE_OBJECT Pdo)
Definition: isapnp.c:1042
static NTSTATUS IsaPnpCreateLogicalDeviceResources(_In_ PISAPNP_PDO_EXTENSION PdoExt)
Definition: isapnp.c:625
KEVENT BusSyncEvent
Definition: isapnp.c:21
PIO_RESOURCE_REQUIREMENTS_LIST IsaPnpCreateReadPortDORequirements(_In_opt_ ULONG SelectedReadPort)
Definition: isapnp.c:821
static VOID IsaConvertMemRange32Requirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PISAPNP_MEMRANGE32_DESCRIPTION Description)
Definition: isapnp.c:137
static VOID IsaConvertMemRangeRequirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PISAPNP_MEMRANGE_DESCRIPTION Description)
Definition: isapnp.c:111
PCM_RESOURCE_LIST IsaPnpCreateReadPortDOResources(VOID)
Definition: isapnp.c:967
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)
Definition: isapnp.c:459
BOOLEAN FindMemoryDescriptor(_In_ PISAPNP_LOGICAL_DEVICE LogDevice, _In_ ULONG RangeStart, _In_ ULONG RangeEnd, _Out_opt_ PUCHAR Information)
Definition: isapnp.c:562
static VOID IsaConvertDmaRequirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PISAPNP_DMA_DESCRIPTION Description, _In_ ULONG Channel, _In_ BOOLEAN FirstDescriptor)
Definition: isapnp.c:89
static NTSTATUS IsaPnpCreateReadPortDO(_In_ PISAPNP_FDO_EXTENSION FdoExt)
Definition: isapnp.c:1007
#define TAG_ISAPNP
Definition: isapnp.h:26
#define ISAPNP_READ_PORT_ALLOW_FDO_SCAN
Allows the active FDO to scan the bus.
Definition: isapnp.h:77
@ dsStopped
Definition: isapnp.h:30
@ IsaPnpLogicalDevice
Definition: isapnp.h:37
@ IsaPnpBus
Definition: isapnp.h:36
@ IsaPnpReadDataPort
Definition: isapnp.h:38
NTSTATUS IsaPdoPnp(_In_ PISAPNP_PDO_EXTENSION PdoDeviceExtension, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:867
#define ISAPNP_SCANNED_BY_READ_PORT
The bus has been scanned by Read Port PDO.
Definition: isapnp.h:76
#define ISAPNP_ENUMERATED
Whether the device has been reported to the PnP manager.
Definition: isapnp.h:75
#define ISAPNP_ADDRESS_PC98
Definition: isapnphw.h:19
#define DMACHANNEL_NONE
Definition: isapnphw.h:47
#define ISAPNP_WRITE_DATA_PC98
Definition: isapnphw.h:20
#define ISAPNP_RESOURCE_TYPE_MEMRANGE
Definition: isapnpres.h:73
ISAPNP_DEPENDENT_FUNCTION_STATE
Definition: isapnpres.h:60
@ dfDone
Definition: isapnpres.h:63
@ dfStarted
Definition: isapnpres.h:62
@ dfNotStarted
Definition: isapnpres.h:61
#define ISAPNP_RESOURCE_TYPE_END
Definition: isapnpres.h:69
#define ISAPNP_RESOURCE_TYPE_IRQ
Definition: isapnpres.h:71
#define ISAPNP_PRESENT
Definition: isapnpres.h:96
#define ISAPNP_RESOURCE_TYPE_IO
Definition: isapnpres.h:70
#define ISAPNP_RESOURCE_TYPE_START_DEPENDENT
Definition: isapnpres.h:75
#define ISAPNP_RESOURCE_TYPE_MEMRANGE32
Definition: isapnpres.h:74
#define ISAPNP_RESOURCE_TYPE_END_DEPENDENT
Definition: isapnpres.h:76
#define ISAPNP_RESOURCE_TYPE_DMA
Definition: isapnpres.h:72
#define ISAPNP_HAS_RESOURCES
Definition: isapnpres.h:102
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CM_RESOURCE_DMA_8
Definition: cmtypes.h:131
#define CM_RESOURCE_MEMORY_READ_ONLY
Definition: cmtypes.h:121
#define CM_RESOURCE_PORT_16_BIT_DECODE
Definition: cmtypes.h:112
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: cmtypes.h:143
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
#define CM_RESOURCE_MEMORY_24
Definition: cmtypes.h:125
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2451
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:327
#define UNREACHABLE
#define DEFAULT_UNREACHABLE
#define RTL_BITS_OF(sizeOfArg)
Definition: ntbasedef.h:676
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ SynchronizationEvent
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define IoCompleteRequest
Definition: irp.c:1240
#define IoCallDriver
Definition: irp.c:1225
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
#define FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:87
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:49
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
PDEVICE_OBJECT Self
Definition: pciidex.h:60
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
IO_RESOURCE_DESCRIPTOR Descriptors[1]
Definition: iotypes.h:2737
ISAPNP_SIGNATURE Signature
Definition: isapnp.h:43
PDEVICE_OBJECT Self
Definition: isapnp.h:44
ISAPNP_DEVICE_STATE State
Definition: isapnp.h:45
UCHAR CurrentChannel
Definition: isapnpres.h:31
PDRIVER_OBJECT DriverObject
Definition: isapnp.h:63
LIST_ENTRY DeviceListHead
Definition: precomp.h:82
PDEVICE_OBJECT Pdo
Definition: isapnp.h:52
LIST_ENTRY BusLink
Definition: isapnp.h:66
KEVENT DeviceSyncEvent
Definition: isapnp.h:55
ISAPNP_COMMON_EXTENSION Common
Definition: isapnp.h:50
PDEVICE_OBJECT Ldo
Definition: isapnp.h:51
USHORT CurrentBase
Definition: isapnpres.h:16
UCHAR CurrentType
Definition: isapnpres.h:24
UCHAR CurrentNo
Definition: isapnpres.h:23
ISAPNP_DMA Dma[2]
Definition: isapnpres.h:133
PDEVICE_OBJECT Pdo
Definition: isapnpres.h:92
ISAPNP_MEMRANGE32 MemRange32[4]
Definition: isapnpres.h:135
ISAPNP_MEMRANGE MemRange[4]
Definition: isapnpres.h:134
ISAPNP_IRQ Irq[2]
Definition: isapnpres.h:132
ULONG CurrentLength
Definition: isapnpres.h:39
ULONG CurrentBase
Definition: isapnpres.h:38
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:204
uint32_t * PULONG
Definition: typedefs.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
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_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1699
_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
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461
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
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareShared
Definition: cmtypes.h:243
@ CmResourceShareUndetermined
Definition: cmtypes.h:240
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
#define IO_NO_INCREMENT
Definition: iotypes.h:598
DRIVER_DISPATCH DRIVER_DISPATCH_RAISED
Definition: iotypes.h:2263
struct _IO_RESOURCE_LIST * PIO_RESOURCE_LIST
#define IO_RESOURCE_ALTERNATIVE
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MN_SET_POWER
#define IRP_MJ_POWER
#define IRP_MN_QUERY_POWER
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
#define IsNEC_98
Definition: ketypes.h:911
#define ObReferenceObject
Definition: obfuncs.h:204
unsigned char UCHAR
Definition: xmlstorage.h:181