History log of /freebsd-10-stable/sys/amd64/acpica/
Revision Date Author Comments
256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


246855 15-Feb-2013 jkim

Consistently use round_page(x) rather than roundup(x, PAGE_SIZE). There is
no functional change.


237037 13-Jun-2012 jkim

- Remove unused code for CR3 and CR4.
- Fix few style(9) nits while I am here.


236772 09-Jun-2012 iwasaki

Add x86/acpica/acpi_wakeup.c for amd64 and i386. Difference of
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@


236424 01-Jun-2012 jkim

Consistently use ACPI_SUCCESS() and ACPI_FAILURE() macros wherever possible.


236419 01-Jun-2012 jkim

Tidy up code clutter in SMP case a bit. No functional change.


236414 01-Jun-2012 jkim

Call AcpiSetFirmwareWakingVector() with interrupt disabled for consistency.


236409 01-Jun-2012 jkim

Improve style(9) in the previous commit.


236403 01-Jun-2012 iwasaki

Call AcpiLeaveSleepStatePrep() in interrupt disabled context
(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


235556 17-May-2012 jhb

Centralize declaration of the debug.acpi sysctl node.


233704 30-Mar-2012 jkim

Re-initialize model-specific MSRs when we resume CPUs.

MFC after: 1 week


233250 20-Mar-2012 jkim

Merge ACPICA 20120320.


233249 20-Mar-2012 jkim

Fix another witness panic. We cannot enter critical section at all because
AcpiEnterSleepState() executes (optional) _GTS method since ACPICA 20120215
(r231844). To evaluate the method, we need malloc(9), which may sleep.

Reported by: bschmidt
MFC after: 3 days


233208 19-Mar-2012 jkim

Fix a witness panic introduced in r231797.

Reported by: bschmidt
Reviewed by: jhb
Pointy hat to: jkim
MFC after: 3 days


231840 16-Feb-2012 jkim

Refine r231791. Install the resume event handler unconditionally.


231797 15-Feb-2012 jkim

Clean up RFLAG and CR3 register handling and nearby comments. For BSP, use
spinlock_enter()/spinlock_exit() to save/restore RFLAGS. We know interrupt
is disabled when returning from S3. For AP, we do not have to save/restore
it because IRET will do it for us any way. Do not save CR3 locally because
savectx() does it and BSP does not have to switch to kernel map for amd64.
Change contigmalloc(9) flag while I am in the neighborhood.


231791 15-Feb-2012 jkim

Set up an event handler to turn off speaker if user requested it. Speaker
will stop beeping after all device drivers are resumed. Use proper API to
"acquire" and "release" PIC timer2 for consistency and correctness.


231787 15-Feb-2012 jkim

Make ACPI resume beeper less cryptic. Set PIC timer2 mode properly.


231227 08-Feb-2012 jkim

Reset clock after atrtc(4) is properly resumed.


230958 03-Feb-2012 jkim

Restore callee saved registers later and micro-optimize.


230957 03-Feb-2012 jkim

Fix a function prototype to reflect reality. No functional change.


230830 31-Jan-2012 jkim

- Restore XCR0 before restoring extended FPU states.
- Update my copyright dates.

Reviewed by: kib


230777 30-Jan-2012 jkim

Naturally align a newly added wakeup_fpusave.


230426 21-Jan-2012 kib

Add support for the extended FPU states on amd64, both for native
64bit and 32bit ABIs. As a side-effect, it enables AVX on capable
CPUs.

In particular:

- Query the CPU support for XSAVE, list of the supported extensions
and the required size of FPU save area. The hw.use_xsave tunable is
provided for disabling XSAVE, and hw.xsave_mask may be used to
select the enabled extensions.

- Remove the FPU save area from PCB and dynamically allocate the
(run-time sized) user save area on the top of the kernel stack,
right above the PCB. Reorganize the thread0 PCB initialization to
postpone it after BSP is queried for save area size.

- The dumppcb, stoppcbs and susppcbs now do not carry the FPU state as
well. FPU state is only useful for suspend, where it is saved in
dynamically allocated suspfpusave area.

- Use XSAVE and XRSTOR to save/restore FPU state, if supported and
enabled.

- Define new mcontext_t flag _MC_HASFPXSTATE, indicating that
mcontext_t has a valid pointer to out-of-struct extended FPU
state. Signal handlers are supplied with stack-allocated fpu
state. The sigreturn(2) and setcontext(2) syscall honour the flag,
allowing the signal handlers to inspect and manipilate extended
state in the interrupted context.

- The getcontext(2) never returns extended state, since there is no
place in the fixed-sized mcontext_t to place variable-sized save
area. And, since mcontext_t is embedded into ucontext_t, makes it
impossible to fix in a reasonable way. Instead of extending
getcontext(2) syscall, provide a sysarch(2) facility to query
extended FPU state.

- Add ptrace(2) support for getting and setting extended state; while
there, implement missed PT_I386_{GET,SET}XMMREGS for 32bit binaries.

- Change fpu_kern KPI to not expose struct fpu_kern_ctx layout to
consumers, making it opaque. Internally, struct fpu_kern_ctx now
contains a space for the extended state. Convert in-kernel consumers
of fpu_kern KPI both on i386 and amd64.

First version of the support for AVX was submitted by Tim Bird
<tim.bird am sony com> on behalf of Sony. This version was written
from scratch.

Tested by: pho (previous version), Yamagi Burmeister <lists yamagi org>
MFC after: 1 month


223758 04-Jul-2011 attilio

With retirement of cpumask_t and usage of cpuset_t for representing a
mask of CPUs, pc_other_cpus and pc_cpumask become highly inefficient.

Remove them and replace their usage with custom pc_cpuid magic (as,
atm, pc_cpumask can be easilly represented by (1 << pc_cpuid) and
pc_other_cpus by (all_cpus & ~(1 << pc_cpuid))).

This change is not targeted for MFC because of struct pcpu members
removal and dependency by cpumask_t retirement.

MD review by: marcel, marius, alc
Tested by: pluknet
MD testing by: marcel, marius, gonzo, andreast


222813 07-Jun-2011 attilio

etire the cpumask_t type and replace it with cpuset_t usage.

This is intended to fix the bug where cpu mask objects are
capped to 32. MAXCPU, then, can now arbitrarely bumped to whatever
value. Anyway, as long as several structures in the kernel are
statically allocated and sized as MAXCPU, it is suggested to keep it
as low as possible for the time being.

Technical notes on this commit itself:
- More functions to handle with cpuset_t objects are introduced.
The most notable are cpusetobj_ffs() (which calculates a ffs(3)
for a cpuset_t object), cpusetobj_strprint() (which prepares a string
representing a cpuset_t object) and cpusetobj_strscan() (which
creates a valid cpuset_t starting from a string representation).
- pc_cpumask and pc_other_cpus are target to be removed soon.
With the moving from cpumask_t to cpuset_t they are now inefficient
and not really useful. Anyway, for the time being, please note that
access to pcpu datas is protected by sched_pin() in order to avoid
migrating the CPU while reading more than one (possible) word
- Please note that size of cpuset_t objects may differ between kernel
and userland. While this is not directly related to the patch itself,
it is good to understand that concept and possibly use the patch
as a reference on how to deal with cpuset_t objects in userland, when
accessing kernland members.
- KTR_CPUMASK is changed and now is represented through a string, to be
set as the example reported in NOTES.

Please additively note that no MAXCPU is bumped in this patch, but
private testing has been done until to MAXCPU=128 on a real 8x8x2(htt)
machine (amd64).

Please note that the FreeBSD version is not yet bumped because of
the upcoming pcpu changes. However, note that this patch is not
targeted for MFC.

People to thank for the time spent on this patch:
- sbruno, pluknet and Nicholas Esborn (nick AT desert DOT net) tested
several revision of the patches and really helped in improving
stability of this work.
- marius fixed several bugs in the sparc64 implementation and reviewed
patches related to ktr.
- jeff and jhb discussed the basic approach followed.
- kib and marcel made targeted review on some specific part of the
patch.
- marius, art, nwhitehorn and andreast reviewed MD specific part of
the patch.
- marius, andreast, gonzo, nwhitehorn and jceel tested MD specific
implementations of the patch.
- Other people have made contributions on other patches that have been
already committed and have been listed separately.

Companies that should be mentioned for having participated at several
degrees:
- Yahoo! for having offered the machines used for testing on big
count of CPUs.
- The FreeBSD Foundation for having sponsored my devsummit attendance,
which has been instrumental.
- Sandvine for having offered offices and infrastructure during
development.

(I really hope I didn't forget anyone, if it happened I apologize in
advance).


217326 12-Jan-2011 mdf

sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.

Commit the kernel changes.


215753 23-Nov-2010 jkim

Reinitialize PAT MSR via pmap_init_pat() while resuming. This function does
better job since r215703 and it is safer now.


215097 10-Nov-2010 jkim

Make APM emulation look more closer to its origin. Use device_get_softc(9)
instead of hardcoding acpi(4) unit number as we have device_t for it.


215072 10-Nov-2010 jkim

Refactor acpi_machdep.c for amd64 and i386, move APM emulation into a new
file acpi_apm.c, and place it on sys/x86/acpica.


215024 09-Nov-2010 jkim

Now OsdEnvironment.c is identical on amd64 and i386. Move it to a new home.


215023 09-Nov-2010 jkim

Reduce diff between platforms and fix style(9) bugs.


215012 08-Nov-2010 jhb

Move the MADT parser for amd64 and i386 to sys/x86/acpica now that it is
identical on both platforms.


215002 08-Nov-2010 jhb

A few small style and whitespace fixes.


214631 01-Nov-2010 jhb

Move <machine/apicreg.h> to <x86/apicreg.h>.


214630 01-Nov-2010 jhb

Move the <machine/mca.h> header to <x86/mca.h>.


211292 13-Aug-2010 jkim

Reset switchtime to zero rather than the current CPU ticker (TSC) value.
It is more appropriate in this context because TSC MSR is reset to zero
when the CPU is restarted from S3 and above. Move acpi_resync_clock() back
to where it was before r211202. It does not make a difference any more.


211202 12-Aug-2010 jkim

Reset switchtime and switchticks after resynchronizing the system clock.
This should fix weird runtime problem after resume on amd64. It also fixes
"calcru: runtime went backwards" warnings with bootverbose.


210942 06-Aug-2010 jkim

Remove unnecessary casting and simplify code. We are not there yet. ;-)


210940 06-Aug-2010 jkim

Correct argument order of acpi_restorecpu(), which was forgotten in r210804.


210810 03-Aug-2010 jkim

Remove an unnecessary register load.


210804 03-Aug-2010 jkim

savectx() has not been used for fork(2) for about 15 years. [1]
Do not clobber FPU thread's PCB as it is more harmful. When we resume CPU,
unconditionally reload FPU state.

Pointed out by: bde [1]


210777 02-Aug-2010 jkim

- Merge savectx2() with savectx() and struct xpcb with struct pcb. [1]
savectx() is only used for panic dump (dumppcb) and kdb (stoppcbs). Thus,
saving additional information does not hurt and it may be even beneficial.
Unfortunately, struct pcb has grown larger to accommodate more data.
Move 512-byte long pcb_user_save to the end of struct pcb while I am here.
- savectx() now saves FPU state unconditionally and copy it to the PCB of
FPU thread if necessary. This gives panic dump and kdb a chance to take
a look at the current FPU state even if the FPU is "supposedly" not used.
- Resuming CPU now unconditionally reinitializes FPU. If the saved FPU
state was irrelevant, it could be in an unknown state.

Suggested by: bde [1]


210614 29-Jul-2010 jkim

Rename PCB_USER_FPU to PCB_USERFPU not to clash with a macro from fpu.h.


210514 26-Jul-2010 jkim

Re-implement FPU suspend/resume for amd64. This removes superfluous uses
of critical_enter(9) and critical_exit(9) by fpugetregs() and fpusetregs().
Also, we do not touch PCB flags any more.

MFC after: 1 month


209957 12-Jul-2010 jkim

Move i386-inherited logic of building ACPI headers for acpi_wakeup.c into
better places and remove intermediate makefile and shell scripts. This
makes parallel kernel build little bit safer for amd64.


209212 15-Jun-2010 jhb

Restore the machine check register banks on resume. For banks being
monitored via CMCI, reset the interrupt threshold to 1 on resume.

Reviewed by: jkim
MFC after: 2 weeks


209174 14-Jun-2010 jkim

Fix ACPI suspend/resume on amd64, which was broken since r208833.
We need actual storage for FPU state to save and restore.


209059 11-Jun-2010 jhb

Update several places that iterate over CPUs to use CPU_FOREACH().


208833 05-Jun-2010 kib

Introduce the x86 kernel interfaces to allow kernel code to use
FPU/SSE hardware. Caller should provide a save area that is chained
into the stack of the areas; pcb save_area for usermode FPU state is
on top. The pcb now contains a pointer to the current FPU saved area,
used during FPUDNA handling and context switches. There is also a
facility to allow the kernel thread to use pcb save_area.

Change the dreaded warnings "npxdna in kernel mode!" into the panics
when FPU usage is not registered.

KPI discussed with: fabient
Tested by: pho, fabient
Hardware provided by: Sentex Communications
MFC after: 1 month


205332 19-Mar-2010 jhb

Use the same policy for rejecting / not-reject ACPI tables with incorrect
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


200280 08-Dec-2009 jkim

Simplify a macro not to generate unncessary symbols.


198931 04-Nov-2009 jkim

Tweak memory allocation for amd64 suspend/resume CPU context.


198422 23-Oct-2009 jkim

Try hiding annoying text cursor after the video controller is reset.


197863 08-Oct-2009 jkim

Clean up amd64 suspend/resume code.

- Allocate memory for wakeup code after ACPI bus is attached. The early
memory allocation hack was inherited from i386 but amd64 does not need it.
- Exclude real mode IVT and BDA explicitly. Improve comments about memory
allocation and reason for the exclusions. It is a no-op in reality, though.
- Remove an unnecessary CLD from wakeup code and re-align.


197536 27-Sep-2009 jkim

Copy apm(4) emulation from sys/i386/acpica/acpi_machdep.c and
install apm(8) and apm_bios.h on amd64.


197439 23-Sep-2009 jhb

Extract the code to find and map the MADT ACPI table during early kernel
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.


193530 05-Jun-2009 jkim

Import ACPICA 20090521.


190636 02-Apr-2009 jkim

Reduce code duplcations from r190620. While I am here, tweak a comment.


190635 02-Apr-2009 jkim

Chase GDT layout changes and unbreak suspend/resume on amd64.


190620 01-Apr-2009 kib

Save and restore segment registers on amd64 when entering and leaving
the kernel on amd64. Fill and read segment registers for mcontext and
signals. Handle traps caused by restoration of the
invalidated selectors.

Implement user-mode creation and manipulation of the process-specific
LDT descriptors for amd64, see sysarch(2).

Implement support for TSS i/o port access permission bitmap for amd64.

Context-switch LDT and TSS. Do not save and restore segment registers on
the context switch, that is handled by kernel enter/leave trampolines
now. Remove segment restore code from the signal trampolines for
freebsd/amd64, freebsd/ia32 and linux/i386 for the same reason.

Implement amd64-specific compat shims for sysarch.

Linuxolator (temporary ?) switched to use gsbase for thread_area pointer.

TODO:
Currently, gdb is not adapted to show segment registers from struct reg.
Also, no machine-depended ptrace command is added to set segment
registers for debugged process.

In collaboration with: pho
Discussed with: peter
Reviewed by: jhb
Linuxolator tested by: dchagin


190341 23-Mar-2009 jkim

- Clean up suspend/resume code for amd64.
- Call acpi_resync_clock() to reset system time before hardclock is ready
to tick. Note we assume the current timecounter hardware and RTC are
already available for read operation.

Tested by: mav


189903 17-Mar-2009 jkim

Initial suspend/resume support for amd64.

This code is heavily inspired by Takanori Watanabe's experimental SMP patch
for i386 and large portion was shamelessly cut and pasted from Peter Wemm's
AP boot code.


189404 05-Mar-2009 jhb

At least one BIOS bogusly includes duplicate entries for I/O APICs. The
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


177253 16-Mar-2008 rwatson

In keeping with style(9)'s recommendations on macros, use a ';'
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


177157 13-Mar-2008 jhb

Rework how the nexus(4) device works on x86 to better handle the idea of
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@


175859 31-Jan-2008 jhb

For no good reason I had assumed that ACPI table headers would be page
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


169395 08-May-2007 jhb

Handle CPUs with APIC IDs higher than 32 (at least one IBM server uses
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


167814 22-Mar-2007 jkim

Catch up with ACPI-CA 20070320 import.


167247 05-Mar-2007 jhb

Use vm_paddr_t rather than uintptr_t when passing the physical address of
APICs to lapic_init() and ioapic_create().


161223 11-Aug-2006 jhb

First pass at allowing memory to be mapped using cache modes other than
WB (write-back) on x86 via control bits in PTEs and PDEs (including making
use of the PAT MSR). Changes include:
- A new pmap_mapdev_attr() function for amd64 and i386 which takes an
additional parameter (relative to pmap_mapdev()) specifying the cache
mode for this mapping. Note that on amd64 only WB mappings are done with
the direct map, all other modes result in a private mapping.
- pmap_mapdev() on i386 and amd64 now defaults to using UC (uncached)
mappings rather than WB. Previously we relied on the BIOS setting up
MTRR's to enforce memio regions being treated as UC. This might make
hw.cbb_start_memory unnecessary in some cases now for example.
- A new pmap_mapbios()/pmap_unmapbios() API has been added to allow places
that used pmap_mapdev() to map non-device memory (such as ACPI tables)
to do so using WB as before.
- A new pmap_change_attr() function for amd64 and i386 that changes the
caching mode for a range of KVA.

Reviewed by: alc


157179 27-Mar-2006 jhb

If the XSDT address in the RSDP for an ACPI 2.0 machine is NULL, then fall
back to using the RSDT instead. ACPI-CA already follows this same strategy
as a workaround for yet another instance of brain-damaged BIOS writers.

PR: i386/93963
Submitted by: Masayuki FUKUI <fukui.FreeBSD@fanet.net>


151948 01-Nov-2005 jkim

Catch up with ACPI-CA 20051021 import


151897 31-Oct-2005 rwatson

Normalize a significant number of kernel malloc type names:

- Prefer '_' to ' ', as it results in more easily parsed results in
memory monitoring tools such as vmstat.

- Remove punctuation that is incompatible with using memory type names
as file names, such as '/' characters.

- Disambiguate some collisions by adding subsystem prefixes to some
memory types.

- Generally prefer lower case to upper case.

- If the same type is defined in multiple architecture directories,
attempt to use the same name in additional cases.

Not all instances were caught in this change, so more work is required to
finish this conversion. Similar changes are required for UMA zone names.


150003 11-Sep-2005 obrien

Canonize the include of acpi.h.


145122 15-Apr-2005 peter

MFi386: use the lapic timer for UP systems that are using the apic so that
IRQ0 and mixed mode isn't a problem anymore. This removes mixed mode
support because nothing is left that uses it.


142257 22-Feb-2005 jhb

- Add a new quirk to indicate that pin 0 of the first I/O APIC is really
IRQ 0 and not an ExtINT pin. The MADT enumerators ignore the PC-AT flag
and ignore overrides that map IRQ 0 to pin 2 when this quirk is present.
- Add a block comment above the quirks to document each quirk so that we
can use more verbose descriptions quirks.

MFC after: 2 weeks


136366 11-Oct-2004 njl

Move the code for halting the CPU (acpi_cpu_c1) into machdep files.
This removes the last MD portion of acpi_cpu.c.

MFC after: 2 weeks


133905 16-Aug-2004 peter

Sync with i386 - get the softc via the devclass rather than caching the dev


131312 30-Jun-2004 njl

Add machdep quirks functions. On i386, this disables acpi on systems with
BIOS dates earlier than Jan 1, 1999. Add prototypes and quirks flags.


130315 10-Jun-2004 peter

Insta-MFi386: ignore disabled cpu apic id's entirely


130035 03-Jun-2004 peter

MFi386: apic intpin programming updates etc.


129284 16-May-2004 peter

MFi386: numerous interrupt and acpi updates


128990 06-May-2004 njl

Make unnecessary globals static and remove unused includes.

Pointed out by: cscout


128508 21-Apr-2004 njl

Don't check for NULL, device_get_softc() always succeeds.


125221 30-Jan-2004 peter

Merge some more changes from i386.


123326 09-Dec-2003 njl

Use the ACPI-CA definitions for the various APIC tables instead of our
own.


123177 06-Dec-2003 peter

MFi386: put the apic disable hook in a better place.

Approved by: re (scottl)


123118 03-Dec-2003 peter

Add an additional knob to just disable the apic code without also having
to resort to disabling acpi as well. I'll document this in the release
notes for amd64.

Approved by: re (scottl)


122712 14-Nov-2003 peter

Minor source sync with amd64. For %.*s printf formats, pass in an
int rather than a size_t. cast the ioapicaddress variable via
uintptr_t before going to void *.


122502 11-Nov-2003 jhb

Some motherboards like to remap the SCI (normally IRQ 9) up to a PCI
interrupt such as IRQ 22 or 19. However, the ACPI BIOS still routes
interrupts from some PCI devices to the same intpin calling the pin
IRQ 22. Thus, ACPI expects to address a single interrupt source via two
different names. To work around this, if the SCI is remapped to a non-ISA
interrupt (i.e., greater than 15), then we use
acpi_OverrideInterruptLevel() function to tell ACPI to use IRQ 22 or 19
rather than IRQ 9 for the SCI.

Previously we would change IRQ 22 or 19's name to IRQ 9 when we encountered
such an Interrupt Source Override entry in the MADT which routed the SCI
properly but left PCI devices mapped to IRQ 22 or 19 w/o a routable
interrupt.

Tested by: sos


122434 10-Nov-2003 jhb

Bump APIC ID limits up to 32 since a machine with 16 CPUs will have APIC
IDs for the I/O APICs that are greater than 16.

Reported by: John Cagle <john.cagle@hp.com>


122172 06-Nov-2003 jhb

Only disable the old pin when doing a remap if it's current vector is still
the old vector.

Reported by: sam


122149 05-Nov-2003 jhb

When remapping an ISA interrupt from one intpin to another, disable the
pin that is used by the default identity mapping if it still maps to the
old vector. The ACPI case might need some tweaking for the SCI interrupt
case since ACPI likes to address the intpin using both the IRQ remapped to
it as well as the previous existing PCI IRQ mapped to it.

Reported by: kan


122016 04-Nov-2003 peter

Make this compile with PAE.


121992 03-Nov-2003 jhb

Add the ACPI MADT table APIC enumerator. This code uses the ACPI Multiple
APIC Descriptor Table to enumerate both I/O APICs and local APICs. ACPI
does not embed PCI interrupt routing information in the MADT like the MP
Table does. Instead, ACPI stores the PCI interrupt routing information
in the _PRT object under each PCI bus device. The MADT table simply
provides hints about which interrupt vectors map to which I/O APICs. Thus
when using ACPI, the existing ACPI PCI bridge drivers are sufficient to
route PCI interrupts.


120347 22-Sep-2003 peter

MFi386 by jhb: add acpi_SetDefaultIntrModel();


119531 28-Aug-2003 njl

Minor style cleanups.


118030 25-Jul-2003 obrien

Use __FBSDID().

Brought to you by: a boring talk at OLS


115428 31-May-2003 peter

Port acpica to amd64.

Approved by: re (amd64/* blanket)


114349 01-May-2003 peter

Commit MD parts of a loosely functional AMD64 port. This is based on
a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to
attempt to get a stable base to start from. There is a lot missing still.
Worth noting:
- The kernel runs at 1GB in order to cheat with the pmap code. pmap uses
a variation of the PAE code in order to avoid having to worry about 4
levels of page tables yet.
- It boots in 64 bit "long mode" with a tiny trampoline embedded in the
i386 loader. This simplifies locore.s greatly.
- There are still quite a few fragments of i386-specific code that have
not been translated yet, and some that I cheated and wrote dumb C
versions of (bcopy etc).
- It has both int 0x80 for syscalls (but using registers for argument
passing, as is native on the amd64 ABI), and the 'syscall' instruction
for syscalls. int 0x80 preserves all registers, 'syscall' does not.
- I have tried to minimize looking at the NetBSD code, except in a couple
of places (eg: to find which register they use to replace the trashed
%rcx register in the syscall instruction). As a result, there is not a
lot of similarity. I did look at NetBSD a few times while debugging to
get some ideas about what I might have done wrong in my first attempt.


112569 25-Mar-2003 jake

- Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
with PAE.
- Use this to represent physical addresses in the MI vm system and in the
i386 pmap code. This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by: DARPA, Network Associates Laboratories
Discussed with: re, phk (cdevsw change)


112551 24-Mar-2003 mdodd

Use repo-copied files in sys/i386/bios.


111815 03-Mar-2003 phk

Gigacommit to improve device-driver source compatibility between
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)


108026 18-Dec-2002 marcel

Export the physical address of the RSDP to userland by means
of the `machdep.acpi_root' sysctl. This is required on ia64
because the root pointer hardly ever, if at all, lives in the
first MB of memory and also because scanning the first MB of
memory can cause machine checks.
This provides a save and reliable way for ACPI tools to work
with the tables if ACPI support is present in the kernel. On
ia64 ACPI is non-optional.


107618 04-Dec-2002 alc

Hold the page queues lock around calls to pmap_remove().

Approved by: re


107199 24-Nov-2002 iwasaki

Add `if (!cold)' checkings for functions which is called via SYSINIT.
Loading acpi.ko with kldload is disallowed, however some
functions were executed unexpectedly.

Approved by: re


107144 21-Nov-2002 jhb

*sigh*. It seems that in the ACPICA code, Intel defines its own APIC_IO
macro for use when parsing MADT tables, thus we always tried to set the
interrupt model to APIC. This proved to be harmful on UP machines with
IO APIC's (or for UP kernels on SMP machines) since the wrong interrupt
routing information would be returned.

Pointy hat to: jhb
Approved by: re (rwatson)


105277 16-Oct-2002 jhb

- curproc may be NULL in 4-stable. In that case use the vmspace from
proc0.
- Remove unused include.

Sponsored by: The Weather Channel


105276 16-Oct-2002 jhb

Include <sys/select.h> on -stable instead of <sys/selinfo.h> to get the
definition of struct selinfo.

Sponsored by: The Weather Channel


104727 09-Oct-2002 jhb

Use d_thread_t for cdevsw functions instead of struct thread * so that it
is easier to share this code with 4-stable.


104223 30-Sep-2002 jhb

Trash the PnPBIOStable pointer later on when we know that the acpi probe
and attach routines have succeeded so that if they fail we can still use
the PnP BIOS to find ISA on-board devices. The fact that we do this here
is gross but fixing it properly involves a lot more work.


103748 21-Sep-2002 markm

Wrap GCC-specific asm() code in #ifdef __GNUC__


103023 06-Sep-2002 jhb

If we are using APIC_IO tell ACPI so it can route interrupts properly.
This still doesn't work quite right because of other APIC_IO hacks in
the i386 PCI code.


102291 22-Aug-2002 archie

Replace (ab)uses of "NULL" where "0" is really meant.


101459 07-Aug-2002 iwasaki

Improve stack manipulation code of ACPI wakeup routine.
The new code just override stack top value with saved return address
rather than pop/push operation.

Submitted by: jhb


101140 01-Aug-2002 iwasaki

Fix a bug about stack manipulation at ACPI wakeup.
This should avoid kernel panic on kernel compiled w/o
NO_CPU_COPTFLAGS.

Suggested by: optimized code by -mcpu=pentiumpro


99149 30-Jun-2002 iwasaki

Resolve conflicts arising from the ACPI CA 20020404 import.


96929 19-May-2002 peter

Make this compile with gcc-3.1, which objects to the multi-line string.


89179 10-Jan-2002 wes

Fix typo in function name.

Reviewed by: peter@
Obtained from: mux@sneakerz.org


89156 09-Jan-2002 takawata

Fix S3 breakage.
Now AcpiEnterSleep() is light enough, so flushing cache
before the function is not too early.


89054 08-Jan-2002 msmith

Staticise devclasses and some unnecessarily global variables.


86554 18-Nov-2001 iwasaki

Yet another verbose printing cleanup. Remove debug_wakeup flag and
check common verbose flag instead.


86262 11-Nov-2001 iwasaki

Add two minor changes.
- clean up wakeup routing fixup code by using macros.
- allocate pte object temporary for kernel thread to avoid kernel
panic by events from sleep button or lid switch.


86133 06-Nov-2001 iwasaki

Add S4BIOS sleep (BIOS hibernation) and DSDT overriding support.
- Add S4BIOS sleep implementation. This will works well if MIB
hw.acpi.s4bios is set (and of course BIOS supports it and hibernation
is enabled correctly).
- Add DSDT overriding support which is submitted by takawata originally.
If loader tunable acpi_dsdt_load="YES" and DSDT file is set to
acpi_dsdt_name (default DSDT file name is /boot/acpi_dsdt.aml),
ACPI CA core loads DSDT from given file rather than BIOS memory block.
DSDT file can be generated by iasl in ports/devel/acpicatools/.
- Add new files so that we can add our proposed additional code to Intel
ACPI CA into these files temporary. They will be removed when
similar code is added into ACPI CA officially.


85556 26-Oct-2001 iwasaki

Add APM compatibility feature to ACPI.
This emulates APM device node interface APIs (mainly ioctl) and
provides APM services for the applications. The goal is to support
most of APM applications without any changes.
Implemented ioctls in this commit are:
- APMIO_SUSPEND (mapped ACPI S3 as default but changable by sysctl)
- APMIO_STANDBY (mapped ACPI S1 as default but changable by sysctl)
- APMIO_GETINFO and APMIO_GETINFO_OLD
- APMIO_GETPWSTATUS

With above, many APM applications which get batteries, ac-line
info. and transition the system into suspend/standby mode (such as
wmapm, xbatt) should work with ACPI enabled kernel (if ACPI works well :-)

Reviewed by: arch@, audit@ and some guys


83181 07-Sep-2001 msmith

Now that this code is MD, we don't need the i386 ifdefs.


80160 22-Jul-2001 iwasaki

Don't do sleep state transition if specified sleep state is not
supported by the system.


80078 21-Jul-2001 msmith

Convert from acpi_strerror() to AcpiFormatException()

Fix dangling include of the dear departed acpi_ecreg.h


80071 21-Jul-2001 msmith

Update the OSD module to match the ACPI CA 20010717 import.

Submitted by: "Grover, Andrew" <andrew.grover@intel.com> (OsdHardware.c)


80028 20-Jul-2001 takawata

Add ACPI S2-S4BIOS Suspend/Resume code.
Some problems may remain.

Reviewed by:iwasaki


67760 28-Oct-2000 msmith

FreeBSD-specific OSD (operating system dependant) modules for the Intel
ACPICA code.