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)
Sun, Nov 3, 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
Unknown Object (File)
Oct 2 2024, 12:02 AM
Unknown Object (File)
Sep 30 2024, 9:45 AM
Unknown Object (File)
Sep 28 2024, 4:38 AM
Unknown Object (File)
Sep 20 2024, 11:21 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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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
742

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
742

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.