Page MenuHomeFreeBSD

bus: Add ACPI locator support

Authored by imp on Oct 30 2021, 12:53 AM.



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

rS FreeBSD src repository - subversion
Lint OK
No Unit 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

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:

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).


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.


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