summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2022-10-25 12:50:09 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2022-10-31 21:12:12 +0100
commitf80b7d1a89abd686931f845a3582329bce1f3fd6 (patch)
treef7c3e729d165b92b6de88421987c6eadbb5af0fa /src
parent85bc6b05491fb4c9f40f8a0e8615ac5321efbea0 (diff)
downloadsystemd-f80b7d1a89abd686931f845a3582329bce1f3fd6.tar.gz
udev: Handle AMBA bus the same way as generic platform bus
On various ARM systems, it is possible to find devices on AMBA bus. This is defined in Linux kernel drivers/amba/bus.c as separate bus type. Udev currently does not recognize this when building ID_PATH which leads to ID_PATH containing the suffix from next recognized parent device. On ST STM32MP15xx with SDIO WiFi, the ID_PATH looks like 'platform-soc', which is not unique and basically useless. On NXP i.MX8M Plus with SDIO WiFi, ID_PATH is 'platform-30b40000.mmc' which is far more useful. Add the 'amba' subsystem handling the same way 'platform' subsystem is handled to get ID_PATH 'platform-soc-amba-48004000.sdmmc' on the former, which is far more useful compared to 'platform-soc'. --- ``` $ udevadm info --attribute-walk --path=/devices/platform/soc/48004000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/net/wlan0 Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/platform/soc/48004000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/net/wlan0': KERNEL=="wlan0" SUBSYSTEM=="net" DRIVER=="" ATTR{addr_assign_type}=="0" ATTR{addr_len}=="6" ATTR{address}=="10:98:c3:5f:4b:80" ATTR{broadcast}=="ff:ff:ff:ff:ff:ff" ATTR{carrier_changes}=="1" ATTR{carrier_down_count}=="1" ATTR{carrier_up_count}=="0" ATTR{dev_id}=="0x0" ATTR{dev_port}=="0" ATTR{flags}=="0x1002" ATTR{gro_flush_timeout}=="0" ATTR{ifalias}=="" ATTR{ifindex}=="3" ATTR{iflink}=="3" ATTR{link_mode}=="0" ATTR{mtu}=="1500" ATTR{napi_defer_hard_irqs}=="0" ATTR{netdev_group}=="0" ATTR{operstate}=="down" ATTR{power/control}=="auto" ATTR{power/runtime_active_time}=="0" ATTR{power/runtime_status}=="unsupported" ATTR{power/runtime_suspended_time}=="0" ATTR{proto_down}=="0" ATTR{queues/rx-0/rps_cpus}=="0" ATTR{queues/rx-0/rps_flow_cnt}=="0" ATTR{queues/tx-0/byte_queue_limits/hold_time}=="1000" ATTR{queues/tx-0/byte_queue_limits/inflight}=="0" ATTR{queues/tx-0/byte_queue_limits/limit}=="0" ATTR{queues/tx-0/byte_queue_limits/limit_max}=="1879048192" ATTR{queues/tx-0/byte_queue_limits/limit_min}=="0" ATTR{queues/tx-0/tx_maxrate}=="0" ATTR{queues/tx-0/tx_timeout}=="0" ATTR{queues/tx-0/xps_rxqs}=="0" ATTR{statistics/collisions}=="0" ATTR{statistics/multicast}=="0" ATTR{statistics/rx_bytes}=="0" ATTR{statistics/rx_compressed}=="0" ATTR{statistics/rx_crc_errors}=="0" ATTR{statistics/rx_dropped}=="0" ATTR{statistics/rx_errors}=="0" ATTR{statistics/rx_fifo_errors}=="0" ATTR{statistics/rx_frame_errors}=="0" ATTR{statistics/rx_length_errors}=="0" ATTR{statistics/rx_missed_errors}=="0" ATTR{statistics/rx_nohandler}=="0" ATTR{statistics/rx_over_errors}=="0" ATTR{statistics/rx_packets}=="0" ATTR{statistics/tx_aborted_errors}=="0" ATTR{statistics/tx_bytes}=="0" ATTR{statistics/tx_carrier_errors}=="0" ATTR{statistics/tx_compressed}=="0" ATTR{statistics/tx_dropped}=="0" ATTR{statistics/tx_errors}=="0" ATTR{statistics/tx_fifo_errors}=="0" ATTR{statistics/tx_heartbeat_errors}=="0" ATTR{statistics/tx_packets}=="0" ATTR{statistics/tx_window_errors}=="0" ATTR{threaded}=="0" ATTR{tx_queue_len}=="1000" ATTR{type}=="1" looking at parent device '/devices/platform/soc/48004000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1': KERNELS=="mmc1:0001:1" SUBSYSTEMS=="sdio" DRIVERS=="brcmfmac" ATTRS{class}=="0x00" ATTRS{coredump}=="(write-only)" ATTRS{device}=="0xa9bf" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" ATTRS{revision}=="0.0" ATTRS{vendor}=="0x02d0" looking at parent device '/devices/platform/soc/48004000.mmc/mmc_host/mmc1/mmc1:0001': KERNELS=="mmc1:0001" SUBSYSTEMS=="mmc" DRIVERS=="" ATTRS{device}=="0xa9bf" ATTRS{ocr}=="0x00200000" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" ATTRS{rca}=="0x0001" ATTRS{revision}=="0.0" ATTRS{type}=="SDIO" ATTRS{vendor}=="0x02d0" looking at parent device '/devices/platform/soc/48004000.mmc/mmc_host/mmc1': KERNELS=="mmc1" SUBSYSTEMS=="mmc_host" DRIVERS=="" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" looking at parent device '/devices/platform/soc/48004000.mmc': KERNELS=="48004000.mmc" SUBSYSTEMS=="amba" <------------------------------------------------------- AMBA is here DRIVERS=="mmci-pl18x" ATTRS{driver_override}=="(null)" ATTRS{id}=="00253180" ATTRS{power/autosuspend_delay_ms}=="50" ATTRS{power/control}=="on" ATTRS{power/runtime_active_time}=="666709" ATTRS{power/runtime_status}=="active" ATTRS{power/runtime_suspended_time}=="0" looking at parent device '/devices/platform/soc': KERNELS=="soc" SUBSYSTEMS=="platform" DRIVERS=="simple-pm-bus" ATTRS{driver_override}=="(null)" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" looking at parent device '/devices/platform': KERNELS=="platform" SUBSYSTEMS=="" DRIVERS=="" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" ```
Diffstat (limited to 'src')
-rw-r--r--src/udev/udev-builtin-path_id.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index d58a3d5d60..8e4d57ee72 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -631,6 +631,13 @@ static int builtin_path_id(sd_device *dev, sd_netlink **rtnl, int argc, char *ar
parent = skip_subsystem(parent, "platform");
supported_transport = true;
supported_parent = true;
+ } else if (streq(subsys, "amba")) {
+ path_prepend(&path, "amba-%s", sysname);
+ if (compat_path)
+ path_prepend(&compat_path, "amba-%s", sysname);
+ parent = skip_subsystem(parent, "amba");
+ supported_transport = true;
+ supported_parent = true;
} else if (streq(subsys, "acpi")) {
path_prepend(&path, "acpi-%s", sysname);
if (compat_path)