Page MenuHomeFreeBSD

bus: Add ACPI locator support
ClosedPublic

Authored by imp on Oct 30 2021, 12:53 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 12, 6:40 AM
Unknown Object (File)
Mon, Nov 25, 6:14 AM
Unknown Object (File)
Wed, Nov 20, 6:31 PM
Unknown Object (File)
Wed, Nov 20, 6:29 PM
Unknown Object (File)
Nov 3 2024, 9:58 PM
Unknown Object (File)
Oct 4 2024, 6:04 PM
Unknown Object (File)
Oct 4 2024, 7:33 AM
Unknown Object (File)
Oct 2 2024, 12:57 AM
Subscribers

Details

Summary

Add support for printing ACPI paths. This is a bit of a degenerate case
for this interface since it's always just the device handle if the
device has one. But it is illustrtive of how to do this for a few nodes
in the tree.

Sponsored by: Netflix

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42548
Build 39436: arc lint + arc unit

Event Timeline

imp requested review of this revision.Oct 30 2021, 12:53 AM
sys/dev/acpica/acpi.c
935

You could take advantage of all of the ACPI-aware buses supporting the ACPI handle ivar to make this a shared function across the various ACPI-aware buses. Something like:

int
acpi_get_device_path(device_t bus, device_t child, const char *locator, struct sbuf *sb)
{
     if (strcmp(locator, BUS_LOCATOR_ACPI) == 0) {
         ACPI_HANDLE *handle = acpi_get_handle(child);

         if (handle != NULL)
              sbuf_printf(sb, "%s", acpi_name(handle);
         return (0);
    }

    return (bus_generic_get_device_path(bus, child, locator, sb));
}

I think all of the buses you patch here could then just reuse that directly (some of them might later have to still grow a driver-specific method for UEFI, but that could at least call this shared routine after handling UEFI).

sys/sys/bus.h
740

Maybe sort these somehow, e.g. alphabetically? Probably make the first commit that adds UEFI follow whatever convention you decide to follow?

Should this review also update the devctl manpage?

imp marked an inline comment as done.Nov 5 2021, 11:29 PM
imp added inline comments.
sys/sys/bus.h
740

sure.

imp marked an inline comment as done.EditedNov 5 2021, 11:30 PM
In D32748#741302, @jhb wrote:

Should this review also update the devctl manpage?

I thought I'd already updated it elsewhere. Or maybe I should ask 'which devctl man page?'

imp marked an inline comment as done.Nov 15 2021, 4:07 PM

update, per review comments, rebase, likely randomly break something subtle

This revision is now accepted and ready to land.Nov 29 2021, 5:35 PM
This revision was automatically updated to reflect the committed changes.