xref: /reactos/modules/rosapps/drivers/green/power.c (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * PROJECT:     ReactOS VT100 emulator
3*c2c66affSColin Finck  * LICENSE:     GPL - See COPYING in the top level directory
4*c2c66affSColin Finck  * FILE:        drivers/base/green/power.c
5*c2c66affSColin Finck  * PURPOSE:     IRP_MJ_POWER operations
6*c2c66affSColin Finck  * PROGRAMMERS: Copyright 2006 Herv� Poussineau (hpoussin@reactos.org)
7*c2c66affSColin Finck  */
8*c2c66affSColin Finck 
9*c2c66affSColin Finck #include "green.h"
10*c2c66affSColin Finck 
11*c2c66affSColin Finck #define NDEBUG
12*c2c66affSColin Finck #include <debug.h>
13*c2c66affSColin Finck 
14*c2c66affSColin Finck NTSTATUS
GreenPower(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp)15*c2c66affSColin Finck GreenPower(
16*c2c66affSColin Finck 	IN PDEVICE_OBJECT DeviceObject,
17*c2c66affSColin Finck 	IN PIRP Irp)
18*c2c66affSColin Finck {
19*c2c66affSColin Finck 	GREEN_DEVICE_TYPE Type;
20*c2c66affSColin Finck 	PIO_STACK_LOCATION Stack;
21*c2c66affSColin Finck 	ULONG_PTR Information = Irp->IoStatus.Information;
22*c2c66affSColin Finck 	NTSTATUS Status = Irp->IoStatus.Status;
23*c2c66affSColin Finck 
24*c2c66affSColin Finck 	Type = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type;
25*c2c66affSColin Finck 	Stack = IoGetCurrentIrpStackLocation(Irp);
26*c2c66affSColin Finck 
27*c2c66affSColin Finck 	switch (Stack->MinorFunction)
28*c2c66affSColin Finck 	{
29*c2c66affSColin Finck 		case IRP_MN_SET_POWER: /* 0x02 */
30*c2c66affSColin Finck 		{
31*c2c66affSColin Finck 			DPRINT("IRP_MJ_POWER / IRP_MN_SET_POWER\n");
32*c2c66affSColin Finck 			if (Type == GreenFDO)
33*c2c66affSColin Finck 			{
34*c2c66affSColin Finck 				PoStartNextPowerIrp(Irp);
35*c2c66affSColin Finck 				Status = STATUS_SUCCESS;
36*c2c66affSColin Finck 			}
37*c2c66affSColin Finck 			else
38*c2c66affSColin Finck 			{
39*c2c66affSColin Finck 				DPRINT1("IRP_MJ_POWER / IRP_MN_SET_POWER / Unknown type 0x%lx\n",
40*c2c66affSColin Finck 					Type);
41*c2c66affSColin Finck 				ASSERT(FALSE);
42*c2c66affSColin Finck 			}
43*c2c66affSColin Finck 			break;
44*c2c66affSColin Finck 		}
45*c2c66affSColin Finck 		default:
46*c2c66affSColin Finck 		{
47*c2c66affSColin Finck 			DPRINT1("IRP_MJ_POWER / unknown minor function 0x%lx\n", Stack->MinorFunction);
48*c2c66affSColin Finck 			break;
49*c2c66affSColin Finck 		}
50*c2c66affSColin Finck 	}
51*c2c66affSColin Finck 
52*c2c66affSColin Finck 	Irp->IoStatus.Status = Status;
53*c2c66affSColin Finck 	Irp->IoStatus.Information = Information;
54*c2c66affSColin Finck 	if (Status != STATUS_PENDING)
55*c2c66affSColin Finck 		IoCompleteRequest(Irp, IO_NO_INCREMENT);
56*c2c66affSColin Finck 
57*c2c66affSColin Finck 	return Status;
58*c2c66affSColin Finck }
59