aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bhnd/tools
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-163-4/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* bhnd nvram map: don't write "variable records written" to standard out by ↵Matt Macy2018-05-191-3/+7
| | | | | | | | | | default Add -v (verbose) option for the developers. The rest of us derive no value from this information. Notes: svn path=/head/; revision=333882
* bhnd(4): Add missing enclosing parentheses to the bhnd bus space macros toLandon J. Fuller2017-12-141-2/+2
| | | | | | | | | | avoid precedence bugs. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=326837
* bhnd: remove srand() to ensure deterministic outputEd Maste2016-12-211-3/+0
| | | | | | | | | | | | | | | | | | r310342 fixed non-deterministic nvram_map_gen.awk output and thus a non- reproducible bhnd(4) build by using a unique sort key. Go one step further and also remove the srand() call. There's no reason we want non-deterministic behaviour from this script. PR: 215422 Reported by: gjb (non-reproducibility of bhnd) Reported by: lidl (srand as the cause) Reviewed by: landonf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8857 Notes: svn path=/head/; revision=310371
* bhnd(4): Use a stable sort key to produce deterministic nvram_map_gen.awkLandon J. Fuller2016-12-211-12/+54
| | | | | | | | | | | | | | | | | output. When ordering SROM layout entries, we now use the unique (var_id, rev_start, rev_end) tuple as the sort key; this fixes the previously non-deterministic output when sorting entries with overlapping var_ids. PR: 215422 Reported by: emaste Reviewed by: emaste Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8859 Notes: svn path=/head/; revision=310342
* bhnd(4): NVRAM serialization support.Landon J. Fuller2016-12-191-7/+29
| | | | | | | | | | | | | | | | 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): Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding.Landon J. Fuller2016-11-261-765/+3803
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* bhnd(4): Implement NVRAM support required for PMU bring-up.Landon J. Fuller2016-08-161-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | - 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] Add remaining bus_(read|write|set)_(1|2|4) APIsAdrian Chadd2016-05-201-7/+14
| | | | | | | | | | | | | | | | | | | This adds bhnd-compatible implementations of bus_(read|write|set)_(1|2|4) APIs, and upgrades the SPROM parsing code to use bhnd_bus_read_region_stream_2(). This a precursor to bridge support for resource adjustment and the new ChipCommon bus support. Tested: * Tested against BCM4331 * Kernel build verified via tinderbox. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6469 Notes: svn path=/head/; revision=300250
* Use awk to run bhnd's awk script, to allow noexec src dirEd Maste2016-05-131-1/+1
| | | | | | | | | PR: 209435 Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6312 Notes: svn path=/head/; revision=299692
* [bhnd] Initial bhnd(4) SPROM/NVRAM support.Adrian Chadd2016-05-083-0/+1174
| | | | | | | | | | | | | | | | | | | | | | 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
* [bhnd] Add bhnd_resource support for the bus_(read|write)(_multi_)stream_* ↵Adrian Chadd2016-05-081-5/+5
| | | | | | | | | | | | functions. This adds additional bhnd_resource shims used by the upcoming SPROM deltas. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6194 Notes: svn path=/head/; revision=299239
* Bring over the initial rewrite of the broadcom bus support found in theirAdrian Chadd2016-02-261-0/+84
SoCs and various chips (including, famously, their wifi chips.) This is "just" (all 20,000 lines of it) code to enumerate the various versions of busses inside these devices, including the PCI bridge and the direct SIBA bridge found in MIPS chips. It also includes shared code for some bus operations (suspend, resume, etc); EEPROM/SROM/etc parsing and other things that are shared between chips. Eventually this'll replace the code that bwi/bwn uses for the internal bus, as well as some apparently upcoming mips74k broadcom SoC support which uses bwn! Thanks to Landon Fuller <landonf@landonf.org> for all this work! Obtained from: https://github.com/landonf/freebsd/compare/user/landonf/bcm4331-CURRENT Notes: svn path=/head/; revision=296077