Lines 550-563
apei_identify(driver_t *driver, device_t parent)
Link Here
|
550 |
{ |
550 |
{ |
551 |
device_t child; |
551 |
device_t child; |
552 |
int found; |
552 |
int found; |
|
|
553 |
ACPI_TABLE_HEADER *hest; |
554 |
ACPI_STATUS status; |
553 |
|
555 |
|
554 |
if (acpi_disabled("apei")) |
556 |
if (acpi_disabled("apei")) |
555 |
return; |
557 |
return; |
556 |
if (acpi_find_table(ACPI_SIG_HEST) == 0) |
558 |
|
|
|
559 |
/* Without HEST table we have nothing to do. */ |
560 |
status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest); |
561 |
if (ACPI_FAILURE(status)) |
557 |
return; |
562 |
return; |
|
|
563 |
AcpiPutTable(hest); |
564 |
|
558 |
/* Only one APEI device can exist. */ |
565 |
/* Only one APEI device can exist. */ |
559 |
if (devclass_get_device(apei_devclass, 0)) |
566 |
if (devclass_get_device(apei_devclass, 0)) |
560 |
return; |
567 |
return; |
|
|
568 |
|
561 |
/* Search for ACPI error device to be used. */ |
569 |
/* Search for ACPI error device to be used. */ |
562 |
found = 0; |
570 |
found = 0; |
563 |
AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
571 |
AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
Lines 564-569
apei_identify(driver_t *driver, device_t parent)
Link Here
|
564 |
100, apei_find, NULL, NULL, (void *)&found); |
572 |
100, apei_find, NULL, NULL, (void *)&found); |
565 |
if (found) |
573 |
if (found) |
566 |
return; |
574 |
return; |
|
|
575 |
|
567 |
/* If not found - create a fake one. */ |
576 |
/* If not found - create a fake one. */ |
568 |
child = BUS_ADD_CHILD(parent, 2, "apei", 0); |
577 |
child = BUS_ADD_CHILD(parent, 2, "apei", 0); |
569 |
if (child == NULL) |
578 |
if (child == NULL) |
Lines 573-590
apei_identify(driver_t *driver, device_t parent)
Link Here
|
573 |
static int |
582 |
static int |
574 |
apei_probe(device_t dev) |
583 |
apei_probe(device_t dev) |
575 |
{ |
584 |
{ |
|
|
585 |
ACPI_TABLE_HEADER *hest; |
586 |
ACPI_STATUS status; |
576 |
int rv; |
587 |
int rv; |
577 |
|
588 |
|
578 |
if (acpi_disabled("apei")) |
589 |
if (acpi_disabled("apei")) |
579 |
return (ENXIO); |
590 |
return (ENXIO); |
580 |
if (acpi_find_table(ACPI_SIG_HEST) == 0) |
591 |
|
581 |
return (ENXIO); |
592 |
if (acpi_get_handle(dev) != NULL) { |
582 |
if (acpi_get_handle(dev) != NULL) |
|
|
583 |
rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) == NULL); |
593 |
rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) == NULL); |
584 |
else |
594 |
if (rv > 0) |
|
|
595 |
return (rv); |
596 |
} else |
585 |
rv = 0; |
597 |
rv = 0; |
586 |
if (rv <= 0) |
598 |
|
587 |
device_set_desc(dev, "Platform Error Interface"); |
599 |
/* Without HEST table we have nothing to do. */ |
|
|
600 |
status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest); |
601 |
if (ACPI_FAILURE(status)) |
602 |
return (ENXIO); |
603 |
AcpiPutTable(hest); |
604 |
|
605 |
device_set_desc(dev, "ACPI Platform Error Interface"); |
588 |
return (rv); |
606 |
return (rv); |
589 |
} |
607 |
} |
590 |
|
608 |
|