aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/acpica
Commit message (Collapse)AuthorAgeFilesLines
* Consistently use round_page(x) rather than roundup(x, PAGE_SIZE). There isJung-uk Kim2013-02-151-2/+2
| | | | | | | no functional change. Notes: svn path=/head/; revision=246855
* 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
* - Fix resumectx() prototypes to reflect reality.Jung-uk Kim2012-06-131-3/+3
| | | | | | | | - For i386, simply jump to resumectx() with PCB in %ecx. - Fix a style(9) nit while I am here. Notes: svn path=/head/; revision=237027
* Add x86/acpica/acpi_wakeup.c for amd64 and i386. Difference ofMitsuru IWASAKI2012-06-092-378/+3
| | | | | | | | | | | | | | | | | | | | | | | | | suspend/resume procedures are minimized among them. common: - Add global cpuset suspended_cpus to indicate APs are suspended/resumed. - Remove acpi_waketag and acpi_wakemap from acpivar.h (no longer used). - Add some variables in acpi_wakecode.S in order to minimize the difference among amd64 and i386. - Disable load_cr3() because now CR3 is restored in resumectx(). amd64: - Add suspend/resume related members (such as MSR) in PCB. - Modify savectx() for above new PCB members. - Merge acpi_switch.S into cpu_switch.S as resumectx(). i386: - Merge(and remove) suspendctx() into savectx() in order to match with amd64 code. Reviewed by: attilio@, acpi@ Notes: svn path=/head/; revision=236772
* Consistently use ACPI_SUCCESS() and ACPI_FAILURE() macros wherever possible.Jung-uk Kim2012-06-011-2/+1
| | | | Notes: svn path=/head/; revision=236424
* Tidy up code clutter in SMP case a bit. No functional change.Jung-uk Kim2012-06-011-10/+6
| | | | Notes: svn path=/head/; revision=236419
* Call AcpiSetFirmwareWakingVector() with interrupt disabled for consistency.Jung-uk Kim2012-06-011-2/+2
| | | | Notes: svn path=/head/; revision=236414
* Improve style(9) in the previous commit.Jung-uk Kim2012-06-011-3/+3
| | | | Notes: svn path=/head/; revision=236409
* Call AcpiLeaveSleepStatePrep() in interrupt disabled contextMitsuru IWASAKI2012-06-011-54/+57
| | | | | | | | | | | | | | | | | | | | | (described in ACPICA source code). - Move intr_disable() and intr_restore() from acpi_wakeup.c to acpi.c and call AcpiLeaveSleepStatePrep() in interrupt disabled context. - Add acpi_wakeup_machdep() to execute wakeup MD procedures and call it twice in interrupt disabled/enabled context (ia64 version is just dummy). - Rename wakeup_cpus variable in acpi_sleep_machdep() to suspcpus in order to be shared by acpi_sleep_machdep() and acpi_wakeup_machdep(). - Move identity mapping related code to acpi_install_wakeup_handler() (i386 version) for preparation of x86/acpica/acpi_wakeup.c (MFC candidate). Reviewed by: jkim@ MFC after: 2 days Notes: svn path=/head/; revision=236403
* Revert the previous commit on wakecode address verbose printing.Mitsuru IWASAKI2012-05-191-2/+2
| | | | | | | This broke PAE kernel building. Notes: svn path=/head/; revision=235639
* Add SMP/i386 suspend/resume support.Mitsuru IWASAKI2012-05-182-423/+378
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most part is merged from amd64. - i386/acpica/acpi_wakecode.S Replaced with amd64 code (from realmode to paging enabling code). - i386/acpica/acpi_wakeup.c Replaced with amd64 code (except for wakeup_pagetables stuff). - i386/include/pcb.h - i386/i386/genassym.c Added PCB new members (CR0, CR2, CR4, DS, ED, FS, SS, GDT, IDT, LDT and TR) needed for suspend/resume, not for context switch. - i386/i386/swtch.s Added suspendctx() and resumectx(). Note that savectx() was not changed and used for suspending (while amd64 code uses it). BSP and AP execute the same sequence, suspendctx(), acpi_wakecode() and resumectx() for suspend/resume (in case of UP system also). - i386/i386/apic_vector.s Added cpususpend(). - i386/i386/mp_machdep.c - i386/include/smp.h Added cpususpend_handler(). - i386/include/apicvar.h - kern/subr_smp.c - sys/smp.h Added IPI_SUSPEND and suspend_cpus(). - i386/i386/initcpu.c - i386/i386/machdep.c - i386/include/md_var.h - pc98/pc98/machdep.c Moved initializecpu() declarations to md_var.h. MFC after: 3 days Notes: svn path=/head/; revision=235622
* Centralize declaration of the debug.acpi sysctl node.John Baldwin2012-05-171-2/+0
| | | | Notes: svn path=/head/; revision=235556
* Merge ACPICA 20120320.Jung-uk Kim2012-03-201-1/+1
| | | | Notes: svn path=/head/; revision=233250
* MFamd64:John Baldwin2012-03-091-12/+19
| | | | | | | | | | | | | | | - Return failure for a suspend attempt if we have no wake address. - Use intr_disable()/intr_restore() instead of ACPI_DISABLE_IRQS(). - Invoke intr_suspend() earlier and call intr_resume() if suspend fails. - Use pause in the loop waiting for CPU to suspend. - Restore PAT MSR, switchtime, switchticks, and MTRRs on resume. Reviewed by: jkim (earlier version) MFC after: 2 weeks Notes: svn path=/head/; revision=232742
* MFamd64: (based on) r209957Jung-uk Kim2010-11-124-43/+1
| | | | | | | | | Move logic of building ACPI headers for acpi_wakeup.c into better places, remove intermediate makefile and shell script, and reduce diff between i386 and amd64. Notes: svn path=/head/; revision=215200
* Make APM emulation look more closer to its origin. Use device_get_softc(9)Jung-uk Kim2010-11-101-3/+2
| | | | | | | instead of hardcoding acpi(4) unit number as we have device_t for it. Notes: svn path=/head/; revision=215097
* Refactor acpi_machdep.c for amd64 and i386, move APM emulation into a newJung-uk Kim2010-11-101-451/+9
| | | | | | | file acpi_apm.c, and place it on sys/x86/acpica. Notes: svn path=/head/; revision=215072
* Now OsdEnvironment.c is identical on amd64 and i386. Move it to a new home.Jung-uk Kim2010-11-091-91/+0
| | | | Notes: svn path=/head/; revision=215024
* Reduce diff between platforms and fix style(9) bugs.Jung-uk Kim2010-11-091-15/+35
| | | | Notes: svn path=/head/; revision=215023
* Move the MADT parser for amd64 and i386 to sys/x86/acpica now that it isJohn Baldwin2010-11-081-572/+0
| | | | | | | identical on both platforms. Notes: svn path=/head/; revision=215012
* Sync the APIC startup sequence with amd64:John Baldwin2010-11-081-1/+1
| | | | | | | | | - Register APIC enumerators at SI_SUB_TUNABLES - 1 instead of SI_SUB_CPU - 1. - Probe CPUs at SI_SUB_TUNABLES - 1. This allows i386 to set a truly accurate mp_maxid value rather than always setting it to MAXCPU - 1. Notes: svn path=/head/; revision=215009
* A few small style and whitespace fixes.John Baldwin2010-11-081-1/+0
| | | | Notes: svn path=/head/; revision=215002
* Move <machine/apicreg.h> to <x86/apicreg.h>.John Baldwin2010-11-011-1/+1
| | | | Notes: svn path=/head/; revision=214631
* Move the <machine/mca.h> header to <x86/mca.h>.John Baldwin2010-11-011-1/+1
| | | | Notes: svn path=/head/; revision=214630
* For every instance of '.if ${CC} == "foo"' or '.if ${CC} != "foo"' inRui Paulo2010-08-171-1/+1
| | | | | | | | | | | | | | | | Makefiles or *.mk files, use ${CC:T:Mfoo} instead, so only the basename of the compiler command (excluding any arguments) is considered. This allows you to use, for example, CC="/nondefault/path/clang -xxx", and still have the various tests in bsd.*.mk identify your compiler as clang correctly. ICC if cases were also changed. Submitted by: Dimitry Andric <dimitry at andric.com> Notes: svn path=/head/; revision=211437
* Restore the machine check register banks on resume. For banks beingJohn Baldwin2010-06-151-0/+2
| | | | | | | | | | monitored via CMCI, reset the interrupt threshold to 1 on resume. Reviewed by: jkim MFC after: 2 weeks Notes: svn path=/head/; revision=209212
* Update several places that iterate over CPUs to use CPU_FOREACH().John Baldwin2010-06-111-3/+1
| | | | Notes: svn path=/head/; revision=209059
* Use the same policy for rejecting / not-reject ACPI tables with incorrectJohn Baldwin2010-03-191-0/+2
| | | | | | | | | | | | | checksums as the base acpi(4) driver. This fixes a problem where the MADT parser would reject the MADT table during early boot causing the MP Table to be, but then the acpi(4) driver would attach and use non-SMP interrupt routing. Tested by: Alastair Hogge agh of coolrhaug com MFC after: 1 week Notes: svn path=/head/; revision=205332
* Extract the code to find and map the MADT ACPI table during early kernelJohn Baldwin2009-09-232-222/+250
| | | | | | | | | | | | startup and genericize it so it can be reused to map other tables as well: - Add a routine to walk a list of ACPI subtables such as those used in the APIC and SRAT tables in the MI acpi(4) driver. - Move the routines for mapping and unmapping an ACPI table as well as mapping the RSDT or XSDT and searching for a table with a given signature out into acpica_machdep.c for both amd64 and i386. Notes: svn path=/head/; revision=197439
* Use C99 initialization for struct filterops.Robert Watson2009-09-121-2/+5
| | | | | | | | | Obtained from: Mac OS X Sponsored by: Apple Inc. MFC after: 3 weeks Notes: svn path=/head/; revision=197134
* Temporarily revert the new-bus locking for 8.0 release. It will beJohn Baldwin2009-08-201-6/+0
| | | | | | | | | reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio Notes: svn path=/head/; revision=196403
* Make the newbus subsystem Giant free by adding the new newbus sxlock.Attilio Rao2009-08-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith) Notes: svn path=/head/; revision=196037
* Adapt vfs kqfilter to the shared vnode lock used by zfs write vop. UseKonstantin Belousov2009-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | vnode interlock to protect the knote fields [1]. The locking assumes that shared vnode lock is held, thus we get exclusive access to knote either by exclusive vnode lock protection, or by shared vnode lock + vnode interlock. Do not use kl_locked() method to assert either lock ownership or the fact that curthread does not own the lock. For shared locks, ownership is not recorded, e.g. VOP_ISLOCKED can return LK_SHARED for the shared lock not owned by curthread, causing false positives in kqueue subsystem assertions about knlist lock. Remove kl_locked method from knlist lock vector, and add two separate assertion methods kl_assert_locked and kl_assert_unlocked, that are supposed to use proper asserts. Change knlist_init accordingly. Add convenience function knlist_init_mtx to reduce number of arguments for typical knlist initialization. Submitted by: jhb [1] Noted by: jhb [2] Reviewed by: jhb Tested by: rnoland Notes: svn path=/head/; revision=193951
* Import ACPICA 20090521.Jung-uk Kim2009-06-054-7/+11
| | | | Notes: svn path=/head/; revision=193530
* We don't need d_thread_t for cross-branch portability here anymore.Warner Losh2009-05-201-4/+4
| | | | | | | Move do struct thread * instead. Notes: svn path=/head/; revision=192442
* At least one BIOS bogusly includes duplicate entries for I/O APICs. TheJohn Baldwin2009-03-051-0/+4
| | | | | | | | | | | | bogus entries have a starting IRQ that is invalid (> 255, so won't fit into a PCI intline config register). It had the side effect of breaking MSI by "claiming" several IRQs in the MSI range. Fix this by ignoring such I/O APICs. MFC after: 2 weeks Notes: svn path=/head/; revision=189404
* Mark these variables as __used too. Fix a style of previous commit.Roman Divacky2009-02-181-5/+6
| | | | | | | | Noticed by: Christoph Mallon Approved by: kib (mentor) Notes: svn path=/head/; revision=188767
* Mark these variables as __used as those are used in the asm block.Roman Divacky2009-02-181-4/+4
| | | | | | | Approved by: kib (mentor) Notes: svn path=/head/; revision=188753
* Remove unit2minor() use from kernel code.Ed Schouten2008-09-261-2/+2
| | | | | | | | | | | | | | | | | | When I changed kern_conf.c three months ago I made device unit numbers equal to (unneeded) device minor numbers. We used to require bitshifting, because there were eight bits in the middle that were reserved for a device major number. Not very long after I turned dev2unit(), minor(), unit2minor() and minor2unit() into macro's. The unit2minor() and minor2unit() macro's were no-ops. We'd better not remove these four macro's from the kernel, because there is a lot of (external) code that may still depend on them. For now it's harmless to remove all invocations of unit2minor() and minor2unit(). Reviewed by: kib Notes: svn path=/head/; revision=183381
* Don't enforce unique device minor number policy anymore.Ed Schouten2008-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Except for the case where we use the cloner library (clone_create() and friends), there is no reason to enforce a unique device minor number policy. There are various drivers in the source tree that allocate unr pools and such to provide minor numbers, without using them themselves. Because we still need to support unique device minor numbers for the cloner library, introduce a new flag called D_NEEDMINOR. All cdevsw's that are used in combination with the cloner library should be marked with this flag to make the cloning work. This means drivers can now freely use si_drv0 to store their own flags and state, making it effectively the same as si_drv1 and si_drv2. We still keep the minor() and dev2unit() routines around to make drivers happy. The NTFS code also used the minor number in its hash table. We should not do this anymore. If the si_drv0 field would be changed, it would no longer end up in the same list. Approved by: philip (mentor) Notes: svn path=/head/; revision=179726
* In keeping with style(9)'s recommendations on macros, use a ';'Robert Watson2008-03-162-3/+3
| | | | | | | | | | | | after each SYSINIT() macro invocation. This makes a number of lightweight C parsers much happier with the FreeBSD kernel source, including cflow's prcc and lxr. MFC after: 1 month Discussed with: imp, rink Notes: svn path=/head/; revision=177253
* Rework how the nexus(4) device works on x86 to better handle the idea ofJohn Baldwin2008-03-131-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | different "platforms" on x86 machines. The existing code already handles having two platforms: ACPI and legacy. However, the existing approach was rather hardcoded and difficult to extend. These changes take the approach that each x86 hardware platform should provide its own nexus(4) driver (it can inherit most of its behavior from the default legacy nexus(4) driver) which is responsible for probing for the platform and performing appropriate platform-specific setup during attach (such as adding a platform-specific bus device). This does mean changing the x86 platform busses to no longer use an identify routine for probing, but to move that logic into their matching nexus(4) driver instead. - Make the default nexus(4) driver in nexus.c on i386 and amd64 handle the legacy platform. It's probe routine now returns BUS_PROBE_GENERIC so it can be overriden. - Expose a nexus_init_resources() routine which initializes the various resource managers so that subclassed nexus(4) drivers can invoke it from their attach routine. - The legacy nexus(4) driver explicitly adds a legacy0 device in its attach routine. - The ACPI driver no longer contains an new-bus identify method. Instead it exposes a public function (acpi_identify()) which is a probe routine that the MD nexus(4) drivers can use to probe for ACPI. All of the probe logic in acpi_probe() is now moved into acpi_identify() and acpi_probe() is just a stub. - On i386 and amd64, an ACPI-specific nexus(4) driver checks for ACPI via acpi_identify() and claims the nexus0 device if the probe succeeds. It then explicitly adds an acpi0 device in its attach routine. - The legacy(4) driver no longer knows anything about the acpi0 device. - On ia64 if acpi_identify() fails you basically end up with no devices. This matches the previous behavior where the old acpi_identify() would fail to add an acpi0 device again leaving you with no devices. Discussed with: imp Silence on: arch@ Notes: svn path=/head/; revision=177157
* For no good reason I had assumed that ACPI table headers would be pageJohn Baldwin2008-01-311-5/+7
| | | | | | | | | | | | | | | | | | | | | | | aligned (or at least not cross a page boundary). However, it turns out that on at least one machine one table header does cross a page boundary. This caused problems with the MADT early probe as it uses the crash dump map to load ACPI tables by loading the RSDT/XSDT into pages 1 ... N and loading the header of each ACPI table header into page 0 looking for the MADT. However, if a table header crossed a page boundary, then page 1 would get trashed resulting in a panic. Fix this by reserving the first 2 pages for ACPI table headers (headers are less than a page in size, so 2 pages will be sufficient) and use pages 2 .. N for the RSDT and XSDT. Note: amd64 should probably be simplified to just use pmap_mapbios() for all these tables which will use the direct map and not need the crash dump hack. MFC after: 5 days Tested on: i386 Reported by: Pete French petefrench of ticketswitch.com Notes: svn path=/head/; revision=175859
* This is a follow-up, cleaning-up commit about recent changes involvingAttilio Rao2007-09-111-1/+1
| | | | | | | | | | | | | | | | | | | topology foo functions. Working at the patch for topology problems in ia32/amd64 evicted some problems regarding functions ordering in the SI_SUB_CPU family of SYSINIT'ed subsystems. In order to avoid problems with new modified to involved functions, a correct ordering is not semantically specified for SI_SUB_CPU functions (for a larger view of the issue please visit: http://lists.freebsd.org/pipermail/freebsd-current/2007-July/075409.html ) Discussed with: peter Tested by: kris, Rui Paulo <rpaulo@FreeBSD.org> Approved by: jeff Approved by: re Notes: svn path=/head/; revision=172144
* Now that we have a function that can be called from a cdevsw close()Nate Lawson2007-07-071-9/+1
| | | | | | | | | entry point, use it. Approved by: re Notes: svn path=/head/; revision=171297
* Update the suspend/resume user API while maintaining backwards compat.Nate Lawson2007-06-211-26/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improvements: * /etc/rc.suspend,rc.resume are always run, no matter the source of the suspend request (user or kernel, apm or acpi) * suspend now requires positive user acknowledgement. If a user program wants to cancel the suspend, they can. If one of the user programs hangs or doesn't respond within 10 seconds, the system suspends anyway. * /dev/apm is clonable, allowing multiple listeners for suspend events. In the future, xorg-server can use this to be informed about suspend even if there are other listeners (i.e. apmd). Changes: * Two new ACPI ioctls: REQSLPSTATE and ACKSLPSTATE. Request begins the process of suspending by notifying all listeners. acpi is monitored by devd(8) and /dev/apm listener(s) are also counted. Users register their approval or disapproval via Ack. If anyone disapproves, suspend is vetoed. * Old user programs or kernel modules that used SETSLPSTATE continue to work. A message is printed once that this interface is deprecated. * acpiconf gains the -k flag to ack the suspend request. This flag is undocumented on purpose since it's only used by /etc/rc.suspend. It is not intended to be a permanent change and will be removed once a better power API is implemented. * S5 (power off) is no longer supported via acpiconf -s 5 or apm -z/-Z. This restores previous behavior of halt/shutdown -p being the interface. * Miscellaneous improvements to error reporting Approved by: re Notes: svn path=/head/; revision=170976
* Handle CPUs with APIC IDs higher than 32 (at least one IBM server usesJohn Baldwin2007-05-081-10/+7
| | | | | | | | | | | | | | | | an APIC ID of 38 for its second CPU): - Add a new MAX_APIC_ID constant for the highest valid APIC ID for modern systems. - Size the various arrays in the MADT, MP Table, and SMP code that are indexed by APIC IDs to allow for up to MAX_APIC_ID. - Explicitly go through and assign logical cpu ids to local APICs before starting any of the APs up rather than doing it while starting up the APs. This step is now where we honor MAXCPU. MFC after: 1 week Notes: svn path=/head/; revision=169395
* Optimize sx locks to use simple atomic operations for the common cases ofJohn Baldwin2007-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | obtaining and releasing shared and exclusive locks. The algorithms for manipulating the lock cookie are very similar to that rwlocks. This patch also adds support for exclusive locks using the same algorithm as mutexes. A new sx_init_flags() function has been added so that optional flags can be specified to alter a given locks behavior. The flags include SX_DUPOK, SX_NOWITNESS, SX_NOPROFILE, and SX_QUITE which are all identical in nature to the similar flags for mutexes. Adaptive spinning on select locks may be enabled by enabling the ADAPTIVE_SX kernel option. Only locks initialized with the SX_ADAPTIVESPIN flag via sx_init_flags() will adaptively spin. The common cases for sx_slock(), sx_sunlock(), sx_xlock(), and sx_xunlock() are now performed inline in non-debug kernels. As a result, <sys/sx.h> now requires <sys/lock.h> to be included prior to <sys/sx.h>. The new kernel option SX_NOINLINE can be used to disable the aforementioned inlining in non-debug kernels. The size of struct sx has changed, so the kernel ABI is probably greatly disturbed. MFC after: 1 month Submitted by: attilio Tested by: kris, pjd Notes: svn path=/head/; revision=168191
* Catch up with ACPI-CA 20070320 import.Jung-uk Kim2007-03-223-144/+139
| | | | Notes: svn path=/head/; revision=167814