aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig8
-rw-r--r--lib/acpi/acpi_device.c27
-rw-r--r--lib/efi_loader/Kconfig3
-rw-r--r--lib/efi_loader/efi_device_path.c4
-rw-r--r--lib/fdtdec.c11
5 files changed, 26 insertions, 27 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index 06eb8d0..a704568 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -699,3 +699,11 @@ config LIB_ELF
This supports fir 32 bit and 64 bit versions.
endmenu
+
+config PHANDLE_CHECK_SEQ
+ bool "Enable phandle check while getting sequence number"
+ default n
+ help
+ When there are multiple device tree nodes with same name,
+ enable this config option to distinguish them using
+ phandles in fdtdec_get_alias_seq() function.
diff --git a/lib/acpi/acpi_device.c b/lib/acpi/acpi_device.c
index 8efa8e9..b5f2ceb 100644
--- a/lib/acpi/acpi_device.c
+++ b/lib/acpi/acpi_device.c
@@ -784,16 +784,6 @@ static const char *acpi_name_from_id(enum uclass_id id)
}
}
-static int acpi_check_seq(const struct udevice *dev)
-{
- if (dev->req_seq == -1) {
- log_warning("Device '%s' has no seq\n", dev->name);
- return log_msg_ret("no seq", -ENXIO);
- }
-
- return dev->req_seq;
-}
-
/* If you change this function, add test cases to dm_test_acpi_get_name() */
int acpi_device_infer_name(const struct udevice *dev, char *out_name)
{
@@ -826,29 +816,18 @@ int acpi_device_infer_name(const struct udevice *dev, char *out_name)
}
}
if (!name) {
- int num;
-
switch (id) {
/* DSDT: acpi/lpss.asl */
case UCLASS_SERIAL:
- num = acpi_check_seq(dev);
- if (num < 0)
- return num;
- sprintf(out_name, "URT%d", num);
+ sprintf(out_name, "URT%d", dev_seq(dev));
name = out_name;
break;
case UCLASS_I2C:
- num = acpi_check_seq(dev);
- if (num < 0)
- return num;
- sprintf(out_name, "I2C%d", num);
+ sprintf(out_name, "I2C%d", dev_seq(dev));
name = out_name;
break;
case UCLASS_SPI:
- num = acpi_check_seq(dev);
- if (num < 0)
- return num;
- sprintf(out_name, "SPI%d", num);
+ sprintf(out_name, "SPI%d", dev_seq(dev));
name = out_name;
break;
default:
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 8746e10..073d90c 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -233,7 +233,8 @@ config EFI_HAVE_RUNTIME_RESET
# bool "Reset runtime service is available"
bool
default y
- depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || SYSRESET_X86
+ depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || \
+ SANDBOX || SYSRESET_X86
config EFI_GRUB_ARM32_WORKAROUND
bool "Workaround for GRUB on 32bit ARM"
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 78191f6..99b5078 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -624,7 +624,7 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
DEVICE_PATH_SUB_TYPE_MSG_SD :
DEVICE_PATH_SUB_TYPE_MSG_MMC;
sddp->dp.length = sizeof(*sddp);
- sddp->slot_number = dev->seq;
+ sddp->slot_number = dev_seq(dev);
return &sddp[1];
}
#endif
@@ -677,7 +677,7 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
DEVICE_PATH_SUB_TYPE_MSG_SD :
DEVICE_PATH_SUB_TYPE_MSG_MMC;
sddp->dp.length = sizeof(*sddp);
- sddp->slot_number = dev->seq;
+ sddp->slot_number = dev_seq(dev);
return &sddp[1];
}
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index ee1bd41..0ab7105 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -500,6 +500,17 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
slash = strrchr(prop, '/');
if (strcmp(slash + 1, find_name))
continue;
+
+ /*
+ * Adding an extra check to distinguish DT nodes with
+ * same name
+ */
+ if (IS_ENABLED(CONFIG_PHANDLE_CHECK_SEQ)) {
+ if (fdt_get_phandle(blob, offset) !=
+ fdt_get_phandle(blob, fdt_path_offset(blob, prop)))
+ continue;
+ }
+
val = trailing_strtol(name);
if (val != -1) {
*seqp = val;