- Delete rbuild and the rbuild files.
[reactos.git] / drivers / bus / isapnp / pdo.c
1 /*
2 * PROJECT: ReactOS ISA PnP Bus driver
3 * FILE: pdo.c
4 * PURPOSE: PDO-specific code
5 * PROGRAMMERS: Cameron Gutman (cameron.gutman@reactos.org)
6 */
7 #include <isapnp.h>
8
9 #define NDEBUG
10 #include <debug.h>
11
12 NTSTATUS
13 NTAPI
14 IsaPdoQueryDeviceRelations(
15 IN PISAPNP_LOGICAL_DEVICE LogDev,
16 IN PIRP Irp,
17 IN PIO_STACK_LOCATION IrpSp)
18 {
19 PDEVICE_RELATIONS DeviceRelations;
20
21 if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation)
22 return Irp->IoStatus.Status;
23
24 DeviceRelations = ExAllocatePool(PagedPool, sizeof(*DeviceRelations));
25 if (!DeviceRelations)
26 return STATUS_INSUFFICIENT_RESOURCES;
27
28 DeviceRelations->Count = 1;
29 DeviceRelations->Objects[0] = LogDev->Common.Self;
30 ObReferenceObject(LogDev->Common.Self);
31
32 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
33
34 return STATUS_SUCCESS;
35 }
36
37 NTSTATUS
38 NTAPI
39 IsaPdoPnp(
40 IN PISAPNP_LOGICAL_DEVICE LogDev,
41 IN PIRP Irp,
42 IN PIO_STACK_LOCATION IrpSp)
43 {
44 NTSTATUS Status = Irp->IoStatus.Status;
45
46 switch (IrpSp->MinorFunction)
47 {
48 case IRP_MN_START_DEVICE:
49 Status = IsaHwActivateDevice(LogDev);
50
51 if (NT_SUCCESS(Status))
52 LogDev->Common.State = dsStarted;
53 break;
54
55 case IRP_MN_STOP_DEVICE:
56 Status = IsaHwDeactivateDevice(LogDev);
57
58 if (NT_SUCCESS(Status))
59 LogDev->Common.State = dsStopped;
60 break;
61
62 case IRP_MN_QUERY_DEVICE_RELATIONS:
63 Status = IsaPdoQueryDeviceRelations(LogDev, Irp, IrpSp);
64 break;
65
66 case IRP_MN_QUERY_RESOURCES:
67 DPRINT1("IRP_MN_QUERY_RESOURCES is UNIMPLEMENTED!\n");
68 break;
69
70 case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
71 DPRINT1("IRP_MN_QUERY_RESOURCE_REQUIREMENTS is UNIMPLEMENTED!\n");
72 break;
73
74 default:
75 DPRINT1("Unknown PnP code: %x\n", IrpSp->MinorFunction);
76 break;
77 }
78
79 Irp->IoStatus.Status = Status;
80 IoCompleteRequest(Irp, IO_NO_INCREMENT);
81
82 return Status;
83 }