<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/dev/acpica, branch stable/13</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>ACPI: Treat all 20-element _BIX entires as revision 0</title>
<updated>2024-12-07T00:01:59+00:00</updated>
<author>
<name>Bartosz Fabianowski</name>
<email>freebsd@chillt.de</email>
</author>
<published>2024-10-02T18:21:28+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=4651f4be1ed36d72f6d299a040f9a41eeb5c43c4'/>
<id>4651f4be1ed36d72f6d299a040f9a41eeb5c43c4</id>
<content type='text'>
Some Fujitsu Lifebooks return an invalid _BIX object. The first element
of _BIX is a revision number, which indicates what elements will follow:
* ACPI 4.0 defined _BIX revision 0 with 20 elements.
* ACPI 6.0 introduced _BIX revision 1 with 21 elements.
The problem is that the offending Lifebooks have the a non-zero _BIX
revision, but provide 20 fields only.

The ACPICA parser chokes on this [1], but that seems to be
inconsequential. More importantly, our own battery info handling code
also verifies that for revision &gt; 0, there are at least 21 fields - and
refuses to process the invalid _BIX. One workaround would be to
introduce special case / quirk handling for Fujitsu Lifebooks. A better
one is to relax the requirements check: If there are only 20 elements,
treat the _BIX as revision 0, no matter what revision number was
provided by the device.

Linux doesn't run into this problem by the way because it only supports
the 20 fields defined in the ACPI 4.0 spec [3]. It never looks at the
revision number or the 21st field added in ACPI 6.0.

[1] https://cgit.freebsd.org/src/tree/sys/contrib/dev/acpica/components/namespace/nsprepkg.c#n815
[2] https://cgit.freebsd.org/src/tree/sys/dev/acpica/acpi_cmbat.c#n371
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/acpi/battery.c#n418

PR: 252030
Reviewed by: imp
MFC After: 2 weeks

(cherry picked from commit cd8c3af747cc300c8257c315c7576644e2bb86ff)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some Fujitsu Lifebooks return an invalid _BIX object. The first element
of _BIX is a revision number, which indicates what elements will follow:
* ACPI 4.0 defined _BIX revision 0 with 20 elements.
* ACPI 6.0 introduced _BIX revision 1 with 21 elements.
The problem is that the offending Lifebooks have the a non-zero _BIX
revision, but provide 20 fields only.

The ACPICA parser chokes on this [1], but that seems to be
inconsequential. More importantly, our own battery info handling code
also verifies that for revision &gt; 0, there are at least 21 fields - and
refuses to process the invalid _BIX. One workaround would be to
introduce special case / quirk handling for Fujitsu Lifebooks. A better
one is to relax the requirements check: If there are only 20 elements,
treat the _BIX as revision 0, no matter what revision number was
provided by the device.

Linux doesn't run into this problem by the way because it only supports
the 20 fields defined in the ACPI 4.0 spec [3]. It never looks at the
revision number or the 21st field added in ACPI 6.0.

[1] https://cgit.freebsd.org/src/tree/sys/contrib/dev/acpica/components/namespace/nsprepkg.c#n815
[2] https://cgit.freebsd.org/src/tree/sys/dev/acpica/acpi_cmbat.c#n371
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/acpi/battery.c#n418

PR: 252030
Reviewed by: imp
MFC After: 2 weeks

(cherry picked from commit cd8c3af747cc300c8257c315c7576644e2bb86ff)
</pre>
</div>
</content>
</entry>
<entry>
<title>acpi: Narrow workaround for broken interrupt settings on x86</title>
<updated>2024-07-23T13:29:17+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2024-07-15T19:13:08+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=17c6c686eda814c52218ea6b393c8388bc6bc1b4'/>
<id>17c6c686eda814c52218ea6b393c8388bc6bc1b4</id>
<content type='text'>
Commit 9a7bf07ccdc1 from 2016 introduced a workaround for some broken
BIOSes that specified active-lo instead of active-hi polarity for ISA
IRQs for UARTs.  The workaround assumed that edge-sensitive ISA IRQs
on x86 should always be active-hi.  However, some recent AMD systems
actually use active-lo edge-sensitive ISA IRQs (and not just for
UARTs, but also for the keyboard and PS/2 mouse devices) and the
override causes interrupts to be dropped resulting in boot time hangs,
non-working keyboards, etc.

Add a hw.acpi.override_isa_irq_polarity tunable (readable as a sysctl
post-boot) to control this quirk.  It can be set to 1 to force enable
the override and 0 to disable it.  The log of original message
mentions an Intel motherboard as the sample case, so default the
tunable to 1 on systems with an Intel CPU and 0 otherwise.

Special thanks to Matthias Lanter &lt;freebsd@lanter-it.ch&gt; for tracking
down boot time issues on recent AMD systems to mismatched interrupt
polarity.

PR:		270707
Reported by:	aixdroix_OSS@protonmail.com, Michael Dexter
Reported by:	mfw_burn@pm.me, Hannes Hfauswedell &lt;h2+fbsdports@fsfe.org&gt;
Reported by:	Matthias Lanter &lt;freebsd@lanter-it.ch&gt;
Reported by:	William Bulley &lt;web@umich.edu&gt;
Reviewed by:	imp, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45554

(cherry picked from commit 0a34d050ae8ea14feddd3d2a62fd2f612613b2c5)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 9a7bf07ccdc1 from 2016 introduced a workaround for some broken
BIOSes that specified active-lo instead of active-hi polarity for ISA
IRQs for UARTs.  The workaround assumed that edge-sensitive ISA IRQs
on x86 should always be active-hi.  However, some recent AMD systems
actually use active-lo edge-sensitive ISA IRQs (and not just for
UARTs, but also for the keyboard and PS/2 mouse devices) and the
override causes interrupts to be dropped resulting in boot time hangs,
non-working keyboards, etc.

Add a hw.acpi.override_isa_irq_polarity tunable (readable as a sysctl
post-boot) to control this quirk.  It can be set to 1 to force enable
the override and 0 to disable it.  The log of original message
mentions an Intel motherboard as the sample case, so default the
tunable to 1 on systems with an Intel CPU and 0 otherwise.

Special thanks to Matthias Lanter &lt;freebsd@lanter-it.ch&gt; for tracking
down boot time issues on recent AMD systems to mismatched interrupt
polarity.

PR:		270707
Reported by:	aixdroix_OSS@protonmail.com, Michael Dexter
Reported by:	mfw_burn@pm.me, Hannes Hfauswedell &lt;h2+fbsdports@fsfe.org&gt;
Reported by:	Matthias Lanter &lt;freebsd@lanter-it.ch&gt;
Reported by:	William Bulley &lt;web@umich.edu&gt;
Reviewed by:	imp, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45554

(cherry picked from commit 0a34d050ae8ea14feddd3d2a62fd2f612613b2c5)
</pre>
</div>
</content>
</entry>
<entry>
<title>acpi_battery: avoid divide-by-zero when no devices have capacity info</title>
<updated>2024-04-24T14:06:08+00:00</updated>
<author>
<name>Josef 'Jeff' Sipek</name>
<email>jeffpc@josefsipek.net</email>
</author>
<published>2024-04-16T23:01:28+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1a4e512adbab4dfc072d6331a7483f4188fb96ce'/>
<id>1a4e512adbab4dfc072d6331a7483f4188fb96ce</id>
<content type='text'>
On laptops with builtin batteries, disconnecting the battery may show up
as a battery without any capacity information. (The theory is that one
is disconnecting the cells but the electronics identifying the battery
are still connected.) As a result, the loop over all batteries in
acpi_battery_get_battinfo results in total_lfcap == 0.

So, just check that total_lfcap is non-zero to avoid a division by zero
(triggerable by sysctl hw.acpi.battery).

Reported by:	Stefano Marinelli
Tested by:	Stefano Marinelli
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D44818

(cherry picked from commit 2e850b832f5d2adb9b230d191277d67c00caaab9)
(cherry picked from commit 788987e034b1c73d779a3aa179f79f672bbdb366)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On laptops with builtin batteries, disconnecting the battery may show up
as a battery without any capacity information. (The theory is that one
is disconnecting the cells but the electronics identifying the battery
are still connected.) As a result, the loop over all batteries in
acpi_battery_get_battinfo results in total_lfcap == 0.

So, just check that total_lfcap is non-zero to avoid a division by zero
(triggerable by sysctl hw.acpi.battery).

Reported by:	Stefano Marinelli
Tested by:	Stefano Marinelli
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D44818

(cherry picked from commit 2e850b832f5d2adb9b230d191277d67c00caaab9)
(cherry picked from commit 788987e034b1c73d779a3aa179f79f672bbdb366)
</pre>
</div>
</content>
</entry>
<entry>
<title>acpi: Don't assume a resource is reserved in acpi_delete_resource</title>
<updated>2024-04-08T17:56:03+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2024-02-14T22:07:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7204a656fcfab41200a0056bb5dba0c538d93052'/>
<id>7204a656fcfab41200a0056bb5dba0c538d93052</id>
<content type='text'>
This fixes a panic if a driver uses bus_set_resource to add a resource
that fails to reserve and then deletes the resource via
bus_delete_resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43891

(cherry picked from commit e05436d577de98944b97b9cf510b29c4d2091b3f)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes a panic if a driver uses bus_set_resource to add a resource
that fails to reserve and then deletes the resource via
bus_delete_resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43891

(cherry picked from commit e05436d577de98944b97b9cf510b29c4d2091b3f)
</pre>
</div>
</content>
</entry>
<entry>
<title>acpi: Allow child drivers to use bus_set_resource for more resources</title>
<updated>2024-04-08T17:54:40+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2024-02-14T22:07:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=55c2c62f108a86e1912228a4a3ac8da3a0df913f'/>
<id>55c2c62f108a86e1912228a4a3ac8da3a0df913f</id>
<content type='text'>
acpi_set_resource excludes certain types of resources for certain
devices.  The intention of this is to avoid adding resource entries
for bogus resources enumerated via _CRS.  However, this also prevents
drivers from adding those resources explicitly if needed.  To fix
this, move the logic to exclude these resources into an ignore hook
used when parsing _CRS to create the initial set of resources for each
device.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43892

(cherry picked from commit 055c1fe230ce5a2997c03a3cc2431baea1594566)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
acpi_set_resource excludes certain types of resources for certain
devices.  The intention of this is to avoid adding resource entries
for bogus resources enumerated via _CRS.  However, this also prevents
drivers from adding those resources explicitly if needed.  To fix
this, move the logic to exclude these resources into an ignore hook
used when parsing _CRS to create the initial set of resources for each
device.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43892

(cherry picked from commit 055c1fe230ce5a2997c03a3cc2431baea1594566)
</pre>
</div>
</content>
</entry>
<entry>
<title>acpi: Use bus_generic_alloc_resource instead of duplicating it</title>
<updated>2024-04-08T17:53:29+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2024-02-09T18:27:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1910a6ca6e83fbab26dd86082c899dbde53efcc1'/>
<id>1910a6ca6e83fbab26dd86082c899dbde53efcc1</id>
<content type='text'>
No functional change, but it is cleaner to use the existing generic
wrappers rather than KOBJ methods directly.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43686

(cherry picked from commit 1fb5445206a5ef2351c32f8bc6beb67605593caa)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional change, but it is cleaner to use the existing generic
wrappers rather than KOBJ methods directly.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43686

(cherry picked from commit 1fb5445206a5ef2351c32f8bc6beb67605593caa)
</pre>
</div>
</content>
</entry>
<entry>
<title>acpi_hpet: Make use of enum for vm_guest to improve readability</title>
<updated>2024-03-31T15:55:49+00:00</updated>
<author>
<name>Zhenlei Huang</name>
<email>zlei@FreeBSD.org</email>
</author>
<published>2024-03-24T15:31:22+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f3b21c5536816eae4d8ecbbddd790419753d403a'/>
<id>f3b21c5536816eae4d8ecbbddd790419753d403a</id>
<content type='text'>
No functional change intended.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44402

(cherry picked from commit 579cb41b132f532bf4915121c0d0b2f43688242e)
(cherry picked from commit ddd779a062c1de28a3f632ece9fe4d1abf07dbdb)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional change intended.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44402

(cherry picked from commit 579cb41b132f532bf4915121c0d0b2f43688242e)
(cherry picked from commit ddd779a062c1de28a3f632ece9fe4d1abf07dbdb)
</pre>
</div>
</content>
</entry>
<entry>
<title>acpi: Defer reserving resources for ACPI devices</title>
<updated>2024-02-23T00:48:39+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2024-02-22T18:43:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=eaa51e59e560c556d0a8273d29eea4309e6b6a4f'/>
<id>eaa51e59e560c556d0a8273d29eea4309e6b6a4f</id>
<content type='text'>
The goal of reserving firmware-assigned resources is to ensure that
"wildcard" resource allocation requests will not claim an address
range that is actually in use even if no attached driver is actively
using that range.  However, the current approach can break in some
cases.

In particular, ACPI can enumerate devices behind PCI bridges that
don't show up in a normal PCI scan, but those device_t objects can end
up as direct children of acpi0.  Reserving resources for those devices
directly from acpi0 ends up conflicting with later attempts to reserve
the PCI bridge windows.

As a workaround, defer reserving unclaimed resources until after the
initial probe and attach scan.  Eventually this pass of reserving
unclaimed resources can be moved earlier, but it requires changes to
other drivers in the tree to permit enumerating devices and reserving
firmware-assigned resources in a depth-first traversal before
attaching devices whose drivers request wildcard allocations.

PR:		272507
Reported by:	Justin Tocci &lt;justin@tocci.org&gt;
Reported by:	john@feith.com, many others
Tested by:	Oleg Sidorkin &lt;osidorkin@gmail.com&gt;, dch

(cherry picked from commit f2fcb68074a51a8b399dc80d4c03fbe98a0ab92c)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The goal of reserving firmware-assigned resources is to ensure that
"wildcard" resource allocation requests will not claim an address
range that is actually in use even if no attached driver is actively
using that range.  However, the current approach can break in some
cases.

In particular, ACPI can enumerate devices behind PCI bridges that
don't show up in a normal PCI scan, but those device_t objects can end
up as direct children of acpi0.  Reserving resources for those devices
directly from acpi0 ends up conflicting with later attempts to reserve
the PCI bridge windows.

As a workaround, defer reserving unclaimed resources until after the
initial probe and attach scan.  Eventually this pass of reserving
unclaimed resources can be moved earlier, but it requires changes to
other drivers in the tree to permit enumerating devices and reserving
firmware-assigned resources in a depth-first traversal before
attaching devices whose drivers request wildcard allocations.

PR:		272507
Reported by:	Justin Tocci &lt;justin@tocci.org&gt;
Reported by:	john@feith.com, many others
Tested by:	Oleg Sidorkin &lt;osidorkin@gmail.com&gt;, dch

(cherry picked from commit f2fcb68074a51a8b399dc80d4c03fbe98a0ab92c)
</pre>
</div>
</content>
</entry>
<entry>
<title>run acpi_shutdown_final later to give other handlers a chance</title>
<updated>2024-02-17T19:58:10+00:00</updated>
<author>
<name>Andriy Gapon</name>
<email>avg@FreeBSD.org</email>
</author>
<published>2021-12-20T11:01:56+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=854db1db3f81f5b840e7f238f627bc584224b311'/>
<id>854db1db3f81f5b840e7f238f627bc584224b311</id>
<content type='text'>
For example, shutdown_panic wants to produce some output and maybe take
some input before a system is actually reset.

The change should only make difference for the case of system reset
(reboot), poweroff and halt should not be affected.

The change makes difference only if hw.acpi.handle_reboot is set.  It
used to default to zero until r213755 / ac731af5670c7.

Also, run shutdown_halt even later, after acpi_shutdown_final.  The
reason for that is that poweroff is requested by RB_POWEROFF | RB_HALT
combination of flags.  In my opinion, that command is a bit bipolar, but
since we've been doing that forever, then so be it.  Because of that
flag combination, the order of shutdown_final handlers that check for
either flag does matter.

Some additional complexity comes from platform-specific shutdown_final
handlers that aim to handle multiple reboot options at once.  E.g.,
acpi_shutdown_final handles both poweroff and reboot / reset.  As
explained in 9cdf326b4f, such a handler must run after shutdown_panic to
give it a chance.  But as the change revealed, the handler must also run
before shutdown_halt, so that the system can actually power off before
entering the halt limbo.

Previously, shutdown_panic and shutdown_halt had the same priority which
appears to be incompatible with handlers that can do both poweroff and
reset.

The above also applies to power cycle handlers.

(cherry picked from commit 9cdf326b4faef97f0d3314b5dd693308ac494d48)
(cherry picked from commit e4ab361e53945a6c3e9d68c5e5ffc11de40a35f2)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For example, shutdown_panic wants to produce some output and maybe take
some input before a system is actually reset.

The change should only make difference for the case of system reset
(reboot), poweroff and halt should not be affected.

The change makes difference only if hw.acpi.handle_reboot is set.  It
used to default to zero until r213755 / ac731af5670c7.

Also, run shutdown_halt even later, after acpi_shutdown_final.  The
reason for that is that poweroff is requested by RB_POWEROFF | RB_HALT
combination of flags.  In my opinion, that command is a bit bipolar, but
since we've been doing that forever, then so be it.  Because of that
flag combination, the order of shutdown_final handlers that check for
either flag does matter.

Some additional complexity comes from platform-specific shutdown_final
handlers that aim to handle multiple reboot options at once.  E.g.,
acpi_shutdown_final handles both poweroff and reboot / reset.  As
explained in 9cdf326b4f, such a handler must run after shutdown_panic to
give it a chance.  But as the change revealed, the handler must also run
before shutdown_halt, so that the system can actually power off before
entering the halt limbo.

Previously, shutdown_panic and shutdown_halt had the same priority which
appears to be incompatible with handlers that can do both poweroff and
reset.

The above also applies to power cycle handlers.

(cherry picked from commit 9cdf326b4faef97f0d3314b5dd693308ac494d48)
(cherry picked from commit e4ab361e53945a6c3e9d68c5e5ffc11de40a35f2)
</pre>
</div>
</content>
</entry>
<entry>
<title>acpi_cpu: Reduce BUS_MASTER_RLD manipulations</title>
<updated>2024-01-19T16:35:54+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2023-12-26T02:19:28+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c71b398a155579d3bd31b3945013488bac5cb41e'/>
<id>c71b398a155579d3bd31b3945013488bac5cb41e</id>
<content type='text'>
Instead of setting and clearing BUS_MASTER_RLD register on every C3
state enter/exit, set it only once if the system supports C3 state
and we are going to "disable" bus master arbitration while in it.

This is what Linux does for the past 14 years, and for even more time
this register is not implemented in a relevant hardware.  Same time
since this is only a single bit in a bigger register, ACPI has to
do take a global lock and do read-modify-write for it, that is too
expensive, saved only by C3 not entered frequently, but enough to be
seen in idle system CPU profiles.

MFC after:	1 month

(cherry picked from commit 5bc10feacc9d81e3bba9d28734a85e996682b408)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of setting and clearing BUS_MASTER_RLD register on every C3
state enter/exit, set it only once if the system supports C3 state
and we are going to "disable" bus master arbitration while in it.

This is what Linux does for the past 14 years, and for even more time
this register is not implemented in a relevant hardware.  Same time
since this is only a single bit in a bigger register, ACPI has to
do take a global lock and do read-modify-write for it, that is too
expensive, saved only by C3 not entered frequently, but enough to be
seen in idle system CPU profiles.

MFC after:	1 month

(cherry picked from commit 5bc10feacc9d81e3bba9d28734a85e996682b408)
</pre>
</div>
</content>
</entry>
</feed>
