aboutsummaryrefslogtreecommitdiff
path: root/sys/modules/bhnd
Commit message (Collapse)AuthorAgeFilesLines
* Remove residual blank line at start of MakefileWarner Losh2024-07-1511-11/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-1611-11/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Fix some modules to export more used symbolsKonstantin Belousov2021-11-182-1/+5
| | | | | | | | | and remove non-present symbols that are now reported by kmod_syms.awk. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32878
* - Fix `make` in sys/modulesLi-Wen Hsu2018-01-121-0/+1
| | | | | | | | Reviewed by: gonzo, landonf, br Differential Revision: https://reviews.freebsd.org/D13856 Notes: svn path=/head/; revision=327872
* siba(4): Add support for devices have neither PMU nor PWRCTL support.Landon J. Fuller2017-11-281-2/+3
| | | | | | | | | | | | | Very early BHND Wi-Fi devices (e.g. BCM4318) do not support any form of dynamic clock control; on these devices, any PMU requests that cannot be met by the device's fixed clock state will return an appropriate error code. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=326301
* bhnd(4): Add missing dependency on ofw_bus_if.hLandon J. Fuller2017-11-241-1/+1
| | | | | | | | Reported by: wma Approved by: adrian (mentor, implicit) Notes: svn path=/head/; revision=326174
* bhnd(4): Add a basic ChipCommon GPIO driver sufficient to support bwn(4)Landon J. Fuller2017-11-221-3/+11
| | | | | | | | | | | | | The driver is functional on both BHND Wi-Fi adapters and MIPS SoCs, but does not currently include support for features not required by bwn(4), including GPIO interrupt handling. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12708 Notes: svn path=/head/; revision=326109
* bhnd(4): extend the PMU APIs to support bwn(4)Landon J. Fuller2017-11-224-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bwn(4) driver requires a number of extensions to the bhnd(4) PMU interface to support external configuration of PLLs, LDOs, and other parameters that require chipset or PHY-specific workarounds. These changes add support for: - Writing raw voltage register values to PHY-specific LDO regulator registers (required by LP-PHY). - Enabling/disabling PHY-specific LDOs (required by LP-PHY) - Writing to arbitrary PMU chipctrl registers (required for common PHY PLL reset support). - Requesting chipset/PLL-specific spurious signal avoidance modes. - Querying clock frequency and latency. Additionally, rather than updating legacy PWRCTL support to conform to the new PMU interface: - PWRCTL API is now provided by a bhnd_pwrctl_if.m interface. - Since PWRCTL is only found in older SSB-based chipsets, translation from bhnd(4) bus APIs to corresponding PWRCTL operations is now handled entirely within the siba(4) driver. - The PWRCTL-specific host bridge clock gating APIs in bhnd_bus_if.m have been lifted out into a standalone bhnd_pwrctl_hostb_if.m interface. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12664 Notes: svn path=/head/; revision=326102
* bhnd: Add support for supplying bus I/O callbacks when initializing an EROMLandon J. Fuller2017-09-271-0/+1
| | | | | | | | | | | | | | | | parser. This allows us to use the EROM parser API in cases where the standard bus space I/O APIs are unsuitable. In particular, this will allow us to parse the device enumeration table directly from bhndb(4) drivers, prior to full attach and configuration of the bridge. Approved by: adrian (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12510 Notes: svn path=/head/; revision=324071
* sys/modules: normalize .CURDIR-relative paths to SRCTOPEnji Cooper2017-03-0410-17/+17
| | | | | | | | | | | This simplifies make output/logic Tested with: `cd sys/modules; make ALL_MODULES=` on amd64 MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314651
* bhnd(4): NVRAM serialization support.Landon J. Fuller2016-12-191-0/+1
| | | | | | | | | | | | | | | | This adds support for: - Serializing an bhnd_nvram_plist (as exported from bhnd_nvram_store, etc) to an arbitrary NVRAM data format. - Generating a serialized representation of the current NVRAM store's state suitable for writing back to flash, or re-encoding for upload to a FullMAC device. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8762 Notes: svn path=/head/; revision=310297
* bhnd(4): NVRAM device path support.Landon J. Fuller2016-12-191-0/+1
| | | | | | | | | | | | Implements bhnd_nvram_store support for parsing and operating over NVRAM device paths, and device path aliases, as well as tracking per-path NVRAM variable writes. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8760 Notes: svn path=/head/; revision=310295
* bhnd(4): add support for wrapping arbitrary pointers in an NVRAM I/OLandon J. Fuller2016-12-191-0/+1
| | | | | | | | | | context. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8759 Notes: svn path=/head/; revision=310294
* bhnd(4): support direct conversion of bhnd_nvram_valLandon J. Fuller2016-12-191-0/+1
| | | | | | | | | | | | | | | | This adds support for bhnd_nvram_val_convert_init() and bhnd_nvram_val_convert_new(), which may be used to perform value format-aware encoding of an NVRAM value to a new target format/type. This will be used to simplify converting to/from serialized format-specific NVRAM value representations to common external representations. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8757 Notes: svn path=/head/; revision=310292
* bhnd(4): Implement a new bhnd_nvram_plist and bhnd_nvram_prop API forLandon J. Fuller2016-12-191-0/+1
| | | | | | | | | | | | | | representing arbitrary Broadcom NVRAM key/value pairs. This will be used to track pending changes in bhnd_nvram_store, and provide support for exporting all or a device subpath for NVRAM (as required by some fullmac wifi chipsets). Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8756 Notes: svn path=/head/; revision=310291
* bhnd(4): Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding.Landon J. Fuller2016-11-261-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Defined an abstract NVRAM I/O API (bhnd_nvram_io), decoupling NVRAM/SPROM parsing from the actual underlying NVRAM data provider (e.g. CFE firmware devices). - Defined an abstract NVRAM data API (bhnd_nvram_data), decoupling higher-level NVRAM operations (indexed lookup, data conversion, etc) from the underlying NVRAM file format parsing/serialization. - Implemented a new high-level bhnd_nvram_store API, providing indexed variable lookup, pending write tracking, etc on top of an arbitrary bhnd_nvram_data instance. - Migrated all bhnd(4) NVRAM device drivers to the common bhnd_nvram_store API. - Implemented a common bhnd_nvram_val API for parsing/encoding NVRAM variable values, including applying format-specific behavior when converting to/from the NVRAM string representations. - Dropped the now unnecessary bhnd_nvram driver, and moved the broadcom/mips-specific CFE NVRAM driver out into sys/mips/broadcom. - Implemented a new nvram_map file format: - Variable definitions are now defined separately from the SPROM layout. This will also allow us to define CIS tuple NVRAM mappings referencing the common NVRAM variable definitions. - Variables can now be defined within arbitrary named groups. - Textual descriptions and help information can be defined inline for both variables and variable groups. - Implemented a new, compact encoding of SPROM image layout offsets. - Source-level (but not build system) support for building the NVRAM file format APIs (bhnd_nvram_io, bhnd_nvram_data, bhnd_nvram_store) as a userspace library. The new compact SPROM image layout encoding is loosely modeled on Apple dyld compressed LINKEDIT symbol binding opcodes; it provides a compact state-machine encoding of the mapping between NVRAM variables and the SPROM image offset, mask, and shift instructions necessary to decode or encode the SPROM variable data. The compact encoding reduces the size of the generated SPROM layout data from roughly 60KB to 3KB. The sequential nature SPROM layout opcode tables also simplify iteration of the SPROM variables, as it's no longer neccessary to iterate the full NVRAM variable definition table, but instead simply scan the SPROM revision's layout opcode table. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8645 Notes: svn path=/head/; revision=309202
* Revert r308107Li-Wen Hsu2016-10-3010-11/+9
| | | | | | | Requested by: jhb Notes: svn path=/head/; revision=308115
* - Fix `make` in sys/modules/bhndLi-Wen Hsu2016-10-3010-9/+11
| | | | | | | | Approved by: landonf Differential Revision: https://reviews.freebsd.org/D7774 Notes: svn path=/head/; revision=308107
* bhnd(4): Implement common API for IOST/IOCTL register access and core resetLandon J. Fuller2016-09-242-2/+2
| | | | | | | | | | | | | | | - Added bhnd(4) bus APIs for per-core ioctl/iost register access. - Updated reset/suspend bhnd(4) APIs for compatibility with ioctl/iost changes. - Implemented core reset/suspend support for both bcma(4) and siba(4). - Implemented explicit release of all outstanding PMU requests at the bus level when putting a core into reset. Approved by: adrian (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D8009 Notes: svn path=/head/; revision=306287
* Migrate bhndb(4) to the new bhnd_erom API.Landon J. Fuller2016-09-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for probing and initializing bhndb(4) bridge state using the bhnd_erom API, ensuring that full bridge configuration is available *prior* to actually attaching and enumerating the bhnd(4) child device, allowing us to safely allocate bus-level agent/device resources during bhnd(4) bus enumeration. - Add a bhnd_erom_probe() method usable by bhndb(4). This is an analogue to the existing bhnd_erom_probe_static() method, and allows the bhndb bridge to discover the best available erom parser class prior to newbus probing of its children. - Add support for supplying identification hints when probing erom devices. This is required on early EXTIF-only chipsets, where chip identification registers are not available. - Migrate bhndb over to the new bhnd_erom API, using bhnd_core_info records rather than bridged bhnd(4) device_t references to determine the bridged chipsets' capability/bridge configuration. - The bhndb parent (e.g. if_bwn) is now required to supply a hardware priority table to the bridge. The default table is currently sufficient for our supported devices. - Drop the two-pass attach approach we used for compatibility with bhndb(4) in the bhnd(4) bus drivers, and instead perform bus enumeration immediately, and allocate bridged per-child bus-level resources during that enumeration. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7768 Notes: svn path=/head/; revision=305371
* Implement a generic bhnd(4) device enumeration table API.Landon J. Fuller2016-09-035-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This defines a new bhnd_erom_if API, providing a common interface to device enumeration on siba(4) and bcma(4) devices, for use both in the bhndb bridge and SoC early boot contexts, and migrates mips/broadcom over to the new API. This also replaces the previous adhoc device enumeration support implemented for mips/broadcom. Migration of bhndb to the new API will be implemented in a follow-up commit. - Defined new bhnd_erom_if interface for bhnd(4) device enumeration, along with bcma(4) and siba(4)-specific implementations. - Fixed a minor bug in bhndb that logged an error when we attempted to map the full siba(4) bus space (18000000-17FFFFFF) in the siba EROM parser. - Reverted use of the resource's start address as the ChipCommon enum_addr in bhnd_read_chipid(). When called from bhndb, this address is found within the host address space, resulting in an invalid bridged enum_addr. - Added support for falling back on standard bus_activate_resource() in bhnd_bus_generic_activate_resource(), enabling allocation of the bhnd_erom's bhnd_resource directly from a nexus-attached bhnd(4) device. - Removed BHND_BUS_GET_CORE_TABLE(); it has been replaced by the erom API. - Added support for statically initializing bhnd_erom instances, for use prior to malloc availability. The statically allocated buffer size is verified both at runtime, and via a compile-time assertion (see BHND_EROM_STATIC_BYTES). - bhnd_erom classes are registered within a module via a linker set, allowing mips/broadcom to probe available EROM parser instances without creating a strong reference to bcma/siba-specific symbols. - Migrated mips/broadcom to bhnd_erom_if, replacing the previous MIPS-specific device enumeration implementation. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7748 Notes: svn path=/head/; revision=305366
* bhnd(4): Initial PMU/PWRCTL power and clock management support.Landon J. Fuller2016-08-273-19/+21
| | | | | | | | | | | | | | | | - Added bhnd_pmu driver implementations for PMU and PWRCTL chipsets, derived from Broadcom's ISC-licensed HND code. - Added bhnd bus-level support for routing per-core clock and resource power requests to the PMU device. - Lift ChipCommon support out into the bhnd module, dropping bhnd_chipc. Reviewed by: mizhka Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7492 Notes: svn path=/head/; revision=304870
* bhnd(4): Implement NVRAM support required for PMU bring-up.Landon J. Fuller2016-08-161-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | - Added a generic bhnd_nvram_parser API, with support for the TLV format used on WGT634U devices, the standard BCM NVRAM format used on most modern devices, and the "board text file" format used on some hardware to supply external NVRAM data at runtime (e.g. via an EFI variable). - Extended the bhnd_bus_if and bhnd_nvram_if interfaces to support both string-based and primitive data type variable access, required for common behavior across both SPROM and NVRAM data sources. - Extended the existing SPROM implementation to support the new string-based NVRAM APIs. - Added an abstract bhnd_nvram driver, implementing the bhnd_nvram_if atop the bhnd_nvram_parser API. - Added a CFE-based bhnd_nvram driver to provide read-only access to NVRAM data on MIPS SoCs, pending implementation of a flash-aware bhnd_nvram driver. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7489 Notes: svn path=/head/; revision=304243
* [bhnd] Implement pass-through resource management for ChipCommon.Adrian Chadd2016-05-242-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY resources with its children, allowing us to hang devices off of bhnd_chipc that rely on access to a subset of the device register space that bhnd_chipc itself must also allocate. We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY wasn't limited to use with allocations at the same size/offset. As a work-around, I implemented something similar to vga_pci.c, which implements similar reference counting of of PCI BAR resources for its children. With these changes, chipc will use reference counting of SYS_RES_MEMORY allocation/activation requests, to decide when to allocate/activate/ deactivate/release resources from the parent bhnd(4) bus. The requesting child device is allocated a new resource from chipc's rman, pointing to (possibly a subregion of) the refcounted bhnd resources allocated by chipc. Other resource types are just passed directly to the parent bhnd bus; RF_SHAREABLE works just fine with IRQs. I also lifted the SPROM device code out into a common driver, since this now allows me to hang simple subclasses off of a common driver off of both bhndb_pci and bhnd_chipc. Tested: * (landonf) Tested against BCM4331 and BCM4312, confirmed that SPROM still attaches and can be queried. Submitted by: Landon Fuller <landonf@landonf.org> Reviewed by: mizkha@gmail.com Differential Revision: https://reviews.freebsd.org/D6471 Notes: svn path=/head/; revision=300548
* [bhnd] Add support for querying the attachment type of the bhnd bus.Adrian Chadd2016-05-231-0/+1
| | | | | | | | | | | | | | | | | | This adds a BHND_BUS_GET_ATTACH_TYPE(); the primary use-case is to let chipc make a coarse-grained determination as to whether UART, SPI, etc drivers ought to be attached, and on fullmac devices, whether a real CPU driver ought to be skipped for the ARM core, etc. Tested: * BCM4331 (BHND) * BCM4312 (SIBA) Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6492 Notes: svn path=/head/; revision=300445
* [bhnd] Finish bhnd(4) PCI/PCIe-G1 hostb support.Adrian Chadd2016-05-173-5/+10
| | | | | | | | | | | | | | | Now that we've got access to SPROM and can access board identification, this implements all known remaining hardware work-arounds for the bhnd(4) PCI and PCIe-G1 cores operating endpoint mode. Additionally, this adds an initial set of skeleton PCIe-G2 hostb and pcib drivers, required by fullmac and newer softmac devices. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6377 Notes: svn path=/head/; revision=300015
* [bhnd] Initial bhnd(4) SPROM/NVRAM support.Adrian Chadd2016-05-085-18/+17
| | | | | | | | | | | | | | | | | | | | | | This adds support for the NVRAM handling and the basic SPROM hardware used on siba(4) and bcma(4) devices, including: * SPROM directly attached to the PCI core, accessible via PCI configuration space. * SPROM attached to later ChipCommon cores. * SPROM variables vended from the parent SoC bus (e.g. via a directly-attached flash device). Additional improvements to the NVRAM/SPROM interface will be required, but this changeset stands alone as working checkpoint. Submitted by: Landon Fuller <landonf@landonf.org> Reviewed by: Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support) Differential Revision: https://reviews.freebsd.org/D6196 Notes: svn path=/head/; revision=299241
* Fix kernel build with parallel make.Niclas Zeising2016-05-051-1/+1
| | | | | | | Approved by: jhb Notes: svn path=/head/; revision=299125
* [bhnd] add missing bus file.Adrian Chadd2016-05-051-1/+1
| | | | Notes: svn path=/head/; revision=299109
* [bhnd] add missing bus interface SRC bits, required after the last source ↵Adrian Chadd2016-05-025-5/+6
| | | | | | | import. Notes: svn path=/head/; revision=298935
* [bhnd] Add a common bhnd_pci driver shared by both bhnd_pcib and bhnd_pci_hostbAdrian Chadd2016-04-221-4/+2
| | | | | | | | | | | | This extracts common code from bhndb_pci, bhnd_pcib, and bhnd_pci_hostb into a simpler shared bhnd_pci base driver, and should enable SoC-side implementation of bhnd_pcib root complex support. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D5763 Notes: svn path=/head/; revision=298479
* Add modules support for the bhnd code.Adrian Chadd2016-02-2613-0/+143
Submitted by: Landon Fuller <landonf@landonf.org> Obtained from: https://github.com/landonf/freebsd/compare/user/landonf/bcm4331-CURRENT Notes: svn path=/head/; revision=296078