Page MenuHomeFreeBSD

Initial bhnd(4) SPROM/NVRAM support.
ClosedPublic

Authored by landon_landonf.org on May 3 2016, 7:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 10:21 AM
Unknown Object (File)
Feb 23 2024, 10:12 AM
Unknown Object (File)
Jan 23 2024, 8:06 AM
Unknown Object (File)
Jan 11 2024, 9:19 AM
Unknown Object (File)
Jan 9 2024, 12:38 AM
Unknown Object (File)
Dec 20 2023, 12:53 AM
Unknown Object (File)
Nov 18 2023, 10:26 AM
Unknown Object (File)
Oct 23 2023, 10:00 AM
Subscribers

Details

Summary

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.

Depends on D6195

Test Plan

Load if_bwn_pci and look for a valid Broadcom MAC address:

bwn0: got macaddr 8c:2d:aa:36:5f:07

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

landon_landonf.org retitled this revision from to Initial bhnd(4) SPROM/NVRAM support..
landon_landonf.org updated this object.
landon_landonf.org edited the test plan for this revision. (Show Details)
landon_landonf.org added a reviewer: adrian.

Optimize NVRAM table lookup, rebase against master.

  • Fix generation of struct variable records.
  • Implement a stable sorting guarantee for the generated NVRAM table.
  • Use the variable table order guarantee to implement binary search for variable definitions.

mizkha: when you get a chance, can you eyeball this for any issues on the SoC side?

sys/dev/bhnd/cores/chipc/chipc.c
196–198 ↗(On Diff #15959)

I think if sprom is unsupported, it shouldn't cause fail of chipc attach call.

sys/dev/bhnd/nvram/nvram_subr.c
48–54 ↗(On Diff #15959)

CRC8 polinom is duplicated few times in kernel. May be to add generic support?

mizhka requested changes to this revision.May 7 2016, 5:56 AM
mizhka edited edge metadata.
This revision now requires changes to proceed.May 7 2016, 5:56 AM
landon_landonf.org edited edge metadata.
  • Add support for generating a set of #defines for all bhnd(4) NVRAM variable keys.
  • Allow ChipCommon to attach when OTP or NFLASH SPROM sources are identified.
  • Rename the bhnd_nvram_* variable functions (modeled on the OF_prop* API).
  • When generating nvram map headers, truncate any existing output file.
  • Add an explicit fallback cases for unmatched enums.
  • Re-integrate module dependency that went missing in a merge.
sys/dev/bhnd/cores/chipc/chipc.c
196–198 ↗(On Diff #15959)

Makes sense; the unhandled sources will now just print a message, rather than breaking attach.

sys/dev/bhnd/nvram/nvram_subr.c
48–54 ↗(On Diff #15959)

I think the only other code using these same crc8 parameters is in the siba code we're replacing.

mizhka edited edge metadata.
This revision is now accepted and ready to land.May 7 2016, 9:40 PM
This revision was automatically updated to reflect the committed changes.
/scratch/tmp/emaste/freebsd/sys/modules/bhnd/bhndb_pci/../../../dev/bhnd/bhndb/bhndb_pci.c:170:52: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'bus_size_t' (aka 'unsigned long') [-Werror,-Wformat]
                        device_printf(dev, "found SPROM (%zu bytes)\n", nv_sz);
                                                         ~~~            ^~~~~
                                                         %lu
/scratch/tmp/emaste/freebsd/sys/modules/bhnd/bhndb_pci/../../../dev/bhnd/bhndb/bhndb_pci.c:237:1: error: conflicting types for 'bhndb_pci_sprom_size'
bhndb_pci_sprom_size(struct bhndb_pci_softc *sc)
^
/scratch/tmp/emaste/freebsd/sys/modules/bhnd/bhndb_pci/../../../dev/bhnd/bhndb/bhndb_pci.c:76:16: note: previous declaration is here
static size_t           bhndb_pci_sprom_size(struct bhndb_pci_softc *sc);
                        ^
2 errors generated.