summaryrefslogtreecommitdiff
path: root/static/openbsd/man4/man4.loongson/apm.4
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-25 14:02:27 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-25 14:02:27 -0400
commit6d8bdc65446a704d0750217efd05532fc641ea7d (patch)
tree8ae6d698b3c9801750a8b117b3842fb369872a3a /static/openbsd/man4/man4.loongson/apm.4
parent2f467bd7ff8f8db0dafa40426166491d7f57f368 (diff)
docs: OpenBSD Man Pages Added
Diffstat (limited to 'static/openbsd/man4/man4.loongson/apm.4')
-rw-r--r--static/openbsd/man4/man4.loongson/apm.4211
1 files changed, 211 insertions, 0 deletions
diff --git a/static/openbsd/man4/man4.loongson/apm.4 b/static/openbsd/man4/man4.loongson/apm.4
new file mode 100644
index 00000000..80a0eafb
--- /dev/null
+++ b/static/openbsd/man4/man4.loongson/apm.4
@@ -0,0 +1,211 @@
+.\" $OpenBSD: apm.4,v 1.8 2023/01/30 14:43:29 jcs Exp $
+.\"
+.\" Copyright (c) 1999 Jason L. Wright (jason@thought.net)
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" APM description:
+.\"
+.\" Copyright (c) 1998 Marco S. Hyman
+.\"
+.\" Permission to copy all or part of this material for any purpose is
+.\" granted provided that the above copyright notice and this paragraph
+.\" are duplicated in all copies. THIS SOFTWARE IS PROVIDED ``AS IS''
+.\" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+.\" LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+.\" FOR A PARTICULAR PURPOSE.
+.Dd $Mdocdate: January 30 2023 $
+.Dt APM 4 loongson
+.Os
+.Sh NAME
+.Nm apm
+.Nd advanced power management device interface
+.Sh SYNOPSIS
+.Cd "apm0 at mainbus0"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides generic power and battery control,
+relying on device specific drivers to provide the actual information.
+.Pp
+The
+.Nm
+driver provides an interface which simulates the Advanced Power Management
+.Pq Tn APM
+BIOS functions encountered on some x86 hardware.
+The BIOS functions are translated into the appropriate microcontroller requests
+by the hardware specific drivers, like
+.Xr ykbec 4 .
+Currently only battery level, AC connection, and charging status are available
+from the
+.Nm
+device.
+Suspend/resume and other power events are not yet supported.
+.Pp
+The
+.Nm
+driver implements the following
+.Xr ioctl 2
+calls.
+They are defined in
+.In machine/apmvar.h .
+.Bl -tag -width Ds
+.\" .It Dv APM_IOC_STANDBY
+.\" .Em NOT YET SUPPORTED on loongson
+.\" .Pq Li "no parameters"
+.\" Request
+.\" .Dq standby
+.\" mode.
+.\" .It Dv APM_IOC_SUSPEND
+.\" .Em NOT YET SUPPORTED on loongson
+.\" .Pq Li "no parameters"
+.\" Request
+.\" .Dq suspend
+.\" mode.
+.\" .It Dv APM_IOC_HIBERNATE
+.\" .Em NOT YET SUPPORTED on loongson
+.\" .Pq Li "no parameters"
+.\" Request
+.\" .Dq hibernate
+.\" mode.
+.It Dv APM_IOC_GETPOWER
+.Pq Li "struct apm_power_info"
+Request the current power state.
+The argument structure is as follows:
+.Bd -literal -offset indent
+struct apm_power_info {
+ u_char battery_state;
+ u_char ac_state;
+ u_char battery_life;
+ u_char spare1;
+ u_int minutes_left;
+ u_int spare2[6];
+};
+.Ed
+.Pp
+The following values are defined for
+.Va battery_state :
+.Bl -tag -width Ds
+.It Dv APM_BATT_HIGH
+Battery has a high state of charge.
+.It Dv APM_BATT_LOW
+Battery has a low state of charge.
+.It Dv APM_BATT_CRITICAL
+Battery has a critical state of charge.
+.It Dv APM_BATT_CHARGING
+Battery is not high, low, or critical and is currently charging.
+.It Dv APM_BATT_UNKNOWN
+Cannot read the current battery state.
+.It Dv APM_BATTERY_ABSENT
+No battery installed.
+.El
+.Pp
+The following values are defined for
+.Va ac_state :
+.Bl -tag -width Ds
+.It Dv APM_AC_OFF
+External power not detected.
+.It Dv APM_AC_ON
+External power detected.
+.\" .It Dv APM_AC_BACKUP
+.\" Backup power in use.
+.\" .It Dv APM_AC_UNKNOWN
+.\" External power state unknown.
+.El
+.Pp
+The
+.Va battery_life
+value contains the estimated percentage of battery life available.
+100% indicates a full charge.
+.Pp
+The
+.Va minutes_left
+value contains the estimated number of minutes of battery life remaining.
+.\" .It Dv APM_IOC_DEV_CTL
+.\" .Em NOT YET SUPPORTED on loongson
+.\" .Pq Li "struct apm_ctl"
+.\" Allows an application to directly set the
+.\" .Tm APM
+.\" operating mode.
+.\" The argument structure is as follows:
+.\" .Bd -literal -offset indent
+.\" struct apm_ctl {
+.\" u_int dev;
+.\" u_int mode;
+.\" };
+.\" .Ed
+.\" .Pp
+.\" .Va dev
+.\" indicates the device, typically
+.\" .Dv APM_DEV_ALLDEVS .
+.\" .Pp
+.\" .Va mode
+.\" indicates the desired operating mode.
+.\" Possible values are
+.\" .Bl -tag -compact -offset indent
+.\" .It Dv APM_SYS_READY
+.\" .It Dv APM_SYS_STANDBY
+.\" .It Dv APM_SYS_SUSPEND
+.\" .It Dv APM_SYS_OFF
+.\" .It Dv APM_LASTREQ_INPROG
+.\" .It Dv APM_LASTREQ_REJECTED
+.\" .El
+.It Dv APM_IOC_PRN_CTL
+.Pq Li "int"
+This
+.Xr ioctl 2
+controls message output by the
+.Nm
+driver when a power change event is detected.
+The integer parameter is one of:
+.Bl -tag -width Ds
+.It Dv APM_PRINT_ON
+All power change events result in a message.
+This is the normal operating mode for the driver.
+.It Dv APM_PRINT_OFF
+Power change event messages are suppressed.
+.It Dv APM_PRINT_PCT
+Power change event messages are suppressed unless the estimated
+battery life percentage changes.
+.El
+.El
+.Sh FILES
+.Bl -tag -width /dev/apmctl
+.It Pa /dev/apm
+APM data device.
+May only be opened read-only.
+May be opened by multiple concurrent users.
+.It Pa /dev/apmctl
+APM control device.
+May be opened read-write or write-only.
+May only be opened by one user at a time.
+An attempt to open the file when in use will fail, returning
+.Er EBUSY .
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr ykbec 4 ,
+.Xr apm 8 ,
+.Xr apmd 8
+.Sh BUGS
+Suspend and resume are not supported.