Page MenuHomeFreeBSD

acpi: parse resources of not-present devices that are kept enabled
ClosedPublic

Authored by guest-seuros on Jul 5 2026, 8:45 PM.
Referenced Files
Unknown Object (File)
Mon, Aug 3, 5:55 AM
Unknown Object (File)
Sun, Aug 2, 6:04 AM
Unknown Object (File)
Sun, Aug 2, 4:57 AM
Unknown Object (File)
Sun, Aug 2, 3:43 AM
Unknown Object (File)
Sun, Aug 2, 1:26 AM
Unknown Object (File)
Sat, Aug 1, 4:16 AM
Unknown Object (File)
Thu, Jul 30, 9:56 AM
Unknown Object (File)
Wed, Jul 29, 10:07 PM

Details

Summary

acpi_probe_child() keeps PCI link devices, the RTC,
and docking stations enabled even when _STA reports them not present,
but skipped acpi_parse_resources() for them. With an empty resource
list, resource-based hint matching (BUS_HINT_DEVICE_UNIT) cannot wire
such a device to its hinted unit, and the hinted ISA device is then
created as a duplicate.

Modern AMI firmware reports the PNP0B00 RTC as not present while
handing timekeeping to the ACPI Time-and-Alarm device.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

guest-seuros created this revision.
adrian added a reviewer: drivers.
adrian added a subscriber: drivers.
ngie added inline comments.
sys/dev/acpica/acpi.c
2584–2588

Could you please add references to the ACPI handles in the comment above? Thanks!

ngie added inline comments.
sys/dev/acpica/acpi.c
2587–2605

Maybe something like this? The PNP0C0F description seems a bit wordy in my suggestion TBH, but maybe something like that to communicate that the state of things with absolute clarity?
Alternatively, if you just create a map of the devices--either using constants or using the handles mentioned in the comment--then link to the actual spec, that would help the reader to understand what the code does (and maybe add more driver quirks as needed in the future).

This revision is now accepted and ready to land.Thu, Jul 9, 11:16 PM

Ugh. Didn't mean to "accept" the revision yet - I'm sorry :(.

This revision now requires review to proceed.Thu, Jul 9, 11:16 PM

This is probably ok. I found the original version a bit easier to read and extend, and maybe the way to handle that is to add a new helper function like so:

static bool
acpi_always_present(ACPI_HANDLE handle)
{
    /* Comment for PCI link devices */
    if (acpi_MatchHid(handle, "PNPOCOF")
      return (true);

   ...
  return (false);
}

Then in acpi_probe_child you end up with:

if (type == ACPI_TYPE_DEVICE && !acpi_DeviceIsPresent(child) &&
    !acpi_always_present(handle)) {
    device_disable(child);
    break;
}
sys/dev/acpica/acpi.c
2587–2605

Eh, I think the current comment is fine. The list in the comment is in the same order as the list of checks so it is already clear enough how they match up. Also, the added bit about PCI link devices "BIOS may not allow them to be used" I think isn't correct.

This revision is now accepted and ready to land.Wed, Jul 29, 5:31 PM
jhb added inline comments.
sys/dev/acpica/acpi.c
2493

Cosmetic (and fine to just fix while pushing), but I think it's more extendable in the future if each of these conditions has a comment as it had in the old code) as then when you add a new exception here in the future, you only have to touch one place. It also addresses ngie@'s question about ensuring the comments line up with the relevant code. So something like:

/*
  * PCI link devices sometimes report "present" but not "functional"
  * (i.e. if disabled).  Always probe them since we may enable them
  * later.
  */
if (acpi_MatchHid(...))

(Then you also don't need to duplicate the HID strings in the comment since the comment is right next to the code.)