• Home
  • Raw
  • Download

Lines Matching +full:ecx +full:- +full:2000

1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* -*- linux-c -*-
4 * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)
16 * (Thanks to Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>)
29 * Jan 2000, Version 1.12
30 * Feb 2000, Version 1.13
31 * Nov 2000, Version 1.14
43 * 1.1: support user-space standby and suspend, power off after system
46 * is only incorrect by 30-60mS (vs. 1S previously) (Gabor J. Toth
48 * screen-blanking and gpm (Stephen Rothwell); Linux 1.99.4
63 * <echter@informatik.uni-rostock.de>
109 * <Walter.Hofmann@physik.stud.uni-erlangen.de>).
120 * Remove smp-power-off. SMP users must now specify
121 * "apm=power-off" on the kernel command line. Suggested
130 * Fix the Thinkpad (again) :-( (CONFIG_APM_IGNORE_MULTIPLE_SUSPENDS
139 * <tmh@magenta-logic.com> and <zlatko@iskon.hr>) modified by sfr.
145 * Changed to use the sysrq-register hack for registering the
156 * calling it - instead idle. (Alan Cox <alan@lxorguk.ukuu.org.uk>)
180 * Intel Order Number 241704-001. Microsoft Part Number 781-110-X01.
234 #include <asm/nospec-branch.h>
244 * [no-]allow[-_]ints allow interrupts during BIOS calls
245 * [no-]broken[-_]psr BIOS has a broken GetPowerStatus call
246 * [no-]realmode[-_]power[-_]off switch to real mode before
248 * [no-]debug log some debugging messages
249 * [no-]power[-_]off power off on shutdown
250 * [no-]smp Use apm even on an SMP box
251 * bounce[-_]interval=<n> number of ticks to ignore suspend
253 * idle[-_]threshold=<n> System idle percentage above which to
256 * idle[-_]period=<n> Period (in 1/100s of a second) over
271 * ?: AcerNote-950: oops on reading /proc/apm - workaround is a WIP
272 * Neale Banks <neale@lowendale.com.au> December 2000
295 * Define to re-initialize the interrupt 0 timer to 100 Hz after a suspend.
323 * The per-file APM data
396 static int apm_disabled = -1;
423 (unsigned long)__va(0x400UL), PAGE_SIZE - 0x400 - 1);
481 * apm_error - display an APM error
512 * for the rest of the kernel. And it will be very obvious! :-) Doing
563 u32 ecx; member
569 /* Error: -ENOMEM, or bits 8-15 of eax */
574 * __apm_bios_call - Make an APM BIOS 32bit call
582 * code is returned in AH (bits 8-15 of eax) and this function
583 * returns non-zero.
605 apm_bios_call_asm(call->func, call->ebx, call->ecx, in __apm_bios_call()
606 &call->eax, &call->ebx, &call->ecx, &call->edx, in __apm_bios_call()
607 &call->esi); in __apm_bios_call()
614 return call->eax & 0xff; in __apm_bios_call()
632 /* work_on_cpu can fail with -ENOMEM */ in on_cpu0()
634 call->err = ret; in on_cpu0()
636 call->err = (call->eax >> 8) & 0xff; in on_cpu0()
642 * apm_bios_call - Make an APM BIOS 32bit call (on CPU 0)
653 * __apm_bios_call_simple - Make an APM BIOS 32bit call (on CPU 0)
658 * (bits 8-15 of eax) and this function returns non-zero (it can
659 * also return -ENOMEM). This is used for simpler BIOS operations.
683 error = apm_bios_call_simple_asm(call->func, call->ebx, call->ecx, in __apm_bios_call_simple()
684 &call->eax); in __apm_bios_call_simple()
694 * apm_bios_call_simple - make a simple APM BIOS 32bit call
697 * @ecx_in: ECX register value for BIOS call
703 * and this function returns non-zero. This is used for simpler
715 call.ecx = ecx_in; in apm_bios_call_simple()
724 * apm_driver_version - APM driver version
751 * apm_get_event - get an APM event from the BIOS
771 call.ebx = call.ecx = 0; in apm_get_event()
780 *info = call.ecx; in apm_get_event()
785 * set_power_state - set the power management state
809 * set_system_power_state - set system wide power state
821 * apm_do_idle - perform power saving
824 * of the OS) idle. It returns -1 in the event that the BIOS refuses
854 return -1; in apm_do_idle()
861 * apm_do_busy - inform the BIOS the CPU is busy
880 * power management - we probably want
887 * apm_cpu_idle - cpu idling for APM capable Linux
903 unsigned int jiffies_since_last_check = jiffies - last_jiffies; in apm_cpu_idle()
913 idle_percentage = nsecs_to_jiffies(stime - last_stime); in apm_cpu_idle()
940 bucket--; in apm_cpu_idle()
953 jiffies_since_last_check = jiffies - last_jiffies; in apm_cpu_idle()
965 * apm_power_off - ask the BIOS to power off
988 * apm_enable_power_management - enable BIOS APM power management
1013 * apm_get_power_status - get current power state
1032 call.ecx = 0; in apm_get_power_status()
1042 *bat = call.ecx; in apm_get_power_status()
1057 u32 ecx;
1070 &ebx, &ecx, &edx, &esi))
1073 *bat = ecx;
1081 * apm_engage_power_management - enable PM on a device
1112 * apm_console_blank - blank the display
1160 return as->event_head == as->event_tail; in queue_empty()
1165 if (++as->event_tail >= APM_MAX_EVENTS) in get_queued_event()
1166 as->event_tail = 0; in get_queued_event()
1167 return as->events[as->event_tail]; in get_queued_event()
1177 for (as = user_list; as != NULL; as = as->next) { in queue_event()
1178 if ((as == sender) || (!as->reader)) in queue_event()
1180 if (++as->event_head >= APM_MAX_EVENTS) in queue_event()
1181 as->event_head = 0; in queue_event()
1183 if (as->event_head == as->event_tail) { in queue_event()
1188 if (++as->event_tail >= APM_MAX_EVENTS) in queue_event()
1189 as->event_tail = 0; in queue_event()
1191 as->events[as->event_head] = event; in queue_event()
1192 if (!as->suser || !as->writer) in queue_event()
1197 as->suspends_pending++; in queue_event()
1203 as->standbys_pending++; in queue_event()
1255 err = (err == APM_SUCCESS) ? 0 : -EIO; in suspend()
1265 for (as = user_list; as != NULL; as = as->next) { in suspend()
1266 as->suspend_wait = 0; in suspend()
1267 as->suspend_result = err; in suspend()
1324 apm_event_name[event - 1]); in check_events()
1410 (pending_count-- <= 0)) { in apm_event_handler()
1449 if (as == NULL || as->magic != APM_BIOS_MAGIC) { in check_apm_user()
1462 as = fp->private_data; in do_read()
1464 return -EIO; in do_read()
1466 return -EINVAL; in do_read()
1467 if ((queue_empty(as)) && (fp->f_flags & O_NONBLOCK)) in do_read()
1468 return -EAGAIN; in do_read()
1476 return -EFAULT; in do_read()
1481 as->suspends_read++; in do_read()
1486 as->standbys_read++; in do_read()
1490 i -= sizeof(event); in do_read()
1493 return count - i; in do_read()
1495 return -ERESTARTSYS; in do_read()
1503 as = fp->private_data; in do_poll()
1517 as = filp->private_data; in do_ioctl()
1519 return -EIO; in do_ioctl()
1520 if (!as->suser || !as->writer) in do_ioctl()
1521 return -EPERM; in do_ioctl()
1525 if (as->standbys_read > 0) { in do_ioctl()
1526 as->standbys_read--; in do_ioctl()
1527 as->standbys_pending--; in do_ioctl()
1528 standbys_pending--; in do_ioctl()
1537 if (as->suspends_read > 0) { in do_ioctl()
1538 as->suspends_read--; in do_ioctl()
1539 as->suspends_pending--; in do_ioctl()
1540 suspends_pending--; in do_ioctl()
1547 as->suspend_wait = 1; in do_ioctl()
1550 as->suspend_wait == 0); in do_ioctl()
1551 ret = as->suspend_result; in do_ioctl()
1555 return -ENOTTY; in do_ioctl()
1564 as = filp->private_data; in do_release()
1567 filp->private_data = NULL; in do_release()
1568 if (as->standbys_pending > 0) { in do_release()
1569 standbys_pending -= as->standbys_pending; in do_release()
1573 if (as->suspends_pending > 0) { in do_release()
1574 suspends_pending -= as->suspends_pending; in do_release()
1580 user_list = as->next; in do_release()
1585 (as1 != NULL) && (as1->next != as); in do_release()
1586 as1 = as1->next) in do_release()
1591 as1->next = as->next; in do_release()
1604 return -ENOMEM; in do_open()
1606 as->magic = APM_BIOS_MAGIC; in do_open()
1607 as->event_tail = as->event_head = 0; in do_open()
1608 as->suspends_pending = as->standbys_pending = 0; in do_open()
1609 as->suspends_read = as->standbys_read = 0; in do_open()
1611 * XXX - this is a tiny bit broken, when we consider BSD in do_open()
1615 * privileged operation -- cevans in do_open()
1617 as->suser = capable(CAP_SYS_ADMIN); in do_open()
1618 as->writer = (filp->f_mode & FMODE_WRITE) == FMODE_WRITE; in do_open()
1619 as->reader = (filp->f_mode & FMODE_READ) == FMODE_READ; in do_open()
1621 as->next = user_list; in do_open()
1624 filp->private_data = as; in do_open()
1638 int percentage = -1; in proc_apm_show()
1639 int time_units = -1; in proc_apm_show()
1669 0x00: Off-line in proc_apm_show()
1670 0x01: On-line in proc_apm_show()
1688 0-100: valid in proc_apm_show()
1689 -1: Unknown in proc_apm_show()
1692 -1: Unknown in proc_apm_show()
1719 /* 2002/08/01 - WT in apm()
1721 * on SMP systems in case of "apm=power-off" mode. Seen on ASUS A7M266D. in apm()
1760 return -1; in apm()
1770 return -1; in apm()
1858 if ((strncmp(str, "bounce-interval=", 16) == 0) || in apm_setup()
1861 if ((strncmp(str, "idle-threshold=", 15) == 0) || in apm_setup()
1864 if ((strncmp(str, "idle-period=", 12) == 0) || in apm_setup()
1867 invert = (strncmp(str, "no-", 3) == 0) || in apm_setup()
1873 if ((strncmp(str, "power-off", 9) == 0) || in apm_setup()
1880 if ((strncmp(str, "allow-ints", 10) == 0) || in apm_setup()
1883 if ((strncmp(str, "broken-psr", 10) == 0) || in apm_setup()
1886 if ((strncmp(str, "realmode-power-off", 18) == 0) || in apm_setup()
1919 printk("%s\n", d->ident); in print_if_true()
1930 "workaround hopefully not needed.\n", d->ident); in broken_ps2_resume()
1940 "Using realmode poweroff only.\n", d->ident); in set_realmode_power_off()
1951 "Enabling interrupts during APM calls.\n", d->ident); in set_apm_ints()
1962 "Disabling APM.\n", d->ident); in apm_is_horked()
1972 "Disabling APM.\n", d->ident); in apm_is_horked_d850md()
1985 "Disabling APM idle calls.\n", d->ident); in apm_likes_to_melt()
1994 * [ Write BIOS Code ]<------
1996 * < Does it Compile >----N--
1998 * < Does it Boot Win98 >-N--
2002 * Phoenix A04 08/24/2000 is known bad (Dell Inspiron 5000e)
2003 * Phoenix A07 09/29/2000 is known good (Dell Inspiron 5000)
2028 KERN_WARNING "IBM T23 - BIOS 1.03b+ and controller firmware 1.02+ may be needed for Linux APM.",
2058 DMI_MATCH(DMI_BIOS_DATE, "08/24/2000"), },
2069 DMI_MATCH(DMI_PRODUCT_NAME, "XPS-Z"),
2086 apm_is_horked, "ABIT KX7-333[R]",
2088 DMI_MATCH(DMI_BOARD_NAME, "VT8367-8233A (KX7-333[R])"), },
2096 apm_is_horked, "Fujitsu-Siemens",
2111 apm_is_horked, "Dell XPS-Z",
2114 DMI_MATCH(DMI_PRODUCT_NAME, "XPS-Z"), },
2117 apm_is_horked, "Sharp PC-PJ/AX",
2119 DMI_MATCH(DMI_PRODUCT_NAME, "PC-PJ/AX"),
2140 { /* Handle problems with APM on Sony Vaio PCG-N505X(DE) */
2146 { /* Handle problems with APM on Sony Vaio PCG-N505VX */
2152 { /* Handle problems with APM on Sony Vaio PCG-XG29 */
2158 { /* Handle problems with APM on Sony Vaio PCG-Z600NE */
2164 { /* Handle problems with APM on Sony Vaio PCG-Z600NE */
2170 { /* Handle problems with APM on Sony Vaio PCG-Z600LEK(DE) */
2176 { /* Handle problems with APM on Sony Vaio PCG-Z505LS */
2182 { /* Handle problems with APM on Sony Vaio PCG-Z505LS */
2188 { /* Handle problems with APM on Sony Vaio PCG-Z505LS (with updated BIOS) */
2194 { /* Handle problems with APM on Sony Vaio PCG-F104K */
2201 { /* Handle problems with APM on Sony Vaio PCG-C1VN/C1VE */
2207 { /* Handle problems with APM on Sony Vaio PCG-C1VE */
2213 { /* Handle problems with APM on Sony Vaio PCG-C1VE */
2255 return -ENODEV; in apm_init()
2265 return -ENODEV; in apm_init()
2275 if (apm_disabled != -1) in apm_init()
2304 return -ENODEV; in apm_init()
2307 pr_notice("disabled - APM is not SMP safe.\n"); in apm_init()
2309 return -ENODEV; in apm_init()
2314 return -ENODEV; in apm_init()
2346 pr_err("disabled - Unable to start kernel thread\n"); in apm_init()
2356 "apm: disabled - APM is not SMP safe (power off active).\n"); in apm_init()