1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
|
/* sci.h -- System Configuration Interface
*
* Copyright (c) 1998 Jonathan A. Buzzard (jonathan@buzzard.org.uk)
*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
* This code is covered by the GNU GPL and you are free to make any
* changes you wish to it under the terms of the license. However the
* code has the potential to render your computer and/or someone else's
* unuseable. Unless you truely understand what is going on, I urge you
* not to make any modifications and use it as it stands.
*
* $Log: sci.h,v $
* Revision 1.7 2004/07/11 17:04:10 schwitrs
* new features added by G. L. Gragnani
*
* Revision 1.6 2002/11/24 19:46:25 schwitrs
* mods for kernle interface
*
* Revision 1.5 2002/01/23 19:50:26 schwitrs
* moved SMMRegisters to smm.h
*
* Revision 1.4 2002/01/19 23:00:56 schwitrs
* undid attempt to use new and old style SCI register names
*
* Revision 1.3 2001/05/14 16:39:51 schwitrs
* merged SMM and SciRegisters using anonymous unions
*
* Revision 1.2 2000/07/04 15:16:58 schwitrs
* fixes for manpages, arch-dep bin dir, version
*
* Revision 1.1 2000/02/03 02:49:03 schwitrs
* Initial revision
*
* Revision 1.9 1999/12/04 13:41:23 jab
* modified SCI_DATE macro to exclude the year and added SCI_FULLDATE macro
*
* Revision 1.8 1999/03/11 20:23:18 jab
* added macros to manipulate date type
* updated some of the enumerations and added a few more
*
* Revision 1.7 1999/03/06 16:47:12 jab
* removed declarations for BiosVersion and MachineID functions
*
* Revision 1.6 1998/09/07 18:15:50 jab
* added prototype for new model fuction
* added a structure for the system configuration interface registers
*
* Revision 1.5 1998/08/23 12:17:36 jab
* added the SCI_BATTERY/SCI_MAINS values
*
* Revision 1.4 1998/08/19 08:42:29 jab
* added extern "C" declaration in case anyone uses this with C++
* fixed the declaration of SCI_SUCSSES/SCI_FAILURE
* other miscellaneous tidy ups
*
* Revision 1.3 1998/08/06 08:25:36 jab
* changed defines to enums and prepended everything with sci_
*
* Revision 1.2 1998/08/04 08:07:46 jab
* added some extra information from Japanesse Libretto effort
*
* Revision 1.1 1998/05/23 08:08:17 jab
* Initial revision
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef SCI_H
#define SCI_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef USE_KERNEL_INTERFACE
# include<linux/toshiba.h>
#else
# include "smm.h"
#endif
//#ifndef SMMREGISTERS
//#define SMMREGISTERS
//typedef struct {
// unsigned short ax;
// unsigned short bx;
// unsigned short cx;
// unsigned int edx;
// unsigned int esi;
// unsigned short di;
//} SMMRegisters;
//#endif
// #ifdef CPLUSPLUS
// struct SciRegisters {
// union {
// unsigned int ebx;
// unsigned int setting;
// };
// union {
// unsigned int ecx __attribute__ ((packed));
// unsigned int current __attribute__ ((packed));
// } __attribute__ ((packed));
// union {
// unsigned int edx __attribute__ ((packed));
// unsigned int possible __attribute__ ((packed));
// } __attribute__ ((packed));
// union {
// unsigned int esi __attribute__ ((packed));
// unsigned int defaults __attribute__ ((packed));
// } __attribute__ ((packed));
// union {
// unsigned int edi __attribute__ ((packed));
// unsigned int attribute __attribute__ ((packed));
// } __attribute__ ((packed));
// // union {
// // unsigned int edi __attribute__ ((packed));
// // unsigned int attribute2 __attribute__ ((packed));
// // } __attribute__ ((packed));
// };
// typedef SciRegisters SMMRegisters;
// #else /* not CPLUSPLUS */
typedef struct {
unsigned int setting;
unsigned int current __attribute__ ((packed));
unsigned int possible __attribute__ ((packed));
unsigned int defaults __attribute__ ((packed));
unsigned int attribute __attribute__ ((packed));
// unsigned int attribute2 __attribute__ ((packed));
} SciRegisters;
// #endif /* CPLUSPLUS */
/*
* the different modes that can be changed
*/
enum {
SCI_POWER_UP = 0x0100,
SCI_BATTERY_SAVE = 0x0101,
SCI_PROCESSING = 0x0102,
SCI_SLEEP_MODE = 0x0104,
SCI_DISPLAY_AUTO = 0x0105,
SCI_HDD_AUTO_OFF = 0x0106,
SCI_CPU_CACHE = 0x0108,
SCI_SPEAKER_VOLUME = 0x0109,
SCI_SYSTEM_BEEP = 0x010a,
SCI_BATTERY_ALARM = 0x010b,
SCI_PANEL_ALARM = 0x010c,
SCI_PANEL_POWER = 0x010d,
SCI_ALARM_DATE = 0x010e,
SCI_ALARM_TIME = 0x010f,
SCI_ALARM_POWER = 0x010f,
SCI_SYSTEM_AUTO = 0x0110,
SCI_BATTERY_PERCENT = 0x0111,
SCI_BATTERY_TIME = 0x0112,
SCI_LCD_BRIGHTNESS = 0x0115,
SCI_BOOT_METHOD = 0x011d,
SCI_2ND_BATTERY = 0x011e,
SCI_CACHE_POLICY = 0x011f,
SCI_COOLING_METHOD = 0x0122,
SCI_STANDBY_TIME = 0x0125,
SCI_HIBERNATION = 0x012d,
SCI_LAN_CONTROLLER = 0x0130,
SCI_SOUND_LOGO = 0x0138,
SCI_STARTUP_LOGO = 0x013a,
SCI_LCD_BACKLIGHT = 0x0305,
SCI_DISPLAY_STRETCH = 0x0308,
SCI_PARALLEL_PORT = 0x0501,
SCI_POINTING_DEVICE = 0x0505,
SCI_INFRARED_PORT = 0x0508,
SCI_USB_LEGACY_MODE = 0x050c,
SCI_USB_FDD_EMULAT = 0x050d,
SCI_PASSWORD_MODE = 0x0600,
SCI_PASSWORD_CHECK = 0x0601,
SCI_PASSWORD = 0x0602,
SCI_PASSWORD_VERIFY = 0x0603,
SCI_PASSWORD_LEVEL = 0x0604
};
/*
* the different states the various modes can be set to
*/
enum {
SCI_BOOT = 0x0000,
SCI_RESUME = 0x0001,
SCI_HIBERNATE = 0x0002,
SCI_QUICK_HIBERNATE = 0x0003
};
enum {
SCI_USER_SETTINGS = 0x0000,
SCI_LOW_POWER = 0x0001,
SCI_FULL_POWER = 0x0002,
SCI_LONG_LIFE = 0x0001,
SCI_NORMAL_LIFE = 0x0002,
SCI_ECONOMY = 0x0002,
SCI_FULL_LIFE = 0x0003
};
enum {
SCI_LOW = 0x0000,
SCI_HIGH = 0x0001
};
enum {
SCI_OFF = 0x0000,
SCI_ON = 0x0001
};
enum {
SCI_DISABLED = 0x0000,
SCI_ENABLED = 0x0001
};
enum {
SCI_ALARM_ENABLED = 0x0000,
SCI_ALARM_DISABLED = 0x0001
};
enum {
SCI_TIME_DISABLED = 0x0001, /* will disable relevant settings */
SCI_TIME_00 = 0x0002,
SCI_TIME_01 = 0x0004,
SCI_TIME_03 = 0x0008,
SCI_TIME_05 = 0x0010,
SCI_TIME_10 = 0x0020,
SCI_TIME_15 = 0x0040,
SCI_TIME_20 = 0x0080,
SCI_TIME_25 = 0x0100,
SCI_TIME_30 = 0x0200,
SCI_TIME_35 = 0x0400,
SCI_TIME_40 = 0x0800,
SCI_TIME_45 = 0x1000,
SCI_TIME_50 = 0x2000,
SCI_TIME_55 = 0x4000,
SCI_TIME_60 = 0x8000
};
enum {
SCI_FD_HD = 0x0000,
SCI_HD_FD = 0x0001
};
enum {
SCI_VOLUME_OFF = 0x0000,
SCI_VOLUME_LOW = 0x0001,
SCI_VOLUME_MEDIUM = 0x0002,
SCI_VOLUME_HIGH = 0x0003
};
enum {
SCI_BRIGHT = 0x0000,
SCI_SEMI_BRIGHT = 0x0001,
SCI_SUPER_BRIGHT = 0x0002
};
enum {
SCI_BACK_DARK = 0x0000,
SCI_BACK_DIM = 0x0001,
SCI_BACK_SEMI = 0x0002,
SCI_BACK_BRIGHT = 0x0003
};
enum {
SCI_PERFORMANCE = 0x0000,
SCI_QUIET = 0x0001
};
enum {
SCI_PARALLEL_ECP = 0x0010,
SCI_PARALLEL_SPP = 0x0020, /* Libretto 20x/30x only ? */
SCI_PARALLEL_PS2 = 0x0040
};
enum {
SCI_AUTO_SELECT = 0x0000,
SCI_SIMULATANEOUS = 0x0001
};
enum {
SCI_IRDA_1_0 = 0x0001, /* These don't work on IrDA 1.1 laptops */
SCI_ASK = 0x0002
};
enum {
SCI_NOT_REGISTERED = 0x0000,
SCI_REGISTERED = 0x0001
};
enum {
SCI_USER_PASSWORD = 0x0000,
SCI_SUPER_PASSWORD = 0x0001
};
enum {
SCI_BATTERY = 0x0003,
SCI_MAINS = 0x0004
};
enum {
SCI_PICTURE_LOGO = 0x0000,
SCI_ANIMATION_LOGO = 0x0001
};
/*
* SCI error codes
*/
enum {
SCI_SUCCESS = 0x00,
SCI_FAILURE = 0x01,
SCI_NOT_SUPPORTED = 0x80,
SCI_ALREADY_OPEN = 0x81,
SCI_NOT_OPENED = 0x82,
SCI_INPUT_ERROR = 0x83,
SCI_WRITE_PROTECTED = 0x84,
SCI_NOT_PRESENT = 0x86,
SCI_NOT_READY = 0x8c,
SCI_DEVICE_ERROR = 0x8d,
SCI_NOT_INSTALLED = 0x8e
};
/*
* macro's to manipulate the time and date data types
*/
#define SCI_TIME(h,m) ((m & 0x3f)<<1) | ((h & 0x1f)<<7)
#define SCI_HOUR(t) ( (t & 0x7fc0)>>7 )
#define SCI_MINUTE(t) ( (t & 0x7e)>>1 )
#define SCI_TIME_ON(t) (t & 0x01)
#define SCI_DATE(m,d) (((m) & 0xf)<<6) | (((d) & 0x1f)<<1)
#define SCI_FULLDATE(y,m,d) ((((y)-1990) & 0x1f)<<10) | \
(((m) & 0xf)<<6) | (((d) & 0x1f)<<1)
#define SCI_YEAR(d) 1990+((d & 0x1fc00)>>10)
#define SCI_MONTH(d) ( (d & 0x3c0)>>6 )
#define SCI_DAY(d) ( (d & 0x3e)>>1 )
#define SCI_DATE_EVERYDAY(d) (d & 0x01)
/*
* function prototypes
*/
int SciSupportCheck(int *version);
int SciOpenInterface(void);
int SciCloseInterface(void);
int SciGet(SMMRegisters *reg);
int SciSet(SMMRegisters *reg);
int SciACPower(void);
int SciGetModel(char *model);
/*int SciSetPassword(const char *password, unsigned short type, int *trys); */
#ifdef __cplusplus
}
#endif
#endif
|