acpidev.h revision 1.2
1/* $OpenBSD: acpidev.h,v 1.2 2005/12/16 21:11:51 marco Exp $ */ 2/* 3 * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> 4 * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19#ifndef __DEV_ACPI_ACPIDEV_H__ 20#define __DEV_ACPI_ACPIDEV_H__ 21 22/* 23 * _BIF (Battery InFormation) 24 * Arguments: none 25 * Results : package _BIF (Battery InFormation) 26 * Package { 27 * // ASCIIZ is ASCII character string terminated with a 0x00. 28 * Power Unit //DWORD 29 * Design Capacity //DWORD 30 * Last Full Charge Capacity //DWORD 31 * Battery Technology //DWORD 32 * Design Voltage //DWORD 33 * Design Capacity of Warning //DWORD 34 * Design Capacity of Low //DWORD 35 * Battery Capacity Granularity 1 //DWORD 36 * Battery Capacity Granularity 2 //DWORD 37 * Model Number //ASCIIZ 38 * Serial Number //ASCIIZ 39 * Battery Type //ASCIIZ 40 * OEM Information //ASCIIZ 41 * } 42 */ 43struct acpibat_bif { 44 u_int32_t bif_power_unit; 45#define BIF_POWER_MW 0x00 46#define BIF_POWER_MA 0x01 47 u_int32_t bif_capacity; 48#define BIF_UNKNOWN 0xffffffff 49 u_int32_t bif_last_capacity; 50 u_int32_t bif_technology; 51#define BIF_TECH_PRIMARY 0x00 52#define BIF_TECH_SECONDARY 0x01 53 u_int32_t bif_voltage; 54 u_int32_t bif_warning; 55 u_int32_t bif_low; 56 u_int32_t bif_cap_granu1; 57 u_int32_t bif_cap_granu2; 58 char bif_data[]; /* 4 strings */ 59}; 60 61/* 62 * _OSC Definition for Control Method Battery 63 * Arguments: none 64 * Results : DWORD flags 65 */ 66#define CMB_OSC_UUID "f18fc78b-0f15-4978-b793-53f833a1d35b" 67#define CMB_OSC_GRANULARITY 0x01 68#define CMB_OSC_WAKE_ON_LOW 0x02 69 70/* 71 * _BST (Battery STatus) 72 * Arguments: none 73 * Results : package _BST (Battery STatus) 74 * Package { 75 * Battery State //DWORD 76 * Battery Present Rate //DWORD 77 * Battery Remaining Capacity //DWORD 78 * Battery Present Voltage //DWORD 79 * } 80 * 81 * Per the spec section 10.2.2.3 82 * Remaining Battery Percentage[%] = (Battery Remaining Capacity [=0 ~ 100] / 83 * Last Full Charged Capacity[=100]) * 100 84 * 85 * Remaining Battery Life [h] = Battery Remaining Capacity [mAh/mWh] / 86 * Battery Present Rate [=0xFFFFFFFF] = unknown 87 */ 88struct acpibat_bst { 89 u_int32_t bst_state; 90#define BST_DISCHARGE 0x01 91#define BST_CHARGE 0x02 92#define BST_CRITICAL 0x04 93 u_int32_t bst_rate; 94#define BST_UNKNOWN 0xffffffff 95 u_int32_t bst_capacity; 96 u_int32_t bst_voltage; 97}; 98 99/* 100 * _BTP (Battery Trip Point) 101 * Arguments: DWORD level 102 * Results : none 103 */ 104#define BTP_CLEAR_TRIP_POINT 0x00 105 106/* 107 * _BTM (Battery TiMe) 108 * Arguments: DWORD rate of discharge 109 * Results : DWORD time in seconds or error/unknown 110 */ 111#define BTM_CURRENT_RATE 0x00 112 113#define BTM_RATE_TOO_LARGE 0x00 114#define BTM_CRITICAL 0x00 115#define BTM_UNKNOWN 0xffffffff 116 117/* 118 * _BMD (Battery Maintenance Data) 119 * Arguments: none 120 * Results : package _BMD (Battery Maintenance Data) 121 * Package { 122 * Status Flags //DWORD 123 * Capability Flags //DWORD 124 * Recalibrate Count //DWORD 125 * Quick Recalibrate Time //DWORD 126 * Slow Recalibrate Time //DWORD 127 * } 128 */ 129struct acpibat_bmd { 130 u_int32_t bmd_status; 131#define BMD_AML_CALIBRATE_CYCLE 0x01 132#define BMD_CHARGING_DISABLED 0x02 133#define BMD_DISCHARGE_WHILE_AC 0x04 134#define BMD_RECALIBRATE_BAT 0x08 135#define BMD_GOTO_STANDBY_SPEED 0x10 136 u_int32_t bmd_capability; 137#define BMD_CB_AML_CALIBRATION 0x01 138#define BMD_CB_DISABLE_CHARGER 0x02 139#define BMD_CB_DISCH_WHILE_AC 0x04 140#define BMD_CB_AFFECT_ALL_BATT 0x08 141#define BMD_CB_FULL_CHRG_FIRST 0x10 142 u_int32_t bmd_recalibrate_count; 143#define BMD_ONLY_CALIB_IF_ST3 0x00 /* only recal when status bit 3 set */ 144 u_int32_t bmd_quick_recalibrate_time; 145#define BMD_UNKNOWN 0xffffffff 146 u_int32_t bmd_slow_recalibrate_time; 147}; 148 149/* 150 * _BMC (Battery Maintenance Control) 151 * Arguments: DWORD flags 152 * Results : none 153 */ 154#define BMC_AML_CALIBRATE 0x01 155#define BMC_DISABLE_CHARGING 0x02 156#define BMC_ALLOW_AC_DISCHARGE 0x04 157 158/* AC device */ 159/* 160 * _PSR (Power Source) 161 * Arguments: none 162 * Results : DWORD status 163 */ 164#define PSR_ONLINE 0x00 165#define PSR_OFFLINE 0x01 166 167/* 168 * _PCL (Power Consumer List) 169 * Arguments: none 170 * Results : LIST of Power Class pointers 171 */ 172 173/* hpet device */ 174#define HPET_REG_SIZE 1024 175 176#define HPET_CAPABILITIES 0x000 177#define HPET_CONFIGURATION 0x010 178#define HPET_INTERRUPT_STATUS 0x020 179#define HPET_MAIN_COUNTER 0x0F0 180#define HPET_TIMER0_CONFIG 0x100 181#define HPET_TIMER0_COMPARE 0x108 182#define HPET_TIMER0_INTERRUPT 0x110 183#define HPET_TIMER1_CONFIG 0x200 184#define HPET_TIMER1_COMPARE 0x208 185#define HPET_TIMER1_INTERRUPT 0x310 186#define HPET_TIMER2_CONFIG 0x400 187#define HPET_TIMER2_COMPARE 0x408 188#define HPET_TIMER2_INTERRUPT 0x510 189 190#endif /* __DEV_ACPI_ACPIDEV_H__ */ 191