svn commit: r364471 - stable/12/sys/dev/acpica
Alexander Motin
mav at FreeBSD.org
Sat Aug 22 00:42:34 UTC 2020
Author: mav
Date: Sat Aug 22 00:42:33 2020
New Revision: 364471
URL: https://svnweb.freebsd.org/changeset/base/364471
Log:
MFC r364407: Unify AcpiGetTable() KPI use in identify, probe and attach.
While there, change probe order to not call AcpiGetTable() for every
probed ACPI device.
PR: 248746
Modified:
stable/12/sys/dev/acpica/acpi_apei.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/acpica/acpi_apei.c
==============================================================================
--- stable/12/sys/dev/acpica/acpi_apei.c Fri Aug 21 23:00:15 2020 (r364470)
+++ stable/12/sys/dev/acpica/acpi_apei.c Sat Aug 22 00:42:33 2020 (r364471)
@@ -550,20 +550,29 @@ apei_identify(driver_t *driver, device_t parent)
{
device_t child;
int found;
+ ACPI_TABLE_HEADER *hest;
+ ACPI_STATUS status;
if (acpi_disabled("apei"))
return;
- if (acpi_find_table(ACPI_SIG_HEST) == 0)
+
+ /* Without HEST table we have nothing to do. */
+ status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest);
+ if (ACPI_FAILURE(status))
return;
+ AcpiPutTable(hest);
+
/* Only one APEI device can exist. */
if (devclass_get_device(apei_devclass, 0))
return;
+
/* Search for ACPI error device to be used. */
found = 0;
AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
100, apei_find, NULL, NULL, (void *)&found);
if (found)
return;
+
/* If not found - create a fake one. */
child = BUS_ADD_CHILD(parent, 2, "apei", 0);
if (child == NULL)
@@ -573,18 +582,27 @@ apei_identify(driver_t *driver, device_t parent)
static int
apei_probe(device_t dev)
{
+ ACPI_TABLE_HEADER *hest;
+ ACPI_STATUS status;
int rv;
if (acpi_disabled("apei"))
return (ENXIO);
- if (acpi_find_table(ACPI_SIG_HEST) == 0)
- return (ENXIO);
- if (acpi_get_handle(dev) != NULL)
+
+ if (acpi_get_handle(dev) != NULL) {
rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) == NULL);
- else
+ if (rv > 0)
+ return (rv);
+ } else
rv = 0;
- if (rv <= 0)
- device_set_desc(dev, "Platform Error Interface");
+
+ /* Without HEST table we have nothing to do. */
+ status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest);
+ if (ACPI_FAILURE(status))
+ return (ENXIO);
+ AcpiPutTable(hest);
+
+ device_set_desc(dev, "ACPI Platform Error Interface");
return (rv);
}
More information about the svn-src-all
mailing list