History log of /freebsd-current/sys/amd64/acpica/acpi_machdep.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 19ee8335 27-Oct-2022 Jung-uk Kim <jkim@FreeBSD.org>

acpica: Merge ACPICA 20221020


# 7ae99f80 22-Sep-2022 John Baldwin <jhb@FreeBSD.org>

pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.

This matches the return type of pmap_mapdev/bios.

Reviewed by: kib, markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D36548


# 991aef97 01-Sep-2022 Warner Losh <imp@FreeBSD.org>

acpi: Move some errors with RSDP and XSLT out from under bootverbose

Failure to map RSDP, XSLT and checksum failures are events that can't
happen unless something has gone wrong. As such, they should be reported
always, and not in bootverbose. This has been this way since it was
originally brought in to parse APIC tables.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D36406


# a14b26a6 01-Sep-2022 Warner Losh <imp@FreeBSD.org>

acpi: Unmap RSDP in more error cases

Add missing pmap_unmapbios() calls for when we return 0. Otherwise we
can leave the table mapped when it is of no use.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D36405


# badcc74f 06-May-2022 John Baldwin <jhb@FreeBSD.org>

amd64: Remove unused devclass arguments to DRIVER_MODULE.


# 43909748 19-Jul-2021 Jessica Clarke <jrtc27@FreeBSD.org>

acpi: Fix a repeated comment typo


# 52fba9a9 19-Jul-2021 Jessica Clarke <jrtc27@FreeBSD.org>

acpi: Fix a repeated vm_offset_t that should be a vm_size_t

The underlying types for both are the same so arguably this doesn't
really matter, but using the wrong type is still confusing and
technically incorrect.


# 732b69c9 04-Mar-2021 Mark Johnston <markj@FreeBSD.org>

acpi: Make nexus_acpi quiet on amd64 and i386

Otherwise during attach newbus prints "nexus0", which is not very
useful.

The generic nexus device is already quiet, as is nexus_acpi on arm64.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation


# 543769bf 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

amd64: clean up empty lines in .c and .h files


# 72c7f24c 19-Aug-2020 Mark Johnston <markj@FreeBSD.org>

Use pmap_mapbios() to map ACPI tables on amd64 and i386.

The ACPI table-mapping code used pmap_kenter_temporary() to create
mappings, which in turn uses the fixed-size crashdump map. Moreover,
the code was not verifying that the table fits in this map, so when
mapping large tables we could clobber adjacent mappings. This use of
pmap_kenter_temporary() appears to predate support in pmap_mapbios() for
creating early mappings, but that restriction no longer applies.

PR: 248746
Reviewed by: kib, mav
Tested by: gallatin, Curtis Villamizar <curtis@ipv6.occnc.com>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26125


# 8f6355b5 19-Aug-2020 Alexander Motin <mav@FreeBSD.org>

Remove some noisy ACPI tables messages from verbose dmesg.

Those messages were printed hundreds of times during boot, often multiple
times for each table. We already print information about the tables in
more organized form once to not duplicate it when random ACPI drivers are
attaching.

MFC after: 1 week


# 0ef8c0cb 23-Feb-2018 Jung-uk Kim <jkim@FreeBSD.org>

Partially revert r197863 to reduce diff against i386.

When I wrote the patch, I wanted to remove SYSINIT() usage from amd64 code.
There is no reason to keep the divergence any more because iwasaki merged
most amd64 suspend/resume code to i386 with r235622. Note this also fixed
an enge case reported by royger. [1]

Suggested by: jhb
Reviewed by: royger
Tested by: royger [1]
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14400 [1]


# c49761dd 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/amd64: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# b57a73f8 08-May-2015 Konstantin Belousov <kib@FreeBSD.org>

If x86 CPU implementation of the MWAIT instruction reasonably
interacts with interrupts, query ACPI and use MWAIT for entrance into
Cx sleep states. Support C1 "I/O then halt" mode. See Intel'
document 302223-007 "Intelб╝ Processor Vendor-Specific ACPI Interface
Specification" for description.

Move the acpi_cpu_c1() function into x86/cpu_machdep.c and use
it instead of inlining "sti; hlt" sequence in several places.

In the acpi(4) man page, besides documenting the dev.cpu.N.cx_methods
sysctl, correct the names for dev.cpu.N.{cx_usage,cx_lowest,cx_supported}
sysctls.

Both jkim and avg have some other patches implementing the mwait
functionality; this work is unrelated. Linux does not rely on the
ACPI to provide correct tables describing Cx modes. Instead, the
driver has pre-defined knowledge of the CPU models, it was supplied by
Intel.

Tested by: pho (previous versions)
Sponsored by: The FreeBSD Foundation


# af3b2549 27-Jun-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

Pull in r267961 and r267973 again. Fix for issues reported will follow.


# 37a107a4 27-Jun-2014 Glen Barber <gjb@FreeBSD.org>

Revert r267961, r267973:

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


# 3da1cf1e 27-Jun-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

Extend the meaning of the CTLFLAG_TUN flag to automatically check if
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


# 00a54dfb 15-Feb-2013 Jung-uk Kim <jkim@FreeBSD.org>

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


# 424e6975 17-May-2012 John Baldwin <jhb@FreeBSD.org>

Centralize declaration of the debug.acpi sysctl node.


# fbbb13f9 12-Jan-2011 Matthew D Fleming <mdf@FreeBSD.org>

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

Commit the kernel changes.


# 93a88474 10-Nov-2010 Jung-uk Kim <jkim@FreeBSD.org>

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.


# 7c2bf852 09-Nov-2010 Jung-uk Kim <jkim@FreeBSD.org>

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.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# d8c0d3dd 26-Mar-2010 John Baldwin <jhb@FreeBSD.org>

MFC 205332:
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.


# 42c93b8d 18-Mar-2010 John Baldwin <jhb@FreeBSD.org>

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


# ff5bfa3e 29-Oct-2009 John Baldwin <jhb@FreeBSD.org>

MFC 197439:
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.


# a7e2341e 08-Oct-2009 Jung-uk Kim <jkim@FreeBSD.org>

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.


# 71f99e63 27-Sep-2009 Jung-uk Kim <jkim@FreeBSD.org>

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


# d95e7f5a 23-Sep-2009 John Baldwin <jhb@FreeBSD.org>

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.


# 129d3046 05-Jun-2009 Jung-uk Kim <jkim@FreeBSD.org>

Import ACPICA 20090521.


# aaac7452 02-Jun-2009 Jung-uk Kim <jkim@FreeBSD.org>

Chase ACPICA API changes (for kernel and boot loader).


# d2b227cd 23-Mar-2009 Jung-uk Kim <jkim@FreeBSD.org>

- 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


# c66d2b38 16-Mar-2009 Jung-uk Kim <jkim@FreeBSD.org>

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.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5217af30 13-Mar-2008 John Baldwin <jhb@FreeBSD.org>

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@


# 2a191126 11-Sep-2005 David E. O'Brien <obrien@FreeBSD.org>

Canonize the include of acpi.h.


# 31ad3b88 10-Oct-2004 Nate Lawson <njl@FreeBSD.org>

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


# e8802274 16-Aug-2004 Peter Wemm <peter@FreeBSD.org>

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


# 1a26ea7f 29-Jun-2004 Nate Lawson <njl@FreeBSD.org>

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


# 8ec94874 20-Apr-2004 Nate Lawson <njl@FreeBSD.org>

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


# 8848ad86 22-Sep-2003 Peter Wemm <peter@FreeBSD.org>

MFi386 by jhb: add acpi_SetDefaultIntrModel();


# 5a4d072c 28-Aug-2003 Nate Lawson <njl@FreeBSD.org>

Minor style cleanups.


# 12ea2cfe 25-Jul-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().

Brought to you by: a boring talk at OLS


# afa88623 30-Apr-2003 Peter Wemm <peter@FreeBSD.org>

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.


# b7b5ae3e 24-Mar-2003 Matthew N. Dodd <mdodd@FreeBSD.org>

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


# 7ac40f5f 02-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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)


# ebff7660 21-Nov-2002 John Baldwin <jhb@FreeBSD.org>

*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)


# 42233ad3 16-Oct-2002 John Baldwin <jhb@FreeBSD.org>

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

Sponsored by: The Weather Channel


# 6b4d1b08 09-Oct-2002 John Baldwin <jhb@FreeBSD.org>

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


# 31a51bf6 30-Sep-2002 John Baldwin <jhb@FreeBSD.org>

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.


# d3b9beba 06-Sep-2002 John Baldwin <jhb@FreeBSD.org>

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.


# f86214b6 26-Oct-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

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