NetBSD Problem Report #53741

From martin@duskware.de  Sun Nov 25 13:20:05 2018
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 993327A172
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 25 Nov 2018 13:20:05 +0000 (UTC)
Message-Id: <20181125131956.264685CC90B@emmas.aprisoft.de>
Date: Sun, 25 Nov 2018 14:19:56 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: /dev/apm is not MI
X-Send-Pr-Version: 3.95

>Number:         53741
>Category:       kern
>Synopsis:       /dev/apm is not MI
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 25 13:25:00 +0000 2018
>Last-Modified:  Sun Nov 25 20:55:01 +0000 2018
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.26
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD painkiller.duskware.de 8.99.26 NetBSD 8.99.26 (GENERIC64) #15: Thu Nov 22 16:54:11 CET 2018 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:

Our /dev/apm is not actually connected to the legacy APM functionality in
old i386 BIOSes, but a (convenient) interface for the MI sysmon/envstat
framework.

However, we only make it available machine/apmdev.h on some architectures.
This sounds wrong (and breaks xfce4-extras compilation on aarch64).

>How-To-Repeat:
Code inspection

>Fix:
Take one version of the include file (sparc?), install it for userland
(in some generic place) and maybe replace the old versions on
architectures that already have it by symlinks to the new location?

>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: kern/53741: /dev/apm is not MI
Date: Sun, 25 Nov 2018 15:13:28 -0500

 On Nov 25,  1:25pm, martin@NetBSD.org (martin@NetBSD.org) wrote:
 -- Subject: kern/53741: /dev/apm is not MI

 | >Number:         53741
 | >Category:       kern
 | >Synopsis:       /dev/apm is not MI
 | >Confidential:   no
 | >Severity:       serious
 | >Priority:       medium
 | >Responsible:    kern-bug-people
 | >State:          open
 | >Class:          sw-bug
 | >Submitter-Id:   net
 | >Arrival-Date:   Sun Nov 25 13:25:00 +0000 2018
 | >Originator:     Martin Husemann
 | >Release:        NetBSD 8.99.26
 | >Organization:
 | The NetBSD Foundation, Inc.
 | >Environment:
 | System: NetBSD painkiller.duskware.de 8.99.26 NetBSD 8.99.26 (GENERIC64) #15: Thu Nov 22 16:54:11 CET 2018 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/evbarm/compile/GENERIC64 evbarm
 | Architecture: aarch64
 | Machine: evbarm
 | >Description:
 | 
 | Our /dev/apm is not actually connected to the legacy APM functionality in
 | old i386 BIOSes, but a (convenient) interface for the MI sysmon/envstat
 | framework.
 | 
 | However, we only make it available machine/apmdev.h on some architectures.
 | This sounds wrong (and breaks xfce4-extras compilation on aarch64).

 I don;t see apmdev, I only see /usr/src/sys/dev/apm/apmio.h and that
 seems mi?

 christos

From: Martin Husemann <martin@duskware.de>
To: Christos Zoulas <christos@zoulas.com>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/53741: /dev/apm is not MI
Date: Sun, 25 Nov 2018 21:53:54 +0100

 Hmm, maybe we should just document this better. The code in question does:

 #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && (defined(i386) || defined(__i386__))
 #include <machine/apm_bios.h>
 #elif (defined(__OpenBSD__) || defined(__NetBSD__))
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #if defined(__sparc64__)
 #include <sparc/apmvar.h>
 #elif defined(__x86_64__)
 #include <dev/apm/apmbios.h>
 #include <dev/apm/apmio.h>
 #else
 #include <machine/apmvar.h>
 #endif
 #define APMDEVICE "/dev/apm"


 ... and as you point out, we can just collapse all of NetBSD in a MI
 way and be done:

 #ifdef __NetBSD__
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <dev/apm/apmbios.h>
 #include <dev/apm/apmio.h>
 #define APMDEVICE "/dev/apm"
 #define _ACPI_APM_BATT_UNKNOWN  0xffff /* from sys/dev/acpi/acpi_apm.c */
 #elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && (defined(i386) || defined(__i386__))


 and this compiles - I'll deal at the pkgsrc level.

 Martin

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.