The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/x86/include/apm_bios.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * APM (Advanced Power Management) BIOS Device Driver
    3  *
    4  * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
    5  *
    6  * This software may be used, modified, copied, and distributed, in
    7  * both source and binary form provided that the above copyright and
    8  * these terms are retained. Under no circumstances is the author
    9  * responsible for the proper functioning of this software, nor does
   10  * the author assume any responsibility for damages incurred with its
   11  * use.
   12  *
   13  * Aug, 1994    Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
   14  *
   15  * $FreeBSD: releng/10.4/sys/x86/include/apm_bios.h 215140 2010-11-11 19:36:21Z jkim $
   16  */
   17 
   18 #ifndef _X86_APM_BIOS_H_
   19 #define _X86_APM_BIOS_H_
   20 
   21 #ifndef _KERNEL
   22 #include <sys/types.h>
   23 #endif
   24 #include <sys/ioccom.h>
   25 
   26 /* BIOS id */
   27 #define APM_BIOS                0x53
   28 #define APM_INT                 0x15
   29 
   30 /* APM flags */
   31 #define APM_16BIT_SUPPORT       0x01
   32 #define APM_32BIT_SUPPORT       0x02
   33 #define APM_CPUIDLE_SLOW        0x04
   34 #define APM_DISABLED            0x08
   35 #define APM_DISENGAGED          0x10
   36 
   37 /* APM initializer physical address */
   38 #define APM_OURADDR             0x00080000
   39 
   40 /* APM functions */
   41 #define APM_INSTCHECK           0x00
   42 #define APM_REALCONNECT         0x01
   43 #define APM_PROT16CONNECT       0x02
   44 #define APM_PROT32CONNECT       0x03
   45 #define APM_DISCONNECT          0x04
   46 #define APM_CPUIDLE             0x05
   47 #define APM_CPUBUSY             0x06
   48 #define APM_SETPWSTATE          0x07
   49 #define APM_ENABLEDISABLEPM     0x08
   50 #define APM_RESTOREDEFAULT      0x09
   51 #define APM_GETPWSTATUS         0x0a
   52 #define APM_GETPMEVENT          0x0b
   53 #define APM_GETPWSTATE          0x0c
   54 #define APM_ENABLEDISABLEDPM    0x0d
   55 #define APM_DRVVERSION          0x0e
   56 #define APM_ENGAGEDISENGAGEPM   0x0f
   57 #define APM_GETCAPABILITIES     0x10
   58 #define APM_RESUMETIMER         0x11
   59 #define APM_RESUMEONRING        0x12
   60 #define APM_TIMERREQUESTS       0x13
   61 #define APM_OEMFUNC             0x80
   62 
   63 /* error code */
   64 #define APME_OK                 0x00
   65 #define APME_PMDISABLED         0x01
   66 #define APME_REALESTABLISHED    0x02
   67 #define APME_NOTCONNECTED       0x03
   68 #define APME_PROT16ESTABLISHED  0x05
   69 #define APME_PROT16NOTSUPPORTED 0x06
   70 #define APME_PROT32ESTABLISHED  0x07
   71 #define APME_PROT32NOTDUPPORTED 0x08
   72 #define APME_UNKNOWNDEVICEID    0x09
   73 #define APME_OUTOFRANGE         0x0a
   74 #define APME_NOTENGAGED         0x0b
   75 #define APME_CANTENTERSTATE     0x60
   76 #define APME_NOPMEVENT          0x80
   77 #define APME_NOAPMPRESENT       0x86
   78 
   79 
   80 /* device code */
   81 #define PMDV_APMBIOS            0x0000
   82 #define PMDV_ALLDEV             0x0001
   83 #define PMDV_DISP0              0x0100
   84 #define PMDV_DISP1              0x0101
   85 #define PMDV_DISPALL            0x01ff
   86 #define PMDV_2NDSTORAGE0        0x0200
   87 #define PMDV_2NDSTORAGE1        0x0201
   88 #define PMDV_2NDSTORAGE2        0x0202
   89 #define PMDV_2NDSTORAGE3        0x0203
   90 #define PMDV_PARALLEL0          0x0300
   91 #define PMDV_PARALLEL1          0x0301
   92 #define PMDV_SERIAL0            0x0400
   93 #define PMDV_SERIAL1            0x0401
   94 #define PMDV_SERIAL2            0x0402
   95 #define PMDV_SERIAL3            0x0403
   96 #define PMDV_SERIAL4            0x0404
   97 #define PMDV_SERIAL5            0x0405
   98 #define PMDV_SERIAL6            0x0406
   99 #define PMDV_SERIAL7            0x0407
  100 #define PMDV_NET0               0x0500
  101 #define PMDV_NET1               0x0501
  102 #define PMDV_NET2               0x0502
  103 #define PMDV_NET3               0x0503
  104 #define PMDV_PCMCIA0            0x0600
  105 #define PMDV_PCMCIA1            0x0601
  106 #define PMDV_PCMCIA2            0x0602
  107 #define PMDV_PCMCIA3            0x0603
  108 /* 0x0700 - 0x7fff      Reserved                        */
  109 #define PMDV_BATT_BASE          0x8000
  110 #define PMDV_BATT0              0x8001
  111 #define PMDV_BATT1              0x8002
  112 #define PMDV_BATT_ALL           0x80ff
  113 /* 0x8100 - 0xdfff      Reserved                        */
  114 /* 0xe000 - 0xefff      OEM-defined power device IDs    */
  115 /* 0xf000 - 0xffff      Reserved                        */
  116 
  117 /* Power state */
  118 #define PMST_APMENABLED         0x0000
  119 #define PMST_STANDBY            0x0001
  120 #define PMST_SUSPEND            0x0002
  121 #define PMST_OFF                0x0003
  122 #define PMST_LASTREQNOTIFY      0x0004
  123 #define PMST_LASTREQREJECT      0x0005
  124 /* 0x0006 - 0x001f      Reserved system states          */
  125 /* 0x0020 - 0x003f      OEM-defined system states       */
  126 /* 0x0040 - 0x007f      OEM-defined device states       */
  127 /* 0x0080 - 0xffff      Reserved device states          */
  128 
  129 #if !defined(ASSEMBLER) && !defined(INITIALIZER)
  130 
  131 /* C definitions */
  132 struct apmhook {
  133         struct apmhook  *ah_next;
  134         int             (*ah_fun)(void *ah_arg);
  135         void            *ah_arg;
  136         const char      *ah_name;
  137         int             ah_order;
  138 };
  139 #define APM_HOOK_NONE           (-1)
  140 #define APM_HOOK_SUSPEND        0
  141 #define APM_HOOK_RESUME         1
  142 #define NAPM_HOOK               2
  143 
  144 #ifdef _KERNEL
  145 
  146 void apm_suspend(int state);
  147 struct apmhook *apm_hook_establish (int apmh, struct apmhook *);
  148 void apm_hook_disestablish (int apmh, struct apmhook *);
  149 void apm_cpu_idle(void);
  150 void apm_cpu_busy(void);
  151 
  152 #endif
  153 
  154 #endif /* !ASSEMBLER && !INITIALIZER */
  155 
  156 #define APM_MIN_ORDER           0x00
  157 #define APM_MID_ORDER           0x80
  158 #define APM_MAX_ORDER           0xff
  159 
  160 /* power management event code */
  161 #define PMEV_NOEVENT            0x0000
  162 #define PMEV_STANDBYREQ         0x0001
  163 #define PMEV_SUSPENDREQ         0x0002
  164 #define PMEV_NORMRESUME         0x0003
  165 #define PMEV_CRITRESUME         0x0004
  166 #define PMEV_BATTERYLOW         0x0005
  167 #define PMEV_POWERSTATECHANGE   0x0006
  168 #define PMEV_UPDATETIME         0x0007
  169 #define PMEV_CRITSUSPEND        0x0008
  170 #define PMEV_USERSTANDBYREQ     0x0009
  171 #define PMEV_USERSUSPENDREQ     0x000a
  172 #define PMEV_STANDBYRESUME      0x000b
  173 #define PMEV_CAPABILITIESCHANGE 0x000c
  174 /* 0x000d - 0x00ff      Reserved system events  */
  175 /* 0x0100 - 0x01ff      Reserved device events  */
  176 /* 0x0200 - 0x02ff      OEM-defined APM events  */
  177 /* 0x0300 - 0xffff      Reserved                */
  178 #define PMEV_DEFAULT            0xffffffff      /* used for customization */
  179 
  180 #if !defined(ASSEMBLER) && !defined(INITIALIZER)
  181 
  182 /*
  183  * Old apm_info structure, returned by the APMIO_GETINFO_OLD ioctl.  This
  184  * is for backward compatibility with old executables.
  185  */
  186 typedef struct apm_info_old {
  187         u_int   ai_major;       /* APM major version */
  188         u_int   ai_minor;       /* APM minor version */
  189         u_int   ai_acline;      /* AC line status */
  190         u_int   ai_batt_stat;   /* Battery status */
  191         u_int   ai_batt_life;   /* Remaining battery life */
  192         u_int   ai_status;      /* Status of APM support (enabled/disabled) */
  193 } *apm_info_old_t;
  194 
  195 /*
  196  * Structure returned by the APMIO_GETINFO ioctl.
  197  *
  198  * In the comments below, the parenthesized numbers indicate the minimum
  199  * value of ai_infoversion for which each field is valid.
  200  */
  201 typedef struct apm_info {
  202         u_int   ai_infoversion; /* Indicates which fields are valid */
  203         u_int   ai_major;       /* APM major version (0) */
  204         u_int   ai_minor;       /* APM minor version (0) */
  205         u_int   ai_acline;      /* AC line status (0) */
  206         u_int   ai_batt_stat;   /* Battery status (0) */
  207         u_int   ai_batt_life;   /* Remaining battery life in percent (0) */
  208         int     ai_batt_time;   /* Remaining battery time in seconds (0) */
  209         u_int   ai_status;      /* True if enabled (0) */
  210         u_int   ai_batteries;   /* Number of batteries (1) */
  211         u_int   ai_capabilities;/* APM Capabilities (1) */
  212         u_int   ai_spare[6];    /* For future expansion */
  213 } *apm_info_t;
  214 
  215 /* Battery flag */
  216 #define APM_BATT_HIGH           0x01
  217 #define APM_BATT_LOW            0x02
  218 #define APM_BATT_CRITICAL       0x04
  219 #define APM_BATT_CHARGING       0x08
  220 #define APM_BATT_NOT_PRESENT    0x10
  221 #define APM_BATT_NO_SYSTEM      0x80
  222 
  223 typedef struct apm_pwstatus {
  224         u_int   ap_device;      /* Device code of battery */
  225         u_int   ap_acline;      /* AC line status (0) */
  226         u_int   ap_batt_stat;   /* Battery status (0) */
  227         u_int   ap_batt_flag;   /* Battery flag (0) */
  228         u_int   ap_batt_life;   /* Remaining battery life in percent (0) */
  229         int     ap_batt_time;   /* Remaining battery time in seconds (0) */
  230 } *apm_pwstatus_t;
  231 
  232 struct apm_bios_arg {
  233         uint32_t eax;
  234         uint32_t ebx;
  235         uint32_t ecx;
  236         uint32_t edx;
  237         uint32_t esi;
  238         uint32_t edi;
  239 };
  240 
  241 struct apm_event_info {
  242         u_int type;
  243         u_int index;
  244         u_int spare[8];
  245 };
  246 
  247 #define APMIO_SUSPEND           _IO('P', 1)
  248 #define APMIO_GETINFO_OLD       _IOR('P', 2, struct apm_info_old)
  249 #define APMIO_ENABLE            _IO('P', 5)
  250 #define APMIO_DISABLE           _IO('P', 6)
  251 #define APMIO_HALTCPU           _IO('P', 7)
  252 #define APMIO_NOTHALTCPU        _IO('P', 8)
  253 #define APMIO_DISPLAY           _IOW('P', 9, int)
  254 #define APMIO_BIOS              _IOWR('P', 10, struct apm_bios_arg)
  255 #define APMIO_GETINFO           _IOR('P', 11, struct apm_info)
  256 #define APMIO_STANDBY           _IO('P', 12)
  257 #define APMIO_GETPWSTATUS       _IOWR('P', 13, struct apm_pwstatus)
  258 /* for /dev/apmctl */
  259 #define APMIO_NEXTEVENT         _IOR('A', 100, struct apm_event_info)
  260 #define APMIO_REJECTLASTREQ     _IO('P', 101)
  261 
  262 #endif /* !ASSEMBLER && !INITIALIZER */
  263 
  264 #endif /* !_X86_APM_BIOS_H_ */

Cache object: 9522b36a013a1004cb15a2756c571247


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.