On Mon, Jan 24, 2022 at 12:15:58PM -0800, Philip Guenther wrote: > On Mon, Jan 24, 2022 at 11:41 AM Mark Kettenis <[email protected]> > wrote: > > > > Date: Mon, 24 Jan 2022 20:19:46 +0100 > > > From: Anton Lindqvist <[email protected]> > > > > > > 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. > > > > Just before that it says: > > > > If bit [0] is cleared, then bit 1 must also be cleared (in other > > words, a device that is not present cannot be enabled). > > > > > Should we therefore check for presence of both STA_PRESENT and > > > STA_ENABLED? > > > > So according to the ACPI specification we don't need to do that. > > Should we do it just to be safe? > > > > Unless you're taking money bets about this being the one thing in the ACPI > spec that some vendor won't screw up, doing both seems "can't be worse; can > be better". > > Philip
A bit late to the party here, but we should all remember the HP bios with the FACS table version of "1" and not 1. (0x31 and not 0x01). So yes, someone will indeed screw it up if it's possible to screw it up.
