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/i386/include/apm_bios.h

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

Cache object: 3d76c105cbb0444d25b5dd49dbfab7ab


[ 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.