aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bhnd
Commit message (Collapse)AuthorAgeFilesLines
* bus: Document special ranges of IVARsJohn Baldwin7 days1-1/+1
| | | | | | | | | | | | | Some IVAR indices are special in that they have global meaning across multiple buses where as other IVARs are always private to the local bus. Try to document this a bit and add constants for the various ranges to avoid future conflicts. This is a no-op, but IVAR indices are now generally defined as enums as that makes it easier to define them in terms of ranges. Reviewed by: imp, royger, andrew Differential Revision: https://reviews.freebsd.org/D54159
* bhnd_bus_*_resource: Remove redundant type and rid argumentsJohn Baldwin2025-12-0922-111/+58
| | | | | | | | | | | | | | Remove type and rid arguments from bhnd_bus_(activate|deactivate|release)_resource. This should have been done earlier to match the changes made to bus_release_resource, etc. While fixing up the callers, remove rid members from softc structures since the only time a value is needed is as a constant input to bhnd_bus_alloc_resource*. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53410
* bhnd_bus_alloc_resource*: Pass rid by valueJohn Baldwin2025-12-0912-17/+17
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53409
* bus_alloc_resource: Pass rid by value to BUS_ALLOC_RESOURCE DEVMETHODJohn Baldwin2025-12-093-12/+12
| | | | | | | | | The wrapper functions such as bus_alloc_resource_any() still support passing the rid by value or pointer, but the underlying implementation now passes by value. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53402
* gpio: remove gpiobus_attach_busAhmad Khalifa2025-08-131-1/+3
| | | | | | | | | | | | Since gpiobus_attach_bus can attach the gpiobus child along with its children in the same bus pass, the parent controller's reference to gpiobus might not be set by the time the children need it. Instead, drivers should use gpiobus_add_bus and explicitly call bus_attach_children. Reviewed by: mmel, imp (older version) Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D51578
* newbus: replace leftover device unit wildcardsAhmad Khalifa2025-06-212-3/+5
| | | | | | Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
* machine/stdarg.h -> sys/stdarg.hBrooks Davis2025-06-112-3/+2
| | | | | | | | | | | | | 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
* bhnd bcma/siba: Remove duplicate call to device_delete_childrenJohn Baldwin2025-01-022-2/+0
| | | | | | | bcma/siba_add_children already call device_delete_children if an error occurs. Differential Revision: https://reviews.freebsd.org/D47968
* siba: Use device_delete_children in siba_add_childrenJohn Baldwin2025-01-021-6/+1
| | | | Differential Revision: https://reviews.freebsd.org/D47967
* bus_generic_detach: Delete children after detaching themJohn Baldwin2025-01-022-7/+0
| | | | | | | | | | | | | | | | | This provides better semantics as a standalone DEVMETHOD for device_attach as bus drivers should remove child devices they created as part of detach cleanup. The implementation calls bus_detach_children() first to permit child devices an opportunity to veto the detach operation. If that succeeds, device_delete_children() is used to delete the child devices. This requires fixing various drivers that were deleting devices explicitly (via a device_t pointer cached in the softc) after calling bus_generic_detach to stop doing that and just rely on bus_generic_detach to remove child devices. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47959
* bhnd: Fix a few use after frees when releasing resourcesGavin Atkinson2024-12-272-10/+13
| | | | | | | The resource list entry needs to be looked up using rman_get_* prior to releasing the resource. Fixes: 9dbf5b0e6876 new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCE
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-065-25/+6
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANYWarner Losh2024-07-255-10/+10
| | | | Sponsored by: Netflix
* bhnd: Use device_set_descf()Mark Johnston2024-06-022-21/+3
| | | | | | | Here we are in a device probe routine with no locks held. M_WAITOK allocations are ok. No functional change intended. MFC after: 1 week
* bhnd: Remove orphaned driver for the BHND USB coreJohn Baldwin2024-06-014-1087/+0
| | | | | | | | This was only connected to the build for MIPS and has been disconnected from the build since MIPS was removed. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D45432
* bhnd(4): Remove a double word in a source code commentGordon Bergling2024-04-201-1/+1
| | | | | | - s/of of/of/ MFC after: 3 days
* new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCEJohn Baldwin2024-03-134-22/+18
| | | | | | | | | | The public bus_release_resource() API still accepts both forms, but the internal kobj method no longer passes the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44131
* new-bus: Remove the 'rid' and 'type' arguments from BUS_*ACTIVATE_RESOURCEJohn Baldwin2024-03-133-59/+41
| | | | | | | | | | The public bus_activate/deactivate_resource() API still accepts both forms, but the internal kobj methods no longer pass the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44130
* new-bus: Remove the 'type' argument from BUS_ADJUST_RESOURCEJohn Baldwin2024-03-132-7/+6
| | | | | | | | | | The public bus_adjust_resource() API still accepts both forms, but the internal kobj method no longer passes the argument. Implementations which need the type now use rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44128
* bhnd: Use rman_get_type in bhndb_find_resource_limitsJohn Baldwin2024-03-133-6/+6
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44126
* sys: Set the type of allocated bus resourcesJohn Baldwin2024-03-131-0/+1
| | | | | | | | Use rman_set_type to set the type of allocated resources everywhere rman_set_rid is currently called. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44123
* bhnd_chipc: Make use of bus_generic_rman_* to simplify some codeJohn Baldwin2024-02-271-46/+22
| | | | | | | | This uses bus_generic_rman_alloc/release_resource to reduce some code duplication. However, I've left the custom activate/deactivate methods as-is. Differential Revision: https://reviews.freebsd.org/D43939
* bhnd_usb: Use bus_generic_rman_*John Baldwin2024-02-271-26/+85
| | | | | | | | | For SYS_RES_MEMORY, use bus_generic_rman_* for activate/deactivate_resource methods as well as custom map/unmap_resource methods that request submappings of the sc_mem resource allocated from the parent bus. Differential Revision: https://reviews.freebsd.org/D43938
* bhnd: Correct the softc size in the siba_bhndb_driver definitionMark Johnston2023-12-051-1/+1
| | | | | | | | | | | | struct siba_bhndb_softc embeds struct siba_softc and adds an extra field, "quirks". In practice, this bug was harmless since "quirks" is unconditionally initialized during driver attach and would have lived in the redzone of the softc allocation, but KASAN catches the out-of-bounds access. PR: 275515 Reported by: Frank Hilgendorf <frank.hilgendorf@posteo.de> MFC after: 1 week
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2733-33/+0
| | | | | | | | | | | | | | | | 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
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-1613-14/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1660-120/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-1654-54/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1614-28/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-NetBSD 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
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1254-54/+54
| | | | | | | | | 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
* Alter the prototype of qsort_r(3) to match POSIX, which adopted theEd Schouten2022-09-301-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | glibc-based interface. Unfortunately, the glibc maintainers, despite knowing the existence of the FreeBSD qsort_r(3) interface in 2004 and refused to add the same interface to glibc based on grounds of the lack of standardization and portability concerns, has decided it was a good idea to introduce their own qsort_r(3) interface in 2007 as a GNU extension with a slightly different and incompatible interface. With the adoption of their interface as POSIX standard, let's switch to the same prototype, there is no need to remain incompatible. C++ and C applications written for the historical FreeBSD interface get source level compatibility when building in C++ mode, or when building with a C compiler with C11 generics support, provided that the caller passes a fifth parameter of qsort_r() that exactly matches the historical FreeBSD comparator function pointer type and does not redefine the historical qsort_r(3) prototype in their source code. Symbol versioning is used to keep old binaries working. MFC: never Relnotes: yes Reviewed by: cem, imp, hps, pauamma Differential revision: https://reviews.freebsd.org/D17083
* bhnd(4): Correct some typos in source code commentsGordon Bergling2022-09-046-18/+18
| | | | | | | | - s/occured/occurred/ While here, fix some whitespace issues. MFC after: 3 days
* bhnd(4): Correct a typo in a source code commentGordon Bergling2022-08-271-1/+1
| | | | | | - s/in he/in the/ MFC after: 3 days
* bhnd: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-0922-46/+19
|
* Remove unused bhndb_devclass.John Baldwin2022-05-092-3/+0
|
* Remove unused cfi_devclass.John Baldwin2022-05-091-1/+1
|
* bhnd: Use devclass_find to lookup devclass for bhnd.John Baldwin2022-05-051-2/+3
| | | | Differential Revision: https://reviews.freebsd.org/D35058
* bhnd: Use __diagused for a variable only used in a KASSERT().John Baldwin2022-04-131-1/+1
|
* bhnd(4): Remove a double word in a source code commentGordon Bergling2022-04-091-1/+1
| | | | | | - s/an an/an/ MFC after: 3 days
* bhnd(4): Remove some double words in source code commentsGordon Bergling2022-04-093-3/+3
| | | | | | | - s/be be/be/ - s/is is/is/ MFC after: 3 days
* bnhd: Write out updated resource dependencies from the table.John Baldwin2022-04-071-1/+2
| | | | | | | | | | The driver parsed the table to update the relevant resource map registers, but failed to write the new register value after computing it. Reported by: -Wunused-but-set-variable Reviewed by: landonf, imp Differential Revision: https://reviews.freebsd.org/D34814
* bhnd_nvram_store_export_child: eliminate num_props write only variableWarner Losh2022-04-051-2/+1
| | | | Sponsored by: Netflix
* bhnd_pmu_sdiod_drive_strength_init: eliminate write only intr_val variableWarner Losh2022-04-051-2/+0
| | | | Sponsored by: Netflix
* bhnd_pwrctl_attach: eliminate write only bus variableWarner Losh2022-04-051-3/+0
| | | | Sponsored by: Netflix
* bhnd: Fix some -Wunused-but-set-variable warningsMark Johnston2022-02-285-18/+0
| | | | MFC after: 1 week
* bhnd: plug set-but-not-used varsMateusz Guzik2021-12-141-22/+0
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* newbus: add bus_topo_assertWarner Losh2021-12-102-4/+3
| | | | | | | | | | Add bus_topo_assert() and implmement it as GIANT_REQUIRED for the moment. This will allow us to change more easily to a newbus-specific lock int he future. Sponsored by: Netflix Reviewed by: wulf, mav, jhb Differential Revision: https://reviews.freebsd.org/D31833
* Create wrapper for Giant taken for newbusWarner Losh2021-12-101-3/+3
| | | | | | | | | | | Create a wrapper for newbus to take giant and for busses to take it too. bus_topo_lock() should be called before interacting with newbus routines and unlocked with bus_topo_unlock(). If you need the topology lock for some reason, bus_topo_mtx() will provide that. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D31831