Implement a generic bhnd(4) device enumeration table API.
authorlandonf <landonf@FreeBSD.org>
Sat, 3 Sep 2016 23:57:17 +0000 (23:57 +0000)
committerlandonf <landonf@FreeBSD.org>
Sat, 3 Sep 2016 23:57:17 +0000 (23:57 +0000)
commit982e7e3df8989174d2815c45f8505b98a33d605b
tree9609d2f7bf1c0467348de94bc8c40b93f787bcd2
parent5c5caa6dec9d58babcf099f0a28f3340bbe4be46
Implement a generic bhnd(4) device enumeration table API.

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
33 files changed:
sys/conf/files
sys/dev/bhnd/bcma/bcma.c
sys/dev/bhnd/bcma/bcma.h
sys/dev/bhnd/bcma/bcma_bhndb.c
sys/dev/bhnd/bcma/bcma_erom.c
sys/dev/bhnd/bcma/bcma_eromvar.h
sys/dev/bhnd/bcma/bcma_nexus.c
sys/dev/bhnd/bcma/bcmavar.h
sys/dev/bhnd/bhnd.h
sys/dev/bhnd/bhnd_bus_if.m
sys/dev/bhnd/bhnd_erom.c [new file with mode: 0644]
sys/dev/bhnd/bhnd_erom.h [new file with mode: 0644]
sys/dev/bhnd/bhnd_erom_if.m [new file with mode: 0644]
sys/dev/bhnd/bhnd_erom_types.h [copied from sys/dev/bhnd/siba/siba.h with 75% similarity]
sys/dev/bhnd/bhnd_subr.c
sys/dev/bhnd/bhndb/bhndb.c
sys/dev/bhnd/siba/siba.c
sys/dev/bhnd/siba/siba.h
sys/dev/bhnd/siba/siba_erom.c [new file with mode: 0644]
sys/dev/bhnd/siba/siba_subr.c
sys/dev/bhnd/siba/sibareg.h
sys/dev/bhnd/siba/sibavar.h
sys/mips/broadcom/bcm_bcma.c [deleted file]
sys/mips/broadcom/bcm_machdep.c
sys/mips/broadcom/bcm_machdep.h
sys/mips/broadcom/bcm_pmu.c
sys/mips/broadcom/bcm_siba.c [deleted file]
sys/mips/broadcom/files.broadcom
sys/modules/bhnd/Makefile
sys/modules/bhnd/bcma/Makefile
sys/modules/bhnd/bcma_bhndb/Makefile
sys/modules/bhnd/siba/Makefile
sys/modules/bhnd/siba_bhndb/Makefile