]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
[bhnd] Implement pass-through resource management for ChipCommon.
authoradrian <adrian@FreeBSD.org>
Tue, 24 May 2016 01:12:19 +0000 (01:12 +0000)
committeradrian <adrian@FreeBSD.org>
Tue, 24 May 2016 01:12:19 +0000 (01:12 +0000)
commitf7aa9e3f773909f53a7bfb843faaf9d6bc8656f6
tree05f381a195ef4b0641261ad2cc856d9440c7bca8
parenta4774d8f19b89abf2a239ea88471c6a6fbdfff9b
[bhnd] Implement pass-through resource management for ChipCommon.

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
20 files changed:
sys/conf/files
sys/dev/bhnd/bhnd_subr.c
sys/dev/bhnd/bhndb/bhndb_pci_sprom.c
sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m
sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c [new file with mode: 0644]
sys/dev/bhnd/cores/chipc/chipc.c
sys/dev/bhnd/cores/chipc/chipc.h
sys/dev/bhnd/cores/chipc/chipc_private.h [new file with mode: 0644]
sys/dev/bhnd/cores/chipc/chipc_subr.c [new file with mode: 0644]
sys/dev/bhnd/cores/chipc/chipcreg.h
sys/dev/bhnd/cores/chipc/chipcvar.h
sys/dev/bhnd/nvram/bhnd_nvram.h
sys/dev/bhnd/nvram/bhnd_sprom.c
sys/dev/bhnd/nvram/bhnd_sprom_subr.c [new file with mode: 0644]
sys/dev/bhnd/nvram/bhnd_spromvar.h
sys/dev/bhnd/siba/siba.c
sys/dev/bhnd/siba/siba_subr.c
sys/dev/bhnd/siba/sibavar.h
sys/modules/bhnd/Makefile
sys/modules/bhnd/cores/bhnd_chipc/Makefile