bhnd(4): Include board_devid in the bhnd_board_info structure, and populate
the expected default board_vendor value on MIPS SoCs. This is required by bwn(4) to differentiate between single-band and dual-band device variants that otherwise share a common chip ID. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
abfdbcdb00
commit
05c61e20ac
@ -1309,8 +1309,9 @@ structure contains the following fields:
|
||||
.It Fa board_vendor
|
||||
Vendor ID of the board manufacturer (PCI-SIG assigned).
|
||||
.It Fa board_type
|
||||
Board ID.
|
||||
.It Fa board_devid
|
||||
Device ID.
|
||||
This is generally a Broadcom-assigned globally unique identifier.
|
||||
.It Fa board_rev
|
||||
Board revision.
|
||||
.It Fa board_srom_rev
|
||||
@ -1323,12 +1324,25 @@ Board flags (2)
|
||||
Board flags (3)
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Fa board_devid
|
||||
field is the Broadcom PCI device ID that most closely matches the
|
||||
capabilities of the BHND device (if any).
|
||||
.Pp
|
||||
On PCI devices, the
|
||||
.Fa board_vendor
|
||||
.Fa board_vendor ,
|
||||
.Fa board_type ,
|
||||
and
|
||||
.Fa board_type
|
||||
fields default to the PCI Subsystem Vendor ID and PCI Subsystem ID, unless
|
||||
overridden in device NVRAM.
|
||||
.Fa board_devid
|
||||
fields default to the PCI Subsystem Vendor ID, PCI Subsystem ID, and PCI
|
||||
device ID, unless overridden in device NVRAM.
|
||||
.Pp
|
||||
On other devices, including SoCs, the
|
||||
.Fa board_vendor ,
|
||||
.Fa board_type ,
|
||||
and
|
||||
.Fa board_devid
|
||||
fields will be populated from device NVRAM.
|
||||
.Pp
|
||||
Symbolic constants for common board flags are defined in
|
||||
.In dev/bhnd/bhnd_ids.h .
|
||||
|
@ -1140,7 +1140,6 @@ static device_method_t bhnd_methods[] = {
|
||||
/* BHND interface */
|
||||
DEVMETHOD(bhnd_bus_get_chipid, bhnd_bus_generic_get_chipid),
|
||||
DEVMETHOD(bhnd_bus_is_hw_disabled, bhnd_bus_generic_is_hw_disabled),
|
||||
DEVMETHOD(bhnd_bus_read_board_info, bhnd_bus_generic_read_board_info),
|
||||
|
||||
DEVMETHOD(bhnd_bus_get_probe_order, bhnd_generic_get_probe_order),
|
||||
|
||||
|
@ -163,20 +163,41 @@ BHND_ACCESSOR(pmu_info, PMU_INFO, void *);
|
||||
* A bhnd(4) board descriptor.
|
||||
*/
|
||||
struct bhnd_board_info {
|
||||
uint16_t board_vendor; /**< PCI-SIG vendor ID (even on non-PCI
|
||||
* devices).
|
||||
uint16_t board_vendor; /**< Board vendor (PCI-SIG vendor ID).
|
||||
*
|
||||
* On PCI devices, this will generally
|
||||
* be the subsystem vendor ID, but the
|
||||
* value may be overridden in device
|
||||
* NVRAM.
|
||||
* On PCI devices, this will default to
|
||||
* the PCI subsystem vendor ID, but may
|
||||
* be overridden by the 'boardtype'
|
||||
* NVRAM variable.
|
||||
*
|
||||
* On SoCs, this will default to
|
||||
* PCI_VENDOR_BROADCOM, but may be
|
||||
* overridden by the 'boardvendor'
|
||||
* NVRAM variable.
|
||||
*/
|
||||
uint16_t board_type; /**< Board type (See BHND_BOARD_*)
|
||||
*
|
||||
* On PCI devices, this will generally
|
||||
* be the subsystem device ID, but the
|
||||
* value may be overridden in device
|
||||
* NVRAM.
|
||||
* This value is usually a
|
||||
* Broadcom-assigned reference board
|
||||
* identifier (see BHND_BOARD_*), but
|
||||
* may be set to an arbitrary value
|
||||
* assigned by the board vendor.
|
||||
*
|
||||
* On PCI devices, this will default
|
||||
* to the PCI subsystem ID, but may be
|
||||
* overridden by the 'boardtype'
|
||||
* NVRAM variable.
|
||||
*
|
||||
* On SoCs, this will always be
|
||||
* populated with the value of the
|
||||
* 'boardtype' NVRAM variable.
|
||||
*/
|
||||
uint16_t board_devid; /**< Board device ID.
|
||||
*
|
||||
* On PCI devices, this will default
|
||||
* to the PCI device ID, but may
|
||||
* be overridden by the 'devid'
|
||||
* NVRAM variable.
|
||||
*/
|
||||
uint16_t board_rev; /**< Board revision. */
|
||||
uint8_t board_srom_rev; /**< Board SROM format revision */
|
||||
|
@ -217,14 +217,16 @@ struct bhnd_board_match {
|
||||
uint8_t
|
||||
board_vendor:1,
|
||||
board_type:1,
|
||||
board_devid:1,
|
||||
board_rev:1,
|
||||
board_srom_rev:1,
|
||||
flags_unused:4;
|
||||
flags_unused:3;
|
||||
} match;
|
||||
} m;
|
||||
|
||||
uint16_t board_vendor; /**< required board vendor */
|
||||
uint16_t board_type; /**< required board type */
|
||||
uint16_t board_devid; /**< required board devid */
|
||||
struct bhnd_hwrev_match board_rev; /**< matching board revisions */
|
||||
struct bhnd_hwrev_match board_srom_rev; /**< matching board srom revisions */
|
||||
};
|
||||
@ -232,6 +234,7 @@ struct bhnd_board_match {
|
||||
#define _BHND_BOARD_MATCH_COPY(_src) \
|
||||
_BHND_COPY_MATCH_FIELD(_src, board_vendor), \
|
||||
_BHND_COPY_MATCH_FIELD(_src, board_type), \
|
||||
_BHND_COPY_MATCH_FIELD(_src, board_devid), \
|
||||
_BHND_COPY_MATCH_FIELD(_src, board_rev), \
|
||||
_BHND_COPY_MATCH_FIELD(_src, board_srom_rev)
|
||||
|
||||
@ -241,6 +244,11 @@ struct bhnd_board_match {
|
||||
/** Set the required board type within a bhnd match descriptor */
|
||||
#define BHND_MATCH_BOARD_TYPE(_type) _BHND_SET_MATCH_FIELD(board_type, \
|
||||
BHND_BOARD_ ## _type)
|
||||
|
||||
/** Set the required board devid within a bhnd match descriptor */
|
||||
#define BHND_MATCH_BOARD_DEVID(_devid) _BHND_SET_MATCH_FIELD(board_devid, \
|
||||
(_devid))
|
||||
|
||||
/** Set the required SROM revision range within a bhnd match descriptor */
|
||||
#define BHND_MATCH_SROMREV(_rev) _BHND_SET_MATCH_FIELD(board_srom_rev, \
|
||||
BHND_HWREV_ ## _rev)
|
||||
@ -278,9 +286,10 @@ struct bhnd_device_match {
|
||||
chip_type:1,
|
||||
board_vendor:1,
|
||||
board_type:1,
|
||||
board_devid:1,
|
||||
board_rev:1,
|
||||
board_srom_rev:1,
|
||||
flags_unused:16;
|
||||
flags_unused:15;
|
||||
} match;
|
||||
} m;
|
||||
|
||||
@ -298,6 +307,7 @@ struct bhnd_device_match {
|
||||
|
||||
uint16_t board_vendor; /**< required board vendor */
|
||||
uint16_t board_type; /**< required board type */
|
||||
uint16_t board_devid; /**< required board devid */
|
||||
struct bhnd_hwrev_match board_rev; /**< matching board revisions */
|
||||
struct bhnd_hwrev_match board_srom_rev; /**< matching board srom revisions */
|
||||
};
|
||||
|
@ -807,6 +807,10 @@ bhnd_board_matches(const struct bhnd_board_info *board,
|
||||
if (desc->m.match.board_type && board->board_type != desc->board_type)
|
||||
return (false);
|
||||
|
||||
if (desc->m.match.board_devid &&
|
||||
board->board_devid != desc->board_devid)
|
||||
return (false);
|
||||
|
||||
if (desc->m.match.board_rev &&
|
||||
!bhnd_hwrev_matches(board->board_rev, &desc->board_rev))
|
||||
return (false);
|
||||
@ -2325,6 +2329,7 @@ bhnd_bus_generic_read_board_info(device_t dev, device_t child,
|
||||
|
||||
OPT_BHND_GV(info->board_vendor, BOARDVENDOR, 0);
|
||||
OPT_BHND_GV(info->board_type, BOARDTYPE, 0); /* srom >= 2 */
|
||||
OPT_BHND_GV(info->board_devid, DEVID, 0); /* srom >= 8 */
|
||||
REQ_BHND_GV(info->board_rev, BOARDREV);
|
||||
OPT_BHND_GV(info->board_srom_rev,SROMREV, 0); /* missing in
|
||||
some SoC
|
||||
|
@ -1002,14 +1002,17 @@ bhndb_pci_populate_board_info(device_t dev, device_t child,
|
||||
}
|
||||
}
|
||||
|
||||
/* If NVRAM did not supply vendor/type info, provide the PCI
|
||||
* subvendor/subdevice values. */
|
||||
/* If NVRAM did not supply vendor/type/devid info, provide the PCI
|
||||
* subvendor/subdevice/device values. */
|
||||
if (info->board_vendor == 0)
|
||||
info->board_vendor = pci_get_subvendor(sc->parent);
|
||||
|
||||
if (info->board_type == 0)
|
||||
info->board_type = pci_get_subdevice(sc->parent);
|
||||
|
||||
if (info->board_devid == 0)
|
||||
info->board_devid = pci_get_device(sc->parent);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,27 @@ bhnd_nexus_get_chipid(device_t dev, device_t child)
|
||||
return (&bcm_get_platform()->cid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default bhnd_nexus implementation of BHND_BUS_READ_BOARD_INFO().
|
||||
*/
|
||||
static int
|
||||
bhnd_nexus_read_board_info(device_t dev, device_t child,
|
||||
struct bhnd_board_info *info)
|
||||
{
|
||||
int error;
|
||||
|
||||
/* Initialize with NVRAM-derived values */
|
||||
if ((error = bhnd_bus_generic_read_board_info(dev, child, info)))
|
||||
return (error);
|
||||
|
||||
/* The board vendor should default to PCI_VENDOR_BROADCOM if not
|
||||
* otherwise specified */
|
||||
if (info->board_vendor == 0)
|
||||
info->board_vendor = PCI_VENDOR_BROADCOM;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default bhnd_nexus implementation of BHND_BUS_MAP_INTR().
|
||||
*/
|
||||
@ -249,6 +270,7 @@ static device_method_t bhnd_nexus_methods[] = {
|
||||
DEVMETHOD(bhnd_bus_get_dma_translation, bhnd_nexus_get_dma_translation),
|
||||
DEVMETHOD(bhnd_bus_get_intr_domain, bhnd_bus_generic_get_intr_domain),
|
||||
DEVMETHOD(bhnd_bus_map_intr, bhnd_nexus_map_intr),
|
||||
DEVMETHOD(bhnd_bus_read_board_info, bhnd_nexus_read_board_info),
|
||||
DEVMETHOD(bhnd_bus_unmap_intr, bhnd_nexus_unmap_intr),
|
||||
|
||||
DEVMETHOD_END
|
||||
|
Loading…
x
Reference in New Issue
Block a user