2016-02-26 03:34:08 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2015 Landon Fuller <landon@landonf.org>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
|
|
|
|
* redistribution must be conditioned upon including a substantially
|
|
|
|
* similar Disclaimer requirement for further binary redistribution.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
|
|
|
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
|
|
|
|
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
|
|
|
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
|
|
|
#include <dev/bhnd/bhnd_ids.h>
|
|
|
|
#include <dev/bhnd/bhndreg.h>
|
|
|
|
#include <dev/bhnd/bhnd.h>
|
|
|
|
|
|
|
|
#include "bhndb_hwdata.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Resource priority specifications shared by all bhndb(4) bridge
|
|
|
|
* implementations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define a bhndb_port_priority table.
|
|
|
|
*/
|
|
|
|
#define BHNDB_PORTS(...) \
|
|
|
|
.ports = _BHNDB_PORT_ARRAY(__VA_ARGS__), \
|
|
|
|
.num_ports = nitems(_BHNDB_PORT_ARRAY(__VA_ARGS__))
|
|
|
|
|
|
|
|
#define _BHNDB_PORT_ARRAY(...) (const struct bhndb_port_priority[]) { \
|
|
|
|
__VA_ARGS__ \
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-05-24 21:20:17 +00:00
|
|
|
* Define a core priority record for all cores matching @p devclass
|
2016-02-26 03:34:08 +00:00
|
|
|
*/
|
2016-05-24 21:20:17 +00:00
|
|
|
#define BHNDB_CLASS_PRIO(_devclass, _priority, ...) { \
|
2016-02-26 03:34:08 +00:00
|
|
|
.match = { \
|
2016-05-24 21:20:17 +00:00
|
|
|
BHND_MATCH_CORE_CLASS(BHND_DEVCLASS_ ## _devclass), \
|
2016-02-26 03:34:08 +00:00
|
|
|
}, \
|
|
|
|
.priority = (BHNDB_PRIORITY_ ## _priority), \
|
|
|
|
BHNDB_PORTS(__VA_ARGS__) \
|
|
|
|
}
|
|
|
|
|
2016-05-24 21:20:17 +00:00
|
|
|
/*
|
|
|
|
* Define a default core priority record
|
|
|
|
*/
|
|
|
|
#define BHNDB_DEFAULT_PRIO(...) { \
|
|
|
|
.match = { \
|
|
|
|
BHND_MATCH_ANY , \
|
|
|
|
}, \
|
|
|
|
.priority = (BHNDB_PRIORITY_DEFAULT), \
|
|
|
|
BHNDB_PORTS(__VA_ARGS__) \
|
|
|
|
}
|
|
|
|
|
2016-02-26 03:34:08 +00:00
|
|
|
/* Define a port priority record for the type/port/region
|
|
|
|
* triplet. */
|
|
|
|
#define BHNDB_PORT_PRIO(_type, _port, _region, _priority) { \
|
|
|
|
.type = (BHND_PORT_ ## _type), \
|
|
|
|
.port = _port, \
|
|
|
|
.region = _region, \
|
|
|
|
.priority = (BHNDB_PRIORITY_ ## _priority) \
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Define a port priority record for the default (_type, 0, 0) type/port/region
|
|
|
|
* triplet. */
|
|
|
|
#define BHNDB_PORT0_PRIO(_type, _priority) \
|
|
|
|
BHNDB_PORT_PRIO(_type, 0, 0, _priority)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic resource priority configuration usable with all currently supported
|
|
|
|
* bcma(4)-based PCI devices.
|
|
|
|
*/
|
|
|
|
const struct bhndb_hw_priority bhndb_bcma_priority_table[] = {
|
|
|
|
/*
|
|
|
|
* Ignorable device classes.
|
|
|
|
*
|
|
|
|
* Runtime access to these cores is not required, and no register
|
|
|
|
* windows should be reserved for these device types.
|
|
|
|
*/
|
2016-05-24 21:20:17 +00:00
|
|
|
BHNDB_CLASS_PRIO(SOC_ROUTER, NONE),
|
|
|
|
BHNDB_CLASS_PRIO(SOC_BRIDGE, NONE),
|
|
|
|
BHNDB_CLASS_PRIO(EROM, NONE),
|
|
|
|
BHNDB_CLASS_PRIO(OTHER, NONE),
|
2016-02-26 03:34:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Low priority device classes.
|
|
|
|
*
|
|
|
|
* These devices do not sit in a performance-critical path and can be
|
|
|
|
* treated as a low allocation priority.
|
|
|
|
*/
|
2016-05-24 21:20:17 +00:00
|
|
|
BHNDB_CLASS_PRIO(CC, LOW,
|
2016-02-26 03:34:08 +00:00
|
|
|
/* Device Block */
|
|
|
|
BHNDB_PORT0_PRIO(DEVICE, LOW),
|
|
|
|
|
|
|
|
/* CC agent registers are not accessed via the bridge. */
|
|
|
|
BHNDB_PORT0_PRIO(AGENT, NONE)
|
|
|
|
),
|
|
|
|
|
2016-05-24 21:20:17 +00:00
|
|
|
BHNDB_CLASS_PRIO(PMU, LOW,
|
2016-02-26 03:34:08 +00:00
|
|
|
/* Device Block */
|
|
|
|
BHNDB_PORT0_PRIO(DEVICE, LOW),
|
|
|
|
|
|
|
|
/* PMU agent registers are not accessed via the bridge. */
|
|
|
|
BHNDB_PORT0_PRIO(AGENT, NONE)
|
|
|
|
),
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Default Core Behavior
|
|
|
|
*
|
2016-05-03 03:41:25 +00:00
|
|
|
* All other cores are assumed to require efficient runtime access to
|
2016-02-26 03:34:08 +00:00
|
|
|
* the default device port, and if supported by the bus, an agent port.
|
|
|
|
*/
|
2016-05-24 21:20:17 +00:00
|
|
|
BHNDB_DEFAULT_PRIO(
|
2016-02-26 03:34:08 +00:00
|
|
|
/* Device Block */
|
|
|
|
BHNDB_PORT0_PRIO(DEVICE, HIGH),
|
|
|
|
|
|
|
|
/* Agent Block */
|
|
|
|
BHNDB_PORT0_PRIO(AGENT, DEFAULT)
|
|
|
|
),
|
|
|
|
|
|
|
|
BHNDB_HW_PRIORITY_TABLE_END
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic resource priority configuration usable with all currently supported
|
|
|
|
* siba(4)-based PCI devices.
|
|
|
|
*/
|
|
|
|
const struct bhndb_hw_priority bhndb_siba_priority_table[] = {
|
|
|
|
/*
|
|
|
|
* Ignorable device classes.
|
|
|
|
*
|
|
|
|
* Runtime access to these cores is not required, and no register
|
|
|
|
* windows should be reserved for these device types.
|
|
|
|
*/
|
2016-05-24 21:20:17 +00:00
|
|
|
BHNDB_CLASS_PRIO(SOC_ROUTER, NONE),
|
|
|
|
BHNDB_CLASS_PRIO(SOC_BRIDGE, NONE),
|
|
|
|
BHNDB_CLASS_PRIO(EROM, NONE),
|
|
|
|
BHNDB_CLASS_PRIO(OTHER, NONE),
|
2016-02-26 03:34:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Low priority device classes.
|
|
|
|
*
|
|
|
|
* These devices do not sit in a performance-critical path and can be
|
|
|
|
* treated as a low allocation priority.
|
|
|
|
*
|
|
|
|
* Agent ports are marked as 'NONE' on siba(4) devices, as they
|
|
|
|
* will be fully mappable via register windows shared with the
|
|
|
|
* device0.0 port.
|
|
|
|
*/
|
2016-05-24 21:20:17 +00:00
|
|
|
BHNDB_CLASS_PRIO(CC, LOW,
|
2016-02-26 03:34:08 +00:00
|
|
|
/* Device Block */
|
|
|
|
BHNDB_PORT_PRIO(DEVICE, 0, 0, LOW)
|
|
|
|
),
|
|
|
|
|
2016-05-24 21:20:17 +00:00
|
|
|
BHNDB_CLASS_PRIO(PMU, LOW,
|
2016-02-26 03:34:08 +00:00
|
|
|
/* Device Block */
|
|
|
|
BHNDB_PORT_PRIO(DEVICE, 0, 0, LOW)
|
|
|
|
),
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Default Core Behavior
|
|
|
|
*
|
2016-05-03 03:41:25 +00:00
|
|
|
* All other cores are assumed to require efficient runtime access to
|
2016-02-26 03:34:08 +00:00
|
|
|
* the device port.
|
|
|
|
*/
|
2016-05-24 21:20:17 +00:00
|
|
|
BHNDB_DEFAULT_PRIO(
|
2016-02-26 03:34:08 +00:00
|
|
|
/* Device Block */
|
|
|
|
BHNDB_PORT_PRIO(DEVICE, 0, 0, HIGH)
|
|
|
|
),
|
|
|
|
|
|
|
|
BHNDB_HW_PRIORITY_TABLE_END
|
|
|
|
};
|