ReactOS 0.4.17-dev-1190-g4c812f4
fdo.c
Go to the documentation of this file.
1/*
2 * PROJECT: PCI IDE bus driver extension
3 * LICENSE: See COPYING in the top level directory
4 * PURPOSE: ATA controller FDO dispatch routines
5 * COPYRIGHT: Copyright 2005 Hervé Poussineau <hpoussin@reactos.org>
6 * Copyright 2023 Dmitry Borisov <di.sean@protonmail.com>
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "pciidex.h"
12
13/* FUNCTIONS ******************************************************************/
14
15static
17VOID
20{
22
24 Controller->Start(Controller);
26}
27
28static
30VOID
33{
35
39}
40
41extern
42VOID
45
46CODE_SEG("PAGE")
49 _In_ PVOID ChannelContext,
50 _In_ BOOLEAN Attach)
51{
52 PCHANNEL_DATA_COMMON ChanData = ChannelContext;
54
55 PAGED_CODE();
56
57 return Controller->AttachChannel(ChanData, Attach);
58}
59
61VOID
63 _In_ PVOID ChannelContext,
65{
66 PCHANNEL_DATA_COMMON ChanData = ChannelContext;
70
71 if (Controller->Flags & CTRL_FLAG_IS_AHCI)
72 InterruptObject = Controller->InterruptObject;
73 else
76
78 ChanData->EnableInterrupts(ChanData, Enable);
80}
81
82VOID
84 _In_ PVOID ChannelContext,
86{
87 PCHANNEL_DATA_COMMON ChanData = ChannelContext;
90 ULONG i;
91 BOOLEAN DiscoveredNewDevice = FALSE;
92
93 for (i = 0; i < ATA_MAX_DEVICE; ++i)
94 {
96
97 if (!Device)
98 continue;
99
100 if (Device->IsNewDevice)
101 DiscoveredNewDevice = TRUE;
102
103 /* Apply the channel limit */
104 Device->SupportedModes &= ChanData->Current.TransferModeSupported;
105
106 if ((ChanData->ChanInfo & CHANNEL_FLAG_NO_ATAPI_DMA) && !Device->IsFixedDisk)
107 Device->SupportedModes &= PIO_ALL;
108
109 /*
110 * If we are booting in minimal safe mode we disable DMA for ATAPI devices
111 * to improve system stability.
112 */
113 if (InitSafeBootMode == 1)
114 {
115 if (!(ChanData->ChanInfo & CHANNEL_FLAG_PIO_VIA_DMA) && !Device->IsFixedDisk)
116 Device->SupportedModes &= PIO_ALL;
117 }
118
119 /* Set initial values for mode selection: Find the fastest supported PIO and DMA mode */
120 if (!_BitScanReverse(&Device->DmaMode, Device->SupportedModes & ~PIO_ALL))
121 Device->DmaMode = PIO_MODE(0);
122 NT_VERIFY(_BitScanReverse(&Device->PioMode, Device->SupportedModes & PIO_ALL));
123 }
124
125 /*
126 * _GTF should be executed after _STM has been evaluated,
127 * because it is expected that ACPI BIOS will use the identity data buffers
128 * to construct the list of ATA commands to the drive.
129 *
130 * Therefore for any new device we have to evaluate a dummy _STM
131 * when the whole configuration of the channel's transfer timings
132 * is done at the controller minidriver.
133 */
134 if (DiscoveredNewDevice && (ChanData->ChanInfo & CHANNEL_FLAG_HAS_ACPI_GTM))
135 {
136 PCHANNEL_DATA_PATA PataData = ChannelContext;
137
138 /* Evaluate _STM */
139 AtaAcpiSetTimingMode(PataData->PdoExt->Common.Self,
140 &PataData->CurrentTimingMode,
141 DeviceList[0] ? DeviceList[0]->IdentifyDeviceData : NULL,
142 DeviceList[1] ? DeviceList[1]->IdentifyDeviceData : NULL);
143 }
144
145 /* ACPI evaluations can pend, so they cannot run under the controller lock */
147 {
148 ChanData->SetTransferMode(Controller, ChanData->Channel, DeviceList);
149 return;
150 }
151
152 /* Set the PATA transfer timings */
154 ChanData->SetTransferMode(Controller, ChanData->Channel, DeviceList);
156}
157
158CODE_SEG("PAGE")
159VOID
161 _In_ PVOID ChannelContext,
163 _In_ PIDENTIFY_DEVICE_DATA IdentifyDeviceData)
164{
165 PCHANNEL_DATA_COMMON ChanData = ChannelContext;
167
168 PAGED_CODE();
169
170 if (!(Controller->Flags & CTRL_FLAG_SATA_HBA_ACPI))
171 return;
172
173 AtaAcpiSetDeviceData(DeviceObject, IdentifyDeviceData);
174}
175
176CODE_SEG("PAGE")
177PVOID
179 _In_ PVOID ChannelContext,
181{
182 PCHANNEL_DATA_COMMON ChanData = ChannelContext;
184
185 PAGED_CODE();
186
187 if ((Controller->Flags & CTRL_FLAG_SATA_HBA_ACPI) ||
189 {
191 }
192
193 return NULL;
194}
195
198 _In_ PVOID ChannelContext)
199{
200 PCHANNEL_DATA_COMMON ChanData = ChannelContext;
202
203 PAGED_CODE();
204
205 if (Controller->Flags & CTRL_FLAG_IS_AHCI)
206 return AtaAhciDowngradeInterfaceSpeed(ChannelContext);
207
208 /* Optionally, implement a SATA framework at some point in the future */
209 return FALSE;
210}
211
212VOID
214 _In_ PVOID ChannelContext,
215 _In_ BOOLEAN DisableInterrupts)
216{
217 PCHANNEL_DATA_COMMON ChanData = ChannelContext;
218
220
221 ChanData->ActiveSlotsBitmap = 0;
222 ChanData->ActiveQueuedSlotsBitmap = 0;
223
224 /* Disable and clear pending interrupts */
225 if (DisableInterrupts)
226 {
227 ChanData->EnableInterrupts(ChanData, FALSE);
228
229#if DBG
230 if (ChanData->Controller->Flags & CTRL_FLAG_IS_AHCI)
231 {
232 PVOID IoBase = ((PCHANNEL_DATA_AHCI)ChanData)->IoBase;
233
234 DbgPrint("PxIS 0x%08lX\n", AHCI_PORT_READ(IoBase, PxInterruptStatus));
235 DbgPrint("PxIE 0x%08lX\n", AHCI_PORT_READ(IoBase, PxInterruptEnable));
236 DbgPrint("PxCMD 0x%08lX\n", AHCI_PORT_READ(IoBase, PxCmdStatus));
237 DbgPrint("PxTFD 0x%08lX\n", AHCI_PORT_READ(IoBase, PxTaskFileData));
238 DbgPrint("PxSIG 0x%08lX\n", AHCI_PORT_READ(IoBase, PxSignature));
239 DbgPrint("PxSSTS 0x%08lX\n", AHCI_PORT_READ(IoBase, PxSataStatus));
240 DbgPrint("PxSCTL 0x%08lX\n", AHCI_PORT_READ(IoBase, PxSataControl));
241 DbgPrint("PxSERR 0x%08lX\n", AHCI_PORT_READ(IoBase, PxSataError));
242 DbgPrint("PxSACT 0x%08lX\n", AHCI_PORT_READ(IoBase, PxSataActive));
243 DbgPrint("PxCI 0x%08lX\n", AHCI_PORT_READ(IoBase, PxCommandIssue));
244 DbgPrint("PxSNTF 0x%08lX\n", AHCI_PORT_READ(IoBase, PxSataNotification));
245 DbgPrint("PxFBS 0x%08lX\n", AHCI_PORT_READ(IoBase, PxFisSwitchingControl));
246 DbgPrint("PxDEVSLP 0x%08lX\n", AHCI_PORT_READ(IoBase, PxDeviceSleep));
247 }
248#endif
249 }
250}
251
252CODE_SEG("PAGE")
253PVOID
257 _In_ ULONG MinimumIoLength)
258{
259 PAGED_CODE();
260
261 if (!(Controller->AccessRange[Index].Flags & RANGE_IS_VALID))
262 return NULL;
263
264 /* Validate the BAR length */
265 if (MinimumIoLength != 0)
266 {
267 if (Controller->AccessRange[Index].Length < MinimumIoLength)
268 {
269 ERR("%04X:%04X.%02X: Unexpected PCI BAR #%lu length 0x%lx, minimum required 0x%lx\n",
270 Controller->Pci.VendorID,
271 Controller->Pci.DeviceID,
272 Controller->Pci.RevisionID,
273 Index,
274 Controller->AccessRange[Index].Length,
275 MinimumIoLength);
276 return NULL;
277 }
278 }
279
280 if ((Controller->AccessRange[Index].Flags & RANGE_IS_MEMORY) &&
281 !(Controller->AccessRange[Index].Flags & RANGE_IS_MAPPED))
282 {
284
285 Controller->AccessRange[Index].Flags |= RANGE_IS_MAPPED;
286
287 PhysicalAddress.QuadPart = (ULONG_PTR)Controller->AccessRange[Index].IoBase;
288 Controller->AccessRange[Index].IoBase = MmMapIoSpace(PhysicalAddress,
289 Controller->AccessRange[Index].Length,
291 }
292
293 return Controller->AccessRange[Index].IoBase;
294}
295
296static
297CODE_SEG("PAGE")
300 _In_ PPCI_COMMON_HEADER PciData,
302{
303 PAGED_CODE();
304
305 for (; *Bar < PCI_TYPE0_ADDRESSES; (*Bar)++)
306 {
307 ULONG IoBase = PciData->u.type0.BaseAddresses[*Bar];
308
309 if (IoBase & PCI_ADDRESS_IO_SPACE)
310 IoBase &= ~PCI_ADDRESS_IO_SPACE;
311 else
313
314 /* Look for a valid BAR */
315 if (IoBase == 0)
316 continue;
317
318 return TRUE;
319 }
320
321 return FALSE;
322}
323
324static
325CODE_SEG("PAGE")
326VOID
330 _In_ PPCI_COMMON_HEADER PciData)
331{
332 ULONG i, Bar;
333
334 PAGED_CODE();
335
337 return;
338
339 for (i = 0; i < ResourcesTranslated->List[0].PartialResourceList.Count; ++i)
340 {
342
343 Desc = &ResourcesTranslated->List[0].PartialResourceList.PartialDescriptors[i];
344 if (Desc->Type == CmResourceTypeInterrupt)
345 {
346 RtlCopyMemory(&Controller->InterruptDesc, Desc, sizeof(*Desc));
347 break;
348 }
349 }
350
351 for (i = 0, Bar = 0; i < ResourcesTranslated->List[0].PartialResourceList.Count; ++i)
352 {
354 ULONG CurrBar, NextBar;
355
356 Desc = &ResourcesTranslated->List[0].PartialResourceList.PartialDescriptors[i];
357 if ((Desc->Type != CmResourceTypePort) && (Desc->Type != CmResourceTypeMemory))
358 continue;
359
360 if (!AtaCtrlPciGetNextBarIndex(PciData, &Bar))
361 break;
362
363 CurrBar = PciData->u.type0.BaseAddresses[Bar];
364 if (Bar < (PCI_TYPE0_ADDRESSES - 1))
365 NextBar = PciData->u.type0.BaseAddresses[Bar + 1];
366 else
367 NextBar = 0;
368
369 if (CurrBar & PCI_ADDRESS_IO_SPACE)
370 {
371 if (Desc->Type != CmResourceTypePort)
372 continue;
373
374 if (Desc->u.Port.Start.QuadPart != (CurrBar & PCI_ADDRESS_IO_ADDRESS_MASK))
375 continue;
376
377 INFO("BAR[%lu]: I/O %I64X Len %lX\n",
378 Bar, Desc->u.Port.Start.QuadPart, Desc->u.Port.Length);
379 Controller->AccessRange[Bar].Flags |= RANGE_IS_VALID;
380 Controller->AccessRange[Bar].IoBase = (PVOID)(ULONG_PTR)Desc->u.Port.Start.QuadPart;
381 Controller->AccessRange[Bar].Length = Desc->u.Port.Length;
382 }
383 else
384 {
385 if (Desc->Type != CmResourceTypeMemory)
386 continue;
387
388 if (Desc->u.Memory.Start.LowPart != (CurrBar & PCI_ADDRESS_MEMORY_ADDRESS_MASK))
389 continue;
390
392 {
393 if (Desc->u.Memory.Start.HighPart != NextBar)
394 continue;
395 }
396 else
397 {
398 if (Desc->u.Memory.Start.HighPart != 0)
399 continue;
400 }
401
402 INFO("BAR[%lu]: MEM %I64X Len %lX\n",
403 Bar, Desc->u.Memory.Start.QuadPart, Desc->u.Memory.Length);
404 Controller->AccessRange[Bar].Flags |= RANGE_IS_VALID | RANGE_IS_MEMORY;
405 Controller->AccessRange[Bar].IoBase = (PVOID)(ULONG_PTR)Desc->u.Memory.Start.QuadPart;
406 Controller->AccessRange[Bar].Length = Desc->u.Memory.Length;
407 }
408
409 ++Bar;
410 }
411}
412
413static
414CODE_SEG("PAGE")
415VOID
418 _In_ PPCI_COMMON_HEADER PciData)
419{
420 PAGED_CODE();
421
422 Controller->Pci.VendorID = PciData->VendorID;
423 Controller->Pci.DeviceID = PciData->DeviceID;
424 Controller->Pci.Command = PciData->Command;
425 Controller->Pci.RevisionID = PciData->RevisionID;
426 Controller->Pci.ProgIf = PciData->ProgIf;
427 Controller->Pci.SubClass = PciData->SubClass;
428 Controller->Pci.BaseClass = PciData->BaseClass;
429 Controller->Pci.CacheLineSize = PciData->CacheLineSize;
430 Controller->Pci.SubVendorID = PciData->u.type0.SubVendorID;
431 Controller->Pci.SubSystemID = PciData->u.type0.SubSystemID;
432}
433
434static
435CODE_SEG("PAGE")
440{
441 PATA_CONTROLLER Controller = &FdoExt->Controller;
443 PPCI_COMMON_HEADER PciData = (PPCI_COMMON_HEADER)Buffer; // Partial PCI header
445
446 PAGED_CODE();
447
448 BytesRead = Controller->GetBusData(Controller->BusInterfaceContext,
450 Buffer,
451 0,
452 sizeof(Buffer));
453 if (BytesRead != sizeof(Buffer))
455
458
459 return STATUS_SUCCESS;
460}
461
462CODE_SEG("PAGE")
465 _In_ PVOID ControllerContext,
467{
468 PFDO_DEVICE_EXTENSION FdoExt = ControllerContext;
471
472 PAGED_CODE();
473
476 Controller->QueueDepth = 1; // PATA_CHANNEL_SLOT
477 Controller->AlignmentRequirement = ATA_MIN_BUFFER_ALIGNMENT;
478 Controller->AttachChannel = PciIdeAttachChannel;
479 Controller->FreeResources = NULL;
480 Controller->Start = NULL;
481 Controller->Stop = NULL;
482 Controller->ChannelEnableBits = NULL;
483
484#if defined(ATA_DETECT_LEGACY_DEVICES)
485 if (Controller->Flags & CTRL_FLAG_NON_PNP)
486 {
488 }
489 else
490#endif
491 {
493 if (!NT_SUCCESS(Status))
494 {
495 ERR("Failed to collect PCI information 0x%lx\n", Status);
496 return Status;
497 }
498
499 INFO("Starting controller %04X:%04X.%02X-%04X.%04X-%02X.%02X.%02X\n",
500 Controller->Pci.VendorID,
501 Controller->Pci.DeviceID,
502 Controller->Pci.RevisionID,
503 Controller->Pci.SubVendorID,
504 Controller->Pci.SubSystemID,
505 Controller->Pci.BaseClass,
506 Controller->Pci.SubClass,
507 Controller->Pci.ProgIf);
508
510 if (Status == STATUS_NO_MATCH)
512 }
513 if (!NT_SUCCESS(Status))
514 {
515 ERR("Failed to match ATA controller with status %lx\n", Status);
516 return Status;
517 }
518
519 if (Controller->Start)
521
522 return STATUS_SUCCESS;
523}
524
525static
526CODE_SEG("PAGE")
527VOID
530{
532 ULONG i;
533
534 PAGED_CODE();
535
536 if (Controller->Stop)
538
539 if (Controller->FreeResources)
540 Controller->FreeResources(Controller);
541
542 Controller->InterruptObject = NULL;
543
544 for (i = 0; i < RTL_NUMBER_OF(Controller->AccessRange); ++i)
545 {
546 if ((Controller->AccessRange[i].Flags & RANGE_IS_VALID) &&
547 (Controller->AccessRange[i].Flags & RANGE_IS_MAPPED))
548 {
549 MmUnmapIoSpace(Controller->AccessRange[i].IoBase, Controller->AccessRange[i].Length);
550 }
551
552 Controller->AccessRange[i].Flags = 0;
553 }
554
555 if (Controller->ChanDataBlock)
556 {
558 Controller->ChanDataBlock = NULL;
559 }
560
561 if (Controller->HwSyncObject)
562 {
563 IoDeleteController(Controller->HwSyncObject);
564 Controller->HwSyncObject = NULL;
565 }
566
567 if (Controller->HwExt)
568 {
570 Controller->HwExt = NULL;
571 }
572
573 Controller->InterruptDesc.Type = 0;
574}
575
576static
577CODE_SEG("PAGE")
581{
582 PAGED_CODE();
583
585
586 return STATUS_SUCCESS;
587}
588
589CODE_SEG("PAGE")
590VOID
592 _In_ PVOID ControllerContext)
593{
594 PFDO_DEVICE_EXTENSION FdoExt = ControllerContext;
595 PLIST_ENTRY ListEntry;
596
597 PAGED_CODE();
598
600
601 for (ListEntry = FdoExt->PdoListHead.Flink;
602 ListEntry != &FdoExt->PdoListHead;
603 ListEntry = ListEntry->Flink)
604 {
606
607 PdoExt = CONTAINING_RECORD(ListEntry, PDO_DEVICE_EXTENSION, ListEntry);
608
611 }
612
614
616}
617
618static
619CODE_SEG("PAGE")
623 _In_ ULONG ChannelNumber)
624{
627 WCHAR DeviceNameBuffer[sizeof("\\Device\\Ide\\PciIde99999Channel99-FFF")];
631 static ULONG PdoNumber = 0;
632
633 PAGED_CODE();
634
635 Status = RtlStringCbPrintfW(DeviceNameBuffer,
636 sizeof(DeviceNameBuffer),
637 L"\\Device\\Ide\\PciIde%luChannel%lu-%lx",
638 FdoExtension->ControllerNumber,
639 ChannelNumber,
640 PdoNumber++);
642 RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
643
644 Status = IoCreateDevice(FdoExtension->Common.Self->DriverObject,
645 sizeof(*PdoExtension),
646 &DeviceName,
649 FALSE,
650 &Pdo);
651 if (!NT_SUCCESS(Status))
652 {
653 ERR("Failed to create PDO 0x%lx\n", Status);
654 return NULL;
655 }
656
657 INFO("Created device object %p '%wZ'\n", Pdo, &DeviceName);
658
659 /* DMA buffers alignment */
660 Alignment = FdoExtension->Controller.AlignmentRequirement;
661 Alignment = max(Alignment, FdoExtension->Common.Self->AlignmentRequirement);
663 Pdo->AlignmentRequirement = Alignment;
664
665 PdoExtension = Pdo->DeviceExtension;
666
668 PdoExtension->Common.Self = Pdo;
669 PdoExtension->Common.FdoExt = FdoExtension;
670 IoInitializeRemoveLock(&PdoExtension->Common.RemoveLock, TAG_PCIIDEX, 0, 0);
671
672 PdoExtension->Channel = ChannelNumber;
673 PdoExtension->ChanData = FdoExtension->Controller.Channels[ChannelNumber];
674 ASSERT(PdoExtension->ChanData);
675 PdoExtension->ChanData->PdoExt = PdoExtension;
676
677 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
678 return PdoExtension;
679}
680
681CODE_SEG("PAGE")
686{
687 PAGED_CODE();
688
689 if (Controller->Flags & CTRL_FLAG_IS_AHCI)
690 return ChannelStateUnknown;
691
693}
694
695static
696CODE_SEG("PAGE")
700 _In_ PIRP Irp)
701{
702 PATA_CONTROLLER Controller = &FdoExt->Controller;
703 PDEVICE_RELATIONS DeviceRelations;
704 PLIST_ENTRY ListEntry;
705 ULONG i, Size, ChannelBitmap = 0;
706
707 PAGED_CODE();
708
709 /*
710 * Preallocate the device relations structure we need for the QBR IRP,
711 * because we don't want to be in a state where allocation fails.
712 */
715 if (!DeviceRelations)
717
718 ExAcquireFastMutex(&FdoExt->PdoListSyncMutex);
719
720 /* Check existing ports */
721 for (ListEntry = FdoExt->PdoListHead.Flink;
722 ListEntry != &FdoExt->PdoListHead;
723 ListEntry = ListEntry->Flink)
724 {
726 IDE_CHANNEL_STATE ChannelState;
728
729 PdoExt = CONTAINING_RECORD(ListEntry, PDO_DEVICE_EXTENSION, ListEntry);
730 Channel = PdoExt->Channel;
731
732 ChannelBitmap |= 1 << Channel;
733
735 if (ChannelState == ChannelDisabled)
736 {
737 INFO("%04X:%04X.%02X: Skip disabled channel %lu\n",
738 Controller->Pci.VendorID,
739 Controller->Pci.DeviceID,
740 Controller->Pci.RevisionID,
741 Channel);
742
744 continue;
745 }
746 }
747
748 /* Enumerate the remaining ports */
749 ChannelBitmap = Controller->ChannelBitmap & ~ChannelBitmap;
750 for (i = 0; i < MAX_CHANNELS; ++i)
751 {
753 IDE_CHANNEL_STATE ChannelState;
754
755 if (!(ChannelBitmap & (1 << i)))
756 continue;
757
758 ChannelState = PciIdeXGetChannelState(Controller, i);
759 if (ChannelState == ChannelDisabled)
760 {
761 INFO("%04X:%04X.%02X: Skip disabled channel %lu\n",
762 Controller->Pci.VendorID,
763 Controller->Pci.DeviceID,
764 Controller->Pci.RevisionID,
765 i);
766 continue;
767 }
768
769 /* Need to create a PDO */
771 if (!PdoExt)
772 {
773 /* We are out of memory, trying to continue process the QBR IRP anyway */
774 continue;
775 }
776
777 InsertTailList(&FdoExt->PdoListHead, &PdoExt->ListEntry);
778 }
779
780 /* Initialize the device relations structure */
781 DeviceRelations->Count = 0;
782 for (ListEntry = FdoExt->PdoListHead.Flink;
783 ListEntry != &FdoExt->PdoListHead;
784 ListEntry = ListEntry->Flink)
785 {
787
788 PdoExt = CONTAINING_RECORD(ListEntry, PDO_DEVICE_EXTENSION, ListEntry);
789 if (PdoExt->Flags & PDO_FLAG_NOT_PRESENT)
790 {
792 continue;
793 }
794
795 DeviceRelations->Objects[DeviceRelations->Count++] = PdoExt->Common.Self;
797 }
798
799 ExReleaseFastMutex(&FdoExt->PdoListSyncMutex);
800
801 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
802 return STATUS_SUCCESS;
803}
804
805static
806CODE_SEG("PAGE")
810 _In_ PIO_STACK_LOCATION IoStack)
811{
812 PAGED_CODE();
813
814 if (IsEqualGUIDAligned(IoStack->Parameters.QueryInterface.InterfaceType,
815 &GUID_TRANSLATOR_INTERFACE_STANDARD))
816 {
818 PTRANSLATOR_INTERFACE TranslatorInterface;
819 CM_RESOURCE_TYPE ResourceType;
821
822 /* In native mode the IDE controller does not use any legacy interrupt resources */
825
826 if (IoStack->Parameters.QueryInterface.Size < sizeof(*TranslatorInterface))
828
829 ResourceType = PtrToUlong(IoStack->Parameters.QueryInterface.InterfaceSpecificData);
830 if (ResourceType != CmResourceTypeInterrupt)
832
833 TranslatorInterface = (PTRANSLATOR_INTERFACE)IoStack->Parameters.QueryInterface.Interface;
834
836 0,
838 sizeof(*TranslatorInterface),
839 IoStack->Parameters.QueryInterface.Version,
840 TranslatorInterface,
841 &BusNumber);
842 }
843
845}
846
847static
848CODE_SEG("PAGE")
852 _In_ PIRP Irp,
853 _In_ PIO_STACK_LOCATION IoStack)
854{
856
857 PAGED_CODE();
858
859 switch (IoStack->Parameters.QueryId.IdType)
860 {
863 {
864 if (!NT_VERIFY(IoForwardIrpSynchronously(FdoExt->Common.LowerDeviceObject, Irp)))
865 {
867 break;
868 }
869 Status = Irp->IoStatus.Status;
870
871 /*
872 * We provide a generic identifier necessary to install the device
873 * in case our FDO is root-enumerated device.
874 */
876 {
877 static const WCHAR IdeGenericId[] = L"*PNP0600\0"; // multi-string
879
881 if (!Buffer)
882 {
884 break;
885 }
886 RtlCopyMemory(Buffer, IdeGenericId, sizeof(IdeGenericId));
887
888 INFO("Hardware/Compatible ID: '%S'\n", Buffer);
889
890 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
892 }
893 break;
894 }
895
896 default:
897 {
899 Status = IoCallDriver(FdoExt->Common.LowerDeviceObject, Irp);
900
901 IoReleaseRemoveLock(&FdoExt->Common.RemoveLock, Irp);
902 return Status;
903 }
904 }
905
906 Irp->IoStatus.Status = Status;
908
909 IoReleaseRemoveLock(&FdoExt->Common.RemoveLock, Irp);
910 return Status;
911}
912
913CODE_SEG("PAGE")
918{
919 PIO_STACK_LOCATION IoStack;
921
922 PAGED_CODE();
923
924 Status = IoAcquireRemoveLock(&FdoExtension->Common.RemoveLock, Irp);
925 if (!NT_SUCCESS(Status))
926 {
927 Irp->IoStatus.Status = Status;
929
930 return Status;
931 }
932
934 switch (IoStack->MinorFunction)
935 {
937 {
938 if (!NT_VERIFY(IoForwardIrpSynchronously(FdoExtension->Common.LowerDeviceObject, Irp)))
939 {
941 goto CompleteIrp;
942 }
943 Status = Irp->IoStatus.Status;
944 if (!NT_SUCCESS(Status))
945 goto CompleteIrp;
946
948 IoStack->Parameters.
949 StartDevice.AllocatedResourcesTranslated);
950 goto CompleteIrp;
951 }
952
954 {
956 break;
957 }
958
960 {
961 IoReleaseRemoveLockAndWait(&FdoExtension->Common.RemoveLock, Irp);
962
964
965 Irp->IoStatus.Status = STATUS_SUCCESS;
967 Status = IoCallDriver(FdoExtension->Common.LowerDeviceObject, Irp);
968
969 IoDetachDevice(FdoExtension->Common.LowerDeviceObject);
970 IoDeleteDevice(FdoExtension->Common.Self);
971 return Status;
972 }
973
975 {
977 break;
978 }
979
981 {
982 if (IoStack->Parameters.QueryDeviceRelations.Type != BusRelations)
983 break;
984
986 if (!NT_SUCCESS(Status))
987 goto CompleteIrp;
988
989 Irp->IoStatus.Status = Status;
990 break;
991 }
992
994 {
996 break;
997 }
998
1000 {
1003 break;
1004
1005 Irp->IoStatus.Status = Status;
1006 break;
1007 }
1008
1014 Irp->IoStatus.Status = STATUS_SUCCESS;
1015 break;
1016
1017 case IRP_MN_QUERY_ID:
1018 return PciIdeXFdoQueryId(FdoExtension, Irp, IoStack);
1019
1020 default:
1021 break;
1022 }
1023
1025 Status = IoCallDriver(FdoExtension->Common.LowerDeviceObject, Irp);
1026
1027 IoReleaseRemoveLock(&FdoExtension->Common.RemoveLock, Irp);
1028 return Status;
1029
1031 Irp->IoStatus.Status = Status;
1033
1034 IoReleaseRemoveLock(&FdoExtension->Common.RemoveLock, Irp);
1035 return Status;
1036}
#define ExAllocatePoolUninitialized
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
#define CODE_SEG(...)
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
NTSTATUS AtaAcpiSetTimingMode(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIDE_ACPI_TIMING_MODE_BLOCK TimingMode, _In_opt_ PIDENTIFY_DEVICE_DATA IdBlock1, _In_opt_ PIDENTIFY_DEVICE_DATA IdBlock2)
Definition: acpi.c:168
VOID AtaAcpiSetDeviceData(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIDENTIFY_DEVICE_DATA IdBlock)
Definition: acpi.c:317
PVOID AtaAcpiGetTaskFile(_In_ PDEVICE_OBJECT DeviceObject)
Definition: acpi.c:233
unsigned char BOOLEAN
Definition: actypes.h:127
FORCEINLINE ULONG AHCI_PORT_READ(_In_ PVOID PortIoBase, _In_ AHCI_PORT_REGISTER Register)
Definition: ahci.h:548
@ PxCmdStatus
Definition: ahci.h:104
@ PxTaskFileData
Definition: ahci.h:105
@ PxCommandIssue
Definition: ahci.h:111
@ PxSataStatus
Definition: ahci.h:107
@ PxSataControl
Definition: ahci.h:108
@ PxInterruptEnable
Definition: ahci.h:103
@ PxSataNotification
Definition: ahci.h:112
@ PxSataError
Definition: ahci.h:109
@ PxSignature
Definition: ahci.h:106
@ PxFisSwitchingControl
Definition: ahci.h:113
@ PxInterruptStatus
Definition: ahci.h:102
@ PxDeviceSleep
Definition: ahci.h:114
@ PxSataActive
Definition: ahci.h:110
NTSTATUS AhciGetControllerProperties(_Inout_ PATA_CONTROLLER Controller)
Definition: ahci_generic.c:625
BOOLEAN AtaAhciDowngradeInterfaceSpeed(_In_ PCHANNEL_DATA_AHCI ChanData)
Definition: ahci_hw.c:1542
#define ATA_MAX_DEVICE
Definition: ata_shared.h:15
#define ATA_MIN_BUFFER_ALIGNMENT
Definition: ata_shared.h:30
#define PIO_MODE(n)
Definition: ata_user.h:36
#define PIO_ALL
Definition: ata_user.h:19
LONG NTSTATUS
Definition: precomp.h:26
#define MAX_CHANNELS
Definition: channels.c:23
#define ERR(fmt,...)
Definition: precomp.h:57
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
Definition: bufpool.h:45
VOID NTAPI IoDeleteController(IN PCONTROLLER_OBJECT ControllerObject)
Definition: controller.c:117
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
_In_ ULONG _In_ MEMORY_CACHING_TYPE _Out_ PPHYSICAL_ADDRESS PhysicalAddress
Definition: dispmprt.h:714
#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
PDEVICE_LIST DeviceList
Definition: utils.c:27
#define L(x)
Definition: resources.c:13
#define INFO
Definition: debug.h:89
PULONG InitSafeBootMode
Definition: init.c:75
#define ULONG_PTR
Definition: config.h:101
#define PtrToUlong(u)
Definition: config.h:107
@ PdoExtension
Definition: precomp.h:61
@ FdoExtension
Definition: precomp.h:60
VOID CompleteIrp(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: pnp.c:12
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define PagedPool
Definition: env_spec_w32.h:308
union Alignment_ Alignment
Status
Definition: gdiplustypes.h:24
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
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 * u
Definition: glfuncs.h:240
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define DbgPrint
Definition: hal.h:12
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
_In_ UCXUSBDEVICE _In_ PDEVICE_OBJECT Pdo
Definition: hubucx.h:280
IDE_CHANNEL_STATE
Definition: ide.h:196
@ ChannelDisabled
Definition: ide.h:197
@ ChannelStateUnknown
Definition: ide.h:199
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:192
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
_In_ PIRP Irp
Definition: kse.h:79
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
void Bar(void)
Definition: terminate.cpp:70
@ InterruptObject
Definition: ketypes.h:447
static BOOL StartDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOL bEnable, IN DWORD HardwareProfile OPTIONAL, OUT BOOL *bNeedReboot OPTIONAL)
Definition: wizard.c:173
#define _In_reads_(s)
Definition: no_sal2.h:168
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_range_(l, h)
Definition: no_sal2.h:368
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
Definition: ntbasedef.h:684
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
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:1038
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1306
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1261
#define IoCompleteRequest
Definition: irp.c:1272
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1657
#define IoCallDriver
Definition: irp.c:1257
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:154
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:171
#define STATUS_NO_MATCH
Definition: ntstatus.h:873
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1173
IDE_CHANNEL_STATE PciIdeGetChannelState(_In_ PATA_CONTROLLER Controller, _In_ ULONG Channel)
Definition: pata_generic.c:912
NTSTATUS PataGetControllerProperties(_Inout_ PATA_CONTROLLER Controller, _In_ PCM_RESOURCE_LIST ResourcesTranslated)
Definition: pata_legacy.c:16
NTSTATUS NTAPI PciIdeGetControllerProperties(IN PVOID DeviceExtension, OUT PIDE_CONTROLLER_PROPERTIES ControllerProperties)
Definition: pciide.c:46
NTSTATUS PciIdeXPnpQueryDeviceUsageNotification(_In_ PCOMMON_DEVICE_EXTENSION CommonExt, _In_ PIRP Irp)
Definition: pciidex.c:214
NTSTATUS PciIdeXPnpQueryPnpDeviceState(_In_ PCOMMON_DEVICE_EXTENSION CommonExt, _In_ PIRP Irp)
Definition: pciidex.c:266
#define CTRL_FLAG_NATIVE_PCI
Definition: pciidex.h:224
#define PDO_FLAG_REPORTED_MISSING
Definition: pciidex.h:411
struct _CHANNEL_DATA_AHCI * PCHANNEL_DATA_AHCI
CONTROLLER_PNP_START_DEVICE PciIdeXFdoStartDevice
Definition: pciidex.h:469
#define RANGE_IS_MAPPED
Definition: pciidex.h:192
#define CHANNEL_FLAG_NO_ATAPI_DMA
Definition: pciidex.h:279
CONTROLLER_ATTACH_CHANNEL AtaCtrlAttachChannel
Definition: pciidex.h:456
_In_ ULONG Channel
Definition: pciidex.h:74
CHANNEL_SET_MODE AtaCtrlSetTransferMode
Definition: pciidex.h:464
#define CTRL_FLAG_NON_PNP
Definition: pciidex.h:229
CHANNEL_SET_DEVICE_DATA AtaCtrlSetDeviceData
Definition: pciidex.h:459
NTSTATUS PciIdeXPdoRemoveDevice(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _In_ PIRP Irp, _In_ BOOLEAN FinalRemove)
Definition: pdo.c:193
_In_ ULONG BusNumber
Definition: pciidex.h:65
CONTROLLER_ATTACH_CHANNEL_EX PciIdeAttachChannel
Definition: pciidex.h:644
#define PDO_FLAG_NOT_PRESENT
Definition: pciidex.h:410
#define CTRL_FLAG_SATA_HBA_ACPI
Definition: pciidex.h:226
CHANNEL_DOWNGRADE_INTERFACE_SPEED AtaCtrlDowngradeInterfaceSpeed
Definition: pciidex.h:465
#define CHANNEL_FLAG_PIO_VIA_DMA
Definition: pciidex.h:270
#define CTRL_FLAG_IS_AHCI
Definition: pciidex.h:228
#define RANGE_IS_MEMORY
Definition: pciidex.h:191
CHANNEL_ABORT_CHANNEL AtaCtrlAbortChannel
Definition: pciidex.h:466
CONTROLLER_PNP_REMOVE_DEVICE PciIdeXFdoRemoveDevice
Definition: pciidex.h:472
CHANNEL_SET_MODE_EX PciIdeGenericSetTransferMode
Definition: pciidex.h:641
#define CHANNEL_FLAG_HAS_ACPI_GTM
Definition: pciidex.h:276
#define TAG_PCIIDEX
Definition: pciidex.h:32
CHANNEL_GET_INIT_TASK_FILE AtaCtrlGetInitTaskFile
Definition: pciidex.h:462
#define RANGE_IS_VALID
Definition: pciidex.h:190
short WCHAR
Definition: pedump.c:58
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:49
#define CmResourceTypeMemory
Definition: restypes.h:106
@ InterfaceTypeUndefined
Definition: restypes.h:121
@ PCIBus
Definition: restypes.h:127
#define CmResourceTypePort
Definition: restypes.h:104
#define CmResourceTypeInterrupt
Definition: restypes.h:105
unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask)
Definition: intrin_arm.h:180
#define DECLSPEC_NOINLINE_FROM_PAGED
#define STATUS_SUCCESS
Definition: shellext.h:65
NTSTATUS PciIdeXFdoDispatchPnp(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _Inout_ PIRP Irp)
Definition: fdo.c:915
static NTSTATUS AtaCtrlPciCollectInformation(_In_ PFDO_DEVICE_EXTENSION FdoExt, _In_ PCM_RESOURCE_LIST ResourcesTranslated)
Definition: fdo.c:437
static PPDO_DEVICE_EXTENSION PciIdeXPdoCreateDevice(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ ULONG ChannelNumber)
Definition: fdo.c:621
static NTSTATUS PciIdeXFdoQueryBusRelations(_In_ PFDO_DEVICE_EXTENSION FdoExt, _In_ PIRP Irp)
Definition: fdo.c:698
static NTSTATUS PciIdeXFdoQueryInterface(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIO_STACK_LOCATION IoStack)
Definition: fdo.c:808
VOID DumpTestMiniport(_Inout_ PFDO_DEVICE_EXTENSION FdoExt)
DECLSPEC_NOINLINE_FROM_PAGED VOID AtaChanEnableInterruptsSync(_In_ PVOID ChannelContext, _In_ BOOLEAN Enable)
Definition: fdo.c:62
static VOID AtaCtrlPciAssignResources(_In_ PATA_CONTROLLER Controller, _In_ PCM_RESOURCE_LIST ResourcesTranslated, _In_ PPCI_COMMON_HEADER PciData)
Definition: fdo.c:327
static NTSTATUS PciIdeXFdoQueryId(_In_ PFDO_DEVICE_EXTENSION FdoExt, _In_ PIRP Irp, _In_ PIO_STACK_LOCATION IoStack)
Definition: fdo.c:850
static DECLSPEC_NOINLINE_FROM_PAGED VOID AtaCtrlCallStopController(_In_ PATA_CONTROLLER Controller)
Definition: fdo.c:31
static NTSTATUS PciIdeXFdoStopDevice(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Definition: fdo.c:579
static VOID PciIdeXFdoFreeResources(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Definition: fdo.c:528
static VOID AtaCtrlPciSaveData(_Out_ PATA_CONTROLLER Controller, _In_ PPCI_COMMON_HEADER PciData)
Definition: fdo.c:416
static DECLSPEC_NOINLINE_FROM_PAGED VOID AtaCtrlCallStartController(_In_ PATA_CONTROLLER Controller)
Definition: fdo.c:18
static BOOLEAN AtaCtrlPciGetNextBarIndex(_In_ PPCI_COMMON_HEADER PciData, _Inout_ PULONG Bar)
Definition: fdo.c:299
PVOID AtaCtrlPciMapBar(_In_ PATA_CONTROLLER Controller, _In_range_(0, PCI_TYPE0_ADDRESSES) ULONG Index, _In_ ULONG MinimumIoLength)
Definition: fdo.c:254
IDE_CHANNEL_STATE PciIdeXGetChannelState(_In_ PATA_CONTROLLER Controller, _In_ ULONG Channel)
Definition: fdo.c:683
PCHANNEL_SET_MODE_EX SetTransferMode
Definition: pciidex.h:244
struct _CHANNEL_DATA_COMMON::@1295 Current
PKINTERRUPT InterruptObject
Definition: pciidex.h:241
ULONG ActiveSlotsBitmap
Definition: pciidex.h:288
ULONG ActiveQueuedSlotsBitmap
Definition: pciidex.h:289
PATA_CONTROLLER Controller
Definition: pciidex.h:249
PCHANNEL_ENABLE_INTERRUPTS EnableInterrupts
Definition: pciidex.h:248
IDE_ACPI_TIMING_MODE_BLOCK CurrentTimingMode
Definition: pciidex.h:316
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@496 Port
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@499 Memory
PDEVICE_OBJECT Self
Definition: pciidex.h:377
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2165
LIST_ENTRY PdoListHead
Definition: precomp.h:256
FAST_MUTEX PdoListSyncMutex
Definition: pciidex.h:393
ATA_CONTROLLER Controller
Definition: pciidex.h:396
struct _IO_STACK_LOCATION::@5020::@5045 QueryDeviceRelations
union _IO_STACK_LOCATION::@1814 Parameters
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
COMMON_DEVICE_EXTENSION Common
Definition: usbhub.h:204
#define max(a, b)
Definition: svc.c:63
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
void * PVOID
Definition: typedefs.h:50
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ UCXCONTROLLER * Controller
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
Definition: usbhub.c:133
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_In_ WDFCMRESLIST _In_ WDFCMRESLIST ResourcesTranslated
Definition: wdfdevice.h:891
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
#define HalGetInterruptTranslator
Definition: haltypes.h:313
#define IoAcquireRemoveLock(RemoveLock, Tag)
#define IoReleaseRemoveLockAndWait(_RemoveLock, _Tag)
Definition: iofuncs.h:2781
#define IoReleaseRemoveLock(_RemoveLock, _Tag)
Definition: iofuncs.h:2771
#define IoInitializeRemoveLock(Lock, AllocateTag, MaxLockedMinutes, HighWatermark)
Definition: iofuncs.h:2840
#define PCI_TYPE_64BIT
Definition: iotypes.h:4255
#define IRP_MN_CANCEL_STOP_DEVICE
@ BusRelations
Definition: iotypes.h:2154
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define PCI_WHICHSPACE_CONFIG
Definition: iotypes.h:3659
#define PCI_ADDRESS_IO_ADDRESS_MASK
Definition: iotypes.h:4249
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_QUERY_INTERFACE
#define PCI_TYPE0_ADDRESSES
Definition: iotypes.h:3515
#define IRP_MN_START_DEVICE
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define IRP_MN_QUERY_ID
#define PCI_ADDRESS_IO_SPACE
Definition: iotypes.h:4246
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define PCI_ADDRESS_MEMORY_ADDRESS_MASK
Definition: iotypes.h:4250
#define IRP_MN_QUERY_STOP_DEVICE
struct _PCI_COMMON_HEADER * PPCI_COMMON_HEADER
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define PCI_ADDRESS_MEMORY_PREFETCHABLE
Definition: iotypes.h:4248
#define IRP_MN_STOP_DEVICE
#define PCI_ADDRESS_MEMORY_TYPE_MASK
Definition: iotypes.h:4247
@ BusQueryCompatibleIDs
Definition: iotypes.h:2953
@ BusQueryHardwareIDs
Definition: iotypes.h:2952
struct _TRANSLATOR_INTERFACE * PTRANSLATOR_INTERFACE
#define IRP_MN_QUERY_REMOVE_DEVICE
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ MmNonCached
Definition: mmtypes.h:129
#define ObReferenceObject
Definition: obfuncs.h:204
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3311