aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/dev-path-parser.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-06efi: dev-path-parser: use acpi_dev_uid_match() for matching _UIDRaag Jadav1-5/+2
Now that we have _UID matching support for integer types, we can use acpi_dev_uid_match() for it. Signed-off-by: Raag Jadav <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2022-09-19efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer()Andy Shevchenko1-4/+6
ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as an integer. Use it instead of custom approach. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2021-07-19ACPI: utils: Fix reference counting in for_each_acpi_dev_match()Andy Shevchenko1-1/+0
Currently it's possible to iterate over the dangling pointer in case the device suddenly disappears. This may happen becase callers put it at the end of a loop. Instead, let's move that call inside acpi_dev_get_next_match_dev(). Fixes: 803abec64ef9 ("media: ipu3-cio2: Add cio2-bridge to ipu3-cio2 driver") Fixes: bf263f64e804 ("media: ACPI / bus: Add acpi_dev_get_next_match_dev() and helper macro") Fixes: edbd1bc4951e ("efi/dev-path-parser: Switch to use for_each_acpi_dev_match()") Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Daniel Scally <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2021-05-22efi/dev-path-parser: Switch to use for_each_acpi_dev_match()Andy Shevchenko1-31/+18
Switch to use for_each_acpi_dev_match() instead of home grown analogue. No functional change intended. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
2020-02-23efi/dev-path-parser: Add struct definition for vendor type device path nodesArd Biesheuvel1-19/+19
In preparation of adding support for loading the initrd via a special device path, add the struct definition of a vendor GUIDed device path node to efi.h. Since we will be producing these data structures rather than just consumsing the ones instantiated by the firmware, refactor the various device path node definitions so we can take the size of each node using sizeof() rather than having to resort to opaque arithmetic in the static initializers. While at it, drop the #if IS_ENABLED() check for the declaration of efi_get_device_by_path(), which is unnecessary, and constify its first argument as well. Signed-off-by: Ard Biesheuvel <[email protected]>
2019-06-24bus_find_device: Unify the match callback with class_find_deviceSuzuki K Poulose1-2/+2
There is an arbitrary difference between the prototypes of bus_find_device() and class_find_device() preventing their callers from passing the same pair of data and match() arguments to both of them, which is the const qualifier used in the prototype of class_find_device(). If that qualifier is also used in the bus_find_device() prototype, it will be possible to pass the same match() callback function to both bus_find_device() and class_find_device(), which will allow some optimizations to be made in order to avoid code duplication going forward. Also with that, constify the "data" parameter as it is passed as a const to the match function. For this reason, change the prototype of bus_find_device() to match the prototype of class_find_device() and adjust its callers to use the const qualifier in accordance with the new prototype of it. Cc: Alexander Shishkin <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Andreas Noever <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Corey Minyard <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: David Kershner <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: David Airlie <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Frank Rowand <[email protected]> Cc: Grygorii Strashko <[email protected]> Cc: Harald Freudenberger <[email protected]> Cc: Hartmut Knaack <[email protected]> Cc: Heiko Stuebner <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Jonathan Cameron <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: Len Brown <[email protected]> Cc: Mark Brown <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michael Jamet <[email protected]> Cc: "Martin K. Petersen" <[email protected]> Cc: Peter Oberparleiter <[email protected]> Cc: Sebastian Ott <[email protected]> Cc: Srinivas Kandagatla <[email protected]> Cc: Yehezkel Bernat <[email protected]> Cc: [email protected] Acked-by: Corey Minyard <[email protected]> Acked-by: David Kershner <[email protected]> Acked-by: Mark Brown <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Acked-by: Srinivas Kandagatla <[email protected]> Acked-by: Wolfram Sang <[email protected]> # for the I2C parts Acked-by: Rob Herring <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-02-04efi: Replace GPL license boilerplate with SPDX headersArd Biesheuvel1-8/+1
Replace all GPL license blurbs with an equivalent SPDX header (most files are GPLv2, some are GPLv2+). While at it, drop some outdated header changelogs as well. Signed-off-by: Ard Biesheuvel <[email protected]> Cc: AKASHI Takahiro <[email protected]> Cc: Alexander Graf <[email protected]> Cc: Bjorn Andersson <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Jeffrey Hugo <[email protected]> Cc: Lee Jones <[email protected]> Cc: Leif Lindholm <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Matt Fleming <[email protected]> Cc: Peter Jones <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sai Praneeth Prakhya <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
2016-11-13efi: Add device path parserLukas Wunner1-0/+203
We're about to extended the efistub to retrieve device properties from EFI on Apple Macs. The properties use EFI Device Paths to indicate the device they belong to. This commit adds a parser which, given an EFI Device Path, locates the corresponding struct device and returns a reference to it. Initially only ACPI and PCI Device Path nodes are supported, these are the only types needed for Apple device properties (the corresponding macOS function AppleACPIPlatformExpert::matchEFIDevicePath() does not support any others). Further node types can be added with little to moderate effort. Apple device properties is currently the only use case of this parser, but Peter Jones intends to use it to match up devices with the ConInDev/ConOutDev/ErrOutDev variables and add sysfs attributes to these devices to say the hardware supports using them as console. Thus, make this parser a separate component which can be selected with config option EFI_DEV_PATH_PARSER. It can in principle be compiled as a module if acpi_get_first_physical_node() and acpi_bus_type are exported (and efi_get_device_by_path() itself is exported). The dependency on CONFIG_ACPI is needed for acpi_match_device_ids(). It can be removed if an empty inline stub is added for that function. Signed-off-by: Lukas Wunner <[email protected]> Signed-off-by: Matt Fleming <[email protected]> Cc: Andreas Noever <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Jones <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>