On Mon, Jan 24, 2022 at 05:31:49PM +0100, Mark Kettenis wrote:
> Currently we attach ACPI devices that are present in a machine.
> However, in some cases ACPI devices can be present, but not enabled.
> Attaching a device driver to devices that are not enabled is not a
> good idea since reading and writing from/to its registers will fail
> and the driver will malfunction in interesting ways.  Such as a com(4)
> serial port that is misdetected and hangs the kernel when it is
> actually opened.
> 
> The diff below makes sure we only enable devices that are actually
> enabled.  This may cause some devices to disappear in OpenBSD.
> However those devices should have been unusable anyway, so that isn't
> an issue.
> 
> ok?

According to the ACPI specification[1]:

> A device can only decode its hardware resources if both bits 0 and 1 are
> set. If the device is not present (bit [0] cleared) or not enabled (bit
> [1] cleared), then the device must not decode its resources.

Should we therefore check for presence of both STA_PRESENT and
STA_ENABLED?

[1] 
https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/06_Device_Configuration/Device_Configuration.html#device-insertion-removal-and-status-objects

Reply via email to