mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 21:22:24 +00:00
[HDAUDBUS] Implement FDO removal. CORE-14617
This commit is contained in:
parent
b05e5b0340
commit
c8c0fc8d64
3 changed files with 69 additions and 1 deletions
|
@ -563,6 +563,7 @@ HDA_FDOStartDevice(
|
||||||
|
|
||||||
if (Descriptor->Type == CmResourceTypeMemory)
|
if (Descriptor->Type == CmResourceTypeMemory)
|
||||||
{
|
{
|
||||||
|
DeviceExtension->RegLength = Descriptor->u.Memory.Length;
|
||||||
DeviceExtension->RegBase = (PUCHAR)MmMapIoSpace(Descriptor->u.Memory.Start, Descriptor->u.Memory.Length, MmNonCached);
|
DeviceExtension->RegBase = (PUCHAR)MmMapIoSpace(Descriptor->u.Memory.Start, Descriptor->u.Memory.Length, MmNonCached);
|
||||||
if (DeviceExtension->RegBase == NULL)
|
if (DeviceExtension->RegBase == NULL)
|
||||||
{
|
{
|
||||||
|
@ -635,6 +636,60 @@ HDA_FDOStartDevice(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
HDA_FDORemoveDevice(
|
||||||
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
|
_Inout_ PIRP Irp)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PHDA_FDO_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
ULONG CodecIndex, AFGIndex;
|
||||||
|
PHDA_CODEC_ENTRY CodecEntry;
|
||||||
|
|
||||||
|
/* get device extension */
|
||||||
|
DeviceExtension = static_cast<PHDA_FDO_DEVICE_EXTENSION>(DeviceObject->DeviceExtension);
|
||||||
|
ASSERT(DeviceExtension->IsFDO == TRUE);
|
||||||
|
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
|
Status = IoCallDriver(DeviceExtension->LowerDevice, Irp);
|
||||||
|
|
||||||
|
IoDetachDevice(DeviceExtension->LowerDevice);
|
||||||
|
|
||||||
|
if (DeviceExtension->RegBase != NULL)
|
||||||
|
{
|
||||||
|
MmUnmapIoSpace(DeviceExtension->RegBase,
|
||||||
|
DeviceExtension->RegLength);
|
||||||
|
}
|
||||||
|
if (DeviceExtension->Interrupt != NULL)
|
||||||
|
{
|
||||||
|
IoDisconnectInterrupt(DeviceExtension->Interrupt);
|
||||||
|
}
|
||||||
|
if (DeviceExtension->CorbBase != NULL)
|
||||||
|
{
|
||||||
|
MmFreeContiguousMemory(DeviceExtension->CorbBase);
|
||||||
|
}
|
||||||
|
for (CodecIndex = 0; CodecIndex < HDA_MAX_CODECS; CodecIndex++)
|
||||||
|
{
|
||||||
|
CodecEntry = DeviceExtension->Codecs[CodecIndex];
|
||||||
|
if (CodecEntry == NULL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (AFGIndex = 0; AFGIndex < CodecEntry->AudioGroupCount; AFGIndex++)
|
||||||
|
{
|
||||||
|
FreeItem(CodecEntry->AudioGroups[AFGIndex]);
|
||||||
|
}
|
||||||
|
FreeItem(CodecEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
IoDeleteDevice(DeviceObject);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
HDA_FDOQueryBusRelations(
|
HDA_FDOQueryBusRelations(
|
||||||
|
|
|
@ -50,6 +50,12 @@ HDA_FdoPnp(
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
|
case IRP_MN_REMOVE_DEVICE:
|
||||||
|
return HDA_FDORemoveDevice(DeviceObject, Irp);
|
||||||
|
case IRP_MN_QUERY_REMOVE_DEVICE:
|
||||||
|
case IRP_MN_CANCEL_REMOVE_DEVICE:
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
break;
|
||||||
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||||
/* handle bus device relations */
|
/* handle bus device relations */
|
||||||
if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations)
|
if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations)
|
||||||
|
|
|
@ -64,8 +64,9 @@ typedef struct
|
||||||
{
|
{
|
||||||
BOOLEAN IsFDO;
|
BOOLEAN IsFDO;
|
||||||
PDEVICE_OBJECT LowerDevice;
|
PDEVICE_OBJECT LowerDevice;
|
||||||
|
|
||||||
PUCHAR RegBase;
|
PUCHAR RegBase;
|
||||||
|
SIZE_T RegLength;
|
||||||
PKINTERRUPT Interrupt;
|
PKINTERRUPT Interrupt;
|
||||||
|
|
||||||
ULONG CorbLength;
|
ULONG CorbLength;
|
||||||
|
@ -126,6 +127,12 @@ HDA_FDOStartDevice(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp);
|
IN PIRP Irp);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
HDA_FDORemoveDevice(
|
||||||
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
|
_Inout_ PIRP Irp);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
HDA_FDOQueryBusRelations(
|
HDA_FDOQueryBusRelations(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue