xref: /freebsd/sys/dev/bhnd/bhndb/bhndb_pci_hwdata.c (revision 685dc743dc3b5645e34836464128e1c0558b404b)
14ad7e9b0SAdrian Chadd /*-
24ad7e9b0SAdrian Chadd  * Copyright (c) 2015 Landon Fuller <landon@landonf.org>
34ad7e9b0SAdrian Chadd  * All rights reserved.
44ad7e9b0SAdrian Chadd  *
54ad7e9b0SAdrian Chadd  * Redistribution and use in source and binary forms, with or without
64ad7e9b0SAdrian Chadd  * modification, are permitted provided that the following conditions
74ad7e9b0SAdrian Chadd  * are met:
84ad7e9b0SAdrian Chadd  * 1. Redistributions of source code must retain the above copyright
94ad7e9b0SAdrian Chadd  *    notice, this list of conditions and the following disclaimer,
104ad7e9b0SAdrian Chadd  *    without modification.
114ad7e9b0SAdrian Chadd  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
124ad7e9b0SAdrian Chadd  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
134ad7e9b0SAdrian Chadd  *    redistribution must be conditioned upon including a substantially
144ad7e9b0SAdrian Chadd  *    similar Disclaimer requirement for further binary redistribution.
154ad7e9b0SAdrian Chadd  *
164ad7e9b0SAdrian Chadd  * NO WARRANTY
174ad7e9b0SAdrian Chadd  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
184ad7e9b0SAdrian Chadd  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
194ad7e9b0SAdrian Chadd  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
204ad7e9b0SAdrian Chadd  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
214ad7e9b0SAdrian Chadd  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
224ad7e9b0SAdrian Chadd  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
234ad7e9b0SAdrian Chadd  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
244ad7e9b0SAdrian Chadd  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
254ad7e9b0SAdrian Chadd  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
264ad7e9b0SAdrian Chadd  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
274ad7e9b0SAdrian Chadd  * THE POSSIBILITY OF SUCH DAMAGES.
284ad7e9b0SAdrian Chadd  */
294ad7e9b0SAdrian Chadd 
304ad7e9b0SAdrian Chadd #include <sys/cdefs.h>
314ad7e9b0SAdrian Chadd /*
324ad7e9b0SAdrian Chadd  * Resource specifications and register maps for Broadcom PCI/PCIe cores
334ad7e9b0SAdrian Chadd  * configured as PCI-BHND bridges.
344ad7e9b0SAdrian Chadd  */
354ad7e9b0SAdrian Chadd 
364ad7e9b0SAdrian Chadd #include <sys/param.h>
374ad7e9b0SAdrian Chadd #include <sys/bus.h>
384ad7e9b0SAdrian Chadd 
394ad7e9b0SAdrian Chadd #include <machine/bus.h>
404ad7e9b0SAdrian Chadd #include <sys/rman.h>
414ad7e9b0SAdrian Chadd #include <machine/resource.h>
424ad7e9b0SAdrian Chadd 
434ad7e9b0SAdrian Chadd #include <dev/pci/pcireg.h>
444ad7e9b0SAdrian Chadd #include <dev/pci/pcivar.h>
454ad7e9b0SAdrian Chadd 
469ed45324SLandon J. Fuller #include <dev/bhnd/cores/pci/bhnd_pcireg.h>
479ed45324SLandon J. Fuller #include <dev/bhnd/cores/pcie2/bhnd_pcie2_reg.h>
489ed45324SLandon J. Fuller 
494ad7e9b0SAdrian Chadd #include "bhndbvar.h"
504ad7e9b0SAdrian Chadd #include "bhndb_pcireg.h"
514ad7e9b0SAdrian Chadd 
524ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v0;
534ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v1_pci;
544ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v1_pcie;
554ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v2;
564ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v3;
574ad7e9b0SAdrian Chadd 
584ad7e9b0SAdrian Chadd /**
594ad7e9b0SAdrian Chadd  * Define a bhndb_hw match entry.
604ad7e9b0SAdrian Chadd  *
614ad7e9b0SAdrian Chadd  * @param _name The entry name.
624ad7e9b0SAdrian Chadd  * @param _vers The configuration version associated with this entry.
634ad7e9b0SAdrian Chadd  */
644ad7e9b0SAdrian Chadd #define	BHNDB_HW_MATCH(_name, _vers, ...) {				\
654ad7e9b0SAdrian Chadd 	.name		= _name,					\
664ad7e9b0SAdrian Chadd 	.hw_reqs	= _BHNDB_HW_REQ_ARRAY(__VA_ARGS__),		\
674ad7e9b0SAdrian Chadd 	.num_hw_reqs	= (sizeof(_BHNDB_HW_REQ_ARRAY(__VA_ARGS__)) /	\
684ad7e9b0SAdrian Chadd 	    sizeof(_BHNDB_HW_REQ_ARRAY(__VA_ARGS__)[0])),		\
694ad7e9b0SAdrian Chadd 	.cfg		= &bhndb_pci_hwcfg_ ## _vers			\
704ad7e9b0SAdrian Chadd }
714ad7e9b0SAdrian Chadd #define	_BHNDB_HW_REQ_ARRAY(...) (struct bhnd_core_match[]) { __VA_ARGS__ }
724ad7e9b0SAdrian Chadd 
734ad7e9b0SAdrian Chadd /**
744ad7e9b0SAdrian Chadd  * Generic PCI-SIBA bridge configuration usable with all known siba(4)-based
754ad7e9b0SAdrian Chadd  * PCI devices; this configuration is adequate for enumerating a bridged
764ad7e9b0SAdrian Chadd  * siba(4) bus to determine the full hardware configuration.
774ad7e9b0SAdrian Chadd  *
784ad7e9b0SAdrian Chadd  * @par Compatibility
794ad7e9b0SAdrian Chadd  * - Compatible with PCI_V0, PCI_V1, PCI_V2, and PCI_V3 devices.
804ad7e9b0SAdrian Chadd  * - Compatible with siba(4) bus enumeration.
814ad7e9b0SAdrian Chadd  * - Compatible with bcma(4) bus enumeration if the ChipCommon core is mapped
824ad7e9b0SAdrian Chadd  *   at the default enumeration address (0x18000000).
834ad7e9b0SAdrian Chadd  */
844ad7e9b0SAdrian Chadd const struct bhndb_hwcfg bhndb_pci_siba_generic_hwcfg = {
854ad7e9b0SAdrian Chadd 	.resource_specs = (const struct resource_spec[]) {
864ad7e9b0SAdrian Chadd 		{ SYS_RES_MEMORY,	PCIR_BAR(0),	RF_ACTIVE },
874ad7e9b0SAdrian Chadd 		{ -1,			0,		0 }
884ad7e9b0SAdrian Chadd 	},
894ad7e9b0SAdrian Chadd 
904ad7e9b0SAdrian Chadd 	.register_windows = (const struct bhndb_regwin[]) {
914ad7e9b0SAdrian Chadd 		/* bar0+0x0000: configurable backplane window */
924ad7e9b0SAdrian Chadd 		{
934ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
944ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_WIN0_OFFSET,
954ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_WIN0_SIZE,
96426a80d4SAdrian Chadd 			.d.dyn = {
97426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V1_BAR0_WIN0_CONTROL
98426a80d4SAdrian Chadd 			},
994ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
1004ad7e9b0SAdrian Chadd 		},
1014ad7e9b0SAdrian Chadd 		BHNDB_REGWIN_TABLE_END
1024ad7e9b0SAdrian Chadd 	},
1039ed45324SLandon J. Fuller 
1049ed45324SLandon J. Fuller 	/* DMA unsupported under generic configuration */
1059ed45324SLandon J. Fuller 	.dma_translations = NULL,
1064ad7e9b0SAdrian Chadd };
1074ad7e9b0SAdrian Chadd 
1084ad7e9b0SAdrian Chadd /**
1094ad7e9b0SAdrian Chadd  * Generic PCI-BCMA bridge configuration usable with all known bcma(4)-based
1104ad7e9b0SAdrian Chadd  * PCI devices; this configuration is adequate for enumerating a bridged
1114ad7e9b0SAdrian Chadd  * bcma(4) bus to determine the full hardware configuration.
1124ad7e9b0SAdrian Chadd  *
1134ad7e9b0SAdrian Chadd  * @par Compatibility
1144ad7e9b0SAdrian Chadd  * - Compatible with PCI_V1, PCI_V2, and PCI_V3 devices.
1154ad7e9b0SAdrian Chadd  * - Compatible with both siba(4) and bcma(4) bus enumeration.
1164ad7e9b0SAdrian Chadd  */
1174ad7e9b0SAdrian Chadd const struct bhndb_hwcfg bhndb_pci_bcma_generic_hwcfg = {
1184ad7e9b0SAdrian Chadd 	.resource_specs		= (const struct resource_spec[]) {
1194ad7e9b0SAdrian Chadd 		{ SYS_RES_MEMORY,	PCIR_BAR(0),	RF_ACTIVE },
1204ad7e9b0SAdrian Chadd 		{ -1,			0,		0 }
1214ad7e9b0SAdrian Chadd 	},
1224ad7e9b0SAdrian Chadd 
1234ad7e9b0SAdrian Chadd 	.register_windows	= (const struct bhndb_regwin[]) {
1244ad7e9b0SAdrian Chadd 		/* bar0+0x0000: configurable backplane window */
1254ad7e9b0SAdrian Chadd 		{
1264ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
1274ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_WIN0_OFFSET,
1284ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_WIN0_SIZE,
129426a80d4SAdrian Chadd 			.d.dyn = {
130426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V1_BAR0_WIN0_CONTROL,
131426a80d4SAdrian Chadd 			},
1324ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
1334ad7e9b0SAdrian Chadd 		},
1344ad7e9b0SAdrian Chadd 
1354ad7e9b0SAdrian Chadd 		/* bar0+0x3000: chipc core registers */
1364ad7e9b0SAdrian Chadd 		{
1374ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
1384ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_CCREGS_OFFSET,
1394ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_CCREGS_SIZE,
140426a80d4SAdrian Chadd 			.d.core = {
1414ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_CC,
1424ad7e9b0SAdrian Chadd 				.unit	= 0,
1434ad7e9b0SAdrian Chadd 				.port	= 0,
1444ad7e9b0SAdrian Chadd 				.region	= 0,
1454ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
1464ad7e9b0SAdrian Chadd 			},
1474ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
1484ad7e9b0SAdrian Chadd 		},
1494ad7e9b0SAdrian Chadd 
1504ad7e9b0SAdrian Chadd 		BHNDB_REGWIN_TABLE_END
1514ad7e9b0SAdrian Chadd 	},
1529ed45324SLandon J. Fuller 
1539ed45324SLandon J. Fuller 	/* DMA unsupported under generic configuration */
1549ed45324SLandon J. Fuller 	.dma_translations = NULL,
1554ad7e9b0SAdrian Chadd };
1564ad7e9b0SAdrian Chadd 
1574ad7e9b0SAdrian Chadd /**
1584ad7e9b0SAdrian Chadd  * Hardware configuration tables for Broadcom HND PCI NICs.
1594ad7e9b0SAdrian Chadd  */
1604ad7e9b0SAdrian Chadd const struct bhndb_hw bhndb_pci_generic_hw_table[] = {
1614ad7e9b0SAdrian Chadd 	/* PCI/V0 WLAN */
1624ad7e9b0SAdrian Chadd 	BHNDB_HW_MATCH("PCI/v0 WLAN", v0,
1634ad7e9b0SAdrian Chadd 		/* PCI Core */
1644ad7e9b0SAdrian Chadd 		{
1655ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
1665ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_ID	(BHND_COREID_PCI),
1675ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_REV(
1685ad9ac03SAdrian Chadd 			    HWREV_LTE		(BHNDB_PCI_V0_MAX_PCI_HWREV)),
1695ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_PCI),
1705ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
1714ad7e9b0SAdrian Chadd 		},
1724ad7e9b0SAdrian Chadd 
1734ad7e9b0SAdrian Chadd 		/* 802.11 Core */
1744ad7e9b0SAdrian Chadd 		{
1755ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
1765ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_WLAN),
1775ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
1784ad7e9b0SAdrian Chadd 		}
1794ad7e9b0SAdrian Chadd 	),
1804ad7e9b0SAdrian Chadd 
1814ad7e9b0SAdrian Chadd 	/* PCI/V1 WLAN */
1824ad7e9b0SAdrian Chadd 	BHNDB_HW_MATCH("PCI/v1 WLAN", v1_pci,
1834ad7e9b0SAdrian Chadd 		/* PCI Core */
1844ad7e9b0SAdrian Chadd 		{
1855ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
1865ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_ID	(BHND_COREID_PCI),
1875ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_REV(
1885ad9ac03SAdrian Chadd 			    HWREV_GTE		(BHNDB_PCI_V1_MIN_PCI_HWREV)),
1895ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_PCI),
1905ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
1914ad7e9b0SAdrian Chadd 		},
1924ad7e9b0SAdrian Chadd 
1934ad7e9b0SAdrian Chadd 		/* 802.11 Core */
1944ad7e9b0SAdrian Chadd 		{
1955ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
1965ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_WLAN),
1975ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
1984ad7e9b0SAdrian Chadd 		}
1994ad7e9b0SAdrian Chadd 	),
2004ad7e9b0SAdrian Chadd 
2014ad7e9b0SAdrian Chadd 	/* PCIE/V1 WLAN */
2024ad7e9b0SAdrian Chadd 	BHNDB_HW_MATCH("PCIe/v1 WLAN", v1_pcie,
2034ad7e9b0SAdrian Chadd 		/* PCIe Core */
2044ad7e9b0SAdrian Chadd 		{
2055ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
2065ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_ID	(BHND_COREID_PCIE),
2075ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_PCIE),
2085ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
2094ad7e9b0SAdrian Chadd 		},
2104ad7e9b0SAdrian Chadd 
2114ad7e9b0SAdrian Chadd 		/* ChipCommon (revision <= 31) */
2124ad7e9b0SAdrian Chadd 		{
2135ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
2145ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_ID	(BHND_COREID_CC),
2155ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_REV(
2165ad9ac03SAdrian Chadd 			    HWREV_LTE		(BHNDB_PCI_V1_MAX_CHIPC_HWREV)),
2175ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_CC),
2185ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
2194ad7e9b0SAdrian Chadd 		},
2204ad7e9b0SAdrian Chadd 
2214ad7e9b0SAdrian Chadd 		/* 802.11 Core */
2224ad7e9b0SAdrian Chadd 		{
2235ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
2245ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_WLAN),
2255ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
2264ad7e9b0SAdrian Chadd 		}
2274ad7e9b0SAdrian Chadd 	),
2284ad7e9b0SAdrian Chadd 
2294ad7e9b0SAdrian Chadd 	/* PCIE/V2 WLAN */
2304ad7e9b0SAdrian Chadd 	BHNDB_HW_MATCH("PCIe/v2 WLAN", v2,
2314ad7e9b0SAdrian Chadd 		/* PCIe Core */
2324ad7e9b0SAdrian Chadd 		{
2335ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
2345ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_ID	(BHND_COREID_PCIE),
2355ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_PCIE),
2365ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
2374ad7e9b0SAdrian Chadd 		},
2384ad7e9b0SAdrian Chadd 
2394ad7e9b0SAdrian Chadd 		/* ChipCommon (revision >= 32) */
2404ad7e9b0SAdrian Chadd 		{
2415ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
2425ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_ID	(BHND_COREID_CC),
2435ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_REV(
2445ad9ac03SAdrian Chadd 			    HWREV_GTE		(BHNDB_PCI_V2_MIN_CHIPC_HWREV)),
2455ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_CC),
2465ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
2474ad7e9b0SAdrian Chadd 		},
2484ad7e9b0SAdrian Chadd 
2494ad7e9b0SAdrian Chadd 		/* 802.11 Core */
2504ad7e9b0SAdrian Chadd 		{
2515ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
2525ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_WLAN),
2535ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
2544ad7e9b0SAdrian Chadd 		}
2554ad7e9b0SAdrian Chadd 	),
2564ad7e9b0SAdrian Chadd 
2574ad7e9b0SAdrian Chadd 	/* PCIE/V3 WLAN */
2584ad7e9b0SAdrian Chadd 	BHNDB_HW_MATCH("PCIe-Gen2/v3 WLAN", v3,
2594ad7e9b0SAdrian Chadd 		/* PCIe Gen2 Core */
2604ad7e9b0SAdrian Chadd 		{
2615ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
2625ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_ID	(BHND_COREID_PCIE2),
2635ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_PCIE),
2645ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
2654ad7e9b0SAdrian Chadd 		},
2664ad7e9b0SAdrian Chadd 
2674ad7e9b0SAdrian Chadd 		/* 802.11 Core */
2684ad7e9b0SAdrian Chadd 		{
2695ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_VENDOR	(BHND_MFGID_BCM),
2705ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_CLASS	(BHND_DEVCLASS_WLAN),
2715ad9ac03SAdrian Chadd 			BHND_MATCH_CORE_UNIT	(0)
2724ad7e9b0SAdrian Chadd 		}
2734ad7e9b0SAdrian Chadd 	),
2744ad7e9b0SAdrian Chadd 	{ NULL, NULL, 0, NULL }
2754ad7e9b0SAdrian Chadd };
2764ad7e9b0SAdrian Chadd 
2774ad7e9b0SAdrian Chadd /**
2784ad7e9b0SAdrian Chadd  * PCI_V0 hardware configuration.
2794ad7e9b0SAdrian Chadd  *
2804ad7e9b0SAdrian Chadd  * Applies to:
2814ad7e9b0SAdrian Chadd  * - PCI (cid=0x804, revision <= 12)
2824ad7e9b0SAdrian Chadd  */
2834ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v0 = {
2844ad7e9b0SAdrian Chadd 	.resource_specs		= (const struct resource_spec[]) {
2854ad7e9b0SAdrian Chadd 		{ SYS_RES_MEMORY,	PCIR_BAR(0),	RF_ACTIVE },
2864ad7e9b0SAdrian Chadd 		{ -1,			0,		0 }
2874ad7e9b0SAdrian Chadd 	},
2884ad7e9b0SAdrian Chadd 
2894ad7e9b0SAdrian Chadd 	.register_windows	= (const struct bhndb_regwin[]) {
2904ad7e9b0SAdrian Chadd 		/* bar0+0x0000: configurable backplane window */
2914ad7e9b0SAdrian Chadd 		{
2924ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
2934ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V0_BAR0_WIN0_OFFSET,
2944ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V0_BAR0_WIN0_SIZE,
295426a80d4SAdrian Chadd 			.d.dyn = {
296426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V0_BAR0_WIN0_CONTROL
297426a80d4SAdrian Chadd 			},
2984ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
2994ad7e9b0SAdrian Chadd 		},
3004ad7e9b0SAdrian Chadd 
3014ad7e9b0SAdrian Chadd 		/* bar0+0x1000: sprom shadow */
3024ad7e9b0SAdrian Chadd 		{
3034ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_SPROM,
3044ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V0_BAR0_SPROM_OFFSET,
3054ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V0_BAR0_SPROM_SIZE,
3064ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
3074ad7e9b0SAdrian Chadd 		},
3084ad7e9b0SAdrian Chadd 
309eaa5fb4bSLandon J. Fuller 		/*
310eaa5fb4bSLandon J. Fuller 		 * bar0+0x1800: pci core registers.
311eaa5fb4bSLandon J. Fuller 		 *
312eaa5fb4bSLandon J. Fuller 		 * Does not include the SSB CFG registers found at the end of
313eaa5fb4bSLandon J. Fuller 		 * the 4K core register block; these are mapped non-contigiously
314eaa5fb4bSLandon J. Fuller 		 * by the next entry.
315eaa5fb4bSLandon J. Fuller 		 */
3164ad7e9b0SAdrian Chadd 		{
3174ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
3184ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V0_BAR0_PCIREG_OFFSET,
3194ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V0_BAR0_PCIREG_SIZE,
320426a80d4SAdrian Chadd 			.d.core = {
3214ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_PCI,
3224ad7e9b0SAdrian Chadd 				.unit	= 0,
3234ad7e9b0SAdrian Chadd 				.port	= 0,
3244ad7e9b0SAdrian Chadd 				.region	= 0,
325eaa5fb4bSLandon J. Fuller 				.port_type = BHND_PORT_DEVICE,
326eaa5fb4bSLandon J. Fuller 			},
327eaa5fb4bSLandon J. Fuller 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
328eaa5fb4bSLandon J. Fuller 		},
329eaa5fb4bSLandon J. Fuller 
330eaa5fb4bSLandon J. Fuller 		/* bar0+0x1E00: pci core (SSB CFG registers) */
331eaa5fb4bSLandon J. Fuller 		{
332eaa5fb4bSLandon J. Fuller 			.win_type	= BHNDB_REGWIN_T_CORE,
333eaa5fb4bSLandon J. Fuller 			.win_offset	= BHNDB_PCI_V0_BAR0_PCISB_OFFSET	,
334eaa5fb4bSLandon J. Fuller 			.win_size	= BHNDB_PCI_V0_BAR0_PCISB_SIZE,
335eaa5fb4bSLandon J. Fuller 			.d.core = {
336eaa5fb4bSLandon J. Fuller 				.class	= BHND_DEVCLASS_PCI,
337eaa5fb4bSLandon J. Fuller 				.unit	= 0,
338eaa5fb4bSLandon J. Fuller 				.port	= 0,
339eaa5fb4bSLandon J. Fuller 				.region	= 0,
340eaa5fb4bSLandon J. Fuller 				.offset	= BHNDB_PCI_V0_BAR0_PCISB_COREOFF,
3414ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
3424ad7e9b0SAdrian Chadd 			},
3434ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
3444ad7e9b0SAdrian Chadd 		},
345eaa5fb4bSLandon J. Fuller 
3464ad7e9b0SAdrian Chadd 		BHNDB_REGWIN_TABLE_END
3474ad7e9b0SAdrian Chadd 	},
3489ed45324SLandon J. Fuller 
3499ed45324SLandon J. Fuller 	.dma_translations = (const struct bhnd_dma_translation[]) {
3509ed45324SLandon J. Fuller 		{
3519ed45324SLandon J. Fuller 			.base_addr	= BHND_PCI_DMA32_TRANSLATION,
3529ed45324SLandon J. Fuller 			.addr_mask	= ~BHND_PCI_DMA32_MASK,
3539ed45324SLandon J. Fuller 			.addrext_mask	= BHND_PCI_DMA32_MASK
3549ed45324SLandon J. Fuller 		},
3559ed45324SLandon J. Fuller 		BHND_DMA_TRANSLATION_TABLE_END
3569ed45324SLandon J. Fuller 	}
3574ad7e9b0SAdrian Chadd };
3584ad7e9b0SAdrian Chadd 
3594ad7e9b0SAdrian Chadd /**
3604ad7e9b0SAdrian Chadd  * PCI_V1 (PCI-only) hardware configuration (PCI version)
3614ad7e9b0SAdrian Chadd  *
3624ad7e9b0SAdrian Chadd  * Applies to:
3634ad7e9b0SAdrian Chadd  * - PCI (cid=0x804, revision >= 13)
3644ad7e9b0SAdrian Chadd  */
3654ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v1_pci = {
3664ad7e9b0SAdrian Chadd 	.resource_specs		= (const struct resource_spec[]) {
3674ad7e9b0SAdrian Chadd 		{ SYS_RES_MEMORY,	PCIR_BAR(0),	RF_ACTIVE },
3684ad7e9b0SAdrian Chadd 		{ -1,			0,		0 }
3694ad7e9b0SAdrian Chadd 	},
3704ad7e9b0SAdrian Chadd 
3714ad7e9b0SAdrian Chadd 	.register_windows	= (const struct bhndb_regwin[]) {
3724ad7e9b0SAdrian Chadd 		/* bar0+0x0000: configurable backplane window */
3734ad7e9b0SAdrian Chadd 		{
3744ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
3754ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_WIN0_OFFSET,
3764ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_WIN0_SIZE,
377426a80d4SAdrian Chadd 			.d.dyn = {
378426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V1_BAR0_WIN0_CONTROL
379426a80d4SAdrian Chadd 			},
3804ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
3814ad7e9b0SAdrian Chadd 		},
3824ad7e9b0SAdrian Chadd 
3834ad7e9b0SAdrian Chadd 		/* bar0+0x1000: sprom shadow */
3844ad7e9b0SAdrian Chadd 		{
3854ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_SPROM,
3864ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_SPROM_OFFSET,
3874ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_SPROM_SIZE,
3884ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
3894ad7e9b0SAdrian Chadd 		},
3904ad7e9b0SAdrian Chadd 
3914ad7e9b0SAdrian Chadd 		/* bar0+0x2000: pci core registers */
3924ad7e9b0SAdrian Chadd 		{
3934ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
3944ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_PCIREG_OFFSET,
3954ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_PCIREG_SIZE,
396426a80d4SAdrian Chadd 			.d.core = {
3974ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_PCI,
3984ad7e9b0SAdrian Chadd 				.unit	= 0,
3994ad7e9b0SAdrian Chadd 				.port	= 0,
4004ad7e9b0SAdrian Chadd 				.region	= 0,
4014ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
4024ad7e9b0SAdrian Chadd 			},
4034ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
4044ad7e9b0SAdrian Chadd 		},
4054ad7e9b0SAdrian Chadd 
4064ad7e9b0SAdrian Chadd 		/* bar0+0x3000: chipc core registers */
4074ad7e9b0SAdrian Chadd 		{
4084ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
4094ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_CCREGS_OFFSET,
4104ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_CCREGS_SIZE,
411426a80d4SAdrian Chadd 			.d.core = {
4124ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_CC,
4134ad7e9b0SAdrian Chadd 				.unit	= 0,
4144ad7e9b0SAdrian Chadd 				.port	= 0,
4154ad7e9b0SAdrian Chadd 				.region	= 0,
4164ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
4174ad7e9b0SAdrian Chadd 			},
4184ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
4194ad7e9b0SAdrian Chadd 		},
4204ad7e9b0SAdrian Chadd 
4214ad7e9b0SAdrian Chadd 		BHNDB_REGWIN_TABLE_END
4224ad7e9b0SAdrian Chadd 	},
4239ed45324SLandon J. Fuller 
4249ed45324SLandon J. Fuller 	.dma_translations = (const struct bhnd_dma_translation[]) {
4259ed45324SLandon J. Fuller 		{
4269ed45324SLandon J. Fuller 			.base_addr	= BHND_PCI_DMA32_TRANSLATION,
4279ed45324SLandon J. Fuller 			.addr_mask	= ~BHND_PCI_DMA32_MASK,
4289ed45324SLandon J. Fuller 			.addrext_mask	= BHND_PCI_DMA32_MASK
4299ed45324SLandon J. Fuller 		},
4309ed45324SLandon J. Fuller 		BHND_DMA_TRANSLATION_TABLE_END
4319ed45324SLandon J. Fuller 	}
4324ad7e9b0SAdrian Chadd };
4334ad7e9b0SAdrian Chadd 
4344ad7e9b0SAdrian Chadd /**
4354ad7e9b0SAdrian Chadd  * PCI_V1 hardware configuration (PCIE version).
4364ad7e9b0SAdrian Chadd  *
4374ad7e9b0SAdrian Chadd  * Applies to:
4384ad7e9b0SAdrian Chadd  * - PCIE (cid=0x820) with ChipCommon (revision <= 31)
4394ad7e9b0SAdrian Chadd  */
4404ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v1_pcie = {
4414ad7e9b0SAdrian Chadd 	.resource_specs		= (const struct resource_spec[]) {
4424ad7e9b0SAdrian Chadd 		{ SYS_RES_MEMORY,	PCIR_BAR(0),	RF_ACTIVE },
4434ad7e9b0SAdrian Chadd 		{ -1,			0,		0 }
4444ad7e9b0SAdrian Chadd 	},
4454ad7e9b0SAdrian Chadd 
4464ad7e9b0SAdrian Chadd 	.register_windows	= (const struct bhndb_regwin[]) {
4474ad7e9b0SAdrian Chadd 		/* bar0+0x0000: configurable backplane window */
4484ad7e9b0SAdrian Chadd 		{
4494ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
4504ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_WIN0_OFFSET,
4514ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_WIN0_SIZE,
452426a80d4SAdrian Chadd 			.d.dyn = {
453426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V1_BAR0_WIN0_CONTROL
454426a80d4SAdrian Chadd 			},
4554ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
4564ad7e9b0SAdrian Chadd 		},
4574ad7e9b0SAdrian Chadd 
4584ad7e9b0SAdrian Chadd 		/* bar0+0x1000: sprom shadow */
4594ad7e9b0SAdrian Chadd 		{
4604ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_SPROM,
4614ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_SPROM_OFFSET,
4624ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_SPROM_SIZE,
4634ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
4644ad7e9b0SAdrian Chadd 		},
4654ad7e9b0SAdrian Chadd 
4664ad7e9b0SAdrian Chadd 		/* bar0+0x2000: pci core registers */
4674ad7e9b0SAdrian Chadd 		{
4684ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
4694ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_PCIREG_OFFSET,
4704ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_PCIREG_SIZE,
471426a80d4SAdrian Chadd 			.d.core = {
4724ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_PCIE,
4734ad7e9b0SAdrian Chadd 				.unit	= 0,
4744ad7e9b0SAdrian Chadd 				.port	= 0,
4754ad7e9b0SAdrian Chadd 				.region	= 0,
4764ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
4774ad7e9b0SAdrian Chadd 			},
4784ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
4794ad7e9b0SAdrian Chadd 		},
4804ad7e9b0SAdrian Chadd 
4814ad7e9b0SAdrian Chadd 		/* bar0+0x3000: chipc core registers */
4824ad7e9b0SAdrian Chadd 		{
4834ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
4844ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V1_BAR0_CCREGS_OFFSET,
4854ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V1_BAR0_CCREGS_SIZE,
486426a80d4SAdrian Chadd 			.d.core = {
4874ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_CC,
4884ad7e9b0SAdrian Chadd 				.unit	= 0,
4894ad7e9b0SAdrian Chadd 				.port	= 0,
4904ad7e9b0SAdrian Chadd 				.region	= 0,
4914ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
4924ad7e9b0SAdrian Chadd 			},
4934ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
4944ad7e9b0SAdrian Chadd 		},
4954ad7e9b0SAdrian Chadd 
4964ad7e9b0SAdrian Chadd 		BHNDB_REGWIN_TABLE_END
4974ad7e9b0SAdrian Chadd 	},
4989ed45324SLandon J. Fuller 
4999ed45324SLandon J. Fuller 	.dma_translations = (const struct bhnd_dma_translation[]) {
5009ed45324SLandon J. Fuller 		{
5019ed45324SLandon J. Fuller 			.base_addr	= BHND_PCIE_DMA32_TRANSLATION,
5029ed45324SLandon J. Fuller 			.addr_mask	= ~BHND_PCIE_DMA32_MASK,
5039ed45324SLandon J. Fuller 			.addrext_mask	= BHND_PCIE_DMA32_MASK
5049ed45324SLandon J. Fuller 		},
5059ed45324SLandon J. Fuller 		{
5069ed45324SLandon J. Fuller 			.base_addr	= BHND_PCIE_DMA64_TRANSLATION,
5079ed45324SLandon J. Fuller 			.addr_mask	= ~BHND_PCIE_DMA64_MASK,
508*80a7c0f5SLandon J. Fuller 			.addrext_mask	= BHND_PCIE_DMA64_MASK
5099ed45324SLandon J. Fuller 		},
5109ed45324SLandon J. Fuller 		BHND_DMA_TRANSLATION_TABLE_END
5119ed45324SLandon J. Fuller 	}
5124ad7e9b0SAdrian Chadd };
5134ad7e9b0SAdrian Chadd 
5144ad7e9b0SAdrian Chadd /**
5154ad7e9b0SAdrian Chadd  * PCI_V2 hardware configuration.
5164ad7e9b0SAdrian Chadd  *
5174ad7e9b0SAdrian Chadd  * Applies to:
5184ad7e9b0SAdrian Chadd  * - PCIE (cid=0x820) with ChipCommon (revision >= 32)
5194ad7e9b0SAdrian Chadd  */
5204ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v2 = {
5214ad7e9b0SAdrian Chadd 	.resource_specs		= (const struct resource_spec[]) {
5224ad7e9b0SAdrian Chadd 		{ SYS_RES_MEMORY,	PCIR_BAR(0),	RF_ACTIVE },
5234ad7e9b0SAdrian Chadd 		{ -1,			0,		0 }
5244ad7e9b0SAdrian Chadd 	},
5254ad7e9b0SAdrian Chadd 
5264ad7e9b0SAdrian Chadd 	.register_windows	= (const struct bhndb_regwin[]) {
5274ad7e9b0SAdrian Chadd 		/* bar0+0x0000: configurable backplane window */
5284ad7e9b0SAdrian Chadd 		{
5294ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
5304ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V2_BAR0_WIN0_OFFSET,
5314ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V2_BAR0_WIN0_SIZE,
532426a80d4SAdrian Chadd 			.d.dyn = {
533426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V2_BAR0_WIN0_CONTROL,
534426a80d4SAdrian Chadd 			},
5354ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
5364ad7e9b0SAdrian Chadd 		},
5374ad7e9b0SAdrian Chadd 
5384ad7e9b0SAdrian Chadd 		/* bar0+0x1000: configurable backplane window */
5394ad7e9b0SAdrian Chadd 		{
5404ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
5414ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V2_BAR0_WIN1_OFFSET,
5424ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V2_BAR0_WIN1_SIZE,
543426a80d4SAdrian Chadd 			.d.dyn = {
544426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V2_BAR0_WIN1_CONTROL,
545426a80d4SAdrian Chadd 			},
5464ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
5474ad7e9b0SAdrian Chadd 		},
5484ad7e9b0SAdrian Chadd 
5494ad7e9b0SAdrian Chadd 		/* bar0+0x2000: pcie core registers */
5504ad7e9b0SAdrian Chadd 		{
5514ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
5524ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V2_BAR0_PCIREG_OFFSET,
5534ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V2_BAR0_PCIREG_SIZE,
554426a80d4SAdrian Chadd 			.d.core = {
5554ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_PCIE,
5564ad7e9b0SAdrian Chadd 				.unit	= 0,
5574ad7e9b0SAdrian Chadd 				.port	= 0,
5584ad7e9b0SAdrian Chadd 				.region	= 0,
5594ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
5604ad7e9b0SAdrian Chadd 			},
5614ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
5624ad7e9b0SAdrian Chadd 		},
5634ad7e9b0SAdrian Chadd 
5644ad7e9b0SAdrian Chadd 		/* bar0+0x3000: chipc core registers */
5654ad7e9b0SAdrian Chadd 		{
5664ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
5674ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V2_BAR0_CCREGS_OFFSET,
5684ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V2_BAR0_CCREGS_SIZE,
569426a80d4SAdrian Chadd 			.d.core = {
5704ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_CC,
5714ad7e9b0SAdrian Chadd 				.unit	= 0,
5724ad7e9b0SAdrian Chadd 				.port	= 0,
5734ad7e9b0SAdrian Chadd 				.region	= 0,
5744ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
5754ad7e9b0SAdrian Chadd 			},
5764ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
5774ad7e9b0SAdrian Chadd 		},
5784ad7e9b0SAdrian Chadd 
5794ad7e9b0SAdrian Chadd 		BHNDB_REGWIN_TABLE_END
5804ad7e9b0SAdrian Chadd 	},
5819ed45324SLandon J. Fuller 
5829ed45324SLandon J. Fuller 	.dma_translations = (const struct bhnd_dma_translation[]) {
5839ed45324SLandon J. Fuller 		{
5849ed45324SLandon J. Fuller 			.base_addr	= BHND_PCIE_DMA32_TRANSLATION,
5859ed45324SLandon J. Fuller 			.addr_mask	= ~BHND_PCIE_DMA32_MASK,
5869ed45324SLandon J. Fuller 			.addrext_mask	= BHND_PCIE_DMA32_MASK
5879ed45324SLandon J. Fuller 		},
5889ed45324SLandon J. Fuller 		{
5899ed45324SLandon J. Fuller 			.base_addr	= BHND_PCIE_DMA64_TRANSLATION,
5909ed45324SLandon J. Fuller 			.addr_mask	= ~BHND_PCIE_DMA64_MASK,
591*80a7c0f5SLandon J. Fuller 			.addrext_mask	= BHND_PCIE_DMA64_MASK
5929ed45324SLandon J. Fuller 		},
5939ed45324SLandon J. Fuller 		BHND_DMA_TRANSLATION_TABLE_END
5949ed45324SLandon J. Fuller 	}
5954ad7e9b0SAdrian Chadd };
5964ad7e9b0SAdrian Chadd 
5974ad7e9b0SAdrian Chadd /**
5984ad7e9b0SAdrian Chadd  * PCI_V3 hardware configuration.
5994ad7e9b0SAdrian Chadd  *
6004ad7e9b0SAdrian Chadd  * Applies to:
6014ad7e9b0SAdrian Chadd  * - PCIE2 (cid=0x83c)
6024ad7e9b0SAdrian Chadd  */
6034ad7e9b0SAdrian Chadd static const struct bhndb_hwcfg bhndb_pci_hwcfg_v3 = {
6044ad7e9b0SAdrian Chadd 	.resource_specs		= (const struct resource_spec[]) {
6054ad7e9b0SAdrian Chadd 		{ SYS_RES_MEMORY,	PCIR_BAR(0),	RF_ACTIVE },
6064ad7e9b0SAdrian Chadd 		{ -1,			0,		0 }
6074ad7e9b0SAdrian Chadd 	},
6084ad7e9b0SAdrian Chadd 
6094ad7e9b0SAdrian Chadd 	.register_windows	= (const struct bhndb_regwin[]) {
6104ad7e9b0SAdrian Chadd 		/* bar0+0x0000: configurable backplane window */
6114ad7e9b0SAdrian Chadd 		{
6124ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
6134ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V3_BAR0_WIN0_OFFSET,
6144ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V3_BAR0_WIN0_SIZE,
615426a80d4SAdrian Chadd 			.d.dyn = {
616426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V3_BAR0_WIN0_CONTROL,
617426a80d4SAdrian Chadd 			},
6184ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
6194ad7e9b0SAdrian Chadd 		},
6204ad7e9b0SAdrian Chadd 
6214ad7e9b0SAdrian Chadd 		/* bar0+0x1000: configurable backplane window */
6224ad7e9b0SAdrian Chadd 		{
6234ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_DYN,
6244ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V3_BAR0_WIN1_OFFSET,
6254ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V3_BAR0_WIN1_SIZE,
626426a80d4SAdrian Chadd 			.d.dyn = {
627426a80d4SAdrian Chadd 				.cfg_offset = BHNDB_PCI_V3_BAR0_WIN1_CONTROL,
628426a80d4SAdrian Chadd 			},
6294ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
6304ad7e9b0SAdrian Chadd 		},
6314ad7e9b0SAdrian Chadd 
6324ad7e9b0SAdrian Chadd 		/* bar0+0x2000: pcie core registers */
6334ad7e9b0SAdrian Chadd 		{
6344ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
6354ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V3_BAR0_PCIREG_OFFSET,
6364ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V3_BAR0_PCIREG_SIZE,
637426a80d4SAdrian Chadd 			.d.core = {
6384ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_PCIE,
6394ad7e9b0SAdrian Chadd 				.unit	= 0,
6404ad7e9b0SAdrian Chadd 				.port	= 0,
6414ad7e9b0SAdrian Chadd 				.region	= 0,
6424ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
6434ad7e9b0SAdrian Chadd 			},
6444ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
6454ad7e9b0SAdrian Chadd 		},
6464ad7e9b0SAdrian Chadd 
6474ad7e9b0SAdrian Chadd 		/* bar0+0x3000: chipc core registers */
6484ad7e9b0SAdrian Chadd 		{
6494ad7e9b0SAdrian Chadd 			.win_type	= BHNDB_REGWIN_T_CORE,
6504ad7e9b0SAdrian Chadd 			.win_offset	= BHNDB_PCI_V3_BAR0_CCREGS_OFFSET,
6514ad7e9b0SAdrian Chadd 			.win_size	= BHNDB_PCI_V3_BAR0_CCREGS_SIZE,
652426a80d4SAdrian Chadd 			.d.core = {
6534ad7e9b0SAdrian Chadd 				.class	= BHND_DEVCLASS_CC,
6544ad7e9b0SAdrian Chadd 				.unit	= 0,
6554ad7e9b0SAdrian Chadd 				.port	= 0,
6564ad7e9b0SAdrian Chadd 				.region	= 0,
6574ad7e9b0SAdrian Chadd 				.port_type = BHND_PORT_DEVICE
6584ad7e9b0SAdrian Chadd 			},
6594ad7e9b0SAdrian Chadd 			.res		= { SYS_RES_MEMORY, PCIR_BAR(0) }
6604ad7e9b0SAdrian Chadd 		},
6614ad7e9b0SAdrian Chadd 
6624ad7e9b0SAdrian Chadd 		BHNDB_REGWIN_TABLE_END
6634ad7e9b0SAdrian Chadd 	},
6649ed45324SLandon J. Fuller 
6659ed45324SLandon J. Fuller 	.dma_translations = (const struct bhnd_dma_translation[]) {
6669ed45324SLandon J. Fuller 		{
6679ed45324SLandon J. Fuller 			.base_addr	= BHND_PCIE2_DMA64_TRANSLATION,
6689ed45324SLandon J. Fuller 			.addr_mask	= ~BHND_PCIE2_DMA64_MASK,
669*80a7c0f5SLandon J. Fuller 			.addrext_mask	= BHND_PCIE_DMA64_MASK
6709ed45324SLandon J. Fuller 		},
6719ed45324SLandon J. Fuller 		BHND_DMA_TRANSLATION_TABLE_END
6729ed45324SLandon J. Fuller 	}
6734ad7e9b0SAdrian Chadd };
674