Commit graph

171 commits

Author SHA1 Message Date
Justin Miller
a8da29e888
[ACPI] Move CMBATT and COMPBATT out of the acpi directory (#7599)
Move these out of ACPI in preparation for ACPI_NEW so they keep their juicy commit history.
Also both ACPIs can coexist for awhile as I don't see the old driver getting removed anytime soon.
2025-01-29 00:49:35 -08:00
George Bișoc
a97fcf19ec
[CMBATT] Minor improvements to estimated battery time code
- Declare CMBATT_DISCHARGE_TIME and CMBATT_CAPACITY_BOGUS constructs
- Determine if the battery was already discharging and if not, update the time when it's being discharged
- Fix the condition where it checks if the battery has been discharging for quite some time
- Default the time to BATTERY_UNKNOWN_TIME if querying the estimated battery time request fails or if the battery has just started discharging not over 15 seconds

CORE-18969
CORE-19452
2025-01-12 20:00:14 +01:00
George Bișoc
13b394c1a7
[COMPBATT] Document COMPBATT_BATTERY_DATA and COMPBATT_DEVICE_EXTENSION structures
CORE-18969
CORE-19452
CORE-19888
2025-01-08 23:20:09 +01:00
George Bișoc
f58f37e944
[COMPBATT] Document the newly added code 2025-01-08 23:20:09 +01:00
George Bișoc
65b29fe533
[COMPBATT] Update the top headers and relicense the driver as MIT 2025-01-08 23:20:09 +01:00
George Bișoc
c439c5849b
[COMPBATT] Implement CompBattGetEstimatedTime 2025-01-08 23:20:08 +01:00
George Bișoc
a6d4998c6c
[COMPBATT] Implement CompBattQueryStatus and CompBattSetStatusNotify 2025-01-08 23:20:08 +01:00
George Bișoc
ee9914c712
[COMPBATT] Implement the battery monitor IRP worker 2025-01-08 23:20:08 +01:00
George Bișoc
6a06db09ca
[COMPBATT] Use FALSE for BOOLEANs on BatteryIoctl, not integers 2025-01-08 23:20:08 +01:00
George Bișoc
c944116833
[COMPBATT] Use the allocated battery IRPs as tags when acquiring I/O remove lock 2025-01-08 23:20:07 +01:00
George Bișoc
95f062bf0d
[COMPBATT] Use the documented debug switches
Use the debug switches that are documented and have a name rather than some cryptic values with no meaning or some shit.
2025-01-08 23:20:07 +01:00
George Bișoc
c6bdbefdc4
[COMPBATT] Use the non-constant variant of UNICODE_STRING for the battery name 2025-01-08 23:20:07 +01:00
George Bișoc
28bb8c6ff7
[COMPBATT] Assign a memory allocation tag for the I/O remove lock
IoInitializeRemoveLock expects an allocation tag to be provided when it allocates debug data in the kernel.
Passing 0 leads to a bunch of ASSERTs in the kernel as such data is allocated by ExAllocatePoolWithTag of which a tag has to be supplied, it's not optional.
2025-01-08 23:20:07 +01:00
George Bișoc
3346301777
[COMPBATT] Pass NULL for the work item context, not 0
It expects an arbitrary pointer, do the right thing!
2025-01-08 23:20:06 +01:00
George Bișoc
8b5423aa60
[COMPBATT] Annotate all functions with SAL2 2025-01-08 23:20:06 +01:00
George Bișoc
f9ea9220d8
[COMPBATT] Remove the useless WaitFlag field in the code which is never used 2025-01-08 23:20:06 +01:00
George Bișoc
04cd478035
[COMPBATT] Prepare the base foundation for the header file
- Introduce some new constructs
- Annotate the function prototypes with SAL2
- Re-structure & remove some useless fields in COMPBATT_DEVICE_EXTENSION and COMPBATT_BATTERY_DATA
2025-01-08 23:19:56 +01:00
Eric Kohl
5c4fcd99d6 [CMBATT] Fix two comments 2025-01-05 21:43:06 +01:00
George Bișoc
faf6123150
[CMBATT] Implement support for the _BIX method
_BIX is basically _BIF but with more information added, such as cycle count, measurement capacity accuracy and whatnot.
Starting with ACPI 4.0 _BIF is rendered obsolete and as a matter of fact a lot of modern hardware fill their ACPI machine data to _BIX.

ReactOS must go forward and beyond, compatibility with _BIF is kept. NOTE that a machine can ONLY support one battery static information method!

CORE-18969
CORE-19452
2025-01-02 18:21:33 +01:00
George Bișoc
f3dd15ad64
[CMBATT] Grab the design voltage after the BIF data gets copied
There was a risk of accessing invalid data as the design voltage was grabbed before the read BIF data was copied into the device extension.
2024-12-16 22:09:02 +01:00
George Bișoc
ea8315ba56
[CMBATT] Convert power statistics from mAh to mWh
ReactOS (like any other OSes) expects power data to be represented in milliwatts per hour, not in milliamps per hour.
Currently CMBATT defaults the stats to unknown values, if that's the case, and there are a bunch of machines that do report their data from _BIF ACPI method in ampere.

CORE-18969
CORE-19452
2024-12-16 17:33:51 +01:00
Hervé Poussineau
2d3f3a1613 [COMPBATT] Use BATTERY_TAG_INVALID instead 0 when applicable 2024-11-20 21:47:13 +01:00
Hervé Poussineau
05ae94092e [COMPBATT] Free device-related memory only if we failed
Otherwise, we just inserted in the BatteryList this device, and we will
probably crash later when accessing it.
2024-11-20 21:47:13 +01:00
Hervé Poussineau
2323dbcb4f [COMPBATT] Keep incoming Status on unknown IOCTL 2024-11-20 21:47:13 +01:00
Hervé Poussineau
81860b482a [CMBATT] Fix battery Tag
0 (ie BATTERY_TAG_INVALID) is not a valid battery tag.
First battery must have a tag of 1.
2024-11-12 21:26:42 +01:00
Dmitry Borisov
10b08aa2bb
[ISAPNP] Detect I/O ports at runtime (#7411)
Improve the driver's portability.
CORE-17977
2024-10-07 16:10:08 +02:00
Hervé Poussineau
30ac80f36b [CMBATT] Implement CmBattVerifyStaticInfo 2024-08-12 11:56:18 +02:00
Hervé Poussineau
2ff683fa33 [CMBATT] Remove useless fields in device extension
Information is already present in BifData, and those fields were never filled.
2024-08-12 11:56:18 +02:00
Hervé Poussineau
359e73d055 [CMBATT] Implement CmBattGetBifData/CmBattGetBstData 2024-08-12 11:56:18 +02:00
Dmitry Borisov
fdc1d96dc1 [ISAPNP] Make sure that APCs are disabled before acquiring a lock
Note: We could just use a fast mutex instead
2024-08-03 17:08:44 +06:00
Dmitry Borisov
6091dde0d3 [ISAPNP] Improvements around hardware access helpers
- Reimplement WriteWord using the WriteByte helper.
- Remove inline qualifiers from the bus read and write functions.
  This code path is considered "cold" and using an inline for it is overkill.
- Don't apply the IRQL restrictions to our PnP state transition helpers.
  They are only called at IRQL below dispatch level.
2024-08-03 17:08:43 +06:00
Dmitry Borisov
2981e63a31 [ISAPNP] Refactor the configuration code
- Remove useless checks
- Increase code readability
2024-08-03 17:08:43 +06:00
Dmitry Borisov
76ec8411a4 [ISAPNP] Fix parsing of complex resource data
- Properly handle the case when the dependent function is placed
  after fixed resources
- Initialize the version and revision fields of resource lists
- Improve validation of resource data
- Add more debug prints

CORE-18562
2024-08-03 17:08:43 +06:00
Dmitry Borisov
c1d7087352 [ISAPNP] Fix the reported length of the memory I/O ranges
CORE-18562
2024-08-03 17:08:43 +06:00
Dmitry Borisov
9b7f34601a [ISAPNP] Force clear the upper reserved bits on fixed I/O descriptors
CORE-18562
2024-08-03 17:08:43 +06:00
Dmitry Borisov
991dbeff53 [ISAPNP] Fix the truncation of 32-bit configuration I/O reads
CORE-18562
2024-08-03 17:08:43 +06:00
Dmitry Borisov
b36d9bd9c1 [ISAPNP_UNITTEST] Add unit tests exercising device discovery and device resources functionality
CORE-18562
2024-08-03 17:08:43 +06:00
Dmitry Borisov
016d01e5d1 [ISAPNP] Extract resource definitions
Prepare the driver for upcoming API tests
CORE-18562
2024-08-03 17:08:43 +06:00
Dmitry Borisov
4ba8a8b59b [ISAPNP] Allocate the Read Port resources on demand
This will simplify failure paths and reduce memory usage
2024-08-03 17:08:42 +06:00
George Bișoc
f69e256376
[ACPI] Register a device interface class with ACPI fans
As the commit title says, the point of registering a device interface with ACPI fans is to receive incoming PnP notifications of incoming ACPI fan drivers so that the power manager can connect to them by creating a power device policies dedicated to them during power manager initialization.

CORE-18969
2024-05-22 20:23:06 +02:00
Dmitry Borisov
5070e8960a
[ACPI] Fix object evaluation (#6302)
CORE-17256

- Implement support for complex input buffers.
  This will enable the IDE driver with some hack
  to execute the _STM (channel timing settings) control method.
- Fix a memory leak.
- Fix returned status code.
- Correctly calculate the output buffer size.
- Improve buffer validation.
- Implement support for async control requests.
- Implement local reference conversion.
- Implement support for subpackage argument conversion.
- Place some code into INIT section.
2024-04-01 18:21:35 +02:00
Hervé Poussineau
0be4e4aa6d [CMBATT] Correctly print UNICODE_STRING 2024-02-05 18:04:01 +01:00
Hervé Poussineau
913235952c [ACPI] Return success even if AcpiInterfaceNotificationsRegister is not implemented
Drivers calling this function still won't be notified in case of event,
but they will at least succeed their initialization.

CORE-18309
2024-02-01 10:08:58 +01:00
Hervé Poussineau
7f1025dcce [CMBATT] Send correct tag on IoAcquireRemoveLock
This prevents an assert in IoReleaseRemoveLock in debug builds, which
already receives the 'Irp' tag.
2024-02-01 10:08:58 +01:00
Thamatip Chitpong
2dd0c6c32b
[ACPI] Add acpi.rc to CMakeLists (#6089)
Fix missing version info.
2023-12-04 07:17:08 +07:00
Dmitry Borisov
3dd3d10531 [PCI] Fix I/O range size of the resource descriptors
Fixes incorrect PCI IDE resources in VPC 2007
CORE-17256
2023-01-21 07:33:03 +01:00
Thomas Faber
d3a718eb01
[COMPBATT] Add inf entry. CORE-18167 2023-01-21 00:10:06 -05:00
Thomas Faber
f0dd1e7b57
[ACPICA] Update to version 20221020. CORE-17905 2022-11-06 08:33:29 -05:00
Thomas Faber
03b24380a7
[ACPICA] Update to version 20220331. CORE-17905 2022-11-06 08:33:29 -05:00
Thomas Faber
8129fee128
[ACPICA] Update to version 20211217. CORE-17905 2022-11-06 08:33:28 -05:00