520{
523 PVOID ControllerContext;
527
528 DPRINT(
"IDE Channel IO %lx, Irq %lu\n", LegacyChannel->IoBase, LegacyChannel->Irq);
529
531 {
532 DPRINT(
"Failed to build the resource list\n");
534 }
535
537 {
538 DPRINT(
"Failed to claim resources\n");
540 }
541
543 IsAddressMmio[0] =
FALSE;
544 IsAddressMmio[1] =
FALSE;
545
547 {
548
551
552 Spare = 2;
553 }
554 else
555 {
557 8,
558 &IsAddressMmio[0]);
560 {
561 DPRINT(
"Failed to map command port\n");
562
564 goto ReleaseResources;
565 }
566
568 1,
569 &IsAddressMmio[1]);
571 {
572 DPRINT(
"Failed to map control port\n");
573
575 goto ReleaseResources;
576 }
577
578 Spare = 1;
579 }
587
589 {
590 DPRINT(
"No IDE devices found\n");
592 }
593
594ReleaseResources:
596
599
607 0,
610 {
611 DPRINT(
"IoReportDetectedDevice() failed with status 0x%lx\n",
Status);
613 }
614
616 {
617
620 (
PVOID)ControllerInferface,
623 {
624 DPRINT1(
"Failed to register the legacy channel 0x%lx, status 0x%lx\n",
625 LegacyChannel->IoBase,
Status);
627 }
628
630 {
631 DPRINT1(
"Unknown interface version 0x%lx\n", ControllerInferface->Version);
634 }
635 }
636
639 {
640 DPRINT1(
"Failed to add the legacy channel 0x%lx, status 0x%lx\n",
641 LegacyChannel->IoBase,
Status);
643 }
644
646
649 {
650 DPRINT1(
"Failed to start the legacy channel 0x%lx, status 0x%lx\n",
651 LegacyChannel->IoBase,
Status);
652
653 ControllerInferface->RemoveDevice(ControllerContext);
654 }
655
657 if (IsAddressMmio[0] && Registers.
Data)
658 {
660 }
661
662 if (IsAddressMmio[1] && Registers.
Control)
663 {
665 }
666
668}
#define PCIIDEX_INTERFACE_VERSION
#define PCIIDEX_GET_CONTROLLER_INTERFACE_SIGNATURE
PDEVICE_OBJECT PhysicalDeviceObject
static const WCHAR Cleanup[]
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
static BOOLEAN AtaLegacyChannelBuildResources(_In_ PATA_LEGACY_CHANNEL LegacyChannel, _Inout_ PCM_RESOURCE_LIST ResourceList)
static BOOLEAN AtaLegacyChannelPresent(_In_ PIDE_REGISTERS Registers)
static PVOID AtaLegacyTranslateBusAddress(_In_ ULONG Address, _In_ ULONG NumberOfBytes, _Out_ PBOOLEAN IsAddressMmio)
static BOOLEAN AtaLegacyClaimHardwareResources(_In_ PDRIVER_OBJECT DriverObject, _In_ PCM_RESOURCE_LIST ResourceList, _In_ ULONG ResourceListSize)
static VOID AtaLegacyChannelTranslateResources(_Inout_ PCM_RESOURCE_LIST ResourceList, _In_ PUCHAR CommandPortBase, _In_ PUCHAR ControlPortBase)
static VOID AtaLegacyReleaseHardwareResources(_In_ PDRIVER_OBJECT DriverObject)
#define STATUS_REVISION_MISMATCH
NTSTATUS NTAPI PciIdeXInitialize(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath, _In_ PCONTROLLER_PROPERTIES HwGetControllerProperties, _In_ ULONG ExtensionSize)
NTSTATUS NTAPI IoReportDetectedDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ INTERFACE_TYPE LegacyBusType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_opt_ PCM_RESOURCE_LIST ResourceList, _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, _In_ BOOLEAN ResourceAssigned, _Inout_ PDEVICE_OBJECT *DeviceObject)
IDE_REG LbaLow
LBA bits 0-7, 24-31.
IDE_REG LbaMid
LBA bits 8-15, 32-39.
IDE_REG LbaHigh
LBA bits 16-23, 40-47.
#define STATUS_UNSUCCESSFUL