Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

897 lines
20 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. smbbattp.h
  5. Abstract:
  6. Smart Battery Class Driver Header File
  7. Author:
  8. Ken Reneris
  9. Environment:
  10. Notes:
  11. Revision History:
  12. --*/
  13. #ifndef FAR
  14. #define FAR
  15. #endif
  16. #include <ntddk.h>
  17. #include <wmilib.h>
  18. #include <batclass.h>
  19. #include <acpiioct.h>
  20. #include <smbus.h>
  21. //
  22. // Debugging
  23. //
  24. #define DEBUG DBG
  25. #if DEBUG
  26. extern ULONG SMBBattDebug;
  27. #define BattPrint(l,m) if(l & SMBBattDebug) DbgPrint m
  28. #else
  29. #define BattPrint(l,m)
  30. #endif
  31. #define BAT_TRACE 0x00000400
  32. #define BAT_STATE 0x00000200
  33. #define BAT_IRPS 0x00000100
  34. #define BAT_IO 0x00000040
  35. #define BAT_DATA 0x00000020
  36. #define BAT_ALARM 0x00000010
  37. #define BAT_NOTE 0x00000008
  38. #define BAT_WARN 0x00000004
  39. #define BAT_ERROR 0x00000002
  40. #define BAT_BIOS_ERROR 0x00000001
  41. //
  42. // Driver supports the following class driver version
  43. //
  44. #define SMB_BATTERY_MAJOR_VERSION 0x0001
  45. #define SMB_BATTERY_MINOR_VERSION 0x0000
  46. //
  47. // Smart battery device driver tag for memory allocations: "BatS"
  48. //
  49. #define SMB_BATTERY_TAG 'StaB'
  50. //
  51. // Globals
  52. //
  53. extern UNICODE_STRING GlobalRegistryPath;
  54. //
  55. // Remove Lock parameters for checked builds
  56. //
  57. #define REMOVE_LOCK_MAX_LOCKED_MINUTES 1
  58. #define REMOVE_LOCK_HIGH_WATER_MARK 64
  59. //
  60. // Driver Device Names (FDO)
  61. //
  62. #define BatterySubsystemName L"\\Device\\SmartBatterySubsystem"
  63. #define SmbBattDeviceName L"\\Device\\SmartBattery"
  64. //
  65. // Query ID Names
  66. //
  67. #define SubSystemIdentifier L"SMBUS\\SMBBATT"
  68. #define BatteryInstance L"Battery"
  69. #define HidSmartBattery L"SMBBATT\\SMART_BATTERY"
  70. //
  71. // Structure for input from private Ioctls to read from devices on smbus
  72. //
  73. typedef struct {
  74. UCHAR Address;
  75. UCHAR Command;
  76. union {
  77. USHORT Block [2];
  78. ULONG Ulong;
  79. } Data;
  80. } SMBBATT_DATA_STRUCT, *PSMBBATT_DATA_STRUCT;
  81. typedef union {
  82. USHORT Block [2];
  83. ULONG Ulong;
  84. } _SMBBATT_DATA_STRUCT_UNION;
  85. #define SMBBATT_DATA_STRUCT_SIZE sizeof (SMBBATT_DATA_STRUCT) - sizeof (_SMBBATT_DATA_STRUCT_UNION)
  86. //
  87. // Private Ioctls for test engines
  88. //
  89. #define IOCTL_SMBBATT_DATA \
  90. CTL_CODE(FILE_DEVICE_BATTERY, 0x100, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  91. //
  92. // Definitions for the selector state lookup table
  93. //
  94. typedef struct {
  95. UCHAR BatteryIndex;
  96. BOOLEAN ReverseLogic;
  97. } SELECTOR_STATE_LOOKUP;
  98. extern const SELECTOR_STATE_LOOKUP SelectorBits [];
  99. extern const SELECTOR_STATE_LOOKUP SelectorBits4 [];
  100. //
  101. // Definitions for control method names neede by the smart battery
  102. //
  103. #define SMBATT_SBS_METHOD (ULONG) ('SBS_') // control method "_SBS"
  104. #define SMBATT_GLK_METHOD (ULONG) ('KLG_') // control method "_GLK"
  105. //
  106. // Definitions for some string lengths
  107. //
  108. #define MAX_DEVICE_NAME_LENGTH 100
  109. #define MAX_CHEMISTRY_LENGTH 4
  110. //
  111. // Maximum number of smart batteries supported by this driver
  112. //
  113. #define MAX_SMART_BATTERIES_SUPPORTED 4
  114. //
  115. // Types for the FDOs hnadled by this driver:
  116. // Smart battery subsystem FDO
  117. // Smart Battery FDO
  118. // Smart battery PDO
  119. //
  120. typedef enum {
  121. SmbTypeSubsystem,
  122. SmbTypeBattery,
  123. SmbTypePdo
  124. } SMB_FDO_TYPE;
  125. //
  126. // SMB Host Controller Device object extenstion
  127. //
  128. //
  129. // Cached battery info
  130. //
  131. typedef struct {
  132. ULONG Tag;
  133. UCHAR Valid;
  134. BATTERY_INFORMATION Info;
  135. UCHAR ManufacturerNameLength;
  136. UCHAR ManufacturerName[SMB_MAX_DATA_SIZE];
  137. UCHAR DeviceNameLength;
  138. UCHAR DeviceName[SMB_MAX_DATA_SIZE];
  139. BATTERY_MANUFACTURE_DATE ManufacturerDate;
  140. ULONG SerialNumber;
  141. ULONG PowerState;
  142. ULONG Capacity;
  143. ULONG VoltageScale;
  144. ULONG CurrentScale;
  145. ULONG PowerScale;
  146. } STATIC_BAT_INFO, *PSTATIC_BAT_INFO;
  147. #define VALID_TAG_DATA 0x01 // manufacturer, device, serial #
  148. #define VALID_MODE 0x02
  149. #define VALID_OTHER 0x04
  150. #define VALID_CYCLE_COUNT 0x08
  151. #define VALID_SANITY_CHECK 0x10
  152. #define VALID_TAG 0x80
  153. #define VALID_ALL 0x1F // (does not include tag)
  154. //
  155. // Selector information structure
  156. //
  157. typedef struct _BATTERY_SELECTOR {
  158. //
  159. // Addressing and command information. This can change based whether or
  160. // not the selector is stand alone or part of the charger.
  161. //
  162. UCHAR SelectorAddress;
  163. UCHAR SelectorStateCommand;
  164. UCHAR SelectorPresetsCommand;
  165. UCHAR SelectorInfoCommand;
  166. //
  167. // Mutex to keep only one person talking with the selector at a time
  168. //
  169. FAST_MUTEX Mutex;
  170. //
  171. // Cached information. We will get notifications when these change.
  172. //
  173. ULONG SelectorState;
  174. ULONG SelectorPresets;
  175. ULONG SelectorInfo;
  176. } BATTERY_SELECTOR, *PBATTERY_SELECTOR;
  177. typedef struct {
  178. ULONG Setting;
  179. ULONG Skip;
  180. LONG Delta;
  181. LONG AllowedFudge;
  182. } BAT_ALARM_INFO, *PBAT_ALARM_INFO;
  183. typedef struct {
  184. UCHAR Address;
  185. USHORT Data;
  186. LIST_ENTRY Alarms;
  187. } SMB_ALARM_ENTRY, *PSMB_ALARM_ENTRY;
  188. //
  189. // Non-pagable device extension for smart battery FDO
  190. // (Created by IoCreateDevice SMB_NP_BATT for each battery)
  191. //
  192. typedef struct {
  193. SMB_FDO_TYPE SmbBattFdoType; // Device object type
  194. IO_REMOVE_LOCK RemoveLock;
  195. //
  196. // All elements above this point must be identical in
  197. // SMB_NP_BATT, SMB_BATT_SUBSYSTEM, and SMB_BATT_PDO structures.
  198. //
  199. FAST_MUTEX Mutex; // lets either battery OR subsystem
  200. // have access to batt
  201. PVOID Class; // Battery Class handle
  202. struct _SMB_BATT *Batt; // Battery pageable extension
  203. PDEVICE_OBJECT LowerDevice; // Battery Subsystem PDO
  204. WMILIB_CONTEXT WmiLibContext;
  205. } SMB_NP_BATT, *PSMB_NP_BATT;
  206. //
  207. // Pagable device extension for smart battery FDO
  208. // (Allocated Extra Memory for device information)
  209. //
  210. typedef struct _SMB_BATT {
  211. //
  212. //
  213. //
  214. PSMB_NP_BATT NP; // Battery device object extension
  215. PDEVICE_OBJECT DeviceObject; // Battery Fdo
  216. PDEVICE_OBJECT PDO; // Battery Pdo
  217. // SMB host controller
  218. PDEVICE_OBJECT SmbHcFdo; // SM bus Fdo
  219. //
  220. // Selector
  221. //
  222. PBATTERY_SELECTOR Selector; // Selector for battery
  223. //
  224. // For handling multiple batteries
  225. //
  226. BOOLEAN SelectorPresent;
  227. ULONG SelectorBitPosition;
  228. //
  229. // Battery
  230. //
  231. ULONG TagCount; // Tag for next battery
  232. STATIC_BAT_INFO Info;
  233. BAT_ALARM_INFO AlarmLow;
  234. } SMB_BATT, *PSMB_BATT;
  235. //
  236. // Device extension for the smart battery subsystem FDO
  237. // (Created by first AddDevice command from ACPI PDO)
  238. //
  239. typedef struct _SMB_BATT_SUBSYSTEM {
  240. SMB_FDO_TYPE SmbBattFdoType; // Device object type
  241. IO_REMOVE_LOCK RemoveLock;
  242. //
  243. // All elements above this point must be identical in
  244. // SMB_NP_BATT, SMB_BATT_SUBSYSTEM, and SMB_BATT_PDO structures.
  245. //
  246. PVOID SmbAlarmHandle; // handle for SmbAlarm registration
  247. PDEVICE_OBJECT LowerDevice; // Subsystem PDO
  248. PDEVICE_OBJECT DeviceObject; // Subsystem FDO
  249. PDEVICE_OBJECT SmbHcFdo; // SMBus Fdo
  250. ULONG NumberOfBatteries; // Number of batteries supported
  251. BOOLEAN SelectorPresent; // Is there a selector present
  252. PBATTERY_SELECTOR Selector; // Selector specific info
  253. //
  254. // Stuff for handling the SMB alarms for the smart battery subsystem
  255. //
  256. LIST_ENTRY AlarmList;
  257. KSPIN_LOCK AlarmListLock;
  258. PIO_WORKITEM WorkerThread; // WORK_QUEUE to get worker thread
  259. ULONG WorkerActive;
  260. //
  261. // Keep a list of the battery PDOs I "discover"
  262. //
  263. PDEVICE_OBJECT BatteryPdoList[MAX_SMART_BATTERIES_SUPPORTED];
  264. } SMB_BATT_SUBSYSTEM, *PSMB_BATT_SUBSYSTEM;
  265. //
  266. // Device extension for the smart battery PDOs
  267. // (Created by IoCreateDevice SMB_BATT_PDO for each battery)
  268. //
  269. typedef struct _SMB_BATT_PDO {
  270. SMB_FDO_TYPE SmbBattFdoType; // Device object type
  271. IO_REMOVE_LOCK RemoveLock;
  272. //
  273. // All elements above this point must be identical in
  274. // SMB_NP_BATT, SMB_BATT_SUBSYSTEM, and SMB_BATT_PDO structures.
  275. //
  276. PDEVICE_OBJECT DeviceObject; // Battery PDO
  277. PDEVICE_OBJECT Fdo; // Battery FDO layered on top of PDO
  278. PDEVICE_OBJECT SubsystemFdo; // Smart Battery subsystem FDO
  279. ULONG BatteryNumber; // Used by subsystem during battery
  280. // FDO init
  281. } SMB_BATT_PDO, *PSMB_BATT_PDO;
  282. //
  283. // SMBus Smart battery addresses and registers
  284. //
  285. #define SMB_HOST_ADDRESS 0x8 // Address on bus (10H)
  286. #define SMB_CHARGER_ADDRESS 0x9 // Address on bus (12H)
  287. #define SMB_SELECTOR_ADDRESS 0xa // Address on bus (14H)
  288. #define SMB_BATTERY_ADDRESS 0xb // Address on bus (16H)
  289. #define SMB_ALERT_ADDRESS 0xc // Address on bus (18H)
  290. //
  291. // Smart Battery command codes
  292. //
  293. #define BAT_REMAINING_CAPACITY_ALARM 0x01 // word
  294. #define BAT_REMAINING_TIME_ALARM 0x02 // word
  295. #define BAT_BATTERY_MODE 0x03 // word
  296. #define BAT_AT_RATE 0x04 // word
  297. #define BAT_RATE_TIME_TO_FULL 0x05 // word
  298. #define BAT_RATE_TIME_TO_EMPTY 0x06 // word
  299. #define BAT_RATE_OK 0x07 // word
  300. #define BAT_TEMPERATURE 0x08 // word
  301. #define BAT_VOLTAGE 0x09 // word
  302. #define BAT_CURRENT 0x0a // word
  303. #define BAT_AVERAGE_CURRENT 0x0b // word
  304. #define BAT_MAX_ERROR 0x0c // word
  305. #define BAT_RELATIVE_STATE_OF_CHARGE 0x0d // word
  306. #define BAT_ABSOLUTE_STATE_OF_CHARGE 0x0e // word
  307. #define BAT_REMAINING_CAPACITY 0x0f // word
  308. #define BAT_FULL_CHARGE_CAPACITY 0x10 // word
  309. #define BAT_RUN_TO_EMPTY 0x11 // word
  310. #define BAT_AVERAGE_TIME_TO_EMPTY 0x12 // word
  311. #define BAT_AVERAGE_TIME_TO_FULL 0x13 // word
  312. #define BAT_STATUS 0x16 // word
  313. #define BAT_CYCLE_COUNT 0x17 // word
  314. #define BAT_DESIGN_CAPACITY 0x18 // word
  315. #define BAT_DESIGN_VOLTAGE 0x19 // word
  316. #define BAT_SPECITICATION_INFO 0x1a // word
  317. #define BAT_MANUFACTURER_DATE 0x1b // word
  318. #define BAT_SERIAL_NUMBER 0x1c // word
  319. #define BAT_MANUFACTURER_NAME 0x20 // block
  320. #define BAT_DEVICE_NAME 0x21 // block
  321. #define BAT_CHEMISTRY 0x22 // block
  322. #define BAT_MANUFACTURER_DATA 0x23 // block
  323. //
  324. // Battery Mode Definitions
  325. //
  326. #define CAPACITY_WATTS_MODE 0x8000
  327. //
  328. // Battery Scale Factors
  329. //
  330. #define BSCALE_FACTOR_0 1
  331. #define BSCALE_FACTOR_1 10
  332. #define BSCALE_FACTOR_2 100
  333. #define BSCALE_FACTOR_3 1000
  334. #define BATTERY_VSCALE_MASK 0x0f00
  335. #define BATTERY_IPSCALE_MASK 0xf000
  336. #define BATTERY_VSCALE_SHIFT 8
  337. #define BATTERY_IPSCALE_SHIFT 12
  338. //
  339. // Selector command codes
  340. //
  341. #define SELECTOR_SELECTOR_STATE 0x01 // word
  342. #define SELECTOR_SELECTOR_PRESETS 0x02 // word
  343. #define SELECTOR_SELECTOR_INFO 0x04 // word
  344. //
  345. // Selector Equates
  346. //
  347. #define SELECTOR_SHIFT_CHARGE 4
  348. #define SELECTOR_SHIFT_POWER 8
  349. #define SELECTOR_SHIFT_COM 12
  350. #define SELECTOR_STATE_PRESENT_MASK 0x000F
  351. #define SELECTOR_STATE_CHARGE_MASK 0x00F0
  352. #define SELECTOR_STATE_POWER_BY_MASK 0x0F00
  353. #define SELECTOR_STATE_SMB_MASK 0xF000
  354. #define SELECTOR_SET_COM_MASK 0x0FFF
  355. #define SELECTOR_SET_POWER_BY_MASK 0xF0FF
  356. #define SELECTOR_SET_CHARGE_MASK 0xFF0F
  357. #define BATTERY_A_PRESENT 0x0001
  358. #define BATTERY_B_PRESENT 0x0002
  359. #define BATTERY_C_PRESENT 0x0004
  360. #define BATTERY_D_PRESENT 0x0008
  361. #define SELECTOR_STATE_PRESENT_CHANGE 0x1
  362. #define SELECTOR_STATE_CHARGE_CHANGE 0x2
  363. #define SELECTOR_STATE_POWER_BY_CHANGE 0x4
  364. #define SELECTOR_STATE_SMB_CHANGE 0x8
  365. #define SELECTOR_PRESETS_OKTOUSE_MASK 0x000F
  366. #define SELECTOR_PRESETS_USENEXT_MASK 0x00F0
  367. #define SELECTOR_SHIFT_USENEXT 4
  368. #define SELECTOR_INFO_SUPPORT_MASK 0x000F
  369. #define SELECTOR_INFO_SPEC_REVISION_MASK 0x00F0
  370. #define SELECTOR_INFO_CHARGING_INDICATOR_BIT 0x0100
  371. #define SELECTOR_SHIFT_REVISION 4
  372. //
  373. // Charger command codes
  374. //
  375. #define CHARGER_SPEC_INFO 0x11 // word
  376. #define CHARGER_MODE 0x12 // word
  377. #define CHARGER_STATUS 0x13 // word
  378. #define CHARGER_CHARGING_CURRENT 0x14 // word
  379. #define CHARGER_CHARGING_VOLTAGE 0x15 // word
  380. #define CHARGER_ALARM_WARNING 0x16 // word
  381. #define CHARGER_SELECTOR_COMMANDS 0x20
  382. #define CHARGER_SELECTOR_STATE CHARGER_SELECTOR_COMMANDS | \
  383. SELECTOR_SELECTOR_STATE
  384. #define CHARGER_SELECTOR_PRESETS CHARGER_SELECTOR_COMMANDS | \
  385. SELECTOR_SELECTOR_PRESETS
  386. #define CHARGER_SELECTOR_INFO CHARGER_SELECTOR_COMMANDS | \
  387. SELECTOR_SELECTOR_INFO
  388. //
  389. // Charger Status Definitions
  390. //
  391. #define CHARGER_STATUS_BATTERY_PRESENT_BIT 0x4000
  392. #define CHARGER_STATUS_AC_PRESENT_BIT 0x8000
  393. //
  394. // Charger Specification Info Definitions
  395. //
  396. #define CHARGER_SELECTOR_SUPPORT_BIT 0x0010
  397. //
  398. // SelectorState ReverseLogic Equates
  399. //
  400. #define INVALID 0xFF
  401. #define BATTERY_A 0x00
  402. #define BATTERY_B 0x01
  403. #define BATTERY_C 0x02
  404. #define BATTERY_D 0x03
  405. #define MULTIBATT_AB 0x04
  406. #define MULTIBATT_AC 0x08
  407. #define MULTIBATT_BC 0x09
  408. #define MULTIBATT_ABC 0x24
  409. #define BATTERY_NONE 0xFF
  410. // word to byte helpers
  411. #define WORD_MSB_SHIFT 8
  412. #define WORD_LSB_MASK 0xFF
  413. //
  414. // Function Prototypes
  415. //
  416. VOID
  417. SmbBattLockDevice (
  418. IN PSMB_BATT SmbBatt
  419. );
  420. VOID
  421. SmbBattUnlockDevice (
  422. IN PSMB_BATT SmbBatt
  423. );
  424. VOID
  425. SmbBattRequest (
  426. IN PSMB_BATT SmbBatt,
  427. IN PSMB_REQUEST SmbReq
  428. );
  429. NTSTATUS
  430. SmbBattSynchronousRequest (
  431. IN PDEVICE_OBJECT DeviceObject,
  432. IN PIRP Irp,
  433. IN PVOID Context
  434. );
  435. VOID
  436. SmbBattRB(
  437. IN PSMB_BATT SmbBatt,
  438. IN UCHAR SmbCmd,
  439. OUT PUCHAR Buffer,
  440. OUT PUCHAR BufferLength
  441. );
  442. VOID
  443. SmbBattRW(
  444. IN PSMB_BATT SmbBatt,
  445. IN UCHAR SmbCmd,
  446. OUT PULONG Result
  447. );
  448. VOID
  449. SmbBattRSW(
  450. IN PSMB_BATT SmbBatt,
  451. IN UCHAR SmbCmd,
  452. OUT PLONG Result
  453. );
  454. VOID
  455. SmbBattWW(
  456. IN PSMB_BATT SmbBatt,
  457. IN UCHAR SmbCmd,
  458. IN ULONG Data
  459. );
  460. UCHAR
  461. SmbBattGenericRW(
  462. IN PDEVICE_OBJECT SmbHcFdo,
  463. IN UCHAR Address,
  464. IN UCHAR SmbCmd,
  465. OUT PULONG Result
  466. );
  467. UCHAR
  468. SmbBattGenericWW(
  469. IN PDEVICE_OBJECT SmbHcFdo,
  470. IN UCHAR Address,
  471. IN UCHAR SmbCmd,
  472. IN ULONG Data
  473. );
  474. VOID
  475. SmbBattGenericRequest (
  476. IN PDEVICE_OBJECT SmbHcFdo,
  477. IN PSMB_REQUEST SmbReq
  478. );
  479. VOID
  480. SmbBattAlarm (
  481. IN PVOID Context,
  482. IN UCHAR Address,
  483. IN USHORT Data
  484. );
  485. BOOLEAN
  486. SmbBattVerifyStaticInfo (
  487. IN PSMB_BATT SmbBatt,
  488. IN ULONG BatteryTag
  489. );
  490. NTSTATUS
  491. SmbBattPowerDispatch(
  492. IN PDEVICE_OBJECT Fdo,
  493. IN PIRP Irp
  494. );
  495. NTSTATUS
  496. SmbBattPnpDispatch(
  497. IN PDEVICE_OBJECT Fdo,
  498. IN PIRP Irp
  499. );
  500. NTSTATUS
  501. SmbBattRegisterForAlarm(
  502. IN PDEVICE_OBJECT Fdo
  503. );
  504. NTSTATUS
  505. SmbBattUnregisterForAlarm(
  506. IN PDEVICE_OBJECT Fdo
  507. );
  508. NTSTATUS
  509. SmbBattSetSelectorComm (
  510. IN PSMB_BATT SmbBatt,
  511. OUT PULONG OldSelectorState
  512. );
  513. NTSTATUS
  514. SmbBattResetSelectorComm (
  515. IN PSMB_BATT SmbBatt,
  516. IN ULONG OldSelectorState
  517. );
  518. NTSTATUS
  519. SmbGetSBS (
  520. IN PULONG NumberOfBatteries,
  521. IN PBOOLEAN SelectorPresent,
  522. IN PDEVICE_OBJECT LowerDevice
  523. );
  524. NTSTATUS
  525. SmbGetGLK (
  526. IN PBOOLEAN GlobalLockRequired,
  527. IN PDEVICE_OBJECT LowerDevice
  528. );
  529. NTSTATUS
  530. SmbBattCreatePdos(
  531. IN PDEVICE_OBJECT SubsystemFdo
  532. );
  533. NTSTATUS
  534. SmbBattBuildDeviceRelations(
  535. IN PSMB_BATT_SUBSYSTEM SubsystemExt,
  536. IN PDEVICE_RELATIONS *DeviceRelations
  537. );
  538. NTSTATUS
  539. SmbBattQueryDeviceRelations(
  540. IN PDEVICE_OBJECT DeviceObject,
  541. IN PIRP Irp
  542. );
  543. NTSTATUS
  544. SmbBattRemoveDevice(
  545. IN PDEVICE_OBJECT DeviceObject,
  546. IN PIRP Irp
  547. );
  548. NTSTATUS
  549. SmbBattQueryId(
  550. IN PDEVICE_OBJECT Pdo,
  551. IN PIRP Irp
  552. );
  553. NTSTATUS
  554. SmbBattQueryCapabilities(
  555. IN PDEVICE_OBJECT Pdo,
  556. IN PIRP Irp
  557. );
  558. SmbBattBuildSelectorStruct(
  559. IN PDEVICE_OBJECT SubsystemFdo
  560. );
  561. VOID
  562. SmbBattWorkerThread (
  563. IN PDEVICE_OBJECT Fdo,
  564. IN PVOID Context
  565. );
  566. VOID
  567. SmbBattLockSelector (
  568. IN PBATTERY_SELECTOR Selector
  569. );
  570. VOID
  571. SmbBattUnlockSelector (
  572. IN PBATTERY_SELECTOR Selector
  573. );
  574. ULONG
  575. SmbBattGetSelectorDeltas (
  576. IN ULONG OriginalSelectorState,
  577. IN ULONG NewSelectorState
  578. );
  579. VOID
  580. SmbBattProcessPresentChanges (
  581. IN PSMB_BATT_SUBSYSTEM SubsystemExt,
  582. IN ULONG OriginalSelectorState,
  583. IN ULONG NewSelectorState
  584. );
  585. VOID
  586. SmbBattProcessChargeChange (
  587. IN PSMB_BATT_SUBSYSTEM SubsystemExt,
  588. IN ULONG OriginalSelectorState,
  589. IN ULONG NewSelectorState
  590. );
  591. VOID
  592. SmbBattProcessPowerByChange (
  593. IN PSMB_BATT_SUBSYSTEM SubsystemExt,
  594. IN ULONG OriginalSelectorState,
  595. IN ULONG NewSelectorState
  596. );
  597. VOID
  598. SmbBattNotifyClassDriver (
  599. IN PSMB_BATT_SUBSYSTEM SubsystemExt,
  600. IN ULONG BatteryIndex
  601. );
  602. NTSTATUS
  603. SmbBattDirectDataAccess (
  604. IN PSMB_NP_BATT DeviceExtension,
  605. IN PSMBBATT_DATA_STRUCT IoBuffer,
  606. IN ULONG InputLen,
  607. IN ULONG OutputLen
  608. );
  609. VOID
  610. SmbBattProcessChargerAlarm (
  611. IN PSMB_BATT_SUBSYSTEM SubsystemExt,
  612. IN ULONG ChargerStatus
  613. );
  614. NTSTATUS
  615. SmbBattSetInformation (
  616. IN PVOID Context,
  617. IN ULONG BatteryTag,
  618. IN BATTERY_SET_INFORMATION_LEVEL Level,
  619. IN PVOID Buffer OPTIONAL
  620. );
  621. UCHAR
  622. SmbBattIndex (
  623. IN PBATTERY_SELECTOR Selector,
  624. IN ULONG SelectorNibble,
  625. IN UCHAR SimultaneousIndex
  626. );
  627. BOOLEAN
  628. SmbBattReverseLogic (
  629. IN PBATTERY_SELECTOR Selector,
  630. IN ULONG SelectorNibble
  631. );
  632. extern BOOLEAN SmbBattUseGlobalLock;
  633. NTSTATUS
  634. SmbBattAcquireGlobalLock (
  635. IN PDEVICE_OBJECT LowerDeviceObject,
  636. OUT PACPI_MANIPULATE_GLOBAL_LOCK_BUFFER GlobalLock
  637. );
  638. NTSTATUS
  639. SmbBattReleaseGlobalLock (
  640. IN PDEVICE_OBJECT LowerDeviceObject,
  641. IN PACPI_MANIPULATE_GLOBAL_LOCK_BUFFER GlobalLock
  642. );
  643. NTSTATUS
  644. SmbBattSystemControl(
  645. IN PDEVICE_OBJECT DeviceObject,
  646. IN PIRP Irp
  647. );
  648. NTSTATUS
  649. SmbBattWmiRegistration(
  650. PSMB_NP_BATT SmbNPBatt
  651. );
  652. NTSTATUS
  653. SmbBattWmiDeRegistration(
  654. PSMB_NP_BATT SmbNPBatt
  655. );