mirror of
https://github.com/systemd/systemd.git
synced 2025-02-14 05:57:40 +03:00
shared/acpi-fpdt: use ENODATA for missing data and skip test
This data is simply missing on non-UEFI systems, and it is useful to distinguish that from corrupted data.
This commit is contained in:
parent
a4bfedec70
commit
67a47c6096
@ -119,7 +119,7 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
|
||||
}
|
||||
|
||||
if (ptr == 0)
|
||||
return -EINVAL;
|
||||
return -ENODATA;
|
||||
|
||||
/* read Firmware Basic Boot Performance Data Record */
|
||||
fd = open("/dev/mem", O_CLOEXEC|O_RDONLY);
|
||||
@ -146,6 +146,10 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
|
||||
if (brec.type != ACPI_FPDT_BOOT_REC)
|
||||
return -EINVAL;
|
||||
|
||||
if (brec.exit_services_exit == 0)
|
||||
/* Non-UEFI compatible boot. */
|
||||
return -ENODATA;
|
||||
|
||||
if (brec.startup_start == 0 || brec.exit_services_exit < brec.startup_start)
|
||||
return -EINVAL;
|
||||
if (brec.exit_services_exit > NSEC_PER_HOUR)
|
||||
|
@ -34,7 +34,7 @@ static int test_acpi_fpdt(void) {
|
||||
|
||||
r = acpi_get_boot_usec(&loader_start, &loader_exit);
|
||||
if (r < 0) {
|
||||
bool ok = r == -ENOENT || (getuid() != 0 && r == -EACCES);
|
||||
bool ok = r == -ENOENT || (getuid() != 0 && r == -EACCES) || r == -ENODATA;
|
||||
|
||||
log_full_errno(ok ? LOG_DEBUG : LOG_ERR,
|
||||
r, "Failed to read ACPI FPDT: %m");
|
||||
|
Loading…
x
Reference in New Issue
Block a user