Commit Graph

164 Commits

Author SHA1 Message Date
jhb
501c9f150e Use polling spin loops for timeouts during early boot.
Some ACPI operations such as mutex acquires and event waits accept a
timeout.  The ACPI OSD layer implements these timeouts by using regular
sleep timeouts.  However, this doesn't work during early boot before
event timers are setup.  Instead, use polling combined with DELAY()
to spin.

This fixes booting on upcoming Intel systems with Kaby Lake processors.

Tested by:	"Jeffrey E Pieper" <jeffrey.e.pieper@intel.com>
Reviewed by:	jimharris
MFC after:	1 week
2016-05-16 21:33:31 +00:00
jkim
0df04f6464 Merge ACPICA 20160422. 2016-04-27 19:09:21 +00:00
jkim
0481c185aa Merge ACPICA 20150818. 2015-08-26 17:13:47 +00:00
andrew
cd458c627d Add basic support for ACPI. It splits out the nexus driver to two new
drivers, one for fdt, one for acpi. It then uses this to decide if it will
use fdt or acpi.

The GICv2 (interrupt controller) and Generic Timer drivers have been
updated to handle both cases.

As this is early code we still need FDT to find the kernel console, and
some parts are still missing, including PCI support.

Differential Revision:	https://reviews.freebsd.org/D2463
Reviewed by:	jhb, jkim, emaste
Obtained from:	ABT Systems Ltd
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2015-06-11 15:45:33 +00:00
jkim
3f8a9f0ec1 Merge ACPICA 20140926. 2014-10-02 19:11:18 +00:00
will
b61070b384 Add sysctl to track the resource consumption of ACPI interrupts.
Submitted by:	gibbs
MFC after:	1 month
Sponsored by:	Spectra Logic
MFSpectraBSD:	636827 on 2012/09/28
2014-10-01 14:35:52 +00:00
hselasky
35b126e324 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
gjb
fc21f40567 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
2014-06-27 22:05:21 +00:00
hselasky
bd1ed65f0f 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
2014-06-27 16:33:43 +00:00
smh
5008097060 Remove duplicate SYSCTL_DECL(_debug_acpi) which was breaking tinderbox
MFC after:	2 weeks
X-MFC-With: r264849
2014-04-24 14:58:12 +00:00
smh
d311afade4 Exposed debug.acpi.max_tasks and debug.acpi.max_threads via sysctls so their
values can be viewed.
2014-04-24 00:41:02 +00:00
jkim
c55a3ec3ad Tidy up global locks for ACPICA. There is no functional change. 2013-08-13 21:34:03 +00:00
jkim
ca7944e405 Merge ACPICA 20130517. 2013-05-20 23:52:49 +00:00
jkim
51db6f82a1 - Prefer ACPI_COMPARE_NAME(a, b) macro over strncmp(a, b, ACPI_NAME_SIZE).
- Make sure the predefined name is a string type.
- Return slightly more useful errors.
2013-05-20 22:18:18 +00:00
jkim
4a97d198fc Fix white spaces. 2013-05-20 22:10:01 +00:00
jkim
33e791eff7 Fix two misusages of return_*() macros for ACPICA.
Noticed by:	avg
2013-01-28 21:10:35 +00:00
jkim
93443619fc Fix white spaces for style consistency. 2013-01-28 21:06:20 +00:00
jkim
982ce06534 Consistently use ACPI_SUCCESS() and ACPI_FAILURE() macros wherever possible. 2012-06-01 21:33:33 +00:00
jkim
5e29a3bfbb Merge ACPICA 20120518. 2012-05-24 23:12:30 +00:00
jkim
ec0f329a37 Fix a long-standing bug for AcpiOsGetTimer(). time_t is 32-bit on i386 and
it needs proper casting before multiplication.

MFC after:	3 days
2012-02-24 23:15:21 +00:00
jkim
a561c762ba Merge ACPICA 20120215. 2012-02-16 22:59:29 +00:00
jkim
fccbffe7d8 De-obfuscate acpi_acquire_global_lock(). It seems the function was directly
translated from i386 assembly version.
2012-02-10 23:30:29 +00:00
ed
e97eae1577 Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
jkim
dad6aab353 Merge ACPICA 20110527. 2011-05-31 19:45:58 +00:00
marcel
c9efdfff4f Use the preload_fetch_addr() and preload_fetch_size() convenience
functions to obtain the address and size of the overriding DSDT.

Sponsored by: Juniper Networks.
2011-02-13 19:24:04 +00:00
jkim
d062de36dc Fix a witness(4) warning introduced in r217238. 2011-01-11 19:20:01 +00:00
jkim
ab709a4e92 Remove impossible error conditions. 2011-01-10 21:09:38 +00:00
jkim
e06fa8b36f Add forgotten free(9) in the previous commit for an error case. 2011-01-10 21:01:41 +00:00
jkim
61d3626b69 Allow AcpiOsInstallInterruptHandler() and AcpiOsRemoveInterruptHandler() to
install or remove non-SCI interrupt handlers per ACPI Component Architecture
User Guide and Programmer Reference.  ACPICA may install such interrupt
handler when a GPE block device is found, for example.  Add a wrapper for
ACPI_OSD_HANDLER, convert its return values to ours, and make it a filter.
Prefer KASSERT(9) over panic(9) as we have never seen those in reality.
Clean up some style(9) nits and add my copyright.
2011-01-10 20:56:59 +00:00
jkim
a3d023442b Prefer KASSERT(9) over panic(9) as it was never seen in reality. 2011-01-10 20:26:36 +00:00
jkim
2de6528ef1 Clean up unused headers. 2010-10-13 17:06:25 +00:00
jkim
c60347528d Remove acpi_bus_number() completely. It had to be removed in r212761.
Pointed out by:	jhb
2010-10-13 16:30:41 +00:00
rpaulo
74808bc8f5 Mark acpi_bus_number() as __unused. This allows clang to this file
without any warnings.
2010-10-13 11:38:24 +00:00
jkim
ddeb148f3e Merge ACPICA 20100915. 2010-09-16 20:08:00 +00:00
jkim
68285361e2 Merge ACPICA 20100806. 2010-08-06 23:11:19 +00:00
jkim
8670848171 Simplify AcpiOsReadPort() and AcpiOsWritePort() with iodev_read_*() and
iodev_write_*().  This removes unnecessary uses of temporary macros as well.
There is no functional change after this (verified with md5(1) on amd64).
2010-07-16 04:27:38 +00:00
jkim
4006e89baa Use pmap_mapdev()/pmap_unmapdev() to map device memory instead of using
AcpiOsMapMemory()/AcpiOsUnmapMemory() (-> pmap_mapbios()/pmap_unmapbios())
for AcpiOsReadMemory() and AcpiOsWriteMemory().  Although they do not sound
too obvious, these functions are exclusively used to access memory mapped
IO in ACPICA.
2010-07-16 03:59:50 +00:00
jkim
66838c310f - AcpiOsReadPciConfiguration() needs similar fixes as r209965 and r210129.
According to ACPICA User Guide and Programmer Reference, the read data must
be zero extended to fill the 64-bit return value even if the bit width of
the location is less than 64.
- Return error when 64-bit access is requested as we do not support 64-bit
PCI register access (yet).  XXX We may have to split it up into two 32-bit
accesses if it is really required.
2010-07-15 19:52:54 +00:00
jkim
8ff80a5cd7 - AcpiOsReadMemory() needs similar fixes as r209965. [1]
According to ACPICA User Guide and Programmer Reference, the read data must
be zero extended to fill the 32-bit return value even if the bit width of
the port is less than 32.
- Remove 64-bit read/write from AcpiOsReadMemory() and AcpiOsWriteMemory().
These functions do not support 64-bit access (yet).  Clean up style nits
and unnecessary bit masking while I am here.

Reported by:	Liu, Jinsong (jinsong dot liu at intel dot com) via
		Lin Ming (ming dot m dot lin at intel dot com) [1]
2010-07-15 17:11:49 +00:00
jkim
81c2c240ef Fix white spaces. 2010-07-13 02:48:42 +00:00
jkim
68aeab54db According to ACPICA User Guide and Programmer Reference, the read data must
be zero extended to fill the 32-bit return value even if the bit width of
the port is less than 32.
2010-07-13 02:45:44 +00:00
jkim
4c85155383 Merge ACPICA 20100428. 2010-04-28 22:25:27 +00:00
jkim
fa5d03cca6 Merge ACPICA 20100121. 2010-01-21 21:14:28 +00:00
jkim
d05c6432a7 Add a missing return in NULL mutex case.
Submitted by:	Pawel Worach (pawel dot worach at gmail dot com)
2009-06-22 17:46:55 +00:00
jkim
3b251954d0 - Remove unnecessary read memory barriers from atomic operations[1].
- Define a macro to make my intention more clearer.

Submitted by:	jhb [1]
2009-06-11 16:48:59 +00:00
jkim
1ff58b5698 Catch up with r193750 (OsdSynch.c locking changes):
- Preallocate some memory for ACPI tasks early enough.  We cannot use
malloc(9) any more because spin mutex may be held here.  The reserved
memory can be tuned via debug.acpi.max_tasks tunable or ACPI_MAX_TASKS
in kernel configuration.  The default is 32 tasks.
- Implement a custom taskqueue_fast to wrap the new memory allocation.
This implementation is not the fastest in the world but we are being
conservative here.
2009-06-10 22:54:20 +00:00
jkim
8e7d7973ac Remove redundant checks for ACPI_WAIT_FOREVER cases. 2009-06-08 20:50:38 +00:00
jkim
8ede8714ca Rewrite OsdSynch.c to reflect the latest ACPICA more closely:
- Implement ACPI semaphore (ACPI_SEMAPHORE) with condvar(9) and mutex(9).
- Implement ACPI mutex (ACPI_MUTEX) with mutex(9).
- Implement ACPI lock (ACPI_SPINLOCK) with spin mutex(9).
2009-06-08 20:07:16 +00:00
jkim
6d358bddff Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
mav
d69ede8261 Remove " + 1".
Thread ID can't be zero anyway while increment may give owerflow.
2008-11-03 18:28:12 +00:00