Commit Graph

27 Commits

Author SHA1 Message Date
Adrian Chadd
e83ce34035 [bhnd] Initial bhnd(4) SPROM/NVRAM support.
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
2016-05-08 19:14:05 +00:00
Adrian Chadd
f74f1a68d5 [bhnd] Add support for matching on chip identifiers.
This is used by the upcoming SPROM code to match on chipsets
that require special handling of muxed SPROM pins.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6195
2016-05-08 18:30:08 +00:00
Adrian Chadd
a73ac06d93 [bhnd] Add bhnd_resource support for the bus_(read|write)(_multi_)stream_* 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
2016-05-08 18:20:01 +00:00
Adrian Chadd
d935257080 [bhnd] Replace is_hostb_device() with a more general find_hostb_device()
This allows bus children to query for the host bridge device, rather
than having to iterate over all attached devices.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6193
2016-05-08 17:52:12 +00:00
Adrian Chadd
426a80d44d [bhnd] don't use anonymous unions.
Found by: gcc-4.2
2016-05-05 19:56:18 +00:00
Adrian Chadd
054ae23156 [bhnd] default to BUS_PROBE_DEFAULT for unknown BHND classes.
Found by: gcc-4.2
2016-05-05 19:55:16 +00:00
Adrian Chadd
0aba90e3bc [bhnd] handle unknown bhnd port type. 2016-05-05 19:54:17 +00:00
Adrian Chadd
10cb4427d5 [bhnd] quieten gcc warning. 2016-05-05 19:38:53 +00:00
Adrian Chadd
988fa8d078 [bhnd] handle unknown port type.
Reported by: emaste
2016-05-05 19:30:14 +00:00
Ed Maste
c009c4021c bhnd: another build fix for GCC-using architectures
Further to r299119. GCC architectures failed with
bcma_subr.c:138: warning: control reaches end of non-void function

Sponsored by:	The FreeBSD Foundation
2016-05-05 17:47:03 +00:00
Ed Maste
c2ec037ff5 bhnd: fix build on gcc architectures
"make tinderbox" fails on sparc64 GENERIC-NODEBUG with:
bhnd_subr.c:188: warning: control reaches end of non-void function

Sponsored by:	The FreeBSD Foundation
2016-05-05 15:07:40 +00:00
Adrian Chadd
148ed57165 [bwn] [bhnd] initial support for using bhnd for if_bwn devices.
This is an initial work in progress to use the replacement bhnd
bus code for devices which support it.

* Add manpage updates for bhnd, bhndb, siba
* Add kernel options for bhnd, bhndbus, etc
* Add initial support in if_bwn_pci / if_bwn_mac for using bhnd
  as the bus transport for suppoted NICs
* if_bwn_pci will eventually be the PCI bus glue to interface to bwn,
  which will use the right backend bus to attach to, versus direct
  nexus/bhnd attachments (as found in embedded broadcom devices.)

The PCI glue defaults to probing at a lower level than the bwn glue,
so bwn should still attach as per normal without a boot time tunable set.

It's also not fully fleshed out - the bwn probe/attach code needs to be
broken out into platform and bus specific things (just like ath, ath_pci,
ath_ahb) before we can shift the driver over to using this.

Tested:

* BCM4311, STA mode
* BCM4312, STA mode

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6191
2016-05-04 23:38:27 +00:00
Pedro F. Giffuni
453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
Adrian Chadd
eaddb80745 [bhnd] fix more module dependencies.
Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6180
2016-05-02 22:30:46 +00:00
Adrian Chadd
96546b75e7 [bhnd] add module dependencies.
Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6179
2016-05-02 21:01:08 +00:00
Adrian Chadd
8a3fcfa7be [bhnd] Fix ChipCommon probing.
ChipCommon probing uses mapping table "chipc_devices". It calls bhnd_device_lookup,
which iterate over mapping table with end condition:

entry->desc != NULL

So if mapping table contains row with description equals to NULL, it will
stop processing of mapping. I.e. description is mandatory field and should
be not NULL.

This patch corrects mapping table for ChipCommon.

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D6088
2016-04-25 16:53:13 +00:00
Adrian Chadd
178c755910 [bhnd] use correct bus deallocation method
Submitted by:	Mizhka Zhilin <mizhka@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D5647
2016-04-22 16:28:41 +00:00
Adrian Chadd
05f61102bb [bhnd] Update bhndb format strings to match long -> rman_res_t size change.
Does what it says on the tin; this unbreaks 32-bit builds.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D5764
2016-04-22 16:27:35 +00:00
Adrian Chadd
bb64eecc0b [bhnd] Add a common bhnd_pci driver shared by both bhnd_pcib and bhnd_pci_hostb
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
2016-04-22 16:26:53 +00:00
Adrian Chadd
36e4410ab0 [bhnd] Standardize bhnd device tables and quirk matching.
This add a bhnd device table mechanism that standardizes matching of
devices on the bhnd(4) bus, discovery of device quirk flags, and should
be pluggable into the new PNPINFO machinery.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D5759
2016-04-19 15:56:39 +00:00
Adrian Chadd
386fb140a6 [bhnd] Clean up bhnd resource handling and inherited bus methods
To facilitate use by SoC implementors working with bhnd-inheriting fdt/nexus
drivers:

* Splits bhnd_bus method implementations into generic bus implementations
  (bhnd_bus_generic) and generic bhnd(4) driver implementations (bhnd_generic)
* Simplifies bhnd resource handling, allowing bhnd bus implementations to
  support bhnd resource activation by implementing the standard BUS_*
  resource APIs and BHND_BUS_ACTIVATE_RESOURCE().

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D5758
2016-04-19 15:53:57 +00:00
Adrian Chadd
e9378f456a [bhnd] Add support for specifying the address space used by bhndb children
This adds support for specifying the address space used by a bridge child;
this will either be the bridged SoC address space, or the host address space
required by children that map non SoC-address ranges from the PCI BAR.

This is necessary to support SROM/OTP child devices that live directly
beneath the bhndb device and require access to host resources, instead
of the standard behavior of delegating access to the bridged SoC address
space.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D5757
2016-04-19 15:52:55 +00:00
Pedro F. Giffuni
74b8d63dcc Cleanup unnecessary semicolons from the kernel.
Found with devel/coccinelle.
2016-04-10 23:07:00 +00:00
Justin Hibbits
f8fd3fb518 Fix the resource_list_print_type() calls to use uintmax_t.
Missed a bunch from r297000.
2016-03-22 22:25:08 +00:00
Justin Hibbits
534ccd7bbf Replace all resource occurrences of '0UL/~0UL' with '0/~0'.
Summary:
The idea behind this is '~0ul' is well-defined, and casting to uintmax_t, on a
32-bit platform, will leave the upper 32 bits as 0.  The maximum range of a
resource is 0xFFF.... (all bits of the full type set).  By dropping the 'ul'
suffix, C type promotion rules apply, and the sign extension of ~0 on 32 bit
platforms gets it to a type-independent 'unsigned max'.

Reviewed By: cem
Sponsored by:	Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5255
2016-03-03 05:07:35 +00:00
Justin Hibbits
82ed3cb0e4 Replace some more default range checks with RMAN_IS_DEFAULT_RANGE().
This is a follow-on to r295832.
2016-03-02 03:26:56 +00:00
Adrian Chadd
4ad7e9b01a Bring over the initial rewrite of the broadcom bus support found in their
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
2016-02-26 03:34:08 +00:00