| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unmap the IRQ instead of just freeing the map data in the case of an
error. Also don't overwrite the resource's virtual address since the
copy of the map data made by intr_activate_irq is stored there.
Implement gpiobus_release_resource so it can unmap IRQs mapped by
gpio_alloc_intr_resource.
Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D51325
|
|
|
|
|
|
|
|
| |
GPIO controllers aren't required to have an _AEI object.
Reviewed by: wulf
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D51236
|
|
|
|
|
|
|
|
|
| |
Move functions and variables internal to gpiobus to their own header to
avoid namespace pollution and misuse.
Reviewed by: wulf, imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50872
|
|
|
|
|
|
|
|
|
|
|
|
| |
gpiobus_release_pin is only meant to be used internally by gpiobus. Use
gpio_pin_release instead.
This also fixes a memory leak since gpio_pin_get_by_ofw_idx returns a
malloc'd pointer, which gpio_pin_release now frees.
Reviewed by: wulf, imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50871
|
|
|
|
|
|
|
|
|
|
|
| |
In some cases, drivers may need to acquire an existing gpio_pin_t. With
the functions gpiobus currently exposes, this isn't possible as they
allocate a new pin then acquire that. Add a new gpio_pin_acquire
function which accepts an existing gpiobus_pin structure.
Reviewed by: mmel, imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50869
|
|
|
|
|
|
| |
Reviewed by: mmel, imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50868
|
|
|
|
|
|
|
|
|
| |
These are programming errors.
Suggested by: mmel
Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50939
|
|
|
|
|
|
|
|
|
|
| |
It is a programming error to call this function with an invalid pin.
Also return proper error value on failure.
Suggested by: mmel
Reviewed by: imp, mmel
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50940
|
|
|
|
|
|
|
|
|
|
| |
Only attach gpiobus when the controller is fully initialized. Children
of gpiobus expect this to be the case.
Reviewed by: mmel, imp, andrew
Approved by: imp (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51088
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some drivers need to postpone the attachment of gpiobus until hardware
init is done. Add a new gpiobus_add_bus function to accommodate this
case.
Suggested by: mmel, andrew
Reviewed by: mmel, imp, andrew
Approved by: imp (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51133
|
|
|
|
|
|
| |
Reviewed by: imp, jhb
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50913
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Switch to using sys/stdarg.h for va_list type and va_* builtins.
Make an attempt to insert the include in a sensible place. Where
style(9) was followed this is easy, where it was ignored, aim for the
first block of sys/*.h headers and don't get too fussy or try to fix
other style bugs.
Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
|
|
|
|
|
|
|
|
|
|
|
| |
We call an ACPICA function in the interrupt handler which may attempt to
lock a mutex. If this is done while another instance of the handler
already holds the lock, it would cause a kernel panic since sleeping
isn't allowed.
Reviewed-by: Warner Losh <imp@FreeBSD.org>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1667
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
|
|
|
|
|
|
|
|
|
| |
GPIOBUS_PIN_SETFLAGS calls GPIO_PIN_SETFLAGS, which doesn't accept
interrupt flags.
Reviewed-by: Warner Losh <imp@FreeBSD.org>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1667
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The flags member of gpio_pin_t was only meant for pin flags acquired via
the FDT.
Instead, make an accessor so gpioaei can still access the flags and
remove the now unused gpio_pin_get_by_acpi_index.
Reviewed-by: Warner Losh <imp@FreeBSD.org>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1667
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
This message was identical to another a few lines up, making it hard to
tell where the error occurred.
Reviewed-by: Ed Maste <emaste@FreeBSD.org>
Reviewed-by: Warner Losh <imp@FreeBSD.org>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1667
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
This method is often used to process GPIO "Power on" button press on
modern x86 laptops with S0ix sleep mode.
Tested with patch from https://reviews.freebsd.org/D26407
Sponsored by: Future Crew LLC
MFC after: 2 month
|
|
|
|
|
| |
Different drivers respond differently to having neither GPIO_PIN_INPUT
or GPIO_PIN_OUTPUT set, this stops the unpredictable results.
|
|
|
|
|
|
|
| |
Earlier calls to bus_generic_detach now take care of deleting
children.
Differential Revision: https://reviews.freebsd.org/D47962
|
|
|
|
|
|
|
| |
These drivers perform additional teardown steps in between detaching
child devices and deleting child devices.
Differential Revision: https://reviews.freebsd.org/D47957
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When GPIOBUS_PIN_SETFLAGS fails we called gpiobus_free_ivars to clean
up the contents of the ivar, then would free the ivar. This lead to a
use-after-free as the ivar had already been set on the child so
gpiobus_child_deleted would try to free it again.
Fix this by removing the early cleanup and letting
gpiobus_child_deleted handle it.
Fixes: c9e880c0ceef ("gpiobus: Use a bus_child_deleted method to free ivars for children")
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47670
|
|
|
|
|
| |
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47675
|
|
|
|
|
| |
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47674
|
|
|
|
|
|
| |
No functional change intended.
MFC after: 1 week
|
|
|
|
|
|
| |
MFC after: 3 days
Reviewed by: ray
Differential Revision: https://reviews.freebsd.org/D47570
|
|
|
|
|
|
|
|
|
| |
These drivers are not bus drivers, and would need proper detach
routines that tore down state stored in the softc. Better to just
fail detach outright instead of an incorrect success.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47389
|
|
|
|
|
| |
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47369
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes to acpi_gpiobus.c handle discovering and parsing the _AEI
objects and storing necessary data in device ivars. A new gpioaei.c
file implements the device, which simply requests an interrupt when
the pin is triggered and invokes the appropriate _Exx or _Lxx ACPI
method.
This makes the GPIO "power button" work on arm64 Graviton systems,
allowing EC2 "Stop"/"Reboot" instance calls to be handled cleanly.
(Prior to this change, those requests would time out after 4 minutes
and the instance would be forcibly killed.)
Reviwed by: imp, andrew, Ahmad Khalifa
MFC after: 3 days
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D47253
Co-authored-by: Andrew Turner <andrew@FreeBSD.org>
|
|
|
|
|
|
|
|
|
| |
The IoRestriction field of ACPI_RESOURCE_GPIO is only meaningful
for resources of type ACPI_RESOURCE_GPIO_TYPE_IO.
Reported by: jrtc27
Reviewed by: jrtc27
Differential Revision: <https://reviews.freebsd.org/D47331>
|
|
|
|
|
|
|
|
|
|
|
| |
GPIO interrupts work just fine and will be used shortly. We still
do not support GPIO_INTR_SHAREABLE however, so leave that within
the NOT_YET scope.
Reviwed by: andrew
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D47251
|
|
|
|
|
|
|
|
|
|
| |
This allows acpi_gpiobus to override the method and fall back to the
generic gpiobus_read_ivar function if needed.
Reviewed by: andrew
MFC after: 1 week
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D47250
|
|
|
|
|
|
|
|
|
|
| |
The firmware may have unmasked pl011 interrupts. If we don't have a
device to handle one the kernel will print a spurious interrupt
warning. Rather than print the warning mask all interrupts until we
are ready to handle them.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46863
|
|
|
|
|
|
|
|
| |
Right now flags is set to 0 before this "=" -> "|=" change, but it will
matter when the NOT_YET section above becomes effective.
MFC after: 2 weeks
Sponsored by: Amazon
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the ordering of priv data creation with setting priv data. This
handles failure better and resolves a panic when repeatedly running
tools/tools/gpioevents.
Explicitly initialise more fields in priv data while we are here.
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46568
|
|
|
|
|
|
|
|
|
| |
This currently only implements the address space handler and attempts to
configure pins with flags obtained from ACPI.
Reviewed by: wulf
MFC after: 1 month
Pull Request: https://github.com/freebsd/freebsd-src/pull/1359
|
|
|
|
|
| |
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1349
|
|
|
|
| |
Sponsored by: Netflix
|
|
|
|
|
| |
Reported by: andrew
Fixes: 5bda26333a8e gpiobus: Use bus_generic_rman_*
|
|
|
|
|
| |
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43887
|
|
|
|
|
|
|
|
|
|
|
| |
Power off or reset may be activated either by low or high signal or by an
edge. So, try everything.
Also, the driver now supports DTS properties for timings.
Finally, the driver does not change the pin configuration during attach.
It is assumed that the pin is already in a state that does not trigger
the power event (otherwise we wouldn't be running).
|
|
|
|
|
|
|
|
|
|
|
| |
We've removed kernel option EXT_RESOURCES almost two years ago.
While it was ok to have some code under a common 'extres' subdirectory
at first, we now have a lot of consumer of it and we made it mandatory
so no need to have it under a cryptic name.
Reviewed by: emaste, imp
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D43194
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42715
|
|
|
|
| |
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
|
|
|
|
| |
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
|
|
|
| |
Remove /^#include\s+<sys/cdefs.h>.*$\n\s+__FBSDID\("\$FreeBSD\$"\);\n/
|
|
|
|
| |
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactor to eliminate duplicated rate and delay tables, with minor style
tweaks for changed lines. Remove an obsolete comment about needing to
convert from microseconds to ticks (that's done elsewhere). Remove
traiing whitespace in kbdcontrol.c.
Except for the new warning, no change in behavior
Sponsored by: DSS GmbH
Reviewed by: imp [minor style tweaks as well]
Pull Request: https://github.com/freebsd/pull/683
Differential Revision: https://reviews.freebsd.org/D38818
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
FreeBSD-9 had introduced support for the full set of Unicode
characters to the parsing and processing of keymap character tables.
This support has been extended to cover the table for accented
characters that are reached via dead key combinations in FreeBSD-13.2.
New ioctls have been introduced to support both the pre-Unicode and
the Unicode formats and keyboard drivers have been extended to support
those ioctls.
This commit makes the ABI compatibility functions in the kernel
optional and dependent on COMPAT_FREEBSD13 in -CURRENT.
The kbdcontrol command in -CURRENT and 13-STABLE (before 13.2) has
been made ABI compatible with old kernels to allow a new world to be
run on an old kernel (that does not have full Unicode support for
keymaps).
This commit is not to merged back to 12-STABLE or 13-STABLE. It is
part of review D38465, which has been split into 3 separate commits
due to different MFC and life-time requirements of either commit.
Approved by: imp
Differential Revision: https://reviews.freebsd.org/D38465
|