From a5d791995969c6f12ab82f251035e0d5015268e2 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 26 Dec 2021 13:55:36 +0000 Subject: [PATCH] Add address locators for the ACPI "bus" and use these to fix the order of the com(4) devices to match the traditional order one the ISA bus. ok patrick@, anton@ --- sys/arch/amd64/conf/GENERIC | 10 +++++----- sys/arch/amd64/conf/RAMDISK | 6 +++--- sys/arch/amd64/conf/RAMDISK_CD | 8 ++++---- sys/dev/acpi/acpivar.h | 6 +++++- sys/dev/acpi/com_acpi.c | 5 ++++- sys/dev/acpi/files.acpi | 4 ++-- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index ea3624ddc94..54274b1e80a 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.507 2021/12/20 14:54:37 hastings Exp $ +# $OpenBSD: GENERIC,v 1.508 2021/12/26 13:55:36 kettenis Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -65,10 +65,10 @@ amdgpio* at acpi? aplgpio* at acpi? bytgpio* at acpi? chvgpio* at acpi? -com0 at acpi? -com1 at acpi? -com2 at acpi? -com3 at acpi? +com0 at acpi? addr 0x3f8 +com1 at acpi? addr 0x2f8 +com2 at acpi? addr 0x3e8 +com3 at acpi? addr 0x2e8 com* at acpi? glkgpio* at acpi? pchgpio* at acpi? diff --git a/sys/arch/amd64/conf/RAMDISK b/sys/arch/amd64/conf/RAMDISK index 7141e7a7762..cfa1dcac4a2 100644 --- a/sys/arch/amd64/conf/RAMDISK +++ b/sys/arch/amd64/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.84 2021/12/16 08:03:17 anton Exp $ +# $OpenBSD: RAMDISK,v 1.85 2021/12/26 13:55:36 kettenis Exp $ machine amd64 maxusers 4 @@ -34,8 +34,8 @@ acpipci* at acpi? acpiprt* at acpi? acpimadt0 at acpi? #acpitz* at acpi? -com0 at acpi? -com1 at acpi? +com0 at acpi? addr 0x3f8 +com1 at acpi? addr 0x2f8 com* at acpi? mpbios0 at bios0 diff --git a/sys/arch/amd64/conf/RAMDISK_CD b/sys/arch/amd64/conf/RAMDISK_CD index 6fa3436a835..4c5c5e90600 100644 --- a/sys/arch/amd64/conf/RAMDISK_CD +++ b/sys/arch/amd64/conf/RAMDISK_CD @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK_CD,v 1.196 2021/12/20 14:54:37 hastings Exp $ +# $OpenBSD: RAMDISK_CD,v 1.197 2021/12/26 13:55:36 kettenis Exp $ machine amd64 maxusers 4 @@ -51,9 +51,9 @@ bytgpio* at acpi? sdhc* at acpi? acpihve* at acpi? chvgpio* at acpi? -com0 at acpi? -com1 at acpi? -com2 at acpi? +com0 at acpi? addr 0x3f8 +com1 at acpi? addr 0x2f8 +com2 at acpi? addr 0x3e8 com* at acpi? glkgpio* at acpi? diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index ff369eeb5eb..706a2ae2147 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.114 2021/03/15 22:44:57 patrick Exp $ */ +/* $OpenBSD: acpivar.h,v 1.115 2021/12/26 13:55:36 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -56,6 +56,10 @@ struct acpivideo_softc { struct aml_node *sc_devnode; }; +#define ACPIDEVCF_ADDR 0 +#define acpidevcf_addr cf_loc[ACPIDEVCF_ADDR] +#define ACPIDEVCF_ADDR_UNK -1 + struct acpi_attach_args { char *aaa_name; bus_space_tag_t aaa_iot; diff --git a/sys/dev/acpi/com_acpi.c b/sys/dev/acpi/com_acpi.c index 205893403cc..9643fcb9d11 100644 --- a/sys/dev/acpi/com_acpi.c +++ b/sys/dev/acpi/com_acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_acpi.c,v 1.5 2021/12/21 06:10:29 anton Exp $ */ +/* $OpenBSD: com_acpi.c,v 1.6 2021/12/26 13:55:36 kettenis Exp $ */ /* * Copyright (c) 2018 Mark Kettenis * @@ -65,6 +65,9 @@ com_acpi_match(struct device *parent, void *match, void *aux) if (aaa->aaa_naddr < 1 || aaa->aaa_nirq < 1) return 0; + if (cf->acpidevcf_addr != aaa->aaa_addr[0] && + cf->acpidevcf_addr != ACPIDEVCF_ADDR_UNK) + return 0; return acpi_matchhids(aaa, com_hids, cf->cf_driver->cd_name); } diff --git a/sys/dev/acpi/files.acpi b/sys/dev/acpi/files.acpi index faef7f925ee..95df4ffe448 100644 --- a/sys/dev/acpi/files.acpi +++ b/sys/dev/acpi/files.acpi @@ -1,9 +1,9 @@ -# $OpenBSD: files.acpi,v 1.62 2020/12/06 20:39:07 kettenis Exp $ +# $OpenBSD: files.acpi,v 1.63 2021/12/26 13:55:36 kettenis Exp $ # # Config file and device description for machine-independent ACPI code. # Included by ports that need it. -define acpi {} +define acpi {[addr = -1]} device acpi file dev/acpi/acpi.c acpi needs-flag file dev/acpi/acpiutil.c acpi -- 2.20.1