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)
Fri, Mar 22, 10:42 PM
Unknown Object (File)
Jan 6 2024, 3:34 PM
Unknown Object (File)
Jan 6 2024, 3:09 PM
Unknown Object (File)
Jan 6 2024, 3:06 PM
Unknown Object (File)
Jan 6 2024, 3:06 PM
Unknown Object (File)
Jan 6 2024, 3:06 PM
Unknown Object (File)
Jan 6 2024, 3:06 PM
Unknown Object (File)
Dec 26 2023, 8:46 PM
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 42784
Build 39672: 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
741

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
741

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.