summaryrefslogtreecommitdiffstats
path: root/sys/i386/bios/apm.c
Commit message (Collapse)AuthorAgeFilesLines
* This isn't functionally identical. In some cases a hint to disableeadler2012-10-221-0/+3
| | | | | | | | unit 0 would in fact disable all units. This reverts r241856 Approved by: cperciva (implicit)
* Now that device disabling is generic, remove extraneous code from theeadler2012-10-221-3/+0
| | | | | | | | device drivers that used to provide this feature. Reviewed by: des Approved by: cperciva MFC after: 1 week
* Do not invoke resume event handlers if suspend was successful.jkim2011-04-191-4/+6
| | | | Pointy hat to: jkim
* Add suspend/resume event handlers for apm(4) as well.jkim2011-04-191-6/+7
|
* Add compat shim for apm(4) to translate APM BIOS function numbers from i386jkim2010-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
* Unobfuscate unit number handling in apm(4).ed2009-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().
* Oops, sorry. Fix for fix.mav2009-05-041-1/+1
|
* There is no atrtc driver in pc98, so hide atrtcclock_disable variable usagemav2009-05-041-0/+2
| | | | in APM driver for this platform. This should fix pc98 build.
* Rename statclock_disable variable to atrtcclock_disable that it actually is,mav2009-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.
* Replace all calls to minor() with dev2unit().ed2008-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
* Now that all platforms use genclock, shuffle things around slightlyphk2008-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.
* Hold Giant over the entire execution of the suspend path instead ofnjl2007-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>
* Apply the same sort of locking done injulian2007-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
* Rename the kthread_xxx (e.g. kthread_create()) callsjulian2007-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.
* First part of a little cleanup in the calendar/timezone/RTC handling.phk2006-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.
* APM was calling the suspend process from a timeout. This meant thatimp2006-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
* - Consistently protect against NULL dereference.mdodd2005-04-121-48/+58
| | | | - Simplify conditional logic to make code easier to read.
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-061-1/+1
|
* Remove local hacks to set flags now that the device probe does this for us.njl2004-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
* o Return ai_batteries as 0xffffffff instead of -1. This is a nop change, butimp2004-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.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-5/+5
| | | | Bump __FreeBSD_version accordingly.
* Add missing #include <sys/module.h>phk2004-05-301-0/+1
|
* Device megapatch 4/6:phk2004-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.
* Device megapatch 1/6:phk2004-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.
* - Implement selwakeuppri() which allows raising the priority of atanimura2003-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
* - Use the new resource_disabled() helper function to see if devices arejhb2003-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.
* Implement a loader tunable/sysctl to allow the user to request thatmdodd2003-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>
* Use __FBSDID().obrien2003-06-021-2/+3
|
* Merge PC98 support.mdodd2003-03-251-0/+117
|
* Use repo-copied files in sys/i386/bios.mdodd2003-03-241-1/+1
|
* Gigacommit to improve device-driver source compatibility betweenphk2003-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)
* Be consistent about functions being static.phk2002-10-161-1/+1
| | | | Spotted by: FlexeLint.
* Hang apm off of the legacy device instead of the nexus.jhb2002-09-231-1/+1
|
* Use a function instead of embedding non-portable asm() constructsmarkm2002-09-211-1/+2
| | | | in C code.
* Sort includes.markm2002-09-211-13/+14
|
* Remove __P.alfred2002-03-201-4/+4
|
* Add generalized power profile code.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
* Some fix for the recent apm module changes.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@
* KSE Milestone 2julian2001-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
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
* Commit some tweaks I have had laying around my tree for over a year now.peter2001-03-131-6/+7
| | | | Always set the APM "device" description. Some minor style tweaks.
* select() DKI is now in <sys/selinfo.h>.wollman2001-01-091-1/+1
|
* Remove unneeded #include <sys/proc.h> lines.phk2000-10-291-1/+0
|
* Add Timer device driver for power management events.iwasaki2000-09-141-80/+6
| | | | | | | | | | | | | | | | The code for suspend/resume is derived from APM device driver. Some people suggested the original code is somewhat buggy, but I'd like to just move it from apm.c without any major changes for the initial version. This code should be refined later. To use pmtimer to adjust time at resume time, add device pmtimer in your kernel config file, and add hint.pmtimer.0.at="isa" in your device.hints Reviewed by: -current, bde
* Add output of per battery information to apm(1).ume2000-08-131-14/+44
| | | | | | New ioctl APMIO_GETPWSTATUS is introduced. Reviewed by: -mobile and -current folks (no objection)
* Cleanup debug messages and Add some enhancements from linux oniwasaki2000-08-041-63/+52
| | | | | | | | | | | | | | display control by apm -d. - Remove APM_DEBUG to avoid re-build kernel with such a unspported optioin. - Introduce new denug flag `debug.apm_debug' which can be controlled by sysctl interface and loader by setting like "debug.apm_debug=1", you will get debug messages from APM driver. - Add some enhancements from linux on display control by apm -d. I'm expecting that we can see some improvements on some laptops where apm -d doesn't work correctly so far. Reviewed by: -mobile and -current folks (no objection) Suggested by: Susumu WAKABAYASHI <susumu@wakabaya.net>
* Except for the information gathering IOCTLs, require apm device beimp2000-07-191-0/+16
| | | | opened for write. This should make the apm device read only safe.
* Correctly handle suspend and resume in APM.n_hibma2000-02-061-14/+13
| | | | | | | | | | | | | | Up to now, errors from DEVICE_SUSPEND(root_bus) were ignored. The fix for this problem (the introduction of defaults for device methods) has been committed months ago by Doug Rabson. Second, the suspended devices were not always properly resumed on error. Third, swapped the order for calling restore hooks and restore methods, to be in line with the cases above. Reviewed by: Doug Rabson Approved by: jhk
* Remove code to select APM version with flags to the apm0 device. Thisjlemon1999-12-021-21/+4
| | | | | | code has been disabled for the last 4 months. Prodded into action by: n_hibma
* Use DRIVER_MODULE(), apm.c already takes care of it's devices withpeter1999-11-081-1/+1
| | | | make_dev().
OpenPOWER on IntegriCloud