I want to get info about hardware through UEFI. I know, I can get the efi variables and make dump using fwts tool in Linux. Also, I know about "device" command for EFI shell, which will show me all devices, managed by UEFI. But I don't see the method, how I can get that info from Linux. I know, there is a range of methods to get info about hardware using another tools, but I want to know if this is possible using UEFI (this if for my studying).
There are no devices managed by UEFI. Because the Linux OS called the UEFI ExitBootServices function. This is required to allow the OS to start managing any device at all.
Modern OS's include drivers for hardware devices. A single device should not be driven by two different drivers. This includes parent devices / "buses", which are used to enumerate and communicate with their child devices.
For example, a USB hub on your monitor, which you connect to your computer through a USB-C port, which is on a PCI-E card plugged in to a PCI-E slot on your motherboard. Your boot firmware could have the capability to load an EFI executable from a USB storage device connected to this USB port. But when you run that executable and it calls UEFI ExitBootServices, it is allowed to take control over of all of these.
So the general rule is that the OS is what enumerates the connected hardware. The firmware no longer has control. You cannot ask the firmware to enumerate currently connected hardware and get any sensible result.
There are exceptions to the general rule. They are all very horrible to deal with. The question as written does not include any reason to enumerate all the exceptions that apply on your machine. So don't do that.
Some hardware information is available through ACPI and DMI. The ACPI tables are technically provided through UEFI, by virtue of passing one pointer (and I suppose by leaving the relevant memory reserved, in the memory map which the OS is passed by UEFI). Presumably DMI is similar.
The DMI command is
dmidecode. DMI mostly seems to be a collection of identifiers. Some of them are gathered from the hardware at boot time. Neither of these is required to be comprehensive, so basically you need to have bus drivers to find all the hardware devices you need.
There are a number of ACPI commands including
acpixtract. One of the tools is a disassembler for an interpreted language called AML, which the OS runs on various occasions.
AML may sound somewhat horrible, but it is at least designed so you can avoid having an OS driver and an AML driver associated with the same hardware, and causing conflicts. For example the OS has a driver for an Embedded Controller device, and AML can actually talk to the OS driver. Or ACPI can reserve certain hardware resources, so that AML can use them directly, and the OS knows it is not allowed to use them.
ACPI also replaces the previous version of ISA PNP. This is used to enumerate legacy devices like serial ports, where they cannot be enumerated by the OS itself.
Similarly, ACPI is nominally responsible for telling the OS to look for the initial PCI registers or IO memory addresses. (I'm not up to date here. But if ACPI says there aren't any, I can imagine that Linux would try to probe the normal address for this anyway).
A lot of devices are accessed through the PCI bus, directly or indirectly.
IIRC Windows will expose this in Device Manager by showing PCI as a child device of ACPI. Linux doesn't seem to bother (I have
pci0000:00/ directly in
/sys/devices); I don't remember whether ACPI->PCI is in a specialized format that there's basically no point exposing, or whether it's Linux that special-cases it and doesn't bother to expose ACPI as the parent device.