aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/bios/apm.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove APM BIOS supportWarner Losh2020-10-081-1526/+0
| | | | | | | | | | | | | | | | APM BIOS was relevant only to early laptops (approximately P166 or P200 and slower). These have not been relevant for a long time, and this code has been untested for a long time (as far as I can tell). The APM compat code in ACPI and the apm(8) command is not being retired. Both of these items are still in use (apm(8) is more scriptable than the replacement acpiconf, for the most part). This has been commented out of i386 GENERIC since 2002. This code is not relevant to any other port. Discussed on: arch@ Notes: svn path=/head/; revision=366546
* i386: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-11/+0
| | | | Notes: svn path=/head/; revision=365072
* Add deprecation notice for apm BIOSWarner Losh2020-08-311-0/+2
| | | | | | | | | | | | | Add deprecation notice for apm bios, aka the apm(4) device. The apm(8) command will remain, at least for a while, since ACPI emulates the apm ioctl interface. Discussed on: arch@ Relnotes: yes MFC After: 3 days Notes: svn path=/head/; revision=365009
* Use NULL for SYSINIT's last arg, which is a pointer typeEd Maste2018-05-181-1/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=333806
* inittodr(0) actually sets the time, so there's no need to callWarner Losh2018-01-101-5/+1
| | | | | | | | | | tc_setclock(). It's redundant. Tweak UPDATING based on code review of past releases. Relnotes: yes (for the removal of pmtimer) Notes: svn path=/head/; revision=327774
* Retire pmtimer driver. Move time fixing into apm driver. MoveWarner Losh2018-01-101-21/+97
| | | | | | | | | | | | Iwasaki-san's copyright over. Remove FIXME code that couldn't possibly work. Call tc_settime() with our estimate of the delta we've been alseep (the one we print) to adjust the time. Not sure what to do about callouts, so keep the small #ifdef in place there. Differential Revision: https://reviews.freebsd.org/D13823 Notes: svn path=/head/; revision=327767
* Remove pc98 support completely.Yoshihiro Takahashi2017-01-281-132/+3
| | | | | | | | | I thank all developers and contributors for pc98. Relnotes: yes Notes: svn path=/head/; revision=312910
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-2/+1
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-1/+2
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* This isn't functionally identical. In some cases a hint to disableEitan Adler2012-10-221-0/+3
| | | | | | | | | | | unit 0 would in fact disable all units. This reverts r241856 Approved by: cperciva (implicit) Notes: svn path=/head/; revision=241885
* Now that device disabling is generic, remove extraneous code from theEitan Adler2012-10-221-3/+0
| | | | | | | | | | | device drivers that used to provide this feature. Reviewed by: des Approved by: cperciva MFC after: 1 week Notes: svn path=/head/; revision=241856
* Do not invoke resume event handlers if suspend was successful.Jung-uk Kim2011-04-191-4/+6
| | | | | | | Pointy hat to: jkim Notes: svn path=/head/; revision=220844
* Add suspend/resume event handlers for apm(4) as well.Jung-uk Kim2011-04-191-6/+7
| | | | Notes: svn path=/head/; revision=220839
* Add compat shim for apm(4) to translate APM BIOS function numbers from i386Jung-uk Kim2010-11-111-0/+17
| | | | | | | | | | to PC98-specific ones. Any binaries using apm ioctl(4) commands but built for i386 should also work on PC98 now. Reviewed by: imp, nyan Notes: svn path=/head/; revision=215139
* Unobfuscate unit number handling in apm(4).Ed Schouten2009-10-311-13/+9
| | | | | | | | | | | There is no need to use the lower 4 bits of the unit number to store the device type number. Just use 0 and 1 to distinguish them. devfs also guarantees that there can never be an open call on a device that has a unit number different to 0 and 1, so there is no need to check for this in open(). Notes: svn path=/head/; revision=198707
* Oops, sorry. Fix for fix.Alexander Motin2009-05-041-1/+1
| | | | Notes: svn path=/head/; revision=191781
* There is no atrtc driver in pc98, so hide atrtcclock_disable variable usageAlexander Motin2009-05-041-0/+2
| | | | | | | in APM driver for this platform. This should fix pc98 build. Notes: svn path=/head/; revision=191780
* Rename statclock_disable variable to atrtcclock_disable that it actually is,Alexander Motin2009-05-031-1/+2
| | | | | | | | | | | | | | | | and hide it inside of atrtc driver. Add new tunable hint.atrtc.0.clock controlling it. Setting it to 0 disables using RTC clock as stat-/ profclock sources. Teach i386 and amd64 SMP platforms to emulate stat-/profclocks using i8254 hardclock, when LAPIC and RTC clocks are disabled. This allows to reduce global interrupt rate of idle system down to about 100 interrupts per core, permitting C3 and deeper C-states provide maximum CPU power efficiency. Notes: svn path=/head/; revision=191766
* Replace all calls to minor() with dev2unit().Ed Schouten2008-09-271-1/+1
| | | | | | | | | | | | | | | | | | After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere. This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware. Reviewed by: kib Notes: svn path=/head/; revision=183397
* Now that all platforms use genclock, shuffle things around slightlyPoul-Henning Kamp2008-04-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for better structure. Much of this is related to <sys/clock.h>, which should really have been called <sys/calendar.h>, but unless and until we need the name, the repocopy can wait. In general the kernel does not know about minutes, hours, days, timezones, daylight savings time, leap-years and such. All that is theoretically a matter for userland only. Parts of kernel code does however care: badly designed filesystems store timestamps in local time and RTC chips almost universally track time in a YY-MM-DD HH:MM:SS format, and sometimes in local timezone instead of UTC. For this we have <sys/clock.h> <sys/time.h> on the other hand, deals with time_t, timeval, timespec and so on. These know only seconds and fractions thereof. Move inittodr() and resettodr() prototypes to <sys/time.h>. Retain the names as it is one of the few surviving PDP/VAX references. Move startrtclock() to <machine/clock.h> on relevant platforms, it is a MD call between machdep.c/clock.c. Remove references to it elsewhere. Remove a lot of unnecessary <sys/clock.h> includes. Move the machdep.disable_rtc_set sysctl to subr_rtc.c where it belongs. XXX: should be kern.disable_rtc_set really, it's not MD. Notes: svn path=/head/; revision=178429
* Hold Giant over the entire execution of the suspend path instead ofNate Lawson2007-12-061-4/+4
| | | | | | | | | | dropping it after each call into newbus. This doesn't fix any known problems but seems more correct. Submitted by: Marko Zec <zec / icir.org> Notes: svn path=/head/; revision=174324
* Apply the same sort of locking done inJulian Elischer2007-11-141-0/+10
| | | | | | | | | | | | | | | | | sys/dev/acpica/acpi.c rev 1.196 a while ago: Grab Giant around calls to DEVICE_SUSPEND/RESUME in acpi_SetSleepState(). If we are resuming non-MPSAFE drivers, they need Giant held for them. This may fix some obscure suspend/resume problems. It has fixed keyrate setting problems that were triggered by cardbus (MPSAFE) changing the ordering for syscons resume (non-MPSAFE). Also, add some asserts that Giant is held in our suspend/resume and shutdown methods. Submitted by: Marko Zec Notes: svn path=/head/; revision=173598
* Rename the kthread_xxx (e.g. kthread_create()) callsJulian Elischer2007-10-201-2/+2
| | | | | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls. Notes: svn path=/head/; revision=172836
* First part of a little cleanup in the calendar/timezone/RTC handling.Poul-Henning Kamp2006-10-021-0/+1
| | | | | | | | | Move relevant variables to <sys/clock.h> and fix #includes as necessary. Use libkern's much more time- & spamce-efficient BCD routines. Notes: svn path=/head/; revision=162954
* APM was calling the suspend process from a timeout. This meant thatWarner Losh2006-05-251-26/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | other timeouts could not happen while suspending, including timeouts for things like msleep. This caused the system to hang on suspend when the cbb was enabled, since its suspend path powered down the socket which used a timeout to wait for it to be done. APM now creates a thread when it is enabled, and deletes the thread when it is disabled. This thread takes the place of the timeout by doing its polling every ~.9s. When the thread is disabled, it will wakeup early, otherwise it times out and polls the varius things the old timeout polled (APM events, suspend delays, etc). This makes my Sony VAIO 505TS suspend/resume correctly when APM is enabled (ACPI is black listed on my 505TS). This will likely fix other problems with the suspend path where drivers would sleep with msleep and/or do other timeouts. Maybe there's some special case code that would use DELAY while suspending and msleep otherwise that can be revisited and removed. This was also tested by glebius@, who pointed out that in the patch I sent him, I'd forgotten apm_saver.c MFC After: 3 weeks Notes: svn path=/head/; revision=158922
* - Consistently protect against NULL dereference.Matthew N. Dodd2005-04-121-48/+58
| | | | | | | - Simplify conditional logic to make code easier to read. Notes: svn path=/head/; revision=144964
* /* -> /*- for copyright notices, minor format tweaks as necessaryWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139790
* Remove local hacks to set flags now that the device probe does this for us.Nate Lawson2004-10-141-9/+1
| | | | | | | | | | Tested on every device except sio_pci and the pc98 fd.c. Perhaps something similar should be done for the "disabled" hints also. MFC after: 2 weeks Notes: svn path=/head/; revision=136520
* o Return ai_batteries as 0xffffffff instead of -1. This is a nop change, butWarner Losh2004-06-161-2/+2
| | | | | | | | | | | | placates gcc which seems to like to complain about -1 being assigned to an unsigned value. It is well defined and intended, but since signess bugs are being hunted just change to 0xffffffff. o Mask the lower 8 bits, not the lower 4 bits for the ai_capabilities word. All 8 bits are defined and the 0xf was almost certainly a typo. o Define APM_UNKNOWN to 0xff for emulation layer. Notes: svn path=/head/; revision=130605
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-5/+5
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Add missing #include <sys/module.h>Poul-Henning Kamp2004-05-301-0/+1
| | | | Notes: svn path=/head/; revision=129882
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-0/+2
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080
* Device megapatch 1/6:Poul-Henning Kamp2004-02-211-2/+0
| | | | | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number. Notes: svn path=/head/; revision=126076
* - Implement selwakeuppri() which allows raising the priority of aSeigo Tanimura2003-11-091-1/+1
| | | | | | | | | | | | | | | | thread being waken up. The thread waken up can run at a priority as high as after tsleep(). - Replace selwakeup()s with selwakeuppri()s and pass appropriate priorities. - Add cv_broadcastpri() which raises the priority of the broadcast threads. Used by selwakeuppri() if collision occurs. Not objected in: -arch, -current Notes: svn path=/head/; revision=122352
* - Use the new resource_disabled() helper function to see if devices areJohn Baldwin2003-07-021-10/+5
| | | | | | | | | | | | | | | disabled. - Change the apm driver to match the acpi driver's behavior by checking to see if the device is disabled in the identify routine instead of in the probe routine. This way if the device is disabled it is never created. Note that a few places (ips(4), Alpha SMP) used "disable" instead of "disabled" for their hint names, and these hints must be changed to "disabled". If this is a big problem, resource_disabled() can always be changed to honor both names. Notes: svn path=/head/; revision=117167
* Implement a loader tunable/sysctl to allow the user to request thatMatthew N. Dodd2003-06-221-0/+8
| | | | | | | | | | the APM driver byte-swap battery time values. (For broken laptops.) PR: i386/42439 Submitted by: Bruce M Simpson <bms@spc.org> Notes: svn path=/head/; revision=116665
* Use __FBSDID().David E. O'Brien2003-06-021-2/+3
| | | | Notes: svn path=/head/; revision=115679
* Merge PC98 support.Matthew N. Dodd2003-03-251-0/+117
| | | | Notes: svn path=/head/; revision=112590
* Use repo-copied files in sys/i386/bios.Matthew N. Dodd2003-03-241-1/+1
| | | | Notes: svn path=/head/; revision=112551
* Gigacommit to improve device-driver source compatibility betweenPoul-Henning Kamp2003-03-031-13/+7
| | | | | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl) Notes: svn path=/head/; revision=111815
* Be consistent about functions being static.Poul-Henning Kamp2002-10-161-1/+1
| | | | | | | Spotted by: FlexeLint. Notes: svn path=/head/; revision=105216
* Hang apm off of the legacy device instead of the nexus.John Baldwin2002-09-231-1/+1
| | | | Notes: svn path=/head/; revision=103864
* Use a function instead of embedding non-portable asm() constructsMark Murray2002-09-211-1/+2
| | | | | | | in C code. Notes: svn path=/head/; revision=103752
* Sort includes.Mark Murray2002-09-211-13/+14
| | | | Notes: svn path=/head/; revision=103751
* Remove __P.Alfred Perlstein2002-03-201-4/+4
| | | | Notes: svn path=/head/; revision=92761
* Add generalized power profile code.Mitsuru IWASAKI2002-03-041-0/+20
| | | | | | | | | | | | | | | | This makes other power-management system (APM for now) to be able to generate power profile change events (ie. AC-line status changes), and other kernel components, not only the ACPI components, can be notified the events. - move subroutines in acpi_powerprofile.c (removed) to kern/subr_power.c - call power_profile_set_state() also from APM driver when AC-line status changes - add call-back function for Crusoe LongRun controlling on power profile changes for a example Notes: svn path=/head/; revision=91640
* Some fix for the recent apm module changes.Mitsuru IWASAKI2001-11-011-2/+96
| | | | | | | | | | | | | | | | | - Now that apm loadable module can inform its existence to other kernel components (e.g. i386/isa/clock.c:startrtclock()'s TCS hack). - Exchange priority of SI_SUB_CPU and SI_SUB_KLD for above purpose. - Add simple arbitration mechanism for APM vs. ACPI. This prevents the kernel enables both of them. - Remove obsolete `#ifdef DEV_APM' related code. - Add abstracted interface for Powermanagement operations. Public apm(4) functions, such as apm_suspend(), should be replaced new interfaces. Currently only power_pm_suspend (successor of apm_suspend) is implemented. Reviewed by: peter, arch@ and audit@ Notes: svn path=/head/; revision=85835
* KSE Milestone 2Julian Elischer2001-09-121-5/+5
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Send the remains (such as I have located) of "block major numbers" toPoul-Henning Kamp2001-03-261-1/+0
| | | | | | | the bit-bucket. Notes: svn path=/head/; revision=74810