Skip to content

Commit 13b394c

Browse files
committed
[COMPBATT] Document COMPBATT_BATTERY_DATA and COMPBATT_DEVICE_EXTENSION structures
CORE-18969 CORE-19452 CORE-19888
1 parent f58f37e commit 13b394c

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

drivers/bus/acpi/compbatt/compbatt.h

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,73 @@
7878
//
7979
typedef struct _COMPBATT_BATTERY_DATA
8080
{
81+
/* The linked battery with the Composite Battery */
8182
LIST_ENTRY BatteryLink;
83+
84+
/* I/O remove lock which protects the battery from being removed */
8285
IO_REMOVE_LOCK RemoveLock;
86+
87+
/*
88+
* The associated device object (usually CMBATT) and the I/O battery packet
89+
* which is used to transport and gather battery data.
90+
*/
8391
PDEVICE_OBJECT DeviceObject;
8492
PIRP Irp;
93+
94+
/*
95+
* The Executive work item, which serves as a worker item for the
96+
* IRP battery monitor worker.
97+
*/
8598
WORK_QUEUE_ITEM WorkItem;
99+
100+
/*
101+
* Execution state mode of the individual battery. Only two modes are valid:
102+
*
103+
* COMPBATT_QUERY_TAG - The battery is currently waiting for a tag to get assigned;
104+
* COMPBATT_READ_STATUS - The battery is querying battery status.
105+
*/
86106
UCHAR Mode;
107+
108+
/*
109+
* The battery wait configuration settings, set up by the SetStatusNotify method.
110+
* These values are used to instruct CMBATT when the battery status should be retrieved.
111+
*/
87112
BATTERY_WAIT_STATUS WaitStatus;
113+
114+
/*
115+
* A union that serves as the buffer which holds battery monitor IRP data, specifically
116+
* managed by CompBattMonitorIrpCompleteWorker, to avoid allocating separate memory pools.
117+
*/
88118
union
89119
{
90120
BATTERY_WAIT_STATUS WorkerWaitStatus;
91121
BATTERY_STATUS WorkerStatus;
92122
ULONG WorkerTag;
93123
} WorkerBuffer;
124+
125+
/* The ID of the battery that associates the identification of this battery */
94126
ULONG Tag;
127+
128+
/*
129+
* The battery flags that govern the behavior of the battery. The valid flags are:
130+
*
131+
* COMPBATT_BATTERY_INFORMATION_PRESENT - The static battery information ha been
132+
* queried. Re-querying such information is not needed.
133+
*
134+
* COMPBATT_STATUS_NOTIFY_SET - The current notification wait settings are valid.
135+
*
136+
* COMPBATT_TAG_ASSIGNED - The battery has a tag assigned and it can be read.
137+
*/
95138
ULONG Flags;
139+
140+
/* The static battery information and battery status */
96141
BATTERY_INFORMATION BatteryInformation;
97142
BATTERY_STATUS BatteryStatus;
143+
144+
/* The interrupt time of which the battery status was last read */
98145
ULONGLONG InterruptTime;
146+
147+
/* A uniquely given name of the battery that associates it */
99148
UNICODE_STRING BatteryName;
100149
} COMPBATT_BATTERY_DATA, *PCOMPBATT_BATTERY_DATA;
101150

@@ -104,18 +153,61 @@ typedef struct _COMPBATT_BATTERY_DATA
104153
//
105154
typedef struct _COMPBATT_DEVICE_EXTENSION
106155
{
156+
/*
157+
* The class data initialized and used by Battery Class. It contains information
158+
* such as miniport data used for registration and communication between the
159+
* Composite Battery and Battery Class, wait and context events, etc.
160+
*/
107161
PVOID ClassData;
162+
163+
/*
164+
* The successor computed tag. This field is used when there are more upcoming
165+
* batteries to be connected with the Composite Battery, of which the tag is
166+
* incremented by 1 by each new battery that is connected.
167+
*/
108168
ULONG NextTag;
169+
170+
/* A list of linked batteries connected with the Composite Battery */
109171
LIST_ENTRY BatteryList;
172+
173+
/* A mutex lock which ensures proper synchronization of Composite Battery operations */
110174
FAST_MUTEX Lock;
175+
176+
/* The ID of the Composite Battery */
111177
ULONG Tag;
178+
179+
/*
180+
* The battery flags that govern the behavior of the battery. The valid flags are:
181+
*
182+
* COMPBATT_BATTERY_INFORMATION_PRESENT - The static battery information has been
183+
* queried. Re-querying such information is not needed.
184+
*
185+
* COMPBATT_STATUS_NOTIFY_SET - The current notification wait settings are valid.
186+
*
187+
* COMPBATT_TAG_ASSIGNED - The battery has a tag assigned and it can be read.
188+
*/
112189
ULONG Flags;
190+
191+
/*
192+
* The Composite Battery static information, status and wait status settings.
193+
* Note that both the battery information and status are combined, based upon
194+
* the individual information and status of each linked battery.
195+
*/
113196
BATTERY_INFORMATION BatteryInformation;
114197
BATTERY_STATUS BatteryStatus;
115198
BATTERY_WAIT_STATUS WaitNotifyStatus;
199+
200+
/* The interrupt time of which the battery status was last read */
116201
ULONGLONG InterruptTime;
202+
203+
/*
204+
* The physical device object that associates the Composite Battery and
205+
* the attached device, typically the ACPI driver.
206+
*/
117207
PDEVICE_OBJECT AttachedDevice;
118208
PDEVICE_OBJECT DeviceObject;
209+
210+
/* The notification entry that identifies the registered I/O PnP notification */
119211
PVOID NotificationEntry;
120212
} COMPBATT_DEVICE_EXTENSION, *PCOMPBATT_DEVICE_EXTENSION;
121213

0 commit comments

Comments
 (0)